Documentation
¶
Overview ¶
Implements a Controller for Texas Instrument's CC253X-based dongles.
For documentation of the serial protocol, please refer to the following documents: "ZNP Interface Specification", "Z-Stack Monitor and Test API".
Index ¶
- Constants
- Variables
- type AfDataConfirm
- type AfDataRequest
- type AfDataResponse
- type AfIncomingMsg
- type AfRegisterRequest
- type AfRegisterResponse
- type Callbacks
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) PermitJoining(enabled bool) error
- func (c *Controller) RegisterPermanentHandler(commandPrototype interface{}) *Handler
- func (c *Controller) Send(message zigbee.OutgoingMessage) error
- func (c *Controller) Start() (chan zigbee.IncomingMessage, error)
- func (c *Controller) WriteCommand(command interface{}) (interface{}, error)
- func (c *Controller) WriteCommandTimeout(command interface{}, timeout time.Duration) (interface{}, error)
- type DeviceState
- type Endpoint
- type ErrorHandling
- type Frame
- type FrameHeader
- type FrameID
- type FrameSubsystem
- type FrameType
- type Handler
- type Port
- func (p *Port) Close() error
- func (p *Port) RegisterOneOffHandler(commandPrototype interface{}) *Handler
- func (p *Port) RegisterPermanentHandler(commandPrototype interface{}) *Handler
- func (p *Port) WriteCommand(command interface{}) (interface{}, error)
- func (p *Port) WriteCommandTimeout(command interface{}, timeout time.Duration) (interface{}, error)
- func (p *Port) WriteMagicByteForBootloader() error
- type SysOsalNvReadRequest
- type SysOsalNvReadResponse
- type SysOsalNvWriteRequest
- type SysOsalNvWriteResponse
- type SysResetInd
- type SysVersionRequest
- type SysVersionResponse
- type UtilGetDeviceInfoRequest
- type UtilGetDeviceInfoResponse
- type ZBReadConfigurationResponse
- type ZbReadConfigurationRequest
- type ZbWriteConfigurationRequest
- type ZbWriteConfigurationResponse
- type ZdoActiveEP
- type ZdoActiveEPRequest
- type ZdoActiveEPResponse
- type ZdoEndDeviceAnnceInd
- type ZdoExtNwkInfoRequest
- type ZdoExtNwkInfoResponse
- type ZdoMgmtPermitJoin
- type ZdoMgmtPermitJoinRequest
- type ZdoMgmtPermitJoinResponse
- type ZdoPermitJoinInd
- type ZdoSrcRtgInd
- type ZdoStartupFromAppRequest
- type ZdoStartupFromAppResponse
- type ZdoStateChangeInd
- type ZdoTcDevInd
Constants ¶
View Source
const ( ResetReasonPowerUp = 0x00 ResetReasonExternal = 0x01 ResetReasonWatchDog = 0x02 )
View Source
const ( LatencyReqNoLatency = 0x00 LatencyReqFastBeacons = 0x01 LatencyReqSlowBeacons = 0x02 )
View Source
const ( CapabilitiesAlternatePanCoordinator = 1 << 0 CapabilitiesRouter = 1 << 1 CapabilitiesMainPowered = 1 << 2 CapabilitiesReceiverOnWhenIdle = 1 << 3 CapabilitiesSecurityCapability = 1 << 6 )
View Source
const FRAME_MAX_DATA_LENGTH = 250
View Source
const SOF = 0xFE // start of frame
Variables ¶
View Source
var ( ErrCommandUnknownFrameHeader = errors.New("unknown serial frame header") ErrCommandInvalidFrame = errors.New("invalid serial frame") )
View Source
var ( ErrInvalidFrame = errors.New("invalid frame") ErrGarbage = errors.New("garbage") )
View Source
var DeviceStateNames = []string{
"InitializedNotStarted",
"InitializedNotConnected",
"Discovering",
"Joining",
"Rejoining",
"JoinedNotAuthenticated",
"EndDevice",
"Router",
"CoordinatorStarting",
"Coordinator",
"Orphan",
}
View Source
var ErrTimeout = errors.New("command timed out")
Functions ¶
This section is empty.
Types ¶
type AfDataConfirm ¶
type AfDataRequest ¶
type AfDataResponse ¶
type AfDataResponse struct {
Status byte
}
type AfIncomingMsg ¶
type AfRegisterRequest ¶
type AfRegisterResponse ¶
type AfRegisterResponse struct {
Status byte
}
type Callbacks ¶
type Callbacks struct { BeforeWrite func(command interface{}) AfterRead func(command interface{}) OnReadError func(err error) ErrorHandling OnParseError func(err error, frame Frame) ErrorHandling }
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(settings zigbee.ControllerSettings) (*Controller, error)
func (*Controller) Close ¶
func (c *Controller) Close() error
func (*Controller) PermitJoining ¶
func (c *Controller) PermitJoining(enabled bool) error
func (*Controller) RegisterPermanentHandler ¶
func (c *Controller) RegisterPermanentHandler(commandPrototype interface{}) *Handler
func (*Controller) Send ¶
func (c *Controller) Send(message zigbee.OutgoingMessage) error
func (*Controller) Start ¶
func (c *Controller) Start() (chan zigbee.IncomingMessage, error)
func (*Controller) WriteCommand ¶
func (c *Controller) WriteCommand(command interface{}) (interface{}, error)
func (*Controller) WriteCommandTimeout ¶
func (c *Controller) WriteCommandTimeout(command interface{}, timeout time.Duration) (interface{}, error)
type DeviceState ¶
type DeviceState uint8
const ( DeviceStateInitializedNotStarted DeviceState = 0x00 // Initialized - not started automatically DeviceStateInitializedNotConnected DeviceState = 0x01 // Initialized - not connected to anything DeviceStateDiscovering DeviceState = 0x02 // Discovering PANs to join DeviceStateJoining DeviceState = 0x03 // Joining a PAN DeviceStateRejoining DeviceState = 0x04 // Rejoining a PAN, only for end devices DeviceStateJoinedNotAuthenticated DeviceState = 0x05 // Joined but not yet authenticated by trust center DeviceStateEndDevice DeviceState = 0x06 // Started as device after authentication DeviceStateRouter DeviceState = 0x07 // Device joined, authenticated and is a router DeviceStateCoordinatorStarting DeviceState = 0x08 // Starting as ZigBee Coordinator DeviceStateCoordinator DeviceState = 0x09 // Started as ZigBee Coordinator DeviceStateOrphan DeviceState = 0x0A // Device has lost information about its parent )
func (DeviceState) String ¶
func (state DeviceState) String() string
type ErrorHandling ¶
type ErrorHandling int
const ( ErrorHandlingPanic ErrorHandling = 0 ErrorHandlingStop ErrorHandling = 1 ErrorHandlingContinue ErrorHandling = 2 )
type Frame ¶
type Frame struct { FrameHeader Data []byte }
One frame of the Z-Stack serial protocol.
type FrameHeader ¶
type FrameHeader struct { Type FrameType Subsystem FrameSubsystem ID FrameID }
type FrameSubsystem ¶
type FrameSubsystem byte
const ( FRAME_SUBSYSTEM_RPC_ERROR FrameSubsystem = 0 FRAME_SUBSYSTEM_SYS FrameSubsystem = 1 FRAME_SUBSYSTEM_MAC FrameSubsystem = 2 FRAME_SUBSYSTEM_NWK FrameSubsystem = 3 FRAME_SUBSYSTEM_AF FrameSubsystem = 4 // application framework FRAME_SUBSYSTEM_ZDO FrameSubsystem = 5 // zigbee device object FRAME_SUBSYSTEM_SAPI FrameSubsystem = 6 // simple api FRAME_SUBSYSTEM_UTIL FrameSubsystem = 7 FRAME_SUBSYSTEM_DEBUG FrameSubsystem = 8 FRAME_SUBSYSTEM_APP FrameSubsystem = 9 )
func (FrameSubsystem) String ¶
func (s FrameSubsystem) String() string
type Port ¶
type Port struct {
// contains filtered or unexported fields
}
func (*Port) RegisterOneOffHandler ¶
func (*Port) RegisterPermanentHandler ¶
func (*Port) WriteCommand ¶
func (*Port) WriteCommandTimeout ¶
func (*Port) WriteMagicByteForBootloader ¶
type SysOsalNvReadRequest ¶
type SysOsalNvReadResponse ¶
type SysOsalNvWriteRequest ¶
type SysOsalNvWriteResponse ¶
type SysOsalNvWriteResponse struct {
Status byte
}
type SysResetInd ¶
type SysVersionRequest ¶
type SysVersionRequest struct{}
type SysVersionResponse ¶
type UtilGetDeviceInfoRequest ¶
type UtilGetDeviceInfoRequest struct{}
type ZbReadConfigurationRequest ¶
type ZbReadConfigurationRequest struct {
ConfigID uint8
}
type ZbWriteConfigurationResponse ¶
type ZbWriteConfigurationResponse struct {
Status byte
}
type ZdoActiveEP ¶
type ZdoActiveEPRequest ¶
type ZdoActiveEPResponse ¶
type ZdoActiveEPResponse struct {
Status byte
}
type ZdoEndDeviceAnnceInd ¶
type ZdoExtNwkInfoRequest ¶
type ZdoExtNwkInfoRequest struct{}
type ZdoExtNwkInfoResponse ¶
type ZdoMgmtPermitJoin ¶
type ZdoMgmtPermitJoinResponse ¶
type ZdoMgmtPermitJoinResponse struct {
Status byte
}
type ZdoPermitJoinInd ¶
type ZdoPermitJoinInd struct {
Duration byte
}
type ZdoSrcRtgInd ¶
Informs the host device about the receipt of a source route to a given device.
type ZdoStartupFromAppRequest ¶
type ZdoStartupFromAppRequest struct {
StartDelay uint16
}
type ZdoStartupFromAppResponse ¶
type ZdoStartupFromAppResponse struct {
Status byte
}
type ZdoStateChangeInd ¶
type ZdoStateChangeInd struct {
State DeviceState
}
type ZdoTcDevInd ¶
Trust Center Device Indication.
Click to show internal directories.
Click to hide internal directories.