I need to send sms with some data.
I use pppos internet connection, and sometimes send data throw sms.
My code
char command[] = {(char)26};
struct mgos_pppos_cmd cmds[] = {
{.cmd = "AT+CMGF=1\r"},
{.cmd = "AT+CMGS=\"+375441234567\"\r"},
{.cmd = "Test message"},
{.cmd = command, .cb = sms_send_cb, .cb_arg = NULL},
{.cmd = NULL},
};
mgos_pppos_run_cmds(0, cmds);
the result is:
[Sep 7 15:25:46.088] mgos_net.c:89 PPP: connecting
[Sep 7 15:25:48.584] mgos_pppos.c:678 Connecting (UART2, APN ‘mts’)…
[Sep 7 15:25:48.590] mgos_pppos.c:712 Trying to connect to 25702,MTS
[Sep 7 15:25:48.595] mgos_mongoose.c:66 New heap free LWM: 186448
[Sep 7 15:25:50.282] mgos_pppos.c:285 SIM800 R14.18, IMEI: 861445032315017
[Sep 7 15:25:50.288] mgos_mongoose.c:66 New heap free LWM: 186356
[Sep 7 15:25:50.591] mgos_pppos.c:355 SIM is ready, IMSI: 257027015225845, ICCID: 89375027010052258454
[Sep 7 15:25:50.597] mgos_mongoose.c:66 New heap free LWM: 186244
[Sep 7 15:25:59.078] mgos_pppos.c:415 Connected to mobile network (home)
[Sep 7 15:25:59.477] mgos_pppos.c:468 Operator: 25702,MTS
[Sep 7 15:25:59.576] mgos_pppos.c:477 RSSI: -55
[Sep 7 15:25:59.778] mgos_pppos.c:828 Starting PPP, user ‘mts’
[Sep 7 15:25:59.784] mgos_mongoose.c:66 New heap free LWM: 178672
[Sep 7 15:25:59.787] mgos_net.c:93 PPP: connected
[Sep 7 15:25:59.798] mgos_mongoose.c:66 New heap free LWM: 175664
[Sep 7 15:25:59.804] mgos_mongoose.c:66 New heap free LWM: 175560
[Sep 7 15:26:01.707] mgos_net.c:104 PPP: ready, IP 10.69.98.37, GW 192.168.254.254, DNS 134.17.1.1, NTP 0.0.0.0
And after, when device tries to send sms, I see these messages:
[Sep 7 15:29:48.059] main.c:82 Sending SMS…
[Sep 7 15:29:52.622] mgos_pppos.c:754 Command timed out: AT+CMGS=“+375441234567”
[Sep 7 15:29:59.531] mongoose.c:12127 Failed to resolve ‘time.google.com’, server 134.17.1.1
[Sep 7 15:29:59.539] mgos_mongoose.c:66 New heap free LWM: 175512
[Sep 7 15:30:01.975] mgos_mongoose.c:66 New heap free LWM: 174324
[Sep 7 15:30:02.981] mongoose.c:12127 Failed to resolve ‘time.google.com’, server 134.17.1.1
[Sep 7 15:30:09.992] mongoose.c:12127 Failed to resolve ‘time.google.com’, server 134.17.1.1
[Sep 7 15:30:25.980] mongoose.c:12127 Failed to resolve ‘time.google.com’, server 134.17.1.1
[Sep 7 15:30:33.974] mgos_pppos.c:210 Error 9 (phase 0), reconnect
[Sep 7 15:30:33.977] mgos_net.c:89 PPP: connecting
[Sep 7 15:30:36.478] mgos_pppos.c:678 Connecting (UART2, APN ‘mts’)…
[Sep 7 15:30:36.483] mgos_pppos.c:712 Trying to connect to 25702,MTS
[Sep 7 15:30:38.567] mgos_pppos.c:754 Command timed out: AT
[Sep 7 15:30:38.572] mgos_net.c:89 PPP: connecting
[Sep 7 15:30:40.977] mgos_pppos.c:678 Connecting (UART2, APN ‘mts’)…
[Sep 7 15:30:40.983] mgos_pppos.c:712 Trying to connect to 25702,MTS
[Sep 7 15:30:43.068] mgos_pppos.c:754 Command timed out: AT
[Sep 7 15:30:43.072] mgos_net.c:89 PPP: connecting
[Sep 7 15:30:45.478] mgos_pppos.c:678 Connecting (UART2, APN ‘mts’)…
[Sep 7 15:30:45.483] mgos_pppos.c:712 Trying to connect to 25702,MTS
[Sep 7 15:30:47.566] mgos_pppos.c:754 Command timed out: AT
etc…
And the network disappears…
Sms is not coming.
After sending sms I need reconnect to again.
How can I implement this?