device

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCreator

func RegisterCreator(kind config.DeviceKind, creator Creator)

Types

type Config

type Config interface {
	Name() string
	Kind() config.DeviceKind
	Device() string
	LogDebug() bool
	LogComDebug() bool
}

type Creator

type Creator func(deviceStruct DeviceStruct, output chan dataflow.Value) (device Device, err error)

func CreateRandomDeviceFactory

func CreateRandomDeviceFactory(registers dataflow.Registers) Creator

type Device

type Device interface {
	Config() Config
	Registers() dataflow.Registers
	SetRegisters(registers dataflow.Registers)
	Shutdown()
}

func RunDevice

func RunDevice(cfg Config, target dataflow.Fillable) (device Device, err error)

type DevicePool

type DevicePool struct {
	Devices      map[string]Device
	DevicesMutex sync.RWMutex
}

func RunPool

func RunPool() (pool *DevicePool)

func (*DevicePool) AddDevice

func (p *DevicePool) AddDevice(device Device)

func (*DevicePool) GetDevice

func (p *DevicePool) GetDevice(deviceName string) Device

func (*DevicePool) RemoveDevice

func (p *DevicePool) RemoveDevice(device Device)

func (*DevicePool) Shutdown

func (p *DevicePool) Shutdown()

type DeviceStruct

type DeviceStruct struct {
	// contains filtered or unexported fields
}

func (DeviceStruct) Config

func (c DeviceStruct) Config() Config

func (DeviceStruct) GetClosedChan

func (c DeviceStruct) GetClosedChan() chan struct{}

func (DeviceStruct) GetShutdownChan

func (c DeviceStruct) GetShutdownChan() chan struct{}

func (DeviceStruct) Registers

func (c DeviceStruct) Registers() dataflow.Registers

func (*DeviceStruct) SetRegisters

func (c *DeviceStruct) SetRegisters(registers dataflow.Registers)

func (DeviceStruct) Shutdown

func (c DeviceStruct) Shutdown()

Jump to

Keyboard shortcuts

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