devices

package
v0.0.0-...-8eff502 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	DeviceIdentifier
	// The Ethernet hardware address of the device, globally unique & assigned by the manufacturer
	MAC net.HardwareAddr `db:"mac" json:"mac"`
	// The host address of the device (Host address or resolvable hostname), assigned on this network
	Host string `db:"host" json:"host"`
	// The local unique name of the device, defined by the user
	Name   string `db:"name" json:"name"`
	Info   string `db:"info"`
	Config string `db:"config"`
	Status string `db:"status"`
}

func NewDevice

func NewDevice(manufacturer, id, name, host string, mac net.HardwareAddr) *Device

type DeviceIdentifier

type DeviceIdentifier struct {
	// The manufacturer of the device
	Manufacturer string `db:"manufacturer" json:"manufacturer"`
	// The unique identifier of the device, defined by the manufacturer
	ID string `db:"id" json:"id"`
}

type DeviceManager

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

func NewDeviceManager

func NewDeviceManager(log logr.Logger, storage *DeviceStorage) *DeviceManager

func (*DeviceManager) DiscoverDevices

func (dm *DeviceManager) DiscoverDevices(service string, interval time.Duration, identify IdentifyDeviceFromZeroConfEntry, init InitializeDeviceFromZeroConfEntry)

func (*DeviceManager) StopDiscovery

func (dm *DeviceManager) StopDiscovery()

type DeviceStorage

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

func NewDeviceStorage

func NewDeviceStorage(log logr.Logger, dbName string) (*DeviceStorage, error)

func (*DeviceStorage) AddDeviceIfUnknown

func (s *DeviceStorage) AddDeviceIfUnknown(device *Device) error

func (*DeviceStorage) Close

func (s *DeviceStorage) Close()

func (*DeviceStorage) DeleteDevice

func (s *DeviceStorage) DeleteDevice(mac string) error

func (*DeviceStorage) GetAllDevices

func (s *DeviceStorage) GetAllDevices() ([]Device, error)

func (*DeviceStorage) GetDeviceByID

func (s *DeviceStorage) GetDeviceByID(id string) (*Device, error)

func (*DeviceStorage) GetDeviceByIdentifier

func (s *DeviceStorage) GetDeviceByIdentifier(identifier string) (*Device, error)

func (*DeviceStorage) GetDeviceByMAC

func (s *DeviceStorage) GetDeviceByMAC(mac string) (*Device, error)

func (*DeviceStorage) GetDeviceByManufacturerAndID

func (s *DeviceStorage) GetDeviceByManufacturerAndID(manufacturer, id string) (*Device, error)

func (*DeviceStorage) GetDeviceByName

func (s *DeviceStorage) GetDeviceByName(name string) (*Device, error)

func (*DeviceStorage) UpdateDevice

func (s *DeviceStorage) UpdateDevice(device Device) error

func (*DeviceStorage) UpsertDevice

func (s *DeviceStorage) UpsertDevice(device *Device) error

type IdentifyDeviceFromZeroConfEntry

type IdentifyDeviceFromZeroConfEntry func(log logr.Logger, entry *zeroconf.ServiceEntry) (*DeviceIdentifier, error)

type InitializeDeviceFromZeroConfEntry

type InitializeDeviceFromZeroConfEntry func(log logr.Logger, entry *zeroconf.ServiceEntry) (*Device, error)

function type that knows how to mak a zerofon entry into a device

Jump to

Keyboard shortcuts

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