In T1 (I assume T2 is only _slightly_ different in some curious way)...
A header file defines all the message structures and "AM_" types. Your config file has a line for each message type: // Host commands to be received RoboMsgM.RCmdStartMsg -> GenericComm.ReceiveMsg[AM_ROBOCMDSTARTMSG]; RoboMsgM.RCmdStopMsg -> GenericComm.ReceiveMsg[AM_ROBOCMDSTOPMSG]; RoboMsgM.RCmdStatMsg -> GenericComm.ReceiveMsg[AM_ROBOCMDSTATMSG]; // Status replies to send RoboMsgM.RStatusMsg -> GenericComm.SendMsg[AM_ROBOSTATUSMSG]; RoboMsgM.RConfirmMsg -> GenericComm.SendMsg[AM_ROBOCONFIRMMSG]; And your impl file has code for each: event TOS_MsgPtr RCmdStartMsg.receive(TOS_MsgPtr m) { // ... return( m ); } void someFunction() { call RStatusMsg.send( MYTOSBASE, sizeof(RoboStatusMsg), statmsgp ); } event result_t RStatusMsg.sendDone(TOS_MsgPtr sent, result_t success) { return SUCCESS; } MS Murray, Ben wrote:
Hi I am trying to write a program that needs to be able to cope with a number of different message types, usually of different lengths. These different message types needed to be routed to different parts of my application for processing depending on their type. Likewise, each note needs to be able to send a number of different types of message. Can/should I be implementing this by using multiple senders and multiple receivers or is there a better/more efficient way? Plus, if I use multiple receivers/senders, do I also need to use multiple .Packet interfaces? ...or is there a single Packet Interface I can use? Equally is there a single send interface I can use for the different type (each with a different payload structure and for a different purpose) e.g. configuration MyApp { } implementation { ... components new AMSenderC(TYPE_ONE) as Sender1; components new AMSenderC(TYPE_TWO) as Sender2; ... components new AMReceiverC(TYPE_ONE) as Receiver1; components new AMReceiverC(TYPE_TWO) as Receiver2; ... App.Sender1 -> Sender1; App.Sender2 -> Sender2; ... App.Packet -> AMSenderC; //***Does not work as no I need to tie App.Packet1 -> Sender1 etc etc App.AMPacket -> AMSenderC; //***as above... ...etc } Many Thanks -Ben ******************************************************************************* Please consider the environment before printing this email. ******************************************************************************* This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed and may not be divulged to any third party without the express permission of the originator. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thales Research & Technology (UK) Limited. ******************************************************************************* _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help