You should read up on the GenericComm code/interface and look
through the relevant parts of the tutorial.
In my code Robot.nc configures a bunch of messages:
GenericComm as RComm, // for RADIO & UART comm
// Host commands to be received (from Radio or UART)
RoboMsgM.RCmdStartMsg -> RComm.ReceiveMsg[AM_ROBOCMDSTARTMSG];
RoboMsgM.RCmdStopMsg -> RComm.ReceiveMsg[AM_ROBOCMDSTOPMSG];
RoboMsgM.RCmdStatMsg -> RComm.ReceiveMsg[AM_ROBOCMDSTATMSG];
RoboMsgM.RCmdDataMsg -> RComm.ReceiveMsg[AM_ROBOCMDDATAMSG];
// Status replies to send
RoboMsgM.RStatusMsg -> RComm.SendMsg[AM_ROBOSTATUSMSG];
RoboMsgM.RDataMsg -> RComm.SendMsg[AM_ROBODATAMSG];
So any reference to "RComm" goes to a specific GenericComm
message that is defined in RoboMsg.h. Then in the RoboMsgM.nc
file each ReceiveMsg type has a handler function, like:
RCmdStartMsg.receive(TOS_MsgPtr m)
which is called, by internal magic, when a message of that
type is received over the Radio or UART. And each SendMsg type
has a send function like:
RDataMsg.send( TosBaseId, sizeof(RoboStatusMsg), &datamsg );
which is called from a task when one wants to send a message
to a specific, Bcast, or UART "port". In addition each send type
has a sendDone() which is called, again by magic, when it completes:
RDataMsg.sendDone(TOS_MsgPtr sent, result_t success)
MS
Michael Wu wrote:
Greeting, Michael Schippling.
I appreciate your great helpful response and your useful code very much!!
I try to understand your codes, but it's not easy for me..
I can't find out where the GenericComm is used, and I almost can't
figure out what is your applications doing because I believe it must a
easy program cause it's a great application your wrote.
Would you please explain your applications please?
I really want to understand your codes very much!!
Thanks your kinds again, I really appreciate you very much!!
Sincerely
Michael
2007/12/27, Michael Schippling <[EMAIL PROTECTED]>:
RadioCRCPacket is rather lower-level than you need.
In T1 at least, look at the GenericComm usage in
various of the demo apps, and the tutorial. You can also
see a convoluted example of receiving and sending messages
using GC in my code at:
http://www.etantdonnes.com/Motes/robocode.tar.gz
But it sounds like you are trying to invent an ad-hoc net
application. Look at contrib/xbow/Surge* and the Moteiv
Boomerang moteiv/apps/Delta for examples of what has
gone before. Since that is what Motes are supposed
to be doing there is a lot of discussion on this list
(which I mostly ignore because, of course, that's not
my application area interest)...
MS
Michael Wu wrote:
Greeting, everybody.
Does anyone please tell me how to use the function RadioCRCpacket to
send a packet to another sensor?
My purpose is that, a sensor(tmote) have 2 functions: It could receive
packets from other sensors, and send packets to another sensor.
I survay many many many source codes, and I can't find out the solution.....
Please, does anyone could do me a favor, tell me how to let a sensor
has 2 functions: receive and send?
It has bothered me for many days already!!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
--
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew
--
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help