9
9
unsigned long ArduinoCellular::getTime () {
10
10
int year, month, day, hour, minute, second;
11
11
float tz;
12
- modem .getNetworkTime (&year, &month, &day, &hour, &minute, &second, &tz);
12
+ Modem .getNetworkTime (&year, &month, &day, &hour, &minute, &second, &tz);
13
13
return Time (year, month, day, hour, minute, second).getUNIXTimestamp ();
14
14
}
15
15
@@ -21,7 +21,7 @@ ArduinoCellular::~ArduinoCellular() {
21
21
}
22
22
23
23
void ArduinoCellular::begin () {
24
- modem .init ();
24
+ Modem .init ();
25
25
26
26
String modemInfo = this ->sendATCommand (" I" );
27
27
if (modemInfo.indexOf (" EC200A" ) > 0 ){
@@ -33,15 +33,15 @@ void ArduinoCellular::begin() {
33
33
}
34
34
35
35
// Set GSM module to text mode
36
- modem .sendAT (" +CMGF=1" );
37
- modem .waitResponse ();
36
+ Modem .sendAT (" +CMGF=1" );
37
+ Modem .waitResponse ();
38
38
39
- modem .sendAT (GF (" +CSCS=\" GSM\" " ));
40
- modem .waitResponse ();
39
+ Modem .sendAT (GF (" +CSCS=\" GSM\" " ));
40
+ Modem .waitResponse ();
41
41
42
42
// Send intrerupt when SMS has been received
43
- modem .sendAT (" +CNMI=2,1,0,0,0" );
44
- modem .waitResponse ();
43
+ Modem .sendAT (" +CNMI=2,1,0,0,0" );
44
+ Modem .waitResponse ();
45
45
46
46
#if defined(ARDUINO_CELLULAR_BEARSSL)
47
47
ArduinoBearSSL.onGetTime (ArduinoCellular::getTime);
@@ -108,7 +108,7 @@ Geolocation ArduinoCellular::getGPSLocation(unsigned long timeout){
108
108
unsigned long startTime = millis ();
109
109
110
110
while ((latitude == 0.00000 || longitude == 0.00000 ) && (millis () - startTime < timeout)) {
111
- modem .getGPS (&latitude, &longitude);
111
+ Modem .getGPS (&latitude, &longitude);
112
112
delay (1000 );
113
113
}
114
114
@@ -127,7 +127,7 @@ Geolocation ArduinoCellular::getGPSLocation(unsigned long timeout){
127
127
128
128
Time ArduinoCellular::getGPSTime (){
129
129
int year, month, day, hour, minute, second;
130
- modem .getGPSTime (&year, &month, &day, &hour, &minute, &second);
130
+ Modem .getGPSTime (&year, &month, &day, &hour, &minute, &second);
131
131
return Time (year, month, day, hour, minute, second);
132
132
}
133
133
@@ -139,22 +139,22 @@ Time ArduinoCellular::getCellularTime(){
139
139
int minute = 0 ;
140
140
int second = 0 ;
141
141
float tz;
142
- if (modem .NTPServerSync () == 0 ) {
143
- modem .getNetworkTime (&year, &month, &day, &hour, &minute, &second, &tz);
142
+ if (Modem .NTPServerSync () == 0 ) {
143
+ Modem .getNetworkTime (&year, &month, &day, &hour, &minute, &second, &tz);
144
144
}
145
145
return Time (year, month, day, hour, minute, second);
146
146
}
147
147
148
148
149
149
void ArduinoCellular::sendSMS (String number, String message){
150
- modem .sendAT (" +CMGF=1" );
151
- modem .waitResponse (1000 );
152
- modem .sendAT (GF (" +CMGS=\" " ), number, GF (" \" " ));
153
- if (modem .waitResponse (GF (" >" )) != 1 ) { }
154
- modem .stream ->print (message); // Actually send the message
155
- modem .stream ->write (static_cast <char >(0x1A )); // Terminate the message
156
- modem .stream ->flush ();
157
- auto response = modem .waitResponse (10000L );
150
+ Modem .sendAT (" +CMGF=1" );
151
+ Modem .waitResponse (1000 );
152
+ Modem .sendAT (GF (" +CMGS=\" " ), number, GF (" \" " ));
153
+ if (Modem .waitResponse (GF (" >" )) != 1 ) { }
154
+ Modem .stream ->print (message); // Actually send the message
155
+ Modem .stream ->write (static_cast <char >(0x1A )); // Terminate the message
156
+ Modem .stream ->flush ();
157
+ auto response = Modem .waitResponse (10000L );
158
158
159
159
if (this ->debugStream != nullptr ){
160
160
this ->debugStream ->println (" Response: " + String (response));
@@ -163,24 +163,24 @@ void ArduinoCellular::sendSMS(String number, String message){
163
163
164
164
165
165
IPAddress ArduinoCellular::getIPAddress (){
166
- return modem .localIP ();
166
+ return Modem .localIP ();
167
167
}
168
168
169
169
int ArduinoCellular::getSignalQuality (){
170
- return modem .getSignalQuality ();
170
+ return Modem .getSignalQuality ();
171
171
}
172
172
173
173
TinyGsmClient ArduinoCellular::getNetworkClient (){
174
- return ManagedTinyGsmClient (modem );
174
+ return ManagedTinyGsmClient (Modem );
175
175
}
176
176
177
177
HttpClient ArduinoCellular::getHTTPClient (const char * server, const int port){
178
- return HttpClient (* new ManagedTinyGsmClient (modem ), server, port);
178
+ return HttpClient (* new ManagedTinyGsmClient (Modem ), server, port);
179
179
}
180
180
181
181
#if defined(ARDUINO_CELLULAR_BEARSSL)
182
182
HttpClient ArduinoCellular::getHTTPSClient (const char * server, const int port){
183
- auto gsmClient = std::make_unique<ManagedTinyGsmClient>(modem );
183
+ auto gsmClient = std::make_unique<ManagedTinyGsmClient>(Modem );
184
184
auto sslClient = std::make_unique<BearSSLClient>(*gsmClient);
185
185
auto & sslRef = *sslClient;
186
186
@@ -190,7 +190,7 @@ HttpClient ArduinoCellular::getHTTPSClient(const char * server, const int port){
190
190
}
191
191
192
192
BearSSLClient ArduinoCellular::getSecureNetworkClient (){
193
- return BearSSLClient (* new ManagedTinyGsmClient (modem ));
193
+ return BearSSLClient (* new ManagedTinyGsmClient (Modem ));
194
194
}
195
195
#endif
196
196
@@ -209,14 +209,14 @@ size_t ArduinoCellular::getManagedClientCount() const {
209
209
}
210
210
211
211
bool ArduinoCellular::isConnectedToOperator (){
212
- return modem .isNetworkConnected ();
212
+ return Modem .isNetworkConnected ();
213
213
}
214
214
215
215
bool ArduinoCellular::connectToGPRS (const char * apn, const char * gprsUser, const char * gprsPass){
216
216
if (this ->debugStream != nullptr ){
217
217
this ->debugStream ->println (" Connecting to 4G network..." );
218
218
}
219
- while (!modem .gprsConnect (apn, gprsUser, gprsPass)) {
219
+ while (!Modem .gprsConnect (apn, gprsUser, gprsPass)) {
220
220
if (this ->debugStream != nullptr ){
221
221
this ->debugStream ->print (" ." );
222
222
}
@@ -226,11 +226,11 @@ bool ArduinoCellular::connectToGPRS(const char * apn, const char * gprsUser, con
226
226
}
227
227
228
228
bool ArduinoCellular::isConnectedToInternet (){
229
- return modem .isGprsConnected ();
229
+ return Modem .isGprsConnected ();
230
230
}
231
231
232
232
SimStatus ArduinoCellular::getSimStatus (){
233
- int simStatus = modem .getSimStatus ();
233
+ int simStatus = Modem .getSimStatus ();
234
234
if (this ->debugStream != nullptr ){
235
235
this ->debugStream ->println (" SIM Status: " + String (simStatus));
236
236
}
@@ -249,12 +249,12 @@ SimStatus ArduinoCellular::getSimStatus(){
249
249
}
250
250
251
251
bool ArduinoCellular::unlockSIM (String pin){
252
- int simStatus = modem .getSimStatus ();
252
+ int simStatus = Modem .getSimStatus ();
253
253
if (simStatus == SIM_LOCKED) {
254
254
if (this ->debugStream != nullptr ){
255
255
this ->debugStream ->println (" Unlocking SIM..." );
256
256
}
257
- return modem .simUnlock (pin.c_str ());
257
+ return Modem .simUnlock (pin.c_str ());
258
258
}
259
259
else if (simStatus == SIM_ERROR || simStatus == SIM_ANTITHEFT_LOCKED) {
260
260
return false ;
@@ -267,7 +267,7 @@ bool ArduinoCellular::awaitNetworkRegistration(bool waitForever){
267
267
if (this ->debugStream != nullptr ){
268
268
this ->debugStream ->println (" Waiting for network registration..." );
269
269
}
270
- while (!modem .waitForNetwork (waitForNetworkTimeout)) {
270
+ while (!Modem .waitForNetwork (waitForNetworkTimeout)) {
271
271
272
272
if (!waitForever) {
273
273
return false ;
@@ -308,13 +308,13 @@ bool ArduinoCellular::enableGPS(bool assisted){
308
308
return false ;
309
309
}
310
310
311
- return modem .enableGPS ();
311
+ return Modem .enableGPS ();
312
312
}
313
313
314
314
String ArduinoCellular::sendATCommand (const char * command, unsigned long timeout){
315
315
String response;
316
- modem .sendAT (command);
317
- modem .waitResponse (timeout, response);
316
+ Modem .sendAT (command);
317
+ Modem .waitResponse (timeout, response);
318
318
return response;
319
319
}
320
320
@@ -426,7 +426,7 @@ std::vector<SMS> parseSMSData(const String& data) {
426
426
}
427
427
428
428
String ArduinoCellular::sendUSSDCommand (const char * command){
429
- return modem .sendUSSD (command);
429
+ return Modem .sendUSSD (command);
430
430
}
431
431
432
432
std::vector<SMS> ArduinoCellular::getReadSMS (){
0 commit comments