vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.95k stars 723 forks source link

TinyGSM making "AT+SAPBR=2,1" call upon server get request seems to fail internally #639

Open Techmokid opened 2 years ago

Techmokid commented 2 years ago

[x ] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module [ ] Bug or problem compiling the library [ x] Bug or issue with library functionality (ie, sending data over TCP/IP) [ x] Question or request for help

What are you working with?

Modem: SIM7000G Main processor board: Arduino Mega 2560 TinyGSM version: 0.11.5 (Latest as of this post) Code: FAR too long to be put here

Hello!

I have been trying to get TinyGSM to work for awhile now, and most of it has juust been debugging my own code. However, I may have come across a bug in the library while diagnosing my code. When I start the SIM7000 and attempt to get data from a server of mine, I get the following output: Public-safe Arduino Output.txt

Now, it seems to fail when calling "AT+SAPBR=2,1". For some reason, the returned data is: +SAPBR: 1,1,"10.132.42.219

Notice the missing quotation mark. Resulting in the inevitable message: [96460] ### Unhandled: +SAPBR: 1,1,"10.132.42.219

2022-02-07 14_24_59-

While my own code is smart enough to detect this failure and try again, this issue always comes up. I do not know why. Something about that dropped quotation mark at the end absolutely CRIPPLES this library in my case. Not sure if this is a known bug or what. I could post my code here if requested, but it is LONG and might end up confusing people more than it would help.

While my code not working is mostly down to just me making mistakes and bugs, this particular issue seems to be fault of the library instead of myself this time. I'm just curious if there is a known fix for this, or if it's a known bug currently being tracked, or what? Hopefully, the solution should be as simple in the library code as "If the response has an odd number of quotation marks, then add one to the end of the incoming char array/string"

Hope to hear from someone about this soon,

Kind regards, Andrey

P.S. Looking back on this question, I seem to have kinda gotten a response from my SIM7000G, but the library refuses to acknowledge it due to something weird going on. This is in the middle of it getting server information: ` AT+SAPBR=3,1,"Contype","GPRS"

OK

AT+SAPBR=3,1,"APN","telstra.wap"

OK

AT+CGDCONT=1,"IP","telstra.wap"

OK

AT+CGATT=1

OK

AT+CGACT=1,1

OK

AT+SAPBR=1,1

OK

AT+SAPBR=2,1

)MQ\x02\x82D\xa8HH\t5UEE\xa5\xa5\x02\x92\x92z\x82\x92z\x82\xc2b\x82\x9a\xd2\xaa\x82\xd2\x8a\xba\x12b\x12Z\x9a\x92\x12b\x82j\n

+SAPBR: 1,1,"100.108.56.79"

[92674] ### Unhandled: )MQ\x02DHH\t5UEE\x02zzb\x12b\x12Z\x12bj\n `

Is returning what I presume to be byte codes like this normal? It doesn't look right to me

fgnievinski commented 1 year ago

I also notice that when issuing the command AT+SAPBR=2,1, the expected response is not just "OK", but more importantly, +SAPBR: <cid>,<Status>,<IP_Addr>: https://github.com/vshymanskyy/TinyGSM/blob/5b83997877c96fe3388f634121d91ed02503728e/src/TinyGsmClientSIM7000.h#L204-L206

OmegaLeWolf commented 3 months ago

Sorry about the bump, any solutions on this?