Interface: tos.lib.serial.SerialPacketInfo

interface SerialPacketInfo

Accessor methods used by a serial dispatcher to communicate with various message_t link formats over a serial port.

Author:
Philip Levis
Ben Greenstein
Date:
August 7 2005

Commands
command uint8_t dataLinkLength(message_t *msg, uint8_t upperLen) Get the size of the datalink packet embedded in the message_t, in bytes.
command uint8_t offset() Get the offset into a message_t where the header information begins.
command uint8_t upperLength(message_t *msg, uint8_t dataLinkLen) Get the size of the payload (in bytes) given the size of the datalink packet (dataLinkLen) embedded in the message_t.

Commands - Details

dataLinkLength

command uint8_t dataLinkLength(message_t *msg, uint8_t upperLen)

Get the size of the datalink packet embedded in the message_t, in bytes. This is the sum of the payload (upperLen) and the size of the link header.

Parameters:
msg - A pointer to the message_t to interrogate. (unused)
upperLen - The size of the payload.
Returns:
Returns the size of the datalink packet.

offset

command uint8_t offset()

Get the offset into a message_t where the header information begins.

Returns:
Returns the offset.

upperLength

command uint8_t upperLength(message_t *msg, uint8_t dataLinkLen)

Get the size of the payload (in bytes) given the size of the datalink packet (dataLinkLen) embedded in the message_t.

Parameters:
msg - A pointer to the message_t to interrogate. (unused)
dataLinkLength - The size of the datalink packet.
Returns:
Returns the size of the payload.