Documentation
¶
Overview ¶
Package frame contains frames and utilities to encode and decode them.
Index ¶
- Constants
- type Frame
- type V1Frame
- func (f *V1Frame) Clone() Frame
- func (f *V1Frame) Decode(br *bufio.Reader) error
- func (f *V1Frame) Encode(buf []byte, msgEncoded []byte) ([]byte, error)
- func (f *V1Frame) GenChecksum(crcExtra byte) uint16
- func (f *V1Frame) GetChecksum() uint16
- func (f *V1Frame) GetComponentID() byte
- func (f *V1Frame) GetMessage() msg.Message
- func (f *V1Frame) GetSystemID() byte
- type V2Frame
- func (f *V2Frame) Clone() Frame
- func (f *V2Frame) Decode(br *bufio.Reader) error
- func (f *V2Frame) Encode(buf []byte, msgEncoded []byte) ([]byte, error)
- func (f *V2Frame) GenChecksum(crcExtra byte) uint16
- func (f *V2Frame) GenSignature(key *V2Key) *V2Signature
- func (f *V2Frame) GetChecksum() uint16
- func (f *V2Frame) GetComponentID() byte
- func (f *V2Frame) GetMessage() msg.Message
- func (f *V2Frame) GetSystemID() byte
- func (f *V2Frame) IsSigned() bool
- type V2Key
- type V2Signature
Constants ¶
const ( // V2MagicByte is the magic byte of a V2 frame. V2MagicByte = 0xFD // V2FlagSigned is the flag of a V2 frame that indicates that the frame is signed. V2FlagSigned = 0x01 )
const (
// V1MagicByte is the magic byte of a V1 frame.
V1MagicByte = 0xFE
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame interface {
// the system id of the author of the frame.
GetSystemID() byte
// the component id of the author of the frame.
GetComponentID() byte
// the message encapsuled in the frame.
GetMessage() msg.Message
// the frame checksum.
GetChecksum() uint16
// generate a clone of the frame
Clone() Frame
// decode the frame
Decode(*bufio.Reader) error
// encode the frame
Encode([]byte, []byte) ([]byte, error)
// generate the checksum
GenChecksum(byte) uint16
}
Frame is the interface implemented by frames of every supported version.
type V1Frame ¶
type V1Frame struct {
SequenceID byte
SystemID byte
ComponentID byte
Message msg.Message
Checksum uint16
}
V1Frame is a Mavlink V1 frame.
func (*V1Frame) GenChecksum ¶
GenChecksum implements the Frame interface.
func (*V1Frame) GetChecksum ¶
GetChecksum implements the Frame interface.
func (*V1Frame) GetComponentID ¶
GetComponentID implements the Frame interface.
func (*V1Frame) GetMessage ¶
GetMessage implements the Frame interface.
func (*V1Frame) GetSystemID ¶
GetSystemID implements the Frame interface.
type V2Frame ¶
type V2Frame struct {
IncompatibilityFlag byte
CompatibilityFlag byte
SequenceID byte
SystemID byte
ComponentID byte
Message msg.Message
Checksum uint16
SignatureLinkID byte
SignatureTimestamp uint64
Signature *V2Signature
}
V2Frame is a Mavlink V2 frame.
func (*V2Frame) GenChecksum ¶
GenChecksum implements the Frame interface.
func (*V2Frame) GenSignature ¶
func (f *V2Frame) GenSignature(key *V2Key) *V2Signature
GenSignature generates a signature with the given key.
func (*V2Frame) GetChecksum ¶
GetChecksum implements the Frame interface.
func (*V2Frame) GetComponentID ¶
GetComponentID implements the Frame interface.
func (*V2Frame) GetMessage ¶
GetMessage implements the Frame interface.
func (*V2Frame) GetSystemID ¶
GetSystemID implements the Frame interface.