portal

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMismatchBytes  = errors.New("number of bytes received mismatch")
	ErrTimeoutRead    = errors.New("read timeout expired")
	ErrUnexpectedChar = errors.New("unexpected char after escape character")

	ErrResponseLength       = errors.New("invalid response length")
	ErrResponseStatusLength = errors.New("invalid response status length")
)

Functions

func Read

func Read(port *serial.SerialObj, timeout time.Duration) ([]byte, error)

func Write

func Write(port *serial.SerialObj, data []byte) error

Types

type MsgObj

type MsgObj struct {
	Direction code.DirectionType
	Opcode    code.OpType

	Data   []byte
	Length int

	Checksum []byte
}

type ResponseObj

type ResponseObj struct {
	Status    bool
	ErrorCode code.ErrType
	// contains filtered or unexported fields
}

func Response

func Response(data []byte) (*ResponseObj, error)

func (*ResponseObj) Checksum

func (r *ResponseObj) Checksum() []byte

func (*ResponseObj) Data

func (r *ResponseObj) Data() []byte

func (*ResponseObj) String

func (r *ResponseObj) String() string

Jump to

Keyboard shortcuts

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