Documentation ¶
Index ¶
- Constants
- func GenerateNetworkKey() []byte
- type Controller
- type Layer
- func (a *Layer) AddNode() (*Node, error)
- func (a *Layer) Node(nodeID byte) (*Node, error)
- func (a *Layer) Nodes() map[byte]*Node
- func (a *Layer) RemoveFailedNode(nodeID byte) (ok bool, err error)
- func (a *Layer) RemoveNode() (byte, error)
- func (a *Layer) SendData(dstNode byte, payload encoding.BinaryMarshaler) error
- func (a *Layer) SendDataSecure(dstNode byte, message encoding.BinaryMarshaler) error
- func (a *Layer) Shutdown() error
- type Node
- func (n *Node) AddAssociation(groupID byte, nodeIDs ...byte) error
- func (n *Node) GetBasicDeviceClassName() string
- func (n *Node) GetGenericDeviceClassName() string
- func (n *Node) GetSpecificDeviceClassName() string
- func (n *Node) GetSupportedCommandClassStrings() []string
- func (n *Node) GetSupportedSecureCommandClassStrings() []string
- func (n *Node) IsListening() bool
- func (n *Node) IsSecure() bool
- func (n *Node) LoadCommandClassVersions() error
- func (n *Node) LoadManufacturerInfo() error
- func (n *Node) LoadSupportedSecurityCommands() error
- func (n *Node) RequestNodeInformationFrame() error
- func (n *Node) SendCommand(command cc.Command) error
- func (n *Node) SendRawCommand(payload []byte) error
- func (n *Node) String() string
Constants ¶
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).
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 ¶
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) RemoveNode ¶
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.
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