arduino-libraries / GSM

GSM Library for Arduino
http://arduino.cc/
44 stars 38 forks source link

Has a bug when receive pdu SMS. #14

Open ru0 opened 5 years ago

ru0 commented 5 years ago

This lib can't receive chinese sms successfully on arduino mini pro . here is my changes.

set pdu mode in GSM3ShieldV1AccessProvider.cpp

else if(ct==5) { // 5: Wait IFC OK if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp)) { //Delay for SW flow control being active. theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000); // 9: SMS pdu Mode theGSM3ShieldV1ModemCore.setCommandCounter(6); theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGF=0"));

change the debug code

void GSM3CircularBuffer::printCharDebug(uint8_t c) { Serial.print(" [");Serial.print(c);Serial.print("] "); if((c>31)&&(c<127)) Serial.print((char)c); else if(c == 13){ Serial.print('\r'); } else if(c == 10){ Serial.print('\n'); }else{ Serial.print('%'); Serial.print(c); Serial.print('%'); } }

------------------BUG------------------------------

when receive SMS.

66 62> [13] [10] [43] + [67] C [77] M [71] G [76] L [58] : [32] [49] 1 [44] , [49] 1 [44] , [44] , [56] 8 [56] 8 [13] [10] [48] 0 [56] 8 [57] 9 [49] 1 [54] 6 [56] 8 [51] 3 [49] 1 [49] 1 [48] 0 [51] 3 [48] 0 [52] 4 [55] 7 [48] 0 [53] 5 [70] F [48] 0 [50] 2 [52] 4 [49] 1 [50] 2 [65] A [48] 0 [48] 0 [49] 1 [53] 5 [54] 6 [57] 9 [53] 5 [50] 2 [49] 1 [48] 0 [53] 5 [57] 9 [52] 4 [48] 0 [49] 1 [49] 1 [54] 6 [54] 6 [56] 8 [48] 0 [48] 0 [48] 0 [56] 8 [56] 8 [49] 1 [49] 1 [49] 1 [48] 0 [50] 2 [49] 1 [50] 2 [52] 4 [49] 1 [57] 9 [53] 5 [50] 2 [51] 3 [52] 4 [50] 2 [51] 3 [48] 0 [49] 1 [48] 0 [53] 5 [70] F [65] A [69] E [55] 7 [54] 6 [68] D [70] F [51] 3 [48] 0 [49] 1 [49] 1 [48] 0 [48] 0 [51] 3 [55] 7 [48] 0 [48] 0 [51] 3 [55] 7 [48] 0 [48] 0 [51] 3 [57] 9 [48] 0 [48] 0 [51] 3 [57] 9 [70] F [70] F [48] 0 [56] 8 [48] 0 [48] 0 [51] 3 [49] 1 [48] 0 [48] 0 [34] " [48] 0

chop start head,tail=66,62 chop stop head,tail=74,62 Receive a message. extractSubstring: chop start head,tail=74,62 chop stop head,tail=84,62 0891683110304705F02412A00156952105940116680008811102124195234230105FAE76DF30110037003700390039FF08003100"05206949F518567096548FF09FF0C8BF74E0D89815C0677ED4FE19A8C8BC17801900F97327ED94ED64EBA3002

sms text has a bug after 103 string ,such as ".

the correct string is below: 0891683110304705F02412A00156952105940116680008811102124195234230105FAE76DF30110037003700390039FF08003100405206949F518567096548FF09FF0C8BF74E0D89815C0677ED4FE19A8C8BC17801900F97327ED94ED64EBA3002