Sample code for Mobile Originated SMS message
#include "legato.h"
#include "interfaces.h"
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
le_result_t smsmo_SendMessage
(
const char* destinationPtr,
const char* textPtr
)
{
myMsg = le_sms_Create();
if (!myMsg)
{
LE_ERROR("SMS message creation has failed!");
return LE_FAULT;
}
res = le_sms_SetDestination(myMsg, destinationPtr);
if (res != LE_OK)
{
LE_ERROR("le_sms_SetDestination has failed (res.%d)!", res);
return LE_FAULT;
}
res = le_sms_SetText(myMsg, textPtr);
if (res != LE_OK)
{
LE_ERROR("le_sms_SetText has failed (res.%d)!", res);
return LE_FAULT;
}
res = le_sms_Send(myMsg);
if (res != LE_OK)
{
LE_ERROR("le_sms_Send has failed (res.%d)!", res);
return LE_FAULT;
}
else
{
LE_INFO("\"%s\" has been successfully sent to %s.", textPtr, destinationPtr);
}
le_sms_Delete(myMsg);
return LE_OK;
}