Hi all,
I had one question on a problem I am getting. I am trying to send int32 values
in a packet in my TelosB nodes and some of the values may be negative. Tried
looking online but couldn't find anyone with the same issue or a solution to
the problem.
I am defining the packet defined as
typedef nx_struct beaconpkt{
nx_int32_t beaconvals[4];
}beaconpkt;
and I am printing a value from the packet at the sender and it is being
correctly defined and is signed. However, when the packet is received, the
positive value is correct but the negative values are giving a nonsense value.
I had in my mind that I had already tried to send negative values in a packet
and all worked fine but maybe I am mistaken. Does anybody have experience on
this?
I am sending the packet like:
message_t pktToActuator;
nx_int32_t eta0tmp;
beaconpkt* apkt = (beaconpkt*)(call Packet.getPayload(&pktToActuator, sizeof
(beaconpkt)));
eta0tmp = -1000;
apkt->beaconvals[3] = eta0tmp;
if (!busy) {
if (call AMSend.send(AM_BROADCAST_ADDR, &pktToActuator, sizeof(beaconpkt)) ==
SUCCESS) {busy = TRUE;}
}
And reading the packet as:
beaconpkt* apkt = (beaconpkt*)payload;
eta0tmp = (apkt->beaconvals[3]);
Thanks for the help!
Best,
José Araújo
_____________________________
PhD student
Department of Automatic Control
KTH Royal Institute of Technology
http://people.kth.se/~araujo/
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help