Documentation ¶
Index ¶
- Constants
- type Frame
- func (z *Frame) CalcChecksum() byte
- func (z *Frame) IsAck() bool
- func (z *Frame) IsCan() bool
- func (z *Frame) IsData() bool
- func (z *Frame) IsNak() bool
- func (z *Frame) IsRequest() bool
- func (z *Frame) IsResponse() bool
- func (z *Frame) MarshalBinary() ([]byte, error)
- func (z *Frame) SetChecksum()
- func (z *Frame) VerifyChecksum() error
- type ILayer
- type Layer
- type ParseEvent
- type ParseStatus
- type Parser
Constants ¶
View Source
const ( HeaderData byte = 0x01 HeaderAck = 0x06 HeaderNak = 0x15 HeaderCan = 0x18 )
View Source
const ( TypeRequest byte = 0x00 TypeResponse = 0x01 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame struct { // Header is one of FrameHeader* Header byte // Length = byte length of all fields, excluding Header and Checksum Length byte // Type is one of FrameType* Type byte // Payload is the command id and command payload Payload []byte // Checksum = 0xff XOR Type XOR Length XOR payload[0] XOR [...payload[n]] Checksum byte }
func NewAckFrame ¶
func NewAckFrame() *Frame
func NewCanFrame ¶
func NewCanFrame() *Frame
func NewNakFrame ¶
func NewNakFrame() *Frame
func NewRequestFrame ¶
func UnmarshalFrame ¶
UnmarshalFrame turns a byte slice into a Frame
func (*Frame) CalcChecksum ¶
CalcChecksum calculates the checksum for this frame, given the current data. The Z-Wave checksum is calculated by taking 0xFF XOR Length XOR Type XOR Payload[0:n]
func (*Frame) IsResponse ¶
func (*Frame) MarshalBinary ¶
Marshal this frame into a byte slice
func (*Frame) SetChecksum ¶
func (z *Frame) SetChecksum()
SetChecksum calculates the frame checksum and saves it into the frame
func (*Frame) VerifyChecksum ¶
VerifyChecksum calculates a checksum for the frame and compares it to the frame's checksum, returning an error if they do not agree
type Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
func NewFrameLayer ¶
func NewFrameLayer(transportLayer io.ReadWriter) *Layer
func (*Layer) GetOutputChannel ¶
type ParseEvent ¶
type ParseEvent struct {
// contains filtered or unexported fields
}
type ParseStatus ¶
type ParseStatus int
const ( ParseOk ParseStatus = iota ParseNotOk ParseTimeout )
Click to show internal directories.
Click to hide internal directories.