Async SMS Send no callback is triggered (le_sms_SendAsync)

Hi

I had 3 days of Legato under my belt and am stuck. Has anyone used the Async SMS Sending successfully, w.r.t. to the callback function?

result = le_sms_SendAsync(msgRef, smsCallback, NULL);

The SMS does get sent to a mobile successfully but the call back function is never called. The callback is defined as follows

void smsCallback(le_sms_MsgRef_t msgRef, le_sms_Status_t status,void *contextPtr)
{

}

The documentation also talks about le_sms_setTimeout, but this function does not exist.
le_sms_Send was as expected, blocking, can anyone help with async operation with callback, has anyone got this working?

Thanks in advance.

Hi Flav,

Just tried and seems working for me.

Jun 12 01:42:39 swi-mdm9x28 user.debug Legato: DBUG | helloWorld[2802]/framework T=main | le_sms_client.c le_sms_Create() 1035 | Sending message to server and waiting for response : 0 bytes sent
Jun 12 01:42:39 swi-mdm9x28 user.debug Legato: DBUG | helloWorld[2802]/framework T=main | le_sms_client.c le_sms_SetDestination() 1214 | Sending message to server and waiting for response : 16 bytes sent
Jun 12 01:42:39 swi-mdm9x28 user.debug Legato: DBUG | helloWorld[2802]/framework T=main | le_sms_client.c le_sms_SetText() 1308 | Sending message to server and waiting for response : 13 bytes sent
Jun 12 01:42:39 swi-mdm9x28 user.debug Legato: DBUG | helloWorld[2802]/framework T=main | le_sms_client.c le_sms_SendAsync() 1877 | Sending message to server and waiting for response : 8 bytes sent
Jun 12 01:42:44 swi-mdm9x28 user.info Legato: INFO | helloWorld[2802]/helloComponent T=main | helloWorld.c CallbackTestHandler() 19 | Message 0x10000001, status 4, ctx (nil)

Below my test code:

static void CallbackTestHandler
(
le_sms_MsgRef_t msgRef,
le_sms_Status_t status,
void* contextPtr
)
{
LE_INFO(“Message %p, status %d, ctx %p”, msgRef, status, contextPtr);
le_sms_Delete(msgRef);
}

COMPONENT_INIT
{
le_sms_MsgRef_t myMsg;
myMsg = le_sms_Create();
le_sms_SetDestination(myMsg, “91234567”);
le_sms_SetText(myMsg, “hello”);
le_sms_SendAsync(myMsg, CallbackTestHandler, NULL);
}

Not sure the problem, maybe we can find something from debug legato log?

cm info
cm radio
log level debug
logread -f
(run you app)

Hope it helps.
Thx

Hi lotam

Thank you for the confirmation. So I had two problems. First I was calling le_sms_Delete(msgRef) after the le_sms_SendAsync and second somehow the le_sms_SendAsync is running on different thread that I created, I think from my own linux timer (non-legato timer).

If I use your code as is, then all works well. I’m struggling to get to grips with a component that has no main loop so created a thread to counteract that, but guess I’m going down wrong path… need to play a bit more, thanks again for confirming. I’ll ask about polling for( ; ; ) on a different post if I don’t come right.

Thanks again!