PLS62W Problems sending SMS from java midlet | Telit Cinterion IoT Developer Community
August 17, 2021 - 10:09am, 3927 views
I am having problems sending SMS from a java midlet. It looks like the modem will not accept the escape character ctrl-z. I am sending this as \032.
The modem is also running ATSJMQTT midlet enabeling MQTT communication.
The ATSJMQTT midlet also seems to block URC's for incoming SMS.
Any hints on solving this??
Regards
Tore
Hello!
Please check the following example of this simple SMS send method. Please note that ctrl-z is sent using char casting.
Please feel free to test it on your side.The isDevGsmRegistered() can be found on install CD in the GsmUtils class from Fota Midlet example (WTK Examples\EclipseSamples\FotaMIDlet\src\com\gemalto\fotamidlet\gsm)
Regarding the ATSJMQTT midlet, I can understand that when ATSJMQTT midlet is not running your first SMS midlet is receiving the URC's correctly? Please also test this scenario if not yet tested.
Best Regards
Wojciech
Hi and thank you for quick reply.
I implemented this code, but it will not run. Program halts as it seems to be forever waiting on ctrl-z. Same result if I disable ATSJMQTT midlet. Other AT commands work fine.
However, if I send SMS commands through USB interface, it works well. See example below.
>>>AT+CMGS=18
AT+CMGS=18
>>>0011000A9174199156240000AA05E8329BFD06
+CMGS: 202
OK
When I disable the ATSJMQTT, URC's are received as normal by my midlet, but not when I enable ATSJMQTT. The ATSJMQTT midlet seem to be reading and deleting the URC, see below
16:07:13.672 -> [ATCommandListener]: '+CIEV: ciphcall,1'
16:07:13.764 -> [ATCommandListener]: '+CMTI: "SM",1' is missing "\n"!
16:07:13.996 -> [SmsHandler]: SMS - Sending usage information to '+47*****
16:07:13.996 -> [SmsHandler]: (*******)
16:07:14.182 -> [SmsHandler]: Waiting for next SMS...
16:07:14.182 -> [ATCommandListener]: '+CIEV: message,1'
16:07:14.182 -> [ATCommandListener]: '+CIEV: message,0'
SW in modem is:
at+cgmr
REVISION 02.000
OK
>>>at+cgmm
at+cgmm
PLS62-W
OK
Hello!
I've sent you right now by mail the sample SMS midlet that was built and tested today, so this example should also work on your side. Please let me know if it will solve the issue.
BR
Wojciech
Hi
I can not find any mail in my inbox,(or any other folder).
Could you please resend or publish here?
Regards
Tore
Hello again.
Problem is partly solved. I was originally trying so send a SMS as a response to an incoming MQTT message. That failed, as the modem was forever waiting on ctr-z.
However, if I create a flag (sendsms) based on the incoming MQTT message, and then send the SMS from another loop based on the sendsms flag, everything works fine.
The problem with incoming SMS remain. Incoming messages are read by the ATSJMQTT midlet and never reach my midlet.
best regards
Tore
Hello,
To be able to receive indications of incoming messages you need to enable them with AT+CNMI command, for instance AT+CNMI=2,1. It seems that ATSJMQTT midlet
must be doing it. These notifications can only be received on one interface or ATCommand instance. So if you do it in your application, ATSJMQTT midlet will not receive them any more (unless it monitors the setting and can set it back).
As for the ctr-z issue it looks strange. Seems a little bit as the implementation issue in your application. Or maybe some timing issue. Do you use the same ATCommand instance in both cases? Is ">" character received before you send the SMS contents and ctr-z?
Best regards,
Bartłomiej
The problem is that the ATSJMQTT midlet is receiving the URC and deleting the SMS, so it can never reach any other midlet. How can that be solved?
For sending SMS: yes, I use the same code and ">" is received as normal in both cases.
Regards
Tore
Hello,
Regarding the notifications - that's how the module is designed - the question is if you need both your application and ATSJMQTT application to receive SMS'es or only your app. The best solution would be to redesign ATSJMQTT or both apps. At least ATSJMQTT ***** to be redesigned if you don't want it to receive SMS'es. And definitely you don't want it to delete them. You may try the ***** with configuring AT+CNMI in your app but if the other MIDlet check the setting and sets back you still cannot be sure. Anyway if you want your app to receive notifications you need to configure AT+CNMI with the ATCommand instance you want to use for receiving the messages.
As for the ctrl-z issue I'm not really sure what the difference is in your app when you send "SMS from another loop". That's why I suspect some implementation error like using another ATCommand instance or something else.
Did you finally receive the app from Wojciech?
BR,
Bartłomiej
Hi and thank you for response.
When I delay the AT+CNMI=2,1 command from my midlet some seconds after startup, URC's are routed to my midlet as normal, and I can now receive and send SMS's from my midlet with ATSJMQTT running.
Another issue: Is it possible to publish MQTT "last will" using ATSJMQTT ??
Best Regards
Tore
Honestly I don't have experience with this application. As I see in the description of AT^SJMQTT command there is probably no way to set last will. But this app is based on the eclipse paho client, so I believe that it should be possible to add this.