SMS service

I am writing a simple “send a hello world text” program to run on the FXT009, using the airprime tutorial chapter 22 (sms).

I have a question about the code example provided:
the sms control handler receives the response from the send sms method, but instead of immediately unsubscribing from the service it starts a timer for 1 second and unsubscribes in the timer handler.

Is this because it may expect a response? (although the sms receive handler does nothing with it) or does it need a delay before unsubscribing.

/* sms control handler captures the events received on SMS sending*/
void SmsCtrlHandler(u8 Event,u16 Nb)
{
s8 sRet;
switch(Event)
{
case ADL_SMS_EVENT_SENDING_OK:
adl_atSendResponse(ADL_AT_RSP,"SMS Sent Successfully");
TRACE((1,"Inside ADL_SMS_EVENT_SENDING_OK EVENT"));
/* if the SMS send is successful, subscribe to timer of short duration and in
the timer handler unsubscribe from the SMS service.*/
adl_tmrSubscribe(FALSE, 10, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t) Timerhdl);
TRACE (( 1, "SMS sent successfully, now unsubscribe" ));
break;
case ADL_SMS_EVENT_SENDING_ERROR:
adl_atSendResponse(ADL_AT_RSP,"error sending sms");
sRet = adl_smsSend(smshandle,telno,smstext,ADL_SMS_MODE_TEXT);
...
...

That’s not quite true.

The send sms “method” simply initiates the process. The response from the send sms “method” just indicates whether the process was initiated or not.

The actual sending is asynchronous, and takes some time - many seconds.

The control event handler receives the events which occur at the end of the sending process.

I find this a major shortcoming of the Tutorial - it doesn’t explain why they do stuff :exclamation:

I suspect that it’s not a good idea to unsubscribe a Service (any Service) whilst you’re actually within a callback of that Service?

To be honest, I don’t see the point of unsubscribing the service at all…