I think you are confused. I have used two different interfaces . "Send as Mhopsend" interface is provided by CTP (CollectionSenderC) And "AMsend as ResetSend" is provided by AMSenderC.
/** * Send a packet with a data payload of <tt>len</tt> to address * <tt>addr</tt>. To determine the maximum available size, use the * Packet interface of the component providing AMSend. If send * returns SUCCESS, then the component will signal the sendDone * event in the future; if send returns an error, it will not * signal the event. Note that a component may accept a send * request which it later finds it cannot satisfy; in this case, it * will signal sendDone with error code. * * @param addr address to which to send the packet * @param 'message_t* ONE msg' the packet * @param len the length of the data in the packet payload * @return SUCCESS if the request to send succeeded and a * sendDone will be signaled later, EBUSY if the * abstraction cannot send now but will be able to * later, or FAIL if the communication layer is not * in a state that can send (e.g., off). * @see sendDone */ command error_t send(am_addr_t addr, message_t* msg, uint8_t len); 2009/11/4 Omprakash Gnawali <[email protected]> > > From: himanshu barve <[email protected]> > > Date: 2009/10/28 > > Subject: problem while having both CTP(multihop) and AMsenderC instances > in > > same program > > To: Omprakash Gnawali <[email protected]>, > > [email protected] > > > > > > Hello Friends . , > > I have included Omprakash Gnawali as i have seen him answering most of > the > > answers related to CTP . > > I am working on one program , in which i need some motes to have both > > multihop and single hop instances together . Basically multihop protocol > is > > for data acquisition and its data flow is from sensor nodes to base node. > > And AMsenderC instance is bidirectional which originates from base , and > > does kind of manual multihop . with the help of if condition and again > send > > the same to respective mote. > > Now the problem is arising in some motes where CollectionSenderC and > > AMsenderC are working together . (Problem did not came for the one where > > Receive and CollectionSenderC was there .. ) > > Now some part of my program .. > > Status_MoteAppC.nc (not whole but only required field) > > _______________________________________________________________ > > components CollectionC as Collector; // Collection layer > > components ActiveMessageC; // AM layer > > components new CollectionSenderC(MHOP_WIRELESSMON); // Sends > multihop > > RF > > components new AMSenderC(AM_RADIO_SENSOR); > > components new AMReceiverC(AM_RADIO_STATUS); > > App.MhopSend -> CollectionSenderC.Send; > > App.SnoopMsg -> Collector.Intercept[MHOP_WIRELESSMON]; > > App.RoutingControl -> Collector; > > App.RadioControl -> ActiveMessageC; > > App.RootControl -> Collector; > > App.ResetSend -> AMSenderC.AMSend; > > App.ResetReceive -> AMReceiverC.Receive; > > App.Packet -> AMSenderC; > > > ----------------------------------------------------------------------------------------------------------------------- > > Status_MoteC.nc (only required part) > > uses interface Send as MhopSend; > > uses interface CollectionPacket; > > uses interface RootControl; > > uses interface SplitControl as RadioControl; > > uses interface StdControl as RoutingControl; > > uses interface Receive as ResetReceive; > > uses interface Send as ResetSend; > > uses interface Packet; > > > > event message_t* ResetReceive.receive(message_t* ResBuf ,void* payload, > > uint8_t len) > > { > > if (len != sizeof(ResetMesg_t)) > > { > > return ResBuf; > > } > > else > > { > > ResetMesg_t* Res = (ResetMesg_t*)payload; > > if (Res -> reset_nodeid == TOS_NODE_ID || Res -> reset_nodeid == 0 > ) > > { > > call ResetTimer.startOneShot(100); > > } > > if (Res -> reset_statusid == TOS_NODE_ID) > > { > > if (!ResetBusy) > > { > > if (call ResetSend.send(TOS_BCAST_ADDR, &Resbuf, > sizeof(ResetMesg_t)) > > == SUCCESS) > > { > > ResetBusy = TRUE; > > } > > } > > } > > > > return ResBuf; > > } > > } > > > -------------------------------------------------------------------------------------------------------------------------------------- > > Error message > > In component `Status_MoteC': > > Status_MoteC.nc: In function `ResetReceive.receive': > > Status_MoteC.nc:208: warning: passing argument 1 of `ResetSend.send' > makes > > point > > er from integer without a cast > > Status_MoteC.nc:208: warning: passing argument 2 of `ResetSend.send' > makes > > integ > > er from pointer without a cast > > Status_MoteC.nc:208: too many arguments to function `ResetSend.send' > > /opt/tinyos-2.x/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: #warning > > This means you have too many arguments to ResetSend.send. It should > have two arguments. Here is a snippet from tos/interfaces/Send.nc: > > /** > * Send a packet with a data payload of <tt>len</tt>. To determine > * the maximum available size, use the Packet interface of the > * component providing Send. If send returns SUCCESS, then the > * component will signal the sendDone event in the future; if send > * returns an error, it will not signal sendDone. Note that a > * component may accept a send request which it later finds it > * cannot satisfy; in this case, it will signal sendDone with an > * appropriate error code. > * > * @param 'message_t* ONE msg' the packet to send > * @param len the length of the packet payload > * @return SUCCESS if the request was accepted and will issue > * a sendDone event, EBUSY if the component cannot > accept > * the request now but will be able to later, FAIL > * if the stack is in a state that cannot accept > requests > * (e.g., it's off). > */ > command error_t send(message_t* msg, uint8_t len); > > - om_p > -- With Best Regards Himanshu Barve M.Tech Electrical Engineering (Power System) IIT Kharagpur , West Bengal , India Ph: - +91 9775201181
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
