Re: [Tinyos-help] Variable with static TOS_NODE_ID

2017-05-11 Thread James Allen (PGR)
Hi Andre,


It's difficult to tell what's going on here as this kind of problem really 
needs a small, concise piece of code to help explain what you are doing (see 
https://stackoverflow.com/help/mcve for some pointers). I'm not sure but I 
think you may be misunderstanding the sequence of events happening, here's some 
thoughts and hopefully something will help:


- Your startDone function fires every time the radio is turned on, and it sends 
*a brand new packet* with it's nodeid value set to the that node's TOS_NODE_ID. 
When you say "When node 13 is to retransmit, the starDone function loads nodeid 
= 13 (is the Node that is transmitting), this is what is wrong, since I wanted 
nodei = 24 to remain unchanged" I'm really confused by this, perhaps this is 
what you are misunderstanding? What is happening in your startDone function is 
not retransmitting a received packet, it is sending a new packet.

Are you trying to create a mesh network? Look at TinyOS Collection Tree 
Protocol (CTP) which handles packet sniffing and retransmissions for you. 
Trying to implement an efficient mesh network from scratch is rather 
complicated.


- I think that the receive event is only signalled when a packet arrives which 
is addressed to that node. If you want to 'sniff' messages in the air destined 
for another node, you need to use the AM Snoop component, not Receive


- The CC2420 by default does not signal any packets received which are not 
addressed directly to this node. So to use Snoop with CC2420 I think you need 
to use the CFLAGS += -DCC2420_NO_ADDRESS_RECOGNITION in your Makefile.

- In your startDone event you are setting your message value to the static 
TOS_NODE_ID value (rcm->nodeid = TOS_NODE_ID ) but then a couple of lines later 
in your debug statement you are printing the nodeid variable, which is 
different (that seems to be set in your Receive event with nodeid= 
rcm->nodeid;) This seems wrong...?

- When you say "But in the output of the debug, the [origin =% hu] is always 
equal value [trans =% hu]" isn't this what should be happening?

James

From: tinyos-help-boun...@millennium.berkeley.edu 
<tinyos-help-boun...@millennium.berkeley.edu> on behalf of arsaraiva 
<andresara...@id.uff.br>
Sent: 09 May 2017 14:08:09
To: tinyos-help@millennium.berkeley.edu
Subject: Re: [Tinyos-help] Variable with static TOS_NODE_ID

Actually nodeid is declared in the booted function, as nodeid = TOS_NODE_ID.

What I have to do is that when the startDone function is run, it loads the
varialvel nodeid with the value of the node and does not change.

What is happening now is that starDone executes on node 24 (for example) and
there nodeid = 24, sends the packet that was received by node 13. When node
13 is to retransmit, the starDone function loads nodeid = 13 (is the Node
that is transmitting), this is what is wrong, since I wanted nodei = 24 to
remain unchanged, so when node 13 retransmitted the packet and it arrived at
the sink (node 0) the sink would know that the packet originated at the node
24 (I do not care if he went through 13).

Could I explain my question better?




--
View this message in context: 
http://tinyos-help.10906.n7.nabble.com/Variable-with-static-TOS-NODE-ID-tp25094p25100.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.
___
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

Re: [Tinyos-help] Variable with static TOS_NODE_ID

2017-05-09 Thread arsaraiva
Actually nodeid is declared in the booted function, as nodeid = TOS_NODE_ID.

What I have to do is that when the startDone function is run, it loads the
varialvel nodeid with the value of the node and does not change.

What is happening now is that starDone executes on node 24 (for example) and
there nodeid = 24, sends the packet that was received by node 13. When node
13 is to retransmit, the starDone function loads nodeid = 13 (is the Node
that is transmitting), this is what is wrong, since I wanted nodei = 24 to
remain unchanged, so when node 13 retransmitted the packet and it arrived at
the sink (node 0) the sink would know that the packet originated at the node
24 (I do not care if he went through 13).

Could I explain my question better?




--
View this message in context: 
http://tinyos-help.10906.n7.nabble.com/Variable-with-static-TOS-NODE-ID-tp25094p25100.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Variable with static TOS_NODE_ID

2017-05-09 Thread James Allen (PGR)
In your startDone function, your line:


dbg("teste", "ENVIAR_PKT_DADOS: destino %hu nodeid %hu slot %hu [cont %hu]
no tempo=%lu.\n", syncwith, nodeid, slot, cont, call Clock.get());

As far as I can tell, you haven't actually declared or assigned a variable 
called 'nodeid'. Perhaps you meant to use TOS_NODE_ID instead?



From: tinyos-help-boun...@millennium.berkeley.edu 
 on behalf of arsaraiva 

Sent: 06 May 2017 14:24:16
To: tinyos-help@millennium.berkeley.edu
Subject: [Tinyos-help] Variable with static TOS_NODE_ID

Hello friends,

I need some help.
I need to store in a variable (nodeid) the source node of a package, so that
this variable does not receive new value with each hop.
In summary, if a tree of height 3, where node 0 is the root, node 2 child of
the root and parent of node 7, need that when a packet leaves node 7, nodeid
variable receives the value of 7, pass By its parent (node 2) without being
altered and reaches the root with the same value 7. My shipping code looks
like this:

event void AMControl.startDone(error_t err) {
radio = TRUE;
dbg("teste","SLOT_ATIVO: No %hu no slot [%hu] com tempo=%lu.\n",
TOS_NODE_ID, slot, call Clock.get());
if (err == SUCCESS) {
if ((call Clock.get() > (ultpkdados+5000)) && (TOS_NODE_ID != 0)){
 teste_msg_t* rcm = (teste_msg_t*)call Packet.getPayload(,
sizeof (teste_msg_t));
 rcm->tipo=1;
 rcm->nodeid = TOS_NODE_ID;
 rcm->slot = slot;
 rcm->proxsalto = syncwith;
 rcm->cont = cont;
 call PacketAcknowledgements.requestAck();
 if (call AMSend.send(syncwith, , sizeof(teste_msg_t)) ==
SUCCESS) {
 dbg("teste", "ENVIAR_PKT_DADOS: destino %hu nodeid %hu slot 
%hu [cont
%hu] no tempo=%lu.\n", syncwith, nodeid, slot, cont, call Clock.get());
 cont++;
 ultpkdados = call Clock.get();
 locked = TRUE;
 }
} else ..

My reception code looks like this:
 event message_t* Receive.receive(message_t* bufPtr, void* payload, uint8_t
len) {
uint16_t transmissor;
uint16_t destino;
uint16_t seqnumin;
if (len != sizeof(teste_msg_t)) {return bufPtr;}
else {
   teste_msg_t* rcm = (teste_msg_t*)payload;
   if (rcm->tipo == 1) {
   if (TOS_NODE_ID == rcm->proxsalto){
   if (TOS_NODE_ID ==0){
transmissor = call AMPacket.source(bufPtr);
cont = rcm->cont;
nodeid= rcm->nodeid;
slotin = rcm->slot;
dbg("teste", "SORVEDOURO: [trans=%hu] [origem=%hu] [slot
%hu] [cont-%hu] [time=%lu].\n", transmissor, nodeid, slotin, cont, call
Clock.get());

} else .

However in the output of the debug nodeid always is = 0:
dbg("teste", "ENVIAR_PKT_DADOS: destino %hu nodeid %hu slot %hu [cont %hu]
no tempo=%lu.\n", syncwith, nodeid, slot, cont, call Clock.get());

and

dbg("teste", "SORVEDOURO: [trans=%hu] [origem=%hu] [slot %hu] [cont-%hu]
[time=%lu].\n", transmissor, nodeid, slotin, cont, call Clock.get());

But in the output of the debug, the [origin =% hu] is always equal value
[trans =% hu]

I do not know what I'm missing
Thanks in advance for any help.



--
View this message in context: 
http://tinyos-help.10906.n7.nabble.com/Variable-with-static-TOS-NODE-ID-tp25094.html
Sent from the TinyOS - Help mailing list archive at Nabble.com.
___
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