I'm totally lost using TinyOS and I think I need some help over here.
I have a node that send a message to all nodes that listen to him, so, from time to time this node send a message to all of his "children"
event void Timer.fired() {
call Read.read();
}
event void Read.readDone(error_t result, uint16_t data) {
if (!busy) {
Msg* localpkt = (Msg*) (call Packet.getPayload(&packet, sizeof(Msg)));
if (localpkt == NULL) { return; }
localpkt->data = data;
if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(Msg)) == SUCCESS) {
busy = TRUE;
}
}
Then, I have the receive method (all methods are in the same .nc)
event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len){
if (len == sizeof(Msg)) {
Msg* localpkt = (Msg*)payload;
data = localpkt->data;
}
return msg;
}
When I send a message, the father node will receive message from his children, but how do I know witch children answered in time?
If I have for example, one father sending message for 3 nodes, how do I know how many of this nodes answered me and how do I know his ID?
I forgot to tell, father node and children node execute the same code, but the father act like a "coordinator", so we have to send message to his children time to time. I`m ussing TOSSIM to simmulate this code.
Thanks in advance!