On Jun 18, 2007, at 7:36 AM, sara Khad wrote:

Hi,
Hope that someone could help me with the following:
I would like to do the following:
1- Mote1 sends a packet every 1sec to Mote2
2- I want Mote2 to add some filed to the received packet and then
forwards it directlly to another mote.

I want to know if it is ok to invoke sendNow() from Receive event???
.......................
void sendNow(){
   if (!busy) {
if (call AMSend.send(0,ptr, sizeof(BlinkToRadioMsg)) == SUCCESS) {
       call Leds.led2Toggle();
       busy = TRUE;
     } }}

event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len){
    message_t *tmp= ptr;
    ptr = msg;
   if (len == sizeof(BlinkToRadioMsg)) {
       BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
       btrpkt->tnow= call Timer0.getNow();
       sendNow();
      }
       return tmp;
      }
I am not sure about sendNow() inside the receive event! Is it ok to
place it inside the event Receive?
what do you think??

It should be OK. The only thing to be careful of is the packet. You want to make sure you do not send the buffer that you pass back to the radio. But your code looks OK in this regard.

Phil
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to