Azure and EXS62-W issues to formate the json string | Telit Cinterion IoT Developer Community
April 8, 2022 - 1:29am, 1744 views
When i try to do this in C :
lteiot9_send_cmd( <eiot9, "AT^SISD=1,\"setParam\",hcContent,\"{ \"batteryLevel\": 50, \"terminalState\": \"Idle\" }\"" );
i get Invalide index.
If i remove the \" around the batterylevel it is accepted, but then Azure dont accept it.
this is the text i wan tto send :
{ "batteryLevel": 50, "terminalState": "Idle" }
Looks like you do the same around "batteryLevel" and "terminalState", so it is interesting that you don't have the same issue with "terminalState".
Maybe you have problem in lteiot9_send_cmd function.
If the app is executed on the module there is also an API for MQTT possible with not AT commands.
Hi, I have simplified it and is now trying to send this :
//#define Topicd_SISD_3 "AT^SISD=1,\"setParam\",\"hcContent\",\"{ \\\"batteryLevel_1\\\" : 54 }\""
//#define Topicd_SISD_3 "AT^SISD=1,\"setParam\",\"hcContent\",\"{\22batteryLevel\22 : 50}\""
#define Topicd_SISD_3 "AT^SISD=1,\"setParam\",\"hcContent\",\"{batteryLevel : 50}\""
all this is accepted, but non is ok for the azure.
The line out for the
AT^SISD=1,"setParam","hcContent","{\"batteryLevel\" : 50}"
OK-----------------------------------
AT^SISD=1,"getParam","hcContent"
^SISD: 1,"hcContent","\1B(\22batteryLevel\22 : 50\1B)"OK
The first i wonder about is the change from { to \1B(
And seccond is how to corectly formate this string to have the modem to send it correct?
Also you mention a API on this. Where do i find this and is this for a embeded mcu like the STM32L4S5 ?
Hello,
The API I mentioned is only possible when the program is executed inside the module, not for an external MCU.
It looks like it is an issue related to character encoding. Have you tried the same manually with some terminal program instead of your STM device?
Do you configure "alphabet" parameter with AT^SISS while configuring the profile? Please set it to 1 and check.
BR,
Bartłomiej
Ok changed the alphabet to 1 and then i did this :
-----------------------------------
AT^SISD=1,"setParam","hcContent","\1B\7B\"batteryLevel\":54\1B\7D"
OK
-----------------------------------
AT^SISD=1,"getParam","hcContent"
^SISD: 1,"hcContent"," \1B(\22batteryLevel\22:54 \1B)"
OK
then i dont get message of disconect but still azure dont like the formate of the string. But i feel it is related to formating of the " and the {} signs that is the issues. Most likely i feel now it related on how to formate the {} correct. the responce from the AT command is changing the 7B and 7D to () and not to {}.
Did you try not to use these escape sequences but just brackets?