I changed your code so that it sends a debug message using the
collection sender after receiving sensor message. It turns out this
message successfully gets forwarded.
This is what my topology looked like:
1 (root) - 2 (Treg) - 3 (SensorTreg)
3 sent a sensor message to 2 (AM_PARENT_ADDR = 2), 2 forwarded the
message to 1 which is what you wanted. Can you try the following code
and let us know if you observe forwarding? If you observe that, the
bug might be unrelated to collection initialization and somewhere else
in your program.
...
message_t newbuf;
typedef struct newpkt {
uint16_t val1;
uint16_t val2;
} newpkt_t;
task void senddbgmsg() {
newpkt_t* tpkt = (newpkt_t *)call TregSend.getPayload(&newbuf);
tpkt->val1 = 0x1122;
tpkt->val2 = 0xcafe;
call TregSend.send(&newbuf, sizeof(newpkt_t));
}
event message_t* SensorReceive.receive(message_t* msg, void* payload, uint8_t
len) {
report_received(); //Signal the successful receipt
of a packet
post senddbgmsg();
....
}
- om_p
HI,
I want to use some nodes in my network to be members of the collection tree
yet at the same time be able to receive packets from nodes that are not part
of the collection tree. I've tried instantiating the AMReceiverC component
with a different AM_ID than the collection tree. However, I find that though
the nodes are able to receive packets from the non-collection tree nodes,
but are unable to send the packets upstream after performing some
computation based on the data received. I don't know if the routing engine
is getting properly initialized or not. I'd really appreciate if someone cud
let me know as to whether my scheme is feasible or not and if so, whether
I'm implementing the components/interfaces correctly. Following is a part of
my configuration file (TregAppC.nc) and module definition:-
configuration:-
components TregC, MainC, LedsC, ActiveMessageC;
components CollectionC as Collector;
components new CollectionSenderC(0xee);
components SerialActiveMessageC;
components new SerialAMSenderC(0x99);
components new AMReceiverC(0x77) as SensorReceiver;
components new TimerMilliC() as TregTimer;
TregC.Boot -> MainC;
TregC.RadioControl -> ActiveMessageC;
TregC.SerialControl -> SerialActiveMessageC;
TregC.RoutingControl -> Collector;
TregC.TregSend -> CollectionSenderC;
TregC.RootUartSend -> SerialAMSenderC.AMSend;
TregC.RootUartPacket -> SerialAMSenderC;
TregC.TregIntercept -> Collector.Intercept[0xee];
TregC.Leds -> LedsC;
TregC.SensorRadioReceive -> SensorReceiver;
TregC.TregTimer -> TregTimer;
TregC.RootControl -> Collector;
TregC.RootTregReceive -> Collector.Receive[0xee];
-----END-----
module TregC :
uses interface Boot;
uses interface SplitControl as RadioControl;
uses interface SplitControl as SerialControl;
uses interface StdControl as RoutingControl;
uses interface Send as TregSend;
uses interface Packet as RootUartPacket;
uses interface AMSend as RootUartSend;
uses interface Receive as SensorRadioReceive;
uses interface Intercept as TregIntercept;
uses interface Leds;
uses interface Timer<TMilli> as TregTimer;
uses interface RootControl;
uses interface Receive as RootTregReceive;
-----End------
thanks,
Prem
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help