FakeSerialDevice

package
v0.0.0-...-2d867ee Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SerialName is the name we are going to assign to our fake serial device
	SerialName = "/dev/fakeprinter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeSerial

type FakeSerial struct {

	// Streams
	ReceiveStream chan byte
	SendStream    chan byte

	// Address
	Address string

	SlaveOpen     bool
	SlaveOpenChan chan bool
	// contains filtered or unexported fields
}

FakeSerial is an object that will emulate a serial device

func NewFakeSerial

func NewFakeSerial() *FakeSerial

NewFakeSerial will construct a new fake serial device

func (*FakeSerial) Check

func (fs *FakeSerial) Check(event *fsEvents.FsEvent) bool

Check is a interface to fsEvents

func (*FakeSerial) Close

func (fs *FakeSerial) Close()

Close will close the pty connection

func (*FakeSerial) GetMask

func (fs *FakeSerial) GetMask() uint32

GetMask is a interface to fsEvents

func (*FakeSerial) Handle

func (fs *FakeSerial) Handle(w *fsEvents.Watcher, event *fsEvents.FsEvent) error

Handle is a interface to fsEvents

func (*FakeSerial) ReadMaster

func (fs *FakeSerial) ReadMaster()

ReadMaster will read all available bytes coming in over the serial device

func (*FakeSerial) SendBytes

func (fs *FakeSerial) SendBytes(buf []byte)

func (*FakeSerial) SendMaster

func (fs *FakeSerial) SendMaster()

SendMaster will send any bytes that come over the stream

type SerialState

type SerialState interface {
	SerialOpened()
	SerialClosed()
}

SerialState is an interface that can be passed to a register function for state events

Jump to

Keyboard shortcuts

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