application

package
v0.0.0-...-02b3c19 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecurePayloadMaxSizeExplore   = 26 // in bytes
	SecurePayloadMaxSizeAutoRoute = 28
	SecurePayloadMaxSizeNoRoute   = 34
)

Maximum possible size (in bytes) of the plaintext payload to be sent when sending a secure frame, based on the SendData options. The smallest possible must be used based on the given option bitset (e.g. if using both no route and explore, the maximum size is 26).

View Source
const MaxSecureInclusionDuration = time.Second * 60

MaxSecureInclusionDuration is the timeout for secure inclusion mode. If this timeout expires, secure inclusion will be canceled no matter how far the process has proceeded.

Variables

This section is empty.

Functions

func GenerateNetworkKey

func GenerateNetworkKey() []byte

GenerateNetworkKey generates a 16-byte encryption key using Go's crypto/rand package, which is cryptographically secure.

Types

type Controller

type Controller struct {
	APIVersion          string `json:"apiversion"`
	APILibraryType      string `json:"apilibrary_type"`
	HomeID              uint32 `json:"home_id"`
	NodeID              byte   `json:"node_id"`
	Version             byte   `json:"version"`
	APIType             string `json:"apitype"`
	IsPrimaryController bool   `json:"is_primary_controller"`
	ApplicationVersion  byte   `json:"application_version"`
	ApplicationRevision byte   `json:"application_revision"`
	SupportedFunctions  []byte `json:"supported_functions"`
	NodeList            []byte `json:"node_list"`
}

type Layer

type Layer struct {
	Controller Controller

	EventBus EventBus.Bus
	// contains filtered or unexported fields
}

Layer is the top-level controlling layer for the Z-Wave network. It maintains information about the controller itself, as well as a list of network nodes. It is responsible for routing messages between the Z-Wave controller and the in-memory representations of network nodes. This involves coordinating Z-Wave security functions (encrypting/decrypting messages, fetching nonces, etc.) and interaction with the Serial API layer.

func NewLayer

func NewLayer(serialAPI serialapi.ILayer) (app *Layer, err error)

NewLayer instantiates a new application layer, handles opening and setting up the local database, reads (or generates) a network key, starts threads to handle incming Z-Wave commands and updates, and loads basic controller data from the Z-Wave controller.

func (*Layer) AddNode

func (a *Layer) AddNode() (*Node, error)

func (*Layer) Node

func (a *Layer) Node(nodeID byte) (*Node, error)

func (*Layer) Nodes

func (a *Layer) Nodes() map[byte]*Node

func (*Layer) RemoveFailedNode

func (a *Layer) RemoveFailedNode(nodeID byte) (ok bool, err error)

func (*Layer) RemoveNode

func (a *Layer) RemoveNode() (byte, error)

func (*Layer) SendData

func (a *Layer) SendData(dstNode byte, payload encoding.BinaryMarshaler) error

func (*Layer) SendDataSecure

func (a *Layer) SendDataSecure(dstNode byte, message encoding.BinaryMarshaler) error

SendDataSecure encapsulates payload in a security encapsulation command and sends it to the destination node.

func (*Layer) Shutdown

func (a *Layer) Shutdown() error

type Node

type Node struct {
	NodeID byte

	Capability          byte
	BasicDeviceClass    byte
	GenericDeviceClass  byte
	SpecificDeviceClass byte

	Failing bool

	CommandClasses cc.CommandClassSet

	NetworkKeySent bool

	ManufacturerID uint16
	ProductTypeID  uint16
	ProductID      uint16

	QueryStageSecurity     bool
	QueryStageManufacturer bool
	QueryStageVersions     bool
	// contains filtered or unexported fields
}

Node is an in-memory representation of a Z-Wave node

func NewNode

func NewNode(application *Layer, nodeID byte) (*Node, error)

func (*Node) AddAssociation

func (n *Node) AddAssociation(groupID byte, nodeIDs ...byte) error

func (*Node) GetBasicDeviceClassName

func (n *Node) GetBasicDeviceClassName() string

func (*Node) GetGenericDeviceClassName

func (n *Node) GetGenericDeviceClassName() string

func (*Node) GetSpecificDeviceClassName

func (n *Node) GetSpecificDeviceClassName() string

func (*Node) GetSupportedCommandClassStrings

func (n *Node) GetSupportedCommandClassStrings() []string

func (*Node) GetSupportedSecureCommandClassStrings

func (n *Node) GetSupportedSecureCommandClassStrings() []string

func (*Node) IsListening

func (n *Node) IsListening() bool

func (*Node) IsSecure

func (n *Node) IsSecure() bool

func (*Node) LoadCommandClassVersions

func (n *Node) LoadCommandClassVersions() error

func (*Node) LoadManufacturerInfo

func (n *Node) LoadManufacturerInfo() error

func (*Node) LoadSupportedSecurityCommands

func (n *Node) LoadSupportedSecurityCommands() error

func (*Node) RequestNodeInformationFrame

func (n *Node) RequestNodeInformationFrame() error

func (*Node) SendCommand

func (n *Node) SendCommand(command cc.Command) error

func (*Node) SendRawCommand

func (n *Node) SendRawCommand(payload []byte) error

func (*Node) String

func (n *Node) String() string

Jump to

Keyboard shortcuts

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