Rehan,

You'll need to modify the receive function BaseStationP with something
like this:

  message_t* receive(am_id_t id, message_t *msg, void *payload, uint8_t len) {
    message_t *ret = msg;
    nx_uint32_t timestamp;

    if(call TimeSyncPacket.isValid(msg)) {
      timestamp = call TimeSyncPacket.timestamp(msg);
    } else {
      timestamp = INVALID_TIMESTAMP;
    }

    // increase payload length
    call RadioPacket.setPayloadLength(msg, len + sizeof(nx_uint32_t));

    // overwrite 4 bytes after payload with timestamp (rx sfd)
    *(nx_uint32_t*)(payload + len) = timestamp;

  // ...
  // the rest of the code remains the same
  // ...
}

Of course, you'll need to wire the TimeSyncPacket interface, provided
by ActiveMessageC.

Thanks,
Janos

On Tue, Feb 15, 2011 at 4:20 AM, Rehan Khan <[email protected]> wrote:
> Hi everyone !!! I am new to tinyos and need some help regarding timestamp
> generation. I have implemented Mote to PC communication using the
> Oscilloscope and BaseStation applications. I wish to modify the BaseStation
> so that when it receives a packet it should modify it by placing its
> timestamp inside it before forwarding it to the PC. Can anyone guide me
> which components to use to generate timestamp and where to use it in
> BaseStation application??
>
> Regards,
>
> Rehan Qayyum
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to