deviceparameters

package module
v0.4.0-1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 9 Imported by: 2

README

go-devparam

Go library and applications for accessing device parameters using the deviceparameters protocol: https://github.com/thinnect/tos-devparam.

deviceparameter A basic utility for dealing with individual nodes and parameters. See the deviceparameter README for details.

deviceparameters A utility for dealing with several parameters on multiple nodes. See the deviceparameters README for details.

Dependencies

Go dependencies have been vendored as submodules under the vendor directory.

Building the deb package requires checkinstall and ronn.

ronn can be obtained from https://github.com/rtomayko/ronn.

Building

Check out all submodules, install ronn and checkinstall.

Enter cmd/deviceparameter or cmd/deviceparameters and execute make or enter cmd and execute the build-deb.sh script.

Both applications can be cross-compiled for Windows and for use on ARM based Linux platforms, though packaging only works on the native architecture. Take a look at the Makefiles for details.

Documentation

Index

Constants

View Source
const AMID_DEVICE_PARAMETERS = 0x82
View Source
const DP_ERROR_PARAMETER_ID = 0xF0
View Source
const DP_ERROR_PARAMETER_SEQNUM = 0xF1
View Source
const DP_GET_PARAMETER_WITH_ID = 0x21
View Source
const DP_GET_PARAMETER_WITH_SEQNUM = 0x22
View Source
const DP_HEARTBEAT = 0x00
View Source
const DP_PARAMETER = 0x10
View Source
const DP_SET_PARAMETER_WITH_ID = 0x31
View Source
const DP_SET_PARAMETER_WITH_SEQNUM = 0x32
View Source
const TOS_SERIAL_DEVICE_PARAMETERS_ID = 0x80

Variables

View Source
var DeviceParameterStringToType = map[string]DeviceParameterType{}
View Source
var DeviceParameterTypeToString = map[DeviceParameterType]string{
	DP_TYPE_RAW:    "raw",
	DP_TYPE_UINT8:  "u8",
	DP_TYPE_UINT16: "u16",
	DP_TYPE_UINT32: "u32",
	DP_TYPE_UINT64: "u64",

	DP_TYPE_STRING: "str",
	DP_TYPE_INT8:   "i8",
	DP_TYPE_INT16:  "i16",
	DP_TYPE_INT32:  "i32",
	DP_TYPE_INT64:  "i64",

	DP_TYPE_NIL: "nil",
}

Functions

func NewInvalidParameterValueError

func NewInvalidParameterValueError(text string) error

func NewParameterError

func NewParameterError(text string) error

func NewTimeoutError

func NewTimeoutError(text string) error

func NewValueMismatchError

func NewValueMismatchError(text string) error

func ParameterValueString

func ParameterValueString(dpt DeviceParameterType, value []byte) (string, error)

func ParseParameterValue

func ParseParameterValue(tpt DeviceParameterType, tval string) ([]byte, error)

Types

type DeviceParameter

type DeviceParameter struct {
	Name      string
	Type      DeviceParameterType
	Seqnum    uint8
	Value     []byte
	Timestamp time.Time
	Error     error
}

func (*DeviceParameter) String

func (self *DeviceParameter) String() string

type DeviceParameterManager

type DeviceParameterManager struct {
	loggers.DIWEloggers
	// contains filtered or unexported fields
}

func NewDeviceParameterActiveMessageManager

func NewDeviceParameterActiveMessageManager(sfc moteconnection.MoteConnection, group moteconnection.AMGroup, address moteconnection.AMAddr, destination moteconnection.AMAddr) *DeviceParameterManager

func NewDeviceParameterManager

func NewDeviceParameterManager(sfc moteconnection.MoteConnection) *DeviceParameterManager

func (*DeviceParameterManager) Close

func (self *DeviceParameterManager) Close() error

func (*DeviceParameterManager) GetList

func (self *DeviceParameterManager) GetList() (chan *DeviceParameter, error)

func (*DeviceParameterManager) GetValue

func (self *DeviceParameterManager) GetValue(name string) (*DeviceParameter, error)

func (*DeviceParameterManager) SetRetries

func (self *DeviceParameterManager) SetRetries(retries int)

func (*DeviceParameterManager) SetTimeout

func (self *DeviceParameterManager) SetTimeout(timeout time.Duration)

func (*DeviceParameterManager) SetValue

func (self *DeviceParameterManager) SetValue(name string, value []byte) (*DeviceParameter, error)

type DeviceParameterType

type DeviceParameterType uint8
const (
	DP_TYPE_RAW    DeviceParameterType = 0x00
	DP_TYPE_UINT8  DeviceParameterType = 0x01
	DP_TYPE_UINT16 DeviceParameterType = 0x02
	DP_TYPE_UINT32 DeviceParameterType = 0x04
	DP_TYPE_UINT64 DeviceParameterType = 0x08

	DP_TYPE_STRING DeviceParameterType = 0x80
	DP_TYPE_INT8   DeviceParameterType = 0x81
	DP_TYPE_INT16  DeviceParameterType = 0x82
	DP_TYPE_INT32  DeviceParameterType = 0x84
	DP_TYPE_INT64  DeviceParameterType = 0x88

	DP_TYPE_NIL DeviceParameterType = 0xFF
)

func ParseDeviceParameterType

func ParseDeviceParameterType(name string) (DeviceParameterType, error)

func (DeviceParameterType) String

func (dpt DeviceParameterType) String() string

type DpErrorParameterId

type DpErrorParameterId struct {
	Header   uint8
	Exists   bool
	Err      uint8
	IdLength uint8 `sfpacket:"len(Id)"`
	Id       string
}

type DpErrorParameterSeqnum

type DpErrorParameterSeqnum struct {
	Header uint8
	Exists bool
	Err    uint8
	Seqnum uint8
}

type DpGetParameterId

type DpGetParameterId struct {
	Header   uint8
	IdLength uint8 `sfpacket:"len(Id)"`
	Id       string
}

type DpGetParameterSeqnum

type DpGetParameterSeqnum struct {
	Header uint8
	Seqnum uint8
}

type DpHeartbeat

type DpHeartbeat struct {
	Header uint8
	Eui64  uint64
	Uptime uint32
}

type DpParameter

type DpParameter struct {
	Header      uint8
	Type        uint8
	Seqnum      uint8
	IdLength    uint8 `sfpacket:"len(Id)"`
	ValueLength uint8 `sfpacket:"len(Value)"`
	Id          string
	Value       []byte
}

type DpSetParameterId

type DpSetParameterId struct {
	Header      uint8
	IdLength    uint8 `sfpacket:"len(Id)"`
	ValueLength uint8 `sfpacket:"len(Value)"`
	Id          string
	Value       []byte
}

type DpSetParameterSeqnum

type DpSetParameterSeqnum struct {
	Header      uint8
	Seqnum      uint8
	ValueLength uint8 `sfpacket:"len(Value)"`
	Value       []byte
}

type InvalidParameterValueError

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

func (InvalidParameterValueError) Error

func (self InvalidParameterValueError) Error() string

type ParameterError

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

func (ParameterError) Error

func (self ParameterError) Error() string

type TimeoutError

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

func (TimeoutError) Error

func (self TimeoutError) Error() string

type ValueMismatchError

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

func (ValueMismatchError) Error

func (self ValueMismatchError) Error() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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