Sms automation problem


hi ,

the following is my code . working in Q2687 . My code can able to receive the message but after the timer the message sending to the number is not performed . I have tried many a times can anyone reply what is the problem.

#include “adl_global.h”

const u16 wm_apmCustomStackSize = 1024*3;
bool SMS_AUTO_Handler(ascii *SmsTel, ascii *SmsTimeLength, ascii *SmsText);
void SMS_AUTO_ctrl_Handler(u8 Event, u16 nb);
void envoi_sms(u8 ID, void * Context);

char Bufferdebug[ 200 ];
char Buffer[ 300 ];

s32 sms_automaton_Handle_txt;

bool SMS_AUTO_Handler(ascii *SmsTel, ascii *SmsTimeLength, ascii *SmsText)
	adl_atSendResponse(1, " IN SMS data handler");
	adl_atSendResponse(ADL_AT_RSP, "\r\nSMS Phone Number: ");
	adl_atSendResponse(ADL_AT_RSP, SmsTel);
	adl_atSendResponse(ADL_AT_RSP, "\r\n");
	adl_atSendResponse(ADL_AT_RSP, "\r\nSMS Time: ");
	adl_atSendResponse(ADL_AT_RSP, SmsTimeLength);
	adl_atSendResponse(ADL_AT_RSP, "\r\n");
	adl_atSendResponse(ADL_AT_RSP, "\r\nSMS Text: ");
	adl_atSendResponse(ADL_AT_RSP, SmsText);
	adl_atSendResponse(ADL_AT_RSP, "\r\n");
	return TRUE;

void SMS_AUTO_ctrl_Handler(u8 Event, u16 nb)

	return ;


void envoi_sms(u8 ID, void * Context)
   static int compte = 0;
   int a;
   wm_sprintf ( Buffer, "Sms n°%d: \r\n", compte );
   a = adl_smsSend(sms_automaton_Handle_txt, "recepient number", Buffer, ADL_SMS_MODE_TEXT);
   wm_sprintf ( Buffer," smsSend = %d: \r\n", a );
    printf("Value: %s",Buffer);
   adl_atSendResponse ( ADL_AT_UNS, Bufferdebug );

void adl_main ( adl_InitType_e  InitType )
    adl_atSendResponse( 1, "Embedded : Appli Init" );
    adl_atSendResponse ( ADL_AT_UNS, "\r\nApp Begin\r\n" );
    sms_automaton_Handle_txt = adl_smsSubscribe(SMS_AUTO_Handler, SMS_AUTO_ctrl_Handler, ADL_SMS_MODE_TEXT);
    adl_tmrSubscribe ( TRUE, 100, ADL_TMR_TYPE_100MS, envoi_sms );


You haven’t checked any of the API call return values!


no i have checked the return values of the API used.


No, the code you posted does not have any checks whatsoever on any API return values!

If you have some other code that does check the return values, what do those values tell you?


Anyway thanks awenil i have solved the problem. The Value iam getting in SmsText is ascii and I am using char Buffer.





It is better practice to subscribe sim before u subscribe for sms.
any ways it worked na.



It’s not the order of subscribing that matters; it’s properly handling the events that’s important - and, in particular, not doing anything that requires the SIM before the SIM is ready!

See: viewtopic.php?f=7&t=3766&hilit=faq+wiki&start=15#p17709