serialapi

package
v0.0.0-...-c4a4cf6 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRemoveNodeCallback

type AddRemoveNodeCallback struct {
	CommandID      byte
	CallbackID     byte
	Status         byte
	Source         byte
	Length         byte
	Basic          byte
	Generic        byte
	Specific       byte
	CommandClasses []byte
}

AddRemoveNodeCallback contains callback info for add/remove node.

type ApplicationCommand

type ApplicationCommand struct {
	CommandID     byte
	ReceiveStatus byte
	DstNodeID     byte
	SrcNodeID     byte
	CmdLength     byte
	CommandData   []byte
}

ApplicationCommand contains an application level command.

type Capabilities

type Capabilities struct {
	ApplicationVersion  byte
	ApplicationRevision byte
	Manufacturer1       byte
	Manufacturer2       byte
	ProductType1        byte
	ProductType2        byte
	ProductID1          byte
	ProductID2          byte
	SupportedFunctions  []byte
}

Capabilities contains the serial api capabilities of the controller.

func (*Capabilities) GetSupportedFunctions

func (s *Capabilities) GetSupportedFunctions() []byte

GetSupportedFunctions returns the supported functions.

type ControllerUpdate

type ControllerUpdate struct {
	Status         byte
	NodeID         byte
	Length         byte
	Basic          byte
	Generic        byte
	Specific       byte
	CommandClasses []byte
}

ControllerUpdate .

func (*ControllerUpdate) GetStatusString

func (a *ControllerUpdate) GetStatusString() string

GetStatusString will get the controller status as a string

type ILayer

type ILayer interface {
	ControllerUpdates() chan ControllerUpdate
	ControllerCommands() chan ApplicationCommand
	AddNode() (*AddRemoveNodeCallback, error)
	RemoveNode() (*AddRemoveNodeCallback, error)
	GetCapabilities() (*Capabilities, error)
	GetVersion() (version *Version, err error)
	MemoryGetID() (homeID uint32, nodeID byte, err error)
	GetInitAppData() (*InitAppData, error)
	GetNodeProtocolInfo(nodeID byte) (nodeInfo *NodeProtocolInfo, err error)
	SendData(nodeID byte, payload []byte) (txTime uint16, err error)
	IsFailedNode(nodeID byte) (failed bool, err error)
	RemoveFailedNode(nodeID byte) (removed bool, err error)
	RequestNodeInfo(nodeInfo byte) (*NodeInfoFrame, error)
	SoftReset()
}

ILayer is an interface for the serialapi layer.

type InitAppData

type InitAppData struct {
	CommandID    byte
	Version      byte
	Capabilities byte
	Nodes        []byte
	ChipType     byte
	ChipVersion  byte
}

InitAppData contains data to initialize application

func (*InitAppData) GetAPIType

func (n *InitAppData) GetAPIType() string

GetAPIType will return the API type (slave or controller)

func (*InitAppData) GetNodeIDs

func (n *InitAppData) GetNodeIDs() []byte

GetNodeIDs will return all node ids

func (*InitAppData) IsPrimaryController

func (n *InitAppData) IsPrimaryController() bool

IsPrimaryController returns if this is the primary controller.

func (*InitAppData) TimerFunctionsSupported

func (n *InitAppData) TimerFunctionsSupported() bool

TimerFunctionsSupported returns whether timer functions are supported.

type Layer

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

Layer contains the serial api layer.

func NewLayer

func NewLayer(ctx context.Context, sessionLayer session.ILayer, logger *zap.Logger) *Layer

NewLayer returns a new serialapi layer.

func (*Layer) AddNode

func (s *Layer) AddNode() (*AddRemoveNodeCallback, error)

AddNode will put the controller into add node mode and handle operations for adding a node.

func (*Layer) ControllerCommands

func (s *Layer) ControllerCommands() chan ApplicationCommand

ControllerCommands returns a channel for application commands.

func (*Layer) ControllerUpdates

func (s *Layer) ControllerUpdates() chan ControllerUpdate

ControllerUpdates returns a channel for controller updates.

func (*Layer) GetCapabilities

func (s *Layer) GetCapabilities() (*Capabilities, error)

GetCapabilities will return the serial api capabilities.

func (*Layer) GetInitAppData

func (s *Layer) GetInitAppData() (*InitAppData, error)

GetInitAppData will return data required to initialize the application.

func (*Layer) GetNodeProtocolInfo

func (s *Layer) GetNodeProtocolInfo(nodeID byte) (nodeInfo *NodeProtocolInfo, err error)

GetNodeProtocolInfo will retrieve protocol info for a node.

func (*Layer) GetVersion

func (s *Layer) GetVersion() (version *Version, err error)

GetVersion will retrieve version information.

func (*Layer) IsFailedNode

func (s *Layer) IsFailedNode(nodeID byte) (failed bool, err error)

IsFailedNode Will return if a node has failed.

func (*Layer) MemoryGetID

func (s *Layer) MemoryGetID() (homeID uint32, nodeID byte, err error)

MemoryGetID will get the home/node id.

func (*Layer) RemoveFailedNode

func (s *Layer) RemoveFailedNode(nodeID byte) (removed bool, err error)

RemoveFailedNode will remove a failed node.

func (*Layer) RemoveNode

func (s *Layer) RemoveNode() (*AddRemoveNodeCallback, error)

RemoveNode will put the controller into remove node mode and handle all operations.

func (*Layer) RequestNodeInfo

func (s *Layer) RequestNodeInfo(nodeID byte) (*NodeInfoFrame, error)

RequestNodeInfo will request info for a node.

func (*Layer) SendData

func (s *Layer) SendData(nodeID byte, payload []byte) (txTime uint16, err error)

SendData will send data to a node.

func (*Layer) SoftReset

func (s *Layer) SoftReset()

SoftReset will perform a soft reset on the device. WARNING: This can (and often will) cause the device to get a new USB address, rendering the serial port's file descriptor invalid.

type NodeInfoFrame

type NodeInfoFrame struct {
}

NodeInfoFrame contains a node info frame.

type NodeProtocolInfo

type NodeProtocolInfo struct {
	Capability          byte
	Security            byte
	BasicDeviceClass    byte
	GenericDeviceClass  byte
	SpecificDeviceClass byte
}

NodeProtocolInfo contains protocol info for a node.

func (*NodeProtocolInfo) GetBasicDeviceClassName

func (n *NodeProtocolInfo) GetBasicDeviceClassName() string

GetBasicDeviceClassName will return the basic device class as a string

func (*NodeProtocolInfo) GetGenericDeviceClassName

func (n *NodeProtocolInfo) GetGenericDeviceClassName() string

GetGenericDeviceClassName will return the generic device class as a string

func (*NodeProtocolInfo) GetSpecificDeviceClassName

func (n *NodeProtocolInfo) GetSpecificDeviceClassName() string

GetSpecificDeviceClassName will return the specific device class as a string

func (*NodeProtocolInfo) IsListening

func (n *NodeProtocolInfo) IsListening() bool

IsListening returns whether a node is listening.

type Version

type Version struct {
	Version     string
	LibraryType byte
}

Version contains version information.

func (*Version) GetLibraryTypeString

func (v *Version) GetLibraryTypeString() string

GetLibraryTypeString will return the string representation of the library type.

Jump to

Keyboard shortcuts

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