Documentation
¶
Overview ¶
Easy Zigbee Stack - the goal is to be easiest-to-understand Zigbee codebase available.
Index ¶
- Constants
- type Channels
- type Device
- type DeviceAndEndpoint
- type DeviceIncomingMessage
- type Endpoint
- type Model
- type NodeDatabase
- type PowerSource
- type Stack
- func (s *Stack) BindToCoordinator(sourceAddress zigbee.IEEEAddress, sourceEndpoint zigbee.EndpointId, ...) error
- func (s *Stack) Channels() *Channels
- func (s *Stack) ConfigureReporting(nwkAddress string, clusterId cluster.ClusterId, ...) error
- func (f *Stack) LocalCommand(dev DeviceAndEndpoint, command cluster.LocalCommand) error
- func (s *Stack) ReadAttributes(nwkAddress string, clusterId cluster.ClusterId, ...) (*cluster.ReadAttributesResponse, error)
- func (s *Stack) Run(ctx context.Context, joinEnable bool, packetCaptureFilename string, ...) error
- func (s *Stack) WriteAttributes(nwkAddress string, clusterId cluster.ClusterId, ...) (*cluster.WriteAttributesResponse, error)
Constants ¶
const (
DefaultSingleEndpointId = 1 // for simple single-endpoint devices, its endpoint ID usually is 1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channels ¶
type Channels struct {
// contains filtered or unexported fields
}
func (*Channels) OnDeviceBecameAvailable ¶
TODO: document what's the difference between available and registered seems to be signalled only when device's network address changes
func (*Channels) OnDeviceIncomingMessage ¶
func (c *Channels) OnDeviceIncomingMessage() chan *DeviceIncomingMessage
"application-level" message, i.e. sensor sending data TODO: rename to reduce confusion between device registration (name sounds like device is incoming to the cluster..)
func (*Channels) OnDeviceRegistered ¶
func (*Channels) OnDeviceUnregistered ¶
type Device ¶
type Device struct { IEEEAddress zigbee.IEEEAddress // "MAC address" that never changes. longer form of *NetworkAddress*, but curiously not present in incoming messages, so what is it used for? NetworkAddress string // shorter address that is used in Zigbee frames. this changes each time the device leaves and then enters the network Manufacturer string ManufacturerId uint16 Model Model LogicalType zigbee.LogicalType // coordinator | router | end device MainPowered bool PowerSource PowerSource Endpoints []*Endpoint }
type DeviceAndEndpoint ¶
type DeviceAndEndpoint struct { NetworkAddress string EndpointId zigbee.EndpointId }
combines device and endpoint, since they both are needed when communicating with a device
type DeviceIncomingMessage ¶
type DeviceIncomingMessage struct { Device *Device IncomingMessage *zcl.ZclIncomingMessage }
type Endpoint ¶
type Endpoint struct { Id zigbee.EndpointId ProfileId uint16 DeviceId uint16 DeviceVersion uint8 InClusterList []cluster.ClusterId // input, i.e. what endpoint attributes the device can receive from us OutClusterList []cluster.ClusterId // output, i.e. what endpoint attributes the device can send to us }
I think the value proposition of "endpoint" is because you simply cannot set OnOff cluster's "on" attribute for *the entire Zigbee device* - what if it's a Zigbee power strip? E.g. with endpoints the Zigbee device (= power strip) can present its multiple sockets separately
type NodeDatabase ¶
type PowerSource ¶
type PowerSource uint8
const ( Unknown PowerSource = iota MainsSinglePhase Mains2Phase Battery DCSource EmergencyMainsConstantlyPowered EmergencyMainsAndTransfer )
func (PowerSource) String ¶
func (ps PowerSource) String() string
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func New ¶
func New(configuration coordinator.Configuration, db NodeDatabase) *Stack
func (*Stack) BindToCoordinator ¶
func (s *Stack) BindToCoordinator( sourceAddress zigbee.IEEEAddress, sourceEndpoint zigbee.EndpointId, clusterId cluster.ClusterId, coordinatorEndpoint zigbee.EndpointId, ) error
func (*Stack) ConfigureReporting ¶
func (s *Stack) ConfigureReporting(nwkAddress string, clusterId cluster.ClusterId, configs ...*cluster.AttributeReportingConfigurationRecord) error
ZCL spec section 2.5.7
func (*Stack) LocalCommand ¶
func (f *Stack) LocalCommand(dev DeviceAndEndpoint, command cluster.LocalCommand) error
func (*Stack) ReadAttributes ¶
func (s *Stack) ReadAttributes( nwkAddress string, clusterId cluster.ClusterId, attributeIds []cluster.AttributeId, ) (*cluster.ReadAttributesResponse, error)
ZCL spec section 2.5.1
func (*Stack) Run ¶
func (s *Stack) Run(ctx context.Context, joinEnable bool, packetCaptureFilename string, settingsFlash bool) error
if *packetCaptureFile* non-empty, specifies a file to log inbound UNP frames
func (*Stack) WriteAttributes ¶
func (s *Stack) WriteAttributes(nwkAddress string, clusterId cluster.ClusterId, writeAttributeRecords []*cluster.WriteAttributeRecord) (*cluster.WriteAttributesResponse, error)
ZCL spec section 2.5.3
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Zigbee protocol
|
Zigbee protocol |
Zigbee Network Processor.
|
Zigbee Network Processor. |
unp
UNP is a framing protocol (commandtype, subsystem, command, payload) for communicating with Texas Instruments radio devices
|
UNP is a framing protocol (commandtype, subsystem, command, payload) for communicating with Texas Instruments radio devices |