[Tinyos-help] Re: Trouble with modifying BaseStation
Philip Levis
pal at cs.stanford.edu
Wed May 2 15:05:15 PDT 2007
On May 2, 2007, at 3:49 AM, Romain Thouvenin wrote:
> On 5/2/07, Romain Thouvenin <romain.thouvenin at gmail.com> wrote:
>> Hi,
>>
>> I'd like to use BaseStation with my Multi-hop Protocol and read the
>> packets in a Java application.
>>
>> So I "migged" the multi-hop packet, wired BaseStationP to the
>> multi-hop component (which provide AM interfaces), and modifyed
>> BaseStationP so that it always use the multi-hop AM type and compute
>> the proper length of the packet.
>>
>> Problem : the multi-hop packet is declared like that :
>> typedef nx_struct mhpacket {
>> mhpacket_header_t header;
>> nx_uint8_t data[TOSH_DATA_LENGTH-sizeof(mhpacket_header_t)];
>> } mhpacket_t;
>>
>> As a result, the Receiver class thinks the packet length is always
>> TOSH_DATA_LENGTH, and reports that received messages are too short.
>>
>> Isn't it possible to use variable-length packets ?
>>
>>
>> Thanks for your help,
>>
>> Romain
>>
>
> Nevermind, I changed the declaration to :
>
> typedef nx_struct mhpacket {
> mhpacket_header_t header;
> nx_uint8_t data[];
> } mhpacket_t;
>
> and it seems to work fine.
That's the right solution.
Phil
More information about the Tinyos-help
mailing list