[Tinyos-devel] timestamps in seriallisten/sflisten etc.
David Gay
dgay42 at gmail.com
Thu Jun 26 11:03:50 PDT 2008
Ok, a suggestion:
- Packet sources acquire a timestamp - this means changing the
net.tinyos.packet.PacketSource interface, e.g., add the following
method
/**
* Read a packet
* @param timestamp timestamp[0] is set to the time at which the
packet was received
* @return The packet read (newly allocated). The format is described
* above
* @exception IOException If the source detected a problem. The source
* is automatically closed.
*/
public byte[] readPacket(long timestamp[]) throws IOException;
The existing readPacket can stay as is, for backwards compatibility
(we could add @deprecated to it at some point)
- Something similar happens for the C, C++, and Python packet
abstractions/interfaces/etc (in a more or less ad-hoc fashion
depending on whether they have a generic packet-source-like concept).
- The serial forwarder protocol is extended to also communicate
timestamps (presumably as 8-byte millisecond timestamps). Note that
the protocol has a version number precisely to allow for extensions,
so use it! (when talking to an old serial forwarder implementation you
can just fill in the timestamp with the local time - better than
nothing)
- If you're so inclined, you can include the ack information in the
serial forwarder protocol (note that it's already in packet sources,
see the return value from writePacket)
- Implementations of packet sources need to fill in timestamps. Here's
the obvious cases:
* serial and network packet sources: call System.currentTimeMillis()
at the appropriate time (first byte received from network / serial
port?)
* serial-forwarder packet sources (this essentially means the serial
forwarder, net.tinyos.sf and the C/C++ implementations): forward the
timestamps from the packet sources being forwarded... (note that the
Java serial-forwarder, at least, can forward an arbitrary packet
source)
David
More information about the Tinyos-devel
mailing list