Documentation
¶
Overview ¶
Package receiver provides trice receiver functionality. It uses a bytes.Reader for getting bytes and provides the received trices over a trice atoms channel
Package receiver provides a Reader for wrapped trice data ¶
It uses any byte reader and additional encoding information. It reads trice wraps and syncs internally if byte stream inconsistent. Discarded Bytes are transferred to function emit.DiscardByte().
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Verbose gives more information on output if set. This variable is set outside this package. Verbose bool )
Functions ¶
This section is empty.
Types ¶
type Trice ¶
type Trice struct {
ID uint16 // 2^16 ^= more than 65500 different trice IDs possible
Value uint16 // max 16 bit data payload inside a TriceAtom
}
Trice is the bare Trice data type for a Trice atom. A trice starts with zero or several trice atoms with ID==0 carrying parts of the trice data payload. The last trice atom of a trice contains the trice ID!=0 and the last part of the data payload.
type TriceReceiver ¶
type TriceReceiver struct {
// contains filtered or unexported fields
}
TriceReceiver receives trices using io.Reader r and decodes them according to the expected coding. It provides a TriceAtomsReceiver interface. All recognized trice atoms as fetched are going as slices into the atoms channel. Not used read bytes are sent to the ignored channel. Theses bytes could be garbage after out of sync or some different protocol.
func (*TriceReceiver) ErrorFatal ¶
func (p *TriceReceiver) ErrorFatal()
ErrorFatal ends in osExit(1) if p.Err not nil.
func (*TriceReceiver) IgnoredBytesChannel ¶
func (p *TriceReceiver) IgnoredBytesChannel() <-chan []byte
IgnoredBytesChannel provides a read channel for reading bytes the trice receiver ignored. It is part of the TriceAtomsReceiver interface.
func (*TriceReceiver) TriceAtomsChannel ¶
func (p *TriceReceiver) TriceAtomsChannel() <-chan []Trice
TriceAtomsChannel provides a read channel for reading trice atoms. It is part of the TriceAtomsReceiver interface.