device

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMock

func IsMock() bool

func Mock

func Mock(mocking bool)

Types

type Device

type Device struct {

	// Last Error encountered
	Error error

	Opener
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(name string) *Device

NewDevice creates a new device with the given name

func (*Device) AddPub

func (d *Device) AddPub(p string)

AddPub adds a publication

func (*Device) GetPub

func (d *Device) GetPub() string

func (*Device) GetSubs

func (d *Device) GetSubs() []string

func (*Device) JSON

func (d *Device) JSON() []byte

func (Device) Name

func (d Device) Name() string

func (*Device) Publish

func (d *Device) Publish(data any)

func (*Device) String

func (d *Device) String() string

func (*Device) Subscribe

func (d *Device) Subscribe(topic string, f func(*messanger.Msg))

func (*Device) TimerLoop

func (d *Device) TimerLoop(period time.Duration, done chan any, readpub func() error)

type DeviceManager

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

func GetDeviceManager

func GetDeviceManager() *DeviceManager

func (*DeviceManager) Add

func (dm *DeviceManager) Add(d Name)

func (*DeviceManager) Get

func (dm *DeviceManager) Get(name string) (Name, bool)

type Name

type Name interface {
	Name() string
}

type OnOff

type OnOff interface {
	On()
	Off()
}

type Opener

type Opener interface {
	Open() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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