Thanks for your quick answer, but I don’t understand it. The first call to adl_smsSend returns OK immediately. So for which OK do I have to wait and how do I do this? Maybe I should have mentioned that I’m new to this wavecom stuff.
You probably have to wait for the ADL_SMS_EVENT_SENDING_OK event to arrive in your SMS Control Event Handler function before sending a second SMS. The control event handler is configured in your adl_smsSubscribe() function call that is required before sending using and of the SMS api functions.
Remember that ADL is event driven - In general, you subscribe to a service and get a handle back if subscription is successful. At subscription time, you also usually get the opportunity to register an event call-back function that will be called whenever an event occurs. Once finished with the service, you unsubscribe from it.
I notice in your code that you are using a handle of 0 in the adl_smsSend() function call. This indicates to me that you haven’t subscribed to the service properly - and I’m surprised that you were able to send an SMS at all.
Have a close look at the SMS automation sample provided with OpenAT.
Are you confusing OK as a return code from an API function with the string “OK” returned by an AT command?
The OK return code from the adl_smsSend API function simply indicates that the command has been accepted - as davidc notes, you have to wait for an event to show when the operation completes…
I propose you to make a queue for the outgoing SMS. When you want to send an SMS you put it (with the phone number) in the queue. You may only eliminate the SMS when you recieve an ADL_SMS_EVENT_SENDING_OK, at this moment you may also send the next one. It’s the best way if you need to send a lot of SMS “at the same time”.
I also recomend an attempt counter, to limit the number of times you try to send the same message. If you don’t do that you may block your “wireless CPU”.
Be carefull also with the situations in which you’re not connected to the net (checked with AT+CREG).
I am talking specifically about ADL Queue facility
my question is,
I am receiving the contact numbers through text and storing it to flash memory, whenever there is a change in state of GPIO21/25, I am reading the contacts from flash and sending text messages. I am able to send text to only one contact. when I tried to send to other contacts (by reading from flash, adl_smsSend(handle, read_flash, “hi”, Text)) in sms control handler, I started receiving “hi” continuously (until I stop the running application but when I tried adl_smsSend(handle, “123456789”, “hi”, Text) , I received the text only once.
even I tried with AT+CMMS but it doesnt worked for me.
Can you please suggest better way to send text to multiple contacts?
So you’re just sending the same message to a list of 5 recipients?
If so, I don’t see any reason to complicate this with queues and stuff - just step through the list of destination numbers!
What you need to do, for each destination, is to send the message and then wait until you have received bothADL_SMS_EVENT_SENDING_OK andADL_SMS_EVENT_SENDING_MR
It might not be a good idea to send from within the control handler…
yes, I understood this logic (in control handler after successful smssend ADL_SMS_EVENT_SENDING_MR gets executed and then ADL_SMS_EVENT_SENDING_OK) but as i said i need read the phone number (5 numbers) from flash and send the messages. the confusing bit for me is wait until you have received both… . where shld i wait (i think in cntrol handler)?
yes, its not a good idea…because I tried to send within handler, sms was sent but sent multiple rather i would say infinite loop gets created.
Can you please give me a clue/ idea about waiting state and sending text outside the control handler?
thanks