Think about what events are passed to the event handler - which one(s) do you think indicate that a message has been sent, and the system is ready for the next…?
I try to send sms from a for loop…wich reads a list of numbers from flash…verifies the access level of that number and if it’s 0…it means it’s an administrator number and needs to get sms…
sms_Handle = adl_smsSubscribe(SmsHdlr, SmsCtrlHdlr, ADL_SMS_MODE_TEXT);
TRACE((1,"sms_Handle = %d", sms_Handle));
if (sms_Handle >= 0)
{
for (i=0; i<=MAX_SMS_NRS; i++)
{
if (adl_flhExist("smsACL", i) > 0)
{
read = adl_flhRead("smsACL",i,sizeof(app_sms_acl),(u8*) &smsACL[i]);
TRACE((1,"read=%d",read));
if (read == OK)
{
if (smsACL[i].nivel_acc == 0)
{
TRACE((1,"smsACL[%d].nivel_acc = %d",i,smsACL[i].nivel_acc));
TRACE((1,smsACL[i].nr_tel));
sms_Send = adl_smsSend(sms_Handle, smsACL[i].nr_tel, SMS_OK_MSG, ADL_SMS_MODE_TEXT);
}else adl_atSendResponse(ADL_AT_RSP, "ERROR : No ADMIN SMS number configured in SMS ACL");
}
}else TRACE ((1,"ERROR : No SMS number configured in SMS ACL at id = %d",i));
}
}
It tries to transmit 2 times and after that i am receiving the sms event but of corse only one sms is sent…Does anyone knows how can i work around this ?
I understand that i cannot do this from a loop…i already modify my application…i was not triggering any watchdog reset but i sends only the first sms… i assigned a variabile wich will retain the position where i have a valid number, and a counter…and now i`m sending sms based on this variables directly from SmsCtrl Handler…
I thought for a second that maybe there is a posibility that i don’t know about…that’s why i posted this message…i was more confortable if this was possible…because now my application will be more laborious since i need to send messages from different parts of application with different messages to different numbers…
So why did you post code that did send it from a loop?!
The watchdog timeout is quite long: so you can be “lucky” and get away with it for a short loop - but the basic design is still faulty, and is likely to catch you out in the future…
You could divide your application into separate tasks; it is OK, for example, to have an adl_eventWait within a loop - because the Event Wait does allow other tasks to run…
This was mentioned in the FAQ/Wiki thread that SiWi have lost…
You could divide your application into separate tasks; it is OK, for example, to have an adl_eventWait within a loop - because the Event Wait does allow other tasks to run…
This was mentioned in the FAQ/Wiki thread that SiWi have lost…
[/quote]
I didn’t knew about adl_eventWait function…i haven’t got the time yet to go trough all ADL user guide informations…i posted an example code with a for loop to see if there is a posibility…because i tried to find one in documentation and other posts on the forum and nothing…and then i concluded that i need to change the way i was doing it but still save the code with the for loop because it’s more practical and maybe someone knew a solution…
Thanks again for replies…it’s so unfortunate that the FAQ/Wiki threads are lost…
If you wanted to learn to swim, would you simply jump off a ship in the middle of the ocean?
It really is not wise to start developing without having studied the ADL User Guide!
I only said i didn’t studied it completely…There are services that i didn’t used yet…and only by reading it i cannot believe that a user will have the complete knowledge of all APIs involved…
I first had contact with Open AT …one month and a half ago…once i will have more experience i suppose that i will not come with questions that maybe for other people seems to be very easy…I use this forum to learn because i don’t have near me an experienced person…and that’s why when i cannot understand something and things doesn’t go as i expect i try to get a response from an experienced user here.
I take in consideration all you are saying and try to learn from it…
Open-AT is Event-Driven, and State Machines (or Finite State Machines, FSM) are often a good way to implement Event-Driven systems.
Therefore, you might do well to take a look at the materials referenced here about Event-Driven Systems and State Machines: viewtopic.php?f=34&t=4208&start=0