Thursday, November 1, 2012

SMS 7-bit encoding doubts in Open AT


Right now I'm writing some software for Sierra Wireless GSM Module - Q2687. This application is written with open AT library supported by GSM module vendor and have to handle special characters in SMS messages. I've set text mode for receiving SMS and started sending messages containing characters from basic characters set extension (see GSM 03.38). I was expecting to receive special character encoded according to this table:
It turns out that this characters are encoded completely different. Neither ESCAPE TO EXTENSION TABLE nor that second byte is like in presented table. I found out that encoding is rather like this:

Hex Dec Character name Character
0x20 32 ESCAPE TO EXTENSION TABLE

0x2020 32 32 CIRCUMLFLEX ACCENT ^
0x2028 32 40 LEFT CURLY BRACKET {
0x2029 32 41 RIGHT CURLY BRACKET }
0x202F 32 47 BACKSLASH \
0x203C 32 60 LEFT SQUARE BRACKET [
0x203D 32 61 TILDE ~
0x203E 32 62 RIGHT SQUARE BRACKET ]
0x20AD 32173 VERTICAL BAR |

As you can see - something is definitely not the way it should be. Look at VERTICAL BAR encoding - it isn't event coded on 7 bit characters, so what encoding it is? I don't know yet but I have to simply implement conversion (which is quite easy to code) before I will treat received SMS with cstring functions.
I tested this situation with messages sent with Android-based mobile as also with plain old Nokia C1.

If you are familiar with Open AT you can test it on your own:

void SmsCtrlHandler(u8 Event, u16 Nb)
{

}

bool SmsMessageHandler(ascii * SmsTel, ascii * SmsTimeOrLength, asii * SmsText)
{
u16 i=0;

while(i<strlen(SmsText))
TRACE((1,”SmsText[%d]=0x%X”, i, SmsText[i])); //display received message byte by byte
return FALSE;
}

s8 smsHandler;
smsHandler = ald_smsSubscribe(SmsMessageHandler, SmsCtrlHandler, ADL_SMS_MODE_TEXT);






No comments:

Post a Comment