Anda di halaman 1dari 29

Agenda

Session 6: ZigBee Application Framework (AF layer)


ZigBee layers Application profiles Devices defined by an application profile ZigBee Cluster Library (ZCL)
Clusters
Server/Client Attributes/commands

Session 7: Application Support Sub-Layer (APS)


Endpoints Binding APS Acknowledgement Fragmentation

ZigBee Layers overview


PHY modulates bits OTA MAC creates MAC, delivers single hop NWK delivers data end-to-end source routing, multicast, etc APS introduces endpoints, binding and fragmentation SSP transports and manages NWK and link keys ZDO manages node state (on NWK, change to new PAN ID or channel) AF provides application interface to the rest of the stack

Session 6

ZigBee Application Framework (AF layer)

BeeStack Architecture
Application Framework
ZPUI

Application Object 240


[On Endpoint 240] APSDE-SAP
APSSE-SAP NLSE-SAP

Application Object 1
[On Endpoint 1] APSDE-SAP

ZigBee Device Object (ZDO)


[On Endpoint 0] APSDE-SAP
APSME-SAP

Security Service Provider

Application Support (APS) Sub-Layer


NLDE-SAP

NLME-SAP

Network (NWK) Layer


MCPS-SAP MLME-SAP

Medium Access Layer (MAC) Layer


PD-SAP PLME-SAP

Physical (PHY) Layer

ZigBee Application Profiles


ZigBee Home Automation (ZHA) ZigBee Health Care (ZHC) ZigBee Smart Energy (ZSE) ZigBee Remote Control (ZRC) a.k.a. RF4CE Commercial Building Automation (CBA) And more coming

Home Automation (HA) Profile


Supports a broad range of applications in automation for homes and small offices
Energy management Blinds and shade controls Security and safety devices Appliances HVAC systems and thermostats Lighting Switches

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

Home Automation (HA) devices


Generic On/Off Switch Level Control Switch On/Off Output Level Controllable Output Scene Selector Configuration Tool Remote Control Combined Interface Range Extender Mains Power Outlet Door Lock Simple Sensor Closures Shade Controller Window Covering Lighting On/Off Light Dimmable Light Color Dimmable Light On/Off Light Switch Dimmer Switch Color Dimmer Switch Light Sensor Occupancy Sensor HVAC Heating/Cooling Unit Thermostat Temperature Sensor Pump Controller Pressure Sensor Flow Sensor Intruder Alarm Systems IAS Control and Indicating Equipment IAS Ancillary Control Equipment IAS Zone IAS Warning Device

ZigBee Cluster Library


The ZigBee Cluster Library (ZCL) is a set of clusters and cross-cluster commands used in the public profiles. The ZigBee Cluster Library is released under its own specification The ZigBee Cluster Library is organized into functional domains, such as:
General Closures HVAC Lighting. Security and Safety Measurement and Sensing Specification

Clusters and Profiles

ZigBee Cluster Library


Is ZCL required? If you are making a public profile device, such as a power meter intended to be compatible with SE or a thermostat intended to be compatible with the HA profilethen the answer is Yes. Thats what public profiles are all about: interoperability. With private Application Profiles, ZCL is not mandatory.

Many private application profiles do not use the ZigBee Cluster Library at all, or only use a few clusters from the library

ZCL Client and Server


ZCL uses the concept of a client, who initiates the transaction, and the server, who performs the work. For example, a light switch (the client) initiates the transaction when someone taps the light switch. One or more lights (the server) complete the transaction by turning on or off and perhaps reporting the status change to some monitoring device(s). From the perspective of the endpoints simple descriptor, the client side lists the cluster ID as an output cluster, and the server side lists the same cluster ID as an input cluster.

ZCL Client and Server

ZCL Attributes and Commands


The ZCL introduces the concept of attributes and commands : Attributes are data items or states defined within a cluster. Commands are actions the cluster must perform.

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.

BeeStack handling ZCL


BeeStack SW Stack BeeAppDataIndication() BeeApp.c file ZCLInterpretFrame()

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)

Application Support Sub-Layer (APS)

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

ZigBee Device Object (ZDO)


[On Endpoint 0] APSDE-SAP
APSME-SAP

[On Endpoint 240]

Security Service Provider

Application Support (APS) Sub-Layer


NLDE-SAP

NLME-SAP

Network (NWK) Layer


MCPS-SAP MLME-SAP

Medium Access Layer (MAC) Layer


PD-SAP PLME-SAP

Physical (PHY) Layer

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

Endpoints will be used by AF layer


Attributes / Command
Data item / action to take within the cluster

Cluster
The object within the app

Endpoint / Profile
Address of an app within a node
EP5 = HA Light

EP1 = HA IAS zone

Clusters: Basic Identify On/Off Scenes Group

Server Attributes: On/Off Commands: On Off Toggle

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

NWK address / IEEE address


Address of a node within a Nwk

802.15.4 MAC

PAN ID / Extended PAN ID


Address of a Nwk within a channel
802.15.4 PHY
MCU/Radio

RF Channel
Physical portion of the RF spectrum

Example: ZigBee Health Care

Anda mungkin juga menyukai