zigbee

package module
v0.0.0-...-6c2328d Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 24

README

Shimmering Bee: Zigbee Common

license standard-readme compliant Actions Status

Implementation of common Zigbee functionality, written in Go.

Table of Contents

Background

Zigbee is a library of common Zigbee functionality used within the Shimmering Bee suite of applications.

Install

Add an import and most IDEs will go get automatically, if it doesn't go build will fetch.

import "github.com/shimmeringbee/zigbee"

Usage

This libraries API is unstable and should not yet be relied upon.

Most of the zigbee library are constants and struct definitions, however a random Zigbee configuration can be created with.

netCfg, _ := zigbee.GenerateNetworkConfiguration()

Maintainers

@pwood

Contributing

Feel free to dive in! Open an issue or submit PRs.

All Shimmering Bee projects follow the Contributor Covenant Code of Conduct.

License

Copyright 2019-2020 Shimmering Bee Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

View Source
const NoManufacturer = ManufacturerCode(0x0000)

Variables

View Source
var ChannelToFrequencies = map[uint8]uint16{
	11: 2405,
	12: 2410,
	13: 2415,
	14: 2420,
	15: 2425,
	16: 2430,
	17: 2435,
	18: 2440,
	19: 2445,
	20: 2450,
	21: 2455,
	22: 2460,
	23: 2465,
	24: 2470,
	25: 2475,
	26: 2480,
}
View Source
var Channels = []uint8{11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
View Source
var DefaultChannel = ZLLChannels[1]
View Source
var EmptyIEEEAddress = IEEEAddress(0)
View Source
var TCLinkKey = NetworkKey{0x5a, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x30, 0x39}
View Source
var ZLLChannels = []uint8{11, 15, 20, 25}

Functions

This section is empty.

Types

type AdapterInfo

type AdapterInfo interface {
	AdapterNode() Node
}

type ApplicationMessage

type ApplicationMessage struct {
	ClusterID           ClusterID
	SourceEndpoint      Endpoint
	DestinationEndpoint Endpoint
	Data                []byte
}

type ClusterID

type ClusterID uint16

func (ClusterID) IsManufacturerSpecific

func (z ClusterID) IsManufacturerSpecific() bool

type Endpoint

type Endpoint uint8

type EndpointDescription

type EndpointDescription struct {
	Endpoint       Endpoint
	ProfileID      ProfileID
	DeviceID       uint16
	DeviceVersion  uint8
	InClusterList  []ClusterID
	OutClusterList []ClusterID
}

type EndpointRegistration

type EndpointRegistration interface {
	RegisterAdapterEndpoint(ctx context.Context, endpoint Endpoint, appProfileId ProfileID, appDeviceId uint16, appDeviceVersion uint8, inClusters []ClusterID, outClusters []ClusterID) error
}

type Error

type Error string

Error retypes a string so that constant errors can be used.

func (Error) Error

func (e Error) Error() string

Error returns the reason for the error.

type EventReceiver

type EventReceiver interface {
	ReadEvent(ctx context.Context) (interface{}, error)
}

type ExtendedPANID

type ExtendedPANID uint64

type GroupID

type GroupID uint16

type IEEEAddress

type IEEEAddress uint64

func GenerateLocalAdministeredIEEEAddress

func GenerateLocalAdministeredIEEEAddress() IEEEAddress

func (IEEEAddress) String

func (a IEEEAddress) String() string

type IncomingMessage

type IncomingMessage struct {
	GroupID            GroupID
	SourceAddress      SourceAddress
	Broadcast          bool
	Secure             bool
	LinkQuality        uint8
	Sequence           uint8
	ApplicationMessage ApplicationMessage
}

type LogicalType

type LogicalType uint8
const (
	Coordinator LogicalType = 0x00
	Router      LogicalType = 0x01
	EndDevice   LogicalType = 0x02
	Unknown     LogicalType = 0xff
)

func (LogicalType) String

func (l LogicalType) String() string

type ManufacturerCode

type ManufacturerCode uint16

type MockProvider

type MockProvider struct {
	mock.Mock
}

func (*MockProvider) AdapterNode

func (m *MockProvider) AdapterNode() Node

func (*MockProvider) BindNodeToController

func (m *MockProvider) BindNodeToController(ctx context.Context, nodeAddress IEEEAddress, sourceEndpoint Endpoint, destinationEndpoint Endpoint, cluster ClusterID) error

func (*MockProvider) DenyJoin

func (m *MockProvider) DenyJoin(ctx context.Context) error

func (*MockProvider) ForceNodeLeave

func (m *MockProvider) ForceNodeLeave(ctx context.Context, networkAddress IEEEAddress) error

func (*MockProvider) PermitJoin

func (m *MockProvider) PermitJoin(ctx context.Context, allRouters bool) error

func (*MockProvider) QueryNodeDescription

func (m *MockProvider) QueryNodeDescription(ctx context.Context, networkAddress IEEEAddress) (NodeDescription, error)

func (*MockProvider) QueryNodeEndpointDescription

func (m *MockProvider) QueryNodeEndpointDescription(ctx context.Context, networkAddress IEEEAddress, endpoint Endpoint) (EndpointDescription, error)

func (*MockProvider) QueryNodeEndpoints

func (m *MockProvider) QueryNodeEndpoints(ctx context.Context, networkAddress IEEEAddress) ([]Endpoint, error)

func (*MockProvider) ReadEvent

func (m *MockProvider) ReadEvent(ctx context.Context) (interface{}, error)

func (*MockProvider) RegisterAdapterEndpoint

func (m *MockProvider) RegisterAdapterEndpoint(ctx context.Context, endpoint Endpoint, appProfileId ProfileID, appDeviceId uint16, appDeviceVersion uint8, inClusters []ClusterID, outClusters []ClusterID) error

func (*MockProvider) RequestNodeLeave

func (m *MockProvider) RequestNodeLeave(ctx context.Context, networkAddress IEEEAddress) error

func (*MockProvider) SendApplicationMessageToNode

func (m *MockProvider) SendApplicationMessageToNode(ctx context.Context, destinationAddress IEEEAddress, message ApplicationMessage, requireAck bool) error

func (*MockProvider) UnbindNodeFromController

func (m *MockProvider) UnbindNodeFromController(ctx context.Context, nodeAddress IEEEAddress, sourceEndpoint Endpoint, destinationEndpoint Endpoint, cluster ClusterID) error

type NetworkAddress

type NetworkAddress uint16
const (
	BroadcastAll                 NetworkAddress = 0xffff
	BroadcastAlwaysOnReceivers   NetworkAddress = 0xfffd
	BroadcastRoutersCoordinators NetworkAddress = 0xfffc
	BroadcastLowPowerRouters     NetworkAddress = 0xfffb
)

type NetworkConfiguration

type NetworkConfiguration struct {
	PANID         PANID
	ExtendedPANID ExtendedPANID
	NetworkKey    NetworkKey
	Channel       uint8
}

func GenerateNetworkConfiguration

func GenerateNetworkConfiguration() (nc NetworkConfiguration, err error)

type NetworkJoining

type NetworkJoining interface {
	PermitJoin(ctx context.Context, allRouters bool) error
	DenyJoin(ctx context.Context) error
}

type NetworkKey

type NetworkKey [16]byte

type Node

type Node struct {
	IEEEAddress    IEEEAddress
	NetworkAddress NetworkAddress
	LogicalType    LogicalType
	LQI            uint8
	Depth          uint8
	LastDiscovered time.Time
	LastReceived   time.Time
}

type NodeBinder

type NodeBinder interface {
	BindNodeToController(ctx context.Context, nodeAddress IEEEAddress, sourceEndpoint Endpoint, destinationEndpoint Endpoint, cluster ClusterID) error
	UnbindNodeFromController(ctx context.Context, nodeAddress IEEEAddress, sourceEndpoint Endpoint, destinationEndpoint Endpoint, cluster ClusterID) error
}

type NodeDescription

type NodeDescription struct {
	LogicalType      LogicalType
	ManufacturerCode ManufacturerCode
}

type NodeIncomingMessageEvent

type NodeIncomingMessageEvent struct {
	Node
	IncomingMessage
}

type NodeJoinEvent

type NodeJoinEvent struct {
	Node
}

type NodeLeaveEvent

type NodeLeaveEvent struct {
	Node
}

type NodeQuerier

type NodeQuerier interface {
	QueryNodeDescription(ctx context.Context, networkAddress IEEEAddress) (NodeDescription, error)
	QueryNodeEndpoints(ctx context.Context, networkAddress IEEEAddress) ([]Endpoint, error)
	QueryNodeEndpointDescription(ctx context.Context, networkAddress IEEEAddress, endpoint Endpoint) (EndpointDescription, error)
}

type NodeRemover

type NodeRemover interface {
	RequestNodeLeave(ctx context.Context, networkAddress IEEEAddress) error
	ForceNodeLeave(ctx context.Context, networkAddress IEEEAddress) error
}

type NodeSender

type NodeSender interface {
	SendApplicationMessageToNode(ctx context.Context, destinationAddress IEEEAddress, message ApplicationMessage, requireAck bool) error
}

type NodeUpdateEvent

type NodeUpdateEvent struct {
	Node
}

type PANID

type PANID uint16

type ProfileID

type ProfileID uint16
const (
	ProfileIndustrialPlantMonitoring    ProfileID = 0x0101
	ProfileHomeAutomation               ProfileID = 0x0104
	ProfileCommercialBuildingAutomation ProfileID = 0x0105
	ProfileTelecomApplications          ProfileID = 0x0107
	ProfilePersonalHomeAndHospitalCare  ProfileID = 0x0108
	ProfileAdvancedMeteringInitiative   ProfileID = 0x0109
)

type Relationship

type Relationship uint8
const (
	RelationshipParent  Relationship = 0x00
	RelationshipChild   Relationship = 0x01
	RelationshipSibling Relationship = 0x02
	RelationshipUnknown Relationship = 0x03
)

type SourceAddress

type SourceAddress struct {
	IEEEAddress    IEEEAddress
	NetworkAddress NetworkAddress
}

Jump to

Keyboard shortcuts

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