Session 6
BeeStack Architecture
Application Framework
ZPUI
Application Object 1
[On Endpoint 1] APSDE-SAP
NLME-SAP
Provides choice and more flexibility to consumers Offers a secure, robust, and reliable home automation solution Customers experience an easy and simple way to establish and expand their ZigBee Home Automation networks
Many private application profiles do not use the ZigBee Cluster Library at all, or only use a few clusters from the library
For example, a Home Automation On/Off Light device uses the On/Off Cluster, cluster ID 0x0006.
An attribute of the On/Off Cluster indicates whether the light is on (0x01) or off (0x00). There are also commands which turn the light on (0x01), off (0x00), or toggle it (0x02), which affect the state of the OnOff attribute.
ZCLReadAttrReq()
BeeAppUpdateDevice()
ZCLfoundation.c file
*DeviceEndpoint.c
ZCLgeneral.c file
ZclLighting.c
ZclHVAC.c
ZclSE.c
ETC
BeeAppUpdateDevice
void BeeAppUpdateDevice ( zbEndPoint_t endPoint, /* IN: endpoint update happend on */ zclUIEvent_t event, /* IN: state to update */ zclAttrId_t attrId, zbClusterId_t clusterId, void *pData ) (void) attrId; (void) clusterId; (void) pData; switch (event) { case gZclUI_Off_c: ASL_SetLed(LED2,gLedOff_c); ASL_LCDWriteString("Light Off" ); ExternalDeviceOff(); break; case gZclUI_On_c: ASL_SetLed(LED2,gLedOn_c); ASL_LCDWriteString("Light On" ); ExternalDeviceOn(); break; . . .
This function is the way Clusters can notify the application that an event has occurred.
Friendly reminder
Do not forget about the available documents!!
Today we learned
Application Profile
Device definition (specific application)
Uses clusters (related to functionality)
Server / Client (provide / request a service) Attributes / Commands (Data item or state / an action)
BeeStack Architecture
Application Framework
Application Object 240
APSDE-SAP
APSSE-SAP NLSE-SAP
Application(s) ZCL
ZPUI
Application Object 1
[On Endpoint 1] APSDE-SAP
NLME-SAP
APS layer
Supports Data requests Support Binding Table Supports end-to-end retries Supports Fragmentation Profile and Endpoint filtering Duplicate Detection
ZigBee Endpoints
BeeStack endpoints mirror ZigBee specification
Endpoint # used (1-240) Profile ID (0x0000 0xfff0) (Examples: HA, SE, HC, BA, etc) Device ID (depends on profile) (Light, Switch, Meter device, etc) List of input and output clusters (OnOff, Scenes, Identify, etc)
Endpoints are found in EndPointConfig.c UI Found in BeeApp.c and ASL_UserInterface.c BeeStack extends endpoint structure to include (optional) ZigBee Cluster Library (ZCL) support Each ZCL endpoint has instance data in files like HaOnOffLightEndPoint.c
Using multi-endpoints
EP1 = SW 1 EP8 = light 1 EP240 = SW 2 EP9 = light 2
HA OnOffSwitch
HA OnOffLight
Cluster
The object within the app
Endpoint / Profile
Address of an app within a node
EP5 = HA Light
Binding
typedef struct apsBindingTable_Ptr_tag { zbEndPoint_t srcEndPoint; apsBindingDst_t dstAddr; zbEndPoint_t dstEndPoint; index_t iClusterCount; zbClusterId_t aClusterList[1]; } apsBindingTable_Ptr_t;
APS simply checks each entry and sends a data request for each that matches the source endpoint Same Tx options are applied to each The confirm is based on the user data request
Binding is on a from endpoint. Use indirect Addr Mode on data request. Binding table binds to node/ep/cluster or group/cluster. Groups are sent to broadcast endpoint 0xff gMaximumApsBindingTableClusters_ c (default 5) defines max cluster per EP Binding is on output clusters (not inputs) Save binding table in NVM to preserve bindings across resets
Binding
EP1 = SW 1 EP8 = light 1
EP9 = light 2
HA OnOffSwitch
HA OnOffLight
APS acknowledgement
APS can inform application of delivery via APS ACKs. APS ACKs use a state machine with retries:
limited in # settable at compile-time Confirm contains status code Confirm contains packet identifier
Status comes back in the data confirm If Data Request fails, then the node is unreachable (at least at this time) Dont ask for ACKs on sleepy devices!
ZigBee Addressing
Attributes / Command
Data item / action to take within the cluster
EP240
P1 EP1
ZDO
Cluster
The object within the app
APS
ZigBee NWK
Endpoint / Profile
Address of an app within a node
802.15.4 MAC
RF Channel
Physical portion of the RF spectrum