Adafruit_FONA icon indicating copy to clipboard operation
Adafruit_FONA copied to clipboard

Add upd support

Open feinstein opened this issue 9 years ago • 3 comments
trafficstars

Corrected several things from master (as explained in the 9734329 commit, copied below), but specially made new TCPIP methods so now it's possible to send data over a UDP or TCP connection. Also I made methods for enabling and disabling the GPRS connection. I don't understand why there is the AT+SAPBR command in the original enable(onoff) method, since the TCPIP manual don't even mentions it. I think these names (enable and disable) make more sense and the code is easier to read, also it's full compliant with the TCPIP Manual. could someone please tell me why there is the AT+SAPBR command in the original method? I never could make it work, and also I can't see the need for it.

My code is tested on UDP connetions (I don't have a TCP socket to test, but I can't see why it should't work too).

All this changes I already had for a couple months, I was just testing them in my project before sending. Some of my modifications were already applied in the library in the past commits, as the lack of AT+CIICR .... but still you need AT+CIFSR.

Feel free to discuss my modifications, I understand merge won't be automatic, since I am in a pretty old common base commit, but I tried to make things easier by applying all your recent commits to my branch.


Commit 9734329 message:

Corrected the timeout of some AT commands (CIPSHUT, SAPBR, CIICR), taking the Max Response Time from the AT Command Manual, but leaving a little bit of safe margin too. Changed some F("OK") left to ok_reply. Fixed the begin method to have the right parameter type. Removed some PSTR left in code since the major re-organization, so there could be better portability. Removed the ADAFRUIT_FONA_DEBUG as "on" as default. I guess most users won't wan't this on at firts, since this only helps coders of the library. Changed all the TCPIP methods. The old ones were left for backward compatibility. Added the hability to have a TCP or a UDP connection. Code is all commented. Added the enableGPRS() and disableGPRS(). The old enableGPRS(onoff) was left for backward compatibility. Changed the way the APN is stored, now all strings are stored in RAM memory so the user can change APN propetries on the fly if needed, without the need to recompile the code (but still can be passed as flash memory strings). Added new string manipulation functions Macros for progmem strings compatibility.


EDIT:

I found out that although the SAPBR commands aren't needed for TCPIP commands, they are needed for the HTTP, FTP, GSM location and maybe other functionalities to work. Added it on the e135e3f commit.

feinstein avatar Jan 22 '16 05:01 feinstein

it will be a while till i do another run at FONA updates - have a large number of other libraries needing updates. but note that i really dont want to merge any code with malloc/free, its just too risky on a 2KB uno. better to have a fixed buffer size for APN details, then strcpy them around?

ladyada avatar Jan 22 '16 17:01 ladyada

Agreed, I don't think also anyone will need more than 100 characters for each of the strings.

I will fix this and push it soon.

feinstein avatar Jan 22 '16 17:01 feinstein

@ladyada fixed.

feinstein avatar Jan 24 '16 23:01 feinstein