On Aug 17, 2010, at 1:42 AM, Hamidreza Ghafghazi wrote: > dear all, > > Is it possible to call AMSend.send in the event void Receive.receive or not?
Yes, but you need to be careful with message pointers. Be sure that you don't return the same message_t* that you pass to AMSend. Otherwise the radio stack might start using your transmit buffer as a receive buffer, leading to corrupted or incorrect packets being sent. > If not, Is it possible to call a timer inside event void Receive.receive as > an event in order to send the modified received data? You can do this as well. > > Actually I want to receive some data and modify it and send it again to the > other node immediately and I am looking for a solution. > that would be so great if anybody could give me a hint. Take a look at tos/lib/net/lqi/LqiForwardingEngineP.nc:SubReceive.receive; it can call mForward, which can call forward, which can call SubSend. This forwarding engine is simpler than CTP's, so it's a bit easier to follow the call chain. Note that if the message is a broadcast, you want to avoid forwarding immediately: many nodes will all broadcast in unison, which can be terrible for collisions. Phil _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help