[Tinyos-help] Re: Trouble with modifying BaseStation

Romain Thouvenin romain.thouvenin at gmail.com
Wed May 2 03:49:17 PDT 2007


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.

Romain


More information about the Tinyos-help mailing list