Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USSD messages truncated too short #121

Open
uwezi opened this issue May 21, 2020 · 0 comments
Open

USSD messages truncated too short #121

uwezi opened this issue May 21, 2020 · 0 comments

Comments

@uwezi
Copy link

uwezi commented May 21, 2020

  • Arduino board: Adafruit Feather 32u4 FONA

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.12

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

When using the example sketch FONAtest for the Adafruit Feather 32u4 FONA I encountered a problem sending the code to charge my sim-card. The message was 20 characters long, and only when sending it for the third time I noticed that the last characters were missing.

This in spite the fact that the test sketch tells the user that the message can be up to 140 characters long.

in Adafruit_FONA.cpp from line #928

char sendcmd[30] = "AT+CUSD=1,\"";
strncpy(sendcmd + 11, ussdmsg, 30 - 11 - 2); // 11 bytes beginning, 2 bytes for close quote + null
sendcmd[strlen(sendcmd)] = '\"';

needs to be changed because it limits and truncates the message including the AT-command to 30 characters.
In order to allow for 140 character long messages it should be:

char sendcmd[140+11+2] = "AT+CUSD=1,\"";
strncpy(sendcmd + 11, ussdmsg, 140); // 11 bytes beginning, 2 bytes for close quote + null
sendcmd[strlen(sendcmd)] = '\"';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant