hi
i want to create a program with sdk which sends an sms but i don’t know how!!!
can u please send me an exemple
Look at the “Telemetry” example?
I tried to do with telemetry but i don’t succed can you please tell me wat i do ???
From the information you’ve given, no!
What exactly have you done?
What exactly happened?
Have you ever managed to get anything to build & run successfully?
If not, start with the Tutorial.
well the program is built by debug mode
but the trace i get for sending sms is -8 i don’t know what’s the problem
So you need to get debugging!
Add further TRACE to see exactly where this -8 comes from, and what’s going on in your project…
ascii a[20]=“21622833160”;
ascii b[20]=“salut”;
ascii c[20]=“56”;
s8 s;
s8 h;
bool SMS_TELE_Handler(ascii *SmsTel, ascii *SmsTimeOrLength, ascii *SmsText)
{
return TRUE;
}
void SMS_TELE_ctrl_Handler ( u8 Event, u16 Nb )
{
// Switch on event
switch ( Event )
{
case ADL_SMS_EVENT_SENDING_OK :
TRACE (( 1, “Report OK” ));
break;
case ADL_SMS_EVENT_SENDING_ERROR :
TRACE (( 1, "Report sending error %d", Nb ));
adl_atSendResponse ( ADL_AT_UNS, "\r\nFailed...\r\n" );
// Check for 512
if ( Nb == 512 )
{
// Please Wait error... retry in 2 seconds
TRACE (( 1, "Retry later..." ));
//adl_tmrSubscribe ( FALSE, 20, ADL_TMR_TYPE_100MS, tele_tmrRetryHandler );
}
break;
}
}
void adl_main ( adl_InitType_e InitType )
{
h=adl_smsSubscribe(SMS_TELE_Handler,SMS_TELE_ctrl_Handler,ADL_SMS_MODE_TEXT);
s=adl_smsSend(h,a,b,ADL_SMS_MODE_TEXT);
TRACE ((1, " Send SMS: %d ", s));
}
this is a code that i try to execute!!
can you please tell me what’s the problem with!!!
the trace is send SMS: -8
So that’s the return value from adl_smsSend, isn’t it?
So we go to the ADL User Guide, and look up adl_smsSend:
Four possible return values are listed - one of them must be -8, mustn’t it…?
oh yes that’s it the problem that this error is: Bad state ->the modem is not ready to send the sms i really don’t know what to do. I try to reset it or init but the problem still the same
You don’t check the return value from adl_smsSubscribe - always a dangerous practice!
The return value might be telling you something…
It’s time to think again: what do you normally do if something is not ready?
Of course - you wait until it is ready!
At the simplest, just wait a bit and try again.
Better, try to determine why it’s not ready; eg, has it registered to the network yet?
I found yesterday (after trying a few different character sets a long time ago to try & fit binary data in the sms msg area), that it wouldn’t send an sms message anymore - though it would receive them fine.
I’d check that your character set is english and encoding is ascii & see if that’s maybe it. It appeared that when I pressed ctrl-z (in the chinese char set) to finish the msg, nothing happened; perhaps because it was a valid character .
Good Luck,
Dave
If you’re using a pre-pay SIM, that could be because you’ve run out of credit!
ah thanks sorry I should have been clearer, my issue was the wrong character set; when I changed it that did fix it & and was able to send fine after that. Took a little while to find that that was my issue though
Dave
You should subscribe to SIM and in CtlrHandler function you must declare adl_smsSend.
No, that’s not true at all!
Subscribing to the SIM service allows you to receive SIM events and, thus, to know when the SIM is ready.
There is no specific need to call adl_smsSend from the SIM event handler - just to make sure that you don’t call it when the SIM is not ready!
-8 means BAD STATE to send an SMS the SIM service has to be subscribed. You should declare in SimHandler at one of the cases preferably ADL_SIM_EVENT_FULL_INIT the function adl_smsSend. I did that and I succeed to send an SMS.
awneil if you don’t belive me, you should try and you will see.
Correct.
Incorrect.
It is entirely possible to send SMS without subscribing the SIM Service!
But, if you do subscribe the SIM Service, it will enable you to know when the SIM is ready for sending SMS!
No, you do not need to have adl_smsSend in your SIM Event handler.
If it suits your particular application to send an SMS as soon as the ADL_SIM_EVENT_FULL_INIT event occurs, then that’s fine - but that is by no means the only way to do it!
I didn’t say that it wouldn’t work - just that it is not the only way to do it.