Documentation
¶
Index ¶
Constants ¶
const ( // MaximumPacketSize is the largest a TSL message can be when sent over UDP MaximumPacketSize int = 2048 // BroadcastIndex is the broadcast index, sent to all displays BroadcastIndex uint16 = 0xFFFF )
Variables ¶
var ( // ErrInvalidSize is when the provided byte slice does not contain enough control bits ErrInvalidSize = errors.New("invalid size") // ErrExceededMaximumPacket is returned when the resultant byte slice is too long for a UDP packet. ErrExceededMaximumPacket = errors.New("tally has exceeded maximum UDP packet size") )
Functions ¶
func Marshal ¶ added in v0.1.0
Marshal converts a Message struct into a TSL v5-compliant byte slice. The resulting byte slice can be sent over TCP, serial, or UDP. Returns an error if the message is invalid or cannot be encoded. If the size exceeds the maximum UDP packet size, it will return an ExceededMaximumPacket error with the byte array
func Unmarshal ¶ added in v0.1.0
Unmarshal parses a byte slice containing a TSL v5 frame into a Message struct. It expects the slice to contain exactly one complete frame. Returns an error if the frame is malformed, has a bad checksum, or is incomplete.
func WriteMessage ¶ added in v0.1.0
WriteMessage encodes a Tally struct into a TSL v5 frame and writes it to an io.Writer. This is intended for stream-oriented transports like TCP or serial. It handles DLE byte-stuffing in the payload and writes DLE STX + length + payload.
Types ¶
type Tally ¶ added in v0.1.0
type Tally struct {
Version byte
Flags Flags
Screen uint16
DisplayMessages []tally.Message
// contains filtered or unexported fields
}
Tally is the representation of a TSL tally
func ReadMessage ¶ added in v0.1.0
ReadMessage reads the next complete TSL v5 message from an io.Reader stream. This is intended for stream-oriented transports like TCP or serial. It synchronizes on the start-of-frame byte and reads the full message. Returns the Message and any error encountered during reading or unmarshaling.