Hi All,
I currently have an FXT009 and I am monitoring the 2 GPIO’s (GPIO21 and GPIO25) for change of state. Upon change of state I am sending a text message to a list of recipients. This is working except when both GPIO states change together. When this happens the first one to initiate the sms works, the 2nd one stops, no errors, no sms sent, nothing.
Here are my code examples.
sms service subscription:
SMS_hndl = adl_smsSubscribe((adl_smsHdlr_f) SMS_hndlr, (adl_smsCtrlHdlr_f) SMS_cntrl_hndlr, ADL_SMS_MODE_TEXT);
(ignore SMS_hndlr in this instance as this is used for received messages)
GPIO21;
adl_smsSend(SMS_hndl, phonenumber, "message", ADL_SMS_MODE_TEXT);
GPIO25;
adl_smsSend(SMS_hndl, phonenumber, "message", ADL_SMS_MODE_TEXT);
SMS_cntrl_hndlr ;
void SMS_cntrl_hndlr(u8 Event, u16 Nb)
{
TRACE((5, "In SMS control handler"));
switch (Event)
{
case ADL_SMS_EVENT_SENDING_OK:
TRACE((5, "SMS sent ok"));
break;
case ADL_SMS_EVENT_SENDING_ERROR:
TRACE((5, "SMS send failure, CMS error number, %d", Nb));
break;
case ADL_SMS_EVENT_SENDING_MR:
TRACE((5, "SMS sent ok, message reference is, %d", Nb));
break;
}
}
Now, if GPIO21 and GPIO25 change state at the same time, they both do the adl_smsSend which goes to the hndl then the cntrl_hndlr which checks for the returned messages OK followed by ERROR or MR. The first adl_smssend works, the second one just stops, no errors, nothing (I assume because the first one is currently in process and therefore it can’t start it’s send process).
So, the question I have is how can I check that an adl_smsSend has already been started so that when another one wants to start it will wait for the cntrl_hndlr to receive the ERROR or MR messages BEFORE going to the hndl to send the message?
I think that I need to check the response in the cntrl_hndlr function from the GPIO21 and GPIO25 functions, is this even possible? (I have tried various ways to do this, including inline waits (while, timer wait, etc), setting global variables, etc, but in all cases the result is the same so far.
If the answer is that my code order is incorrect, that is fine, just please give me examples so that I can re-order the code appropriately.
thanks in advance