@@ -142,8 +142,8 @@ bool Sim800L::setSleepMode(bool state)
142142
143143 _sleepMode = state;
144144
145- if (_sleepMode) this ->print (F (" AT+CSCLK=1\r\n " ));
146- else this ->print (F (" AT+CSCLK=0\r\n " ));
145+ if (_sleepMode) this ->SoftwareSerial :: print (F (" AT+CSCLK=1\r\n " ));
146+ else this ->SoftwareSerial :: print (F (" AT+CSCLK=0\r\n " ));
147147
148148 if ( (_readSerial ().indexOf (" ER" )) == -1 )
149149 {
@@ -175,13 +175,13 @@ bool Sim800L::setFunctionalityMode(uint8_t fun)
175175 switch (_functionalityMode)
176176 {
177177 case 0 :
178- this ->print (F (" AT+CFUN=0\r\n " ));
178+ this ->SoftwareSerial :: print (F (" AT+CFUN=0\r\n " ));
179179 break ;
180180 case 1 :
181- this ->print (F (" AT+CFUN=1\r\n " ));
181+ this ->SoftwareSerial :: print (F (" AT+CFUN=1\r\n " ));
182182 break ;
183183 case 4 :
184- this ->print (F (" AT+CFUN=4\r\n " ));
184+ this ->SoftwareSerial :: print (F (" AT+CFUN=4\r\n " ));
185185 break ;
186186 }
187187
@@ -211,7 +211,7 @@ bool Sim800L::setPIN(String pin)
211211
212212 // Can take up to 5 seconds
213213
214- this ->print (command);
214+ this ->SoftwareSerial :: print (command);
215215
216216 if ( (_readSerial (5000 ).indexOf (" ER" )) == -1 )
217217 {
@@ -225,7 +225,7 @@ bool Sim800L::setPIN(String pin)
225225
226226String Sim800L::getProductInfo ()
227227{
228- this ->print (" ATI\r " );
228+ this ->SoftwareSerial :: print (" ATI\r " );
229229 return (_readSerial ());
230230}
231231
@@ -235,7 +235,7 @@ String Sim800L::getOperatorsList()
235235
236236 // Can take up to 45 seconds
237237
238- this ->print (" AT+COPS=?\r " );
238+ this ->SoftwareSerial :: print (" AT+COPS=?\r " );
239239
240240 return _readSerial (45000 );
241241
@@ -244,7 +244,7 @@ String Sim800L::getOperatorsList()
244244String Sim800L::getOperator ()
245245{
246246
247- this ->print (" AT+COPS ?\r " );
247+ this ->SoftwareSerial :: print (" AT+COPS ?\r " );
248248
249249 return _readSerial ();
250250
@@ -262,11 +262,11 @@ bool Sim800L::calculateLocation()
262262 uint8_t cid = 1 ;
263263
264264
265- this ->print (" AT+CIPGSMLOC=" );
266- this ->print (type);
267- this ->print (" ," );
268- this ->print (cid);
269- this ->print (" \r " );
265+ this ->SoftwareSerial :: print (" AT+CIPGSMLOC=" );
266+ this ->SoftwareSerial :: print (type);
267+ this ->SoftwareSerial :: print (" ," );
268+ this ->SoftwareSerial :: print (cid);
269+ this ->SoftwareSerial :: print (" \r " );
270270
271271
272272 String data = _readSerial (20000 );
@@ -336,10 +336,10 @@ void Sim800L::reset()
336336 delay (1000 );
337337 // wait for the module response
338338
339- this ->print (F (" AT\r\n " ));
339+ this ->SoftwareSerial :: print (F (" AT\r\n " ));
340340 while (_readSerial ().indexOf (" OK" )==-1 )
341341 {
342- this ->print (F (" AT\r\n " ));
342+ this ->SoftwareSerial :: print (F (" AT\r\n " ));
343343 }
344344
345345 // wait for sms ready
@@ -358,7 +358,7 @@ void Sim800L::setPhoneFunctionality()
358358 4 Disable phone both transmit and receive RF circuits.
359359 <rst> 1 Reset the MT before setting it to <fun> power level.
360360 */
361- this ->print (F (" AT+CFUN=1\r\n " ));
361+ this ->SoftwareSerial :: print (F (" AT+CFUN=1\r\n " ));
362362}
363363
364364
@@ -377,37 +377,37 @@ String Sim800L::signalQuality()
377377 subclause 7.2.4
378378 99 Not known or not detectable
379379 */
380- this ->print (F (" AT+CSQ\r\n " ));
380+ this ->SoftwareSerial :: print (F (" AT+CSQ\r\n " ));
381381 return (_readSerial ());
382382}
383383
384384
385385void Sim800L::activateBearerProfile ()
386386{
387- this ->print (F (" AT+SAPBR=3,1,\" CONTYPE\" ,\" GPRS\" \r\n " ));
387+ this ->SoftwareSerial :: print (F (" AT+SAPBR=3,1,\" CONTYPE\" ,\" GPRS\" \r\n " ));
388388 _buffer=_readSerial (); // set bearer parameter
389- this ->print (F (" AT+SAPBR=3,1,\" APN\" ,\" internet\" \r\n " ));
389+ this ->SoftwareSerial :: print (F (" AT+SAPBR=3,1,\" APN\" ,\" internet\" \r\n " ));
390390 _buffer=_readSerial (); // set apn
391- this ->print (F (" AT+SAPBR=1,1 \r\n " ));
391+ this ->SoftwareSerial :: print (F (" AT+SAPBR=1,1 \r\n " ));
392392 delay (1200 );
393393 _buffer=_readSerial (); // activate bearer context
394- this ->print (F (" AT+SAPBR=2,1\r\n " ));
394+ this ->SoftwareSerial :: print (F (" AT+SAPBR=2,1\r\n " ));
395395 delay (3000 );
396396 _buffer=_readSerial (); // get context ip address
397397}
398398
399399
400400void Sim800L::deactivateBearerProfile ()
401401{
402- this ->print (F (" AT+SAPBR=0,1\r\n " ));
402+ this ->SoftwareSerial :: print (F (" AT+SAPBR=0,1\r\n " ));
403403 delay (1500 );
404404}
405405
406406
407407
408408bool Sim800L::answerCall ()
409409{
410- this ->print (F (" ATA\r\n " ));
410+ this ->SoftwareSerial :: print (F (" ATA\r\n " ));
411411 // Response in case of data call, if successfully connected
412412 if ( (_readSerial ().indexOf (" ER" )) == -1 )
413413 {
@@ -421,9 +421,9 @@ bool Sim800L::answerCall()
421421
422422void Sim800L::callNumber (char * number)
423423{
424- this ->print (F (" ATD" ));
425- this ->print (number);
426- this ->print (F (" \r\n " ));
424+ this ->SoftwareSerial :: print (F (" ATD" ));
425+ this ->SoftwareSerial :: print (number);
426+ this ->SoftwareSerial :: print (F (" \r\n " ));
427427}
428428
429429
@@ -439,7 +439,7 @@ uint8_t Sim800L::getCallStatus()
439439 4 Call in progress
440440
441441 */
442- this ->print (F (" AT+CPAS\r\n " ));
442+ this ->SoftwareSerial :: print (F (" AT+CPAS\r\n " ));
443443 _buffer=_readSerial ();
444444 return _buffer.substring (_buffer.indexOf (" +CPAS: " )+7 ,_buffer.indexOf (" +CPAS: " )+9 ).toInt ();
445445
@@ -449,7 +449,7 @@ uint8_t Sim800L::getCallStatus()
449449
450450bool Sim800L::hangoffCall ()
451451{
452- this ->print (F (" ATH\r\n " ));
452+ this ->SoftwareSerial :: print (F (" ATH\r\n " ));
453453 _buffer=_readSerial ();
454454 if ( (_buffer.indexOf (" ER" )) == -1 )
455455 {
@@ -466,16 +466,16 @@ bool Sim800L::sendSms(char* number,char* text)
466466
467467 // Can take up to 60 seconds
468468
469- this ->print (F (" AT+CMGF=1\r " )); // set sms to text mode
469+ this ->SoftwareSerial :: print (F (" AT+CMGF=1\r " )); // set sms to text mode
470470 _buffer=_readSerial ();
471- this ->print (F (" AT+CMGS=\" " )); // command to send sms
472- this ->print (number);
473- this ->print (F (" \"\r " ));
471+ this ->SoftwareSerial :: print (F (" AT+CMGS=\" " )); // command to send sms
472+ this ->SoftwareSerial :: print (number);
473+ this ->SoftwareSerial :: print (F (" \"\r " ));
474474 _buffer=_readSerial ();
475- this ->print (text);
476- this ->print (" \r " );
475+ this ->SoftwareSerial :: print (text);
476+ this ->SoftwareSerial :: print (" \r " );
477477 _buffer=_readSerial ();
478- this ->print ((char )26 );
478+ this ->SoftwareSerial :: print ((char )26 );
479479 _buffer=_readSerial (60000 );
480480 // expect CMGS:xxx , where xxx is a number,for the sending sms.
481481 if ( (_buffer.indexOf (" ER" )) == -1 )
@@ -511,13 +511,13 @@ String Sim800L::readSms(uint8_t index)
511511
512512 // Can take up to 5 seconds
513513
514- this ->print (F (" AT+CMGF=1\r " ));
514+ this ->SoftwareSerial :: print (F (" AT+CMGF=1\r " ));
515515
516516 if (( _readSerial (5000 ).indexOf (" ER" )) ==-1 )
517517 {
518- this ->print (F (" AT+CMGR=" ));
519- this ->print (index);
520- this ->print (" \r " );
518+ this ->SoftwareSerial :: print (F (" AT+CMGR=" ));
519+ this ->SoftwareSerial :: print (index);
520+ this ->SoftwareSerial :: print (" \r " );
521521 _buffer=_readSerial ();
522522 if (_buffer.indexOf (" CMGR:" )!=-1 )
523523 {
@@ -534,7 +534,7 @@ bool Sim800L::delAllSms()
534534{
535535 // Can take up to 25 seconds
536536
537- this ->print (F (" at+cmgda=\" del all\"\n\r " ));
537+ this ->SoftwareSerial :: print (F (" at+cmgda=\" del all\"\n\r " ));
538538 _buffer=_readSerial (25000 );
539539 if ( (_buffer.indexOf (" ER" )) == -1 )
540540 {
@@ -548,13 +548,13 @@ bool Sim800L::delAllSms()
548548
549549void Sim800L::RTCtime (int *day,int *month, int *year,int *hour,int *minute, int *second)
550550{
551- this ->print (F (" at+cclk?\r\n " ));
551+ this ->SoftwareSerial :: print (F (" at+cclk?\r\n " ));
552552 // if respond with ERROR try one more time.
553553 _buffer=_readSerial ();
554554 if ((_buffer.indexOf (" ERR" ))!=-1 )
555555 {
556556 delay (50 );
557- this ->print (F (" at+cclk?\r\n " ));
557+ this ->SoftwareSerial :: print (F (" at+cclk?\r\n " ));
558558 }
559559 if ((_buffer.indexOf (" ERR" ))==-1 )
560560 {
@@ -571,7 +571,7 @@ void Sim800L::RTCtime(int *day,int *month, int *year,int *hour,int *minute, int
571571// Get the time of the base of GSM
572572String Sim800L::dateNet ()
573573{
574- this ->print (F (" AT+CIPGSMLOC=2,1\r\n " ));
574+ this ->SoftwareSerial :: print (F (" AT+CIPGSMLOC=2,1\r\n " ));
575575 _buffer=_readSerial ();
576576
577577 if (_buffer.indexOf (" OK" )!=-1 )
@@ -627,7 +627,7 @@ bool Sim800L::updateRtc(int utc)
627627 }
628628 // for debugging
629629 // Serial.println("at+cclk=\""+dt.substring(2,4)+"/"+dt.substring(5,7)+"/"+tmp_day+","+tmp_hour+":"+tm.substring(3,5)+":"+tm.substring(6,8)+"-03\"\r\n");
630- this ->print (" at+cclk=\" " +dt.substring (2 ,4 )+" /" +dt.substring (5 ,7 )+" /" +tmp_day+" ," +tmp_hour+" :" +tm.substring (3 ,5 )+" :" +tm.substring (6 ,8 )+" -03\"\r\n " );
630+ this ->SoftwareSerial :: print (" at+cclk=\" " +dt.substring (2 ,4 )+" /" +dt.substring (5 ,7 )+" /" +tmp_day+" ," +tmp_hour+" :" +tm.substring (3 ,5 )+" :" +tm.substring (6 ,8 )+" -03\"\r\n " );
631631 if ( (_readSerial ().indexOf (" ER" ))!=-1 )
632632 {
633633 return true ;
@@ -647,18 +647,18 @@ String Sim800L::_readSerial()
647647
648648 uint64_t timeOld = millis ();
649649
650- while (!this ->available () && !(millis () > timeOld + TIME_OUT_READ_SERIAL))
650+ while (!this ->SoftwareSerial :: available () && !(millis () > timeOld + TIME_OUT_READ_SERIAL))
651651 {
652652 delay (13 );
653653 }
654654
655655 String str;
656656
657- while (this ->available ())
657+ while (this ->SoftwareSerial :: available ())
658658 {
659- if (this ->available ()>0 )
659+ if (this ->SoftwareSerial :: available ()>0 )
660660 {
661- str += (char ) this ->read ();
661+ str += (char ) this ->SoftwareSerial :: read ();
662662 }
663663 }
664664
@@ -671,18 +671,18 @@ String Sim800L::_readSerial(uint32_t timeout)
671671
672672 uint64_t timeOld = millis ();
673673
674- while (!this ->available () && !(millis () > timeOld + timeout))
674+ while (!this ->SoftwareSerial :: available () && !(millis () > timeOld + timeout))
675675 {
676676 delay (13 );
677677 }
678678
679679 String str;
680680
681- while (this ->available ())
681+ while (this ->SoftwareSerial :: available ())
682682 {
683- if (this ->available ()>0 )
683+ if (this ->SoftwareSerial :: available ()>0 )
684684 {
685- str += (char ) this ->read ();
685+ str += (char ) this ->SoftwareSerial :: read ();
686686 }
687687 }
688688
0 commit comments