Documentation ¶
Overview ¶
Package message implements basic types and functionality to handle messages on the Container-Lab's LAN. Basic package except for general utils from package typeconv.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressBytes ¶
type AddressBytes []byte
AddressBytes - the source for Address struct.
func UDPAddrToBytes ¶
func UDPAddrToBytes(addrStrct net.UDPAddr) AddressBytes
UDPAddrToBytes - method of Address struct; cast it to a slice of bytes. Port is represented as UInt16, big endian.
func (AddressBytes) ToAddress ¶
func (b AddressBytes) ToAddress() (result net.UDPAddr)
ToAddress - cast AddressBytes (4 bytes IP + 2 bytes port) to Address struct.
type Bytes ¶
type Bytes []byte
Bytes - the source for Message struct.
type Message ¶
type Message struct { SendAddr net.UDPAddr // who sent RecvAddr net.UDPAddr // who received PackLen uint16 Timestamp time.Time // the moment the message was sent MsgType uint8 // 0 status set, 1 status is, 2 ambient params, 3 measured data Data []byte Checksum uint32 // Adler32 or CRC32 }
Message - a struct to hold all the information of a UDP message.
func New ¶
func New() *Message
New returns the pointer to a new message struct with MsgType set to an undefined value
func ParseOldCarMsg ¶
ParseOldCarMsg takes old CARIBIC format message and parses it to new Message type. Msg typ must be determined from content (status tag vs. something else)
func (*Message) MakeOldCarMsg ¶
MakeOldCarMsg makes old CARIBIC format message from Message only applicable to status set messages