Hi,

you should have a look at the "Execution model" section in the TinyOS 
programming manual (chapter "Basic programming"). Concerning your 
current problem: For a simple solution you could check your 
request_index[gid] condition in the sendDone event handler and initiate 
successive calls to send_join_inform() from there.

Regards


Omar Cheikhrouhou (yahoo) schrieb:
>
> Hello,
>
> I implement a fuction that send a message. However, the successive 
> call of this message rend EBUSY. The code is as follows:
>
> My program{
>
> ……
>
> while(request_index[gid]>0)
>
> {
>
> //send a join inform message to the GC
>
> send_join_inform(request_node[gid][request_index[gid]], gid);
>
> //sleep(10); faire dormir le capteur inutile
>
> request_index[gid]--;
>
> }
>
> ……..
>
> _}
>
> _
>
> void send_join_inform(uint16_t nid, uint8_t gid)
>
> {
>
> …….
>
> //send the message to GC
>
> //while(radioBusy){printf("waiting...\n");}
>
> res=call AMSend.send(GCAddress[gid], &pkt, sizeof(riseg_msg_t));
>
> //if(res==SUCCESS) radioBusy=TRUE;
>
> printf("BaseStationP: call AMSend.send(%x, &pkt, len); return %d 
> TimeStamp: %i\n", GCAddress[gid],res, joinMsgSent->t);
>
> }
>
> I get the following result:
>
> BaseStationP:send a JOIN_INFORM message to the GC of group 1
>
> BaseStationP: call AMSend.send(2, &pkt, len); return 0 TimeStamp: 14
>
> BaseStationP:send a JOIN_INFORM message to the GC of group 1
>
> BaseStationP: call AMSend.send(2, &pkt, len); *return 5* TimeStamp: 14
>
> BaseStationP:send a JOIN_INFORM message to the GC of group 1
>
> BaseStationP: call AMSend.send(2, &pkt, len); *return 5* TimeStamp: 14
>
> As you note only the first message is sent. For others system return 5 
> which means EBUSY.
>
> Did you propose any solution to deal with this problem?
>
> My idea is that, to use a radioBusy variale which is sent to true at 
> each sent and to false at each sendDone (the commented code). However, 
> with this solution the system plant at the 
> _while(radioBusy){printf("waiting...\n");} instruction. Some people in 
> this group tell me that the event sendone cannot interrupt the 
> function that’s why the system plant.
>
> How we can make the function interruptable by the senddone event?
>
> _
>
> Thx for help.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to