[Tinyos-help] Changing Delta Message size
Ole Bischoff
s01item2 at item.uni-bremen.de
Fri Jul 28 07:39:47 PDT 2006
Hy Yannis,
the DeltaMsg is stored in the data-array of MultihopMsg,
TOS_Msg->data = TOS_MHopMsg
TOS_MHopMsg->data = DeltaMsg
the number of bytes in data are defined as: TOSH_DATA_LENGTH - 10
(-10, because all other elements, except data, sum up to 10 bytes).
The DeltaMsg has a length of 22 bytes, if this should fit in the data-array,
TOSH_DATA_LENGTH has to be >= 32 (= 22 +10).
In the makefile (.../moteiv/apps/Delta/Makefile) the value is changed by an
offset, like you mentioned. This enables the combination of data types
described above, but I don't know why it is set to 36 (and not 32).
If your application won't work without a change of the length of the
payload, I would add another offset of 4 bytes for your new two fields.
.../moteiv/tos/lib/MultiHopLQI/MultiHop.h
typedef struct MultihopMsg {
uint16_t sourceaddr;
uint16_t originaddr;
int16_t seqno;
int16_t originseqno;
uint8_t ttl;
uint8_t id;
uint8_t data[(TOSH_DATA_LENGTH - 10)];
} TOS_MHopMsg;
-> Total Bytes = 4 + 4 + 4+ 4+ 1+ 1 + 1*(TOSH_DATA_LENGTH - 10)
.../moteiv/apps/Delta/Delta.h
typedef struct DeltaMsg {
uint32_t seqno;
uint16_t Temper;
uint16_t parent;
uint8_t neighborsize;
uint8_t retransmissions;
uint16_t neighbors[MHOP_PARENT_SIZE];
uint16_t quality[MHOP_PARENT_SIZE];
} DeltaMsg;
.../moteiv/tos/lib/MultiHopLQI/MultiHop.h
#define MHOP_DEFAULT_PARENT_SIZE 3
-> Total Bytes = 4 + 2 + 2+ 1+ 1+ 2*3 +2*3 = 22
I hope this helps you a bit,
OLE
----- Original Message -----
From: "Ioannis Krontiris" <ikro at ait.edu.gr>
To: <tinyos-help at Millennium.Berkeley.EDU>
Sent: Wednesday, July 26, 2006 4:55 PM
Subject: [Tinyos-help] Changing Delta Message size
> Hello all,
>
> we have added two more fields in the Delta Message,
>
> typedef struct DeltaMsg {
> uint32_t seqno;
> uint16_t Humidity; // New field added by us
> uint16_t Temper;
> uint16_t Voltage; // New field added by us
> uint16_t parent;
> uint8_t neighborsize;
> uint8_t retransmissions;
> uint16_t neighbors[MHOP_PARENT_SIZE];
> uint16_t quality[MHOP_PARENT_SIZE];
> } DeltaMsg;
>
>
> However we face "ArrayIndexOutOfBounds Exception for get_neighborsize" at
> run time. We think this should be a problem with the payload length. so we
> decided to change its value. As can be seen in the Makefile for data
> application:
>
> CFLAGS += -DTOSH_DATA_LENGTH=28+3*2+2
>
> First Question: Can someone explain why the offset 3*2+2 is present there?
> It seems that this value is bigger than what is needed by original Delta
> application and the Multihop message. If we're not mistaken a data length
> of 28 will suffice for it (??).
>
> Second Question:
> How should we change the payload length in the Makefile for the above
> delta message and why?
>
> thanks
>
> Yannis
>
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
More information about the Tinyos-help
mailing list