Some advices about SMS

I am majoring in a project about SMS,to realize the function of send/receive short message(the module I used is Q2406B).But the comprehension about this aspect made me lost,who can give me any example about SMS or give me some other technology help?
thanks a lot!

I also need help about SMS functions in ADL library.

If I try to send to SMS in a short time ADL only sends one of them with success.

Any advice?

You need to wait for the event ADL_SMS_EVENT_SENDING_OK (in SMS Control Handler) before sending another SMS message !

If you don’t do this, then you will have the event ADL_SMS_EVENT_SENDING_ERROR.

Also, try to send AT+CMMS command first (see AT commands user guide). This command allows to send several SMS messages into the same radio link in order to send faster all the SMS messages.

Useful for concatenated messages (EMS, MMS, …).

I also have some problem sending SMS with adl_smsSend function …
I try to write my_smsSend function which send sms when available and queued it when there is already a SMS inprocess …
It works … with right phone number but not with erroneous phone number …

I explain …
with “toto” as phone number parameter function adl_smsSend return an error so it’s OK !
with “+33622222222” adl_smsSend return OK and the callback smsSendCtrlHandler is called with ADL_SMS_EVENT_SENDING_MR and I can process my queue if not empty …

BUT with “33” for example as phone number parameter function adl_smsSend return OK … and callback smsSendCtrlHandler is never called …

What’s wrong with my process ?
How can I know if my phone number is wrong …

Thanks in advance,

       Vincent.

As a sample code is better than a long speech :laughing:

/***************************************************************************/
/*  Local variables                                                        */
/***************************************************************************/
s8 smsHandle;

/***************************************************************************/
/*  Local functions                                                        */
/***************************************************************************/

bool SmsHandler( ascii * SmsTel, ascii * SmsTimeOrLength, ascii * SmsText )
{
	TRACE (( 1, "Incoming SMS Handler" ));
	/* manage your incoming SMS messages here */
	return TRUE;
}

void SmsCtrlHandler( u8 Event, u16 Nb )
{
	TRACE (( 1, "SMS Ctrl Handler : Event=%d / Nb=%d", Event, Nb ));
	switch ( Event )
	{
		case ADL_SMS_EVENT_SENDING_OK:
			TRACE (( 1, "SMS sent with success !" ));
			adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_OK); // answer OK to AT+SMS command
			break;
		case ADL_SMS_EVENT_SENDING_ERROR:
			TRACE (( 1, "Error while trying to send SMS ! Error is #%d", Nb ));
			if ( Nb == 305 )
				TRACE (( 1, "Error #305 = Invalid parameter" ));
  			adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR); // answer ERROR to AT+SMS command
			break;
		case ADL_SMS_EVENT_SENDING_MR:
			TRACE (( 1, "Message reference of the SMS sent is %d", Nb ));
			break;
	}
}

void hdl_atsms( adl_atCmdPreParser_t *params)
{
	s8 result;

	if ( params->Type == ADL_CMD_TYPE_PARA)
	{
		TRACE (( 1, "SMS Destination Address is :" ));
		TRACE (( 1, ADL_GET_PARAM(params, 0) ));
		result = adl_smsSend( smsHandle, ADL_GET_PARAM(params, 0), "HELLO", ADL_SMS_MODE_TEXT );
		switch (result)
		{
			case OK:
				TRACE (( 1, "adl_smsSend : OK" ));
				// don't send the "OK" answer here, but in SmsCtrlHandler
				break;
			case ADL_RET_ERR_PARAM:
				TRACE (( 1, "adl_smsSend : K0 (parameter error)" ));
				adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR);
				break;
			case ADL_RET_ERR_UNKNOWN_HDL:
				TRACE (( 1, "adl_smsSend : K0 (unknown handler)" ));
				adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR);
				break;
			case ADL_RET_ERR_BAD_STATE:
				TRACE (( 1, "adl_smsSend : K0 (not ready to send SMS)" ));
				adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR);
				break;
			default:
				adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR);
		}
	}
	else
		adl_atSendStdResponse( ADL_AT_RSP, ADL_STR_ERROR);
}

/***************************************************************************/
/*  Function   : adl_main                                                  */
/***************************************************************************/
void adl_main ( adl_InitType_e InitType )
{
    TRACE (( 1, "Embedded Application \"SMS_Test\" : Main" ));
	smsHandle = adl_smsSubscribe( SmsHandler, SmsCtrlHandler, ADL_SMS_MODE_TEXT );
	adl_atCmdSubscribe ( "AT+SMS", (adl_atCmdHandler_t) hdl_atsms, ADL_CMD_TYPE_PARA|0x0011 );
	
}

Enter your PIN code (if needed), wait for network registration (+CREG: 1) and then use AT+SMS= command to send “HELLO” message to .

If = “TOTO” the error is catched directly in result of adl_smsSend command.

If = 33 the error is catched by the SmsCtrlHandler.

You’re right …
I had the same code as you … And it works perfectly on Q2406 target …
But not on Q2686 !!!

If = 33 the error is NOT catched by the SmsCtrlHandler on Q2686 Target … Any Idea ?

Is there a bug ?

          Vincent.