Documentation ¶
Index ¶
- Constants
- Variables
- func FixString(chars []byte) string
- func LogEverything(logger *log.Logger)
- func MessageName(id uint8) string
- func MessageNameID(id uint8) string
- func NameIDFromMessage(msg Message) string
- func Send(writer io.Writer, systemID, componentID, sequence uint8, message Message) error
- type Connection
- type ErrInvalidChecksum
- type ErrPacketLoss
- type ErrUnknownMessageID
- type Header
- type Message
- type Pacemaker
- type Packet
Constants ¶
View Source
const FRAME_START = 0xFE
Variables ¶
View Source
var ( ProtocolName string ProtocolVersion uint8 MessageFactory [256]func() Message )
The following variables will be set by importing a protocol definition package.
View Source
var ( SendLogger *log.Logger ReceiveLogger *log.Logger AllErrorsLogger *log.Logger UnreportedErrorsLogger *log.Logger DebugLogger *log.Logger )
View Source
var FRAME_START_BYTE = []byte{FRAME_START}
Functions ¶
func LogEverything ¶
func MessageName ¶
func MessageNameID ¶
func NameIDFromMessage ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(wrappedConn io.ReadWriter, systemID uint8) *Connection
func (*Connection) Close ¶
func (conn *Connection) Close(writeTimeout time.Time) error
Close stops reading from wrappedConn after the current read finishes and stops writing when there are no more buffered packets or the current time has reached writeTimeout. After that, if wrappedConn implements io.Closer, its Close method will be called and the result returned.
func (*Connection) Receive ¶
func (conn *Connection) Receive() *Packet
type ErrInvalidChecksum ¶
func (*ErrInvalidChecksum) Error ¶
func (e *ErrInvalidChecksum) Error() string
type ErrPacketLoss ¶
type ErrPacketLoss int
func (ErrPacketLoss) Error ¶
func (loss ErrPacketLoss) Error() string
type ErrUnknownMessageID ¶
type ErrUnknownMessageID uint8
func (ErrUnknownMessageID) Error ¶
func (id ErrUnknownMessageID) Error() string
type Header ¶
type Header struct { PayloadLength uint8 PacketSequence uint8 SystemID uint8 ComponentID uint8 MessageID uint8 }
func (*Header) FieldsShortString ¶
func (*Header) FieldsString ¶
func (*Header) ShortString ¶
type Pacemaker ¶
type Pacemaker struct {
// contains filtered or unexported fields
}
func NewPacemaker ¶
type Packet ¶
func ParsePacket ¶
func ReceiveLogErr ¶
ReceiveLogErr calls Receive and returns a *Packet if there was no error. If Receive returns an error, and LogUnreportedErrors is true, then the error will be logged. The only exception is the error io.EOF. In that case the error won't be logged and a nil packet will be returned.
func (*Packet) ShortString ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.