The message header, kinda by definition, is at the beginning of
the message packet before the "payload". So trying to get the
header out of the payload is a non-starter... There may be a
Packet.getHeader() or some such method -- I don't use that
module so I don't know. Or you could probably get away with
a cast and structure copy like this:
btrpkt->header = (ieee154_header_t) &pkt;
I'm not sure what pkt is.... "usually" it would already
be a pointer passed in to your function from the message
receive code, so the '&' may be superfluous.
MS
sai manoj wrote:
> Hi,
>
> I want to copy the message header into payload by creating my own
> payload format
>
> This is the Msg format I like to transmit
>
> typedef nx_struct Msg
> {
> nx_uint16_t hdr;
> ieee154_header_t header_t;
>
> nx_uint16_t val;
> nx_uint16_t type;
> }Msg;
>
>
> And in the implementation part I tried 3 different
>
> Msg* btrpkt = (Msg*)(call Packet.getPayload(&pkt, sizeof(Msg)));
>
> btrpkt->header_t=getheader(btrpkt);
> or
> btrpkt->header=ieee154_header_t;
> or
> btrpkt->header_t.fcf=getFCF(btrpkt);
>
> I need to do copy the header of the data into payload
>
> --
> SAI MANOJ P D (M.Tech)
> International Institute of Information Technology,Bangalore
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help