packet

package
v0.0.0-...-f2d3015 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxUint24 = 0x00FFFFFF

Variables

This section is empty.

Functions

func RmapCrc8

func RmapCrc8(data []byte) (crc uint8)

Types

type Packet

type Packet interface {
	Encode() ([]byte, error)

	// VerifyData makes sure that the data checksum matches, if relevant
	VerifyData() bool

	IsValid() bool
	PathBytes() (routing []uint8, npath int)
	MergePath(path Path) (Packet, error)
}

func DecodePacket

func DecodePacket(packet []byte) (Packet, error)

type Path

type Path []uint8

type ReadPacket

type ReadPacket struct {
	DestinationPath           Path
	DestinationLogicalAddress uint8 // should default to 254
	OptIncrement              bool
	DestinationKey            uint8
	SourcePath                Path
	SourceLogicalAddress      uint8 // should default to 254
	TransactionIdentifier     uint16
	ExtendedReadAddress       uint8
	ReadAddress               uint32
	DataLength                uint32
}

func (ReadPacket) Encode

func (rp ReadPacket) Encode() ([]byte, error)

func (ReadPacket) IsValid

func (rp ReadPacket) IsValid() bool

func (ReadPacket) MergePath

func (rp ReadPacket) MergePath(path Path) (Packet, error)

func (ReadPacket) PathBytes

func (rp ReadPacket) PathBytes() (routing []uint8, npath int)

func (ReadPacket) VerifyData

func (rp ReadPacket) VerifyData() bool

type ReadReply

type ReadReply struct {
	SourcePath                Path
	SourceLogicalAddress      uint8 // should default to 254
	OptIncrement              bool
	Status                    uint8 // 0 for successful execution
	DestinationLogicalAddress uint8 // should default to 254
	TransactionIdentifier     uint16
	DataBytes                 []byte
}

func (ReadReply) Encode

func (rr ReadReply) Encode() ([]byte, error)

func (ReadReply) IsValid

func (rr ReadReply) IsValid() bool

func (ReadReply) MergePath

func (rr ReadReply) MergePath(path Path) (Packet, error)

func (ReadReply) PathBytes

func (rr ReadReply) PathBytes() (routing []uint8, npath int)

func (ReadReply) VerifyData

func (rr ReadReply) VerifyData() bool

type WritePacket

type WritePacket struct {
	DestinationPath           Path
	DestinationLogicalAddress uint8 // should default to 254
	OptVerifyData             bool
	OptAcknowledge            bool
	OptIncrement              bool
	DestinationKey            uint8
	SourcePath                Path
	SourceLogicalAddress      uint8 // should default to 254
	TransactionIdentifier     uint16
	ExtendedWriteAddress      uint8
	WriteAddress              uint32
	DataBytes                 []byte
	DataCRC                   uint8
}

func (WritePacket) Encode

func (wp WritePacket) Encode() ([]byte, error)

func (WritePacket) IsValid

func (wp WritePacket) IsValid() bool

func (WritePacket) MergePath

func (wp WritePacket) MergePath(path Path) (Packet, error)

func (WritePacket) PathBytes

func (wp WritePacket) PathBytes() (routing []uint8, npath int)

func (WritePacket) VerifyData

func (wp WritePacket) VerifyData() bool

type WriteReply

type WriteReply struct {
	SourcePath                Path
	SourceLogicalAddress      uint8 // should default to 254
	OptVerifyData             bool
	OptIncrement              bool
	Status                    uint8 // 0 for successful execution
	DestinationLogicalAddress uint8 // should default to 254
	TransactionIdentifier     uint16
}

func (WriteReply) Encode

func (wr WriteReply) Encode() ([]byte, error)

func (WriteReply) IsValid

func (wr WriteReply) IsValid() bool

func (WriteReply) MergePath

func (wr WriteReply) MergePath(path Path) (Packet, error)

func (WriteReply) PathBytes

func (wr WriteReply) PathBytes() (routing []uint8, npath int)

func (WriteReply) VerifyData

func (wr WriteReply) VerifyData() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL