@@ -251,53 +251,54 @@ String Sim800L::getOperator()
251
251
}
252
252
253
253
254
- bool Sim800L::calculateLocation ()
255
- {
256
- /*
257
- Type: 1 To get longitude and latitude
258
- Cid = 1 Bearer profile identifier refer to AT+SAPBR
259
- */
260
-
261
- uint8_t type = 1 ;
262
- uint8_t cid = 1 ;
263
-
264
-
265
- this ->print (" AT+CIPGSMLOC=" );
266
- this ->print (type);
267
- this ->print (" ," );
268
- this ->print (cid);
269
- this ->print (" \r " );
270
-
271
-
272
- String data = _readSerial (20000 );
273
-
274
- if (data.indexOf (" ER" )!=(-1 )) return false ;
275
-
276
- uint8_t indexOne;
277
- uint8_t indexTwo;
278
-
279
- indexOne = data.indexOf (" :" ) + 1 ;
280
- indexTwo = data.indexOf (" ," );
281
-
282
- _locationCode = data.substring (indexOne , indexTwo);
283
-
284
- indexOne = data.indexOf (" ," ) + 1 ;
285
- indexTwo = data.indexOf (" ," , indexOne);
286
-
287
- _longitude = data.substring (indexOne , indexTwo);
288
-
289
- indexOne = data.indexOf (" ," , indexTwo) + 1 ;
290
- indexTwo = data.indexOf (" ," , indexOne);
291
-
292
- _latitude = data.substring (indexOne , indexTwo);
293
-
294
- return true ;
295
-
296
- }
297
-
298
- String Sim800L::getLocationCode () {
299
- return _locationCode;
300
- /*
254
+ bool Sim800L::calculateLocation ()
255
+ {
256
+ /*
257
+ Type: 1 To get longitude and latitude
258
+ Cid = 1 Bearer profile identifier refer to AT+SAPBR
259
+ */
260
+
261
+ uint8_t type = 1 ;
262
+ uint8_t cid = 1 ;
263
+
264
+
265
+ this ->print (" AT+CIPGSMLOC=" );
266
+ this ->print (type);
267
+ this ->print (" ," );
268
+ this ->print (cid);
269
+ this ->print (" \r " );
270
+
271
+
272
+ String data = _readSerial (20000 );
273
+
274
+ if (data.indexOf (" ER" )!=(-1 )) return false ;
275
+
276
+ uint8_t indexOne;
277
+ uint8_t indexTwo;
278
+
279
+ indexOne = data.indexOf (" :" ) + 1 ;
280
+ indexTwo = data.indexOf (" ," );
281
+
282
+ _locationCode = data.substring (indexOne, indexTwo);
283
+
284
+ indexOne = data.indexOf (" ," ) + 1 ;
285
+ indexTwo = data.indexOf (" ," , indexOne);
286
+
287
+ _longitude = data.substring (indexOne, indexTwo);
288
+
289
+ indexOne = data.indexOf (" ," , indexTwo) + 1 ;
290
+ indexTwo = data.indexOf (" ," , indexOne);
291
+
292
+ _latitude = data.substring (indexOne, indexTwo);
293
+
294
+ return true ;
295
+
296
+ }
297
+
298
+ String Sim800L::getLocationCode ()
299
+ {
300
+ return _locationCode;
301
+ /*
301
302
Location Code:
302
303
0 Success
303
304
404 Not Found
@@ -307,15 +308,17 @@ String Sim800L::getLocationCode() {
307
308
603 DNS Error
308
309
604 Stack Busy
309
310
65535 Other Error
310
- */
311
+ */
311
312
}
312
313
313
- String Sim800L::getLongitude () {
314
- return _longitude;
314
+ String Sim800L::getLongitude ()
315
+ {
316
+ return _longitude;
315
317
}
316
318
317
- String Sim800L::getLatitude () {
318
- return _latitude;
319
+ String Sim800L::getLatitude ()
320
+ {
321
+ return _latitude;
319
322
}
320
323
321
324
0 commit comments