internal

package
v0.0.0-...-0583f8e Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartDelimSize = 2
	ChecksumSize   = 2

	RocketPacketStart uint16 = 's'
	AcknowledgeStart  uint16 = 0xface
	CommandStart      uint16 = 0xface
)

Variables

View Source
var ErrInvalidChecksum = e.New("packet checksum validation failed")

Functions

func ReadBinary

func ReadBinary(reader io.Reader) (result interface{}, err error)

ReadBinary reads and unmarshall the next packet from a raw binary io.Reader

func ReadCsv

func ReadCsv(reader io.Reader) ([]packet.RocketPacket, error)

ReadCsv reads and transforms all the data from the reader to a list of packet.RocketPacket.

IMPORTANT: Do NOT use on large files. Instead use csvutil.Decoder and process the file line by line (don't store the whole file in memory).

func ReadCsvFile

func ReadCsvFile(csvPath string) ([]packet.RocketPacket, error)

ReadCsvFile reads a CSV file and returns a list of packet.RocketPacket.

IMPORTANT: Do NOT use on large files. Instead use csvutil.Decoder and process the file line by line (don't store the whole file in memory).

func WriteBinary

func WriteBinary(writer io.Writer, delimiter uint16, packet interface{}) (err error)

WriteBinary TODO doc

func WriteCommandBinary

func WriteCommandBinary(writer io.Writer, cmdPacket packet.CommandPacket) error

WriteCommandBinary TODO doc

Types

type ErrUnknownStart

type ErrUnknownStart struct {
	Char uint16
}

func (ErrUnknownStart) Error

func (e ErrUnknownStart) Error() string

type SaveDataHandler

type SaveDataHandler struct {
	Output  *csvutil.Encoder
	Enabled bool
}

func (*SaveDataHandler) OnData

func (s *SaveDataHandler) OnData(packets []packet.RocketPacket)

Jump to

Keyboard shortcuts

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