and I can receive SMS and its information(sender no,sms text etc) in the SmsHandler.
My problem is that when I am trying to send SMS by
adl_smsSend( (u8)SMSHDL, SmsTel, SmsText, ADL_SMS_MODE_TEXT );
(where SmsTel and SmsText are two string arrays)
it is alyays returning ADL_RET_ERR_BAD_STATE and SMS is not sent.
But When I tried to send SMS with AT+CMGS to a particular number it is fine then.
Please help me to send sms using ADL.
I have used the adl_simSubscribe() API.But the datahandler of this API is not even called as I am getting no responses from the datahandler as mensioned in the ADL user guide.Bt still I am getting responses from the datahandler of adl_smsSubscribe when some SMS is received and I can alsosend SMS with AT commands(AT+CMGS).
If the sim is not subscribed properly then how I am getting the later responses?
I am using NULL as the PIN in adl_simSubscribe() as I got no specific PIN for my airtel connection.But I am still getting
CPIN:OK when I am issuing AT+CPIN?
Error code -8 (ADL_RET_ERR_BAD_STATE) is returned by adl_smsSend API in the following cases.
• When the initialization of the Wireless CPU is not complete
• When another SMS is being sent at that time.
For the first case, it’s recommended to execute this API in application only after WIND:4 is received.
In case the application has subscribed for the SIM event then it should be sent after event “SIM state of 3” (Full initialization complete).
For the second case (which seems to be the one faced by you), you need to be sure that there is no SMS being sent at the same time. If you are planaing to send several SMS in a short time, it’s recommended to use AT+CMMS command.
The behaviour could also occur because when an SMS is being sent another command should not be sent from the external application. This case could be prevented after implementing the following steps :
After “adl_smsSend ()” API is called, block all AT commands by doing a CMD Subscribe. This can be done using the following statement:
If any AT command is received, in the “adl_atCmdSubscribe ()” API callback handler, return “+CME ERROR: 515”. This informs the external application that the Open AT® Library is busy processing a command
After “ADL_SMS_EVENT_SENDING_OK” or “ADL_SMS_EVENT_SENDING_ERROR” event is received in the callback handler, perform “adl_atCmdUnSubscribe()” to unblock AT command from the external application.
This procedure prevents the error -8 (ADL_RET_ERR_BAD_STATE). It must also be noted that no command should be created (using adl_atCmdCreate () API) until the Wireless CPU has received an event pertaining to the SMS which is being sent. In other words, between steps 1 and 3, no command should be created using adl_atCmdCreate () API. This API should be used only after you receive an ADL_SMS_EVENT_SENDING_OK” or “ADL_SMS_EVENT_SENDING_ERROR” event in the callback handler.
Thanks Awneil for your quick answer. I’ve sent you a personal message only to be sure that you will read it as soon as possible. I will post this at the “Shareware -> Sample Applications -> Problem with adl_smsSend” topic.
I’m refering to the problem with the adl_smsSend function which keeps returning ADL_RET_ERR_BAD_STATE.
I’ve found out that my modem (Q24PL001, OpenAT V3.16) does not receive the ADL_SIM_EVENT_FULL_INIT event. Further more, it doesn’t receive any +WIND events after WOPEN=1, although I’m subscribing to them. Do you have any idea what might be wrong?
I’ve used adl_adRecompact function at the beginning of OpenAt application (after every reset/power on) and the WIND:4 indication and the full sim card init indication both came back. Now I can use adl_smsSend with no problem.