system

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutRigSystem

func PutRigSystem(ctx context.Context, store datastore.Store, system *RigSystem) error

Put puts a RigSystem and all of its components into the datastore.

func WithActuators

func WithActuators(actuators ...*model.ActuatorV2) func(any) error

WithActuators is a functional option that adds the passed actuators to the RigSystem.

func WithLocation

func WithLocation(lat, long float64) func(any) error

WithLocation is a functional option which sets the latitude and longitude.

func WithPeripherals

func WithPeripherals(peripherals ...*model.Device) func(any) error

WithPeripherals is a functional option that adds the passed peripherals to the RigSystem.

func WithRigSystemDefaults

func WithRigSystemDefaults() func(any) error

WithRigSystemDefaults is a functional option that uses all of the current defaults for a rig system.

func WithSensors

func WithSensors(sensors ...*model.SensorV2) func(any) error

WithSensors is a functional option that adds the passed sensors to the RigSystem.

func WithVariables

func WithVariables(variables ...*model.Variable) func(any) error

WithVariables is a functional option that adds the passed variables to the RigSystem.

func WithWifi

func WithWifi(ssid, pass string) func(any) error

WithWifi is a functional option that sets the wifi name and password for a device.

Types

type Option

type Option func(any) error

Option represents functional options that can be passed to NewRigSystem.

type RigSystem

type RigSystem struct {
	Controller  model.Device
	Variables   []*model.Variable
	Sensors     []*model.SensorV2
	Actuators   []*model.ActuatorV2
	Peripherals []*model.Device
}

RigSystem represents a controller device which has associated variables, sensors, acuators, and peripherals.

func NewRigSystem

func NewRigSystem(skey, dkey int64, MAC, name string, options ...Option) (*RigSystem, error)

NewRigSystem returns a new RigSystem with the given options. It is the callers responsibility to put the components into the datastore.

dkey, MAC and name refer to the device key, MAC Address and name of the Controller which will be the heart of the RigSystem.

func (*RigSystem) AddVariables

func (sys *RigSystem) AddVariables(variables ...*model.Variable)

addVariables adds variables to the rig system controller. This implements the variableHolder interface.

func (*RigSystem) SetLocation

func (sys *RigSystem) SetLocation(lat, long float64)

SetLocation adds the location of the system to the system controller, as well as any defined peripherals.

func (*RigSystem) SetWifi

func (sys *RigSystem) SetWifi(ssid, pass string)

SetWifi adds the wifi name and password to the rig system Controller. This implements the wifiHolder interface.

Jump to

Keyboard shortcuts

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