Thursday, September 20, 2007

pointer to const memory

char * s = "ab";
memset(s, 0 , strlen(s)); //empy string

This code won't run because s is considered pointer to const char.
As well, this applies on a statement like this:

memcpy(s, "\0\0" , strlen(s));

That's because the compiler first reserved a memory space to hold the value "ab" then it returns to you a pointer to it. i.e. this is not considered intialization of the pointer.
Of course, defining s as an array of characters will be ok, where s will be handled as a normal variable that can be inialized not as pointer to const memory.

Monday, September 17, 2007

receiving an SMS status report message

If you set the status report request TP-SRR bit when sending an SMS-SUBMIT message, you'll receive an SMS-STATUS-REPORT message when it is delivered to the recipient.
To be able to receive this message, set the mode of new message indication as the following:

or just AT+CNMI=,,,1 (as the forth parameter is the one of our concern)
then you'll get the the status report as soon as it is delivered to the recipient:

+CDS: 06000B910221815716F2709021510121807090215101718000

The PDU String consists of the following:
06First octet of this SMS-STATUS-REPORT message.
TP-MR. Message-Reference identifying the previously submitted message.
0BAddress-Length. Length of the sender number (0B hex = 11 dec)
91Type-of-address of the sender number
02 21 81 57 16 F2Sender number (decimal semi-octets), with a trailing F
70 90 21 51 01 21 80TP SCTS. Service Center Time stamp (semi-octets)
70 90 21 51 01 71 80TP DT. Discharge Time (semi-octets)
00TP ST. Status of the previously sent message .