Hi sara,
I think it is better replacing the sendNow() function by a task. This way you make the event shorter, and complete faster as recommended in the TinyOs programming guide. Cheers, O.Chougna -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sara Khad Sent: maandag 18 juni 2007 16:37 To: [email protected] Subject: [Tinyos-help] send inside Receive 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?? thanks for any help Sara _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
