ZigBee PRO Stack User Guide

Size: px
Start display at page:

Download "ZigBee PRO Stack User Guide"

Transcription

1 ZigBee PRO Stack JN-UG-3101 Revision April 2017

2 ZigBee PRO Stack 2 NXP Laboratories UK 2017 JN-UG-3101 v1.5

3 ZigBee PRO Stack Contents Preface 13 Organisation 13 Conventions 14 Acronyms and Abbreviations 15 Related Documents 16 Support Resources 16 Trademarks 16 Chip Compatibility 16 Part I: Concept and Operational Information 1. ZigBee PRO Overview ZigBee Network Nodes ZigBee PRO Network Topology Ideal Applications for ZigBee Wireless Radio Frequency Operation Battery-Powered Components Easy Installation and Configuration Highly Reliable Operation Secure Operating Environment Co-existence and Interoperability Profiles Stack Profiles Application Profiles ZigBee PRO Architecture and Operation Architectural Overview Network Level Concepts ZigBee Nodes Network Topology Neighbour Tables Network Addressing Network Identity Network Creation Starting a Network (Co-ordinator) Joining a Network (Routers and End Devices) 39 JN-UG-3101 v1.5 NXP Laboratories UK

4 Contents 2.4 Application Level Concepts Multiple Applications and Endpoints Descriptors Application Profiles Attributes and Clusters Discovery ZigBee Device Objects (ZDO) Network Routing Message Addressing and Propagation Route Discovery Many-to-one Routing Network Communications Service Discovery Binding Detailed Architecture Software Levels ZigBee PRO Stack Software Software Overview ZigBee PRO APIs JenOS APIs Summary of API Functionality Application Development Overview Development Environment Development Resources Development Phases Application Coding with ZigBee PRO APIs Forming a Network Starting the Co-ordinator Starting Routers and End Devices Pre-determined Parents Discovering the Network Obtaining Network Properties Finding Compatible Endpoints Obtaining and Maintaining Node Addresses Obtaining IEEE Address Obtaining Network Address Obtaining Node Properties Maintaining a Primary Discovery Cache Discovering Routes Managing Group Addresses 76 4 NXP Laboratories UK 2017 JN-UG-3101 v1.5

5 ZigBee PRO Stack 5.4 Binding Setting Up Bind Request Server Binding Endpoints Unbinding Endpoints Accessing Binding Tables Transferring Data Sending Data Unicast Broadcast Group Multicast Bound Transfer Inter-PAN Transfer Receiving Data Polling for Data Security in Data Transfers Leaving and Rejoining the Network Leaving the Network Rejoining the Network Return Codes and Extended Error Handling Implementing ZigBee Security Network-level Security Set-up Application-level Security Set-up Network Key Modification 94 Part II: Reference Information 6. ZigBee Device Objects (ZDO) API ZDO API Functions Network Deployment Functions 98 ZPS_eAplZdoStartStack 99 ZPS_eAplZdoGetDeviceType 100 ZPS_eAplZdoDiscoverNetworks 101 ZPS_eAplZdoJoinNetwork 102 ZPS_eAplZdoRejoinNetwork 103 ZPS_eAplZdoDirectJoinNetwork 104 ZPS_eAplZdoOrphanRejoinNetwork 105 ZPS_eAplZdoPermitJoining 106 ZPS_u16AplZdoGetNetworkPanId 107 ZPS_u64AplZdoGetNetworkExtendedPanId 108 ZPS_u8AplZdoGetRadioChannel 109 ZPS_eAplZdoBind 110 ZPS_eAplZdoUnbind 111 ZPS_eAplZdoBindGroup 112 ZPS_eAplZdoUnbindGroup 113 ZPS_ePurgeBindTable 114 JN-UG-3101 v1.5 NXP Laboratories UK

6 Contents ZPS_eAplZdoPoll 115 ZPS_eAplZdoLeaveNetwork 116 ZPS_vNwkNibSetLeaveAllowed 118 ZPS_vNwkSendNwkStatusCommand 119 ZPS_vRemoveMacTableEntry 120 ZPS_vSaveAllZpsRecords Security Functions 122 ZPS_vAplSecSetInitialSecurityState 123 ZPS_eAplZdoTransportNwkKey 125 ZPS_eAplZdoSwitchKeyReq 126 ZPS_eAplZdoRequestKeyReq 127 ZPS_eAplZdoAddReplaceLinkKey 128 ZPS_eAplZdoRemoveLinkKey 129 ZPS_eAplZdoRemoveDeviceReq 130 ZPS_eAplZdoSetDevicePermission 131 ZPS_bAplZdoTrustCenterSetDevicePermissions 132 ZPS_bAplZdoTrustCenterGetDevicePermissions 133 ZPS_bAplZdoTrustCenterRemoveDevice 134 ZPS_vTCSetCallback Addressing Functions 137 ZPS_u16AplZdoGetNwkAddr 138 ZPS_u64AplZdoGetIeeeAddr 139 ZPS_eAplZdoAddAddrMapEntry 140 ZPS_vPurgeAddressMap 141 ZPS_u16AplZdoLookupAddr 142 ZPS_u64AplZdoLookupIeeeAddr 143 ZPS_u64NwkNibGetMappedIeeeAddr 144 ZPS_bNwkFindAddIeeeAddr 145 ZPS_vSetOverrideLocalIeeeAddr 146 ZPS_eAplZdoGroupEndpointAdd 147 ZPS_eAplZdoGroupEndpointRemove 148 ZPS_eAplZdoGroupAllEndpointRemove Routing Functions 150 ZPS_eAplZdoRouteRequest 151 ZPS_eAplZdoManyToOneRouteRequest Object Handle Functions 153 ZPS_pvAplZdoGetAplHandle 154 ZPS_pvAplZdoGetMacHandle 155 ZPS_pvAplZdoGetNwkHandle 156 ZPS_psNwkNibGetHandle 157 ZPS_psAplAibGetAib 158 ZPS_psAplZdoGetNib 159 ZPS_u64NwkNibGetEpid Optional Cluster Function 161 ZPS_eAplZdoRegisterZdoFilterCallback NXP Laboratories UK 2017 JN-UG-3101 v1.5

7 ZigBee PRO Stack 6.2 ZDO Enumerations Security Keys (ZPS_teZdoNwkKeyState) Device Types (ZPS_teZdoDeviceType) Device Permissions (ZPS_teDevicePermissions) Trust Centre Permissions (ZPS_teTCDevicePermissions) Application Framework (AF) API AF API Functions Initialisation Functions 167 ZPS_eAplAfInit 168 ZPS_eAplAibSetApsUseExtendedPanId 169 ZPS_vExtendedStatusSetCallback 170 ZPS_bAppAddBeaconFilter 171 ZPS_vAplAfEnableMcpsFilter 172 ZPS_vNwkLinkCostCallbackRegister 173 ZPS_vSetOrphanUpdateDisable Data Transfer Functions 175 ZPS_eAplAfApsdeDataReq 176 ZPS_eAplAfUnicastDataReq 177 ZPS_eAplAfUnicastIeeeDataReq 179 ZPS_eAplAfUnicastAckDataReq 181 ZPS_eAplAfUnicastIeeeAckDataReq 183 ZPS_eAplAfGroupDataReq 185 ZPS_eAplAfBroadcastDataReq 187 ZPS_eAplAfBoundDataReq 189 ZPS_eAplAfBoundAckDataReq 191 ZPS_eAplAfInterPanDataReq 193 ZPS_u8AplGetMaxPayloadSize Endpoint Functions 195 ZPS_vAplAfSetEndpointState 196 ZPS_eAplAfGetEndpointState 197 ZPS_eAplAfSetEndpointDiscovery 198 ZPS_eAplAfGetEndpointDiscovery Descriptor Functions 200 ZPS_eAplAfGetNodeDescriptor 201 ZPS_eAplAfGetNodePowerDescriptor 202 ZPS_eAplAfGetSimpleDescriptor AF Structures Descriptor Structures ZPS_tsAplAfNodeDescriptor ZPS_tsAplAfNodePowerDescriptor ZPS_tsAplAfSimpleDescriptor Event Structures ZPS_tsAfEvent ZPS_tuAfEventData ZPS_tsAfDataIndEvent 210 JN-UG-3101 v1.5 NXP Laboratories UK

8 Contents ZPS_tsAfDataConfEvent ZPS_tsAfDataAckEvent ZPS_tsAfNwkFormationEvent ZPS_tsAfNwkJoinedEvent ZPS_tsAfNwkJoinFailedEvent ZPS_tsAfNwkDiscoveryEvent ZPS_tsAfNwkJoinIndEvent ZPS_tsAfNwkLeaveIndEvent ZPS_tsAfNwkLeaveConfEvent ZPS_tsAfNwkStatusIndEvent ZPS_tsAfNwkRouteDiscoveryConfEvent ZPS_tsAfPollConfEvent ZPS_tsAfNwkEdScanConfEvent ZPS_tsAfErrorEvent ZPS_tsAfZdoBindEvent ZPS_tsAfZdoUnbindEvent ZPS_tsAfZdoLinkKeyEvent ZPS_tsAfBindRequestServerEvent ZPS_tsAfInterPanDataIndEvent ZPS_tsAfInterPanDataConfEvent ZPS_tsAfZdpEvent Other Structures ZPS_tsNwkNetworkDescr ZPS_tsNwkNlmeCfmEdScan ZPS_tsInterPanAddress ZPS_tsAfProfileDataReq tsbeaconfiltertype ZigBee Device Profile (ZDP) API ZDP API Functions Address Discovery Functions 234 ZPS_eAplZdpNwkAddrRequest 235 ZPS_eAplZdpIEEEAddrRequest 237 ZPS_eAplZdpDeviceAnnceRequest Service Discovery Functions 239 ZPS_eAplZdpNodeDescRequest 240 ZPS_eAplZdpPowerDescRequest 241 ZPS_eAplZdpSimpleDescRequest 242 ZPS_eAplZdpExtendedSimpleDescRequest 243 ZPS_eAplZdpComplexDescRequest 245 ZPS_eAplZdpUserDescRequest 246 ZPS_eAplZdpMatchDescRequest 247 ZPS_eAplZdpActiveEpRequest 249 ZPS_eAplZdpExtendedActiveEpRequest 250 ZPS_eAplZdpUserDescSetRequest 252 ZPS_eAplZdpSystemServerDiscoveryRequest 254 ZPS_eAplZdpDiscoveryCacheRequest 255 ZPS_eAplZdpDiscoveryStoreRequest 256 ZPS_eAplZdpNodeDescStoreRequest NXP Laboratories UK 2017 JN-UG-3101 v1.5

9 ZigBee PRO Stack ZPS_eAplZdpPowerDescStoreRequest 260 ZPS_eAplZdpSimpleDescStoreRequest 262 ZPS_eAplZdpActiveEpStoreRequest 264 ZPS_eAplZdpFindNodeCacheRequest 266 ZPS_eAplZdpRemoveNodeCacheRequest Binding Functions 269 ZPS_eAplZdpEndDeviceBindRequest 270 ZPS_eAplZdpBindUnbindRequest 272 ZPS_eAplZdpBindRegisterRequest 274 ZPS_eAplZdpReplaceDeviceRequest 275 ZPS_eAplZdpStoreBkupBindEntryRequest 277 ZPS_eAplZdpRemoveBkupBindEntryRequest 279 ZPS_eAplZdpBackupBindTableRequest 281 ZPS_eAplZdpRecoverBindTableRequest 283 ZPS_eAplZdpBackupSourceBindRequest 285 ZPS_eAplZdpRecoverSourceBindRequest Network Management Services Functions 289 ZPS_eAplZdpMgmtNwkDiscRequest 290 ZPS_eAplZdpMgmtLqiRequest 292 ZPS_eAplZdpMgmtRtgRequest 293 ZPS_eAplZdpMgmtBindRequest 294 ZPS_eAplZdpMgmtLeaveRequest 296 ZPS_eAplZdpMgmtDirectJoinRequest 298 ZPS_eAplZdpMgmtPermitJoiningRequest 300 ZPS_eAplZdpMgmtCacheRequest 302 ZPS_eAplZdpMgmtNwkUpdateRequest Response Data Extraction Function 306 ZPS_bAplZdpUnpackResponse ZDP Structures Descriptor Structures ZPS_tsAplZdpNodeDescriptor ZPS_tsAplZdpNodePowerDescriptor ZPS_tsAplZdpSimpleDescType ZDP Request Structures ZPS_tsAplZdpNwkAddrReq ZPS_tsAplZdpIEEEAddrReq ZPS_tsAplZdpDeviceAnnceReq ZPS_tsAplZdpNodeDescReq ZPS_tsAplZdpPowerDescReq ZPS_tsAplZdpSimpleDescReq ZPS_tsAplZdpExtendedSimpleDescReq ZPS_tsAplZdpComplexDescReq ZPS_tsAplZdpUserDescReq ZPS_tsAplZdpMatchDescReq ZPS_tsAplZdpActiveEpReq ZPS_tsAplZdpExtendedActiveEpReq ZPS_tsAplZdpUserDescSet ZPS_tsAplZdpSystemServerDiscoveryReq 321 JN-UG-3101 v1.5 NXP Laboratories UK

10 Contents ZPS_tsAplZdpDiscoveryCacheReq ZPS_tsAplZdpDiscoveryStoreReq ZPS_tsAplZdpNodeDescStoreReq ZPS_tsAplZdpPowerDescStoreReq ZPS_tsAplZdpSimpleDescStoreReq ZPS_tsAplZdpActiveEpStoreReq ZPS_tsAplZdpFindNodeCacheReq ZPS_tsAplZdpRemoveNodeCacheReq ZPS_tsAplZdpEndDeviceBindReq ZPS_tsAplZdpBindUnbindReq ZPS_tsAplZdpBindRegisterReq ZPS_tsAplZdpReplaceDeviceReq ZPS_tsAplZdpStoreBkupBindEntryReq ZPS_tsAplZdpRemoveBkupBindEntryReq ZPS_tsAplZdpBackupBindTableReq ZPS_tsAplZdpRecoverBindTableReq ZPS_tsAplZdpBackupSourceBindReq ZPS_tsAplZdpRecoverSourceBindReq ZPS_tsAplZdpMgmtNwkDiscReq ZPS_tsAplZdpMgmtLqiReq ZPS_tsAplZdpMgmtRtgReq ZPS_tsAplZdpMgmtBindReq ZPS_tsAplZdpMgmtLeaveReq ZPS_tsAplZdpMgmtDirectJoinReq ZPS_tsAplZdpMgmtPermitJoiningReq ZPS_tsAplZdpMgmtCacheReq ZPS_tsAplZdpMgmtNwkUpdateReq ZDP Response Structures ZPS_tsAplZdpNwkAddrRsp ZPS_tsAplZdpIeeeAddrRsp ZPS_tsAplZdpNodeDescRsp ZPS_tsAplZdpPowerDescRsp ZPS_tsAplZdpSimpleDescRsp ZPS_tsAplZdpExtendedSimpleDescRsp ZPS_tsAplZdpComplexDescRsp ZPS_tsAplZdpUserDescRsp ZPS_tsAplZdpMatchDescRsp ZPS_tsAplZdpActiveEpRsp ZPS_tsAplZdpExtendedActiveEpRsp ZPS_tsAplZdpUserDescConf ZPS_tsAplZdpSystemServerDiscoveryRsp ZPS_tsAplZdpDiscoveryCacheRsp ZPS_tsAplZdpDiscoveryStoreRsp ZPS_tsAplZdpNodeDescStoreRsp ZPS_tsAplZdpPowerDescStoreRsp ZPS_tsAplZdpSimpleDescStoreRsp ZPS_tsAplZdpActiveEpStoreRsp ZPS_tsAplZdpFindNodeCacheRsp ZPS_tsAplZdpRemoveNodeCacheRsp ZPS_tsAplZdpEndDeviceBindRsp ZPS_tsAplZdpBindRsp ZPS_tsAplZdpUnbindRsp ZPS_tsAplZdpBindRegisterRsp ZPS_tsAplZdpReplaceDeviceRsp NXP Laboratories UK 2017 JN-UG-3101 v1.5

11 ZigBee PRO Stack ZPS_tsAplZdpStoreBkupBindEntryRsp ZPS_tsAplZdpRemoveBkupBindEntryRsp ZPS_tsAplZdpBackupBindTableRsp ZPS_tsAplZdpRecoverBindTableRsp ZPS_tsAplZdpBackupSourceBindRsp ZPS_tsAplZdpRecoverSourceBindRsp ZPS_tsAplZdpMgmtNwkDiscRsp ZPS_tsAplZdpMgmtLqiRsp ZPS_tsAplZdpMgmtRtgRsp ZPS_tsAplZdpMgmtBindRsp ZPS_tsAplZdpMgmtLeaveRsp ZPS_tsAplZdpMgmtDirectJoinRsp ZPS_tsAplZdpMgmtPermitJoiningRsp ZPS_tsAplZdpMgmtCacheRsp ZPS_tsAplZdpMgmtNwkUpdateNotify Broadcast Addresses Event and Status Codes Events Return/Status Codes ZDP Codes APS Codes NWK Codes MAC Codes Extended Error Codes ZigBee Network Parameters Basic Parameters Profile Definition Parameters Cluster Definition Parameters Co-ordinator Parameters Router Parameters End Device Parameters Advanced Device Parameters Endpoint Parameters Bound Addressing Table PDU Manager Group Addressing Table RF Channels Node Descriptor Node Power Descriptor Key Descriptor Table Trust Centre ZDO Configuration 398 JN-UG-3101 v1.5 NXP Laboratories UK

12 Contents Part III: Configuration Information 11. Network and OS Configuration Configuration Principles Configuring ZigBee Network Parameters ZPS Configuration Editor Getting Started Using the ZPS Configuration Editor Creating a New ZPS Configuration Adding Device Types Setting Co-ordinator Properties Setting Advanced Device Parameters 421 Part IV: Appendices A. Handling Stack Events 425 B. Application Design Notes 426 B.1 Fragmented Data Transfers 426 B.2 Sending Data to Sleeping End Devices 428 B.3 Clearing Stack Context Data Before a Rejoin 430 B.4 Beacon Filtering Guidelines 430 B.5 Table Configuration Guidelines 431 B.6 Received Message Queues 434 B.7 Filtering Packets on LQI Value/Link Cost 434 B.8 Disabling Orphan Notifications to the Trust Centre 437 B.9 Forcing Broadcast Retries 438 B.10 Noise Threshold for Forming a Network 439 C. Glossary NXP Laboratories UK 2017 JN-UG-3101 v1.5

13 ZigBee PRO Stack Preface This manual provides a single point of reference for information relating to the ZigBee PRO wireless network protocol stack which can be implemented on the NXP JN516x wireless microcontroller. The manual provides both conceptual and practical information concerning the NXP ZigBee PRO stack software. Guidance is provided on use of the Application Programming Interfaces (APIs) for ZigBee PRO. The API resources (functions, network parameters, enumerations, data types, events, etc) are fully detailed. The manual should be used as a reference resource throughout ZigBee PRO application development. Note 1: The development of wireless network applications based on the NXP ZigBee PRO stack also requires use of JenOS (Jennic Operating System), which is fully detailed in the JenOS (JN-UG-3075). Note 2: This supports the ZigBee PRO Software Developer s Kits (SDKs) with part numbers JN-SW-416x which are designed to be used with the BeyondStudio for NXP toolchain (JN-SW-4141). It replaces the JN-UG-3048 for these SDKs. For more detailed information on the ZigBee PRO standard, refer to the ZigBee Specification (05347), available from the ZigBee Alliance. Organisation This manual is divided into four parts: Part I: Concept and Operational Information comprises five chapters: Chapter 1 introduces the ZigBee PRO wireless network protocol. Chapter 2 describes the architecture and features of ZigBee PRO. Chapter 3 introduces the NXP ZigBee PRO stack software. Chapter 4 provides an overview of the ZigBee PRO application development environment and process. Chapter 5 describes how to perform common wireless network operations using the functions of the NXP ZigBee PRO APIs. Part II: Reference Information comprises five chapters: Chapter 6 details the functions and associated resouces of the ZigBee Device Objects (ZDO) API. Chapter 7 details the functions and associated resouces of the Application Framework (AF) API. JN-UG-3101 v1.5 NXP Laboratories UK

14 Preface Chapter 8 details the functions and associated resouces of the ZigBee Device Profile (ZDP) API. Chapter 9 details the stack events and the return/status codes used by the ZigBee PRO APIs. Chapter 10 details the ZigBee network parameters. Part III: Configuration Information comprises two chapters: Chapter 11 introduces the configuration tools that are required to set up a ZigBee PRO application, including the ZPS Configuration Editor. Chapter 12 describes how to use the ZPS Configuration Editor. Part IV: Appendices contains three appendices that provide various ancillary information, including a description of the handling of ZigBee PRO stack events, a set of application design notes and a glossary of terms used in ZigBee PRO networks. Conventions Files, folders, functions and parameter types are represented in bold type. Function parameters are represented in italics type. Code fragments are represented in the Courier New typeface. This is a Tip. It indicates useful or practical information. This is a Note. It highlights important additional information. This is a Caution. It warns of situations that may result in equipment malfunction or damage. 14 NXP Laboratories UK 2017 JN-UG-3101 v1.5

15 ZigBee PRO Stack Acronyms and Abbreviations AF Application Framework AIB APS Information Base APDU Application Protocol Data Unit API Application Programming Interface APS Application Support (sub-layer) APSDE Application Support (sub-layer) Data Entity APSME Application Support (sub-layer) Management Entity DBG Debug DIO Digital Input/Output EPID Extended PAN ID HA Home Automation HVAC Heating, Ventilation and Air-Conditioning IO Input/Output ISR Interrupt Service Routine JenOS Jennic Operating System MAC Media Access Control PAN Personal Area Network NIB NWK Information Base NPDU Network Protocol Data Unit NVM Non-Volatile Memory NWK Network PDU Protocol Data Unit PDUM Protocol Data Unit Manager PDM Persistent Data Manager PIC Programmable Interrupt Controller PWRM Power Manager RF Radio Frequency RTOS Real-Time Operating System SAP Service Access Point SDK Software Developer s Kit SE Smart Energy UART Universal Asynchronous Receiver-Transmitter JN-UG-3101 v1.5 NXP Laboratories UK

16 Preface ZCL ZCP ZDO ZDP ZLL ZPS ZigBee Cluster Library ZigBee Compliant Platform ZigBee Device Objects ZigBee Device Profile ZigBee Light Link ZigBee PRO Stack Related Documents JN-UG-3103 ZigBee Cluster Library JN-UG-3075 JenOS JN-UG-3076 ZigBee Home Automation JN-UG-3091 ZigBee Light Link JN-UG-3087 JN516x Integrated Peripherals API JN-UG-3098 BeyondStudio for NXP Installation and ZigBee Specification (from ZigBee Alliance) ZigBee Cluster Library Specification (from ZigBee Alliance) Support Resources To access online support resources such as SDKs, Application Notes and User Guides, visit the Wireless Connectivity area of the NXP web site: ZigBee resources can be accessed from the ZigBee page, which can be reached via the short-cut All NXP resources referred to in this manual can be found at the above addresses, unless otherwise stated. Trademarks All trademarks are the property of their respective owners. Chip Compatibility The software described in this manual can be used on the NXP JN516x family of wireless microcontrollers with the exception of JN5161 device. However, the supported devices will be referred to as JN516x. 16 NXP Laboratories UK 2017 JN-UG-3101 v1.5

17 ZigBee PRO Stack Part I: Concept and Operational Information JN-UG-3101 v1.5 NXP Laboratories Ltd

18 18 NXP Laboratories Ltd 2017 JN-UG-3101 v1.5

19 ZigBee PRO Stack 1. ZigBee PRO Overview The ZigBee protocol was developed to provide low-power, wireless connectivity for a wide range of network applications concerned with monitoring and control. ZigBee is a worldwide open standard controlled by the ZigBee Alliance. ZigBee PRO is an enhancement of the original ZigBee protocol, providing a number of extra features that are particularly useful for very large networks (that may include hundreds or even thousands of nodes). The ZigBee standard builds on the established IEEE standard for packetbased wireless transport. ZigBee enhances the functionality of IEEE by providing flexible, extendable network topologies with integrated set-up and routing intelligence to facilitate easy installation and high resilience to failure. ZigBee networks also incorporate listen-before-talk and rigorous security measures that enable them to co-exist with other wireless technologies (such as Bluetooth and Wi-Fi) in the same operating environment. ZigBee's wireless connectivity means that it can be installed easily and cheaply, and its built-in intelligence and flexibility allow networks to be easily adapted to changing needs by adding, removing or moving network nodes. The protocol is designed such that nodes can appear in and disappear from the network, allowing some devices to be put into a power-saving mode when not active. This means that many devices in a ZigBee network can be battery-powered, making them self-contained and, again, reducing installation costs. The figure below shows a simple example of a ZigBee network in a home heating and air-conditioning system. JN-UG-3101 v1.5 NXP Laboratories UK

20 Chapter 1 ZigBee PRO Overview Controller/Timer (Co-ordinator) Air-conditioning thermostat (Router) Heating thermostat (Router) Fan control (End Device) Heater control (End Device) Compressor control (End Device) Heater control (End Device) Master switch (End Device) Figure 1: Simple ZigBee Network (Home Heating and Air-conditioning) 1.1 ZigBee Network Nodes A wireless network comprises a set of nodes that can communicate with each other by means of radio transmissions, according to a set of routing rules (for passing messages between nodes). A ZigBee wireless network includes three types of node: Co-ordinator: This is the first node to be started and is responsible for forming the network by allowing other nodes to join the network through it. Once the network is established, the Co-ordinator has a routing role (is able to relay messages from one node to another) and is also able to send/receive data. Every network must have one and only one Co-ordinator. Router: This is a node with a routing capability, and is also able to send/receive data. It also allows other nodes to join the network through it, so plays a role in extending the network. A network may have many Routers. End Device: This is a node which is only capable of sending and receiving data (it has no routing capability). A network may have many End Devices. The deployment of these node types in a ZigBee PRO network is described in Section 1.2. More detailed information about the node types is provided in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

21 ZigBee PRO Stack 1.2 ZigBee PRO Network Topology ZigBee facilitates a range of network topologies from the simplest Star topology, through the highly structured Tree topology to the flexible Mesh topology. ZigBee PRO is designed primarily for Mesh networks. A Mesh network has little implicit structure. It is a collection of nodes comprising a Coordinator and a number of Routers and/or End Devices, where: Each node, except the Co-ordinator, is associated with a Router or the Coordinator - this is the node through which it joined the network and is known as its parent. Each parent may have a number of children. An End Device can only communicate directly with its own parent. Each Router and the Co-ordinator can communicate directly with any other Router/Co-ordinator within radio range. It is the last property above that gives a Mesh network its flexibility and efficiency in terms of inter-node communication. A Mesh network is illustrated in the figure below. Co-ordinator End Device End Device End Device Router Router Router End Device End Device End Device Router Router Router Figure 2: Simple Mesh Network Mesh networks and their constituent nodes are described in more detail in Section JN-UG-3101 v1.5 NXP Laboratories UK

22 Chapter 1 ZigBee PRO Overview 1.3 Ideal Applications for ZigBee ZigBee is suitable for a wide range of applications, covering both commercial and domestic use, which include: Point-to-point cable replacement (e.g. wireless mouse, remote controls, toys) Security systems (e.g. fire and intruder) Environmental control (e.g. heating and air-conditioning) Hospital patient monitoring Lighting control Home automation (e.g. home entertainment, doors, gates, curtains and blinds) Automated meter reading (AMR) Industrial automation (e.g. plant monitoring and control) ZigBee's wireless communications also enable some applications to be developed that currently cannot be implemented with cabled systems. Examples are applications that involve mobility, which must be free of cabling (e.g. long-term health monitoring, asset tracking in warehouses). Existing applications (such as lighting control and industrial plant monitoring) that currently rely on cable-based systems can be implemented more cheaply as ZigBee reduces or removes cable installation costs. ZigBee can also be beneficial in environments where cable-based solutions can be difficult and expensive to install - for example, in home security systems, sensors need to be easy to install (no cables or power supply wiring), small and self-contained (battery-powered). 22 NXP Laboratories UK 2017 JN-UG-3101 v1.5

23 ZigBee PRO Stack 1.4 Wireless Radio Frequency Operation The IEEE protocol, on which ZigBee is built, provides radio-based network connectivity operating in one of three possible RF (Radio Frequency) bands: 868, 915 or 2400 MHz. These bands are available for unlicensed use, depending on the geographical area (check your local radio communication regulations). The characteristics of these RF bands are shown in the table below. RF Band Frequency Range (MHz) Data Rate (kbps) Channel Number(s) Geographical Area 868 MHz (1 channel) Europe 915 MHz (10 channels) America Australia 2400 MHz (16 channels) Worldwide Table 1: Wireless Network Radio Frequency Bands The 868- and 915-MHz bands offer certain advantages such as fewer users, less interference, and less absorption and reflection, but the 2400-MHz band is far more widely adopted for a number of reasons: Worldwide availability for unlicensed use Higher data rate (250 kbps) and more channels Lower power (transmit/receive are on for shorter time due to higher data rate) Band more commonly understood and accepted by the marketplace Therefore, the ZigBee standard assumes operation in the 2400-MHz band, although it is possible to implement ZigBee networks in the other IEEE bands. ZigBee includes measures to avoid interference between radio communications. One is its ability to automatically select the best frequency channel at initialisation. It is also possible to adapt to a changing RF environment by moving the network to another channel, if the current channel proves problematic - this frequency agility is a core feature of ZigBee PRO. Other measures are described in Section 1.7. The range of a radio transmission is dependent on the operating environment - for example, indoors or outdoors. Using an NXP JN516x standard module fitted with an external dipole antenna, a range of over 1 km can typically be achieved in an open area, but inside a building this can be reduced due to absorption, reflection, diffraction and standing wave effects caused by walls and other solid objects. A high-power module (greater than 15 dbm output power) can achieve a range which is a factor of five greater than that of a standard module. In addition, the range between devices can be extended in a ZigBee network since the network topology (see Section 2.2.2) can use intermediate nodes (Routers) as stepping stones when passing data to destinations. JN-UG-3101 v1.5 NXP Laboratories UK

24 Chapter 1 ZigBee PRO Overview 1.5 Battery-Powered Components There are many wireless applications that benefit from battery power, including lightswitches, active tags and security detectors. The ZigBee and IEEE protocols are specifically designed for battery-powered applications. From a user perspective, battery power has certain advantages: Easy and low-cost installation of nodes: No need to connect node to separate power supply Flexible location of nodes: Nodes can be installed in difficult places where there is no power supply, and can even be used as mobile devices Easily modified network: Nodes can easily be added or removed, on a temporary or permanent basis Since these devices are generally small, they use low-capacity batteries and therefore battery use must be optimised. This is achieved by restricting the amount of time for which energy is required by the device. Since the major power drain in the system is the operation of the radio, data may be transmitted infrequently (perhaps once per hour or even once per week), which results in a low duty cycle (transmission time as proportion of time interval between transmissions). When data is not being sent, the device may revert to a low-power sleep mode to minimise power consumption. In practice, not all nodes in a network can be battery-powered, notably those that need to be switched on all the time for routing purposes (and therefore cannot sleep). These devices can often be installed in a mains-powered appliance that is permanently connected to the mains supply (even if not switched on) - for example, a ceiling lamp or an electric radiator. This avoids the need to install a dedicated mains power connection for the node. Only End Devices are normally battery-powered. Note: A network device can also potentially use "energy harvesting" to absorb and store energy from its surroundings - for example, the use of a solar cell panel on a device in a well-lit environment. 24 NXP Laboratories UK 2017 JN-UG-3101 v1.5

25 ZigBee PRO Stack 1.6 Easy Installation and Configuration One of the great advantages of a ZigBee network is the ease with which it can be installed and configured. As already mentioned, the installation is simplified and streamlined by the use of certain battery-powered devices with no need for power cabling. In addition, since the whole system is radio-based, there is no need for control wiring to any of the network devices. Therefore, ZigBee avoids much of the wiring and associated construction work required when installing cable-based networks. The configuration of the network depends on how the installed system has been developed. There are three system possibilities: pre-configured, self-configuring and custom. Pre-configured system: A system in which all parameters are configured by the manufacturer. The system is used as delivered and cannot readily be modified or extended. Examples: vending machine, patient monitoring unit. Self-configuring system: A system that is installed and configured by the end-user. The network is initially configured by sending "discovery" messages between devices. Some initial user intervention is required to set up the devices - for example, by pressing buttons on the nodes. Once installed, the system can be easily modified or extended without any re-configuration by the user - the system detects when a node has been added, removed or simply moved, and automatically adjusts the system settings. Example: off-the-shelf home security or home lighting system in which extra devices can be added later. Custom system: A system that is adapted for a specific application/location. It is designed and installed by a system integrator using custom network devices. The system is usually configured using a software tool. As indicated above, system commissioning (individually configuring the network nodes) can be performed either using an IO interface (e.g. buttons or a keypad) on the node in a self-configuring system or using a commissioning tool (e.g. run on a lap-top PC) which interacts with the node in a custom system. In the latter case, ZigBee PRO allows commissioning to be conducted in a secure way - for example, using a security key to gain access to the configurable parameters of the node, and using encryption in any wireless communication between the commissioning tool and the node. For more information on system security, refer to Section 1.8. JN-UG-3101 v1.5 NXP Laboratories UK

26 Chapter 1 ZigBee PRO Overview 1.7 Highly Reliable Operation ZigBee and IEEE employ a range of techniques to ensure reliable communications between network nodes - that is, to ensure communications reach their destinations uncorrupted. Corruption could result, for example, from radio interference or poor transmission/reception conditions. Data Coding: At a first level, a coding mechanism is applied to radio transmissions. The coding method employed in the 2400-MHz band uses QPSK (Quadrature Phase-Shift Keying) modulation with conversion of 4-bit data symbols to 32-bit chip sequences. Due to this coding, there is a high probability that a message will get through to its destination intact, even if there are conflicting transmissions (more than one device transmitting in the same frequency channel at the same time). Listen Before Send: The transmission scheme also avoids transmitting data when there is activity on its chosen channel - this is known as Carrier Sense, Multiple Access with Collision Avoidance (CSMA-CA). Put simply, this means that before beginning a transmission, a node will listen on the channel to check whether it is clear. If activity is detected on the channel, the node delays the transmission for a random amount of time and listens again - if the channel is now clear, the transmission can begin, otherwise the delay-and-listen cycle is repeated. Acknowledgements: Two systems of acknowledgements are available to ensure that messages reach their destinations: End-to-End: When a message arrives at its final destination, the receiving device sends an acknowledgement to the source node to indicate that the message has been received. End-to-end acknowledgements are optional. Next Hop: When a message is routed via intermediate nodes to reach its destination, the next routing node (or next hop node) in the route sends an acknowledgement to the previous node to indicate that it has received the message. Next-hop acknowledgements are always implemented. In both cases, if the sending device does not receive an acknowledgement within a certain time interval, it resends the original message (it can resend the message several times until the message has been acknowledged). Frequency Agility: When a ZigBee network is initially set up, the best channel in the relevant radio band is automatically chosen as the operating channel. This is normally the quietest channel detected in an energy scan across the band, but this may not always remain the quietest channel if other networks that operate in the same channel are introduced nearby. For this reason, ZigBee includes an optional frequency agility facility. If the operating channel becomes too noisy, this feature allows the whole network to be moved to a better channel in the radio band. Route Repair: Networks that employ a Mesh topology (see Section 1.2) have built-in intelligence to ensure that messages reach their destinations. If the default route to the destination node is down, due to a failed intermediate node or link, the network can discover and implement alternative routes for message delivery. ZigBee PRO is designed for Mesh networks and therefore incorporates route repair as a core feature. 26 NXP Laboratories UK 2017 JN-UG-3101 v1.5

27 ZigBee PRO Stack The above reliability measures allow a ZigBee network to operate even when there are other ZigBee networks nearby operating in the same frequency band. Therefore, adjacent ZigBee networks will not interfere with each other. In addition, ZigBee networks can also operate in the neighbourhood of networks based on other standards, such as Wi-Fi and Bluetooth, without any interference. 1.8 Secure Operating Environment ZigBee networks can be made highly secure - measures can be incorporated to prevent intrusion from potentially hostile parties and from neighbouring ZigBee networks. ZigBee also provides privacy measures for communication between pairs of nodes of the same network. ZigBee PRO provides two security modes, standard security and high security, but only standard security mode is currently included in the NXP ZigBee PRO implementation (since there is currently little demand for high security mode). The standard security mode of ZigBee PRO includes the following security features: Access control lists Key-based encryption of communications Frame counters These security measures are outlined below. Access Control Lists An access control list allows only pre-defined friendly nodes to join the network. Key-based Encryption A very high-security, 128-bit AES-based encryption system (built into the JN516x device as a hardware function) is applied to network communications, preventing external agents from interpreting ZigBee network data. This encryption is key-based. Normally, the same network key is used for all nodes in the network. However, it is possible to use an individual link key between a given pair of network nodes, allowing communications (possibly containing sensitive data) between the two nodes to be private from other nodes in the same network. Keys can be pre-configured in nodes in the factory, commissioned during system installation or distributed around a working network from a central Trust Centre node. A Trust Centre manages keys and security policies - for example, changing the network key on all network nodes, issuing link keys for node pairs and restricting the hours in which certain events or interactions can occur. Any node can be nominated as the Trust Centre, but it is by default the Co-ordinator. JN-UG-3101 v1.5 NXP Laboratories UK

28 Chapter 1 ZigBee PRO Overview Frame Counters The use of frame counters prevents sending the same message twice, and freshness checking rejects any such repeated messages, preventing message replay attacks on the network. An example of a replay attack would be someone recording the open command for a garage door opener, and then replaying it to gain unauthorised entry into the property. 1.9 Co-existence and Interoperability ZigBee is an open standard devised by the ZigBee Alliance. Any device designed for use in a ZigBee network must comply with the standard. This ensures "co-existence" and, to a certain extent, "interoperability" of ZigBee devices: Co-existence: The ability of a device to operate in the same space and radio channel as devices in other wireless networks (which possibly use protocols other than ZigBee) without interfering with them Interoperability: The ability of a device to operate in the same ZigBee network as devices from other manufacturers - that is, to communicate and function with them The ZigBee Alliance co-ordinates the compliance issues for products based on the ZigBee protocol. It defines two levels of compliance: ZigBee Compliant Platform (ZCP) applies to modules or platforms intended as building blocks for use in end-products. All NXP products based on the supported chips are designed to be ZigBee Compliant Platforms. See Chip Compatibility on page 16. ZigBee Certified Product applies to end-products that are built on ZigBee Compliant Platforms and that use public ZigBee Alliance Application Profiles. After successful completion of the ZigBee Alliance Certification programme, the ZigBee Certified Product logo can be applied to the product. Note: End-products based on manufacturer-specific profiles can also obtain ZigBee Certified Product status, but such products cannot carry the ZigBee Certified Product logo. Test service providers are authorised by the ZigBee Alliance to undertake testing and certification. For details of authorised test houses, contact the ZigBee Alliance. In addition, products using an NXP ZCP must also be checked against the radio regulations of the country or countries where they are to be marketed (these checks can often be performed by the same test house). 28 NXP Laboratories UK 2017 JN-UG-3101 v1.5

29 ZigBee PRO Stack 1.10 Profiles For the purpose of interoperability (described in Section 1.9), the ZigBee Alliance has introduced the concept of a device profile, which contains the essential properties of a device for a particular application or market. There are two classes of profile, the Stack Profile and the Application Profile, described below Stack Profiles The ZigBee specification contains both mandatory and optional features that are available to a wireless network application. A manufacturer of ZigBee products may implement only a subset of the optional features. The particular set of optional features implemented determines the Stack Profile used. Thus, the Stack Profile varies between manufacturers and a particular ZigBee device may only operate with a specific Stack Profile. Currently, two standard ZigBee Alliance stack profiles are available for use with public Application Profiles (see Section below) - these stack profiles are ZigBee and ZigBee PRO. The NXP software described in this manual uses the ZigBee PRO stack profile and cannot be modified to use any other profile Application Profiles An Application Profile defines a collection of devices that can be coherently used together in implementing an application for a certain market sector. For example, the ZigBee Alliance has defined the Home Automation (HA) profile for use in controlling appliances and systems in the home, such as a lighting system. It defines a number of devices and functions that are needed or are useful for controlling domestic systems, such as switches, dimmers, occupancy sensors and load controllers for a lighting system. Application Profiles can be public or private, described below. Public Profiles The profiles introduced by the ZigBee Alliance are public profiles, for use by manufacturers implementing devices that need to work with devices from other manufacturers. For example, to allow a switch from one vendor to work with the light fitting (containing a load controller) from another vendor, both should implement the appropriate devices specified in the HA profile. Products implemented to a public profile will be tested and certified for conformance to that profile, in order to ensure that a device implementing a function in the profile will operate with another suitable device. The main advantage of public profiles is that products (e.g. a light-switch) from multiple manufacturers will work together. A public Application Profile is identified by a 16-bit number, allocated by the ZigBee Alliance, giving the possibility of many thousands of profiles. Public profiles can only JN-UG-3101 v1.5 NXP Laboratories UK

30 Chapter 1 ZigBee PRO Overview be used on ZigBee Compliant Platforms based on either the ZigBee or ZigBee PRO stack profile. Private Profiles (also known as 'non-public' profiles) Due to the huge diversity of market segments, geographic regions and products, many applications are expected to be developed with private profiles. Products utilising private profiles may still be able to co-exist and interoperate with other ZigBee networks. Private profiles have a number of advantages for manufacturers. They allow manufacturers to introduce products to market for which public profiles do not exist, and allow them to differentiate their products from others in the same market segment. Note that private profiles can be used on platforms based on stack profiles other than ZigBee and ZigBee PRO. 30 NXP Laboratories UK 2017 JN-UG-3101 v1.5

31 ZigBee PRO Stack 2. ZigBee PRO Architecture and Operation This chapter introduces ZigBee PRO from architectural and operational view-points by describing: Basic architecture on which ZigBee PRO is based (Section 2.1) Concepts for an understanding of ZigBee PRO at the network level (Section 2.2) Process of network formation (Section 2.3) Concepts for an understanding of ZigBee PRO at the application level (Section 2.4) Features and concepts related to message routing (Section 2.5) Features and concepts related to exchanging messages (Section 2.6) A detailed view of the ZigBee PRO software architecture (Section 2.7) 2.1 Architectural Overview This section introduces the basic architecture of the software that runs on a ZigBee PRO network node. The software architecture is built on top of IEEE , an established and proven standard for wireless communication. From a high-level view, the software architecture of any ZigBee network comprises four basic stack layers: Application layer, Network layer, Data Link layer and Physical layer. The Application layer is the highest level and the Physical layer is the lowest level, as illustrated in the figure below. Application layer Network layer Data Link layer Physical layer Figure 3: Basic Software Architecture Note: The NXP ZigBee PRO software is supplied with JenOS (Jennic operating system), which sits alongside and interacts with the above software stack. JenOS is included in the description of the NXP ZigBee PRO software architecture in Section 3.1. JN-UG-3101 v1.5 NXP Laboratories UK

32 Chapter 2 ZigBee PRO Architecture and Operation The basic layers of the ZigBee software stack are described below, from top to bottom: Application layer: The Application layer contains the applications that run on the network node. These give the device its functionality - essentially an application converts input into digital data, and/or converts digital data into output. A single node may run several applications - for example, an environmental sensor may contain separate applications to measure temperature, humidity and atmospheric pressure. Network layer: The Network layer provides the ZigBee PRO functionality and the application s interface to the IEEE layers (see below). The layer is concerned with network structure and multi-hop routing. Data Link layer: The Data Link layer is provided by the IEEE standard and is responsible for addressing - for outgoing data it determines where the data is going, and for incoming data it determines where the data has come from. It is also responsible for assembling data packets or frames to be transmitted and disassembling received frames. In the IEEE standard, the Data Link layer is referred to as IEEE MAC (Media Access Control) and the frames used are MAC frames. Physical layer: The Physical layer is provided by the IEEE standard and is concerned with the interface to the physical transmission medium (radio, in this case), exchanging data bits with this medium, as well as exchanging data bits with the layer above (the Data Link layer). In the IEEE standard, the Physical layer is referred to as IEEE PHY. For a more detailed view of the software architecture of ZigBee PRO, refer to Section Section 2.7. Note: Security measures are implemented throughout the stack, including the Application layer and lower stack layers. 32 NXP Laboratories UK 2017 JN-UG-3101 v1.5

33 ZigBee PRO Stack 2.2 Network Level Concepts This section describes important concepts relating to the work of the ZigBee stack ZigBee Nodes There are three general types of node that can exist in a ZigBee network: Co-ordinator Router End Device The roles of these node types are described in the sub-sections below. Note: These roles exist at the network level - a ZigBee node may also be performing tasks at the Application level, independent of the role it plays in the network. For example, a network of ZigBee devices measuring temperature may have a temperature sensor application in each node, irrespective of whether the node is an End Device, Router or the Co-ordinator. Co-ordinator All ZigBee networks must have one (and only one) Co-ordinator. At the network level, the Co-ordinator is mainly needed at system initialisation - it is the first node to be started and performs the following initialisation tasks: Selects the frequency channel to be used by the network (usually the one with the least detected activity) Starts the network Allows child nodes to join the network through it The Co-ordinator can additionally provide other services such as message routing and security management. It may also provide services at the Application level. If any of these additional services are used, the Co-ordinator must be able to provide them at all times. However, if none of these additional services are used, the network will be able to operate normally even if the Co-ordinator fails or is switched off. Router A ZigBee PRO network usually has at least one Router. The main tasks of a Router are: Relays messages from one node to another Allows child nodes to join the network through it Note that a Router cannot sleep, as it must always be available for routing. JN-UG-3101 v1.5 NXP Laboratories UK

34 Chapter 2 ZigBee PRO Architecture and Operation End Device The main tasks of an End Device at the network level are sending and receiving messages. An End Device can only communicate directly with its parent, so all messages to/from an End Device pass via its parent. An End Device can be battery-powered and, when not transmitting or receiving, can sleep in order to conserve power. Messages destined for a sleep-enabled End Device are buffered by its parent for collection by the End Device once it is awake (also see Section below). Note that End Devices cannot relay messages and cannot allow other nodes to connect to the network through them - that is, they cannot have children Network Topology The ZigBee PRO standard was designed to facilitate wireless networks with the Mesh topology. A Mesh network consists of a Co-ordinator, Routers and End Devices. The Coordinator is associated with a set of Routers and End Devices - its children. A Router may then be associated with more Routers and End Devices - its children. This can continue to a number of levels. The relationships between the nodes must obey the following rules: The Co-ordinator and Routers can have children, and can therefore be parents. A Router can be both a child and a parent. End Devices cannot have children, and therefore cannot be parents. The communication rules for a Mesh network are as follows: An End Device can only directly communicate with its parent (and with no other node). A Router can directly communicate with its children, with its own parent and with any other Router or Co-ordinator within radio range. The Co-ordinator can directly communicate with its children and with any Router within radio range. The resulting structure is illustrated in Figure 4. In ZigBee PRO, the maximum depth (number of levels below the Co-ordinator) of a network is 15. The maximum number of hops that a message can make in travelling between the source and destination nodes is 30 (twice the maximum depth). The ability of a routing node (Router or Co-ordinator) to communicate directly with other routing nodes (within radio range) is the specific property that distinguishes a Mesh network from a Tree network. This property gives rise to very efficient and flexible message propagation, and means that alternative routes can be found if a link fails or there is congestion. Note that an End Device which is able to sleep is unable to receive messages directly. A message destined for a sleep-enabled End Device is always buffered in its parent node, in case the End Device is asleep when the message arrives. Once the End Device is awake, it must ask or poll the parent for messages. 34 NXP Laboratories UK 2017 JN-UG-3101 v1.5

35 ZigBee PRO Stack Co-ordinator End Device End Device End Device Router Router Router End Device End Device End Device Router Router Router Figure 4: Mesh Topology In the Mesh topology, a "route discovery" feature is provided which allows the network to find the best available route for a message. Route discovery is described further in Section Note that message propagation is handled by the network layer software and is transparent to the application programs running on the nodes Neighbour Tables A routing node (Router or Co-ordinator) holds information about its neighbouring nodes. This information is stored in a Neighbour table containing entries for the node s immediate children, for its own parent and, in a Mesh network, for all peer Routers with which the node has direct radio communication. It is possible to define the maximum number of entries in a Neighbour table. If this parameter is set to a low value, it will result in a long, thin network. The structure and configuration of a Neighbour table are described in Appendix B.5.1. JN-UG-3101 v1.5 NXP Laboratories UK

36 Chapter 2 ZigBee PRO Architecture and Operation Network Addressing In a ZigBee network, each node must have a unique identification. This is achieved by means of two addresses: IEEE (MAC) address: This is a 64-bit address, allocated by the IEEE, which uniquely identifies the device - no two devices in the world can have the same IEEE address. It is often referred to as the MAC address and, in a ZigBee network, is sometimes called the extended address. Network address: This 16-bit address identifies the node in the network and is local to that network (thus, two nodes in separate networks may have the same network address). It is sometimes called the short address. In ZigBee PRO, the network address of a node is dynamically assigned as a random 16-bit value by the parent when the node first joins the network. Due to the randomness of the address allocation, this is known as stochastic addressing. Although random, the parent ensures that the chosen address has not already been assigned to one of its neighbours. In the unlikely event of the address already existing in the network beyond the immediate neighbourhood, a mechanism exists to automatically detect and resolve the conflict. The allocated network address can be retained by the joining node, even if it later loses its parent and acquires a new parent. The Co-ordinator always has the network address 0x0000. While an application on a node may use IEEE/MAC addresses or network addresses to identify remote nodes, the ZigBee PRO stack always uses network addresses for this purpose. To facilitate translation between IEEE/MAC addresses and network addresses, an Address Map table may be maintained on the node, where each table entry contains the pair of addresses for a remote node. In the NXP implementation of ZigBee PRO, the IEEE/MAC addresses (of other network nodes) are stored in a single place on a node, called the MAC Address table. This avoids the need to repeat the 64-bit IEEE/MAC addresses in other tables, such as the Address Map table and Neighbour table, and therefore saves storage space. Instead, a 16-bit index to the relevant entry in the MAC Address table is stored in the other tables. It is also possible to define a 16-bit group address which refers to a set of applications (or endpoints - see Section 2.4.1) that may be located across several nodes. Specifying a group address in a data transfer will result in the data being broadcast to all nodes in the network but, at the destinations, the data will only be passed to those applications which are covered by the group address. Refer to Section 5.3 for more details of using group addresses. 36 NXP Laboratories UK 2017 JN-UG-3101 v1.5

37 ZigBee PRO Stack Network Identity A ZigBee network must be uniquely identifiable. This allows more than one ZigBee network to operate in close proximity - nodes operating in the same space must be able to identify which network they belong to. For this purpose, ZigBee uses two identifiers, as follows: PAN ID: A 16-bit value called the PAN ID (Personal Area Network Identifier) is used in inter-node communications (implemented at the IEEE level of the stack) to identify the relevant network. A value for the PAN ID is selected at random by the Co-ordinator when the network is started. When other nodes join the network, they learn the network s PAN ID and use it in all subsequent communications with the network. It is possible that the PAN ID generated for a newly installed network will clash with the PAN ID of another network already operating on the same radio channel, in the same neighbourhood. In this case, ZigBee PRO automatically resolves such a conflict by generating another random PAN ID for the new network until a value is obtained that does not clash with the PAN ID of any other detectable network. Extended PAN ID: A 64-bit value called the Extended PAN ID (EPID) is used in forming the network and subsequently modifying the network, if necessary. This identifier can be pre-set to a random value in the user application that runs on the Co-ordinator. Alternatively, the identifier can be pre-set to zero, in which case the Co-ordinator will adopt its own 64-bit IEEE/MAC address as the Extended PAN ID when the network starts - this is a sure way of obtaining a globally unique value (see Section 2.2.4). When a Router or End Device first tries to find a network to join, it will use the Extended PAN ID in either of following ways: If an Extended PAN ID has been pre-set in the user application for the Router or End Device, the node will join the network which has this Extended PAN ID (provided this network is detected). If there is no pre-set Extended PAN ID for the Router or End Device, the node will join the first network detected, irrespective of the Extended PAN ID. The joining node will then learn the Extended PAN ID of its network and later use this identifier to rejoin the network if, for some reason, it loses contact with the network (the node is orphaned). For more information on joining a network, refer to Section Note: At the Application level, you only need to be concerned with the Extended PAN ID, as the allocation and use of the PAN ID is transparent to the application. JN-UG-3101 v1.5 NXP Laboratories UK

38 Chapter 2 ZigBee PRO Architecture and Operation 2.3 Network Creation This section outlines the process of starting and forming a ZigBee PRO network: Section describes how the Co-ordinator starts a network. Section describes how a Router or End Device joins a network as part of the network formation process. Note: The network formation actions described in this section are performed automatically by the ZigBee stack. The actions required at the application level are described later in Section Starting a Network (Co-ordinator) The Co-ordinator is responsible for starting a network. It must be the first node to be started and, once powered on, goes through the following network initialisation steps: 1. Set EPID and Co-ordinator address The Co-ordinator first sets the Extended PAN ID (EPID) for the network and the device s own network address: Sets the EPID to the 64-bit value specified in the Co-ordinator s application (if this value is zero, the EPID will be set to the 64-bit IEEE/MAC address of the Co-ordinator device) Sets the 16-bit network address of the Co-ordinator to 0x Select radio channel The Co-ordinator then selects the radio channel in which the network will operate, within the chosen RF band. The Co-ordinator performs an Energy Detection Scan in which it scans the RF band to find a quiet channel (the scan can be programmed to listen to specific channels). The channel with the least detected activity is chosen. 3. Set the PAN ID of the network Once the radio channel has been selected, the Co-ordinator chooses a 16-bit PAN ID for the network. To do this, it listens in the channel for traffic from other networks and identifies the PAN IDs of these networks (if any). To avoid conflicts, the Co-ordinator assigns its own network a random PAN ID that is not in use by another network. 4. Receive join requests from other devices The Co-ordinator is now ready to receive requests from other devices (Routers and End Devices) to wirelessly connect to the network through it. For more information on joining a network, refer to Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

39 ZigBee PRO Stack Joining a Network (Routers and End Devices) Routers and End Devices can join an existing network already created by a Coordinator. The Co-ordinator and Routers have the capability to allow other nodes to join the network through them. The join process is as follows: 1. Search for network The new node first scans the channels of the relevant RF band to find a network. Multiple networks may operate, even in the same channel, and the selection of a network is the responsibility of the application (for example, this decision could be based on a pre-defined Extended PAN ID). 2. Select parent The node now selects a parent node within the chosen network by listening to network activity. The node may be able to 'hear' multiple Routers and the Coordinator from the network. Given a choice of parents, the node chooses the parent with the smallest depth in the network - that is, the parent closest to the Co-ordinator (which is at depth zero). 3. Request joining The node sends a message to the desired parent, asking to join the network. 4. Receive response The node now waits for a response from the potential parent, which determines whether the node is a permitted device and whether the parent is currently allowing devices to join. To determine whether the joining node is a permitted device, the parent consults the Trust Centre (if it is not the Trust Centre itseif). If these criteria are satisfied, the parent will then allow the node to join the network as its child. In its acceptance response to its new child, the parent will include the 16-bit network address that it has randomly allocated to the child (see Section 2.2.4). If the potential parent is unable to accept the node as a child, a rejection response will be sent to the node, which must then try another potential parent (or another network). 5. Learn network IDs The new node learns the PAN ID and Extended PAN ID of the network, as well as the network address that it has been assigned. It will need the PAN ID for communications with the network and will need the Extended PAN ID if, at some point in the future, it needs to rejoin the network (it will also be able to reuse its network address if it later rejoins the network). A Router or Co-ordinator can be configured to have a time-period during which joins are allowed, controlled by its permit joining status. The join period may be initiated by a user action, such as pressing a button. An infinite join period can also be set, so that child nodes can join the parent node at any time. Note: When an orphaned node attempts to rejoin the network, the permit joining status of a potential parent is ignored. Thus, the node is able to rejoin the network through a parent on which permit joining is disabled. JN-UG-3101 v1.5 NXP Laboratories UK

40 Chapter 2 ZigBee PRO Architecture and Operation 2.4 Application Level Concepts This section describes some key concepts required at the application level Multiple Applications and Endpoints A node may have several applications running on it - for example, a node in an environment monitoring network may be measuring temperature and humidity, each of which is an application. Access to application instances is provided through endpoints, which act as communication ports for the applications. In order to direct a message to the appropriate application instance on a node, the relevant endpoint must be specified. Endpoints are numbered from 1 to 240. Therefore, to communicate with a remote application instance in a ZigBee network, you need to supply the address of the remote node together with the required endpoint number on the node. Endpoint 255 is the broadcast endpoint number - the same data can be sent to all application instances on a node by sending the message to this endpoint number Descriptors An application may need to obtain information about the nodes of the network in which it runs, as described in Section For this, it uses information stored in descriptors in the nodes. There are three mandatory descriptors and two optional descriptors stored in a node. The mandatory descriptors are the Node, Node Power and Simple descriptors, while the optional descriptors are called the Complex and User descriptors For each node, there is only one Node and Node Power descriptor, but there is a Simple descriptor for each endpoint. There may also be Complex and User descriptors in the device. The Node, Node Power and Simple descriptors are outlined below. For full details of the descriptors, refer to Section Node Descriptor The Node descriptor contains information on the capabilities of the node, including: Type (End Device, Router or Co-ordinator) Frequency band in use (868 MHz, 902 MHz or 2400 MHz) IEEE MAC capabilities - that is, whether: the device can be a PAN Co-ordinator the node implements a Full-Function or Reduced-Function IEEE device the device is mains powered the device is capable of using MAC security 40 NXP Laboratories UK 2017 JN-UG-3101 v1.5

41 ZigBee PRO Stack the receiver stays on during idle periods Manufacturer code Maximum buffer size (the largest data packet that can be sent by an application in one operation) Node Power Descriptor The Node Power descriptor contains information on how the node is powered: Power mode - whether the device receiver is on all the time, or wakes up periodically as determined by the network or only when an application requires (e.g. button press) Available power sources - indicates whether the mains supply, or rechargeable or disposable batteries (or any combination) can be used to power the device Current power sources - indicates which power source (mains supply, or rechargeable or disposable batteries) is currently being used to power the device Current power source level - indicates the level of charge of the current power source Simple Descriptor The Simple descriptor for an application includes: The endpoint on which the application communicates The Application Profile that it implements The Application Profile device identifier and version Whether there are corresponding Complex and User descriptors Lists of input and output clusters (see Section 2.4.1) that the application uses and provides, respectively Application Profiles The Application Profile ensures the interoperability of ZigBee devices from different manufacturers. This profile relates to a particular application area and/or market, and contains descriptions of the device types and interfaces that are needed for the relevant field of application. An Application Profile is defined in terms of the device descriptors introduced in Section The ZigBee Alliance defines public profiles, such as the Home Automation (HA) profile. Private and public profiles can be defined by individual manufacturers, but all public profiles must use unique identifiers allocated by the ZigBee Alliance. As well as defining the device types supported, the Application Profile also specifies the types of data supported and the operations that can be performed on this data. These are defined in terms of the clusters for an endpoint, which are specified in the Simple descriptor for the endpoint. Clusters are described in Section JN-UG-3101 v1.5 NXP Laboratories UK

42 Chapter 2 ZigBee PRO Architecture and Operation Attributes and Clusters A data entity (e.g. temperature measurement) handled by a ZigBee endpoint is referred to as an attribute. The application may communicate via a set of attributes - for example, a thermostat endpoint may have attributes for temperature, minimum temperature, maximum temperature and tolerance. ZigBee applications use the concept of a "cluster" for communicating attribute values. A cluster comprises a set of related attributes together with a set of commands to interact with the attributes - for example, the above temperature measurement attributes together with commands for reading the attribute values. A cluster has two aspects, which are respectively concerned with receiving and sending commands. One or both aspects may be used by a ZigBee application. These sides of a cluster are described below and illustrated in Figure 5. Input Cluster or Server Cluster: This side of a cluster is used to store attributes and receive commands to manipulate the stored attributes (to which the cluster may return responses) - for example, an input cluster would store a temperature measurement and associated attributes, and respond to commands which request readings of these attributes. Output Cluster or Client Cluster: This side of a cluster is used to manipulate attributes in the corresponding input cluster by sending commands to it (and receiving the responses). Normally, these are write commands to set attribute values and read commands to obtain attribute values (the read values being returned in responses). Note: In the context of clusters and attributes, the ZigBee standard sometimes refers to applications as devices. Application A Output Cluster (Client) Commands sent from client to server Responses returned from server to client (may contain attribute values read) Application B Input Cluster (Server) Attributes written or read, according to command Figure 5: Input and Output Clusters The input clusters and output clusters communicated via an endpoint are listed (separately) in the endpoint s Simple descriptor, which forms part of the Application Profile (see Section 2.4.3). For consistency and interoperability, the ZigBee Alliance have defined a number of standard clusters for different functional areas. These are collected together in the 42 NXP Laboratories UK 2017 JN-UG-3101 v1.5

43 ZigBee PRO Stack ZigBee Cluster Library (ZCL). Thus, developers can use standard clusters from the ZCL in their Application Profiles. The ZCL is fully detailed in the ZigBee Cluster Library Specification (075123) from the ZigBee Alliance. A Default cluster (with ID of 0xFFFF) is also available. If the Default cluster is present on an endpoint and a message is received which is destined for a cluster that is not in the endpoint's list of supported input clusters, this message will still be passed to the application (provided it comes from a defined application profile). If it is required, the Default cluster must be explicitly added to the endpoint (see Section ) Discovery The ZigBee specification provides the facility for devices to find out about the capabilities of other nodes in a network, such as their addresses, which types of applications are running on them, their power source and sleep behaviour. This information is stored in descriptors (see Section 2.4.5) on each node, and is used by the enquiring node to adapt its behaviour to the requirements of the network. Discovery is typically used when a node is being introduced into a user-configured network, such as a domestic security or lighting control system. To integrate the device into the network may require the user to start the integration process by pressing a button or similar. The first task is to find out if there are any appropriate devices with which the new node can communicate. Device Discovery Device discovery returns information about the addresses of a network node. The retrieved information can be the IEEE/MAC address of the node with a given network address, or the network address of a node with a given IEEE/MAC address. If the node being interrogated is a Router or Co-ordinator, it may optionally supply the addresses of all the devices that are associated with it, as well as its own address. In this way, it is possible to discover all the devices in a network by requesting this information from the Co-ordinator (network address 0x0000) and then using the list of addresses corresponding to the children of the Co-ordinator to launch other queries about their child nodes. Service Discovery Service discovery allows a node to request information from a remote node about the remote node's capabilities. This information is stored in a number of descriptors (see Section 2.4.2) on the remote node, and includes: The device type and capabilities of the node The power characteristics of the node Information about each application running on the node Optional information such as serial numbers Other user-defined information - for example, easily understandable names such as MtgRoomLight Requests for these descriptors are made by a device during the discovery process that is typically part of the device's configuration and integration into a ZigBee network. JN-UG-3101 v1.5 NXP Laboratories UK

44 Chapter 2 ZigBee PRO Architecture and Operation ZigBee Device Objects (ZDO) A special application, common to all ZigBee devices, is provided to manage the various processes which have been described. This application is the ZigBee Device Objects or ZDO. It resides in the Application layer of a node, and can communicate with remote nodes via endpoint 0 using the ZigBee Device Profile (ZDP) and associated clusters. It has the following roles: Defines the type of network device: Co-ordinator, Router or End Device Initialises the node to allow applications to be run Performs the device discovery and service discovery processes Implements the processes needed to allow a Co-ordinator to create a network, and Routers and End Devices to join and leave a network Initiates and responds to binding requests (see Section 2.6.2) Provides security services which allow secure relationships to be established between applications Allows remote nodes to retrieve information from the node, such as Routing and Binding tables, and to perform remote management of the node, such as instructing it to leave the network The ZDO uses services within the stack to implement these roles and provides a means of allowing user applications to access stack services. 44 NXP Laboratories UK 2017 JN-UG-3101 v1.5

45 ZigBee PRO Stack 2.5 Network Routing The basic operation in a network is to transfer data from one node to another. The data is sourced from an input (possibly a switch or a sensor) on the originating node, and is communicated to another node which can interpret and use the data. In the simplest data communication, the data is transmitted directly from the source node to the destination node. However, if the two nodes are far apart or in a difficult environment, direct communication may not be possible. In this case, it is necessary to send the data to another node within radio range, which then passes it on to another node, and so on until the desired destination node is reached - that is, to use one or more intermediate nodes as stepping stones. The process of receiving data destined for another node and passing it on is known as routing. Actual route Node 2 Node 3 Node 1 Desired route Node 4 Figure 6: Message Routing Routing allows the range of a network to be extended beyond the distances supported by direct radio communication. Remote devices can join the network by connecting to a Router. Note: Application programs in intermediate nodes are not aware of the relayed message or its contents - the relaying mechanism is handled by the ZigBee stack Message Addressing and Propagation If a message sent from one node to another needs to pass through one or more intermediate nodes to reach its final destination (up to 30 such hops are allowed), the message carries two destination addresses: Address of the final destination Address of the node which is the next "hop" ZigBee PRO is designed for Mesh networks (see Section 2.2.2) in which the message propagation path (the route) depends on whether the target node is in radio range: If the target node is in range, only the "final destination" address is used. If the target node is not in range, the "next hop" address is that of the first node in the route to the final destination. JN-UG-3101 v1.5 NXP Laboratories UK

46 Chapter 2 ZigBee PRO Architecture and Operation The next hop address is determined using information stored in a Routing table on the routing node (Router or Co-ordinator). An entry of this table contains information for a remote node, including the network addresses of the remote node and of the next routing node in the route to the remote node. Thus, when a message is received by a routing node, it looks for the destination address in its Routing table and extracts next hop address from this table to insert into the message. The message is then passed on and propagation continues in this way until the target node is reached. Note that if the message originates from an End Device, the message will always be first passed to the source node s parent before being passed on Route Discovery The ZigBee stack network layer supports a route discovery facility which finds the best available route to the destination, when sending a message. A message is normally routed along an already discovered mesh route, if one exists, otherwise the routing node (Router or the Co-ordinator) involved in sending the message initiates a route discovery. Once complete, the message will be sent along the calculated route. The mechanism for route discovery between two End Devices has the following steps: 1. A route discovery broadcast is sent by the parent of the source End Device, and contains the destination End Device s network address. 2. All routing nodes will eventually receive the broadcast, one of which is the parent of the destination End Device 3. The parent of the destination node sends back a reply addressed to the parent of the source node. 4. As the reply travels back through the network, the hop count and a signal quality measure for each hop are recorded. Each routing node in the path can build a Routing table entry containing the best path to the destination End Device. The choice of best path is usually the one with the least number of hops, although if a hop on the most direct route has a poor signal quality (and hence a greater chance that retries will be needed), a route with more hops may be chosen. 5. Eventually each routing node in the path will have a Routing table entry and the route from source to destination End Device is established. Note that the corresponding route from destination to source is not known - the route discovered is unidirectional. A source Router implements route discovery in a similar way to the above except the Router broadcasts its own route discovery message (without needing its parent to do this). Similarly, the Co-ordinator broadcasts its own route discovery messages. Note: Message routing is performed automatically by the ZigBee stack and is transparent to the user application. If required, route discovery is also automatic and transparent to the application. 46 NXP Laboratories UK 2017 JN-UG-3101 v1.5

47 ZigBee PRO Stack Many-to-one Routing A common scenario in a wireless network is the need for most network nodes to communicate with a single node which performs some centralised function, e.g. a gateway. This node is often referred to as a concentrator. In order to establish communication with the concentrator, each remote node may initiate a route discovery, resulting in a corresponding entry in the Routing table of each routing node along the way. If most network nodes need to communicate with the concentrator, many such route discoveries may be initiated. Where the resulting routes have a common leg, the relevant Routing table entries will not be duplicated but shared. However, a large number of simultaneous route discoveries may require significant memory space in the nodes near the concentrator for the temporary storage of route discovery information, and possibly result in memory overflow and traffic congestion. A more efficient method of establishing routes to a concentrator is for the concentrator to initiate a many-to-one route discovery for routes from all other network nodes to itself. To do this, the concentrator broadcasts a route discovery request and the Routing tables are updated as the broadcast propagates through the network. Since no responses are generated, the temporary storage of route discovery information is not required and network traffic congestion is minimised. Many-to-one route discovery is illustrated in the figure below. Concentrator broadcasts a route discovery request for routes back to itself "Concentrator" Node Figure 7: Many-to-one Route Discovery In order to avoid the storage of return routes (from the concentrator) in the Routing tables of intermediate nodes, the technique of source routing is used - the outward route taken by a message to the concentrator is remembered by the concentrator and embedded in the response message. In this case, the response message must carry up to 30 addresses of the nodes along the return route (maximum number of hops allowed is 30). JN-UG-3101 v1.5 NXP Laboratories UK

48 Chapter 2 ZigBee PRO Architecture and Operation 2.6 Network Communications This section considers the processes that are needed to allow a network of devices to exchange information and perform useful functions. In order to communicate with each other, two nodes must be compatible in that one node can produce data which the other node can accept and interpret in a meaningful way. For example, a temperature sensor node produces a temperature measurement that a heating controller node can use to control a central heating system. When a new node joins a network, it must find compatible nodes with which it is able to communicate - this process is facilitated by the Service Discovery mechanism. It must then choose which of the compatible nodes it will communicate with. A method of pairing nodes for easy communication is provided by the binding mechanism. Note: While you should always use Service Discovery to find compatible nodes, binding is an optional method for pairing compatible nodes. Service Discovery and binding are covered in the sub-sections below Service Discovery A device joining a network must be able to find other devices in the network that can use the information it provides, or that can generate the information needed by the device to perform its own function. A node can use Service Discovery to find nodes with which it can communicate. Service Discovery is introduced in Section The node requests the required services from other nodes by means of a broadcast message that propagates throughout the network. Any node that has the requested services then uni-casts a response back to the requesting node. This means that the requesting node may receive more than one response. A response includes the network address of the remote node that contains the requested services. The node stores this address locally and the application can then use the address for all future communications to the remote node. This is referred to as direct addressing. Alternatively, rather than using direct addressing in their communications, two nodes can communicate through the binding mechanism, described in Section below. 48 NXP Laboratories UK 2017 JN-UG-3101 v1.5

49 ZigBee PRO Stack Binding Once two nodes have been found to be compatible through Service Discovery (see Section 2.6.1), they may be paired for communication purposes. For example, a lightswitch may be paired with a particular light, and we must ensure that this light-switch only ever switches the light that it is intended to control. An easy way to pair nodes for communication is provided by the binding mechanism. Binding allows nodes to be paired in such a way that a certain type of output data from one node is automatically routed to the paired node, without the need to specify the destination address and endpoint every time. The two nodes must first be bound together using the address and relevant endpoint number for each node - these can be obtained through Service Discovery, described in Section A binding has a source node and a destination node, relating to the direction in which data will be sent between the nodes (from source to destination). The details of a binding are stored as an entry in a binding table, normally held on the source node of the binding or sometimes on another nominated node. In order to establish a binding, it must be requested in either of the following ways: Binding request is submitted to the source node for the binding by either the source node itself or a remote node (not one of the nodes to be bound). Binding requests are submitted to the Co-ordinator by the source and destination nodes for the binding (for example, by pressing a button on each node to generate a binding request). The two binding requests must be received within a certain timeout period. During the binding process, the Binding table for the source node is updated or, if necessary, created. Binding occurs at the application level using clusters (described in Section 2.4.4). In order for two applications to be bound, they must support the same cluster. The binding between two applications is specified by: The node address and endpoint number of the source of the binding (e.g. a light-switch) The node address and endpoint number of the destination of the binding (e.g. the load controller for a light) The cluster ID for the binding JN-UG-3101 v1.5 NXP Laboratories UK

50 Chapter 2 ZigBee PRO Architecture and Operation The following types of binding can be achieved: One-to-one: This is a simple binding in which an endpoint is bound to one (and only one) other endpoint, requiring a single Binding table entry. One-to-many: This is a binding in which a source endpoint is bound to more than one destination endpoint. The binding is achieved by having multiple Binding table entries for the same source endpoint. Many-to-one: This is a binding in which more than one source endpoint is bound to a single destination endpoint. The binding is achieved by multiple nodes having one-to-one bindings for the same destination endpoint. These are illustrated in the figure below. One-to-one binding One-to-many binding... Many-to-one binding... Figure 8: Types of Binding As an example of these bindings, consider a switch and load controller for lighting: In the one-to-one case, a single switch controls a single light In the one-to-many case, a single switch controls several lights In the many-to-one case, several switches control a single light, such as a light on a staircase, where there are switches at the top and bottom of the stairs, either of which can be used to switch on the light It is also possible to envisage many-to-many bindings where in the last scenario there are several lights on the staircase, all of which are controlled by either switch. 50 NXP Laboratories UK 2017 JN-UG-3101 v1.5

51 ZigBee PRO Stack The way bindings are configured depends on the type of network (described in Section 1.6), as follows: Pre-configured system: Bindings are factory-configured and stored in the application image. Self-configuring system: Bindings are automatically created during network installation using discovery software that finds compatible nodes/clusters. Custom system: Bindings are created manually by the system integrator or installation technician, who may use a graphical software tool to draw binding lines between clusters on nodes. 2.7 Detailed Architecture This section elaborates on the simplified software architecture presented in Section 2.1 The detailed architecture is illustrated in the figure below. Application (APL) layer Application Framework (AF) Application object Endpoint Application object Endpoint 1 ZigBee Device Objects (ZDO) Endpoint 0 Security Service Provider Application Support sub-layer (APS) Network (NWK) layer ZDO Management plane IEEE MAC layer IEEE PHY layer Figure 9: Detailed Software Architecture JN-UG-3101 v1.5 NXP Laboratories UK

52 Chapter 2 ZigBee PRO Architecture and Operation Software Levels The software architecture diagram in Figure 9 shows (from top to bottom): Application (APL) Layer This includes: Applications: Up to 240 application instances may be supported on a single ZigBee node. Each application instance communicates via an endpoint, where endpoints are numbered between 1 and 240 (note that endpoint 0 is reserved for the ZDO of the node - see below). Application Framework (AF): The AF facilitates interaction between the applications and the APS layer (see below) through an interface known as a Service Access Point or SAP. All application instances are contained inside this framework. Application Support sub-layer (APS): The APS layer is responsible for: Communicating with the relevant application - for example, when a message arrives to illuminate an LED, the APS layer relays this instruction to the responsible application using the endpoint information in the message. Maintaining binding tables (see Section 2.6.2) and sending messages between bound nodes Providing communication with the Trust Centre to obtain authorisation The APS layer has an associated database, called the APS Information Base (AIB). This contains attributes that mainly relate to system security. ZigBee Device Objects (ZDO): The ZDO represents the ZigBee node type of the device (Co-ordinator, Router or End Device) and has a number of communication roles. The ZDO communicates via endpoint 0. For more information, refer to Section ZDO Management plane: This plane spans the NWK and APS layers, and allows the ZigBee Device Objects (ZDO) to communicate with these layers when performing its internal tasks. It also allows the ZDO to deal with requests from applications for network access and security functions using ZigBee Device Profile messages. Network (NWK) Layer The NWK layer handles network addressing and routing by invoking actions in the MAC layer. It provides services for: Starting the network Assigning network addresses Adding devices to and removing them from the network Routing messages to their intended destinations Applying security to outgoing messages Implementing route discovery and storing Routing table information 52 NXP Laboratories UK 2017 JN-UG-3101 v1.5

53 ZigBee PRO Stack The NWK layer has an associated database, called the NWK Information Base (NIB). This contains attributes required in the management of the NWK layer. Physical/Data Link Layers This consists of the IEEE PHY and MAC layers, described in Section 2.1. Note: The Security Service Provider spans the APS and NWK layers, providing security services - for example, security key management, datastream encryption and decryption. It may use hardware functions provided in the node to perform the encode and decode operations efficiently. JN-UG-3101 v1.5 NXP Laboratories UK

54 Chapter 2 ZigBee PRO Architecture and Operation 54 NXP Laboratories UK 2017 JN-UG-3101 v1.5

55 ZigBee PRO Stack 3. ZigBee PRO Stack Software This chapter introduces the NXP ZigBee PRO stack software and the associated operating system, JenOS, for the JN516x microcontroller. 3.1 Software Overview The NXP ZigBee PRO software provides all components of the ZigBee PRO stack detailed in Section 2.7. In addition, it includes the Jennic Operating System, JenOS. The basic architecture of this software, in relation to the wireless network application, is illustrated in the figure below. Application JenOS RTOS PDM PWRM PDUM ZigBee PRO Stack (see Figure 11 for details) Integrated Peripherals API DBG Figure 10: Overview of NXP ZigBee PRO Software Architecture The NXP ZigBee PRO software includes Application Programming Interfaces (APIs) to facilitate simplified application development for wireless networks. These APIs comprise C functions that can be incorporated directly in application code. Two general categories of API are supplied: ZigBee PRO APIs - see Section JenOS APIs - see Section In addition, the above figure shows the Integrated Peripherals API that can be used to interact with the on-chip hardware peripherals of the JN516x device. This API is described in the JN516x Integrated Peripherals API (JN-UG-3087). All the above APIs are supplied in the JN516x Software Developer s Kits (SDKs) for ZigBee application profiles. For more details on the SDKs, refer to Section 4.1. JN-UG-3101 v1.5 NXP Laboratories UK

56 Chapter 3 ZigBee PRO Stack Software ZigBee PRO APIs The ZigBee PRO APIs are concerned with network-specific operations and easy interaction with the ZigBee PRO stack from the application code. These C-function APIs are supplied in the JN516x SDK Libraries for ZigBee application profiles (see Section 4.1). There are three ZigBee PRO APIs: ZigBee Device Objects (ZDO) API: Concerned with the management of the local device (e.g. introducing the device into a network) ZigBee Device Profile (ZDP) API: Concerned with the management of remote devices (e.g. device discovery, service discovery, binding) Application Framework (AF) API: Concerned with creating data frames for transmission and modifying device descriptors The locations of these APIs within the Application layer of the stack are illustrated in the figure below. Application layer Application Framework (AF) JenOS APIs Application object ZDO API ZigBee Device Objects (ZDO) JenOS ZDP API AF API Application Support sub-layer (APS) ZDO Management plane Figure 11: Locations of ZigBee PRO APIs Note: The C functions of all the ZigBee PRO APIs are fully detailed in Part II: Reference Information of this manual. 56 NXP Laboratories UK 2017 JN-UG-3101 v1.5

57 ZigBee PRO Stack JenOS APIs The JenOS operating system provides an easy-to-use interface to simplify the programming of a range of non-network-specific operations. JenOS is divided into a number of modules, each comprising a C function API. In addition, a configuration editor is provided which allows you to easily configure the use of OS resources in your application - this tool is known as the JenOS Configuration Editor and is a plug-in for the BeyondStudio for NXP IDE (Integrated Development Environment). JenOS interacts with the: user application, through use of the supplied APIs in the application code ZigBee PRO stack JN516x integrated peripherals JenOS is supplied in the JN516x SDKs for ZigBee application profiles. The JenOS Configuration Editor plug-in is also provided in the SDKs. For more details of the SDKs, refer to Section 4.1. The JenOS modules are outlined below: Real-time Operating System (RTOS): This module provides a mechanism for reacting to real-time events in a way that optimises the efficiency and reliability of the system. Persistent Data Manager (PDM): This module handles the storage of context and application data in Non-Volatile Memory (NVM), and the retrieval of this data. It provides a mechanism by which the JN516x device can resume operation without loss of continuity following a power loss. Power Manager (PWRM): This module manages the transitions of the JN516x device into and out of low-power modes, such as sleep mode. Protocol Data Unit Manager (PDUM): This module is concerned with managing memory, as well as inserting data into messages to be transmitted and extracting data from messages that have been received. Debug module (DBG): This module allows diagnostic messages to be output when the application runs, as an aid to debugging the application code. Note: The JenOS modules are fully described in the JenOS (JN-UG-3075), which you should refer to in conjunction with this while developing your ZigBee PRO application code. JN-UG-3101 v1.5 NXP Laboratories UK

58 Chapter 3 ZigBee PRO Stack Software 3.2 Summary of API Functionality This section summarises the roles of the NXP ZigBee PRO and JenOS APIs in an application. The table below indicates the APIs needed for the different functionality that your may require in your code: Functionality ZigBee PRO APIs JenOS APIs Essential functionality, including network formation and management ZDO API: Network formation and local network management ZDP API: Network discovery and remote network management RTOS API: Managing tasks and ISRs (Interrupt Service Routines) Basic data transfer Binding endpoints for data transfers between them Low-power modes (Sleep and Doze) Preserving context data (e.g. for resuming operation after sleep without memory held) Diagnostic messages for debugging AF API: Sending and receiving data messages ZDO API: Basic binding ZDP API: Manipulation of remote Binding tables PDUM API: Assembling and disassembling data messages PWRM API: Managing lowpower modes PDM API: Saving and restoring context data DBG API: Producing output for tracking code execution Table 2: Use of ZigBee PRO and JenOS APIs Note that: ZigBee PRO API function names are prefixed with ZPS (for ZigBee PRO Stack function). The function names also incorporate Apl (for Application function) and the acronym for the API to which the function belongs: ZDO function names include Zdo (e.g. ZPS_eAplZdoPoll()) ZDP function names include Zdp (e.g. eaplzdpactiveeprequest()) AF function names include Af (e.g. ZPS_eAplAfUnicastDataReq()) JenOS API function names are prefixed with the acronym for the JenOS module to which the function belongs: OS for RTOS functions PDM for PDM functions PWRM for PWRM functions PDUM for PDUM functions DBG for DBG functions A similar naming convention is used in structures and enumerations. 58 NXP Laboratories UK 2017 JN-UG-3101 v1.5

59 ZigBee PRO Stack 4. Application Development Overview This chapter provides an overview of the main phases in developing a ZigBee PRO wireless network product. It is important that you refer to this chapter, particularly Section 4.3, before and during your product development. You will need to develop an application program for each node type in your product - Co-ordinator, Router and End Device. If a node type has variants, you may need to develop a separate application for each variant - for example, an End Device which is an infra-red sensor and an End Device which is a vibration sensor in a security system. 4.1 Development Environment This supports the NXP ZigBee PRO Software Developer s Kits (SDKs) that are designed to be used with the BeyondStudio for NXP development platform (JN-SW-4141). These SDKs have part numbers of the form JN-SW-416x and each SDK supports one or more ZigBee application profiles (ZLL, HA, SE). Note that not all profiles are currently supported for use with BeyondStudio for NXP. The BeyondStudio for NXP toolchain provides the software tools needed to develop applications for the JN516x devices, including: Eclipse-based IDE (Integrated Development Environment) JN51xx compiler JN51xx Flash programmer This toolchain is fully detailed in the BeyondStudio for NXP Installation and User Guide (JN-UG-3098). The SDK is installed on top of the above toolchain, and provides the stack and API software needed to develop ZigBee PRO applications with the required application profile (ZLL, HA or SE) for the JN516x devices. It includes: ZigBee PRO and IEEE stack software ZigBee PRO APIs JenOS APIs ZLL, HA or SE application profile software and APIs ZPS and JenOS Configuration Editors (plug-ins for BeyondStudio) Integrated Peripherals API and Board API SDK installation instructions are provided in the BeyondStudio for NXP Installation and (JN-UG-3098). Note: The SDK and toolchain for a particular ZigBee application profile can be obtained via the profile s page on the NXP web site. The profile pages can be accessed from JN-UG-3101 v1.5 NXP Laboratories UK

60 Chapter 4 Application Development Overview NXP-specific tools have been devised for BeyondStudio/Eclipse, including configuration editors (see below), a compiler and a linker. Network and OS configuration editors are provided in the SDKs as Eclipse plug-ins: ZPS Configuration Editor: This is used to set network parameters. JenOS Configuration Editor: This is used to configure JenOS resources. The above configuration editors are introduced in Chapter Development Resources While developing your ZigBee PRO application, you should consult this along with the JenOS (JN-UG-3075) and, if required, the JN516x Integrated Peripherals API (JN-UG-3087). Additional documentation is available for developing JN516x ZigBee PRO applications with the ZigBee application profiles - for example, refer to the ZigBee Home Automation (JN-UG-3076) or ZigBee Light Link (JN-UG-3091). Further assistance in developing ZigBee PRO applications for the JN516x devices is provided in NXP Application Notes. The resources relevant to a particular ZigBee application profile can be obtained via the profile s page on the NXP web site, accessible from Development Phases The main phases of development of a ZigBee PRO application are as follows: 1. Network Configuration: Configure the network parameters for the nodes using the ZPS Configuration Editor - refer to Chapter 10, Chapter 11 and Chapter OS Configuration: Configure the JenOS resources to be used by your application using the JenOS Configuration Editor - refer to the JenOS User Guide (JN-UG-3075). Note: Before you attempt to configure JenOS resources, you should familiarise yourself with the JenOS modules by studying the JenOS. 3. Application Code Development: Develop the application code for your nodes using the ZigBee PRO APIs and JenOS APIs - refer to Chapter 5 and the JenOS (JN-UG-3075). You may also use APIs and resources from one of the ZigBee application profiles (e.g. ZLL). 4. Application Build: Build the application binaries for your nodes using the NXP JN51xx compiler and linker built into BeyondStudio for NXP. 5. Node Programming: Load the application binaries into Flash memory on your nodes using the JN51xx Flash Programmer in BeyondStudio for NXP. 60 NXP Laboratories UK 2017 JN-UG-3101 v1.5

61 5. Application Coding with ZigBee PRO APIs ZigBee PRO Stack This chapter outlines how to use functions of the NXP ZigBee PRO APIs to perform common operations required in a ZigBee PRO wireless network application. References are also made to certain JenOS API functions, but the JenOS APIs are fully described in the JenOS (JN-UG-3075). The topics covered in this chapter are: Forming a ZigBee PRO wireless network (Section 5.1) Discovering the properties of the formed network (Section 5.2) Managing group addresses (Section 5.3) Binding nodes for easy communication between them (Section 5.4) Transferring data between nodes (Section 5.5) Leaving and rejoining the network (Section 5.6) Function return codes and extended error handling (Section 5.7) Implementing ZigBee security (Section 5.8) The main stages of the life-cycle of a wireless network are illustrated in Figure 12. These stages incorporate many of the high-level operations described in this chapter. Many of the functions referenced in this chapter are non-blocking functions that submit a request to the relevant node(s) of the network and then return - these functions have Request or Req in their names. The recipient of the request will normally reply by sending a response to the node that initiated the request. Once received, this response message can be collected using the JenOS RTOS function OS_eCollectMessage(). The ZigBee PRO API functions mentioned in this chapter are fully detailed in Part II: Reference Information of this manual. Tip: Further assistance in developing your own JN516x ZigBee PRO applications with the HA or ZLL profile is provided in a range of NXP Application Notes, available from the profile s page on the NXP web site. The profile pages can be accessed from JN-UG-3101 v1.5 NXP Laboratories UK

62 Chapter 5 Application Coding with ZigBee PRO APIs Co-ordinator Start stack and initialise network Other Node Start stack Search for and join network Discover other nodes (node addresses and properties) Network This is the wireless network created by the Co-ordinator. Initially, it consists only of the Co-ordinator, which other nodes can then join. As Router nodes join, the network can expand since new nodes may join the Routers instead of the Co-ordinator. Bind with other nodes (if required) Send and receive data Leave network Figure 12: Wireless Network Life-Cycle 62 NXP Laboratories UK 2017 JN-UG-3101 v1.5

63 ZigBee PRO Stack 5.1 Forming a Network This section describes how to form a wireless network by first starting the Co-ordinator and then starting the other nodes (which join the network initiated by the Co-ordinator). Important: In order to start any network node, certain configuration values must have been pre-set for the application. This configuration is performed using the ZPS Configuration Editor, introduced in Chapter 11 and detailed in Chapter 12. At initialisation, the same function calls are needed for all node types (although, once started, the stack will perform initialisation tasks according to the specific node type, as described in Section and Section 5.1.2). These function calls are listed below, in the required order: 1. OS_vStart() must first be called to start the JenOS RTOS. 2. PDUM_vInit() must be called to initialise the JenOS PDU Manager. 3. PWRM_vInit() to initialise the JenOS Power Manager in order to facilitiate low-power modes such as sleep and doze. 4. PDM_vInit() to initialise the JenOS Persistent Data Manager in order to save context and application data for retrieval after a power break. 5. ZPS_eAplAfInit() must be called to initialise the Application Framework. 6. ZPS_eAplZdoStartStack() must be called to start the ZigBee PRO stack. Note 1: If you wish to use the JenOS Debug module, you must call DBG_vInit() before calling any of the above functions. Note 2: If you wish to use the Integrated Peripherals API to interface with JN516x on-chip peripherals, be aware that this API is initialised automatically by JenOS and you must not call the library initialisation function, u32ahi_init(), explicitly in your application code. JN-UG-3101 v1.5 NXP Laboratories UK

64 Chapter 5 Application Coding with ZigBee PRO APIs Starting the Co-ordinator The Co-ordinator must be the first node to be started. This node is pre-configured using the ZPS Configuration Editor. The functions that must be called in the Coordinator application to initialise the node are those listed at the start of this section (Section 5.1). Once the stack has been started using ZPS_eAplZdoStartStack(), the Co-ordinator works through the following process to establish a network: 1. Sets the radio channel for the network The choice of 2.4-GHz band channel for the network is pre-configured via the the ZPS Configuration Editor (see Section ) as either a fixed channel (in the range 11-26) or a set of channels from which the best channel will be selected by the Co-ordinator. In the latter case, the Co-ordinator performs an energy scan of the possible channels and chooses the quietest channel. 2. Sets the Extended PAN ID for the network The 64-bit Extended PAN ID (EPID) for the network is obtained as follows: A pre-configured value may be set in the advanced device parameter APS Use Extended PAN ID in the ZPS Configuration Editor (see Section ). If the pre-set value is zero, the Co-ordinator will use its own IEEE/MAC address as the EPID. Note that the application may over-ride the EPID value set by the ZPS Configuration Editor by calling ZPS_eAplAibSetApsUseExtendedPanId() before calling ZPS_eAplZdoStartStack(). 3. Accepts join requests from other devices (if enabled) The Co-ordinator may now allow other devices (Routers and End Devices) to join the network as its children, enabling the network to grow. A maximum number of (direct) children of the Co-ordinator is pre-set via the advanced network parameter Active Neighbour Table Size in the ZPS Configuration Editor (see Section ), beyond which the Co-ordinator will not accept any further join requests from prospective children. Note: The initial permit joining status is pre-set via the Co-ordinator parameter Permit Joining Time in the ZPS Configuration Editor. If this is initially disabled, the Coordinator may not accept children until joining has been enabled using ZPS_eAplZdoPermitJoining(). However, the permit joining status is ignored during a join in which the pre-set EPID on the joining device is non-zero and during any rejoin (see Section 5.6.2). The above function can be used at any time to allow joinings for a limited time-period or indefinitely, and can also be used to disable joinings. 64 NXP Laboratories UK 2017 JN-UG-3101 v1.5

65 ZigBee PRO Stack Once the Co-ordinator (and therefore network) has started, the stack event ZPS_EVENT_NWK_STARTED is generated on the device. If the Co-ordinator fails to start, the stack event ZPS_EVENT_NWK_FAILED_TO_START is generated. When a node joins the Co-ordinator, the stack event ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED is generated on the Co-ordinator Starting Routers and End Devices A Router or End Device is pre-configured using the ZPS Configuration Editor. The functions that must be called in a Router or End Device application to initialise the node are those listed at the start of this section (Section 5.1). Note: The start-up and join process described in this section is for a first-time join (cold start) only and not for a rejoin (which is described in Section 5.6.2). Once the stack has been started using ZPS_eAplZdoStartStack(), a Router or End Device works through the following process to join a network: 1. Searches for a network to join As part of the ZPS_eAplZdoStartStack() function call, the device searches for networks by listening for beacons from Routers and Co-ordinators of ZigBee PRO networks in the neighbourhood. The radio channel for this search is preconfigured via the ZPS Configuration Editor (see Section ) in the same way as for the Co-ordinator as either a fixed channel (in the range 11-26) or a set of channels to scan. Thus, the device listens for beacons in the relevant channel(s). A beacon filter can be optionally introduced using the function ZPS_bAppAddBeaconFilter() to allow only beacons from networks of interest to be considered - beacons can be filtered on the basis of Extended PAN ID, LQI value, and device joining status/capacity (see Appendix B.4). On completion of this search, the subsequent actions depend on the pre-set value of the 64-bit Extended PAN ID (EPID), which is set via the advanced device parameter APS Use Extended PAN ID in the ZPS Configuration Editor (see Section ): If the pre-set EPID value is non-zero, this value identifies a specific network to join (assuming the Co-ordinator has been pre-set with the same EPID - see Section 5.1.1). Provided that a network with this EPID has been discovered in the search, the device attempts to join this network as described in Step 3 below (therefore bypassing Step 2). If the pre-set EPID value is zero, the results of the search are reported in a ZPS_EVENT_NWK_DISCOVERY_COMPLETE stack event, which contains details of the networks discovered (see Section 5.2.1). The device must then select a network to join, as described in Step 2 below. 2. Selects a network to join On the basis of the results in ZPS_EVENT_NWK_DISCOVERY_COMPLETE, the application must select a network which the device will attempt to join. The search results contain a recommended network, selected as the first ZigBee JN-UG-3101 v1.5 NXP Laboratories UK

66 Chapter 5 Application Coding with ZigBee PRO APIs PRO network detected that is allowing nodes to join. The application is, however, free to choose another network, where this choice may be based on LQI value (detected signal strength). 3. Submits a join request to network Once the device has identified a network to join, a request to join the network must be submitted. If a non-zero pre-configured EPID has been set (see above), this join request is submitted automatically, otherwise the function ZPS_eAplZdoJoinNetwork() must be called to submit the request. The outcome of this request is reported in one of the following stack events on the requesting device: ZPS_EVENT_NWK_JOINED_AS_ROUTER (if joined as Router) ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE (if joined as End Device) ZPS_EVENT_NWK_FAILED_TO_JOIN (if failed to join) In the case of success, the above stack event contains the 16-bit network address that the network has allocated to the local device. In addition, the event ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED is generated on the parent. If the case of failure, the device can attempt another join by calling ZPS_eAplZdoJoinNetwork() with a different result reported in the ZPS_EVENT_NWK_DISCOVERY_COMPLETE event. 4. Records the network's EPID for application use The function ZPS_eAplAibSetApsUseExtendedPanId() may now be used to create a persistent record of the EPID of the network that the node has joined (it will first be necessary to obtain the EPID value using the functions ZPS_pvAplZdoGetNwkHandle() and ZPS_u64NwkGetEpid()). If this EPID record is created, the node will automatically continue in the network following a reset without explicitly rejoining. 5. Router accepts join requests from other devices (if enabled) A Router may now allow other devices (Routers and End Devices) to join it as its children. The number of (direct) children of the Router will be limited by the maximum number of neighbours for the node, which is pre-set via the advanced network parameter Active Neighbour Table Size in the ZPS Configuration Editor (see Section ). Note: The initial permit joining status is pre-set via the Router parameter Permit Joining Time in the ZPS Configuration Editor. If this is initially disabled, the Router may not accept children until joining has been enabled using ZPS_eAplZdoPermitJoining(). However, the permit joining status is ignored during a join in which the pre-set EPID on the joining device is non-zero and during any rejoin (see Section 5.6.2). The above function can be used at any time to allow joinings for a limited time-period or indefinitely, and can also be used to disable joinings. 66 NXP Laboratories UK 2017 JN-UG-3101 v1.5

67 ZigBee PRO Stack Once a node has joined the network, each endpoint application on the node is next likely to search for compatible endpoints on remote nodes with which it can communicate, as described in Section Note: A network can be set up such that an End Device or Router joins a particular parent node. The required configuration and function calls to employ predetermined parents are described in Section Pre-determined Parents It is possible to force a parent (Router or the Co-ordinator) to accept certain nodes as its (direct) children. The function ZPS_eAplZdoDirectJoinNetwork() can be used on this parent to register a potential child node (with specified IEEE/MAC and network addresses) by adding this node to the Neighbour table - never write to the Neighbour table directly. The parent then regards this node as an orphaned child. This function should only be called when the parent node is fully up and running - that is, the node has been started as described in Section or Section When one of the designated children is started, its application should call the function ZPS_eAplZdoOrphanRejoinNetwork() in order to attempt to join the network as if it were a previously orphaned node. This function will start the ZigBee PRO stack and attempt to join the network whose EPID has been pre-configured on the node (using the ZPS Configuration Editor). The function will only allow the node to join a parent that already has knowledge of the node (in the parent s Neighbour table). Note 1: When ZPS_eAplZdoOrphanRejoinNetwork() is used, the start-up procedure described in Section is not applicable to the joining node and the function ZPS_eAplZdoStartStack() must not be explicitly called on the node. Note 2: When a node joins the network in this way, the permit joining status on the parent is ignored. If the node successfully joins the network (via the designated parent), the stack event ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED is generated on the parent node and one of the following stack events is generated on the joined node: ZPS_EVENT_NWK_JOINED_AS_ROUTER (if joined as a Router) ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE (if joined as an End Device) These events contain the network address that the parent has allocated to the joined node. If the join request is unsuccessful, the ZPS_EVENT_NWK_FAILED_TO_JOIN event is generated on the joining node. JN-UG-3101 v1.5 NXP Laboratories UK

68 Chapter 5 Application Coding with ZigBee PRO APIs Once the node has joined the pre-determined parent, the node is next likely to search for compatible endpoints on remote nodes with which it can communicate, as described in Section Discovering the Network This section describes how to discover properties of the network, including general network properties, node addresses and features, and the services offered by nodes. The important task of finding nodes that can communicate with each other is described. Maintenance of the primary discovery cache of a node is also described - this cache contains information about other nodes of the network (not all nodes will host a primary discovery cache - only the Co-ordinator and Routers are allowed to) Obtaining Network Properties A network discovery is implemented when the function ZPS_eAplZdoStartStack() is called to start the stack on an End Device or Router node (which needs to find a network to join). In addition, a network discovery can be explicitly started by calling the function ZPS_eAplZdoDiscoverNetworks(). For example, this function could be called if the initial network discovery did not find any suitable networks to join, in which case the function may be used to initiate a scan of previously unscanned channels (detailed in the stack event described below, resulting from the initial discovery). Both of these function calls eventually result in the stack event ZPS_EVENT_NWK_DISCOVERY_COMPLETE on the End Device or Router, where this event reports the following properties of the discovered networks: Extended PAN ID ZigBee version ZigBee stack profile This stack event also indicates the recommended network to join, which is taken to be the first ZigBee PRO network detected that is allowing nodes to join. For information on joining a network, refer to Section Finding Compatible Endpoints An endpoint on a newly joined node must find compatible endpoints on remote nodes with which to communicate. The decision of whether a remote endpoint is compatible is based on the endpoint properties stored in its Simple descriptor, notably the application profile and the input/output clusters supported. The endpoint application can discover compatible nodes by sending out a Match_Desc_req request identifying the required application profile and clusters. This request is submitted by calling the function ZPS_eAplZdpMatchDescRequest(), which allows the request to be sent as a broadcast to all nodes or as a unicast to a particular node (the sending node may already have a record of the network nodes and their addresses, as each node automatically announces itself in a broadcast when 68 NXP Laboratories UK 2017 JN-UG-3101 v1.5

69 ZigBee PRO Stack it joins the network). The request is sent in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). A receiving endpoint which satisfies the supplied criteria replies to the request with a Match_Desc_rsp response which, when received, must be collected on the requesting node using the RTOS function OS_eCollectMessage(). The requesting application may bind to a compatible endpoint (see Section 5.4) and communicate with the endpoint using binding or addressing (see Section 5.5) Obtaining and Maintaining Node Addresses The addresses of network nodes are needed in order to access node information (see Section 5.2.4), send data from one node to another (see Section 5.5) and bind nodes together (see Section 5.4). In most of these operations, an application can specify either 64-bit IEEE/MAC addresses or 16-bit network addresses, but the ZigBee PRO stack always works with network addresses. If the IEEE address (rather than the network address) of a remote node is specified by the application, the network address must still be available to the stack in an Address Map - see below. The IEEE address of a node is assigned at the time of device manufacture and is fixed, while its network address is dynamically allocated by its parent when the device joins the network (this address may change if the network is re-started or the device later leaves and rejoins the network). Functions are provided to obtain the IEEE address of a node given its network address or to obtain the network address given the IEEE address. Use of these functions is described in Section and Section Note: The IEEE/MAC and network addresses of a node can be broadcast to all other nodes in the network using the function ZPS_eAplZdpDeviceAnnceRequest(). For example, this function would typically be called when the node joins or rejoins the network. The information is sent in a Device_annce announcement, which must be collected by the recipient nodes using the RTOS function OS_eCollectMessage(). An Address Map table can be maintained on a node, where each entry of this table contains the pair of addresses for a remote node - the 64-bit IEEE/MAC address and 16-bit network address. In fact, the IEEE/MAC address is not directly stored in the Address Map table but in a MAC Address table - the Address Map table contains the index of this address in the MAC Address table. The Address Map is automatically updated by the stack when a Device_annce announcement is received from a remote node (described in the Note above), but you can also add an address-pair to this table using the function ZPS_eAplZdoAddAddrMapEntry() - never write to the Address Map table directly. The Address Map must be properly maintained if the application employs IEEE/MAC addresses to identify remote nodes. In addition, when applicationlevel security (see Section 5.8) is used in sending data from one node to another, the Address Map on the sending node must contain an entry for the target node. JN-UG-3101 v1.5 NXP Laboratories UK

70 Chapter 5 Application Coding with ZigBee PRO APIs Obtaining IEEE Address You may wish to obtain the IEEE address of the node with a given network address - for example, in order to know which physical node corresponds to a particular dynamically allocated network address. The IEEE address of the local node can be obtained simply by calling the function ZPS_u64AplZdoGetIeeeAddr(). The IEEE address of a remote node can be obtained in either of two ways, depending on whether an entry for the node exists in the local Address Map table: The function ZPS_u64AplZdoLookupIeeeAddr() can be used to search the local Address Map table for the IEEE address which corresponds to a given network address. The required IEEE address can be obtained directly from the remote node by using the function ZPS_eAplZdpIeeeAddrRequest() to submit a request for the IEEE address of the node with a particular network address. This request, of type IEEE_addr_req, is sent in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). The request details are specified through the structure ZPS_tsAplZdpIeeeAddrReq, which includes an option to also request the IEEE addresses of all the target node s children (if any). The results are reported in an IEEE_addr_resp response Obtaining Network Address You may wish to obtain the network address of the node with a given IEEE address - for example, in order to know the network address that has been dynamically allocated to a particular physical node. The network address of the local node can be obtained simply by calling the function ZPS_u16AplZdoGetNwkAddr(). The network address of a remote node can be obtained in either of two ways, depending on whether an entry for the node exists in the local Address Map table: ZPS_u16AplZdoLookupAddr() can be used to search the local Address Map table for the network address which corresponds to a given IEEE address. The required network address can be obtained directly from within the network by using the function ZPS_eAplZdpNwkAddrRequest() to submit a request for the network address of the node with a particular IEEE address. This request can be either unicast or broadcast, as follows: Unicast to another node that will know the required network address (this may be the parent of the node of interest or the Co-ordinator) Broadcast to the network This request, of type NWK_addr_req, is sent in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). The request details are specified through the structure ZPS_tsAplZdpNwkAddrReq, which includes an option to also request the network addresses of all the target node s children (if any). The results are reported in a NWK_addr_resp response. 70 NXP Laboratories UK 2017 JN-UG-3101 v1.5

71 ZigBee PRO Stack Obtaining Node Properties Functions are provided to obtain information about the properties of network nodes. Much of this information is held on a node in special structures, referred to as descriptors. Five types of descriptor are used: Node descriptor Node Power descriptor Simple descriptor User descriptor Complex descriptor In addition to the above, information can be obtained about the active endpoints, primary discovery cache and services of a node. The required functions are detailed below. Functions are provided to obtain descriptors from the local node and from a remote node. When obtaining information from a remote node, the function sends a request in an APDU (Application Protocol Data Unit) which must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). The results of the request are reported in a response which must be collected using the RTOS function OS_eCollectMessage(). Note 1: When obtaining a descriptor of a remote node, the request can be submitted to the node itself or to another node which may hold the required descriptor in its primary discovery cache. Note 2: The structures that contain the descriptors (referenced below) are described in Section 7.2 and Section Note 3: Where 64-bit IEEE/MAC addresses are used to identify remote nodes, the corresponding 16-bit network addresses must be available in the local Address Map - see Section Node Descriptor The Node descriptor contains basic information about the node, such as its ZigBee node type and the radio frequency bands supported. The following functions can be used to obtain a Node descriptor: ZPS_eAplAfGetNodeDescriptor() obtains the Node descriptor of the local node. The result is stored in a structure of type ZPS_tsAplAfNodeDescriptor. ZPS_eAplZdpNodeDescRequest() requests the Node descriptor of a remote node. The result is stored in a structure of type ZPS_tsAplZdpNodeDescriptor. JN-UG-3101 v1.5 NXP Laboratories UK

72 Chapter 5 Application Coding with ZigBee PRO APIs Power Descriptor The Node Power descriptor contains information about the node s supported power sources and present power source. The following functions can be used to obtain a Power descriptor: ZPS_eAplAfGetNodePowerDescriptor() obtains the Node Power descriptor of the local node. The result is stored in a structure of type ZPS_tsAplAfNodePowerDescriptor. ZPS_eAplZdpPowerDescRequest() requests the Node Power descriptor of a remote node. The result is stored in a structure of type ZPS_tsAplZdpNodePowerDescriptor. Note that elements of the Node Power descriptor can be set on the local node using the ZPS Configuration Editor. Simple Descriptor There is a Simple descriptor for each endpoint on a node. The information in this descriptor includes the ZigBee application profile supported by the endpoint as well as details of its input and output clusters. The following functions can be used to obtain a Simple descriptor: ZPS_eAplAfGetSimpleDescriptor() obtains the Simple descriptor of a particular endpoint on the local node. The result is stored in a structure of type ZPS_tsAplAfSimpleDescriptor. ZPS_eAplZdpSimpleDescRequest() requests the Simple descriptor of a particular endpoint on a remote node. The result is stored in a structure of type ZPS_tsAplZdpSimpleDescReq. The returned Simple descriptor includes a list of input clusters and a list of output clusters of the endpoint. When requesting a Simple descriptor from a remote node, if the cluster lists are long, the Simple descriptor may not fit into the APDU of the response. In this case, the returned Simple descriptor will contain incomplete cluster lists, but the remainder of the lists can be recovered using ZPS_eAplZdpExtendedSimpleDescRequest(). It is also possible to search for nodes on the basis of certain criteria in the Simple descriptors of their endpoints - for example, search for endpoints which support a particular ZigBee application profile, or which have a particular list of input clusters and/or output clusters. Such a search can be performed using the function ZPS_eAplZdpMatchDescRequest(). Use of this function is described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

73 ZigBee PRO Stack User Descriptor The User descriptor is a user-defined character string, normally used to describe the node (e.g. Thermostat ). The maximum length of the character string is 16, by default. A node need not have a User descriptor - if it has one, this must be indicated in the Node descriptor. The following functions can be used to access a User descriptor: ZPS_eAplZdpUserDescSetRequest() sets the User descriptor of a remote node. ZPS_eAplZdpUserDescRequest() requests the User descriptor of a remote node. The result is stored in a structure of type ZPS_tsAplZdpUserDescReq. The above functions can only be used to access the User descriptor of a non-nxp device (which supports this descriptor), since the storage of a User descriptor on an NXP JN516x device is not supported. Complex Descriptor The Complex descriptor is an optional descriptor which contains device information such as manufacturer, model and serial number. The function ZPS_eAplZdpComplexDescRequest() allows the Complex descriptor of a remote node to be requested. However, the NXP ZigBee PRO stack does not support the functionality to produce a valid response and this function is provided only for compatibility with non-nxp products that do support the relevant functionality. Active Endpoints An endpoint on the local node can be configured as enabled or disabled using the function ZPS_eAplAfSetEndpointState(). An enabled endpoint is described as active. The current state of a local endpoint can be obtained using the function ZPS_eAplAfGetEndpointState(). It is also possible to configure whether a local endpoint will be included in the results of network discovery operations, e.g. when ZPS_eAplZdpMatchDescRequest() is called. The discoverable state of a local endpoint can be set using the function ZPS_eAplAfSetEndpointDiscovery(), while this state can be obtained using the function ZPS_eAplAfGetEndpointDiscovery(). A list of the active endpoints on a remote can be obtain using the function ZPS_eAplZdpActiveEpRequest(). This functions submits an Active_EP_req request to the target node, which replies with an Active_EP_rsp response. If the active endpoint list is too long to fit into the APDU of the response, the returned list will be incomplete. However, the remainder of the list can be recovered using the function ZPS_eAplZdpExtendedActiveEpRequest(). Note that an endpoint is included in the list only if it is active and discoverable. JN-UG-3101 v1.5 NXP Laboratories UK

74 Chapter 5 Application Coding with ZigBee PRO APIs Primary Discovery Cache A ZigBee routing node (Router or the Co-ordinator) may be able to host a primary discovery cache. This is a database, held in memory, containing discovery information about a set of network nodes, normally children and possibly other descendant nodes. The information held about a node includes the node s addresses, descriptors (Node, Node Power, Simple) and its list of active endpoints. Remote nodes can then interrogate the primary discovery cache to obtain information about other nodes in the network. Note: NXP nodes do not have the capability to hold a primary discovery cache, but functions are provided to interface with a primary discovery cache held on a node from another manufacturer. The function ZPS_eAplZdpDiscoveryCacheRequest() allows nodes which hold a primary discovery cache to be detected. This function submits a Discovery_Cache_req request to the network. Nodes with a primary discovery cache reply with a Discovery_Cache_rsp response. In addition, the function ZPS_eAplZdpFindNodeCacheRequest() can be used to search for nodes with a primary discovery cache that holds information about a particular node. This function submits a Find_node_cache_req request to the network. Nodes with the required node information in their caches reply with a Find_node_cache_rsp response. Functions for storing node information in a primary discovery cache are described in Section Servers A node can host one or more of the following servers in a ZigBee PRO network: Primary Trust Centre Backup Trust Centre Primary Binding Table Cache Backup Binding Table Cache Primary Discovery Cache Backup Discovery Cache Network Manager The function ZPS_eAplZdpSystemServerDiscoveryRequest() can be used to discover the servers hosted by other nodes in the network. The function broadcasts a System_Server_Discovery_req request to all nodes. A remote node replies with a System_Server_Discovery_rsp response containing a bitmap indicating the servers hosted by the node. 74 NXP Laboratories UK 2017 JN-UG-3101 v1.5

75 ZigBee PRO Stack Maintaining a Primary Discovery Cache Some routing nodes of a ZigBee PRO network may be capable of hosting a primary discovery cache, which contains discovery information relating to other nodes in the network - see Primary Discovery Cache on page 74. Note: NXP nodes do not have the capability to hold a primary discovery cache, but functions are provided to interface with a primary discovery cache held on a node from another manufacturer. Functions are provided for storing the local node s discovery information in another node s primary discovery cache (normally in the parent or another ascendant node). First of all, ZPS_eAplZdpDiscoveryStoreRequest() must be called to allocate memory space for this information in the remote node s cache. This function sends a Discovery_store_req request to the remote node, which replies with a Discovery_store_rsp response. The local node s information can then be stored in the remote node s primary discovery cache using the following functions (which all operate on a request/response basis): Node descriptor: Stored using ZPS_eAplZdpNodeDescStoreRequest() Power descriptor: Stored using ZPS_eAplZdpPowerDescStoreRequest() Simple descriptor: Stored using ZPS_eAplZdpSimpleDescStoreRequest() Active endpoints list: Stored using ZPS_eAplZdpActiveEpStoreRequest() A node s information can be removed from a primary discovery cache using the function ZPS_eAplZdpRemoveNodeCacheRequest(). This function can be called on the local node to remove a third node s information from the primary discovery cache of a remote node Discovering Routes The route from one network node to another can be pre-established by implementing a route discovery. As a result, each routing node along the route will contain a Routing table entry for the destination node, where this entry consists of the destination address and the next hop address. Routing and route discovery are fully introduced in Section 2.5. Two functions are provided in the ZigBee PRO API to initiate route discoveries: ZPS_eAplZdoRouteRequest() can be used to establish a route from the local node to a specific destination node. This kind of end-to-end route discovery is outlined in Section ZPS_eAplZdoManyToOneRouteRequest() can be used on a concentrator node to implement a many-to-one route discovery back to itself. The result is that Routing tables in routing nodes within a certain radius of the concentrator will acquire entries with the concentrator as the destination. Many-to-one routing is outlined in Section JN-UG-3101 v1.5 NXP Laboratories UK

76 Chapter 5 Application Coding with ZigBee PRO APIs 5.3 Managing Group Addresses A group address is a concept that simplifies data transfers (see Section 5.5) to multiple nodes/endpoints. It is a collective 16-bit address which refers to a group of destination endpoints (that may be located on different nodes). So, for example, when a group address is specified as the destination address for a data transfer, the data will be delivered to all the nodes/endpoints in the associated group. It is the responsibility of the wireless network application to allocate and manage group addresses on a network-wide basis. A node which is to receive group-addressed communications must have a Group Address table. This table contains information about all the groups to which endpoints on the node belong - that is, each group address and the associated local endpoint numbers. The table is consulted on receiving a data packet with a group address - if the group address exists in the table, the packet is passed to the corresponding endpoint(s). A Group Address table is created on a node using the ZPS Configuration Editor. The table can then be maintained by the application as follows: An endpoint can be added to a group by calling the function ZPS_eAplZdoGroupEndpointAdd() on the local node (which contains the endpoint). An endpoint can be removed from a group by calling the function ZPS_eAplZdoGroupEndpointRemove() on the local node (which contains the endpoint). Alternatively, ZPS_eAplZdoGroupAllEndpointRemove() can be used to remove a specified local endpoint from all groups to which it belongs. The group addresses used in a network are defined by the application developer. 5.4 Binding For the purpose of data communication between applications running on different nodes, it may be useful to bind the relevant source and destination endpoints. When data is subsequently sent from the source endpoint, it is automatically routed to the bound destination endpoint(s) without the need to specify a destination address. For example, a binding could be created between the temperature sensor endpoint on a thermostat node and the switch endpoint on a heating controller node. Details of a binding are held in a Binding table on the source node. Binding is introduced more fully in Section 2.6.2, where bindings are one-to-one, one-to-many or many-to-one. This section describes setting up a Bind Request Server and how to bind together two nodes, as well as how to unbind them. Access to the Binding tables is also described. Note: Where 64-bit IEEE/MAC addresses are used to identify remote nodes, the corresponding 16-bit network addresses must be available in the local Address Map - see Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

77 ZigBee PRO Stack Setting Up Bind Request Server A Bind Request Server must be set up on each device that will be the source node of a bound data transfer. This server manages a bound data transfer so that application processing is not blocked by concurrent requests for transmissions to the multiple destinations of the transfer. It does this by limiting the number of destinations and inserting a time delay between consecutive transmissions of a bound transfer. The server is configured in the ZPS Configuration Editor (introduced in Chapter 12). Two parameter values must be set: Simultaneous Requests This refers to the maximum number of destinations for a bound data transfer. The value set must be less than or equal to the value of the ZigBee network parameter Maximum Number of Simultaneous Data Requests or Maximum Number of Simultaneous Data Requests with Acks, described in Section Time Interval This refers to the time interval between consecutive transmissions to the different destinations of a bound data transfer and is measured in milliseconds. In the ZPS Configuration Editor, these parameters are accessed by clicking on Bind Request Server under ZDO Configuration for the device (the parameters appear in the Properties tab of the bottom pane). Note: The bound server can only handle one bound request at a time. The application must wait for the confirmation from the first bound request before attempting to send a second bound request Binding Endpoints An endpoint on the local node can be bound to one or more endpoints on remote nodes using the following functions: ZPS_eAplZdoBind() creates a one-to-one binding to a single remote endpoint. ZPS_eAplZdoBindGroup() creates a one-to-many binding for which the destination endpoints are specified via a group address (refer to Section 5.3). The function ZPS_eAplZdpEndDeviceBindRequest() is also provided, which allows an endpoint on one End Device to be bound to an endpoint on another End Device via the Co-ordinator. This function must be called on both End Devices, where the function call would typically be triggered by a user action such as pressing a button on the node. The function submits an End_Device_Bind_req request to the Co-ordinator, which replies with an End_Device_Bind_rsp response. The stack will then automatically update the Binding tables on the End Devices (as the result of bind requests from the Co-ordinator), and these updates will be indicated by a ZPS_EVENT_ZDO_BIND event on each of the End Devices. JN-UG-3101 v1.5 NXP Laboratories UK

78 Chapter 5 Application Coding with ZigBee PRO APIs Unbinding Endpoints Bindings can be removed using the following functions: Two endpoints previously bound using ZPS_eAplZdoBind() can be unbound using the function ZPS_eAplZdoUnbind(). Endpoints previously bound using ZPS_eAplZdoBindGroup() can be unbound using the function ZPS_eAplZdoUnbindGroup() Accessing Binding Tables Information about established bindings is held in Binding tables on the relevant nodes. Normally, a Binding table is held on a node which contains at least one source endpoint for a binding - thus, the table includes entries for all bindings which involve source endpoints on the local node. Alternatively, the Binding table entries for a particular source node can be held in a primary Binding table cache on the node s parent or another ascendant node. However, if a primary Binding table cache exists on an ascendant node, a source node can opt out of membership of this table by calling the function ZPS_eAplZdpBindRegisterRequest() to indicate that the source node will store its own Binding table entries locally. Functions are provided which allow Binding tables to be remotely accessed and modified. These functions are particularly useful in implementing a commissioning tool application. A binding can be remotely created or removed by requesting a modification to the relevant Binding table on a remote node. The remote Binding table may be a primary Binding table cache or the source node s local Binding table, whichever is relevant for the particular binding. The function ZPS_eAplZdpBindUnbindRequest() can be used to request that a new binding is added to a remote Binding table. The addition of this binding is signalled by a ZPS_EVENT_ZDO_BIND event on the remote node. The function ZPS_eAplZdpBindUnbindRequest() can also be used to request that an existing binding is removed from a remote Binding table. The removal of this binding is signalled by a ZPS_EVENT_ZDO_UNBIND event on the remote node. In addition, binding entries in a remote primary Binding table cache can be modified using the function ZPS_eAplZdpReplaceDeviceRequest(), to replace an IEEE/MAC address and/or endpoint number. This operation works on a search and replace basis in the Binding table, and the address/endpoint number to be replaced could occur in the source or destination of one or more table entries. The function ZPS_eAplZdpMgmtBindRequest() is also provided, which can be used to request the Binding table of a remote node. 78 NXP Laboratories UK 2017 JN-UG-3101 v1.5

79 ZigBee PRO Stack 5.5 Transferring Data This section describes how to send data to a remote node and receive the data at the destination. The data polling method is also described, which is used by an End Device to obtain data that arrives at its parent while the End Device is asleep Sending Data Data is sent across the wireless network in an Application Protocol Data Unit (APDU). Before calling the function to send the data, an APDU instance must first be allocated using the JenOS PDUM function PDUM_hAPduAllocateAPduInstance() and then populated with data using the PDUM function PDUM_u16APduInstanceWriteNBO(). There are five ways to send data to one or more remote nodes: Unicast: Sending data to a single destination endpoint Broadcast: Sending data to (potentially) all endpoints Group Multicast: Sending data to a group of endpoints Bound Transfer: Sending data to bound endpoints Inter-PAN Transfer: Sending data to another ZigBee PRO network These methods are described in the sub-sections below. However, in all cases except the inter-pan transfer, a general function ZPS_eAplAfApsdeDataReq() can be used which imposes no restrictions on the destination address, destination application profile, destination cluster and destination endpoint number - these destination parameters do not need to be known to the stack or defined in the ZPS configuration. Note 1: In all cases, once the data packet has been successfully sent, a DATA_CONFIRM stack event is generated. When sending data to one or more individual nodes (not broadcasting), this event is generated after a MAC-level acknowledgement has been received from the next hop node. Note 2: Where 64-bit IEEE/MAC addresses are used to identify remote nodes, the corresponding 16-bit network addresses must be available in the local Address Map - see Section JN-UG-3101 v1.5 NXP Laboratories UK

80 Chapter 5 Application Coding with ZigBee PRO APIs Unicast A unicast is a data transmission to a single destination - in this case, a single endpoint. The destination node for a unicast can be specified using the network address or the IEEE/MAC address of the node: ZPS_eAplAfUnicastDataReq() is used to send a data packet to an endpoint on a node with a given network address. ZPS_eAplAfUnicastIeeeDataReq() is used to send a data packet to an endpoint on a node with a given IEEE/MAC address. Neither of these functions provide any indication that the data packet has been successfully delivered to its destination. It is possible that a unicast packet will not reach its destination because the packet is lost - for example, it becomes caught in a circular route. However, equivalent functions are available which request the destination node to provide an acknowledgement of data received - these with acknowledgement functions are ZPS_eAplAfUnicastAckDataReq() and ZPS_eAplAfUnicastIeeeAckDataReq(), requiring network and IEEE/MAC addresses respectively. These functions request end-to-end acknowledgements which, when received, generate ZPS_EVENT_APS_DATA_ACK events (note that the next hop ZPS_EVENT_APS_DATA_CONFIRM events will also be generated). A timeout of approximately 1600 ms is applied to the acknowledgements. If an acknowledgement has not been received within the timeout period, the data is re-sent, and up to 3 more re-tries can subsequently be performed before the data transfer is abandoned completely (which occurs approximately 3 seconds after the initial send). Note: If a message is unicast to a destination for which a route has not already been established, the message will not be sent and a route discovery will be performed instead. If this is the case, the unicast function will return ZPS_NWK_ENUM_ROUTE_ERROR. The application must then wait for the stack event ZPS_EVENT_NWK_ROUTE_DISCOVERY_CONFIRM (success or failure) before attempting to re-send the message by calling the same unicast function again. Unicasts from Sleepy Nodes To allow a unicast acknowledgement to be received as described above, the source node must remain awake for a time equal to the timeout period. On a battery-powered node which sleeps, the use of acknowledgements and retries may not be desirable from a power-saving point of view. In this case, acknowledgements should not be used, but it is good practice for the application to monitor the route to a remote node by periodically attempting to read an attribute on the node and wait for a response. If the response is not observed within a pre-defined time then the application should take one of the actions listed below, depending on whether the source node is an End Device or Router. 80 NXP Laboratories UK 2017 JN-UG-3101 v1.5

81 ZigBee PRO Stack If an End Device, the application should notify the parent node about the routing problem by sending it a unicast network status command using the function ZPS_vNwkSendNwkStatusCommand(), with the status as No Route Available (0x00) If a Router, the application should initiate an explicit route discovery to the destination node by calling the function ZPS_eAplZdoRouteRequest() Fragmenting Large Unicast Packets The unicast with acknowledgement functions, ZPS_eAplAfUnicastAckDataReq() and ZPS_eAplAfUnicastIeeeAckDataReq(), also allow a large data packet to be sent that may be fragmented into multiple messages during transmission. Application design issues concerned with fragmented data transfers are outlined in Appendix B Broadcast A broadcast is a data transmission to all network nodes, although it is possible to select a subset of nodes. The following destinations are possible: All nodes All nodes for which receiver on when idle - these include the Co-ordinator, Routers and non-sleeping End Devices All Routers and the Co-ordinator The function ZPS_eAplAfBroadcastDataReq() is used to broadcast a data packet. It is possible to specify a particular destination endpoint on the nodes (the same endpoint number for all recipient nodes) or all endpoints. Following this function call, the packet may be broadcast up to four times (in addition, the packet may be subsequently re-broadcast up to four times by each intermediate routing node) Group Multicast A group multicast is a data transmission which is intended for a selection of network nodes or, more specifically, a selection of endpoints on these nodes. The set of destination endpoints must be pre-assembled into a group with an associated group address, as described in Section 5.3. The function ZPS_eAplAfGroupDataReq() is used to send a data packet to the group of endpoints with a given group address. In practice, the data packet is broadcast to all nodes in the network and it is the responsibility of each recipient node to determine whether it has endpoints in the target group (and therefore whether the packet is of interest). JN-UG-3101 v1.5 NXP Laboratories UK

82 Chapter 5 Application Coding with ZigBee PRO APIs Bound Transfer A data packet can be sent from an endpoint to all the remote endpoints with which the source endpoint has been previously bound (see Section 5.4). The function ZPS_eAplAfBoundDataReq() is used to implement this type of data transfer. This method provides an alternative to a group multicast (see Section ) for sending data to selected endpoints. An equivalent to the above function is provided which also requests an end-to-end acknowledgement from the destination - ZPS_eAplAfBoundAckDataReq(). If an acknowledgement has not been received within approximately 1600 ms of the initial request, the data is re-sent, with up to 3 more subsequent re-tries before the data transfer is abandoned completely. ZPS_eAplAfBoundAckDataReq() also allows a large data packet to be sent that may need to be fragmented into multiple messages during transmission. Application design issues concerned with fragmented data transfers are outlined in Appendix B.1. Following a call to one of the above bound transfer functions, a deferred ZPS_EVENT_BIND_REQUEST_SERVER event is generated on the sending node. This event summarises the status of the transmission (see Section ), including the number of bound endpoints for which the transmission failed. The event is generated only after receiving MAC-level acknowledgements from the next hop nodes or, if requested, after receiving end-to-end acknowledgements from the destination nodes. Note: In the case of a bound transfer, the next hop ZPS_EVENT_APS_DATA_CONFIRM events and endto-end ZPS_EVENT_APS_DATA_ACK events are consumed and do not reach the application. 82 NXP Laboratories UK 2017 JN-UG-3101 v1.5

83 ZigBee PRO Stack Inter-PAN Transfer A data packet can be sent to nodes in other IEEE 15.4 networks - this is referred to as an inter-pan transfer or transmission. Typically, this mechanism could be used to send information to optional low-cost devices that are not part of the local network. Note that no security (encyption/decryption) can be applied to inter-pan transfers and only one application on a device can perform inter-pan transmissions. The inter-pan messages are not forwarded and so will only be received by nodes within direct radio range of the transmitter. The inter-pan feature is enabled via the ZPS Configuration Editor. The Inter PAN value is set to true in the APS Layer Configuration section of the Advanced Properties for the device. The function ZPS_eAplAfInterPanDataReq() is used to request an inter-pan transmission. This function requires the destination(s) for the transfer to specified: Single destination node in a specific network (PAN ID and node address must be specified) Multiple destination nodes in a specific network (PAN ID and a group address for the nodes must be specified) All nodes in a specific network (PAN ID and broadcast address of 0xFFFF must be specified) All nodes in all reachable networks (broadcast PAN ID and broadcast address, both of 0xFFFF, must be specified) After successfully sending the data packet, the stack will generate the event ZPS_EVENT_APS_INTERPAN_DATA_CONFIRM (for a single destination, this event is generated once the next hop acknowledgement has been received). A destination endpoint is not specified for this type of data transfer but an application profile and cluster must be specified for the destination. On receiving the data packet, the recipient node will automatically pass the packet to the endpoint which supports the given cluster as part of the given application profile (see Section 5.5.2). JN-UG-3101 v1.5 NXP Laboratories UK

84 Chapter 5 Application Coding with ZigBee PRO APIs Receiving Data When a data packet (sent using one of the methods described in Section 5.5.1) is received by the destination node, it is put into a message queue. A ZPS_EVENT_AF_DATA_INDICATION stack event is generated on the destination node to indicate that a data packet has arrived (the destination endpoint is indicated in this event). The packet must then be collected from the message queue using the RTOS function OS_eCollectMessage(). Note 1: In the case of a data packet received from another network by means of an inter-pan transfer, the ZPS_EVENT_APS_INTERPAN_DATA_INDICATION stack event will be generated. The data packet will be passed to the endpoint which supports the specified cluster as part of the specified application profile. The application must always handle these inter-pan packets and release the APDU instances (see below). The event will only be generated if the inter-pan feature has been enabled via the ZPS Configuration Editor. If an application transmits inter-pan messages but does not need to receive them, the application must enable inter- PAN in the ZPS Configuration Editor and handle any ZPS_EVENT_APS_INTERPAN_DATA_INDICATION events by releasing the APDU instances. Note 2: In the case of the arrival of a response packet which is destined for the ZDO, a ZPS_EVENT_AF_DATA_INDICATION stack event will be generated with a destination endpoint of 0. It will be necessary for the application to call the function ZPS_bAplZdpUnpackResponse() to extract the response data from the event. An End Device which is asleep will be unable to receive a data packet directly, so the data is buffered by its parent for collection later. The End Device must explicitly request this data, once awake. This method of receiving data is called data polling and is described in Section Once a data packet has been collected from a message queue, the data can be extracted from the APDU instance using the JenOS PDUM function PDUM_u16APduInstanceReadNBO(). The APDU instance must then be released using the JenOS function PDUM_eAPduFreeAPduInstance(). By default, received data packets are filtered on the basis of signal strength (LQI value) such that packets received with a weak signal are discarded. If required, packet filtering can be re-configured or disabled using the function ZPS_vAplAfEnableMcpsFilter(). Packet filtering is fully described in Appendix B NXP Laboratories UK 2017 JN-UG-3101 v1.5

85 ZigBee PRO Stack Polling for Data In the case of an End Device which is capable of sleeping, messages are not delivered directly to the device, since it may be asleep when the messages arrive. Instead, the messages are temporarily buffered by the End Device s parent. Once awake, the End Device can then ask or poll its parent for data. Note: End Devices that are not enabled for sleep can receive messages directly and therefore do not need to poll. An End Device is pre-configured as either sleeping or non-sleeping via the End Device parameter Sleeping in the ZPS Configuration Editor (see Section ). Data polling is performed using the function ZPS_eAplZdoPoll() in the End Device application. This function requests the buffered data and should normally be called immediately after waking from sleep. If the poll request is successfully sent to the parent, a ZPS_EVENT_NWK_POLL_CONFIRM stack event will occur on the End Device. The subsequent arrival of data from the parent is indicated by the stack event ZPS_EVENT_AF_DATA_INDICATION. Any messages forwarded from the parent should then be collected from the relevant message queue using the RTOS function OS_eCollectMessage(), just as for normal data reception described in Section Application design issues concerned with transferring data to a sleeping End Device are outlined in Appendix B Security in Data Transfers The send data functions for unicast, broadcast, group transfer and bound transfer contain a parameter to select the required security setting for the protection of the sent message. In the NXP ZigBee PRO software, there are currently three security options, as follows: No security Network-level security Application-level security Application-level security is only available for unicast and bound transfers, while network-level security is available for all transfer types except inter-pan transfers. Network-level and application-level security are detailed in Section 5.8. JN-UG-3101 v1.5 NXP Laboratories UK

86 Chapter 5 Application Coding with ZigBee PRO APIs Note 1: Only ZigBee standard security is available. High security, which is implemented at the ZigBee stack APL (Application) layer, is not currently implemented in the NXP ZigBee PRO software. Note 2: No security is available for inter-pan transfers (to other networks). Note 3: When application-level security is used in sending data, the IEEE/MAC address and network address of the target node must be available through the local Address Map table - see Section Leaving and Rejoining the Network This section describes how a node may leave the network and later rejoin either the same network or a different network Leaving the Network A node may leave the network intentionally or unintentionally: The node may be intentionally (and temporarily) removed from the network for maintenance work, such as the replacement of batteries. The node may unintentionally leave the network due to unforeseen circumstances, such as a broken radio link with its parent (an obstacle may have been introduced into the path of the signal). A node can be intentionally removed from the network using the function ZPS_eAplZdoLeaveNetwork(), which issues a leave request. The target node can be the requesting node itself or a child of the requesting node. The application may be designed to call this function when a button is pressed on the requesting node. When calling ZPS_eAplZdoLeaveNetwork(): You can specify whether the children of the leaving node should also be requested to leave the network. If this is the case, the leaving node will first automatically call ZPS_eAplZdoLeaveNetwork() for each of its children. You can specify whether the leaving node should immediately attempt to rejoin the same network after leaving. The stack event ZPS_EVENT_NWK_LEAVE_INDICATION is generated on the node which has been requested to leave (this event is also generated when a neighbouring node has left the network). Once a node has been successfully removed from the network as the result of a call to ZPS_eAplZdoLeaveNetwork(), the stack event ZPS_EVENT_NWK_LEAVE_CONFIRM is generated on the requesting node. 86 NXP Laboratories UK 2017 JN-UG-3101 v1.5

87 ZigBee PRO Stack The function ZPS_eAplZdpMgmtLeaveRequest() is also provided which can be used to request a remote node to leave the network. Some profiles permit a Router to ignore leave request messages. This is to prevent a rogue node from disrupting the network. By default, a Router will always act on leave request messages. However, if the function ZPS_vNwkNibSetLeaveAllowed() is called with the bleave parameter as FALSE, the Router will ignore network leave requests. End Devices always act on leave requests from their parent and ignore leave requests from other nodes Rejoining the Network A node may leave its network - for example, by: losing radio contact with its parent - the stack on the orphaned node will detect this loss and automatically attempt to rejoin the network calling ZPS_eAplZdoLeaveNetwork() - the node will automatically attempt to rejoin the network only if an immediate rejoin has been requested in the function call If the node successfully rejoins the network, the stack event ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED is generated on the parent node and one of the following stack events is generated on the joined node: ZPS_EVENT_NWK_JOINED_AS_ROUTER (if joined as a Router) ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE (if joined as an End Device) These events contain the network address that the parent has allocated to the joined node (this may be different from the network address that the node previously had). If the join request is unsuccessful, the ZPS_EVENT_NWK_FAILED_TO_JOIN event is generated on the requesting node. If an automatic rejoin has failed or has not been requested, the function ZPS_eAplZdoRejoinNetwork() can be used to request a rejoin (this function must be called on the node that needs to rejoin). The application may be designed to call this function when a button is pressed on the node. The result of this function call will be indicated by means of the above events. The function ZPS_eAplZdpMgmtDirectJoinRequest() is also provided which submits a request to a remote parent to allow a particular node to join it. In addition, the function ZPS_eAplZdpMgmtPermitJoiningRequest() is provided which allows joining to be enabled/disabled on a remote node. JN-UG-3101 v1.5 NXP Laboratories UK

88 Chapter 5 Application Coding with ZigBee PRO APIs Note 1: When a device rejoins a network, the permit joining status on the potential parent is ignored. Note 2: When a device joins the network, its application may call ZPS_eAplZdpDeviceAnnceRequest() to announce the device s membership and network address to the rest of the network. The information is sent in a Device_annce announcement, which must be collected by the recipient nodes using the RTOS function OS_eCollectMessage(). Caution: If a node rejoins the same secured network but its stack context data was cleared before the rejoin (by calling PDM_vDelete()), data sent by the node will be rejected by the destination node since the frame counter has been reset on the source node. Therefore, you are not recommended to clear the stack context data before a rejoin. For more information and advice, refer to Appendix B NXP Laboratories UK 2017 JN-UG-3101 v1.5

89 5.7 Return Codes and Extended Error Handling ZigBee PRO Stack When a ZigBee PRO API function is called, a code is normally returned on completion of the function to indicate the outcome. This code is taken from one of the following: ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section An extended error handling mechanism can be optionally implemented which allows more detail to be obtained about certain errors that can occur during function execution. The particular errors are: 0xA3: ZPS_APL_APS_E_ILLEGAL_REQUEST 0xA6: ZPS_APL_APS_E_INVALID_PARAMETER 0xC2: ZPS_NWK_ENUM_INVALID_REQUEST The extended error codes are listed and described in Section In order to implement the extended error handling mechanism, you must register a callback function using the function ZPS_vExtendedStatusSetCallback(). This registration function must be called before invoking the first API function for which extended error handling is required. The registered callback function will then be invoked during execution of the API function if one of the above errors occurs. The callback function will return an extended error code (from those listed in Section 9.2.5) but the API function will return only the basic error code. JN-UG-3101 v1.5 NXP Laboratories UK

90 Chapter 5 Application Coding with ZigBee PRO APIs 5.8 Implementing ZigBee Security The NXP ZigBee PRO APIs allow ZigBee standard security to be implemented, which applies key-based encryption to communications between network nodes. The message frame content generated at the NWK layer and higher is encrypted using 128-bit AES-based encryption (see Section 1.8). The NWK payload of the frame is encrypted, and the NWK header and payload are integrity-protected with a 32-bit Message Integrity Code (MIC). Two types of security can be applied: Network-level security: This uses a network key which is common throughout the network and is used to encrypt/decrypt all communications between all nodes. Application-level security: This uses an application link key which is used (in addition to the network key) to encrypt/decrypt communications between a particular pair of nodes. If security is enabled in a ZigBee network then network-level security is always used, while application-level security is optional. Security is enabled on a node via the device parameter Security Enabled in the ZPS Configuration Editor. Enabling security also enables many-to-one routing towards the Trust Centre, which becomes a network concentrator (see Section 2.5.3). A Trust Centre must be nominated (see Section 1.8) using the ZPS Configuration Editor. The Co-ordinator is normally chosen as the Trust Centre. The maximum number of nodes that will require the services of the Trust Centre must be set on the nominated node using the network parameter Route Record Table Size in the ZPS Configuration Editor (the default number is 4). Security can be set up in the application code using the function ZPS_vAplSecSetInitialSecurityState(), which must be called before ZPS_eAplAfInit() and ZPS_eAplZdoStartStack() - see Section 5.1. Note: As an alternative to using the function ZPS_vAplSecSetInitialSecurityState() in the application code, ZigBee security can be set up in the ZPS Configuration Editor (see Section 5.8.1). Once ZPS_vAplSecSetInitialSecurityState() has been called and the stack has been started, the stack will automatically manage the subsequent network-level security set-up and implementation. Network-level security is established using an initial security key which must be specified in the function call. This key can be one of the following types: Pre-configured network key Default network key Pre-configured global link key Pre-configured unique link key 90 NXP Laboratories UK 2017 JN-UG-3101 v1.5

91 ZigBee PRO Stack The network-level security set-up process depends on the type of key specified - the different set-up processes are described in Section Once network-level security is set up, a particular pair of nodes can opt to use application-level security for private communications between the two nodes - the application-level security set-up process is described in Section Network key modification is then described in Section Network-level Security Set-up The function ZPS_vAplSecSetInitialSecurityState() initiates the set-up process for network-level security and requires an initial security key, which can be one of three types (listed above). These key types and the corresponding set-up processes are described below. Pre-configured Network Key The pre-configured network key is pre-programmed into all the network nodes (including the Trust Centre). As an alternative to specifying this key in the application code, the key can be set through the parameter Initial Security Key in the ZPS Configuration Editor by first specifying the key for the Trust Centre and then for the other nodes. This key can be used immediately to encrypt/decrypt network communications. This network key does not need to be transported over-air and so is not exposed to the risk of detection. Default Network Key The default network key is initially held only by the Trust Centre - it is either randomly generated or pre-set on the Trust Centre (to randomly generate the key, it is necessary to provide a NULL pointer in the key parameter in the function call). As an alternative to specifying this key in the application code, the key can be set through the parameter Initial Security Key in the ZPS Configuration Editor by specifying the key for the Trust Centre only. The Trust Centre must send this key unencrypted to any node that joins the network directly via the Trust Centre. When a node joins the network via an existing Router, this parent node must request the key from the Trust Centre on behalf of the new child (the Trust Centre must verify that the new node is not blacklisted). While the Trust Centre can transport the key encrypted down to the parent, the key will be unencrypted during the final hop from the parent to the child. Therefore, this key is exposed to the risk of detection during one hop while being transported to a new node. Pre-configured Global Link Key A pre-configured link key is used to secure communication between the Trust Centre and the joining node. Each node uses the same pre-configured link key, which is programmed into all nodes and into the Trust Centre. JN-UG-3101 v1.5 NXP Laboratories UK

92 Chapter 5 Application Coding with ZigBee PRO APIs The Trust Centre generates a random network key to be used in network-level communications between all nodes. When a new node joins the network, the Trust Centre transports this network key, encrypted using the pre-configured link key, to the newly joined node. Pre-configured Unique Link Key An individual pre-configured link key is used to secure communication between the Trust Centre and one other node. Thus, a different pre-configured link key is used for each node of the network, and must be pre-programmed into the node and into the Trust Centre. As an alternative to specifying this key in the application code, the key can be set through the Key Descriptor parameter Key in the ZPS Configuration Editor by specifying the key first for the Trust Centre and then for the other node. The IEEE/MAC address of the node must also be pre-programmed into the Trust Centre along with the link key. The Trust Centre generates a random network key to be used in network-level communications between all nodes. When a new node joins the network, the Trust Centre transports this network key, encrypted using the pre-configured link key, to the newly joined node. This key type provides the most secure method of setting up network-level security. Note 1: The application on the Trust Centre can take control (from the stack) of whether a node is allowed to join the network (possibly using its pre-configured link key) through a user-defined callback function. If required, this callback function must be registered using the function ZPS_vTCSetCallback(). For more details, refer to the function description on page 135. Note 2: When a device joins a ZigBee network and requires authentication which involves transporting a network key to it, the parent opens an authentication interval during which the joining device must announce itself to the network. This interval begins from the transmission of a rejoin response (if the device joins through a NWK layer rejoin) or an association response (if it joins through an IEEE association). If the device fails to announce itself during this interval, the parent removes the Neighbour table entry for the joining device to ensure that the child capacity of the parent is maintained. This authentication interval must be set on all potential parent nodes via the network parameter APS Security Timeout Period (see Section 10.7), which is 1 second by default but 6 seconds is a more reasonable setting. 92 NXP Laboratories UK 2017 JN-UG-3101 v1.5

93 ZigBee PRO Stack Application-level Security Set-up Once network-level security has been set up (as described in Section 5.8.1), application-level security can be set up for an individual pair of nodes. Applicationlevel security is used when the communications between the two nodes must remain private from the rest of the network. This requires their communications to be encrypted/decrypted using an application link key which may be global or unique. A global link key is shared between all nodes on the network. Frame counters are not checked for freshness when using a global link key. A unique link key is exclusive to a pair of nodes which need to communicate. Frame counters are checked for freshness to prevent rogue nodes replaying stale messages. This provides the most secure method of application security. In order to set up application-level security between two nodes, the function ZPS_eAplZdoRequestKeyReq() must be called on one of the nodes to request an application link key from the Trust Centre. The Trust Centre responds to this request by sending the same application link key to both nodes. The Trust Centre will ignore the request if the node is not permitted to send APS secured data. Each of these responses are encrypted as follows: If a link key exists for communications between the Trust Centre and the target node (e.g. the pre-configured link key described in Section 5.8.1), this key and the network key are both used to encrypt the transported application link key. Otherwise, only the network key is used to encrypt the application link key. On receiving the application link key, the ZigBee stack on the two nodes will automatically save the key. The event ZPS_EVENT_ZDO_LINK_KEY is generated to indicate that the link key is available. Any subsequent unicast or bound data transfer between these two nodes can opt to use this key (ZPS_E_APL_AF_SECURE_APL). Note 1: An application link key can be introduced directly by the application using the function ZPS_eAplZdoAddReplaceLinkKey(). If a link key already exists for the same node-pair, it will be replaced by the new link key. This function must be called on both nodes in the pair. Note 2: When an application link key is used to encrypt a data packet, the packet payload is encrypted at the application level using the link key and then the packet is encrypted at the ZigBee stack NWK layer using the network key (therefore, both keys are used). Note 3: When application-level security is used in sending data, the IEEE/MAC address and network address of the target node must be available through the local Address Map table - see Section JN-UG-3101 v1.5 NXP Laboratories UK

94 Chapter 5 Application Coding with ZigBee PRO APIs Network Key Modification It is possible to store more than one network key on a node, although only one key can be active at any one time. Each network key is identified by means of a unique key sequence number assigned by the Trust Centre application. A new network key can be installed in a node in one of two ways: Distributed by the Trust Centre to one or multiple nodes of the network using the function ZPS_eAplZdoTransportNwkKey(), which requires the associated key sequence number to be specified Requested from the Trust Centre by calling the function ZPS_eAplZdoRequestKeyReq() on the node that needs the network key On reaching its destination(s), the transported key is automatically saved but not activated. A stored network key can be adopted as the active key using the function ZPS_eAplZdoSwitchKeyReq(), which is called on the Trust Centre and which identifies the required key by means of its unique sequence number. 94 NXP Laboratories UK 2017 JN-UG-3101 v1.5

95 ZigBee PRO Stack Part II: Reference Information JN-UG-3101 v1.5 NXP Laboratories Ltd

96 96 NXP Laboratories Ltd 2017 JN-UG-3101 v1.5

97 ZigBee PRO Stack 6. ZigBee Device Objects (ZDO) API The chapter describes the resources of the ZigBee Device Objects (ZDO) API. This API is primarily concerned with starting, forming and modifying a ZigBee PRO network. The API is defined in the header file zps_apl_zdo.h. In this chapter: Section 6.1 details the ZDO API functions Section 6.2 details the ZDO API enumerations 6.1 ZDO API Functions The ZDO API functions are divided into the following categories: Network Deployment functions, described in Section Security functions, described in Section Addressing functions, described in Section Routing functions, described in Section Object Handle functions, described in Section Optional Cluster function, described in Section JN-UG-3101 v1.5 NXP Laboratories UK

98 Chapter 6 ZigBee Device Objects (ZDO) API Network Deployment Functions The ZDO Network Deployment functions are used to start the ZigBee PRO stack, and allow devices to join the network and bind to each other, as well as leave the network. The functions are listed below, along with their page references: Function Page ZPS_eAplZdoStartStack 99 ZPS_eAplZdoGetDeviceType 100 ZPS_eAplZdoDiscoverNetworks 101 ZPS_eAplZdoJoinNetwork 102 ZPS_eAplZdoRejoinNetwork 103 ZPS_eAplZdoDirectJoinNetwork 104 ZPS_eAplZdoOrphanRejoinNetwork 105 ZPS_eAplZdoPermitJoining 106 ZPS_u16AplZdoGetNetworkPanId 107 ZPS_u64AplZdoGetNetworkExtendedPanId 108 ZPS_u8AplZdoGetRadioChannel 109 ZPS_eAplZdoBind 110 ZPS_eAplZdoUnbind 111 ZPS_eAplZdoBindGroup 112 ZPS_eAplZdoUnbindGroup 113 ZPS_ePurgeBindTable 114 ZPS_eAplZdoPoll 115 ZPS_eAplZdoLeaveNetwork 116 ZPS_vNwkNibSetLeaveAllowed 118 ZPS_vNwkSendNwkStatusCommand 119 ZPS_vRemoveMacTableEntry 120 ZPS_vSaveAllZpsRecords 121 Note: The ZDO initialisation and start stack functions use network parameter values that have been pre-set and saved using the ZPS Configuration Editor - see Chapter NXP Laboratories UK 2017 JN-UG-3101 v1.5

99 ZigBee PRO Stack ZPS_eAplZdoStartStack ZPS_teStatus ZPS_eAplZdoStartStack(void); Description This function starts the ZigBee PRO stack. The steps taken depend on the node type: If the device is the Co-ordinator, this function will start the network formation process. If the device is a Router or End Device, this function will start the network discovery process - that is, the device will search for a network to join. When the stack starts, the 2400-MHz radio channel to be used by the device is selected. The channels (in the range 11 to 26) available to the device should be specified in advance using the ZPS Configuration Editor (see Chapter 12) and can be either of the following: A fixed channel A set of channels for a channel scan: If the device is the Co-ordinator, this is the set of channels that the device will scan to find a suitable operating channel for the network. If the device is a Router or End Device, this is the set of channels that the device will scan to find a network to join. If this function successfully initiates network formation or discovery, ZPS_E_SUCCESS will be returned. Subsequent results from this process will then be reported through stack events (see Section 9.1 for details of these events): If the Co-ordinator successfully creates a network, the event ZPS_EVENT_NWK_STARTED is generated. Otherwise, the event ZPS_EVENT_NWK_FAILED_TO_START is generated. When the network discovery process for a Router or End Device has completed, the subsequent actions depend on the Extended PAN ID (EPID) that has been pre-set using the ZPS Configuration Editor: If a zero EPID value was pre-set, the stack event ZPS_EVENT_NWK_DISCOVERY_COMPLETE is generated. This includes a list of the detected networks and the index (in the list) of the recommended network to join. You can then call ZPS_eAplZdoJoinNetwork() to join the desired network. If a non-zero EPID value was pre-set, the device will automatically attempt to join the network with this EPID, provided that such a network has been discovered. Note that the permit joining setting of the potential parent will be ignored. The maximum depth (number of levels below the Co-ordinator) of the network is 15. Parameters None Returns ZPS_E_SUCCESS (stack started and network formation/discovery begun) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

100 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoGetDeviceType ZPS_teZdoDeviceType ZPS_eAplZdoGetDeviceType(void); Description This function can be used to obtain the ZigBee device type (Co-ordinator, Router or End Device) of the local node. Parameters None Returns ZigBee device type, one of: ZPS_ZDO_DEVICE_COORD (Co-ordinator) ZPS_ZDO_DEVICE_ROUTER (Router) ZPS_ZDO_DEVICE_ENDDEVICE (End Device) 100 NXP Laboratories UK 2017 JN-UG-3101 v1.5

101 ZigBee PRO Stack ZPS_eAplZdoDiscoverNetworks ZPS_teStatus ZPS_eAplZdoDiscoverNetworks( uint32 u32channelmask); Description This function can be used by a Router or End Device to initiate a network discovery - that is, to find a network to join. A network discovery is performed when the stack is started using the function ZPS_eAplZdoStartStack(). The function ZPS_eAplZdoDiscoverNetworks() can be used to perform subsequent network discoveries (for example, if the initial search did not yield any suitable networks). As part of this function call, you must specify a value which indicates the 2400-MHz radio channels (numbered 11 to 26) to be used in the network search. There are two ways of setting this parameter: A single value in the range 11 to 26 can be specified, indicating that the corresponding channel (and no other) must be used - for example, 12 indicates use channel 12. A 32-bit mask can be used to specify a set of channels that the device will scan to find a network - each of bits 11 to 26 represents the corresponding radio channel, where the channel will be included in the scan if the bit is set to 1 (and excluded if cleared to 0). Therefore, the value 0x07FFF800 represents all channels. Note that if an invalid value is specified for this parameter, the default value of 0x07FFF800 (all channels) will be used. If this function successfully initiates a network discovery, ZPS_E_SUCCESS will be returned. The network discovery results will then be reported through the event ZPS_EVENT_NWK_DISCOVERY_COMPLETE (for details of this event, refer to Section ). This includes a list of the detected networks and the index (in the list) of the recommended network to join. You should then call ZPS_eAplZdoJoinNetwork() to join the desired network. Parameters u32channelmask Radio channel(s) for network discovery (see above) Returns ZPS_E_SUCCESS (network discovery started) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

102 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoJoinNetwork ZPS_teStatus ZPS_eAplZdoJoinNetwork( ZPS_tsNwkNetworkDescr *psnetworkdescr); Description This function can be used by a Router or End Device to send a request to join a particular network, following a network discovery. Note: This function is not needed if the network to join has been pre-determined by setting the advanced device parameter APS Use Extended PAN Id using the ZPS Configuration Editor. In this case, a join will be attempted automatically after starting the stack. Parameters The required network is specified using its network descriptor, obtained in a ZPS_EVENT_NWK_DISCOVERY_COMPLETE event which results from a network discovery previously implemented using ZPS_eAplZdoStartStack() or ZPS_eAplZdoDiscoverNetworks(). For details of this event, refer to Section If the join request is successfully sent, the function will return ZPS_E_SUCCESS (note that this does not mean that device has joined the network). The result of the join request will then be reported through a stack event (see Section 9.1 for details of these events): If the device successfully joined the network as a Router, the event ZPS_EVENT_NWK_JOINED_AS_ROUTER is generated. The allocated 16-bit network address of the Router is returned as part of this stack event. If the device successfully joined the network as an End Device, the event ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE is generated. The allocated 16-bit network address of the End Device is returned as part of this stack event. If the join request was unsuccessful, the event ZPS_EVENT_NWK_FAILED_TO_JOIN is generated. Note that nodes can join a ZigBee PRO network to a maximum depth of 15 (levels below the Co-ordinator). *psnetworkdescr Pointer to network descriptor of network to join Returns ZPS_E_SUCCESS (join request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

103 ZigBee PRO Stack ZPS_eAplZdoRejoinNetwork ZPS_teStatus ZPS_eAplZdoRejoinNetwork( bool_t bwithdiscovery); Description This function can be used by an active Router or End Device to send a request to rejoin its previous network. The function should be called if the application detects that it has lost its connection to the network - this is indicated by an excessive number of failed communications (for example, with many missing acknowledgements). Options are provided to first perform a network discovery to find potential parents to join or simply rejoin the previous parent. If the rejoin request is successfully sent, the function will return ZPS_E_SUCCESS (note that this does not mean that device has rejoined the network). The result of the rejoin request will then be reported through a stack event (see Section 9.1 for details of these events): If the device successfully rejoined the network as a Router, the event ZPS_EVENT_NWK_JOINED_AS_ROUTER is generated. If the device successfully rejoined the network as an End Device, the event ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE is generated. If the rejoin request was unsuccessful, the event ZPS_EVENT_NWK_FAILED_TO_JOIN is generated. In the case of a successful rejoin, the node will retain its previously allocated 16-bit network address. Note that the permit joining status of the potential parent is ignored during a rejoin. Parameters bwithdiscovery Specifies whether a network discovery is required: TRUE - perform network discovery before rejoining FALSE - rejoin previous parent Returns ZPS_E_SUCCESS (rejoin request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

104 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoDirectJoinNetwork ZPS_teStatus ZPS_eAplZdoDirectJoinNetwork( uint64 u64addr, uint16 u16addr, uint8 u8capability); Description This function can be used on a Router and on the Co-ordinator to pre-determine the child nodes that will directly join it. The function is called to register each child node separately, and the IEEE/MAC and network addresses of the child node must be specified. The function adds the registered node to its Neighour table (it actually adds the node s IEEE/MAC address to the MAC Address table and then includes the index of this address in a Neighbour table entry for the node). The function must be called only when the parent node is fully up and running in the network. Since the child node has not yet joined the network but is in the Neighbour table, it will be perceived by the parent as having been orphaned. Therefore, when the child node attempts to join the network, it must perform a rejoin as an orphan by calling the function ZPS_eAplZdoOrphanRejoinNetwork(). Caution: You should only modify to the Neighour table using this function and never write to it directly. Parameters u64addr u16addr u8capability IEEE/MAC address of child node to be registered Network address of child node to be registered A bitmap indicating the operational capabilities of the child node - this bitmap is detailed in Table 8 on page 216 Returns ZPS_E_SUCCESS (child node successfully registered) ZPS_APL_APS_E_ILLEGAL_REQUEST (address 0x0, address 0xFFFFFFFFFFFFFFFF, own address, ZDO busy) ZPS_NWK_ENUM_ALREADY_PRESENT ZPS_NWK_ENUM_NEIGHBOR_TABLE_FULL 104 NXP Laboratories UK 2017 JN-UG-3101 v1.5

105 ZigBee PRO Stack ZPS_eAplZdoOrphanRejoinNetwork ZPS_teStatus ZPS_eAplZdoOrphanRejoinNetwork(void); Description This function can be used by an orphaned node to attempt to rejoin the network - the orphaned node may be an End Device or a Router. The function should also be used for a first-time join for which the parent has been pre-determined using the function ZPS_eAplZdoDirectJoinNetwork(). The function starts the stack on the node. Therefore, when this function is used, there is no need to explicitly start the stack using ZPS_eAplZdoStartStack(). If the rejoin request is successfully sent, the function will return ZPS_E_SUCCESS (note that this does not mean that device has rejoined the network). The result of the rejoin request will then be reported through a stack event (see Section 9.1 for details of these events): If the device successfully rejoined the network as a Router, the event ZPS_EVENT_NWK_JOINED_AS_ROUTER is generated. If the device successfully rejoined the network as an End Device, the event ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE is generated. If the rejoin request was unsuccessful, the event ZPS_EVENT_NWK_FAILED_TO_JOIN is generated. In the case of a successful rejoin of a genuinely orphaned node, the node will retain its previously allocated 16-bit network address. Note that the permit joining status of the potential parent is ignored during a rejoin. Parameters None Returns ZPS_E_SUCCESS (rejoin request successfully sent) ZPS_APL_APS_E_ILLEGAL_REQUEST (missing EPID, called from Co-ordinator, ZDO busy) JN-UG-3101 v1.5 NXP Laboratories UK

106 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoPermitJoining ZPS_teStatus ZPS_eAplZdoPermitJoining( uint8 u8permitduration); Description This function can be used on a Router or the Co-ordinator to control whether new child nodes are allowed to join it - that is, to set the node s permit joining status. The function can be used to enable joining permanently or for a fixed duration, or to disable joining (permanently). The specified parameter value determines the permit joining status, as follows: 0 Disables joining Enables joining for specified time interval, in seconds 255 Enables joining permanently For example, if the parameter is set to 60, joining will be enabled for the next 60 seconds and then automatically disabled. Caution: The permit joining setting of a device is ignored during a join attempt in which a non-zero Extended PAN ID is specified on the joining device and during any rejoin attempt. Parameters u8permitduration Time duration, in seconds, for which joining will be permitted (see above) Returns ZPS_E_SUCCESS ( permit joining status successfully set) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

107 ZigBee PRO Stack ZPS_u16AplZdoGetNetworkPanId uint16 ZPS_u16AplZdoGetNetworkPanId(void); Description Parameters Returns This function obtains the 16-bit PAN ID of the ZigBee network to which the local node currently belongs. None PAN ID of current network JN-UG-3101 v1.5 NXP Laboratories UK

108 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_u64AplZdoGetNetworkExtendedPanId uint64 ZPS_u64AplZdoGetNetworkExtendedPanId(void) Description Parameters Returns This function obtains the 64-bit Extended PAN ID (EPID) of the ZigBee PRO network to which the local node currently belongs. None Extended PAN ID of current network 108 NXP Laboratories UK 2017 JN-UG-3101 v1.5

109 ZigBee PRO Stack ZPS_u8AplZdoGetRadioChannel uint8 ZPS_u8AplZdoGetRadioChannel(void); Description Parameters Returns This function obtains the 2400-MHz band channel in which the local node is currently operating. The channel is represented by an integer in the range 11 to 26. None Radio channel number (in range 11-26) JN-UG-3101 v1.5 NXP Laboratories UK

110 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoBind ZPS_teStatus ZPS_eAplZdoBind( uint16 u16clusterid, uint8 u8srcendpoint, uint16 u16dstaddr, uint64 u64dstieeeaddr, uint8 u8dstendpoint); Description This function requests a binding to be created between an endpoint on the local node and an endpoint on a remote node. The source endpoint and cluster must be specified, as well as the destination node and endpoint. The destination node is specified using both its 64-bit IEEE (MAC) address and its 16-bit network address. The binding is added to the binding table on the local node. A binding to multiple remote endpoints (collected into a group) can be created using the function ZPS_eAplZdoBindGroup(). Parameters u16clusterid u8srcendpoint u16dstaddr u64dstieeeaddr u8dstendpoint Identifier of cluster on source node to be bound Number of endpoint (1-240) on source node to be bound 16-bit network address of destination for binding 64-bit IEEE (MAC) address of destination for binding Number of endpoint on destination node to be bound Returns ZPS_E_SUCCESS (binding successfully created) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

111 ZigBee PRO Stack ZPS_eAplZdoUnbind ZPS_teStatus ZPS_eAplZdoUnbind( uint16 u16clusterid, uint8 u8srcendpoint, uint16 u16dstaddr, uint64 u64dstieeeaddr, uint8 u8dstendpoint); Description This function requests an existing binding to be removed between an endpoint on the local node and an endpoint on a remote node, where this binding was created using the function ZPS_eAplZdoBind(). The source endpoint and cluster must be specified, as well as the destination node and endpoint. The destination node is specified using both its 64-bit IEEE (MAC) address and its 16-bit network address. The binding is removed from the binding table on the local node. Parameters u16clusterid u8srcendpoint u16dstaddr u64dstieeeaddr u8dstendpoint Identifier of bound cluster on source node Number of bound endpoint (1-240) on source node 16-bit network address of destination for binding 64-bit IEEE (MAC) address of destination for binding Number of bound endpoint on destination node Returns ZPS_E_SUCCESS (binding successfully removed) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

112 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoBindGroup ZPS_teStatus ZPS_eAplZdoBindGroup( uint16 u16clusterid, uint8 u8srcendpoint, uint16 u16dstgrpaddr); Description This function requests a binding to be created between an endpoint on the local node and multiple endpoints on remote nodes. The source endpoint and cluster must be specified, as well as the destination nodes/endpoints for the binding, which must be specified using a 16-bit group address, previously set up using ZPS_eAplZdoGroupEndpointAdd(). The binding is added to the binding table on the local node. Parameters u16clusterid u8srcendpoint u16dstgrpaddr Identifier of cluster on source node to be bound Number of endpoint (1-240) on source node to be bound 16-bit group address of destination group for binding Returns ZPS_E_SUCCESS (binding successfully created) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

113 ZigBee PRO Stack ZPS_eAplZdoUnbindGroup ZPS_teStatus ZPS_eAplZdoUnbindGroup( uint16 u16clusterid, uint8 u8srcendpoint, uint16 u16dstgrpaddr); Description This function requests an existing binding to be removed between an endpoint on the local node and a group of endpoints on remote nodes, where this binding was created using the function ZPS_eAplZdoBindGroup(). The source endpoint and cluster must be specified, as well as the destination nodes/endpoints for the binding, which must be specified using a 16-bit group address. The binding is removed from the binding table on the local node. Parameters u16clusterid u8srcendpoint u16dstgrpaddr Identifier of bound cluster on source node Number of bound endpoint (1-240) on source node 16-bit group address of bound destination group Returns ZPS_E_SUCCESS (binding successfully removed) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

114 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_ePurgeBindTable ZPS_teStatus ZPS_ePurgeBindTable(void); Description This function removes all bindings from the binding table on the local node. Parameters None Returns ZPS_E_SUCCESS (binding successfully removed) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

115 ZigBee PRO Stack ZPS_eAplZdoPoll ZPS_teStatus ZPS_eAplZdoPoll(void); Description This function can be used by an End Device to poll its parent for pending data. Since an End Device is able to sleep, messages addressed to the End Device are buffered by the parent for delivery when the child is ready. This function requests this buffered data and should normally be called immediately after waking from sleep. This function call will trigger a confirmation event, ZPS_EVENT_NWK_POLL_CONFIRM, if the poll request is successfully sent to the parent. The subsequent arrival of data from the parent is indicated by a ZPS_EVENT_APS_DATA_INDICATION event. Any messages forwarded from the parent should then be collected using the RTOS function OS_eCollectMessage(). Parameters None Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

116 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoLeaveNetwork ZPS_teStatus ZPS_eAplZdoLeaveNetwork( uint64 u64addr, bool bremovechildren, bool brejoin); Description This function can be used to request a node to leave the network. The leaving node can be a child of the requesting node or can be the requesting node itself (excluding the Co-ordinator). The node being asked to leave the network is specified by means of its IEEE (MAC) address (or zero, if a node is requesting itself to leave the network). You must also: Use the parameter bremovechildren to specify whether children of the leaving node must leave their parent - if this is the case, the leaving node will automatically call ZPS_eAplZdoLeaveNetwork() for each of its children. This parameter must always be set to FALSE when the function is called on an End Device (as there are no children). Use the parameter brejoin to specify whether the leaving node must attempt to rejoin the network (probably via another parent) immediately after leaving. Tip: If you wish to move a whole network branch from under the requesting node to a different parent node, set bremovechildren to FALSE and brejoin to TRUE. If this function successfully initiates the removal of a node, ZPS_E_SUCCESS will be returned. Subsequently, when the removal is complete, the stack event ZPS_EVENT_NWK_LEAVE_CONFIRM is generated. For details of this event, refer to Section Parameters u64addr bremovechildren brejoin 64-bit IEEE (MAC) address of node to leave network (zero value will cause requesting node to leave network) Boolean value indicating whether children of leaving node must leave their parent: TRUE: Children to leave FALSE: Children not to leave Boolean value indicating whether leaving node must attempt to rejoin network immediately after leaving: TRUE: Rejoin network immediately FALSE: Do not rejoin network 116 NXP Laboratories UK 2017 JN-UG-3101 v1.5

117 ZigBee PRO Stack Returns ZPS_E_SUCCESS (removal of node successfully started) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

118 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_vNwkNibSetLeaveAllowed void ZPS_vNwkNibSetLeaveAllowed(void *pvnwk, bool bleave); Description Parameters This function controls the action of a Router node on receiving a leave request. It has no effect on a Co-ordinator or End Device. If called with bleave set to TRUE, the Router will obey a leave request. If called with bleave set to FALSE, the Router will ignore leave request messages. pvnwk bleave Pointer to NWK layer instance Boolean value indicating whether the Router will leave the network when requested or will ignore leave request messages: TRUE - Obey leave request messages FALSE - Ignore leave request messages Returns None 118 NXP Laboratories UK 2017 JN-UG-3101 v1.5

119 ZigBee PRO Stack ZPS_vNwkSendNwkStatusCommand void ZPS_vNwkSendNwkStatusCommand( void *pvnwk, uint16 u16dstaddress, uint16 u16targetaddress, uint8 u8commandid, uint8 u8radius); Description This function can be used to send a network status command to another node. For example, it can be used by an End Device to report a routing problem (concerning a remote node) to its parent. Parameters pvnwk u16dstaddress u16targetaddress u8commandid u8radius Pointer to NWK layer instance Network address of the remote node to which the status command relates (e.g. the node for which a routing problem is being reported) Network address of the node to which the status command is to be sent (e.g. the parent of the local node) Value representing the network status command to be sent (the possible values are provided in the ZigBee PRO specification) Maximum number of hops permitted to target node (zero value specifies that default maximum is to be used) Returns None JN-UG-3101 v1.5 NXP Laboratories UK

120 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_vRemoveMacTableEntry void ZPS_vRemoveMacTableEntry(uint64 u64macaddress); Description Parameters This function can be used to remove the specified 64-bit IEEE/MAC address (of a remote device) from the local MAC Address table. It provides a safe mechanism for removing a MAC address from the table. The MAC address may also be used elsewhere, so just removing it from the MAC Address table may cause problems. The only safe method of removal is through this function. The function will: 1. Remove the Neighbour table entry associated with the MAC address 2. Remove the address from the Address Map table 3. Remove the address from the MAC Address table However, the MAC address can only be removed by this function if it is not used in the Key Descriptor table, Trust Centre information base and Binding table. Before calling this function, you must: Remove any associated link key using ZPS_eAplZdoRemoveLinkKey(). If the local device is a Trust Centre, remove the remote device from the Trust Centre information base using ZPS_bAplZdoTrustCenterRemoveDevice(). Remove any associated bindings using ZPS_eAplZdoUnbind(). u64macaddress 64-bit IEEE/MAC address of node to be removed from the MAC Address table Returns None 120 NXP Laboratories UK 2017 JN-UG-3101 v1.5

121 ZigBee PRO Stack ZPS_vSaveAllZpsRecords void ZPS_vSaveAllZpsRecords(void); Description Parameters Returns This function can be used to save all ZigBee PRO stack context data (that is persisted in PDM records) in non-volatile memory. None None JN-UG-3101 v1.5 NXP Laboratories UK

122 Chapter 6 ZigBee Device Objects (ZDO) API Security Functions The ZDO Security functions are used to set up network security (at the standard level), including the keys used in the encryption/decryption of network communications. The functions are listed below, along with their page references: Function Page ZPS_vAplSecSetInitialSecurityState 123 ZPS_eAplZdoTransportNwkKey 125 ZPS_eAplZdoSwitchKeyReq 126 ZPS_eAplZdoRequestKeyReq 127 ZPS_eAplZdoAddReplaceLinkKey 128 ZPS_eAplZdoRemoveLinkKey 129 ZPS_eAplZdoRemoveDeviceReq 130 ZPS_eAplZdoSetDevicePermission 131 ZPS_bAplZdoTrustCenterSetDevicePermissions 132 ZPS_bAplZdoTrustCenterGetDevicePermissions 133 ZPS_bAplZdoTrustCenterRemoveDevice 134 ZPS_vTCSetCallback 135 Note 1: Before using the above functions on a node, security must be enabled on the node via the device parameter Security Enabled in the ZPS Configuration Editor (security is enabled by default). Note 2: Enabling security also enables many-to-one routing towards the Trust Centre, which will become a network concentrator. You must set the maximum number of nodes to be serviced by the Trust Centre using its network parameter Route Record Table Size in the ZPS Configuration Editor (the default number is 4). Note 3: Many of the security settings and keys that are set up using the above functions can alternatively be pre-configured via the ZPS Configuration Editor. 122 NXP Laboratories UK 2017 JN-UG-3101 v1.5

123 ZigBee PRO Stack ZPS_vAplSecSetInitialSecurityState ZPS_teStatus ZPS_vAplSecSetInitialSecurityState( ZPS_teZdoNwkKeyState estate, uint8 *pu8key, uint8 u8keyseqnum ZPS_teApsLinkKeyType ekeytype); Description This function is used to configure the initial state of ZigBee security on the local node. This requires a security key to be specified that will be used in setting up networklevel security. Note that before using this function, security must be enabled on the node via the device parameter Security Enabled in the ZPS Configuration Editor. You must provide a pointer to a security key of one of the following types: Default network key (only relevant to Trust Centre) Pre-configured network key Pre-configured link key These keys are described in Section It is also possible to specify no network key. This option is required when the node is in a network for which a default network key has been defined on the Trust Centre. Note: When this function is called on the Trust Centre, if a default network key is selected but the parameter pu8key is set to a NULL pointer, the Trust Centre will generate a random network key. Parameters You must also specify the sequence number for a default or pre-configured network key (this number is used to uniquely identify the key). A ZigBee Light Link (ZLL) network supports both the ZLL and Home Automation (HA) joining mechanisms. This function must therefore be called twice: 1. Register the HA global link key with the state ZPS_ZDO_PRECONFIGURED_LINK_KEY and the type ZPS_APS_GLOBAL_LINK_KEY. 2. Register the ZLL key (production or test) with the state ZPS_ZDO_ZLL_LINK_KEY and the type ZPS_APS_GLOBAL_LINK_KEY. estate pu8key The state of the key, one of: ZPS_ZDO_NO_NETWORK_KEY ZPS_ZDO_PRECONFIGURED_NETWORK_KEY ZPS_ZDO_DEFAULT_NETWORK_KEY ZPS_ZDO_PRECONFIGURED_LINK_KEY ZPS_ZDO_ZLL_LINK_KEY Pointer to key JN-UG-3101 v1.5 NXP Laboratories UK

124 Chapter 6 ZigBee Device Objects (ZDO) API u8keyseqnum ekeytype Sequence number of specified network key (parameter is ignored when specifying a link key) Type of key, one of: ZPS_APS_UNIQUE_LINK_KEY ZPS_APS_GLOBAL_LINK_KEY (parameter is ignored when not specifying a link key) Returns ZPS_E_SUCCESS (security state successfully initialised) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

125 ZigBee PRO Stack ZPS_eAplZdoTransportNwkKey ZPS_teStatus ZPS_eAplZdoTransportNwkKey( uint8 u8dstaddrmode, ZPS_tuAddress udstaddress, uint8 au8key[zps_sec_key_length], uint8 u8keyseqnum, bool buseparent, uint64 u64parentaddr); Description This function can be used on the Trust Centre to send the network key to one or multiple nodes. On reaching the target node(s), the key is only stored but can be subsequently designated the active network key using the function ZPS_eAplZdoSwitchKeyReq(). The target node can be specified by means of its network address or IEEE/MAC address. A broadcast to multiple nodes in the network can be achieved by specifying a special network address or IEEE/MAC address - see Section 8.3. If the destination is a single node, it is possible to send the key to the parent of the destination node. Note that this function will also reset the frame counter on the target node(s). Parameters u8dstaddrmode udstaddress au8key[] u8keyseqnum buseparent u64parentaddr Type of destination address: ZPS_E_ADDR_MODE_SHORT - 16-bit network address ZPS_E_ADDR_MODE_IEEE - 64-bit IEEE/MAC address All other values are reserved Destination address (address type as specified through u8dstaddrmode) - special broadcast addresses are detailed in Section 8.3 Array containing the network key to be transported. This array has a length equal to ZPS_SEC_KEY_LENGTH Sequence number of the specified key Indicates whether to send key to parent of target node: TRUE - send to parent FALSE - do not send to parent 64-bit IEEE/MAC address of parent (if used) Returns ZPS_E_SUCCESS (key successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

126 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoSwitchKeyReq ZPS_teStatus ZPS_eAplZdoSwitchKeyReq( uint8 u8dstaddrmode, ZPS_tuAddress udstaddress, uint8 u8keyseqnum); Description This function can be used (normally by the Trust Centre) to request one or multiple nodes to switch to a different active network key. The new network key is specified using its unique sequence number and the key must have been pre-loaded into the target node(s) using the function ZPS_eAplZdoTransportNwkKey() or ZPS_eAplZdoRequestKeyReq(). The target node can be specified by means of its network address or IEEE/MAC address. A broadcast to multiple nodes in the network can be achieved by specifying a special network address or IEEE/MAC address - see Section 8.3. Parameters u8dstaddrmode udstaddress u8keyseqnum Type of destination address: ZPS_E_ADDR_MODE_SHORT - 16-bit network address ZPS_E_ADDR_MODE_IEEE - 64-bit IEEE/MAC address All other values are reserved Destination address (address type as specified through u8dstaddrmode) - special broadcast addresses are detailed in Section 8.3 Sequence number of new network key to adopt Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

127 ZigBee PRO Stack ZPS_eAplZdoRequestKeyReq ZPS_teStatus ZPS_eAplZdoRequestKeyReq( uint8 u8keytype, uint64 u64ieeepartneraddr); Description Parameters This function can be used to request an application link key or network key from the Trust Centre: Application link key: This key will be used to encrypt/decrypt communications with another partner node. The IEEE/MAC address of this partner node must be specified as part of the function call. The Trust Centre will respond by sending the application link key to both the local node and the partner node. When it arrives, this key will be automatically saved by the stack and the event ZPS_EVENT_ZDO_LINK_KEY will be generated once the link key has been installed and is ready to be used. Network key: This key can be used to encrypt/decrypt communications with all network nodes. The Trust Centre will respond by sending the network key to the requesting node. When it arrives, the key will be automatically saved by the stack but not implemented (the key can be activated from the Trust Centre using the function ZPS_eAplZdoSwitchKeyReq()). In the case of requesting a network key, the function parameter u64ieeepartneraddr is ignored. u8keytype u64ieeepartneraddr Type of key to request: 1 - network key 2 - application link key All other values reserved 64-bit IEEE/MAC address of partner node (for link key only) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

128 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoAddReplaceLinkKey ZPS_teStatus ZPS_eAplZdoAddReplaceLinkKey( uint64 u64ieeeaddr, uint8 au8key[zps_sec_key_length], ZPS_teApsLinkKeyType ekeytype); Description This function can be used to introduce or replace the application link key on the local node, where this key will be used to encrypt and decrypt communications with the specified partner node. The function must be called on both the local node and the partner node. Note that the Trust Centre s record of the application link key for this pair of nodes remains unchanged. If the JenOS Persistent Data Manager (PDM) module is enabled, this function will also save the application link key to Non-Volatile Memory. This allows the key to be automatically recovered during a subsequent cold start (e.g. following a power failure). Parameters u64ieeeaddr au8key[] ekeytype 64-bit IEEE/MAC address of partner node for which the specified link key is valid Array containing the link key to be added/replaced. This array has a length equal to ZPS_SEC_KEY_LENGTH The type of the key, one of: ZPS_APS_UNIQUE_LINK_KEY ZPS_APS_GLOBAL_LINK_KEY Returns ZPS_E_SUCCESS (link key successfully installed) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

129 ZigBee PRO Stack ZPS_eAplZdoRemoveLinkKey ZPS_teStatus ZPS_eAplZdoRemoveLinkKey( uint64 u64ieeeaddr); Description This function can be used to remove the current application link key that is used to encrypt and decrypt communications between the local node and the specified partner node. The function must be called on both the local node and the partner node. Note that the Trust Centre s record of the application link key for this pair of nodes remains unchanged. In the absence of an application link key, communications between these nodes will subsequently be secured using the network key. Parameters u64ieeeaddr 64-bit IEEE/MAC address of partner node for which the link key is to be removed Returns ZPS_E_SUCCESS (link key successfully removed) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

130 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoRemoveDeviceReq ZPS_teStatus ZPS_eAplZdoRemoveDeviceReq( uint64 u64parentaddr, uint64 u64childaddr); Description This function can be used (normally by the Co-ordinator/Trust Centre) to request another node (such as a Router) to remove one of its children from the network (for example, if the child node does not satisfy security requirements). The Router receiving this request will ignore the request unless it has originated from the Trust Centre or is a request to remove itself. If the request was sent without APS layer encryption, the device will ignore the request. If APS layer security is not in use, the alternative function ZPS_eAplZdoLeaveNetwork() should be used. Parameters u64parentaddr u64childaddr 64-bit IEEE/MAC address of parent to be instructed 64-bit IEEE/MAC address of child node to be removed Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

131 ZigBee PRO Stack ZPS_eAplZdoSetDevicePermission void ZPS_eAplZdoSetDevicePermission( ZPS_teDevicePermissions u8devicepermissions); Description This function can be used on any device to set the permissions for certain requests from other nodes. The possible settings are: Allow all requests from all other nodes (ALL_PERMITED) Do not allow join requests from all other nodes (JOIN_DISALLOWED) Do not allow data requests from all other nodes (DATA_REQUEST_DISALLOWED) The function is particularly useful in disabling the generation of APS (end-to-end) acknowledgements, using DATA_REQUEST_DISALLOWED. Parameters u8devicepermissions Bitmap of permissions to be set, constructed using the following enumerations: ZPS_DEVICE_PERMISSIONS_ALL_PERMITED ZPS_DEVICE_PERMISSIONS_JOIN_DISALLOWED ZPS_DEVICE_PERMISSIONS_DATA_REQUEST_DISALLOWED Returns ZPS_E_SUCCESS (permissions successfully set) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

132 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_bAplZdoTrustCenterSetDevicePermissions ZPS_teStatus ZPS_bAplZdoTrustCenterSetDevicePermissions( uint64 u64deviceaddr, ZPS_teTCDevicePermissions u8devicepermissions); Description Parameters This function can be used by the Trust Centre to set the permissions for certain requests from a particular node. The possible settings are: Allow all requests from the specified node (ALL_PERMITED) Do not allow join requests from the specified node (JOIN_DISALLOWED) Do not allow data requests from the specified node (DATA_REQUEST_DISALLOWED) u64deviceaddr 64-bit IEEE/MAC address of node for which permissions are to be set u8devicepermissions Bitmap of permissions to be set, constructed using the following enumerations: ZPS_TRUST_CENTER_ALL_PERMITED ZPS_TRUST_CENTER_JOIN_DISALLOWED ZPS_TRUST_CENTER_DATA_REQUEST_DISALLOWED Returns ZPS_E_SUCCESS (permissions successfully set) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

133 ZigBee PRO Stack ZPS_bAplZdoTrustCenterGetDevicePermissions ZPS_teStatus ZPS_bAplZdoTrustCenterGetDevicePermissions( uint64 u64deviceaddr, ZPS_teTCDevicePermissions *pu8devicepermissions); Description Parameters This function can be used by the Trust Centre to obtain its own permissions for certain requests from a particular node. The possible settings are: Allow all requests from the specified node Do not allow join requests from the specified node Do not allow data requests from the specified node u64deviceaddr pu8devicepermissions 64-bit IEEE/MAC address of node for which permissions are to be obtained Pointer to bitmap containing permissions obtained, where: 0 indicates all requests allowed 1 indicates join requests disallowed 2 indicates data requests disallowed 3 indicates data and join requests disallowed Higher bits are reserved for future use Returns ZPS_E_SUCCESS (permissions successfully obtained) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

134 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_bAplZdoTrustCenterRemoveDevice ZPS_teStatus ZPS_bAplZdoTrustCenterRemoveDevice( uint64 u64deviceaddr); Description This function can be used by the Trust Centre to delete a node in its information base. Parameters u64deviceaddr 64-bit IEEE/MAC address of node to be removed from list Returns ZPS_E_SUCCESS (node successfully removed from list) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

135 ZigBee PRO Stack ZPS_vTCSetCallback void ZPS_vTCSetCallback(void *pcallbackfn); Description This function can be used to register a user-defined callback function on the Trust Centre, where this callback function allows the application to react to a notification from another network node - for example, to decide whether to permit a node to join that may or may not be known to the Trust Centre application. The prototype of the user-defined callback function is: bool_t btransportkeydecider(uint16 u16shortaddr, uint64 u64deviceaddress, uint64 u64parentaddress, uint8 u8status); where: u16shortaddr is the network address of the relevant node u64deviceaddress is the IEEE/MAC address of the relevant node u64parentaddress is the IEEE/MAC address of the parent that sent the notification u8status is the nature of the notification: 0: Secure rejoin 1: Unsecure join (association) 2: Leave 3: Unsecure rejoin To disallow the notified action (e.g. a join), the callback function should return FALSE. If the callback function is not registered or returns TRUE, the Trust Centre will allow the notified action. In the case of a join, the Trust Centre will send the network key in a transport key command to the node, either: encrypted with the node s pre-configured link key, if this key is known to the Trust Centre, or encrypted with the Trust Centre s default pre-configured link key otherwise (in this case, the joining node will only be able to decrypt the transport key command and complete the join if it also has the Trust Centre s default pre-configured link key) Registration of this callback function may be useful in controlling rejoins. A node can initially join a network using its pre-configured link key (which is also known by the Trust Centre), but this key may subsequently be replaced on the Trust Centre by an application link key (shared only by the node and the Trust Centre). If the node later leaves the network and loses its context data (including the application link key), it may attempt to rejoin the network using its pre-configured link key again. The callback function can allow the application to decide whether to permit such a rejoin. If the rejoin is to be allowed, the callback function must replace the stored application link key with the pre-configured link key on the Trust Centre before returning TRUE. Parameters pcallbackfn Pointer to user-defined callback function JN-UG-3101 v1.5 NXP Laboratories UK

136 Chapter 6 ZigBee Device Objects (ZDO) API Returns None 136 NXP Laboratories UK 2017 JN-UG-3101 v1.5

137 ZigBee PRO Stack Addressing Functions The ZDO Addressing functions allow node addresses to be stored and obtained. They include the group address functions that allow a group of nodes/endpoints, with an assigned group address, to be created and modified (this group can be used as the destinations for a multicast message). The functions are listed below, along with their page references: Function Page ZPS_u16AplZdoGetNwkAddr 138 ZPS_u64AplZdoGetIeeeAddr 139 ZPS_eAplZdoAddAddrMapEntry 140 ZPS_u16AplZdoLookupAddr 142 ZPS_u64AplZdoLookupIeeeAddr 143 ZPS_u64NwkNibGetMappedIeeeAddr 144 ZPS_bNwkFindAddIeeeAddr 145 ZPS_vSetOverrideLocalIeeeAddr 146 ZPS_eAplZdoGroupEndpointAdd 147 ZPS_eAplZdoGroupEndpointRemove 148 ZPS_eAplZdoGroupAllEndpointRemove 149 Note: Further addressing functions are provided in the ZDP API and are described in Section JN-UG-3101 v1.5 NXP Laboratories UK

138 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_u16AplZdoGetNwkAddr uint16 ZPS_u16AplZdoGetNwkAddr(void); Description This function obtains the 16-bit network address of the local node. Parameters None Returns 16-bit network address obtained 138 NXP Laboratories UK 2017 JN-UG-3101 v1.5

139 ZigBee PRO Stack ZPS_u64AplZdoGetIeeeAddr uint64 ZPS_u64AplZdoGetIeeeAddr(void); Description This function obtains the 64-bit IEEE (MAC) address of the local node. Parameters None Returns 64-bit IEEE/MAC address obtained JN-UG-3101 v1.5 NXP Laboratories UK

140 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoAddAddrMapEntry ZPS_teStatus ZPS_eAplZdoAddAddrMapEntry( uint16 u16nwkaddr, uint64 u64extaddr); Description This function can be used to add the addresses of a remote node to the local Address Map table. Each entry in this table stores a remote node s 16-bit network address and an index to its 64-bit IEEE (MAC) address in the MAC Address table (see Section 2.2.4). Thus, the function adds the IEEE address to the MAC Address table and then the index of this entry to the Address Map table. Caution: You should only modify to the Address Map table using the supplied API functions and never write to it directly. Parameters u16nwkaddr u64extaddr 16-bit network address of node to be added 64-bit IEEE/MAC address of node to be added Returns ZPS_E_SUCCESS (addresses successfully added to tables) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

141 ZigBee PRO Stack ZPS_vPurgeAddressMap void ZPS_vPurgeAddressMap(void); Description This function removes all entries from the Address Map table on the local node. Caution: You should only modify to the Address Map table using the supplied API functions and never write to it directly. Parameters None Returns None JN-UG-3101 v1.5 NXP Laboratories UK

142 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_u16AplZdoLookupAddr uint16 ZPS_u16AplZdoLookupAddr(uint64 u64extaddr); Description This function can be used to search the local Address Map table for the 16-bit network address of the node with a given 64-bit IEEE (MAC) address. Parameters u64extaddr 64-bit IEEE/MAC address of node to be search for Returns 16-bit network address obtained 142 NXP Laboratories UK 2017 JN-UG-3101 v1.5

143 ZigBee PRO Stack ZPS_u64AplZdoLookupIeeeAddr uint64 ZPS_u64AplZdoLookupIeeeAddr( uint16 u16nwkaddr); Description This function can be used to search the local Address Map table for the 64-bit IEEE (MAC) address of the node with a given 16-bit network address. Parameters u16nwkaddr 16-bit network address of node to be search for Returns 64-bit IEEE/MAC address obtained JN-UG-3101 v1.5 NXP Laboratories UK

144 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_u64NwkNibGetMappedIeeeAddr uint64 ZPS_u64NwkNibGetMappedIeeeAddr( void *pvnwk, uint16 u16location); Description This function can be used to obtain the 64-bit IEEE (MAC) address that is stored in a particular entry in the local MAC Address table. The number of the entry must be specified as well as the handle of the relevant network. Parameters pvnwk u16location Pointer to relevant NWK layer instance Number of entry to access in MAC Address table Returns 64-bit IEEE/MAC address obtained 144 NXP Laboratories UK 2017 JN-UG-3101 v1.5

145 ZigBee PRO Stack ZPS_bNwkFindAddIeeeAddr bool_t ZPS_bNwkFindAddIeeeAddr( void *pvnwk, uint64 u64ieeeaddr, uint16 *pu16location, bool_t bneighbortable; Description This function can be used to add the 64-bit IEEE (MAC) address of a node to the local MAC Address table. The function will first search the table to determine whether the address already exists in the table. If there is no entry for this address, a new entry for it will be added to the table. The number of the entry where the address was found or added is returned in a specified location. Caution: You should only modify to the MAC Address table using this API function and never write to it directly. Parameters pvnwk u64ieeeaddr pu16location bneighbortable Pointer to relevant NWK layer instance 64-bit IEEE/MAC address to be added Pointer to location to receive number of entry in MAC Address table where specified address was found or added Always set to FALSE Returns Boolean indicating the outcome of the operation: TRUE - address successfully added to the table FALSE - address found to already exist in the table JN-UG-3101 v1.5 NXP Laboratories UK

146 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_vSetOverrideLocalIeeeAddr void ZPS_vSetOverrideLocalIeeeAddr( uint64 *pu64address); Description This function can be used to over-ride the 64-bit IEEE (MAC) address of a JN516x device, where this address is stored locally in the index sector of Flash memory. Caution: If required, this function must be called before the ZigBee PRO stack is initialised. Parameters pu64address Pointer to the 64-bit IEEE MAC address Caution: The stack stores a pointer to pu64address and does not take a copy of the address. The memory pointed to by pu64address must therefore be static or constant, and must not be on the CPU stack. 146 NXP Laboratories UK 2017 JN-UG-3101 v1.5

147 ZigBee PRO Stack ZPS_eAplZdoGroupEndpointAdd ZPS_teStatus ZPS_eAplZdoGroupEndpointAdd( uint16 u16groupaddr, uint8 u8dstendpoint); Description This function requests that the specified endpoint (on the local node) is added to the group with the specified group address. This means that this endpoint will become one of the destinations for messages sent to the given group address. To form a group comprising endpoints from different nodes, it is necessary to call this function for each endpoint individually, on the endpoint s local node. An endpoint can belong to more than one group. Information on the endpoints in a group can be obtained from the Group Address table in the AIB (which can be accessed using the function ZPS_psAplAibGetAib()). Note: In order to add an endpoint to a group using this function, a Group Address table must exist on the local node. This table is created using the ZPS Configuration Editor. Parameters u16groupaddr u8dstendpoint 16-bit group address Number of destination endpoint (1-240) on local node Returns ZPS_E_SUCCESS (endpoint successfully added to group) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

148 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoGroupEndpointRemove ZPS_teStatus ZPS_eAplZdoGroupEndpointRemove( uint16 u16groupaddr, uint8 u8dstendpoint); Description This function requests that the specified endpoint (on the local node) is removed from the group with the specified group address. If you wish to remove an endpoint from all groups to which it belongs, use the function ZPS_eAplZdoGroupAllEndpointRemove(). Information on the endpoints in a group can be obtained from the Group Address table in the AIB (which can be accessed using the function ZPS_psAplAibGetAib()). Parameters u16groupaddr u8dstendpoint 16-bit group address Number of destination endpoint (1-240) on local node Returns ZPS_E_SUCCESS (endpoint successfully removed from group) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

149 ZigBee PRO Stack ZPS_eAplZdoGroupAllEndpointRemove ZPS_teStatus ZPS_eAplZdoGroupAllEndpointRemove( uint8 u8dstendpoint); Description This function requests that the specified endpoint (on the local node) is removed from all groups to which it currently belongs. Information on the endpoints in a group can be obtained from the Group Address table in the AIB (which can be accessed using the function ZPS_psAplAibGetAib()). Parameters u8dstendpoint Number of destination endpoint (1-240) on local node Returns ZPS_E_SUCCESS (endpoint successfully removed from all groups) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

150 Chapter 6 ZigBee Device Objects (ZDO) API Routing Functions The ZDO Routing functions can be used to make route discovery requests. The functions are listed below, along with their page references: Function Page ZPS_eAplZdoRouteRequest 151 ZPS_eAplZdoManyToOneRouteRequest NXP Laboratories UK 2017 JN-UG-3101 v1.5

151 ZigBee PRO Stack ZPS_eAplZdoRouteRequest ZPS_teStatus ZPS_eAplZdoRouteRequest( uint16 u16dstaddr, uint8 u8radius); Description This function requests the discovery of a route to the specified remote node (and that this route is added to the Routing tables in the relevant Router nodes). Parameters u16dstaddr u8radius 16-bit network address of destination node Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Returns ZPS_E_SUCCESS (route discovery request successfully initiated) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

152 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoManyToOneRouteRequest ZPS_teStatus ZPS_eAplZdoManyToOneRouteRequest( bool bcacheroute, uint8 u8radius); Description This function requests a many-to-one route discovery and should be called on a node that will act as a concentrator in the network (that is, a node with which many other nodes will need to communicate). As a result of this function call, a route discovery message is broadcast across the network and Routing table entries (for routes back to the concentrator) are stored in the Router nodes. The maximum number of hops to be taken by a route discovery message in this broadcast must be specified. There is also an option to store the discovered routes in a Route Record Table on the concentrator (for return communications). Parameters bcacheroute u8radius Indicates whether to store routes in Route Record Table: TRUE - store routes FALSE - do not store routes Maximum number of hops of route discovery message (zero value specifies that default maximum is to be used) Returns ZPS_E_SUCCESS (many-to-one route discovery successfully initiated) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

153 ZigBee PRO Stack Object Handle Functions The ZDO Object Handle functions can be used to obtain the handles of various objects. The functions are listed below, along with their page references: Function Page ZPS_pvAplZdoGetAplHandle 154 ZPS_pvAplZdoGetMacHandle 155 ZPS_pvAplZdoGetNwkHandle 156 ZPS_psNwkNibGetHandle 157 ZPS_psAplAibGetAib 158 ZPS_psAplZdoGetNib 159 ZPS_u64NwkNibGetEpid 160 JN-UG-3101 v1.5 NXP Laboratories UK

154 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_pvAplZdoGetAplHandle void *ZPS_pvAplZdoGetAplHandle(void); Description This function obtains a handle for the Application layer instance. Parameters None Returns Pointer to Application layer instance 154 NXP Laboratories UK 2017 JN-UG-3101 v1.5

155 ZigBee PRO Stack ZPS_pvAplZdoGetMacHandle void *ZPS_pvAplZdoGetMacHandle(void); Description This function obtains a handle for the IEEE MAC layer instance. Parameters None Returns Pointer to MAC layer instance JN-UG-3101 v1.5 NXP Laboratories UK

156 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_pvAplZdoGetNwkHandle void *ZPS_pvAplZdoGetNwkHandle(void); Description This function obtains a handle for the ZigBee NWK layer instance. Parameters None Returns Pointer to NWK layer instance 156 NXP Laboratories UK 2017 JN-UG-3101 v1.5

157 ZigBee PRO Stack ZPS_psNwkNibGetHandle ZPS_tsNwkNib *ZPS_psNwkNibGetHandle(void *pvnwk); Description Parameters This function obtains a handle for the NIB (Network Information Base) corresponding to the specified NWK layer instance. The function should be called after ZPS_pvAplZdoGetNwkHandle(), which is used to obtain a pointer to the NWK layer instance. The NIB is detailed in the ZigBee Specification (05347) from the ZigBee Alliance. This function is not strictly a ZDO function. pvnwk Pointer to NWK layer instance Returns Pointer to NIB structure Example void *pvnwk; = ZPS_pvAplZdoGetNwkHandle(); ZPS_tsNwkNib *pnib = ZPS_psNwkNibGetHandle(pvNwk); JN-UG-3101 v1.5 NXP Laboratories UK

158 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_psAplAibGetAib ZPS_tsAplAib *ZPS_psAplAibGetAib(void); Description Parameters Returns This function obtains a pointer to the AIB (Application Information Base) structure for the application. None Pointer to AIB structure 158 NXP Laboratories UK 2017 JN-UG-3101 v1.5

159 ZigBee PRO Stack ZPS_psAplZdoGetNib ZPS_tsNwkNib *ZPS_psAplZdoGetNib(void); Description This function obtains a pointer to the NIB (Network Information Base) structure. The NIB is detailed in the ZigBee Specification (05347) from the ZigBee Alliance. Parameters None Returns Pointer to NIB structure JN-UG-3101 v1.5 NXP Laboratories UK

160 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_u64NwkNibGetEpid uint64 ZPS_u64NwkNibGetEpid(void *pvnwk); Description This function can be used to obtain the Extended PAN ID (EPID) from a local NIB (Network Information Base). The handle of the NWK layer instance that contains the relevant NIB must be specified. This handle can be obtained using ZPS_pvAplZdoGetNwkHandle(). Parameters pnibhandle Pointer to NWK layer instance that contains the NIB Returns 64-bit Extended PAN ID from NIB 160 NXP Laboratories UK 2017 JN-UG-3101 v1.5

161 ZigBee PRO Stack Optional Cluster Function The ZDO Optional Cluster function can be used to register a user-defined callback function to handle messages for a ZDO cluster that is not currently supported by the NXP ZigBee PRO stack. The function is listed below, along with its page reference: Function Page ZPS_eAplZdoRegisterZdoFilterCallback 162 JN-UG-3101 v1.5 NXP Laboratories UK

162 Chapter 6 ZigBee Device Objects (ZDO) API ZPS_eAplZdoRegisterZdoFilterCallback ZPS_teStatus ZPS_eAplZdoRegisterZdoFilterCallback( void *fnptr); Description This function can be used to register a user-defined callback function which handles messages received for an unsupported cluster which resides on the ZDO endpoint (0), such as the cluster for an optional descriptor (e.g. user descriptor). The prototype of the user-defined callback function is: bool fn(uint16 clusterid); where clusterid is the ID of the cluster that the function handles. Normally, a message arriving for an unsupported ZDO cluster is not handled and the stack automatically returns an unsupported message to the originating node. If this function is used to register a callback function for an unsupported ZDO cluster then on receiving a message for the cluster, the stack will invoke the callback function. The stack will not respond with an unsupported message provided that the callback function returns TRUE, otherwise the normal stack behaviour will continue. The callback function allows the received message to be passed to the application for servicing. Parameters fnptr Pointer to user-defined callback function Returns ZPS_E_SUCCESS (callback function successfully registered) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

163 ZigBee PRO Stack 6.2 ZDO Enumerations This section details the enumerated types used by the ZDO functions. These are all defined in the header file zps_apl_zdo.h Security Keys (ZPS_teZdoNwkKeyState) This structure ZPS_teZdoNwkKeyState contains the enumerations used to specify a type of security key: typedef enum { ZPS_ZDO_NO_NETWORK_KEY, ZPS_ZDO_PRECONFIGURED_NETWORK_KEY, ZPS_ZDO_DEFAULT_NETWORK_KEY, ZPS_ZDO_PRECONFIGURED_LINK_KEY, ZPS_ZDO_ZLL_LINK_KEY } PACK ZPS_teZdoNwkKeyState; These enumerations are described in the table below: Enumeration ZPS_ZDO_NO_NETWORK_KEY ZPS_ZDO_PRECONFIGURED_NETWORK_KEY ZPS_ZDO_DEFAULT_NETWORK_KEY ZPS_ZDO_PRECONFIGURED_LINK_KEY ZPS_ZDO_ZLL_LINK_KEY Description No network key is to be used. A pre-configured network key is to be used. This key may be fixed at the time of manufacture. The default network key is to be used. This key is randomly generated by the Trust Centre. A pre-configured link key is to be used. This key may be fixed at the time of manufacture. A pre-configured ZigBee Light Link (ZLL) link key is to be used. This key may be fixed at the time of manufacture. A ZLL node will contain both a ZPS_ZDO_PRECONFIGURED_LINK_KEY for Home Automation (HA) compatibility and a ZPS_ZDO_ZLL_LINK_KEY for ZLL networks. Table 3: Security Key Enumerations JN-UG-3101 v1.5 NXP Laboratories UK

164 Chapter 6 ZigBee Device Objects (ZDO) API Device Types (ZPS_teZdoDeviceType) This structure ZPS_teZdoDeviceType contains the enumerations used to specify a ZigBee device type typedef enum { ZPS_ZDO_DEVICE_COORD, ZPS_ZDO_DEVICE_ROUTER, ZPS_ZDO_DEVICE_ENDDEVICE } PACK ZPS_teZdoDeviceType; These enumerations are described in the table below. Enumeration ZPS_ZDO_DEVICE_COORD ZPS_ZDO_DEVICE_ROUTER ZPS_ZDO_DEVICE_ENDDEVICE Description Co-ordinator Router End Device Table 4: Device Type Enumerations Device Permissions (ZPS_teDevicePermissions) This structure ZPS_teDevicePermissions contains the enumerations used on a device to specify the permissions for certain requests from other nodes: typedef enum { ZPS_DEVICE_PERMISSIONS_ALL_PERMITED = 0, ZPS_DEVICE_PERMISSIONS_JOIN_DISALLOWED = 1, ZPS_DEVICE_PERMISSIONS_DATA_REQUEST_DISALLOWED = 2 } PACK ZPS_teDevicePermissions; These enumerations are described in the table below: Enumeration ZPS_DEVICE_PERMISSIONS_ALL_PERMITED ZPS_DEVICE_PERMISSIONS_JOIN_DISALLOWED ZPS_DEVICE_PERMISSIONS_DATA_REQUEST_DISALLOWED Description Allow all requests from other nodes Do not allow join requests from other nodes Do not allow data requests from other nodes and disable end-to-end acknowledgements Table 5: Device Permissions Enumerations 164 NXP Laboratories UK 2017 JN-UG-3101 v1.5

165 ZigBee PRO Stack Trust Centre Permissions (ZPS_teTCDevicePermissions) This structure ZPS_teTCDevicePermissions contains the enumerations used on the Trust Centre to specify the permissions for certain requests from a node: typedef enum { ZPS_TRUST_CENTER_ALL_PERMITED = 0, ZPS_TRUST_CENTER_JOIN_DISALLOWED = 1, ZPS_TRUST_CENTER_DATA_REQUEST_DISALLOWED = 2 } PACK ZPS_teTCDevicePermissions; These enumerations are described in the table below: Enumeration ZPS_TRUST_CENTER_ALL_PERMITED ZPS_TRUST_CENTER_JOIN_DISALLOWED ZPS_TRUST_CENTER_DATA_REQUEST_DISALLOWED Description Allow all requests from node Do not allow join requests from node Do not allow key requests from node and disable end-to-end acknowledgements Table 6: Trust Centre Permissions Enumerations JN-UG-3101 v1.5 NXP Laboratories UK

166 Chapter 6 ZigBee Device Objects (ZDO) API 166 NXP Laboratories UK 2017 JN-UG-3101 v1.5

167 ZigBee PRO Stack 7. Application Framework (AF) API The chapter describes the resources of the Application Framework (AF) API. This API is concerned with transmitting data, controlling/monitoring local endpoints, and copying descriptors to/from the context area of the stack. The API is defined in the header file zps_apl_af.h. In this chapter: Section 7.1 details the AF API functions Section 7.2 details the AF API structures 7.1 AF API Functions The AF API functions are divided into the following categories: Initialisation functions, described in Section Data Transfer functions, described in Section Endpoint functions, described in Section Descriptor functions, described in Section Initialisation Functions The AF API contains a number of initialisation/set-up functions. The functions are listed below, along with their page references: Function Page ZPS_eAplAfInit 168 ZPS_eAplAibSetApsUseExtendedPanId 169 ZPS_vExtendedStatusSetCallback 170 ZPS_bAppAddBeaconFilter 171 ZPS_vAplAfEnableMcpsFilter 172 ZPS_vNwkLinkCostCallbackRegister 173 ZPS_vSetOrphanUpdateDisable 174 Note: The function ZPS_eAplAfInit() is mandatory and must be the first network function called in your application. JN-UG-3101 v1.5 NXP Laboratories UK

168 Chapter 7 Application Framework (AF) API ZPS_eAplAfInit ZPS_teStatus ZPS_eAplAfInit(void); Description This function initialises the Application Framework and must be the first network function called in your application code. The function will first request a reset of the Network (NWK) layer of the ZigBee PRO stack. It will then initialise certain network parameters with values that have been pre-configured using the ZPS Configuration Editor (see Chapter 12). These parameters include the node type and the Extended PAN ID of the network. Note: This function also resets the IEEE MAC and PHY levels of the stack. Therefore, if any customised MAC or PHY settings are required, these must be made after this function has been called (such settings could be made with the Stack API and/or the JN516x Integrated Peripherals API, which are supplied in the JN516x SDKs). The device will be started as the pre-configured node type. If this is a Co-ordinator, the Extended PAN ID of the node is set to the pre-configured value. Note that if a zero value has been specified, the Co-ordinator will use its own IEEE/MAC address for the Extended PAN ID. Parameters None Returns ZPS_E_SUCCESS (AF successfully initialised) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

169 ZigBee PRO Stack ZPS_eAplAibSetApsUseExtendedPanId ZPS_teStatus ZPS_eAplAibSetApsUseExtendedPanId( uint64 u64useextpanid); Description Parameters This function can be used to create an application record of the Extended PAN ID (EPID) of the network to which the local device belongs. The only use of this function for a Co-ordinator is described in Section The function should only be called on a Router or End Device in the manner described in Section u64useextpanid Extended PAN ID of network to which device belongs Returns ZPS_E_SUCCESS (Extended PAN ID record successfully created) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

170 Chapter 7 Application Framework (AF) API ZPS_vExtendedStatusSetCallback void ZPS_vExtendedStatusSetCallback( tpfextendedstatuscallback pfextendedstatuscallback); Description This function can be used to register a callback function for extended error handling (see Section 5.7). The prototype of the callback function is: ZPS_teExtendedStatus vextendedstatuscb(); The registered callback function will be invoked if a subsequent API function call results in one of the following errors: 0xA3: ZPS_APL_APS_E_ILLEGAL_REQUEST 0xA6: ZPS_APL_APS_E_INVALID_PARAMETER 0xC2: ZPS_NWK_ENUM_INVALID_REQUEST The callback function will return another error code (from those listed and described in Section 9.2.5) which provides a more specific reason for the error. Parameters pfextendedstatuscallback Pointer to extended error handling callback function to be registered Returns None 170 NXP Laboratories UK 2017 JN-UG-3101 v1.5

171 ZigBee PRO Stack ZPS_bAppAddBeaconFilter void ZPS_bAppAddBeaconFilter( tsbeaconfiltertype *psappbeaconstruct); Description This function can be used to introduce a filter that will be used for filtering beacons in network searches (on a Router or End Device). Beacons can be filtered on the basis of Extended PAN ID, LQI value, and device joining status/capacity. The filter details are provided in a tsbeaconfiltertype structure (see Section ). If required, this function should be called immediately before ZPS_eAplZdoDiscoverNetworks(), ZPS_eAplZdoRejoinNetwork() or ZPS_eAplZdoStartStack(). Caution: A filter should NOT be implemented unless attempting a join, as this will prevent some stack operations from working correctly. Once the join or discovery has completed, the filter is automatically removed and will need to be re-instated if a retry is required. Guidelines on the implementation of beacon filters are provided in Appendix B.4. Parameters *psappbeaconstruct Pointer to a structure containing the beacon filter details (see Section ) Returns None JN-UG-3101 v1.5 NXP Laboratories UK

172 Chapter 7 Application Framework (AF) API ZPS_vAplAfEnableMcpsFilter void ZPS_vAplAfEnableMcpsFilter( bool_t bmcpsfilterenable, uint8 u8zpsdefaultfiltervalue); Description This function allows packet filtering based on link cost to be enabled/disabled, as well as some basic configuration of the filtering. Packet filtering is enabled by default. The default link cost threshold is 5. This means that when packet filtering is enabled, received packets with a link cost of 5 or less will be discarded by the stack and not queued for processing. The link cost threshold can be modified (from the default value of 5) using this function. If required, this function can be called at any time after ZPS_eAplAfInit(). For more information on packet filtering and link costs, refer to Appendix B.7. Parameters bmcpsfilterenable u8zpsdefaultfiltervalue Enables or disables packet filtering: TRUE - Enable packet filtering FALSE - Disable packet filtering Link cost threshold to be set (only valid when packet filtering is enabled) Returns None 172 NXP Laboratories UK 2017 JN-UG-3101 v1.5

173 ZigBee PRO Stack ZPS_vNwkLinkCostCallbackRegister void ZPS_vNwkLinkCostCallbackRegister(void *pvfn); Description This function can be used to register a user-defined callback function which defines custom mappings between LQI values and link costs that are to be used in packet filtering based on link cost. When packet filtering is enabled, the stack uses a default set of mappings, detailed in Appendix B.7.1. The callback function is only needed if custom mappings are to be used that will over-ride the default mappings. If required, this registration function must be called before ZPS_eAplAfInit(), and on both cold and warm starts. The user-defined callback function to be registered has the following prototype: uint8 APP_u8LinkCost(uint8 u8lqi); This callback function translates a measured LQI value (u8lqi) into a link cost value. An example function is given in Appendix B.7.3. For more information on packet filtering and link costs, refer to Appendix B.7. Parameters pvfn Pointer to user-defined callback function to be registered Returns None JN-UG-3101 v1.5 NXP Laboratories UK

174 Chapter 7 Application Framework (AF) API ZPS_vSetOrphanUpdateDisable void ZPS_vSetOrphanUpdateDisable( bool_t benableoverride); Description This function allows Orphan Notifications to the Trust Centre in a secured ZigBee network to be disabled (they are enabled by default). When an orphaned node tries to rejoin the network, the potential parent sends an Orphan Notification to the Trust Centre. Disabling these notifications on the parent will stop the Trust Centre from authenticating a rejoining node. For more information, refer to Appendix B.8. If required, this function can be called at any time after ZPS_eAplAfInit(). Parameters benableoverride Enables or disables Orphan Notifications: TRUE - Disable notifications FALSE - Enable notifications Returns None 174 NXP Laboratories UK 2017 JN-UG-3101 v1.5

175 ZigBee PRO Stack Data Transfer Functions The AF Data Transfer functions are used to request the transmission of data, in the form of an Application Protocol Data Unit (APDU), to one or more remote nodes. The functions are listed below, along with their page references: Function Page ZPS_eAplAfApsdeDataReq 176 ZPS_eAplAfUnicastDataReq 177 ZPS_eAplAfUnicastIeeeDataReq 179 ZPS_eAplAfUnicastAckDataReq 181 ZPS_eAplAfUnicastIeeeAckDataReq 183 ZPS_eAplAfGroupDataReq 185 ZPS_eAplAfBroadcastDataReq 187 ZPS_eAplAfBoundDataReq 189 ZPS_eAplAfBoundAckDataReq 191 ZPS_eAplAfInterPanDataReq 193 ZPS_u8AplGetMaxPayloadSize 194 Note: Functions for handling APDUs are provided in the JenOS PDUM API, described in the JenOS (JN-UG-3075). APDUs for Requests and Responses A request generated by this API is sent in an APDU (Application Protocol Data Unit). A local APDU instance for the request must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). This function returns a handle for the APDU instance, which is subsequently used in the relevant AF API request function. Once the request has been successfully sent, the APDU instance is automatically deallocated by the stack (there is no need for the application to de-allocate it). Note: If the request is not successfully sent (the send function does not return ZPS_E_SUCCESS) then the APDU instance will not be automatically de-allocated and the application should de-allocate it using the PDUM function PDUM_eAPduFreeAPduInstance(). When a response is subsequently received, the stack automatically allocates a local APDU instance and includes its handle in the notification event for the response. Once the response has been dealt with, the application must de-allocate the APDU instance using the function PDUM_eAPduFreeAPduInstance(). JN-UG-3101 v1.5 NXP Laboratories UK

176 Chapter 7 Application Framework (AF) API ZPS_eAplAfApsdeDataReq ZPS_teStatus ZPS_eAplAfApsdeDataReq( PDUM_thAPduInstance hapduinst, ZPS_tsAfProfileDataReq *psprofiledatareq, uint8 *pu8seqnum); Description This function submits a request to send data to a remote node, with no restrictions on the type of transmission, destination address, destination application profile, destination cluster and destination endpoint number - these destination parameters do not need to be known to the stack or defined in the ZPS configuration. In this sense, this is most general of the Data Transfer functions. The destination details and type of transmission are specified in the function call in a ZPS_tsAfProfileDataReq structure (see Section ). The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). To send large APDUs, use the function ZPS_eAplAfUnicastAckDataReq(), which automatically implements data fragmentation (if required). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. Parameters hapduinst *psprofiledatareq *pu8seqnum Handle of APDU instance to be sent Pointer to structure containing the details for the transmission (see Section ) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

177 ZigBee PRO Stack ZPS_eAplAfUnicastDataReq ZPS_teStatus ZPS_eAplAfUnicastDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint8 u8dstendpoint, uint16 u16destaddr, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to a remote node (unicast), using the remote node s network address. You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint), as well as the network address of the remote node and the destination endpoint on the node. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). To send large APDUs, use the function ZPS_eAplAfUnicastAckDataReq(), which automatically implements data fragmentation (if required). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. If data is sent using this function to a destination for which a route has not already been established, the data will not be sent and a route discovery will be performed instead. In this case, the function will return ZPS_NWK_ENUM_ROUTE_ERROR and must later be re-called to send the data (see Note under Unicast on page 80). Security (encryption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint u8dstendpoint u16dstaddr Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Destination endpoint number (1-240) on remote node Network address of destination node JN-UG-3101 v1.5 NXP Laboratories UK

178 Chapter 7 Application Framework (AF) API esecuritymode u8radius *pu8seqnum Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

179 ZigBee PRO Stack ZPS_eAplAfUnicastIeeeDataReq ZPS_teStatus ZPS_eAplAfUnicastIeeeDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint8 u8dstendpoint, uint64 u64destaddr, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to a remote node (unicast), using the remote node s IEEE (MAC) address. You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint), as well as the IEEE address of the remote node and the destination endpoint on the node. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). To send large APDUs, use the function ZPS_eAplAfUnicastIeeeAckDataReq(), which automatically implements data fragmentation (if required). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. If data is sent using this function to a destination for which a route has not already been established, the data will not be sent and a route discovery will be performed instead. In this case, the function will return ZPS_NWK_ENUM_ROUTE_ERROR and must later be re-called to send the data (see Note under Unicast on page 80). Security (encryption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint u8dstendpoint u64destaddr Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Destination endpoint number (1-240) on remote node IEEE (MAC) address of destination node JN-UG-3101 v1.5 NXP Laboratories UK

180 Chapter 7 Application Framework (AF) API esecuritymode u8radius *pu8seqnum Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

181 ZigBee PRO Stack ZPS_eAplAfUnicastAckDataReq ZPS_teStatus ZPS_eAplAfUnicastAckDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint8 u8dstendpoint, uint16 u16destaddr, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to a remote node (unicast), using the remote node s network address, and requires an acknowledgement to be returned by the remote node once the data reaches its destination. You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint), as well as the network address of the remote node and the destination endpoint on the node. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, the APDU will be broken up into fragments (NPDUs) for transmission, provided that fragmentation has been enabled by setting the ZigBee network parameter Maximum Number of Transmitted Simultaneous Fragmented Messages to a non-zero value. If data is sent using this function to a destination for which a route has not already been established, the data will not be sent and a route discovery will be performed instead. In this case, the function will return ZPS_NWK_ENUM_ROUTE_ERROR and must later be re-called to send the data (see Note under Unicast on page 80). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. Then, once an acknowledgement has been received from the destination node, a ZPS_EVENT_APS_DATA_ACK will be generated on the sending node. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint u8dstendpoint u16dstaddr Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Destination endpoint number (1-240) on remote node Network address of destination node JN-UG-3101 v1.5 NXP Laboratories UK

182 Chapter 7 Application Framework (AF) API esecuritymode u8radius *pu8seqnum Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

183 ZigBee PRO Stack ZPS_eAplAfUnicastIeeeAckDataReq ZPS_teStatus ZPS_eAplAfUnicastIeeeAckDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint8 u8dstendpoint, uint64 u64destaddr, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to a remote node (unicast), using the remote node s IEEE (MAC) address, and requires an acknowledgement to be returned by the remote node once the data reaches its destination. You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint), as well as the IEEE address of the remote node and the destination endpoint on the node. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, the APDU will be broken up into fragments (NPDUs) for transmission, provided that fragmentation has been enabled by setting the ZigBee network parameter Maximum Number of Transmitted Simultaneous Fragmented Messages to a non-zero value. If data is sent using this function to a destination for which a route has not already been established, the data will not be sent and a route discovery will be performed instead. In this case, the function will return ZPS_NWK_ENUM_ROUTE_ERROR and must later be re-called to send the data (see Note under Unicast on page 80). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. Then, once an acknowledgement has been received from the destination node, a ZPS_EVENT_APS_DATA_ACK will be generated on the sending node. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint u8dstendpoint u64destaddr Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Destination endpoint number (1-240) on remote node IEEE (MAC) address of destination node JN-UG-3101 v1.5 NXP Laboratories UK

184 Chapter 7 Application Framework (AF) API esecuritymode u8radius *pu8seqnum Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

185 ZigBee PRO Stack ZPS_eAplAfGroupDataReq ZPS_teStatus ZPS_eAplAfGroupDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint16 u16dstgroupaddr, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to a group of endpoints located on one or more nodes (group multicast). You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint) as well as the group address of the group of destination endpoints. A group is set up using the function ZPS_eAplZdoGroupEndpointAdd(). The data is actually broadcast to all network nodes and each recipient node assesses whether it has endpoints in the specified group. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). Once the data has been transmitted, a ZPS_EVENT_APS_DATA_CONFIRM event will be generated on the local node. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint u16dstgroupaddr esecuritymode u8radius Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Group address of destination endpoints Security mode for data transfer, one of: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) JN-UG-3101 v1.5 NXP Laboratories UK

186 Chapter 7 Application Framework (AF) API *pu8seqnum Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

187 ZigBee PRO Stack ZPS_eAplAfBroadcastDataReq ZPS_teStatus ZPS_eAplAfBroadcastDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, uint8 u8dstendpoint, ZPS_teAplAfBroadcastMode ebroadcastmode, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to all network nodes that conform to the specified broadcast mode. You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint), as well as the destination endpoint(s) on the remote nodes. The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). Following this function call, the APDU may be broadcast up to four times by the source node (in addition, the APDU may be subsequently re-broadcast up to four times by each intermediate routing node). If the transmission is successful, the event ZPS_EVENT_APS_DATA_CONFIRM will be generated on the local node. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node u8dstendpoint Destination endpoint number (1-240) on remote node, or 255 for all endpoints on node ebroadcastmode Type of broadcast, one of: ZPS_E_BROADCAST_ALL (all nodes) ZPS_E_BROADCAST_ALL RX_ON (all nodes with radio receiver permanently enabled) ZPS_E_BROADCAST_ZC_ZR (all Routers and Co-ordinator) JN-UG-3101 v1.5 NXP Laboratories UK

188 Chapter 7 Application Framework (AF) API esecuritymode u8radius *pu8seqnum Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

189 ZigBee PRO Stack ZPS_eAplAfBoundDataReq ZPS_teStatus ZPS_eAplAfBoundDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to all nodes/endpoints to which the source node/endpoint has been previously bound (using the binding functions, described in Section 8.1.3). You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint). The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). Once the sent data has reached the first hop node in the route to its destination(s), a ZPS_EVENT_BIND_REQUEST_SERVER event will be generated on the local node. This event reports the status of the bound transmission, including the number of bound endpoints for which the transmission has failed. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint esecuritymode Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) JN-UG-3101 v1.5 NXP Laboratories UK

190 Chapter 7 Application Framework (AF) API u8radius *pu8seqnum Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL. Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

191 ZigBee PRO Stack ZPS_eAplAfBoundAckDataReq ZPS_teStatus ZPS_eAplAfBoundAckDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint8 u8srcendpoint, ZPS_teAplAfSecurityMode esecuritymode, uint8 u8radius, uint8 *pu8seqnum); Description This function submits a request to send data to all nodes/endpoints to which the source node/endpoint has been previously bound (using the binding functions, described in Section 8.1.3) and requires an acknowledgement to be returned by the remote node(s) once the data reaches its destination(s). You must specify the local endpoint and output cluster from which the data originates (the cluster must be in the Simple descriptor for the endpoint). The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the network, the APDU will be broken up into fragments (NPDUs) for transmission, provided that fragmentation has been enabled by setting the ZigBee network parameter Maximum Number of Transmitted Simultaneous Fragmented Messages to a non-zero value. Once the sent data has reached its final destination node(s), a ZPS_EVENT_BIND_REQUEST_SERVER event will be generated on the local node. This event reports the status of the bound transmission, including the number of bound endpoints for which the transmission has failed. Security (encyption/decryption) can be applied to the APDU, where this security can be implemented at the Application layer or the network (ZigBee) layer, or both. Parameters hapduinst u16clusterid u8srcendpoint esecuritymode Handle of APDU instance to be sent Identifier of relevant output cluster on source endpoint Source endpoint number (1-240) on local node Security mode for data transfer: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) JN-UG-3101 v1.5 NXP Laboratories UK

192 Chapter 7 Application Framework (AF) API u8radius *pu8seqnum ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) Maximum number of hops permitted to destination node (zero value specifies that default maximum is to be used) Pointer to location to receive sequence number assigned to data transfer request. If not required, set to NULL. Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

193 ZigBee PRO Stack ZPS_eAplAfInterPanDataReq ZPS_teStatus ZPS_eAplAfInterPanDataReq( PDUM_thAPduInstance hapduinst, uint16 u16clusterid, uint16 u16profileid, ZPS_tsInterPanAddress *psdstaddr, uint8 u8handle); Description Parameters This function submits a request to send data to one or more nodes in another ZigBee PRO network - that is, to implement an inter-pan transmission. The destination for the data is specified in a structure (detailed in Section ) which contains: PAN ID of destination network (a broadcast to all reachable ZigBee PRO networks can also be configured) Address of destination node (this can be an IEEE/MAC or network address for a single node, a group address for multiple nodes or a broadcast address for all nodes) The data is sent in an Application Protocol Data Unit (APDU) instance, which can be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance() and then written to using PDUM_u16APduInstanceWriteNBO(). If the APDU size is larger than the maximum packet size allowed on the local network, this function call will fail (and return ZPS_E_ADSU_TOO_LONG). Once the sent data has reached the first hop node in the route to its destination, a ZPS_EVENT_APS_INTERPAN_DATA_CONFIRM event will be generated on the local node (in the case of a broadcast or group multicast, this event is simply generated once the data has been sent from the local node). Security (encyption/decryption) cannot be applied to inter-pan transmissions. hapduinst u16clusterid u16profileid psdstaddr u8handle Handle of APDU instance to be sent Identifier of cluster for which data is intended at destination (must be a cluster of the application profile specified below) Identifier of application profile for which data is intended at destination Pointer to stucture containing destination PAN ID and address (see Section ) Handle for internal use (set to any value) Returns ZPS_E_SUCCESS ZPS_APL_APS_E_ILLEGAL_REQUEST MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

194 Chapter 7 Application Framework (AF) API ZPS_u8AplGetMaxPayloadSize uint8 ZPS_u8AplGetMaxPayloadSize(void *pvapl, uint16 u16addr); Description This function obtains the effective payload size, in bytes, within an IEEE data frame to be sent to the node with the specified network address. The handle of the relevant Application layer instance must also be specified, which can be obtained using ZPS_pvAplZdoGetAplHandle(). An IEEE data frame contains 127 bytes, but the effective payload is reduced by the various IEEE and ZigBee headers. The function returns the size of the payload available for data but does not take into account bytes needed for ZCL cluster headers (so may not reflect the exact amount of space available for data). Parameters pvapl u16addr Handle of handle for the Application layer instance 16-bit network address of node to which data is to be sent Returns Number of data frame payload bytes available for data (ignoring ZCL headers) 194 NXP Laboratories UK 2017 JN-UG-3101 v1.5

195 ZigBee PRO Stack Endpoint Functions The AF Endpoint functions are used to control and monitor the states of endpoints on the local node. The functions are listed below, along with their page references: Function Page ZPS_vAplAfSetEndpointState 196 ZPS_eAplAfGetEndpointState 197 ZPS_eAplAfSetEndpointDiscovery 198 ZPS_eAplAfGetEndpointDiscovery 199 JN-UG-3101 v1.5 NXP Laboratories UK

196 Chapter 7 Application Framework (AF) API ZPS_vAplAfSetEndpointState ZPS_teStatus ZPS_eAplAfSetEndpointState( uint8 u8endpoint, bool benabled); Description This function puts the specified endpoint on the local node into the specified state (enabled or disabled). Parameters u8endpoint benabled Endpoint number (on local node) State in which to put endpoint, one of: TRUE: enable endpoint FALSE: disable endpoint Returns ZPS_E_SUCCESS (endpoint state successfully set) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

197 ZigBee PRO Stack ZPS_eAplAfGetEndpointState ZPS_teStatus ZPS_eAplAfGetEndpointState( uint8 u8endpoint, bool *pbenabled); Description This function obtains the current state (enabled or disabled) of the specified endpoint on the local node. Parameters u8endpoint *pbenabled Endpoint number (on local node) Pointer to location to receive endpoint state. The returned state is one of: TRUE: endpoint enabled FALSE: endpoint disabled Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

198 Chapter 7 Application Framework (AF) API ZPS_eAplAfSetEndpointDiscovery ZPS_teStatus ZPS_eAplAfSetEndpointDiscovery( uint8 u8endpoint, uint16 u16clusterid, bool boutput, bool bdiscoverable); Description This function sets the discoverable state of the specified cluster of the specified endpoint on the local node - that is, whether the cluster/endpoint will be included in device discoveries initiated on the network. If the cluster/endpoint is discoverable, it will appear in the Simple descriptor of the local node and will also be included in match results requested using the function ZPS_eAplZdpMatchDescRequest(). The initial discoverable state of the cluster/endpoint is pre-set using the ZPS Configuration Editor (see Chapter 12). Parameters u8endpoint u16clusterid boutput bdiscoverable Endpoint number (on local node) Cluster ID Type of cluster (output or input), one of: TRUE: Output cluster FALSE: Input cluster Discoverable state to set, one of: TRUE: Discoverable FALSE: Not discoverable Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

199 ZigBee PRO Stack ZPS_eAplAfGetEndpointDiscovery ZPS_teStatus ZPS_eAplAfGetEndpointDiscovery( uint8 u8endpoint, uint16 u16clusterid, bool boutput, bool_t *pbdiscoverable); Description This function obtains the discoverable state of the specified cluster of the specified endpoint on the local node - that is, whether the cluster/endpoint will be included in device discoveries initiated on the network. If the cluster/endpoint is discoverable, it will appear in the Simple descriptor of the local node and will also be included in match results requested using the function ZPS_eAplZdpMatchDescRequest(). The initial discoverable state of the cluster/endpoint is pre-set using the ZPS Configuration Editor (see Chapter 12). The state can subsequently be changed at run-time using the function ZPS_eAplAfSetEndpointDiscovery(). Parameters u8endpoint u16clusterid boutput *pbdiscoverable Endpoint number (on local node) Cluster ID Type of cluster (output or input), one of: TRUE: Output cluster FALSE: Input cluster Pointer to location to receive discoverable state, which will be one of: TRUE: Discoverable FALSE: Not discoverable Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

200 Chapter 7 Application Framework (AF) API Descriptor Functions The AF Descriptor functions allow ZigBee descriptors for the local node to be copied to and from the context area of the ZigBee PRO stack. The functions are listed below, along with their page references: Function Page ZPS_eAplAfGetNodeDescriptor 201 ZPS_eAplAfGetNodePowerDescriptor 202 ZPS_eAplAfGetSimpleDescriptor NXP Laboratories UK 2017 JN-UG-3101 v1.5

201 ZigBee PRO Stack ZPS_eAplAfGetNodeDescriptor ZPS_teStatus ZPS_eAplAfGetNodeDescriptor( ZPS_tsAplAfNodeDescriptor *psdesc); Description This function copies the Node descriptor (for the local node) from the context area of the stack to the specified structure (the descriptor is returned through the function s parameter). Parameters *psdesc Pointer to structure (see Section ) to receive Node descriptor Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

202 Chapter 7 Application Framework (AF) API ZPS_eAplAfGetNodePowerDescriptor ZPS_teStatus ZPS_eAplAfGetNodePowerDescriptor( ZPS_tsAplAfNodePowerDescriptor *psdesc); Description This function copies the Node Power descriptor (for the local node) from the context area of the stack to the specified structure (the descriptor is returned through the function s parameter). Parameters *psdesc Pointer to structure (see Section ) to receive Node Power descriptor Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

203 ZigBee PRO Stack ZPS_eAplAfGetSimpleDescriptor ZPS_teStatus ZPS_eAplAfGetSimpleDescriptor( uint8 u8endpoint, ZPS_tsAplAfSimpleDescriptor *psdesc); Description This function copies the Simple descriptor for the specified endpoint (on the local node) from the context area of the stack to the specified structure (the descriptor is returned through the function s parameter). Parameters *psdesc Pointer to structure (see Section ) to receive Simple descriptor Returns ZPS_E_SUCCESS APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

204 Chapter 7 Application Framework (AF) API 7.2 AF Structures This section describes the structures of the Application Framework (AF) API. These include the following categories of structure: Descriptor structures - see Section Event structures - see Section Other structures - see Section Descriptor Structures These structures are used to represent the following descriptors that contain information about the host node: Node descriptor Node Power descriptor Simple descriptor The structures are listed below, along with their page references. Structure Page ZPS_tsAplAfNodeDescriptor 204 ZPS_tsAplAfNodePowerDescriptor 206 ZPS_tsAplAfSimpleDescriptor ZPS_tsAplAfNodeDescriptor The AF Node descriptor structure ZPS_tsAplAfNodeDescriptor is shown below. typedef struct { uint32 : 8; /* padding */ uint32 elogicaltype : 3; uint32 bcomplexdescavail : 1; uint32 buserdescavail : 1; uint32 ereserved : 3; /* reserved */ uint32 efrequencyband : 5; uint32 eapsflags : 3; uint32 u8macflags : 8; uint16 u16manufacturercode; uint8 u8maxbuffersize; uint16 u16maxrxsize; uint16 u16servermask; uint16 u16maxtxsize; uint8 u8descriptorcapability; } ZPS_tsAplAfNodeDescriptor; 204 NXP Laboratories UK 2017 JN-UG-3101 v1.5

205 ZigBee PRO Stack where: elogicaltype contains 3 bits (bits 0-2) indicating the ZigBee device type of the node, as follows: 000: Co-ordinator 001: Router 010: End Device bcomplexdescavail is set to 1 if there is a Complex descriptor available for node. buserdescavail is set to 1 if there is a User descriptor available for node. ereserved is reserved. efrequencyband contains 5 bits detailing the frequency bands supported by the node, as follows (a bit is set to 1 if the corresponding band is supported): Bit 0: MHz Bit 2: MHz Bit 3: MHz Bits 1 and 4 are reserved eapsflags is not currently supported and set to zero. emacflags contains 8 bits (bits 0-7) indicating the node capabilities, as required by the IEEE MAC sub-layer. These node capability flags are described in Table 8 on page 216. u16manufacturercode contains 16 bits (bits 0-15) indicating the manufacturer code for the node, where this code is allocated to the manufacturer by the ZigBee Alliance. u8maxbuffersize is the maximum size, in bytes, of an NPDU (Network Protocol Data Unit). u16maxrxsize is the maximum size, in bytes, of an APDU (Application Protocol Data Unit). This value can be greater than the value of u8maxbuffersize, due to the fragmentation of an APDU into NPDUs. u16servermask contains 8 bits (bits 0-7) indicating the server status of the node. This server mask is detailed in Table 10 on page 321. u16maxtxsize is the maximum size, in bytes, of the ASDU (Application Sublayer Data Unit) in which a message can be sent (the message may actually be transmitted in smaller fragments) u8descriptorcapability contains 8 bits (bits 0-7) indicating the properties of the node that can be used by other nodes in network discovery, as follows: Bit Description 0 Set to 1 if Extended Active Endpoint List is available on the node, 0 otherwise 1 Set to 1 if Extended Simple Descriptor List is available on the node, 0 otherwise 2-7 Reserved JN-UG-3101 v1.5 NXP Laboratories UK

206 Chapter 7 Application Framework (AF) API ZPS_tsAplAfNodePowerDescriptor The AF Node Power descriptor structure ZPS_tsAplAfNodePowerDescriptor is shown below. typedef struct { uint32 ecurrentpowermode : 4; uint32 eavailablepowersources : 4; uint32 ecurrentpowersource : 4; uint32 ecurrentpowersourcelevel : 4; } ZPS_tsAplAfNodePowerDescriptor; where: ecurrentpowermode contains 4 bits (bits 0-3) indicating the power mode currently used by the node, as follows: 0000: Receiver configured according to Receiver on when idle MAC flag in the Node Descriptor (see Section ) 0001: Receiver switched on periodically 0010: Receiver switched on when stimulated, e.g. by pressing a button All other values are reserved eavailablepowersources contains 4 bits (bits 0-3) indicating the available power sources for the node, as follows (a bit is set to 1 if the corresponding power source is available): Bit 0: Permanent mains supply Bit 1: Rechargeable battery Bit 2: Disposable battery Bit 4: Reserved ecurrentpowersource contains 4 bits (bits 0-3) indicating the current power source for the node, as detailed for the element above (the bit corresponding to the current power source is set to 1, all other bits are set to 0). ecurrentpowersourcelevel contains 4 bits (bit 0-3) indicating the current level of charge of the node s power source (mainly useful for batteries), as follows: 0000: Critically low 0100: Approximately 33% 1000: Approximately 66% 1100: Approximately 100% (near fully charged) 206 NXP Laboratories UK 2017 JN-UG-3101 v1.5

207 ZigBee PRO Stack ZPS_tsAplAfSimpleDescriptor The AF Simple descriptor structure ZPS_tsAplAfSimpleDescriptor is shown below. typedef struct { uint16 u16applicationprofileid; uint16 u16deviceid; uint8 u8deviceversion; uint8 u8endpoint; uint8 u8inclustercount; uint8 u8outclustercount; uint16 *pu16inclusterlist; uint16 *pu16outclusterlist; } ZPS_tsAplAfSimpleDescriptor; where: u16applicationprofileid is the 16-bit identifier of the ZigBee application profile supported by the endpoint. This must be an application profile identifier issued by the ZigBee Alliance. u16deviceid is the 16-bit identifier of the ZigBee device description supported by the endpoint. This must be a device description identifier issued by the ZigBee Alliance. u8deviceversion contains 4 bits (bits 0-3) representing the version of the supported device description (default is 0000, unless set to another value according to the application profile used). u8endpoint is the number, in the range 1-240, of the endpoint to which the Simple descriptor corresponds. u8inclustercount is an 8-bit count of the number of input clusters, supported on the endpoint, that will appear in the list pointed to by the pu16inclusterlist element. u8outclustercount is an 8-bit count of the number of output clusters, supported on the endpoint, that will appear in the pu16outclusterlist element. *pu16inclusterlist is a pointer to the list of input clusters supported by the endpoint (for use during the service discovery and binding procedures). This is a sequence of 16-bit values, representing the cluster numbers (in the range 1-240), where the number of values is equal to count u8inclustercount. If this count is zero, the pointer can be set to NULL. *pu16outclusterlist is a pointer to the list of output clusters supported by the endpoint (for use during the service discovery and binding procedures). This is a sequence of 16-bit values, representing the cluster numbers (in the range 1-240), where the number of values is equal to count u8outclustercount. If this count is zero, the pointer can be set to NULL. JN-UG-3101 v1.5 NXP Laboratories UK

208 Chapter 7 Application Framework (AF) API Event Structures These stuctures are used to contain events. Event details (type and associated data) are passed to the application in the structure ZPS_tsAfEvent. Data structures for the individual event types are contained in the union ZPS_tuAfEventData. Note: Enumerations for the event types are provided in the stucture ZPS_teAfEventType. This structure and the associated events are detailed in Section 9.1. The structures are listed below, along with their page references. Structure Page ZPS_tsAfEvent 209 ZPS_tuAfEventData 209 ZPS_tsAfDataIndEvent 210 ZPS_tsAfDataConfEvent 211 ZPS_tsAfDataAckEvent 212 ZPS_tsAfNwkFormationEvent 213 ZPS_tsAfNwkJoinedEvent 213 ZPS_tsAfNwkJoinFailedEvent 213 ZPS_tsAfNwkDiscoveryEvent 214 ZPS_tsAfNwkJoinIndEvent 215 ZPS_tsAfNwkLeaveIndEvent 216 ZPS_tsAfNwkLeaveConfEvent 217 ZPS_tsAfNwkStatusIndEvent 217 ZPS_tsAfNwkRouteDiscoveryConfEvent 218 ZPS_tsAfPollConfEvent 218 ZPS_tsAfNwkEdScanConfEvent 218 ZPS_tsAfErrorEvent 219 ZPS_tsAfZdoBindEvent 221 ZPS_tsAfZdoUnbindEvent 222 ZPS_tsAfZdoLinkKeyEvent 222 ZPS_tsAfBindRequestServerEvent 222 ZPS_tsAfInterPanDataIndEvent 223 ZPS_tsAfInterPanDataConfEvent 224 ZPS_tsAfZdpEvent NXP Laboratories UK 2017 JN-UG-3101 v1.5

209 ZigBee PRO Stack ZPS_tsAfEvent This stucture contains the details of an event. The ZPS_tsAfEvent structure is detailed below. typedef struct { ZPS_teAfEventType etype; ZPS_tuAfEventData uevent; } ZPS_tsAfEvent; where etype indicates the event type, using the enumerations listed and described in Section 9.1 uevent is a structure containing the event data from the union of structures detailed in Section ZPS_tuAfEventData This structure is a union of the data structures for the individual events described in Section through to Section The ZPS_tuAfEventData structure is detailed below. typedef union { ZPS_tsAfDataIndEvent sapsdataindevent; ZPS_tsAfDataConfEvent sapsdataconfirmevent; ZPS_tsAfDataAckEvent sapsdataackevent; ZPS_tsAfNwkFormationEvent snwkformationevent; ZPS_tsAfNwkJoinedEvent snwkjoinedevent; ZPS_tsAfNwkJoinFailedEvent snwkjoinfailedevent; ZPS_tsAfNwkDiscoveryEvent snwkdiscoveryevent; ZPS_tsAfNwkJoinIndEvent snwkjoinindicationevent; ZPS_tsAfNwkLeaveIndEvent snwkleaveindicationevent; ZPS_tsAfNwkLeaveConfEvent snwkleaveconfirmevent; ZPS_tsAfNwkStatusIndEvent snwkstatusindicationevent; ZPS_tsAfNwkRouteDiscoveryConfEvent snwkroutediscoveryconfirmevent; ZPS_tsAfPollConfEvent snwkpollconfirmevent; ZPS_tsAfNwkEdScanConfEvent snwkedscanconfirmevent; ZPS_tsAfErrorEvent saferrorevent; ZPS_tsAfZdoBindEvent szdobindevent; ZPS_tsAfZdoUnbindEvent szdounbindevent; ZPS_tsAfZdoLinkKeyEvent szdolinkkeyevent; ZPS_tsAfBindRequestServerEvent sbindrequestserverevent; ZPS_tsAfInterPanDataIndEvent sapsinterpandataindevent; ZPS_tsAfInterPanDataConfEvent sapsinterpandataconfirmevent; ZPS_tsAfZdpEvent sapszdpevent; } ZPS_tuAfEventData; JN-UG-3101 v1.5 NXP Laboratories UK

210 Chapter 7 Application Framework (AF) API ZPS_tsAfDataIndEvent This structure is used in the ZPS_EVENT_APS_DATA_INDICATION event, which indicates the arrival of data on the local node. The ZPS_tsAfDataIndEvent structure is detailed below. typedef struct { uint8 u8dstaddrmode; ZPS_tuAddress udstaddress; uint8 u8dstendpoint; uint8 u8srcaddrmode; ZPS_tuAddress usrcaddress; uint8 u8srcendpoint; uint16 u16profileid; uint16 u16clusterid; PDUM_thAPduInstance hapduinst; uint8 estatus; uint8 esecuritystatus; uint8 u8linkquality; uint32 u32rxtime; } ZPS_tsAfDataIndEvent; where: u8dstaddrmode indicates the type of destination address specified through the element udstaddress (see Table 7 below) udstaddress is the address of the destination node for the data packet (the type of address is specified using the element u8dstaddrmode above) u8dstendpoint is the number of the destination endpoint (in range 0-240) u8srcaddrmode indicates the type of source address specified through the element usrcaddress (below) - this can be a 64-bit MAC/IEEE address or a 16-bit network address usrcaddress is the address of the source node for the data packet (the type of address is specified using the element u8srcaddrmode above) u8srcendpoint is the number of the source endpoint (in range 1-240) u16profileid is the identifier of the ZigBee device profile of the device which can interpret the data u16clusterid is the identifier of the cluster (which belongs to the device profile specified in u16profileid) which is capable of interpreting the data hapduinst is the handle of the APDU which contains the data estatus is one of the status codes from the NWK layer or MAC layer, detailed in Section and Section esecuritystatus indicates the type of security with which the packet was sent - unsecured (0xAF), secured with network key (0xAC) or secured with link key (0xAB) 210 NXP Laboratories UK 2017 JN-UG-3101 v1.5

211 ZigBee PRO Stack u8linkquality is a measure of the signal strength of the radio link over which the data packet was sent (for the last hop) u32rxtime is reserved for future use. u8dstaddrmode Code Description 0x00 ZPS_E_ADDR_MODE_BOUND Bound endpoint 0x01 ZPS_E_ADDR_MODE_GROUP 16-bit Group address 0x02 ZPS_E_ADDR_MODE_SHORT 16-bit Network (Short) address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 7: Addressing Modes ZPS_tsAfDataConfEvent This structure is used in the ZPS_EVENT_APS_DATA_CONFIRM event, which confirms that a data packet sent by the local node has been successfully passed down the stack to the MAC layer and has made its first hop towards its destination (an acknowledgement has been received from the next hop node). The ZPS_tsAfDataConfEvent structure is detailed below. typedef struct { uint8 u8status; uint8 u8srcendpoint; uint8 u8dstendpoint; uint8 u8dstaddrmode; ZPS_tuAddress udstaddr; uint8 u8sequencenum; } ZPS_tsAfDataConfEvent; where: u8status is one of the status codes from the lower stack layers, detailed in Section 9.2. u8srcendpoint is the number of the (local) source endpoint for the data transfer (in range 1-240) u8dstendpoint is the number of the destination endpoint for the data transfer (in range 1-240) u8dstaddrmode indicates the type of destination address specified through the element udstaddr (see Table 7 on page 211) - only values 0x02 (group address) and 0x03 (network address) are valid in this structure udstaddr is the address of the destination node for the data packet (the type of address is specified using the element u8dstaddrmode above) u8sequencenum is the sequence number of the request that initiated the data transfer JN-UG-3101 v1.5 NXP Laboratories UK

212 Chapter 7 Application Framework (AF) API ZPS_tsAfDataAckEvent This structure is used in the ZPS_EVENT_APS_DATA_ACK event, which is generated when an end-to-end acknowledgement is received from the destination node during a data transfer in which an acknowledgement was requested. typedef struct { uint8 u8status; uint8 u8srcendpoint; uint8 u8dstendpoint; uint8 u8dstaddrmode; uint16 u16dstaddr; uint8 u8sequencenum; uint16 u16profileid; uint16 u16clusterid; } ZPS_tsAfDataAckEvent; where: u8status is one of the status codes from the lower stack layers, detailed in Section 9.2 u8srcendpoint is the number of the (local) source endpoint for the data transfer (in range 1-240) u8dstendpoint is the number of the destination endpoint for the data transfer (in range 1-240) u8dstaddrmode indicates the type of destination address specified through the element u16dstaddr (see Table 7 on page 211) - only values 0x01 (group address) and 0x02 (network address) are valid in this structure u16dstaddr is the 16-bit address of the destination node for the data transfer and therefore of the node that sent the acknowledgement (the type of address is specified using the element u8dstaddrmode above) u8sequencenum is the sequence number of the request that initiated the data transfer u16profileid is the identifier of the ZigBee device profile of the device for which the data transfer was intended u16clusterid is the identifier of the cluster (which belongs to the device profile specified in u16profileid) for which the data transfer was intended 212 NXP Laboratories UK 2017 JN-UG-3101 v1.5

213 ZigBee PRO Stack ZPS_tsAfNwkFormationEvent This structure is used in the event ZPS_EVENT_NWK_STARTED, which indicates whether the network has been started (on the Co-ordinator). The ZPS_tsAfNwkFormationEvent structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAfNwkFormationEvent; where is one of the status codes from the lower stack layers, detailed in Section ZPS_tsAfNwkJoinedEvent This structure is used in the events ZPS_EVENT_NWK_JOINED_AS_ROUTER and ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE, which confirm that the local device (Router or End Device) has successfully joined a network. The ZPS_tsAfNwkJoinedEvent structure reports the network address that the parent has assigned to the new node and is detailed below. typedef struct { uint16 u16addr; } ZPS_tsAfNwkJoinedEvent; where u16addr is the 16-bit network address allocated to the joining node ZPS_tsAfNwkJoinFailedEvent This structure is used in the event ZPS_EVENT_NWK_FAILED_TO_JOIN, which indicates that the local device has failed to join a network. The ZPS_tsAfNwkJoinFailedEvent structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAfNwkJoinFailedEvent; where u8status is one of the status codes from the lower stack layers, detailed in Section 9.2. JN-UG-3101 v1.5 NXP Laboratories UK

214 Chapter 7 Application Framework (AF) API ZPS_tsAfNwkDiscoveryEvent This structure is used in the ZPS_EVENT_NWK_DISCOVERY_COMPLETE event, which reports the details of the networks detected in a network discovery initiated by a Router or End Device that needs to join a network. The ZPS_tsAfNwkDiscoveryEvent structure is detailed below. typedef struct { uint32 u32unscannedchannels; uint8 estatus; uint8 u8networkcount; uint8 u8selectednetwork; ZPS_tsNwkNetworkDescr *psnwkdescriptors; } ZPS_tsAfNwkDiscoveryEvent; where: u32unscannedchannels is a 32-bit bitmap representing the set of channels from the network discovery that had not yet been scanned when this event was generated. Bits 11 to 26 represent the 2400-MHz channels 11 to 26, where 1 indicates channel scanned and 0 indicates channel not yet scanned. estatus is the status of the network discovery process, returned by the lower layers (see Section 9.2) - MAC_ENUM_SUCCESS, if the discovery was successfully completed. u8networkcount is the number of networks that had been discovered when this event was generated. u8selectednetwork is the index of the recommended network in the array of reported networks (see below). psnwkdescriptors is a pointer to the network discovery table in the network NIB. The network discovery table contains array of data structures, where each structure contains details of a discovered network. Each array element is a structure of the type ZPS_tsNwkNetworkDescr, described in Section The number of array elements is given by u8networkcount, described above. 214 NXP Laboratories UK 2017 JN-UG-3101 v1.5

215 ZigBee PRO Stack ZPS_tsAfNwkJoinIndEvent This structure is used in the event ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED, which notifies a Router or the Co-ordinator that a new child node has joined the network. The ZPS_tsAfNwkJoinIndEvent structure contains information about the new node and is detailed below. typedef struct { uint64 u64extaddr; uint16 u16nwkaddr; uint8 u8capability; uint8 u8rejoin; uint8 u8securerejoin; } ZPS_tsAfNwkJoinIndEvent; where: u64extaddr is the 64-bit IEEE (MAC) address of the joining node u16nwkaddr is the 16-bit network address assigned to the joining node u8capability is a bitmap indicating the operational capabilities of the joining node. This bitmap is detailed in Table 8 below u8rejoin indicates the method used to join the network: 0x00 if joined through association 0x01 if joined directly or used orphaning 0x02 if was network rejoin u8securerejoin indicates whether the join was performed in a secure manner - zero represents FALSE and a non-zero value represents TRUE JN-UG-3101 v1.5 NXP Laboratories UK

216 Chapter 7 Application Framework (AF) API Bits Description 0 Co-ordinator capability: 1: Node able to act as Co-ordinator 0: Node not able to act as Co-ordinator 1 Device type: 1: Full-Function Device (FFD) 0: Reduced-Function Device (RFD) An FFD can act as any node type while an RFD cannot act as the network Co-ordinator. 2 Power source: 1: Node is mains-powered 0: Node is not mains-powered 3 Receiver on when idle: 1: Receiver enabled during idle periods 0: Receiver disabled during idle periods to conserve power 4-5 Reserved 6 Security capability: 1: High security 0: Standard security 7 Allocate address: 1: Network address should be allocated to node 0: Network address need not be allocated to node Table 8: Node Capabilities Bitmap ZPS_tsAfNwkLeaveIndEvent This structure is used in the ZPS_EVENT_LEAVE_INDICATION event, which indicates that a neighbouring node has left the network or a remote node has requested the local node to leave. The ZPS_tsAfNwkLeaveIndEvent structure is detailed below. typedef struct { uint64 u64extaddr; uint8 u8rejoin; } ZPS_tsAfNwkLeaveIndEvent; where: u64extaddr is the 64-bit IEEE (MAC) address of the node that has left the network, or is zero if the local node has been requested to leave the network u8rejoin indicates whether the leaving node was requested to attempt a subsequent rejoin of the network - zero represents FALSE and a non-zero value represents TRUE 216 NXP Laboratories UK 2017 JN-UG-3101 v1.5

217 ZigBee PRO Stack ZPS_tsAfNwkLeaveConfEvent This structure is used in the event ZPS_EVENT_NWK_LEAVE_CONFIRM, which reports the results of a node leave request issued by the local node. The ZPS_tsAfNwkLeaveConfEvent structure is detailed below. typedef struct { uint64 u64extaddr; uint8 estatus; } ZPS_tsAfNwkLeaveConfEvent; where: u64extaddr is the 64-bit IEEE (MAC) address of the leaving node. This value is zero if the local node itself is leaving estatus is the leave status returned by the lower layers - ZPS_NWK_ENUM_SUCCESS, if the leave request has been successful ZPS_tsAfNwkStatusIndEvent This structure is used in the ZPS_EVENT_NWK_STATUS_INDICATION event, which reports status information from the NWK layer of the stack. The ZPS_tsAfNwkStatusIndEvent structure is detailed below. typedef struct { uint16 u16nwkaddr; uint8 u8status; } ZPS_tsAfNwkStatusIndEvent; where: u16nwkaddr is the 16-bit network address of the node associated with the event u8status is one of the status codes from the lower stack layers, detailed in Section 9.2. JN-UG-3101 v1.5 NXP Laboratories UK

218 Chapter 7 Application Framework (AF) API ZPS_tsAfNwkRouteDiscoveryConfEvent This structure is used in the ZPS_EVENT_NWK_ROUTE_DISCOVERY_CONFIRM event, which confirms that a route discovery has been performed. The ZPS_tsAfNwkRouteDiscoveryConfEvent structure is detailed below. typedef struct { uint8 u8status; uint8 u8nwkstatus; } ZPS_tsAfNwkRouteDiscoveryConfEvent; where: u8status is one of the status codes from the MAC layer, detailed in Section u8nwkstatus is one of the status codes from the NWK layer, detailed in Section ZPS_tsAfPollConfEvent This structure is used in the ZPS_EVENT_NWK_POLL_CONFIRM event, which reports the completion of a poll request sent from the (local) End Device to its parent. The ZPS_tsAfPollConfEvent structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAfPollConfEvent; where u8status is one of the status codes from the lower stack layers, detailed in Section ZPS_tsAfNwkEdScanConfEvent This structure is used in the ZPS_EVENT_NWK_ED_SCAN event, which indicates that an energy detect scan in the 2.4-GHz radio band has completed. The ZPS_tsAfNwkEdScanConfEvent structure is defined as: typedef ZPS_tsNwkNlmeCfmEdScan ZPS_tsAfNwkEdScanConfEvent; where ZPS_tsNwkNlmeCfmEdScan is described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

219 ZigBee PRO Stack ZPS_tsAfErrorEvent This structure is used in the ZPS_EVENT_ERROR event, which reports error situations concerning the storage of received messages in APDU instances. The ZPS_tsAfErrorEvent structure is detailed below. typedef struct { enum { ZPS_ERROR_APDU_TOO_SMALL, ZPS_ERROR_APDU_INSTANCES_EXHAUSTED, ZPS_ERROR_NO_APDU_CONFIGURED, ZPS_ERROR_OS_MESSAGE_QUEUE_OVERRUN } eerror; union { struct { uint16 u16profileid; uint16 u16clusterid; uint16 u16srcaddr; uint16 u16datasize; PDUM_thAPdu hapdu; uint8 u8srcendpoint; uint8 u8dstendpoint; }saferrorapdu; struct { OS_thMessage hmessage; } saferrorosmessageoverrun; } uerrordata; } ZPS_tsAfErrorEvent; The member enumerations and structures of the above structure are detailed below. JN-UG-3101 v1.5 NXP Laboratories UK

220 Chapter 7 Application Framework (AF) API eerror Enumerations The error enumerations which are part of the ZPS_tsAfErrorEvent structure are listed and described below. eerror Enumeration ZPS_ERROR_APDU_TOO_SMALL ZPS_ERROR_APDU_INSTANCES_EXHAUSTED ZPS_ERROR_NO_APDU_CONFIGURED ZPS_ERROR_OS_MESSAGE_QUEUE_OVERRUN Description Allocated APDU instance is too small to accommodate received message. This error is detailed in the structure saferrorapdu, which is described below. The are no APDU instances available to accommodate the received message. This error is detailed in the structure saferrorapdu, which is described below. No APDU has been configured to accommodate the received message. This error is detailed in the structure saferrorapdu, which is described below. A message queue is full and can accept no more messages. This error is detailed in the structure saferrorosmessageoverrun, which is described below. Table 9: eerror Enumerations saferrorapdu This structure is used in the following errors: ZPS_ERROR_APDU_TOO_SMALL, which reports that the allocated APDU instance is too small to store a received message ZPS_ERROR_APDU_INSTANCES_EXHAUSTED, which reports that there are no allocated APDU instances left to store a received message ZPS_ERROR_NO_APDU_CONFIGURED, which reports that no APDU has been configured to store the received message The saferrorapdu structure is detailed below. struct { uint16 u16profileid; uint16 u16clusterid; uint16 u16srcaddr; uint16 u16datasize; PDUM_thAPdu hapdu; uint8 u8srcendpoint; uint8 u8dstendpoint; }saferrorapdu; where: u16profileid is the identifier of the ZigBee application profile associated with the source and destination endpoints for the message u16clusterid is the identifier of the cluster associated with the source and destination endpoints for the message u16srcaddr is the 16-bit network address of the source node of the message 220 NXP Laboratories UK 2017 JN-UG-3101 v1.5

221 ZigBee PRO Stack u16datasize is the size of the received message, in bytes hapdu is the handle of the local APDU pool from which the APDU instance comes u8srcendpoint is the number of the source endpoint of the message u8dstendpoint is the number of the destination endpoint of the message saferrorosmessageoverrun This structure is used in the ZPS_ERROR_OS_MESSAGE_QUEUE_OVERRUN error, which indicates that a message queue is full and can accept no more messages. The saferrorosmessageoverrun structure is detailed below. struct { OS_thMessage hmessage; } saferrorosmessageoverrun; where hmessage is the handle of the message type for the queue which is full ZPS_tsAfZdoBindEvent This structure is used in the ZPS_EVENT_ZDO_BIND event, which indicates that the local node has been successfully bound to one or more remote nodes. The ZPS_tsAfZdoBindEvent structure is detailed below. typedef struct { ZPS_tuAddress udstaddr; uint8 u8dstaddrmode; uint8 u8srcep; uint8 u8dstep; } ZPS_tsAfZdoBindEvent; where udstaddr is the address of the remote node for the binding (the type of address is specified using the element u8dstaddrmode above) u8dstaddrmode indicates the type of address specified through the element udstaddr (see Table 7 on page 211) u8srcep is the number of the source endpoint for the binding (in range 1-240) u8dstep is the number of the destination endpoint for the binding (in range 1-240) JN-UG-3101 v1.5 NXP Laboratories UK

222 Chapter 7 Application Framework (AF) API ZPS_tsAfZdoUnbindEvent This structure is used in the ZPS_EVENT_ZDO_UNBIND event, which indicates that the local node has been successfully unbound from one or more remote nodes. The ZPS_tsAfZdoUnbindEvent structure is defined as: typedef ZPS_tsAfZdoBindEvent ZPS_tsAfZdoUnbindEvent; where ZPS_tsAfZdoBindEvent is described in Section (but for this event, the data in the structure relates to unbinding rather than binding) ZPS_tsAfZdoLinkKeyEvent This structure is used in the ZPS_EVENT_ZDO_LINK_KEY event, which indicates that a new application link key has been received and installed, and is ready for use. The ZPS_tsAfZdoLinkKeyEvent structure is defined as: typedef struct { uint64 u64ieeelinkaddr; } ZPS_tsAfZdoLinkKeyEvent; where u64ieeelinkaddr is the IEEE/MAC address of the remote device with which the installed link key is valid ZPS_tsAfBindRequestServerEvent This structure is used in the ZPS_EVENT_BIND_REQUEST_SERVER event, which reports the status of a data transmission sent from the (local) node to a set of bound endpoints. The ZPS_tsAfBindRequestServerEvent structure is detailed below. typedef struct { uint8 u8status; uint8 u8srcendpoint; uint32 u32failurecount; } ZPS_tsAfBindRequestServerEvent; where: u8status is the overall status of the bound data transmission: Success (0) indicates that the data packet was successfully transmitted to all bound endpoints Failure (non-zero value) indicates that the data packet was not successfully sent to at least one bound endpoint (see u32failurecount below) u8srcendpoint is the number of the local endpoint from which the data packet was sent u32failurecount is the number of bound endpoints for which the transmission failed 222 NXP Laboratories UK 2017 JN-UG-3101 v1.5

223 ZigBee PRO Stack ZPS_tsAfInterPanDataIndEvent This structure is used in the ZPS_EVENT_APS_INTERPAN_DATA_INDICATION event, which indicates that an inter-pan data packet has arrived. The ZPS_tsAfInterPanDataIndEvent structure is detailed below. typedef struct { ZPS_tsInterPanAddress sdstaddr; uint8 u8srcaddrmode; uint16 u16srcpan; uint64 u64srcaddress; uint16 u16profileid; uint16 u16clusterid; PDUM_thAPduInstance hapduinst; uint8 estatus; uint8 u8dstendpoint; uint8 u8linkquality; } ZPS_tsAfInterPanDataIndEvent; where sdstaddr is a structure of the type ZPS_tsInterPanAddress (see Section ) which contains the PAN ID and address for the destination node(s) of the inter-pan data packet u8srcaddrmode indicates the type of address specified through the element u64srcaddress (see Table 7 on page 211) u16srcpan is the PAN ID of the network from which the data packet originates u64srcaddress is the address of the node which sent the data packet (the type of address is specified using the element u8srcaddrmode above) u16profileid is the identifier of the application profile for which the data packet is intended u16clusterid is the identifier of the cluster for which the data packet is intended hapduinst is the handle of the APDU instance for the data packet estatus is one of the status codes from the lower stack layers, detailed in Section 9.2 u8dstendpoint is the number of the destination endpoint for the data packet (in range 1-240) u8linkquality is an LQI value indicating the perceived strength of the radio signal which carried the received data packet JN-UG-3101 v1.5 NXP Laboratories UK

224 Chapter 7 Application Framework (AF) API ZPS_tsAfInterPanDataConfEvent This structure is used in the ZPS_EVENT_APS_INTERPAN_DATA_CONFIRM event, which indicates that an inter-pan communication has been sent by the local node and an acknowledgement has been received from the first hop node (this acknowledgement is not generated in the case of a broadcast). The ZPS_tsAfInterPanDataConfEvent structure is detailed below. typedef struct { uint8 u8status; uint8 u8handle; } ZPS_tsAfInterPanDataConfEvent; where u8status is one of the status codes from the lower stack layers, detailed in Section 9.2. u8handle is a handle for internal use ZPS_tsAfZdpEvent This structure is used when a ZPS_EVENT_APS_DATA_INDICATION event is generated containing a response which is destined for the ZDO at endpoint 0. The application can extract the response data from the event using the function ZPS_bAplZdpUnpackResponse() and this structure is used to receive the extracted data. The ZPS_tsAfZdpEvent structure is detailed below. typedef struct { uint8 u8sequnumber; uint16 u16clusterid; union { ZPS_tsAplZdpDeviceAnnceReq sdeviceannce; ZPS_tsAplZdpMgmtNwkUpdateReq smgmtnwkupdatereq; ZPS_tsAplZdpMgmtPermitJoiningReq spermitjoiningreq; ZPS_tsAplZdpDiscoveryCacheRsp sdiscoverycachersp; ZPS_tsAplZdpDiscoveryStoreRsp sdiscoverystorersp; ZPS_tsAplZdpNodeDescStoreRsp snodedescstorersp; ZPS_tsAplZdpActiveEpStoreRsp sactiveepstorersp; ZPS_tsAplZdpSimpleDescStoreRsp ssimpledescstorersp; ZPS_tsAplZdpRemoveNodeCacheRsp sremovenodecachersp; ZPS_tsAplZdpEndDeviceBindRsp senddevicebindrsp; ZPS_tsAplZdpBindRsp sbindrsp; ZPS_tsAplZdpUnbindRsp sunbindrsp; ZPS_tsAplZdpReplaceDeviceRsp sreplacedevicersp; ZPS_tsAplZdpStoreBkupBindEntryRsp sstorebkupbindentryrsp; ZPS_tsAplZdpRemoveBkupBindEntryRsp sremovebkupbindentryrsp; ZPS_tsAplZdpBackupSourceBindRsp sbackupsourcebindrsp; ZPS_tsAplZdpMgmtLeaveRsp smgmtleaversp; ZPS_tsAplZdpMgmtDirectJoinRsp smgmtdirectjoinrsp; 224 NXP Laboratories UK 2017 JN-UG-3101 v1.5

225 ZigBee PRO Stack ZPS_tsAplZdpMgmtPermitJoiningRsp spermitjoiningrsp; ZPS_tsAplZdpNodeDescRsp snodedescrsp; ZPS_tsAplZdpPowerDescRsp spowerdescrsp; ZPS_tsAplZdpSimpleDescRsp ssimpledescrsp; ZPS_tsAplZdpNwkAddrRsp snwkaddrrsp; ZPS_tsAplZdpIeeeAddrRsp sieeeaddrrsp; ZPS_tsAplZdpUserDescConf suserdescconf; ZPS_tsAplZdpSystemServerDiscoveryRsp ssystemserverdiscoveryrsp; ZPS_tsAplZdpPowerDescStoreRsp spowerdescstorersp; ZPS_tsAplZdpUserDescRsp suserdescrsp; ZPS_tsAplZdpActiveEpRsp sactiveeprsp; ZPS_tsAplZdpMatchDescRsp smatchdescrsp; ZPS_tsAplZdpComplexDescRsp scomplexdescrsp; ZPS_tsAplZdpFindNodeCacheRsp sfindnodecachersp; ZPS_tsAplZdpExtendedSimpleDescRsp sextendedsimpledescrsp; ZPS_tsAplZdpExtendedActiveEpRsp sextendedactiveeprsp; ZPS_tsAplZdpBindRegisterRsp sbindregisterrsp; ZPS_tsAplZdpBackupBindTableRsp sbackupbindtablersp; ZPS_tsAplZdpRecoverBindTableRsp srecoverbindtablersp; ZPS_tsAplZdpRecoverSourceBindRsp srecoversourcebindrsp; ZPS_tsAplZdpMgmtNwkDiscRsp smgmtnwkdiscrsp; ZPS_tsAplZdpMgmtLqiRsp smgmtlqirsp; ZPS_tsAplZdpMgmtRtgRsp srtgrsp; ZPS_tsAplZdpMgmtBindRsp smgmtbindrsp; ZPS_tsAplZdpMgmtCacheRsp smgmtcachersp; ZPS_tsAplZdpMgmtNwkUpdateNotify smgmtnwkupdatenotify; }uzdpdata; union { ZPS_tsAplZdpBindingTableEntry asbindingtable[5]; ZPS_tsAplZdpNetworkDescr asnwkdesctable[5]; ZPS_tsAplZdpNtListEntry asntlist[2]; ZPS_tsAplDiscoveryCache adisccache[5]; uint16 au16data[34]; uint8 au8data[77]; uint64 au64data[9]; }ulists; }ZPS_tsAfZdpEvent; where: u8sequnumber is the sequence number of the ZDP request/response u16clusterid is the ID of the cluster to which the request/response relates uzdpdata is a union of the different ZDP request/response types: sdeviceannce is a structure of the type ZPS_tsAplZdpDeviceAnnceReq, described in Section smgmtnwkupdatereq is a structure of the type ZPS_tsAplZdpMgmtNwkUpdateReq, described in Section spermitjoiningreq is a structure of the type ZPS_tsAplZdpMgmtPermitJoiningReq, described in Section JN-UG-3101 v1.5 NXP Laboratories UK

226 Chapter 7 Application Framework (AF) API sdiscoverycachersp is a structure of the type ZPS_tsAplZdpDiscoveryCacheRsp, described in Section sdiscoverystorersp is a structure of the type ZPS_tsAplZdpDiscoveryStoreRsp, described in Section snodedescstorersp is a structure of the type ZPS_tsAplZdpNodeDescStoreRsp, described in Section sactiveepstorersp is a structure of the type ZPS_tsAplZdpActiveEpStoreRsp, described in Section ssimpledescstorersp is a structure of the type ZPS_tsAplZdpSimpleDescStoreRsp, described in Section sremovenodecachersp is a structure of the type ZPS_tsAplZdpRemoveNodeCacheRsp, described in Section senddevicebindrsp is a structure of the type ZPS_tsAplZdpEndDeviceBindRsp, described in Section sbindrsp is a structure of the type ZPS_tsAplZdpBindRsp, described in Section sunbindrsp is a structure of the type ZPS_tsAplZdpUnbindRsp, described in Section sreplacedevicersp is a structure of the type ZPS_tsAplZdpReplaceDeviceRsp, described in Section sstorebkupbindentryrsp is a structure of the type ZPS_tsAplZdpStoreBkupBindEntryRsp, described in Section sremovebkupbindentryrsp is a structure of the type ZPS_tsAplZdpRemoveBkupBindEntryRsp, described in Section sbackupsourcebindrsp is a structure of the type ZPS_tsAplZdpBackupSourceBindRsp, described in Section smgmtleaversp is a structure of the type ZPS_tsAplZdpMgmtLeaveRsp, described in Section smgmtdirectjoinrsp is a structure of the type ZPS_tsAplZdpMgmtDirectJoinRsp, described in Section spermitjoiningrsp is a structure of the type ZPS_tsAplZdpMgmtPermitJoiningRsp, described in Section snodedescrsp is a structure of the type ZPS_tsAplZdpNodeDescRsp, described in Section spowerdescrsp is a structure of the type ZPS_tsAplZdpPowerDescRsp, described in Section ssimpledescrsp is a structure of the type ZPS_tsAplZdpSimpleDescRsp, described in Section snwkaddrrsp is a structure of the type ZPS_tsAplZdpNwkAddrRsp, described in Section sieeeaddrrsp is a structure of the type ZPS_tsAplZdpIeeeAddrRsp, described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

227 ZigBee PRO Stack suserdescconf is a structure of the type ZPS_tsAplZdpUserDescConf, described in Section ssystemserverdiscoveryrsp is a structure of the type ZPS_tsAplZdpSystemServerDiscoveryRsp, described in Section spowerdescstorersp is a structure of the type ZPS_tsAplZdpPowerDescStoreRsp, described in Section suserdescrsp is a structure of the type ZPS_tsAplZdpUserDescRsp, described in Section sactiveeprsp is a structure of the type ZPS_tsAplZdpActiveEpRsp, described in Section smatchdescrsp is a structure of the type ZPS_tsAplZdpMatchDescRsp, described in Section scomplexdescrsp is a structure of the type ZPS_tsAplZdpComplexDescRsp, described in Section sfindnodecachersp is a structure of the type ZPS_tsAplZdpFindNodeCacheRsp, described in Section sextendedsimpledescrsp is a structure of the type ZPS_tsAplZdpExtendedSimpleDescRsp, described in Section sextendedactiveeprsp is a structure of the type ZPS_tsAplZdpExtendedActiveEpRsp, described in Section sbindregisterrsp is a structure of the type ZPS_tsAplZdpBindRegisterRsp, described in Section sbackupbindtablersp is a structure of the type ZPS_tsAplZdpBackupBindTableRsp, described in Section srecoverbindtablersp is a structure of the type ZPS_tsAplZdpRecoverBindTableRsp, described in Section srecoversourcebindrsp is a structure of the type ZPS_tsAplZdpRecoverSourceBindRsp, described in Section smgmtnwkdiscrsp is a structure of the type ZPS_tsAplZdpMgmtNwkDiscRsp, described in Section smgmtlqirsp is a structure of the type ZPS_tsAplZdpMgmtLqiRsp, described in Section srtgrsp is a structure of the type ZPS_tsAplZdpMgmtRtgRsp, described in Section smgmtbindrsp is a structure of the type ZPS_tsAplZdpMgmtBindRsp, described in Section smgmtcachersp is a structure of the type ZPS_tsAplZdpMgmtCacheRsp, described in Section smgmtnwkupdatenotify is a structure of the type ZPS_tsAplZdpMgmtNwkUpdateNotify, described in Section ulists is a union of the different arrays/tables which act as temporary storage for data elements used by the stack (and are therefore for internal use only) JN-UG-3101 v1.5 NXP Laboratories UK

228 Chapter 7 Application Framework (AF) API Other Structures This section describes various structures used by the AF API. The structures are listed below, along with their page references. Structure Page ZPS_tsNwkNetworkDescr 228 ZPS_tsNwkNlmeCfmEdScan 229 ZPS_tsInterPanAddress ZPS_tsNwkNetworkDescr This structure is used in an array element in the structure ZPS_tsAfNwkDiscoveryEvent, which is created as part of the ZPS_EVENT_NWK_DISCOVERY_COMPLETE event which reports the networks detected during a network discovery (see Section ). The ZPS_tsNwkNetworkDescr structure contains information on a detected network and is detailed below. typedef struct { uint64 u64extpanid; uint8 u8logicalchan; uint8 u8stackprofile; uint8 u8zigbeeversion; uint8 u8permitjoining; uint8 u8routercapacity; uint8 u8enddevicecapacity; } ZPS_tsNwkNetworkDescr; where: u64extpanid is the Extended PAN ID of the discovered network u8logicalchan is the 2400-MHz channel on which the network was found u8stackprofile is the Stack Profile of the discovered network (0 - manufacturer-specific, 1 - ZigBee, 2 - ZigBee PRO, other values reserved) and is fixed at 2 for the NXP stack u8zigbeeversion is the ZigBee version of the discovered network u8permitjoining indicates the number of detected nodes with permit joining enabled (and therefore allowing nodes to join the network through them) u8routercapacity indicates the number of detected nodes that are allowing Routers to join the network through them u8enddevicecapacity indicates the number of detected nodes that are allowing End Devices to join the network through them 228 NXP Laboratories UK 2017 JN-UG-3101 v1.5

229 ZigBee PRO Stack ZPS_tsNwkNlmeCfmEdScan This structure is used by the structure ZPS_tsAfNwkEdScanConfEvent, which is created as part of the ZPS_EVENT_NWK_ED_SCAN event which reports the results of an energy detect scan in the 2.4-GHz radio band. The ZPS_tsNwkNlmeCfmEdScant structure is detailed below. typedef struct { uint8 u8status; uint8 u8resultlistsize; uint8 au8energydetect[zps_nwk_max_ed_results]; } ZPS_tsNwkNlmeCfmEdScan; where u8status is one of the status codes from the lower stack layers, detailed in Section 9.2. u8resultlistsize is the number of entries in the results list (see below) au8energydetect[] is an array containing the list of results of the energy scan (8-bit values representing the detected energy levels in the channels) - there is one array element for each channel scanned, where element 0 is for the first channel scanned, element 1 is for the second channel scanned, etc ZPS_tsInterPanAddress This structure is used to specify the destination for an inter-pan transmission. The ZPS_tsInterPanAddress structure is detailed below. typedef struct { enum { ZPS_E_AM_INTERPAN_GROUP = 0x01, ZPS_E_AM_INTERPAN_SHORT, ZPS_E_AM_INTERPAN_IEEE }emode; uint16 u16panid; ZPS_tuAddress uaddress; } ZPS_tsInterPanAddress; where: emode is used to specify the type of destination address that will be used in the field uaddress below - one of the following enumerations must be specified: ZPS_E_AM_INTERPAN_GROUP indicates that a 16-bit group address will be used to specify multiple target nodes in the destination network (the group address must be valid in the destination network) JN-UG-3101 v1.5 NXP Laboratories UK

230 Chapter 7 Application Framework (AF) API ZPS_E_AM_INTERPAN_SHORT indicates that a 16-bit network/short address will be used to specify a single target node or a broadcast to all nodes in the destination network ZPS_E_AM_INTERPAN_IEEE indicates that a 64-bit IEEE/MAC address will be used to specify a single target node in the destination network u16panid is the PAN ID of the destination network - a value 0xFFFF can be used to specify a broadcast to all reachable ZigBee PRO networks uaddress is the address of the target node(s) in the destination network (the address type must be as specified above in the emode field) - a value of 0xFFFF can be used to specify a broadcast to all nodes in the destination network(s) ZPS_tsAfProfileDataReq This structure is used to specify the transmission details for a data transmission submitted using the function ZPS_eAplAfApsdeDataReq(). The ZPS_tsAfProfileDataReq structure is detailed below. typedef struct { ZPS_tuAddress uint16 uint16 uint8 ZPS_teAplApsdeAddressMode uint8 ZPS_teAplAfSecurityMode uint8 }ZPS_tsAfProfileDataReq; where: udstaddr; u16clusterid; u16profileid; u8srcep; edstaddrmode; u8dstep; esecuritymode; u8radius; udstaddr is the address of the destination node for the transmission request (can be 16- or 64-bit, as specified by edstaddrmode) u16clusterid is the Cluster ID of the destination cluster u16profileid is the Profile ID of the destination application profile u8srcep is the source endpoint number (1-240) on the local node edstaddrmode is the type of destination address, one of (also see Table 7 on page 211): ZPS_E_ADDR_MODE_BOUND (no address needed for bound nodes) ZPS_E_ADDR_MODE_GROUP (16-bit group address) ZPS_E_ADDR_MODE_SHORT (16-bit network address) ZPS_E_ADDR_MODE_IEEE (64-bit IEEE/MAC address) 230 NXP Laboratories UK 2017 JN-UG-3101 v1.5

231 ZigBee PRO Stack u8dstep is the destination endpoint number (1-240) on the remote node esecuritymode is the security mode for the data transfer, one of: ZPS_E_APL_AF_UNSECURE (no security enabled) ZPS_E_APL_AF_SECURE (Application-level security using link key and network key) ZPS_E_APL_AF_SECURE_NWK (Network-level security using network key) ZPS_E_APL_AF_SECURE ZPS_E_APL_AF_EXT_NONCE (Application-level security using link key and network key with the extended NONCE included in the frame) ZPS_E_APL_AF_WILD_PROFILE (May be combined with above flags using OR operator. Sends the message using the wild card profile (0xFFFF) instead of the profile in the associated Simple descriptor) u8radius is the maximum number of hops permitted to the destination node (zero value specifies that default maximum is to be used) tsbeaconfiltertype This structure contains the details of a beacon filter that can be introduced using the function ZPS_bAppAddBeaconFilter(). The tsbeaconfiltertype structure is detailed below. typedef struct { uint64 *pu64extendpanidlist; uint8 u8listsize; uint8 u8lqi; uint8 u8filtermap; } tsbeaconfiltertype; where: pu64extendpanidlist is a pointer to a list of 64-bit Extended PAN IDs (EPIDs) which acts as a blacklist or whitelist of networks, depending on the settings of bits 0 and 1 in the u8filtermap bitmap: If this is a blacklist, beacons from networks with EPIDs in the list will not be accepted If this is a whitelist, only beacons from networks with EPIDs in the list will be accepted u8listsize is the number of Extended PAN IDs in the list pointed to by pu64extendpanidlist u8lqi is the minimum LQI value (in the range 0 to 255) of an acceptable beacon (any beacon with LQI value less than this minimum will be filtered out) - if required, this field must be enabled through bit 2 in the u8filtermap bitmap JN-UG-3101 v1.5 NXP Laboratories UK

232 Chapter 7 Application Framework (AF) API u8filtermap is an 8-bit bitmap detailing the filtering requirements, as follows: Bit Enumeration Description 0 BF_BITMAP_BLACKLIST(0x1) If set, field pu64extendpanidlist points to a blacklist of networks 1 BF_BITMAP_WHITELIST (0x2) If set, field pu64extendpanidlist points to a whitelist of networks 2 BF_BITMAP_LQI (0x4) If set, beacons must be filtered according to LQI value using the minimum in field u8lqi 3 BF_BITMAP_CAP_ENDDEVICE (0x8) If set, beacons from nodes with capacity for End Device children can be accepted 4 BF_BITMAP_CAP_ROUTER (0x10) If set, beacons from nodes with capacity for Router children can be accepted 5 BF_BITMAP_PERMIT_JOIN (0x20) If set, beacons from nodes with permit joining enabled can be accepted 6 - Reserved 7 - Reserved Note: Bits 0 and 1 must not both be set Note: After each discovery or rejoin, the flags contained in the u8filtermap field will be cleared while all other fields of this structure will remain intact. 232 NXP Laboratories UK 2017 JN-UG-3101 v1.5

233 ZigBee PRO Stack 8. ZigBee Device Profile (ZDP) API The chapter describes the resources of the ZigBee Device Profile (ZDP) API. This API is concerned with sending network requests (e.g. binding requests) and receiving responses. The API is defined in the header file zps_apl_zdp.h. In this chapter: Section 8.1 details the ZDP API functions Section 8.2 details the ZDP API structures Section 8.3 describes the broadcast options when sending requests using the ZDP API functions 8.1 ZDP API Functions The ZDP API functions are divided into the following categories: Address Discovery functions, described in Section Service Discovery functions, described in Section Binding functions, described in Section Network Management Service functions, described in Section Response Data Extraction function, described in Section Common Parameters All the ZDP API functions, except ZPS_bAplZdpUnpackResponse(), are concerned with sending out a request and all use a similar set of parameters. These parameters are described below, but more specific information is provided as part of the function descriptions: hapdu: This is the unique handle of the APDU (Application Protocol Data Unit) instance for the request to be sent (see below). udstaddr: This is the IEEE address or network address of the node to which the request will be sent (the parameter bextaddr must be set according to the type of address used). For a broadcast, udstaddr must be set to a special address, as described in Section 8.3. bextaddr: This is a Boolean indicating the type of address specified in the parameter udstaddr as a 64-bit IEEE address (TRUE) or 16-bit network address (FALSE). pu8seqnumber: This is a pointer to the sequence number for the request - each request must have a unique sequence number to help determine the order in which requests were sent. On sending a request, the function automatically increments the sequence number for the next request. u16profileid: This is the identifier of the ZigBee application profile being used. pszdpnwkaddrreq: This is a pointer to a structure representing the request. The structure used is dependent on the specific function. The different request structures are detailed in Section JN-UG-3101 v1.5 NXP Laboratories UK

234 Chapter 8 ZigBee Device Profile (ZDP) API APDUs for Requests and Responses A request generated by this API is sent in an APDU (Application Protocol Data Unit). A local APDU instance for the request must first be allocated using the PDUM function PDUM_hAPduAllocateAPduInstance(). This function returns a handle for the APDU instance, which is subsequently used in the relevant ZDP API request function. Once the request has been successfully sent, the APDU instance is automatically deallocated by the stack (there is no need for the application to de-allocate it). Note: If the request is not successfully sent (the send function does not return ZPS_E_SUCCESS) then the APDU instance will not be automatically de-allocated and the application should de-allocate it using the PDUM function PDUM_eAPduFreeAPduInstance(). When a response is subsequently received, the stack automatically allocates a local APDU instance and includes its handle in the notification event for the response. Once the response has been dealt with, the application must de-allocate the APDU instance using the function PDUM_eAPduFreeAPduInstance() Address Discovery Functions The ZDP Address Discovery functions are concerned with obtaining addresses of nodes in the network. The functions are listed below, along with their page references: Function Page ZPS_eAplZdpNwkAddrRequest 235 ZPS_eAplZdpIEEEAddrRequest 237 ZPS_eAplZdpDeviceAnnceRequest 238 Note: Further addressing functions are provided in the ZDO API and are described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

235 ZigBee PRO Stack ZPS_eAplZdpNwkAddrRequest ZPS_teStatus ZPS_eAplZdpNwkAddrRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpNwkAddrReq *pszdpnwkaddrreq); Description Parameters This function requests the 16-bit network address of the node with a particular 64-bit IEEE (MAC) address. The function sends out an NWK_addr_req request, which can be either unicast or broadcast, as follows: Unicast to another node, specified through udstaddr, that will know the required network address (this may be the parent of the node of interest or the Co-ordinator) Broadcast to the network, in which case udstaddr must be set to the special network address 0xFFFF (see Section 8.3) The IEEE address of the node of interest must be specified in the request, represented by the structure below (detailed further in Section ). typedef struct { uint64 u64ieeeaddr; uint8 u8requesttype; uint8 u8startindex; } ZPS_tsAplZdpNwkAddrReq; The required network address will be received in an NWK_addr_resp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpNwkAddrRsp (detailed in Section ). Note that this response can optionally contain the network addresses of the responding node s neighbours (this option is selected as part of the request through u8requesttype). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpnwkaddrreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) JN-UG-3101 v1.5 NXP Laboratories UK

236 Chapter 8 ZigBee Device Profile (ZDP) API Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

237 ZigBee PRO Stack ZPS_eAplZdpIEEEAddrRequest ZPS_teStatus ZPS_eAplZdpIeeeAddrRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpIeeeAddrReq *pszdpieeeaddrreq); Description Parameters This function requests the 64-bit IEEE (MAC) address of the node with a particular 16-bit network address. The function sends an IEEE_addr_req request to the relevant node, specified through udstaddr. The network address of the node of interest must also be specified in the request, represented by the structure below (detailed further in Section ). typedef struct { uint16 u16nwkaddrofinterest; uint8 u8requesttype; uint8 u8startindex; } ZPS_tsAplZdpIeeeAddrReq; The required IEEE address will be received in an IEEE_addr_resp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpIeeeAddrRsp (detailed in Section ). Note that this response can optionally contain the IEEE addresses of the responding node s neighbours (this option is selected as part of the request through u8requesttype). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpieeeaddrreq Handle of APDU instance in which request will be sent Network address of destination node of request (bextaddr must be set to FALSE - see below) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

238 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpDeviceAnnceRequest ZPS_teStatus ZPS_eAplZdpDeviceAnnceRequest( PDUM_thAPduInstance hapduinst, uint8 *pu8seqnumber, ZPS_tsAplZdpDeviceAnnceReq *pszdpdeviceanncereq); Description Parameters This function is used to notify other nodes that the local node has joined or rejoined the network. The function broadcasts a Device_annce announcement to the network and is normally automatically called by the ZDO when the local node joins or rejoins the network. The IEEE (MAC) and allocated network addresses as well as the capabilities of the sending node must be specified in the announcement, represented by the structure below (detailed further in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8capability; } ZPS_tsAplZdpDeviceAnnceReq; On receiving this announcement, a network node will update any information it holds that relates to the supplied IEEE and network addresses: If it already holds the supplied IEEE address, it will update the corresponding network address with the supplied one (if necessary). If it already holds the supplied network address but with a different corresponding IEEE address, the latter will be marked as not having a valid corresponding network address. hapduinst *pu8seqnumber *pszdpdeviceanncereq Handle of APDU instance in which request will be sent Pointer to sequence number of announcement Pointer to announcement (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

239 ZigBee PRO Stack Service Discovery Functions The ZDP Service Discovery functions are concerned with obtaining information about the nature and capabilities of a network node. The functions are listed below, along with their page references: Function Page ZPS_eAplZdpNodeDescRequest 240 ZPS_eAplZdpPowerDescRequest 241 ZPS_eAplZdpSimpleDescRequest 242 ZPS_eAplZdpExtendedSimpleDescRequest 243 ZPS_eAplZdpComplexDescRequest 245 ZPS_eAplZdpUserDescRequest 246 ZPS_eAplZdpMatchDescRequest 247 ZPS_eAplZdpActiveEpRequest 249 ZPS_eAplZdpExtendedActiveEpRequest 250 ZPS_eAplZdpUserDescSetRequest 252 ZPS_eAplZdpSystemServerDiscoveryRequest 254 ZPS_eAplZdpDiscoveryCacheRequest 255 ZPS_eAplZdpDiscoveryStoreRequest 256 ZPS_eAplZdpNodeDescStoreRequest 258 ZPS_eAplZdpPowerDescStoreRequest 260 ZPS_eAplZdpSimpleDescStoreRequest 262 ZPS_eAplZdpActiveEpStoreRequest 264 ZPS_eAplZdpFindNodeCacheRequest 266 ZPS_eAplZdpRemoveNodeCacheRequest 267 JN-UG-3101 v1.5 NXP Laboratories UK

240 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpNodeDescRequest ZPS_teStatus ZPS_eAplZdpNodeDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpNodeDescReq *pszdpnodedescreq); Description Parameters This function requests the Node descriptor of the node with a particular network address. The function sends a Node_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpNodeDescReq; The required Node descriptor will be received in a Node_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpNodeDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpnodedescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

241 ZigBee PRO Stack ZPS_eAplZdpPowerDescRequest ZPS_teStatus ZPS_eAplZdpPowerDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpPowerDescReq *pszdppowerdescreq); Description Parameters This function requests the Power descriptor of the node with a particular network address. The function sends a Power_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpPowerDescReq; The required Power descriptor will be received in a Power_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpPowerDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdppowerdescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

242 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpSimpleDescRequest ZPS_teStatus ZPS_eAplZdpSimpleDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpSimpleDescReq *pszdpsimpledescreq); Description Parameters This function requests the Simple descriptor for a specific endpoint on the node with a particular network address. The function sends a Simple_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest and the relevant endpoint on the node must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; uint8 u8endpoint; } ZPS_tsAplZdpSimpleDescReq; The required Simple descriptor will be received in a Simple_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpSimpleDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpsimpledescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

243 ZigBee PRO Stack ZPS_eAplZdpExtendedSimpleDescRequest ZPS_teStatus ZPS_eAplZdpExtendedSimpleDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpExtendedSimpleDescReq *pszdpextendedsimpledescreq); Description Parameters This function requests a cluster list for a specific endpoint on the node with a particular network address. The function should be called if the endpoint has more input or output clusters than could be included in the response to ZPS_eAplZdpSimpleDescRequest(). The function sends an Extended_Simple_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest and the relevant endpoint on the node must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint8 u8endpoint; uint8 u8startindex; } ZPS_tsAplZdpExtendedSimpleDescReq; This structure allows you to specify the first input/output cluster of interest in the endpoint s input and output cluster lists. Thus, this should normally be the cluster after the last one reported following a call to ZPS_eAplZdpSimpleDescRequest(). The required cluster information will be received in a Extended_Simple_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpExtendedSimpleDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpextendedsimpledescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) JN-UG-3101 v1.5 NXP Laboratories UK

244 Chapter 8 ZigBee Device Profile (ZDP) API Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

245 ZigBee PRO Stack ZPS_eAplZdpComplexDescRequest ZPS_teStatus ZPS_eAplZdpComplexDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpComplexDescReq *pszdpcomplexdescreq); Description Parameters This function requests the Complex descriptor of the node with a particular network address. The function sends a Complex_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpComplexDescReq; The required Complex descriptor will be received in a Complex_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpComplexDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpcomplexdescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

246 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpUserDescRequest ZPS_teStatus ZPS_eAplZdpUserDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpUserDescReq *pszdpuserdescreq); Description This function requests the User descriptor of the node with a particular network address. The function sends a User_Desc_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. Note: This function can only be used to access the User descriptor of a non-nxp device (which supports this descriptor), since the storage of a User descriptor on an NXP JN516x device is not supported. Parameters The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpUserDescReq; The required User descriptor will be received in a User_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpUserDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpuserdescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

247 ZigBee PRO Stack ZPS_eAplZdpMatchDescRequest ZPS_teStatus ZPS_eAplZdpMatchDescRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMatchDescReq *pszdpmatchdescreq); Description Parameters This function requests responses from network nodes with endpoints that match specified criteria in their Simple descriptors. More specifically, these criteria include: application profile, number of input clusters, number of output clusters, list of input clusters, list of output clusters. The function sends out a Match_Desc_req command, as a broadcast to all network nodes, or as a unicast to either a specific node of interest or another node that may hold the required information in its primary discovery cache. The wild card profile (0xFFFF) can be used to match any profile ID. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; uint16 u16profileid; /* rest of message is variable length */ uint8 u8numinclusters; uint16* pu16inclusterlist; uint8 u8numoutclusters; uint16* pu16outclusterlist; } ZPS_tsAplZdpMatchDescReq; A node with matching endpoint criteria will respond with a Match_Desc_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMatchDescRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmatchdescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) JN-UG-3101 v1.5 NXP Laboratories UK

248 Chapter 8 ZigBee Device Profile (ZDP) API Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

249 ZigBee PRO Stack ZPS_eAplZdpActiveEpRequest ZPS_teStatus ZPS_eAplZdpActiveEpRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpActiveEpReq *pszdpactiveepreq); Description Parameters This function requests a list of the active endpoints on a remote node. The function sends an Active_EP_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpActiveEpReq; The endpoint list will be received in an Active_EP_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpActiveEpRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpactiveepreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

250 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpExtendedActiveEpRequest ZPS_teStatus ZPS_eAplZdpExtendedActiveEpRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpExtendedActiveEpReq *pszdpextendedactiveepreq); Description Parameters This function requests a list of the active endpoints on a remote node. The function should be called if the node has more active endpoints than could be included in a response to ZPS_eAplZdpActiveEpRequest(). The function sends an Extended_Active_EP_req request either to the relevant node or to another node that may hold the required information in its primary discovery cache. The network address of the node of interest must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint8 u8startindex; } ZPS_tsAplZdpExtendedActiveEpReq; This structure allows you to specify the first endpoint of interest for the request. The endpoint list will be received in an Extended_Active_EP_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpExtendedActiveEpRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpactiveepreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 250 NXP Laboratories UK 2017 JN-UG-3101 v1.5

251 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

252 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpUserDescSetRequest ZPS_teStatus ZPS_eAplZdpUserDescSetRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpUserDescSet *pszdpuserdescsetreq); Description This function can be used to configure the User descriptor on a remote node. The function sends a User_Desc_set request either to the remote node or to another node that may hold the relevant User descriptor in its primary discovery cache. Note: This function can only be used to access the User descriptor of a non-nxp device (which supports this descriptor), since the storage of a User descriptor on an NXP JN516x device is not supported. Parameters The network address of the node of interest as well as the required modifications must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddrofinterest; uint8 u8length; char szuserdescriptor[zps_zdp_length_of_user_desc]; } ZPS_tsAplZdpUserDescSet; If the specified User descriptor was successfully modified, a User_Desc_conf response will be received. This response should be collected by the application task using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpUserDescConf (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpuserdescsetreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 252 NXP Laboratories UK 2017 JN-UG-3101 v1.5

253 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

254 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpSystemServerDiscoveryRequest ZPS_teStatus ZPS_eAplZdpSystemServerDiscoveryRequest( PDUM_thAPduInstance hapduinst, uint8 *pu8seqnumber, ZPS_tsAplZdpSystemServerDiscoveryReq *pszdpsystemserverdiscoveryreq); Description Parameters This function can be used to request information on the available servers hosted by remote nodes (Primary or Backup Trust Centre, Primary or Backup Binding Table Cache, Primary or Backup Discovery Cache, Network Manager). The function broadcasts a System_Server_Discovery_req request to all network nodes. The required servers must be specified by means of a bitmask in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16servermask; } ZPS_tsAplZdpSystemServerDiscoveryReq; A remote node will reply with a System_Server_Discovery_rsp response, indicating which of the requested servers are implemented. This response should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpSystemServerDiscoveryRsp (detailed in Section ). hapduinst *pu8seqnumber *pszdpsystemserverdiscoveryreq Handle of APDU instance in which request will be sent Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

255 ZigBee PRO Stack ZPS_eAplZdpDiscoveryCacheRequest ZPS_teStatus ZPS_eAplZdpDiscoveryCacheRequest( PDUM_thAPduInstance hapduinst, uint8 *pu8seqnumber, ZPS_tsAplZdpDiscoveryCacheReq *pszdpdiscoverycachereq); Description Parameters This function is used to discover which nodes in the network have a primary discovery cache - that is, a bank of information about other nodes in the network. The function broadcasts a Discovery_Cache_req request to the network. The request includes the network and IEEE addresses of the sending device, and is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpDiscoveryCacheReq; A node with a primary discovery cache replies with a Discovery_Cache_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpDiscoveryCacheRsp (detailed in Section ). hapduinst *pu8seqnumber *pszdpdiscoverycachereq Handle of APDU instance in which request will be sent Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

256 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpDiscoveryStoreRequest ZPS_teStatus ZPS_eAplZdpDiscoveryStoreRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpDiscoveryStoreReq *pszdpdiscoverystorereq); Description This function can be called on an End Device to request a remote node to reserve memory space to store the local node s discovery information. To do this, the remote node must contain a primary discovery cache. The discovery information includes the local node s IEEE address, network address, Node descriptor, Power descriptor, Simple descriptor and number of active endpoints. The function sends a Discovery_store_req request to the remote node. This request includes the network and IEEE addresses of the sending node as well as the amount of storage space (in bytes) needed to store the information. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8nodedescsize; uint8 u8powerdescsize; uint8 u8activeepsize; uint8 u8simpledesccount; /* Rest of message is variable length */ uint8* pu8simpledescsizelist; } ZPS_tsAplZdpDiscoveryStoreReq; On receiving this request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has storage space in the cache for the new discovery information. If the space is available, it will be reserved until the information is later uploaded from the local node. The node replies with a Discovery_store_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpDiscoveryStoreRsp (detailed in Section ). 256 NXP Laboratories UK 2017 JN-UG-3101 v1.5

257 ZigBee PRO Stack Parameters hapduinst, udstaddr bextaddr *pu8seqnumber *pszdpdiscoverystorereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

258 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpNodeDescStoreRequest ZPS_teStatus ZPS_eAplZdpNodeDescStoreRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpNodeDescStoreReq *pszdpnodedescstorereq); Description This function can be called on an End Device to upload the local node s Node descriptor for storage in the primary discovery cache on a remote node. The function sends a Node_Desc_store_req command to the remote node. This request includes the network and IEEE addresses of the sending node as well as the Node descriptor to store. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; /* Rest of message is variable length */ ZPS_tsAplZdpNodeDescriptor snodedescriptor; } ZPS_tsAplZdpNodeDescStoreReq; On receiving the request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has previously reserved storage space in its cache for the local node. If it has, it will store the Node descriptor in its cache. The node replies with a Node_Desc_store_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpNodeDescStoreRsp (detailed in Section ). Note: This function should only be called if storage space for the local node s discovery information has previously been reserved on the remote node following a call to ZPS_eAplZdpDiscoveryStoreRequest(). 258 NXP Laboratories UK 2017 JN-UG-3101 v1.5

259 ZigBee PRO Stack Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpnodedescstorereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

260 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpPowerDescStoreRequest ZPS_teStatus ZPS_eAplZdpPowerDescStoreRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpPowerDescStoreReq *pszdppowerdescstorereq); Description This function can be called on an End Device to upload the local node s Power descriptor for storage in the primary discovery cache on a remote node. The function sends a Power_Desc_store_req request to the remote node. This request includes the network and IEEE addresses of the sending node as well as the Power descriptor to store. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; /* Rest of message is variable length */ ZPS_tsAplZdpNodePowerDescriptor spowerdescriptor; } ZPS_tsAplZdpPowerDescStoreReq; On receiving the request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has previously reserved storage space in its cache for the local node. If it has, it will store the Power descriptor in its cache. The node replies with a Power_Desc_store_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpPowerDescStoreRsp (detailed in Section ). Note: This function should only be called if storage space for the local node s discovery information has previously been reserved on the remote node following a call to ZPS_eAplZdpDiscoveryStoreRequest(). 260 NXP Laboratories UK 2017 JN-UG-3101 v1.5

261 ZigBee PRO Stack Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdppowerdescstorereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

262 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpSimpleDescStoreRequest ZPS_teStatus ZPS_eAplZdpSimpleDescStoreRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpSimpleDescStoreReq *pszdpsimpledescstorereq); Description This function can be called on an End Device to upload a Simple descriptor from the local node for storage in the primary discovery cache on the specified remote node. The Simple descriptor for each endpoint on the local node must be uploaded separately using this function. The function sends a Simple_Desc_store_req request to the remote node. This request includes the network and IEEE addresses of the sending node as well as the Simple descriptor to store. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8length; /* Rest of message is variable length */ ZPS_tsAplZdpSimpleDescType ssimpledescriptor; } ZPS_tsAplZdpSimpleDescStoreReq; On receiving the request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has previously reserved storage space in its cache for the local node. If it has, it will store the Simple descriptor in its cache. The node replies with a Simple_Desc_store_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpSimpleDescStoreRsp (detailed in Section ). Note: This function should only be called if storage space for the local node s discovery information has previously been reserved on the remote node following a call to ZPS_eAplZdpDiscoveryStoreRequest(). 262 NXP Laboratories UK 2017 JN-UG-3101 v1.5

263 ZigBee PRO Stack Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpsimpledescstorereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

264 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpActiveEpStoreRequest ZPS_teStatus ZPS_eAplZdpActiveEpStoreRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpActiveEpStoreReq *pszdpactiveepstorereq); Description This function can be called on an End Device to upload a list of its active endpoints for storage in the primary discovery cache on a remote node. The function sends an Active_EP_store_req command to the remote node. This request includes the network and IEEE addresses of the sending node as well as the list of active endpoints to store. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8activeepcount; /* Rest of message is variable length */ uint8* pu8activeeplist; } ZPS_tsAplZdpActiveEpStoreReq; On receiving the request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has previously reserved storage space in its cache for the local node. If it has, it will store the list of active endpoints in its cache. The node replies with an Active_EP_store_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpActiveEpStoreRsp (detailed in Section ). Note: This function should only be called if storage space for the local node s discovery information has previously been reserved on the remote node following a call to ZPS_eAplZdpDiscoveryStoreRequest(). 264 NXP Laboratories UK 2017 JN-UG-3101 v1.5

265 ZigBee PRO Stack Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpactiveepstorereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

266 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpFindNodeCacheRequest ZPS_teStatus ZPS_eAplZdpFindNodeCacheRequest( PDUM_thAPduInstance hapduinst, uint8 *pu8seqnumber, ZPS_tsAplZdpFindNodeCacheReq *pszdpfindnodecachereq); Description Parameters This function can be used to search for nodes in the network that hold discovery information about a particular node. The function broadcasts a Find_node_cache_req request to the network. This request includes the network and IEEE addresses of the node of interest. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpFindNodeCacheReq; On receiving the request, a remote node will first check whether it has a primary discovery cache, or is the specified node itself. If either is the case, it will check whether it holds the required information and, if this is the case, will reply with a Find_node_cache_rsp response. This response should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpFindNodeCacheRsp (detailed in Section ). Only nodes that hold the required information will respond. hapduinst *pu8seqnumber *pszdpfindnodecachereq Handle of APDU instance in which request will be sent Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

267 ZigBee PRO Stack ZPS_eAplZdpRemoveNodeCacheRequest ZPS_teStatus ZPS_eAplZdpRemoveNodeCacheRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpRemoveNodeCacheReq *pszdpremovenodecachereq); Description This function requests a Primary Discovery Cache node to remove from its cache all discovery information relating to a particular End Device. The function sends a Remove_node_cache_req request to the Primary Discovery Cache node. The effect of a successful request is to remove the relevant discovery information and free the corresponding storage space in the cache previously reserved by ZPS_eAplZdpDiscoveryStoreRequest() (which may have been called from another node in the network). This request includes the network and IEEE addresses of the End Device whose discovery information is to be removed. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpRemoveNodeCacheReq; On receiving the request, the remote node will first check whether it has a primary discovery cache. If this is the case, it will check whether it has previously received and implemented a Discovery_store_req request for the specified End Device, resulting from a call to ZPS_eAplZdpDiscoveryStoreRequest(). If it has, it will delete the relevant data and unreserve the corresponding part of the cache. The node replies with a Remove_node_cache_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpRemoveNodeCacheRsp (detailed in Section ). JN-UG-3101 v1.5 NXP Laboratories UK

268 Chapter 8 ZigBee Device Profile (ZDP) API Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpremovenodecachereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

269 ZigBee PRO Stack Binding Functions The ZDP Binding functions are concerned with binding nodes together, to aid communication between them, and managing binding tables. The functions are listed below, along with their page references: Function Page ZPS_eAplZdpEndDeviceBindRequest 270 ZPS_eAplZdpBindUnbindRequest 272 ZPS_eAplZdpBindRegisterRequest 274 ZPS_eAplZdpReplaceDeviceRequest 275 ZPS_eAplZdpStoreBkupBindEntryRequest 277 ZPS_eAplZdpRemoveBkupBindEntryRequest 279 ZPS_eAplZdpBackupBindTableRequest 281 ZPS_eAplZdpRecoverBindTableRequest 283 ZPS_eAplZdpBackupSourceBindRequest 285 ZPS_eAplZdpRecoverSourceBindRequest 287 Note 1: Some of the above binding functions cannot be used to send requests to nodes that run the NXP ZigBee PRO stack. They are supplied in the NXP ZDP API in order to facilitate interoperability with nodes based on non-nxp software which supports the corresponding requests. If applicable, this restriction is noted in the function description. Note 2: Further binding functions are provided in the ZDO API and are described in Section JN-UG-3101 v1.5 NXP Laboratories UK

270 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpEndDeviceBindRequest ZPS_teStatus ZPS_eAplZdpEndDeviceBindRequest( PDUM_thAPduInstance hapduinst, uint8 *pu8seqnumber, ZPS_tsAplZdpEndDeviceBindReq *pszdpenddevicebindreq); Description This function sends a binding request to the Co-ordinator in order to bind an endpoint on the local node to an endpoint on a remote node (these nodes can be End Devices or Routers). The function should normally be invoked as the result of a user action on the local node, such as pressing a button. The function sends an End_Device_Bind_req request to the Co-ordinator. This request includes details of the source node, endpoint and clusters. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16bindingtarget; uint64 u64srcieeeaddress; uint8 u8srcendpoint; uint16 u16profileid; /* Rest of message is variable length */ uint8 u8numinclusters; uint16 *pu16inclusterlist; uint8 u8numoutclusters; uint16 *pu16outclusterlist; } ZPS_tsAplZdpEndDeviceBindReq; On receiving the request, the Co-ordinator waits (for a pre-defined timeout period) for another binding request, from a different node, so that it can pair the requests and bind the endpoints. In order to bind the endpoints, their application profile IDs must match, and they must have compatible clusters in their input and output cluster lists. The Co-ordinator replies to a binding request with an End_Device_Bind_rsp response, which should be collected on the requesting node using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpEndDeviceBindRsp (detailed in Section ). The stack will automatically update the Binding tables on the two End Devices (following further bind requests from the Co-ordinator) and an ZPS_EVENT_ZDO_BIND event will be generated on the End Devices to signal these updates. 270 NXP Laboratories UK 2017 JN-UG-3101 v1.5

271 ZigBee PRO Stack Parameters hapduinst *pu8seqnumber *pszdpenddevicebindreq Handle of APDU instance in which request will be sent Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

272 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpBindUnbindRequest ZPS_teStatus ZPS_eAplZdpBindUnbindRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, bool bbindreq, ZPS_tsAplZdpBindUnbindReq *pszdpbindreq); Description This function sends a binding or unbinding request (as specified) to a remote node which hosts a binding table. The function requests a modification of the binding table in order to bind or unbind two endpoints of nodes in the network. The nodes to be bound/unbound may be different from the node sending the request and the node receiving the request. The latter must be either a node with a primary binding table cache or the source node for the binding. This function could typically be used in a commissioning application to configure bindings between nodes during system setup. The function sends a Bind_req or Unbind_req request to the remote node which hosts the binding table to be modified. This request includes details of the source node and endpoint, and the target node and endpoint for the binding. The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; } uaddressfield; } ZPS_tsAplZdpBindUnbindReq; On receiving the request, the remote node adds or removes the relevant entry in its binding table and locally generates the event ZPS_EVENT_ZDO_BIND or ZPS_EVENT_ZDO_UNBIND, as appropriate, to signal the relevant update. 272 NXP Laboratories UK 2017 JN-UG-3101 v1.5

273 ZigBee PRO Stack If the remote node holds a primary binding table cache, it will check whether the source node for the binding holds a table of its own source bindings (see the description of ZPS_eAplZdpBindRegisterRequest()) and, if so, automatically requests an update of this table. A node with a primary binding table cache will also request an update of the back-up cache, if one exists. The remote node replies with a Bind_rsp or Unbind_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpBindRsp (detailed in Section ) or ZPS_tsAplZdpUnbindRsp (detailed in Section ). Parameters hapduinst udstaddr bextaddr *pu8seqnumber bbindreq *pszdpbindreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Bind or unbind request: TRUE: bind FALSE: unbind Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

274 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpBindRegisterRequest ZPS_teStatus ZPS_eAplZdpBindRegisterRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpBindRegisterReq *pszdpbindregisterreq); Description Parameters This function informs a remote node with a primary binding table cache that the local node will hold its own binding table entries (and therefore the remote node does not need to hold these entries). The function sends a Bind_Register_req request to the remote node. The IEEE address of the local node must be specified in the request, which is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64nodeaddress; } ZPS_tsAplZdpBindRegisterReq; The remote node will reply with a Bind_Register_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpBindRegisterRsp (detailed in Section ). This response contains any information stored about the binding on the remote. hapduinst udstaddr bextaddr *pu8seqnumber *pszdppowerdescreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

275 ZigBee PRO Stack ZPS_eAplZdpReplaceDeviceRequest ZPS_teStatus ZPS_eAplZdpReplaceDeviceRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpReplaceDeviceReq *pszdpreplacedevicereq); Description This function requests a remote node with a primary binding table cache to modify binding table entries with new data - more specifically, binding table entries can be modified by replacing an IEEE address and/or associated endpoint number. This function could typically be used in a commissioning application to modify bindings between nodes. The function sends a Replace_Device_req request to the remote node. This request must include the old IEEE address and its replacement, as well as the corresponding endpoint number and its replacement (if any). The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64oldaddress; uint8 u8oldendpoint; uint64 u64newaddress; uint8 u8newendpoint; } ZPS_tsAplZdpReplaceDeviceReq; On receiving this request, the remote node will search its binding table for entries containing the old IEEE address and old endpoint number from the request - this pair of values may make up the source or destination data of the binding table entry. These values will be replaced by the new IEEE address and endpoint number from the request. Note that if the endpoint number in the request is zero, only the address will be included in the search and replace (the endpoint number in the modified binding table entries will be left unchanged). The remote node will check whether a node affected by a binding table change holds a table of its own source bindings (see ZPS_eAplZdpBindRegisterRequest()) and, if so, automatically requests an update of this table. The remote node will also request an update of the back-up of the primary binding table cache, if one exists. The remote node will reply with a Replace_Device_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpReplaceDeviceRsp (detailed in Section ). JN-UG-3101 v1.5 NXP Laboratories UK

276 Chapter 8 ZigBee Device Profile (ZDP) API Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpreplacedevicereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

277 ZigBee PRO Stack ZPS_eAplZdpStoreBkupBindEntryRequest ZPS_teStatus ZPS_eAplZdpStoreBkupBindEntryRequest( PDUM_thAPdu hapdu, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, uint16 u16profileid, ZPS_tsAplZdpStoreBkupBindEntryReq *pszdpstorebkupbindentryreq); Description This function requests that a back-up of an entry in the local primary binding table cache is performed on a remote node. The destination node of the request must hold the corresponding back-up binding table cache. The back-up operation is normally required when a new entry has been added to the primary binding table cache. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. This request must include the binding table entry to be backed up. The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; } ZPS_tsAplZdpStoreBkupBindEntryReq; On receiving the request, the remote node adds the specified binding table entry to its back-up binding table cache, if possible. JN-UG-3101 v1.5 NXP Laboratories UK

278 Chapter 8 ZigBee Device Profile (ZDP) API The remote node replies with a Store_Bkup_Bind_Entry_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpStoreBkupBindEntryRsp (detailed in Section ). Parameters hapdu udstaddr Handle of APDU in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) bextaddr Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address *pu8seqnumber Pointer to sequence number of request u16profileid Application profile ID *pszdpstorebkupbindentryreq Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

279 ZigBee PRO Stack ZPS_eAplZdpRemoveBkupBindEntryRequest ZPS_teStatus ZPS_eAplZdpRemoveBkupBindEntryRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpRemoveBkupBindEntryReq *pszdpremovebkupbindentryreq); Description This function requests the removal of an entry in the back-up binding table cache on a remote node. The function must be called from the node with the corresponding primary binding table cache. The removal of a back-up entry is normally required when an entry in the primary binding table cache has been removed. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. This request must include the binding table entry to be removed. The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; } ZPS_tsAplZdpRemoveBkupBindEntryReq; On receiving the request, the remote node removes the specified binding table entry from its back-up binding table cache, if possible. JN-UG-3101 v1.5 NXP Laboratories UK

280 Chapter 8 ZigBee Device Profile (ZDP) API The remote node replies with a Remove_Bkup_Bind_Entry_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpRemoveBkupBindEntryRsp (detailed in Section ). Parameters hapduinst Handle of APDU instance in which request will be sent udstaddr Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) bextaddr Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address *pu8seqnumber Pointer to sequence number of request *pszdpremovebkupbindentryreq Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

281 ZigBee PRO Stack ZPS_eAplZdpBackupBindTableRequest ZPS_teStatus ZPS_eAplZdpBackupBindTableRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpBackupBindTableReq *pszdpbackupbindtablereq); Description This function requests that a back-up of the locally held primary binding table cache is performed on a remote node - the whole or part of the table can be backed up. The destination node of the request must hold the corresponding back-up binding table cache. The latter must already exist and be associated with the cache on the local node through a previous discovery. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. This request must include the binding table entries to be backed up. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16bindingtableentries; uint16 u16startindex; uint16 u16bindingtablelistcount; /* Rest of message is variable length */ ZPS_tsAplZdpBindingTable sbindingtable; } ZPS_tsAplZdpBackupBindTableReq; On receiving the request, the remote node saves the new binding table, if possible, overwriting existing entries. If the new table is longer than the previous one, as many extra entries as possible will be saved. The remote node replies with a Backup_Bind_Table_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpBackupBindTableRsp (detailed in Section ). JN-UG-3101 v1.5 NXP Laboratories UK

282 Chapter 8 ZigBee Device Profile (ZDP) API Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpbackupbindtablereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

283 ZigBee PRO Stack ZPS_eAplZdpRecoverBindTableRequest ZPS_teStatus ZPS_eAplZdpRecoverBindTableRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpRecoverBindTableReq *pszdprecoverbindtablereq); Description This function requests that a back-up of the locally held primary binding table cache is recovered from a remote node. The destination node of the request must hold the back-up binding table cache which is associated with the primary cache on the local node. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters This request must indicate the starting index in the binding table for the recovery. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16startindex; } ZPS_tsAplZdpRecoverBindTableReq; The remote node replies with a Recover_Bind_Table_rsp response containing the required binding table entries, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpRecoverBindTableRsp (detailed in Section ). As many binding entries as possible are included in this response. If the returned binding table is incomplete, this is indicated in the response and this function must be called again, with the appropriate starting index, to recover the rest of the table. hapduinst udstaddr bextaddr *pu8seqnumber *pszdprecoverbindtablereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) JN-UG-3101 v1.5 NXP Laboratories UK

284 Chapter 8 ZigBee Device Profile (ZDP) API Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

285 ZigBee PRO Stack ZPS_eAplZdpBackupSourceBindRequest ZPS_teStatus ZPS_eAplZdpBackupSourceBindRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpBackupSourceBindReq *pszdpbackupsourcebindreq); Description This function requests that a back-up of the locally held source binding table is performed on a remote node. This source binding table contains entries only relevant to the local node. The function must be called from a node with a primary binding table cache and the destination node of the request must hold the corresponding back-up binding table cache. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. This request must include the source binding table entries to be backed up. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16sourcetableentries; uint16 u16startindex; uint16 u16sourcetablelistcount; /* Rest of message is variable length */ uint64* pu64sourceaddress; } ZPS_tsAplZdpBackupSourceBindReq; On receiving the request, the remote node saves the new source binding table, if possible, overwriting existing entries. If the new table is longer than the previous one, as many extra entries as possible will be saved. The remote node replies with a Backup_Source_Bind_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpBackupSourceBindRsp (detailed in Section ). JN-UG-3101 v1.5 NXP Laboratories UK

286 Chapter 8 ZigBee Device Profile (ZDP) API Parameters hapduinst udstaddr Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) bextaddr Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address *pu8seqnumber Pointer to sequence number of request *pszdpbackupsourcebindreq Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

287 ZigBee PRO Stack ZPS_eAplZdpRecoverSourceBindRequest ZPS_teStatus ZPS_eAplZdpRecoverSourceBindRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpRecoverSourceBindReq *pszdprecoversourcebindreq); Description This function requests that a back-up of the locally held source binding table is recovered from a remote node. The function must be called from a node with a primary binding table cache and the destination node of the request must hold the corresponding back-up binding table cache. Note: This function is provided in the NXP ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters This request must indicate the starting index in the binding table for the recovery. The request is represented by the structure below (further detailed in Section ). typedef struct { uint16 u16startindex; } ZPS_tsAplZdpRecoverSourceBindReq; The remote node replies with a Recover_Source_Bind_rsp response containing the required binding table entries, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpRecoverSourceBindRsp (detailed in Section ). As many binding entries as possible are included in this response. If the returned binding table is incomplete, this is indicated in the response and this function must be called again, with the appropriate starting index, to recover the rest of the table. hapduinst udstaddr bextaddr *pu8seqnumber *pszdprecoversourcebindreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) JN-UG-3101 v1.5 NXP Laboratories UK

288 Chapter 8 ZigBee Device Profile (ZDP) API Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

289 ZigBee PRO Stack Network Management Services Functions The ZDP Network Management Services functions are concerned with requests for network operations to be implemented remotely. The functions are listed below, along with their page references: Function Page ZPS_eAplZdpMgmtNwkDiscRequest 290 ZPS_eAplZdpMgmtLqiRequest 292 ZPS_eAplZdpMgmtRtgRequest 293 ZPS_eAplZdpMgmtBindRequest 294 ZPS_eAplZdpMgmtLeaveRequest 296 ZPS_eAplZdpMgmtDirectJoinRequest 298 ZPS_eAplZdpMgmtPermitJoiningRequest 300 ZPS_eAplZdpMgmtCacheRequest 302 ZPS_eAplZdpMgmtNwkUpdateRequest 304 Note: Some of these functions cannot be used to send requests to nodes that run the NXP ZigBee PRO stack. They are supplied in the ZDP API in order to facilitate interoperability with nodes based on non-nxp software which supports the corresponding requests. JN-UG-3101 v1.5 NXP Laboratories UK

290 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtNwkDiscRequest ZPS_teStatus ZPS_eAplZdpMgmtNwkDiscRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtNwkDiscReq *pszdpmgmtnwkdiscreq); Description This function requests a remote node to perform a channel scan in order to discover any other wireless networks that are operating in the neighbourhood. Note: This function is provided in the ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters This request must specify the requirements for the scan: channels to scan, duration of scan, starting channel. The request is represented by the structure below (further detailed in Section ). typedef struct { uint32 u32scanchannels; uint8 u8scanduration; uint8 u8startindex; } ZPS_tsAplZdpMgmtNwkDiscReq; The remote node replies with a Mgmt_NWK_Disc_rsp response containing the scan results, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtNwkDiscRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtnwkdiscreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 290 NXP Laboratories UK 2017 JN-UG-3101 v1.5

291 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

292 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtLqiRequest ZPS_teStatus ZPS_eAplZdpMgmtLqiRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtLqiReq *pszdpmgmtlqireq); Description Parameters This function requests a remote node to provide a list of neighbouring nodes, from its Neighbour table, including LQI (link quality) values for radio transmissions from each of these nodes. The destination node of this request must be a Router or the Coordinator. This request must specify the index of the first node in the Neighbour table to report. The request is represented by the structure below (further detailed in Section ). typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtLqiReq; The remote node replies with a Mgmt_Lqi_rsp response containing the required information, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtLqiRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtlqireq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section NXP Laboratories UK 2017 JN-UG-3101 v1.5

293 ZigBee PRO Stack ZPS_eAplZdpMgmtRtgRequest ZPS_teStatus ZPS_eAplZdpMgmtRtgRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtRtgReq *pszdpmgmtrtgreq); Description Parameters This function requests a remote node to provide the contents of its Routing table. The destination node of this request must be a Router or the Co-ordinator. This request must specify the index of the first entry in the Routing table to report. The request is represented by the structure below (further detailed in Section ). typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtRtgReq; The remote node replies with a Mgmt_Rtg_rsp response containing the required information, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtRtgRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtrtgreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

294 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtBindRequest ZPS_teStatus ZPS_eAplZdpMgmtBindRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtBindReq *pszdpmgmtbindreq); Description Parameters This function requests a remote node to provide the contents of its Binding table. The destination node of this request must be a Router or the Co-ordinator. This request must specify the index of the first entry in the Binding table to report. The request is represented by the structure below (further detailed in Section ). typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtBindReq; The remote node replies with a Mgmt_Bind_rsp response containing the required information, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtBindRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtbindreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 294 NXP Laboratories UK 2017 JN-UG-3101 v1.5

295 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

296 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtLeaveRequest ZPS_teStatus ZPS_eAplZdpMgmtLeaveRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtLeaveReq *pszdpmgmtleavereq); Description This function requests a remote node to leave the network. The request also indicates whether the children of the leaving node should also be requested to leave and whether the leaving node(s) should subsequently attempt to rejoin the network. Note: This function is provided in the ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters The IEEE address of the node to leave the network must be included in the request, as well as flags indicating the children and rejoin choices (see above). The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64deviceaddress; uint8 u8flags; } ZPS_tsAplZdpMgmtLeaveReq; The remote node replies with a Mgmt_Leave_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtLeaveRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtleavereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 296 NXP Laboratories UK 2017 JN-UG-3101 v1.5

297 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

298 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtDirectJoinRequest ZPS_teStatus ZPS_eAplZdpMgmtDirectJoinRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtDirectJoinReq *pszdpmgmtdirectjoinreq); Description This function requests a remote node to allow a particular device (identified through its IEEE address) to join the network as a child of the node. Thus, joining should be enabled on the remote node just for the nominated device. The destination node of this request must be a Router or the Co-ordinator. Note: This function is provided in the ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters The IEEE address of the nominated device as well as its capabilities must be included in the request. The request is represented by the structure below (further detailed in Section ). typedef struct { uint64 u64deviceaddress; uint8 u8capability; } ZPS_tsAplZdpMgmtDirectJoinReq; The remote node replies with a Mgmt_Direct_Join_req response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtDirectJoinRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtdirectjoinreq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 298 NXP Laboratories UK 2017 JN-UG-3101 v1.5

299 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

300 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtPermitJoiningRequest ZPS_teStatus ZPS_eAplZdpMgmtPermitJoiningRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtPermitJoiningReq *pszdpmgmtpermitjoiningreq); Description This function requests a remote node to enable or disable joining for a specified amount of time. The destination node of this request must be a Router or the Coordinator. The request can be unicast to a particular node or broadcast to all routing nodes (for which the destination address must be set to the 16-bit network address 0xFFFC). Note: This function is provided in the ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters The duration of the enable or disable joining state must be specified in the request. The request is represented by the structure below (further detailed in Section ). typedef struct { uint8 u8permitduration; bool_t btcsignificance; } ZPS_tsAplZdpMgmtPermitJoiningReq; If the request was unicast, the remote node replies with a Mgmt_Permit_Joining_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtPermitJoiningRsp (detailed in Section ). hapduinst udstaddr Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) bextaddr Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address *pu8seqnumber Pointer to sequence number of request *pszdpmgmtpermitjoiningreq Pointer to request (see above) 300 NXP Laboratories UK 2017 JN-UG-3101 v1.5

301 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

302 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtCacheRequest ZPS_teStatus ZPS_eAplZdpMgmtCacheRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtCacheReq *pszdpmgmtcachereq); Description This function requests a remote node to provide a list of the End Devices registered in its primary discovery cache. Therefore, the destination node must contain a primary discovery cache. Note: This function is provided in the ZDP API for the reason of interoperability with nodes running non-nxp ZigBee PRO stacks that support the generated request. On receiving a request from this function, the NXP ZigBee PRO stack will return the status ZPS_ZDP_NOT_SUPPORTED. Parameters The request is represented by the structure below (further detailed in Section ). typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtCacheReq; The remote node replies with a Mgmt_Cache_rsp response, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtCacheRsp (detailed in Section ). hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtcachereq Handle of APDU in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) 302 NXP Laboratories UK 2017 JN-UG-3101 v1.5

303 ZigBee PRO Stack Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

304 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_eAplZdpMgmtNwkUpdateRequest ZPS_teStatus ZPS_eAplZdpMgmtNwkUpdateRequest( PDUM_thAPduInstance hapduinst, ZPS_tuAddress udstaddr, bool bextaddr, uint8 *pu8seqnumber, ZPS_tsAplZdpMgmtNwkUpdateReq *pszdpmgmtnwkupdatereq); Description This function requests an update of network parameters related to radio communication. The request can specify any of the following: update the radio channel mask (for scans) and the 16-bit network address of the network manager (node nominated to manage radio-band operation of network) change the radio channel used scan radio channels and report the results The request can be broadcast or unicast to nodes with radio receivers that are configured to remain on during idle periods. The request is represented by the structure below (further detailed in Section ). typedef struct { uint32 u32scanchannels; uint8 u8scanduration; uint8 u8scancount; uint8 u8nwkupdateid; uint16 u16nwkmanageraddr; } ZPS_tsAplZdpMgmtNwkUpdateReq; The specific action to be taken as a result of this request is indicated through the element u8scanduration, as described in the table below. 304 NXP Laboratories UK 2017 JN-UG-3101 v1.5

305 ZigBee PRO Stack u8scanduration 0x00-0x05 0x06-0xFD 0xFE 0xFF Action Perform radio channel scan on the set of channels specified through u32scanchannels. The time, in seconds, spent scanning each channel is determined by the value of u8scanduration and the number of scans is equal to the value of u8scancount. Valid for unicasts only. Reserved Change radio channel to single channel specified through u32scanchannels and set the network manager address to that specified through u16nwkmanageraddr. Valid for broadcasts only. Update the stored radio channel mask with that specified through u32scanchannels (but do not scan). Valid for broadcasts only. The remote node replies with a Mgmt_NWK_Update_notify notification, which should be collected using the RTOS function OS_eCollectMessage() and stored in a structure of type ZPS_tsAplZdpMgmtNwkUpdateNotify (detailed in Section ). Parameters hapduinst udstaddr bextaddr *pu8seqnumber *pszdpmgmtnwkupdatereq Handle of APDU instance in which request will be sent Address of destination node of request (can be 16- or 64-bit, as specified by bextaddr) Type of destination address: TRUE: 64-bit IEEE (MAC) address FALSE: 16-bit network address Pointer to sequence number of request Pointer to request (see above) Returns ZPS_E_SUCCESS (request successfully sent) APS return codes, listed and described in Section NWK return codes, listed and described in Section MAC return codes, listed and described in Section JN-UG-3101 v1.5 NXP Laboratories UK

306 Chapter 8 ZigBee Device Profile (ZDP) API Response Data Extraction Function The ZDP Response Data Extraction function is concerned with obtaining the data from a received response packet which is destined for the ZDO. The function should be called when a ZPS_EVENT_APS_DATA_INDICATION event is generated for destination endpoint 0. The function is listed below, along with its page reference: Function Page ZPS_bAplZdpUnpackResponse 307 Note: This function and the related structure ZPS_tsAfZdpEvent are defined in the header file appzdpextraction.h. 306 NXP Laboratories UK 2017 JN-UG-3101 v1.5

307 ZigBee PRO Stack ZPS_bAplZdpUnpackResponse bool ZPS_bAplZdpUnpackResponse( ZPS_tsAfEvent *pszdoserverevent, ZPS_tsAfZdpEvent *psreturnstruct); Description This function can be used to extract data received in a response packet which is destined for the ZDO (at endpoint 0). When such a packet is received, the event ZPS_EVENT_APS_DATA_INDICATION is generated. The application must then check whether the destination endpoint number is 0 in the event and, if this is the case, call this function to extract the response data from the event. A pointer to a ZPS_tsAfZdpEvent structure must be provided, which the function will populate with the extracted data. Parameters *pszdoserverevent *psreturnstruct Pointer to structure containing the event (see Section ) Pointer to structure to receive extracted data (see Section ) Returns TRUE if data successfully extracted FALSE if data not successfully extracted JN-UG-3101 v1.5 NXP Laboratories UK

308 Chapter 8 ZigBee Device Profile (ZDP) API 8.2 ZDP Structures This section describes the structures used by the ZigBee Device Profile (ZDP) API. Three sets of structures are presented: Structures used to represent the descriptors that reside on a node - see Section Structures used to issue requests using the ZDP functions - see Section Structures used to receive responses to the ZDP requests - see Section Descriptor Structures These structures are used to represent the following descriptors that contain information about the host node: Node descriptor Node Power descriptor Simple descriptor The structures are listed below, along with their page references. Structure Page ZPS_tsAplZdpNodeDescriptor 308 ZPS_tsAplZdpNodePowerDescriptor 310 ZPS_tsAplZdpSimpleDescType ZPS_tsAplZdpNodeDescriptor The ZDP Node descriptor structure ZPS_tsAplZdpNodeDescriptor is shown below. typedef struct { union { ZPS_tsAplZdpNodeDescBitFields sbitfields; uint16 u16value; } ubitunion; uint8 u8macflags; uint16 u16manufacturercode; uint8 u8maxbuffersize; uint16 u16maxrxsize; uint16 u16servermask; uint16 u16maxtxsize; uint8 u8descriptorcapability; } ZPS_tsAplZdpNodeDescriptor; where: 308 NXP Laboratories UK 2017 JN-UG-3101 v1.5

309 ZigBee PRO Stack sbitfields is a structure of the type ZPS_tsAplZdpNodeDescBitFields (described below) containing various items of information about the node. u16value is used for the union and should be set to 0x0000. emacflags contains 8 bits (bits 0-7) indicating the node capabilities, as required by the IEEE MAC sub-layer. These node capability flags are described in Table 8 on page 216. u16manufacturercode contains 16 bits (bits 0-15) indicating the manufacturer code for the node, where this code is allocated to the manufacturer by the ZigBee Alliance. u8maxbuffersize is the maximum size, in bytes, of an NPDU (Network Protocol Data Unit). u16maxrxsize is the maximum size, in bytes, of an APDU (Application Protocol Data Unit). This value can be greater than the value of u8maxbuffersize, due to the fragmentation of an APDU into NPDUs. u16servermask contains 8 bits (bits 0-7) indicating the server status of the node. This server mask is detailed in Table 15 on page 349. u16maxtxsize is the maximum size, in bytes, of the ASDU (Application Sublayer Data Unit) in which a message can be sent (the message may actually be transmitted in smaller fragments) u8descriptorcapability contains 8 bits (bits 0-7) indicating the properties of the node that can be used by other nodes in network discovery, as indicated in the table below. Bit Description 0 Set to 1 if Extended Active Endpoint List is available on the node, 0 otherwise 1 Set to 1 if Extended Simple Descriptor List is available on the node, 0 otherwise 2-7 Reserved ZPS_tsAplZdpNodeDescBitFields The ZPS_tsAplZdpNodeDescBitFields structure is used by the sbitfields element in the Node descriptor structure (see above), and is shown below: typedef struct { unsigned efrequencyband : 5; unsigned eapsflags : 3; unsigned ereserved : 3; /* reserved */ unsigned buserdescavail : 1; unsigned bcomplexdescavail : 1; unsigned elogicaltype : 3; }ZPS_tsAplZdpNodeDescBitFields; where: JN-UG-3101 v1.5 NXP Laboratories UK

310 Chapter 8 ZigBee Device Profile (ZDP) API efrequencyband is a 5-bit value representing the IEEE radiofrequency band used by the node: 0: 868-MHz band 2: 915-MHz band 3: 2400-MHz band eapsflags is a 3-bit value containing flags that indicate the ZigBee APS capabilities of the node (not currently supported and should be set to 0). ereserved is a 3-bit reserved value. buserdescavail is a 1-bit value indicating whether a User descriptor is available for the node - 1 indicates available, 0 indicates unavailable. bcomplexdescavail is a 1-bit value indicating whether a Complex descriptor is available for the node - 1 indicates available, 0 indicates unavailable. elogicaltype is a 3-bit value indicating the ZigBee device of the node: 0: Co-ordinator 1: Router 2: End Device ZPS_tsAplZdpNodePowerDescriptor The ZDP Node Power descriptor structure ZPS_tsAplZdpNodePowerDescriptor is shown below. typedef struct { union { ZPS_tsAplZdpPowerDescBitFields sbitfields; uint16 u16value; }ubitunion; } ZPS_tsAplZdpNodePowerDescriptor; where: sbitfields is a structure of type ZPS_tsAplZdpPowerDescBitFields (described below) containing various items of information about the node s power. u16value is used for the union and should be set to 0x NXP Laboratories UK 2017 JN-UG-3101 v1.5

311 ZigBee PRO Stack ZPS_tsAplZdpPowerDescBitFields The ZPS_tsAplZdpPowerDescBitFields structure is used by the sbitfields element in the Node Power descriptor structure (see above), and is shown below: typedef struct { unsigned ecurrentpowersourcelevel : 4; unsigned ecurrentpowersource : 4; unsigned eavailablepowersource : 4; unsigned ecurrentpowermode : 4; }ZPS_tsAplZdpPowerDescBitFields; where: ecurrentpowersourcelevel is a 4-bit value roughly indicating the level of charge of the node s power source (mainly useful for batteries), as follows: 0000: Critically low 0100: Approximately 33% 1000: Approximately 66% 1100: Approximately 100% (near fully charged) ecurrentpowersource is a 4-bit value indicating the current power source for the node, as detailed below (the bit corresponding to the current power source is set to 1, all other bits are set to 0): Bit 0: Permanent mains supply Bit 1: Rechargeable battery Bit 2: Disposable battery Bit 4: Reserved eavailablepowersource is a 4-bit value indicating the available power sources for the node, as detailed above (a bit is set to 1 if the corresponding power source is available). ecurrentpowermode is a 4-bit value indicating the power mode currently used by the node, as follows: 0000: Receiver synchronised with the receiver on when idle subfield of the Node descriptor 0001: Receiver switched on periodically, as defined by the Node Power descriptor 0010: Receiver switched on when stimulated, e.g. by pressing a button All other values are reserved JN-UG-3101 v1.5 NXP Laboratories UK

312 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpSimpleDescType The ZDP Simple descriptor structure ZPS_tsAplZdpSimpleDescType is shown below. typedef struct { uint8 u8endpoint; uint16 u16applicationprofileid; uint16 u16deviceid; union { ZPS_tsAplZdpSimpleDescBitFields sbitfields; uint8 u8value; }ubitunion; uint8 u8inclustercount; uint16* pu16inclusterlist; uint8 u8outclustercount; uint16* pu16outclusterlist; }ZPS_tsAplZdpSimpleDescType; where: u8endpoint is the number, in the range 1-240, of the endpoint to which the Simple descriptor corresponds. u16applicationprofileid is the 16-bit identifier of the ZigBee application profile supported by the endpoint. This must be an application profile identifier issued by the ZigBee Alliance. u16deviceid is the 16-bit identifier of the ZigBee device description supported by the endpoint. This must be a device description identifier issued by the ZigBee Alliance. sbitfields is a structure of type ZPS_tsAplZdpSimpleDescBitFields (described below) containing information about the endpoint. u8value is used for the union and must be set to 0x00. u8inclustercount is an 8-bit count of the number of input clusters, supported on the endpoint, that will appear in the list pointed to by the pu16inclusterlist element. *pu16inclusterlist is a pointer to the list of input clusters supported by the endpoint (for use during the service discovery and binding procedures). This is a sequence of 16-bit values, representing the cluster numbers (in the range 1-240), where the number of values is equal to count u8inclustercount. If this count is zero, the pointer can be set to NULL. u8outclustercount is an 8-bit count of the number of output clusters, supported on the endpoint, that will appear in the pu16outclusterlist element. *pu16outclusterlist is a pointer to the list of output clusters supported by the endpoint (for use during the service discovery and binding procedures). This is a sequence of 16-bit values, representing the cluster numbers (in the range 1-240), where the number of values is equal to count u8outclustercount. If this count is zero, the pointer can be set to NULL. 312 NXP Laboratories UK 2017 JN-UG-3101 v1.5

313 ZigBee PRO Stack ZPS_tsAplZdpSimpleDescBitFields The ZPS_tsAplZdpSimpleDescBitFields structure is used by the sbitfields element in the Simple descriptor structure (see above), and is shown below: typedef struct { unsigned edeviceversion :4; unsigned ereserved :4; }ZPS_tsAplZdpSimpleDescBitFields; where: edeviceversion is a 4-bit value identifying the version of the device description supported by the endpoint. ereserved is a 4-bit reserved value. JN-UG-3101 v1.5 NXP Laboratories UK

314 Chapter 8 ZigBee Device Profile (ZDP) API ZDP Request Structures These structures are used to represent requests in the ZDP functions. The ZDP request structures are listed below, along with their page references. Structure Page Address Discovery Request Structures ZPS_tsAplZdpNwkAddrReq 315 ZPS_tsAplZdpIEEEAddrReq 316 ZPS_tsAplZdpDeviceAnnceReq 316 Service Discovery Request Structures ZPS_tsAplZdpNodeDescReq 317 ZPS_tsAplZdpPowerDescReq 317 ZPS_tsAplZdpSimpleDescReq 317 ZPS_tsAplZdpExtendedSimpleDescReq 318 ZPS_tsAplZdpComplexDescReq 318 ZPS_tsAplZdpUserDescReq 318 ZPS_tsAplZdpMatchDescReq 319 ZPS_tsAplZdpActiveEpReq 319 ZPS_tsAplZdpExtendedActiveEpReq 320 ZPS_tsAplZdpUserDescSet 320 ZPS_tsAplZdpSystemServerDiscoveryReq 321 ZPS_tsAplZdpDiscoveryCacheReq 321 ZPS_tsAplZdpDiscoveryStoreReq 322 ZPS_tsAplZdpNodeDescStoreReq 323 ZPS_tsAplZdpPowerDescStoreReq 323 ZPS_tsAplZdpSimpleDescStoreReq 324 ZPS_tsAplZdpActiveEpStoreReq 324 ZPS_tsAplZdpFindNodeCacheReq 325 ZPS_tsAplZdpRemoveNodeCacheReq 325 Binding Request Structures ZPS_tsAplZdpEndDeviceBindReq 326 ZPS_tsAplZdpBindUnbindReq 327 ZPS_tsAplZdpBindRegisterReq 328 ZPS_tsAplZdpReplaceDeviceReq 328 ZPS_tsAplZdpStoreBkupBindEntryReq 329 ZPS_tsAplZdpRemoveBkupBindEntryReq 330 ZPS_tsAplZdpBackupBindTableReq 331 ZPS_tsAplZdpRecoverBindTableReq 333 ZPS_tsAplZdpBackupSourceBindReq 333 ZPS_tsAplZdpRecoverSourceBindReq NXP Laboratories UK 2017 JN-UG-3101 v1.5

315 Network Management Services Request Structures ZPS_tsAplZdpMgmtNwkDiscReq 334 ZPS_tsAplZdpMgmtLqiReq 334 ZPS_tsAplZdpMgmtRtgReq 335 ZPS_tsAplZdpMgmtBindReq 335 ZPS_tsAplZdpMgmtLeaveReq 335 ZPS_tsAplZdpMgmtDirectJoinReq 336 ZPS_tsAplZdpMgmtPermitJoiningReq 336 ZPS_tsAplZdpMgmtCacheReq 336 ZPS_tsAplZdpMgmtNwkUpdateReq 337 ZigBee PRO Stack ZPS_tsAplZdpNwkAddrReq This structure is used by the function ZPS_eAplZdpNwkAddrRequest(). It represents a request for the network address of the node with a given IEEE address. The ZPS_tsAplZdpNwkAddrReq structure is detailed below. typedef struct { uint64 u64ieeeaddr; uint8 u8requesttype; uint8 u8startindex; } ZPS_tsAplZdpNwkAddrReq; where: u64ieeeaddr is the IEEE address of the node of interest u8requesttype is the type of response required: 0x00: Single device response, which will contain only the network address of the target node 0x01: Extended response, which will also include the network addresses of neighbouring nodes All other values are reserved u8startindex is the Neighbour table index of the first neighbouring node to be included in the response, if an extended response has been selected JN-UG-3101 v1.5 NXP Laboratories UK

316 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpIEEEAddrReq This structure is used by the function ZPS_eAplZdpIEEEAddrRequest(). It represents a request for the IEEE address of a node with a given network address. The ZPS_tsAplZdpIEEEAddrReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; uint8 u8requesttype; uint8 u8startindex; } ZPS_tsAplZdpIEEEAddrReq; where: u16nwkaddrofinterest is the network address of the node of interest u8requesttype is the type of response required: 0x00: Single device response, which will contain only the IEEE address of the target node 0x01: Extended response, which will also include the IEEE addresses of neighbouring nodes All other values are reserved u8startindex is the Neighbour table index of the first neighbouring node to be included in the response, if an extended response has been selected ZPS_tsAplZdpDeviceAnnceReq This structure is used by the function ZPS_eAplZdpDeviceAnnceRequest(). It represents an announcement that the sending node has joined or rejoined the network. The ZPS_tsAplZdpDeviceAnnceReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8capability; } ZPS_tsAplZdpDeviceAnnceReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node u8capability is a bitmap representing the capabilities of the sending node. This bitmap is detailed in Table 8 on page NXP Laboratories UK 2017 JN-UG-3101 v1.5

317 ZigBee PRO Stack ZPS_tsAplZdpNodeDescReq This structure is used by the function ZPS_eAplZdpNodeDescRequest(). It represents a request for the Node descriptor of the node with a given network address. The ZPS_tsAplZdpNodeDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpNodeDescReq; where u16nwkaddrofinterest is the network address of the node of interest ZPS_tsAplZdpPowerDescReq This structure is used by the function ZPS_eAplZdpPowerDescRequest(). It represents a request for the Power descriptor of the node with a given network address. The ZPS_tsAplZdpPowerDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpPowerDescReq; where u16nwkaddrofinterest is the network address of the node of interest ZPS_tsAplZdpSimpleDescReq This structure is used by the function ZPS_eAplZdpSimpleDescRequest(). It represents a request for the Simple descriptor of an endpoint on the node with a given network address. The ZPS_tsAplZdpSimpleDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; uint8 u8endpoint; } ZPS_tsAplZdpSimpleDescReq; where: u16nwkaddrofinterest is the network address of the node of interest u8endpoint is the number of the relevant endpoint on the node (1-240) JN-UG-3101 v1.5 NXP Laboratories UK

318 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpExtendedSimpleDescReq This structure is used by the ZPS_eAplZdpExtendedSimpleDescRequest() function. It represents a request for the Simple descriptor of an endpoint on the node with a given network address. This request is required when the endpoint has more input/output clusters than the usual ZPS_eAplZdpSimpleDescRequest() function can deal with. The ZPS_tsAplZdpExtendedSimpleDescReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint8 u8endpoint; uint8 u8startindex; } ZPS_tsAplZdpExtendedSimpleDescReq; where: u16nwkaddrofinterest is the network address of the node of interest u8endpoint is the number of the relevant endpoint on the node (1-240) u8startindex is the index of the first cluster of interest in the input and output cluster lists for the endpoint (this and subsequent clusters will be reported in the response) ZPS_tsAplZdpComplexDescReq This structure is used by the function ZPS_eAplZdpComplexDescRequest(). It represents a request for the Complex descriptor of the node with a given network address. The ZPS_tsAplZdpComplexDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpComplexDescReq; where u16nwkaddrofinterest is the network address of the node of interest ZPS_tsAplZdpUserDescReq This structure is used by the function ZPS_eAplZdpUserDescRequest(). It represents a request for the User descriptor of the node with a given network address. The ZPS_tsAplZdpUserDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpUserDescReq; where u16nwkaddrofinterest is the network address of the node of interest. 318 NXP Laboratories UK 2017 JN-UG-3101 v1.5

319 ZigBee PRO Stack ZPS_tsAplZdpMatchDescReq This structure is used by the function ZPS_eAplZdpMatchDescRequest(). It represents a request for nodes with endpoints that match certain criteria in their Simple descriptors. The ZPS_tsAplZdpMatchDescReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; uint16 u16profileid; /* rest of message is variable length */ uint8 u8numinclusters; uint16* pu16inclusterlist; uint8 u8numoutclusters; uint16* pu16outclusterlist; } ZPS_tsAplZdpMatchDescReq; where: u16nwkaddrofinterest is the network address of the node of interest u16profileid is the identifier of the ZigBee application profile used u8numinclusters is the number of input clusters to be matched pu16inclusterlist is a pointer to the list of input clusters to be matched - this is a variable-length list of input cluster IDs, two bytes for each cluster u8numoutclusters is the number of output clusters to be matched pu16outclusterlist is a pointer to the list of output clusters to be matched - this is a variable-length list of output cluster IDs, two bytes for each cluster ZPS_tsAplZdpActiveEpReq This structure is used by the function ZPS_eAplZdpActiveEpRequest(). It represents a request for a list of the active endpoints on the node with a given network address. The ZPS_tsAplZdpActiveEpReq structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpActiveEpReq; where u16nwkaddrofinterest is the network address of the node of interest. JN-UG-3101 v1.5 NXP Laboratories UK

320 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpExtendedActiveEpReq This structure is used by the function ZPS_eAplZdpExtendedActiveEpRequest(). It represents a request for a list of the active endpoints on the node with a given network address. This request is required when the node has more active endpoints than the usual ZPS_eAplZdpActiveEpRequest() function can deal with. The ZPS_tsAplZdpExtendedActiveEpReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint8 u8startindex; } ZPS_tsAplZdpExtendedActiveEpReq; where: u16nwkaddr is the network address of the node of interest u8startindex is the index of the first endpoint of interest in the list of active endpoints (this and subsequent endpoints will be reported in the response) ZPS_tsAplZdpUserDescSet This structure is used by the function ZPS_eAplZdpUserDescSetRequest(). It represents a request used to configure the User descriptor on a remote node. The ZPS_tsAplZdpUserDescSet structure is detailed below. typedef struct { uint16 u16nwkaddrofinterest; uint8 u8length; char szuserdescriptor[zps_zdp_length_of_user_desc]; } ZPS_tsAplZdpUserDescSet; where: u16nwkaddrofinterest is the network address of the node of interest u8length is the length of the User descriptor szuserdescriptor is the new User descriptor for the remote node as a character array. 320 NXP Laboratories UK 2017 JN-UG-3101 v1.5

321 ZigBee PRO Stack ZPS_tsAplZdpSystemServerDiscoveryReq This structure is used by the ZPS_eAplZdpSystemServerDiscoveryRequest() function. It represents a request for information on the available services of a remote node. The ZPS_tsAplZdpSystemServerDiscoveryReq structure is detailed below. typedef struct { uint16 u16servermask; } ZPS_tsAplZdpSystemServerDiscoveryReq; where u16servermask is a bitmask representing the required services (1 for required, 0 for not required ). This bitmask is detailed in the table below. Bit Service 0 Primary Trust Centre 1 Backup Trust Centre 2 Primary Binding Table Cache 3 Backup Binding Table Cache 4 Primary Discovery Cache 5 Back-up Discovery Cache 6 Network Manager 7-15 Reserved Table 10: Services Bitmask ZPS_tsAplZdpDiscoveryCacheReq This structure is used by the function ZPS_eAplZdpDiscoveryCacheRequest(). It represents a request to find the nodes in the network which have a primary discovery cache. The ZPS_tsAplZdpDiscoveryCacheReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpDiscoveryCacheReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node JN-UG-3101 v1.5 NXP Laboratories UK

322 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpDiscoveryStoreReq This structure is used by the function ZPS_eAplZdpDiscoveryStoreRequest(). It represents a request to a remote node to reserve memory space to store the local node s discovery information. The ZPS_tsAplZdpDiscoveryStoreReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8nodedescsize; uint8 u8powerdescsize; uint8 u8activeepsize; uint8 u8simpledesccount; /* Rest of message is variable length */ uint8* pu8simpledescsizelist; } ZPS_tsAplZdpDiscoveryStoreReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node u8nodedescsize is the size of the Node descriptor to store u8powerdescsize is the size of the Power descriptor to store u8activeepsize is the size of the list of active endpoints to store u8simpledesccount is the number of Simple descriptors to store pu8simpledescsizelist is a pointer to a list of sizes of the Simple descriptors 322 NXP Laboratories UK 2017 JN-UG-3101 v1.5

323 ZigBee PRO Stack ZPS_tsAplZdpNodeDescStoreReq This structure is used by the function ZPS_eAplZdpNodeDescStoreRequest(). It represents a request to a remote node to store the Node descriptor of the local node. The ZPS_tsAplZdpNodeDescStoreReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; /* Rest of message is variable length */ ZPS_tsAplZdpNodeDescriptor snodedescriptor; } ZPS_tsAplZdpNodeDescStoreReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node snodedescriptor is a pointer to the Node descriptor to store (this is itself a structure of the type ZPS_tsAplZdpNodeDescriptor, detailed in Section ) ZPS_tsAplZdpPowerDescStoreReq This structure is used by the function ZPS_eAplZdpPowerDescStoreRequest(). It represents a request to a remote node to store the Power descriptor of the local node. The ZPS_tsAplZdpPowerDescStoreReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; /* Rest of message is variable length */ ZPS_tsAplZdpNodePowerDescriptor spowerdescriptor; } ZPS_tsAplZdpPowerDescStoreReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node spowerdescriptor is a pointer to the Power descriptor to store (this is itself a structure of the type ZPS_tsAplZdpNodePowerDescriptor, detailed in Section ) JN-UG-3101 v1.5 NXP Laboratories UK

324 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpSimpleDescStoreReq This structure is used by the function ZPS_eAplZdpSimpleDescStoreRequest(). It represents a request to a remote node to store the Simple descriptor of one of the local node s endpoints. The ZPS_tsAplZdpSimpleDescStoreReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8length; /* Rest of message is variable length */ ZPS_tsAplZdpSimpleDescType ssimpledescriptor; } ZPS_tsAplZdpSimpleDescStoreReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node u8length is the length of the Simple descriptor to store ssimpledescriptor is a pointer to the Simple descriptor to store (this is itself a structure of the type ZPS_tsAplZdpSimpleDescType, detailed in Section ) ZPS_tsAplZdpActiveEpStoreReq This structure is used by the function ZPS_eAplZdpActiveEpStoreRequest(). It represents a request to a remote node to store the list of active endpoints of the local node. The ZPS_tsAplZdpActiveEpStoreReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; uint8 u8activeepcount; /* Rest of message is variable length */ uint8* pu8activeeplist; } ZPS_tsAplZdpActiveEpStoreReq; where: u16nwkaddr is the network address of the sending node u64ieeeaddr is the IEEE address of the sending node u8activeepcount is the number of active endpoints in the list to store pu8activeeplist is a pointer to the list of active endpoints to store 324 NXP Laboratories UK 2017 JN-UG-3101 v1.5

325 ZigBee PRO Stack ZPS_tsAplZdpFindNodeCacheReq This structure is used by the function ZPS_eAplZdpActiveEpStoreRequest(). It represents a request to search for nodes in the network that hold discovery information about a particular node. The ZPS_tsAplZdpFindNodeCacheReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpFindNodeCacheReq; where: u16nwkaddr is the network address of the node of interest u64ieeeaddr is the IEEE address of the node of interest ZPS_tsAplZdpRemoveNodeCacheReq This structure is used by the function ZPS_eAplZdpActiveEpStoreRequest(). It represents a request to a remote node to remove from its Primary Discovery Cache all discovery information relating to a particular End Device. The ZPS_tsAplZdpRemoveNodeCacheReq structure is detailed below. typedef struct { uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpRemoveNodeCacheReq; where: u16nwkaddr is the network address of the End Device of interest u64ieeeaddr is the IEEE address of the End Device of interest JN-UG-3101 v1.5 NXP Laboratories UK

326 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpEndDeviceBindReq This structure is used by the function ZPS_eAplZdpEndDeviceBindRequest(). It represents a request to the Co-ordinator to bind an endpoint on the local node to an endpoint on a remote node (the Co-ordinator must match two such binding requests, from the local node and remote node). The ZPS_tsAplZdpEndDeviceBindReq structure is detailed below. typedef struct { uint16 u16bindingtarget; uint64 u64srcieeeaddress; uint8 u8srcendpoint; uint16 u16profileid; /* Rest of message is variable length */ uint8 u8numinclusters; uint16 *pu16inclusterlist; uint8 u8numoutclusters; uint16 *pu16outclusterlist; } ZPS_tsAplZdpEndDeviceBindReq; where: u16bindingtarget is the network address of the node to hold the binding (either a node with primary binding table cache or the local node) u64srcieeeaddress is the IEEE address of the local node u8srcendpoint is the number of the local endpoint to be bound (1-240) u16profileid is the application profile ID to be matched for the binding u8numinclusters is the number of input clusters of the local endpoint (available for matching with output clusters of remote node to be bound) pu16inclusterlist is a pointer to the input cluster list of the local endpoint (containing clusters for matching with output clusters of remote node) u8numoutclusters is the number of output clusters of the local endpoint (available for matching with input clusters of remote node to be bound) pu16outclusterlist is a pointer to the output cluster list of the local endpoint (containing clusters for matching with input clusters of remote node) 326 NXP Laboratories UK 2017 JN-UG-3101 v1.5

327 ZigBee PRO Stack ZPS_tsAplZdpBindUnbindReq This structure is used by the function ZPS_eAplZdpBindUnbindRequest(). It represents a request for a modification of the Binding table on the target node, in order to either bind or unbind two nodes in the network. The ZPS_tsAplZdpBindUnbindReq structure is detailed below. typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; } uaddressfield; } ZPS_tsAplZdpBindUnbindReq; where: u64srcaddress is the IEEE address of the source node for the binding u8srcendpoint is the number of the source endpoint for the binding (1-240) u16clusterid is the ID of the cluster (on the local endpoint) for the binding u8dstaddrmode is the destination addressing mode (see Table 11 below): ZPS_E_ADDR_MODE_SHORT: network address (u8dstendpoint is unspecified) ZPS_E_ADDR_MODE_IEEE: IEEE address (u8dstendpoint is specified) All other values are reserved u16dstaddress or u64dstaddress is the address of the destination node for the binding: network address u16dstaddress if u8dstaddrmode is set to ZPS_E_ADDR_MODE_SHORT IEEE address u64dstaddress if 8DstAddrMode is set to ZPS_E_ADDR_MODE_IEEE u8dstendpoint is the number of the destination endpoint for the binding (1-240) - not required if u8dstaddrmode set to ZPS_E_ADDR_MODE_SHORT (network address) JN-UG-3101 v1.5 NXP Laboratories UK

328 Chapter 8 ZigBee Device Profile (ZDP) API u8dstaddrmode Code Description 0x02 ZPS_E_ADDR_MODE_SHORT 16-bit Network (Short) address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 11: Addressing Modes ZPS_tsAplZdpBindRegisterReq This structure is used by the function ZPS_eAplZdpBindRegisterRequest(). It represents a request to inform a remote node with a primary binding table cache that the local node will hold its own Binding table entries. The ZPS_tsAplZdpBindRegisterReq structure is detailed below. typedef struct { uint64 u64nodeaddress; } ZPS_tsAplZdpBindRegisterReq; where u64nodeaddress is the IEEE address of the local node ZPS_tsAplZdpReplaceDeviceReq This structure is used by the function ZPS_eAplZdpReplaceDeviceRequest(). It represents a request to a remote node (with a primary binding table cache) to modify its binding table entries by replacing an IEEE address and/or associated endpoint number. The ZPS_tsAplZdpReplaceDeviceReq structure is detailed below. typedef struct { uint64 u64oldaddress; uint8 u8oldendpoint; uint64 u64newaddress; uint8 u8newendpoint; } ZPS_tsAplZdpReplaceDeviceReq; where: u64oldaddress is the IEEE address to be replaced u8oldendpoint is the endpoint number to be replaced (0-240, where 0 indicates that the endpoint number is not to be replaced) u64newaddress is the replacement IEEE address u8newendpoint is the replacement endpoint number (1-240) 328 NXP Laboratories UK 2017 JN-UG-3101 v1.5

329 ZigBee PRO Stack ZPS_tsAplZdpStoreBkupBindEntryReq This structure is used by the function ZPS_eAplZdpStoreBkupBindEntryRequest(). It represents a request to a remote node to save a back-up of an entry from the local primary binding table cache. The ZPS_tsAplZdpStoreBkupBindEntryReq structure is detailed below. typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; } ZPS_tsAplZdpStoreBkupBindEntryReq; where: u64srcaddress is the IEEE address of the source node for the binding entry u8srcendpoint is the number of the source endpoint for the binding (1-240) u16clusterid is the ID of the cluster (on the local endpoint) for the binding u8dstaddrmode is the destination addressing mode for remaining elements (see Table 12 below) u16dstaddress is the address of the destination node for the binding (address type according to setting of u8dstaddrmode) u8dstendpoint is the number of the destination endpoint for the binding (1-240) u8dstaddrmode Code Description 0x01 ZPS_E_ADDR_MODE_GROUP 16-bit Group address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 12: Addressing Modes JN-UG-3101 v1.5 NXP Laboratories UK

330 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpRemoveBkupBindEntryReq This structure is used by the ZPS_eAplZdpRemoveBkupBindEntryRequest() function. It represents a request to a remote node to remove the back-up of an entry from the local primary binding table cache. The ZPS_tsAplZdpRemoveBkupBindEntryReq structure is detailed below. typedef struct { uint64 u64srcaddress; uint8 u8srcendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; } ZPS_tsAplZdpRemoveBkupBindEntryReq; where: u64srcaddress is the IEEE address of the source node for the binding entry u8srcendpoint is the number of the source endpoint for the binding (1-240) u16clusterid is the ID of the cluster (on the local endpoint) for the binding u8dstaddrmode is the destination addressing mode for remaining elements (see Table 13 below) u16dstaddress is the address the destination node for the binding (address type according to setting of u8dstaddrmode) u8dstendpoint is the number of the destination endpoint for the binding (1-240) u8dstaddrmode Code Description 0x01 ZPS_E_ADDR_MODE_GROUP 16-bit Group address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 13: Addressing Modes 330 NXP Laboratories UK 2017 JN-UG-3101 v1.5

331 ZigBee PRO Stack ZPS_tsAplZdpBackupBindTableReq This structure is used by the function ZPS_eAplZdpBackupBindTableRequest(). It represents a request to a remote node to save a back-up of the local primary binding table cache (whole or in part). The ZPS_tsAplZdpBackupBindTableReq structure is detailed below. typedef struct { uint16 u16bindingtableentries; uint16 u16startindex; uint16 u16bindingtablelistcount; /* Rest of message is variable length */ ZPS_tsAplZdpBindingTable sbindingtable; } ZPS_tsAplZdpBackupBindTableReq; where: u16bindingtableentries is the total number of entries in the primary binding table cache u16startindex is the binding table index of the first entry to be backed up u16bindingtablelistcount is the number of binding table entries in the list to be backed up (sbindingtable) sbindingtable is a pointer to the list of binding table entries to be backed up. Each list item is of the type ZPS_tsAplZdpBindingTable detailed below ZPS_tsAplZdpBindingTable typedef struct { uint64 u64sourceaddress; ZPS_tsAplZdpBindingTableEntry* psbindingtableentryforspsrcaddr; }ZPS_tsAplZdpBindingTable; where: u64sourceaddress is the IEEE source address for the binding table entry psbindingtableentryforspsrcaddr is the binding table entry. This is of the type ZPS_tsAplZdpBindingTableEntry detailed below JN-UG-3101 v1.5 NXP Laboratories UK

332 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpBindingTableEntry typedef struct { uint16 u16clusterid; uint8 u8sourceendpoint; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; }ZPS_tsAplZdpBindingTableEntry; where: u16clusterid is the ID of the cluster (on the local endpoint) for the binding u8srcendpoint is the number of the source endpoint for the binding (1-240) u8dstaddrmode is the destination addressing mode for remaining elements (see Table 14 below) u16dstaddress is the address the destination node for the binding (address type according to setting of u8dstaddrmode) u8dstendpoint is the number of the destination endpoint for the binding (1-240) u8dstaddrmode Code Description 0x01 ZPS_E_ADDR_MODE_GROUP 16-bit Group address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 14: Addressing Modes 332 NXP Laboratories UK 2017 JN-UG-3101 v1.5

333 ZigBee PRO Stack ZPS_tsAplZdpRecoverBindTableReq This structure is used by the function ZPS_eAplZdpRecoverBindTableRequest(). It represents a request to a remote node to recover a back-up of the local primary binding table cache. The ZPS_tsAplZdpRecoverBindTableReq structure is detailed below. typedef struct { uint16 u16startindex; } ZPS_tsAplZdpRecoverBindTableReq; where u16startindex is the binding table index of the first entry to be recovered ZPS_tsAplZdpBackupSourceBindReq This structure is used by the function ZPS_eAplZdpBackupSourceBindRequest(). It represents a request to a remote node to save a back-up of the local node s source binding table (whole or in part). The ZPS_tsAplZdpBackupSourceBindReq structure is detailed below. typedef struct { uint16 u16sourcetableentries; uint16 u16startindex; uint16 u16sourcetablelistcount; /* Rest of message is variable length */ uint64* pu64sourceaddress; } ZPS_tsAplZdpBackupSourceBindReq; where: u16sourcetableentries is the total number of entries in the source binding table u16startindex is the binding table index of the first entry to be backed up u16sourcetablelistcount is the number of binding table entries in the list to be backed up (pu64sourceaddress) pu64sourceaddress is a pointer to the list of IEEE source addresses corresponding to the binding table entries to be backed up ZPS_tsAplZdpRecoverSourceBindReq This structure is used by the function ZPS_eAplZdpRecoverSourceBindRequest(). It represents a request to a remote node to recover the back-up of the local node s source binding table (whole or in part). The ZPS_tsAplZdpRecoverSourceBindReq structure is detailed below. typedef struct { uint16 u16startindex; } ZPS_tsAplZdpRecoverSourceBindReq; where u16startindex is the binding table index of the first entry to be recovered. JN-UG-3101 v1.5 NXP Laboratories UK

334 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpMgmtNwkDiscReq This structure is used by the function ZPS_eAplZdpMgmtNwkDiscRequest(). It represents a request to a remote node to discover any other wireless networks that are operating in the neighbourhood. The ZPS_tsAplZdpMgmtNwkDiscReq structure is detailed below. typedef struct { uint32 u32scanchannels; uint8 u8scanduration; uint8 u8startindex; } ZPS_tsAplZdpMgmtNwkDiscReq; where: u32scanchannels is a bitmask of the radio channels to scan ( 1 means scan, 0 means do not scan): Bits 0 to 26 respectively represent channels 0 to 26 (only bits 11 to 26 are relevant to the 2400-MHz band) Bits 27 to 31 are reserved u8scanduration is a value in the range 0x00 to 0x0E that determines the time spent scanning each channel - this time is proportional to 2 u8scanduration +1 u8startindex is the index of the first result from the results list to include in the response to this request ZPS_tsAplZdpMgmtLqiReq This structure is used by the function ZPS_eAplZdpMgmtLqiRequest(). It represents a request to a remote node to provide a list of neighbouring nodes, from its Neighbour table, including a radio signal strength (LQI) value for each of these nodes. The ZPS_tsAplZdpMgmtLqiReq structure is detailed below. typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtLqiReq; where u8startindex is the Neighbour table index of the first entry to be included in the response to this request. 334 NXP Laboratories UK 2017 JN-UG-3101 v1.5

335 ZigBee PRO Stack ZPS_tsAplZdpMgmtRtgReq This structure is used by the function ZPS_eAplZdpMgmtRtgRequest(). It represents a request to a remote node to provide the contents of its Routing table. The ZPS_tsAplZdpMgmtRtgReq structure is detailed below. typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtRtgReq; where u8startindex is the Routing table index of the first entry to be included in the response to this request ZPS_tsAplZdpMgmtBindReq This structure is used by the function ZPS_eAplZdpMgmtBindRequest(). It represents a request to a remote node to provide the contents of its Binding table. The ZPS_tsAplZdpMgmtBindReq structure is detailed below. typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtBindReq; where u8startindex is the Binding table index of the first entry to be included in the response to this request ZPS_tsAplZdpMgmtLeaveReq This structure is used by the function ZPS_eAplZdpMgmtLeaveRequest(). It requests a remote node to leave the network. The ZPS_tsAplZdpMgmtLeaveReq structure is detailed below. typedef struct { uint64 u64deviceaddress; uint8 u8flags; } ZPS_tsAplZdpMgmtLeaveReq; where: u64deviceaddress is the IEEE address of the device being asked to leave the network u8flags is an 8-bit bitmap containing the following flags: Rejoin flag (bit 0): Set to 1 if the node requested to leave the network should immediately try to rejoin the network, otherwise set to 0. Remove Children flag (bit 1): Set to 1 if the node requested to leave the network should also request its own children (if any) to leave the network, otherwise set to 0. Reserved (bits 7-2) JN-UG-3101 v1.5 NXP Laboratories UK

336 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpMgmtDirectJoinReq This structure is used by the function ZPS_eAplZdpMgmtDirectJoinRequest(). It requests a remote node to allow a particular device to join it (and therefore the network). The ZPS_tsAplZdpMgmtDirectJoinReq structure is detailed below. typedef struct { uint64 u64deviceaddress; uint8 u8capability; } ZPS_tsAplZdpMgmtDirectJoinReq; where: u64deviceaddress is the IEEE address of the device to be allowed to join u8capability is a bitmask of the operating capabilities of the device to be allowed to join. This bitmask is detailed in Table 8 on page ZPS_tsAplZdpMgmtPermitJoiningReq This structure is used by the function ZPS_eAplZdpMgmtPermitJoiningRequest(). It requests a remote node (Router or Co-ordinator) to enable or disable joining for a specified amount of time. The ZPS_tsAplZdpMgmtPermitJoiningReq structure is detailed below. typedef struct { uint8 u8permitduration; bool_t btcsignificance; } ZPS_tsAplZdpMgmtPermitJoiningReq; where: u8permitduration is the time period, in seconds, during which joining will be allowed (0x00 means that joining is enabled or disabled with no time limit) btcsignificance determines whether the remote device is a Trust Centre : TRUE: A Trust Centre FALSE: Not a Trust Centre ZPS_tsAplZdpMgmtCacheReq This structure is used by the function ZPS_eAplZdpMgmtCacheRequest(). It requests a remote node to provide a list of the End Devices registered in its primary discovery cache. The ZPS_tsAplZdpMgmtCacheReq structure is detailed below. typedef struct { uint8 u8startindex; } ZPS_tsAplZdpMgmtCacheReq; where u8startindex is the discovery cache index of the first entry to be included in the response to this request. 336 NXP Laboratories UK 2017 JN-UG-3101 v1.5

337 ZigBee PRO Stack ZPS_tsAplZdpMgmtNwkUpdateReq This structure is used by the function ZPS_eAplZdpMgmtNwkUpdateRequest(). It requests an update of network parameters related to radio communication and may optionally initiate an energy scan in the 2400-MHz band. The ZPS_tsAplZdpMgmtNwkUpdateReq structure is detailed below. typedef struct { uint32 u32scanchannels; uint8 u8scanduration; uint8 u8scancount; uint8 u8nwkupdateid; uint16 u16nwkmanageraddr; } ZPS_tsAplZdpMgmtNwkUpdateReq; where: u32scanchannels is a bitmask of the radio channels to be scanned ( 1 means scan, 0 means do not scan): Bits 0 to 26 respectively represent channels 0 to 26 (only bits 11 to 26 are relevant to the 2400-MHz band) Bits 27 to 31 are reserved u8scanduration is a key value used to determine the action to be taken, as follows: 0x00-0x05: Indicates that an energy scan is required and determines the time to be spent scanning each channel - this time is proportional to 2 u8scanduration +1. The set of channels to scan is specified through u32scanchannels and the maximum number of scans is equal to the value of u8scancount. Valid for unicasts only 0x06-0xFD: Reserved 0xFE: Indicates that radio channel is to be changed to single channel specified through u32scanchannels and that network manager address to be set to that specified through u16nwkmanageraddr. Valid for broadcasts only 0xFF: Indicates that stored radio channel mask to be updated with that specified through u32scanchannels (but scan not required). Valid for broadcasts only. u8scancount is the number of energy scans to be conducted and reported. Valid only if a scan has been enabled through u8scanduration (0x00-0x05) u8nwkupdateid is a value set by the Network Channel Manager before the request is sent. Valid only if u8scanduration set to 0xFE or 0xFF u16nwkmanageraddr is the 16-bit network address of the Network Manager (node nominated to manage radio-band operation of network). Valid only if u8scanduration set to 0xFF JN-UG-3101 v1.5 NXP Laboratories UK

338 Chapter 8 ZigBee Device Profile (ZDP) API ZDP Response Structures This section details the structures that are used to store ZDP responses, resulting from requests sent using the ZDP functions. A received response is collected using the RTOS function OS_eCollectMessage(). As part of this function call, you must provide a pointer to a structure to store the message data. This structure must be of the appropriate type for the response, from those described in this section. The ZDP response structures are listed below, along with their page references. Structure Page Address Discovery Response Structures ZPS_tsAplZdpNwkAddrRsp 340 ZPS_tsAplZdpIeeeAddrRsp 341 Service Discovery Response Structures ZPS_tsAplZdpNodeDescRsp 342 ZPS_tsAplZdpPowerDescRsp 342 ZPS_tsAplZdpSimpleDescRsp 343 ZPS_tsAplZdpExtendedSimpleDescRsp 344 ZPS_tsAplZdpComplexDescRsp 345 ZPS_tsAplZdpUserDescRsp 346 ZPS_tsAplZdpMatchDescRsp 346 ZPS_tsAplZdpActiveEpRsp 347 ZPS_tsAplZdpExtendedActiveEpRsp 348 ZPS_tsAplZdpUserDescConf 348 ZPS_tsAplZdpSystemServerDiscoveryRsp 349 ZPS_tsAplZdpDiscoveryCacheRsp 349 ZPS_tsAplZdpDiscoveryStoreRsp 350 ZPS_tsAplZdpNodeDescStoreRsp 350 ZPS_tsAplZdpPowerDescStoreRsp 350 ZPS_tsAplZdpSimpleDescStoreRsp 351 ZPS_tsAplZdpActiveEpStoreRsp 351 ZPS_tsAplZdpFindNodeCacheRsp 351 ZPS_tsAplZdpRemoveNodeCacheRsp 352 Binding Response Structures ZPS_tsAplZdpEndDeviceBindRsp 352 ZPS_tsAplZdpBindRsp 352 ZPS_tsAplZdpUnbindRsp 353 ZPS_tsAplZdpBindRegisterRsp 353 ZPS_tsAplZdpReplaceDeviceRsp 355 ZPS_tsAplZdpStoreBkupBindEntryRsp 355 ZPS_tsAplZdpRemoveBkupBindEntryRsp 356 ZPS_tsAplZdpBackupBindTableRsp NXP Laboratories UK 2017 JN-UG-3101 v1.5

339 ZPS_tsAplZdpRecoverBindTableRsp 357 ZPS_tsAplZdpBackupSourceBindRsp 357 ZPS_tsAplZdpRecoverSourceBindRsp 358 Network Management Services Response Structures ZPS_tsAplZdpMgmtNwkDiscRsp 359 ZPS_tsAplZdpMgmtLqiRsp 360 ZPS_tsAplZdpMgmtRtgRsp 362 ZPS_tsAplZdpMgmtBindRsp 364 ZPS_tsAplZdpMgmtLeaveRsp 364 ZPS_tsAplZdpMgmtDirectJoinRsp 365 ZPS_tsAplZdpMgmtPermitJoiningRsp 365 ZPS_tsAplZdpMgmtCacheRsp 366 ZPS_tsAplZdpMgmtNwkUpdateNotify 367 ZigBee PRO Stack JN-UG-3101 v1.5 NXP Laboratories UK

340 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpNwkAddrRsp This structure is used to store NWK_addr_rsp message data - a response to a call to the function ZPS_eAplZdpNwkAddrRequest(). This response contains the network address of the node with a given IEEE address. The ZPS_tsAplZdpNwkAddrRsp structure is detailed below. typedef struct { uint8 u8status; uint64 u64ieeeaddrremotedev; uint16 u16nwkaddrremotedev; uint8 u8numassocdev; uint8 u8startindex; /* Rest of the message is variable Length */ uint16* pnwkaddrassocdevlist; } ZPS_tsAplZdpNwkAddrRsp; where: u8status is the return status for ZPS_eAplZdpNwkAddrRequest() u64ieeeaddrremotedev is the IEEE address of the remote node that sent the response (this is the IEEE address specified in the original request) u16nwkaddrremotedev is the network address of the remote node that sent the response (this is the network address that was requested) u8numassocdev is the number of neighbouring nodes for which network addresses are also being reported (in the remainder of the structure) u8startindex is the index in the remote node s Neighbour table of the first entry to be included in this report. This element should be ignored if the element u8numassocdev is 0. pnwkaddrassocdevlist is a pointer to a list of 16-bit network addresses of the remote node s neighbours (this is a variable-length list with four bytes per node). This element should be ignored if the element u8numassocdev is NXP Laboratories UK 2017 JN-UG-3101 v1.5

341 ZigBee PRO Stack ZPS_tsAplZdpIeeeAddrRsp This structure is used to store IEEE_addr_rsp message data - a response to a call to the function ZPS_eAplZdpIeeeAddrRequest(). This response contains the IEEE address of the node with a given network address. The ZPS_tsAplZdpIeeeAddrRsp structure is detailed below. typedef struct { uint8 u8status; uint64 u64ieeeaddrremotedev; uint16 u16nwkaddrremotedev; uint8 u8numassocdev; uint8 u8startindex; /* Rest of the message is variable Length */ uint16* pnwkaddrassocdevlist; } ZPS_tsAplZdpIeeeAddrRsp; where: u8status is the return status for ZPS_eAplZdpIeeeAddrRequest() u64ieeeaddrremotedev is the IEEE address of the remote node that sent the response (this is the IEEE address that was requested) u16nwkaddrremotedev is the network address of the remote node that sent the response (this is the network address specified in the original request) u8numassocdev is the number of neighbouring nodes for which network addresses are also being reported (in the remainder of the structure) u8startindex is the index in the remote node s Neighbour table of the first entry to be included in this report. This element should be ignored if the element u8numassocdev is 0. pnwkaddrassocdevlist is a pointer to a list of 16-bit network addresses of the remote node s neighbours (this is a variable-length list with four bytes per node). This element should be ignored if the element u8numassocdev is 0. JN-UG-3101 v1.5 NXP Laboratories UK

342 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpNodeDescRsp This structure is used to store Node_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpNodeDescRequest(). This response contains the Node descriptor of the node with a given network address. The ZPS_tsAplZdpNodeDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; /* Rest of the message is variable length */ ZPS_tsAplZdpNodeDescriptor tsnodedescriptor; } ZPS_tsAplZdpNodeDescRsp; where: u8status is the return status for ZPS_eAplZdpNodeDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) tsnodedescriptor is the returned Node descriptor, a structure of type ZPS_tsAplZdpNodeDescriptor (detailed in Section ). This is only included if u8status reports success ZPS_tsAplZdpPowerDescRsp This structure is used to store Power_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpPowerDescRequest(). This response contains the Power descriptor of the node with a given network address. The ZPS_tsAplZdpPowerDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; /* Rest of the message is variable length */ ZPS_tsAplZdpNodePowerDescriptor spowerdescriptor; } ZPS_tsAplZdpPowerDescRsp; where: u8status is the return status for ZPS_eAplZdpPowerDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) spowerdescriptor is the returned Power descriptor, a structure of type ZPS_tsAplZdpNodePowerDescriptor (detailed in Section ). This is only included if u8status reports success 342 NXP Laboratories UK 2017 JN-UG-3101 v1.5

343 ZigBee PRO Stack ZPS_tsAplZdpSimpleDescRsp This structure is used to store Simple_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpSimpleDescRequest(). This response contains the Simple descriptor of a given endpoint on the node with a given network address. The ZPS_tsAplZdpSimpleDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; uint8 u8length; /* Rest of the message is variable length */ ZPS_tsAplZdpSimpleDescType ssimpledescriptor; } ZPS_tsAplZdpSimpleDescRsp; where: u8status is the return status for ZPS_eAplZdpSimpleDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8length is the length of the returned Simple descriptor, in bytes (depends on the number of clusters supported by the endpoint) ssimpledescriptor is the returned Simple descriptor, a structure of type ZPS_tsAplZdpSimpleDescType (detailed in Section ). This is only included if u8status reports success JN-UG-3101 v1.5 NXP Laboratories UK

344 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpExtendedSimpleDescRsp This structure is used to store Extended_Simple_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpExtendedSimpleDescRequest(). This response contains a cluster list (combined input and output) for a given endpoint on the node with a given network address. The ZPS_tsAplZdpExtendedSimpleDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddr; uint8 u8endpoint; uint8 u8appinputclustercount; uint8 u8appoutputclustercount; uint8 u8startindex; /* Rest of the message is variable length */ uint16* pappclusterlist; } ZPS_tsAplZdpExtendedSimpleDescRsp; where: u8status is the return status for ZPS_eAplZdpExtendedSimpleDescRequest() u16nwkaddr is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8endpoint is the number of the endpoint for which the response was sent (this is the endpoint number that was specified in the request) u8appinputclustercount is the total number of input clusters in the endpoint s complete input cluster list u8appoutputclustercount is the total number of output clusters in the endpoint s complete output cluster list u8startindex is the index, in the endpoint s complete input or output cluster list, of the first cluster reported in this response pappclusterlist is a pointer to the reported cluster list, input clusters first then output clusters. This is only included if u8status reports success 344 NXP Laboratories UK 2017 JN-UG-3101 v1.5

345 ZigBee PRO Stack ZPS_tsAplZdpComplexDescRsp This structure is used to store Complex_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpComplexDescRequest(). This response contains the Complex descriptor of the node with a given network address. The ZPS_tsAplZdpComplexDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; uint8 u8length; /* Rest of the message is variable Length */ ZPS_tsAplZdpComplexDescElement scomplexdescriptor; } ZPS_tsAplZdpComplexDescRsp; where: u8status is the return status for ZPS_eAplZdpComplexDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8length is the length of the returned Complex descriptor, in bytes scomplexdescriptor is the returned Complex descriptor, a structure of type ZPS_tsAplZdpComplexDescRsp (described below). This is only included if u8status reports success ZPS_tsAplZdpComplexDescElement typedef struct { uint8 u8xmltag; uint8 u8fieldcount; uint8 *pu8data; } ZPS_tsAplZdpComplexDescElement; where: u8xmltag is the XML tag for the current field u8fieldcount is the number of fields in the Complex descriptor *pu8data is a pointer to the data of the current field JN-UG-3101 v1.5 NXP Laboratories UK

346 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpUserDescRsp This structure is used to store User_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpUserDescRequest(). This response contains the User descriptor of the node with a given network address. The ZPS_tsAplZdpUserDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; uint8 u8length; /* Rest of the message is variable Length */ char szuserdescriptor[zps_zdp_length_of_user_desc]; } ZPS_tsAplZdpUserDescRsp; where: u8status is the return status for ZPS_eAplZdpUserDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8length is the length of the returned User descriptor, in bytes (maximum: 16) szuserdescriptor is the returned User descriptor as a character array. This is only included if u8status reports success ZPS_tsAplZdpMatchDescRsp This structure is used to store Match_Desc_rsp message data - a response to a call to the function ZPS_eAplZdpMatchDescRequest(). This response contains details of the endpoints on the remote node that matched the criteria specified in the original request. The ZPS_tsAplZdpMatchDescRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; uint8 u8matchlength; /* Rest of message is variable length */ uint8* u8matchlist; } ZPS_tsAplZdpMatchDescRsp; where: u8status is the return status for ZPS_eAplZdpMatchDescRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8matchlength is the length of the list of matched endpoints, in bytes u8matchlist is a pointer to the list of matched endpoints, where each endpoint is represented by an 8-bit value (in the range 1-240) 346 NXP Laboratories UK 2017 JN-UG-3101 v1.5

347 ZigBee PRO Stack ZPS_tsAplZdpActiveEpRsp This structure is used to store Active_EP_rsp message data - a response to a call to the function ZPS_eAplZdpActiveEpRequest(). This response contains a list of the active endpoints on a given network node. The ZPS_tsAplZdpActiveEpRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; uint8 u8activeepcount; /* Rest of the message is variable */ uint8* pactiveeplist; } ZPS_tsAplZdpActiveEpRsp; where: u8status is the return status for ZPS_eAplZdpActiveEpRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8activeepcount is the number of active endpoints on the node pactiveeplist is a pointer to the list of active endpoints, where each endpoint is represented by an 8-bit value (in the range 1-240). JN-UG-3101 v1.5 NXP Laboratories UK

348 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpExtendedActiveEpRsp This structure is used to store Extended_Active_EP_rsp message data - a response to a call to the function ZPS_eAplZdpExtendedActiveEpRequest(). This response contains a list of the active endpoints on the node with a given network address. The ZPS_tsAplZdpExtendedActiveEpRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddr; uint8 u8activeepcount; uint8 u8startindex; /* Rest of the message is variable Length */ uint8* pactiveeplist; } ZPS_tsAplZdpExtendedActiveEpRsp; where: u8status is the return status for ZPS_eAplZdpExtendedActiveEpRequest() 16NwkAddr is the network address of the remote node that sent the response (this is the network address that was specified in the request) u8activeepcount is the total number of active endpoints on the node u8startindex is the index, in the node s list of active endpoints, of the first endpoint reported in this response pactiveeplist is a pointer to the reported list of active endpoints (starting with the endpoint with index u8startindex) ZPS_tsAplZdpUserDescConf This structure is used to store User_Desc_conf message data - a response to a call to the function ZPS_eAplZdpUserDescSetRequest(). This response contains a confirmation of the requested configuration of the User descriptor on a given network node. The ZPS_tsAplZdpUserDescConf structure is detailed below. typedef struct { uint8 u8status; uint16 u16nwkaddrofinterest; } ZPS_tsAplZdpUserDescConf; where: u8status is the return status for ZPS_eAplZdpUserDescSetRequest() u16nwkaddrofinterest is the network address of the remote node that sent the response (this is the network address that was specified in the request) 348 NXP Laboratories UK 2017 JN-UG-3101 v1.5

349 ZigBee PRO Stack ZPS_tsAplZdpSystemServerDiscoveryRsp This structure is used to store System_Server_Discovery_rsp message data - a response to a call to the function ZPS_eAplZdpSystemServerDiscoveryRequest(). This response indicates which of the requested services are supported by a given network node. The ZPS_tsAplZdpSystemServerDiscoveryRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16servermask; } ZPS_tsAplZdpSystemServerDiscoveryRsp; where: u8status is the return status for the function ZPS_eAplZdpSystemServerDiscoveryRequest() u16servermask is the returned bitmask that summarises the requested services supported by the node (1 for supported, 0 for not supported or not requested ). This bitmask is detailed in the table below. Bit Service 0 Primary Trust Centre 1 Backup Trust Centre 2 Primary Binding Table Cache 3 Backup Binding Table Cache 4 Primary Discovery Cache 5 Back-up Discovery Cache 6 Network Manager 7-15 Reserved Table 15: Services Bitmask ZPS_tsAplZdpDiscoveryCacheRsp This structure is used to store Discovery_Cache_rsp message data - a response to a call to the function ZPS_eAplZdpDiscoveryCacheRequest(). This response indicates that the sending node has a primary discovery cache. The ZPS_tsAplZdpDiscoveryCacheRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpDiscoveryCacheRsp; where u8status is the return status for ZPS_eAplZdpDiscoveryCacheRequest(). JN-UG-3101 v1.5 NXP Laboratories UK

350 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpDiscoveryStoreRsp This structure is used to store Discovery_Store_rsp message data - a response to a call to the function ZPS_eAplZdpDiscoveryStoreRequest(). This response indicates whether the sending node has successfully reserved space in its primary discovery cache. The ZPS_tsAplZdpDiscoveryStoreRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpDiscoveryStoreRsp; where u8status is the return status for ZPS_eAplZdpDiscoveryStoreRequest() ZPS_tsAplZdpNodeDescStoreRsp This structure is used to store Node_Desc_store_rsp message data - a response to a call to the function ZPS_eAplZdpNodeDescStoreRequest(). This response indicates whether the sending node has successfully stored the received Node descriptor in its primary discovery cache. The ZPS_tsAplZdpNodeDescStoreRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpNodeDescStoreRsp; where u8status is the return status for ZPS_eAplZdpNodeDescStoreRequest() ZPS_tsAplZdpPowerDescStoreRsp This structure is used to store Power_Desc_store_rsp message data - a response to a call to the function ZPS_eAplZdpPowerDescStoreRequest(). This response indicates whether the sending node has successfully stored the received Power descriptor in its primary discovery cache. The ZPS_tsAplZdpPowerDescStoreRsp structure is detailed below. typedef struct { uint8 u8status; uint64 u64ieeeaddr; /* Rest of message is variable length */ ZPS_tsAplZdpNodePowerDescriptor spowerdescriptor; } ZPS_tsAplZdpPowerDescStoreRsp; where: u8status is the return status for ZPS_eAplZdpPowerDescStoreRequest(). u64ieeeaddr is the IEEE/MAC address of the device whose Power descriptor has been stored in the primary discovery cache. spowerdescriptor is the Power descriptor stored (see Section ). 350 NXP Laboratories UK 2017 JN-UG-3101 v1.5

351 ZigBee PRO Stack ZPS_tsAplZdpSimpleDescStoreRsp This structure is used to store Power_Desc_store_rsp message data - a response to a call to the function ZPS_eAplZdpSimpleDescStoreRequest(). This response indicates whether the sending node has successfully stored the received Simple descriptor in its primary discovery cache. The ZPS_tsAplZdpSimpleDescStoreRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpSimpleDescStoreRsp; where u8status is the return status for ZPS_eAplZdpSimpleDescStoreRequest() ZPS_tsAplZdpActiveEpStoreRsp This structure is used to store Active_EP_store_rsp message data - a response to a call to the function ZPS_eAplZdpActiveEpStoreRequest(). This response indicates whether the sending node has successfully stored the received list of active endpoints in its primary discovery cache. The ZPS_tsAplZdpActiveEpStoreRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpActiveEpStoreRsp; where u8status is the return status for ZPS_eAplZdpActiveEpStoreRequest() ZPS_tsAplZdpFindNodeCacheRsp This structure is used to store Find_node_cache_rsp message data - a response to a call to the function ZPS_eAplZdpFindNodeCacheRequest(). This response indicates that the sending node holds discovery information about a given network node in its primary discovery cache. The ZPS_tsAplZdpFindNodeCacheRsp structure is detailed below. typedef struct { uint16 u16cachenwkaddr; uint16 u16nwkaddr; uint64 u64ieeeaddr; } ZPS_tsAplZdpFindNodeCacheRsp; where: u16cachenwkaddr is the network address of the remote node that sent the response u16nwkaddr is the network address of the node of interest (this is the network address that was specified in the request) u64ieeeaddr is the IEEE address of the node of interest (this is the IEEE address that was specified in the request) JN-UG-3101 v1.5 NXP Laboratories UK

352 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpRemoveNodeCacheRsp This structure is used to store Remove_node_cache_rsp message data - a response to a call to the function ZPS_eAplZdpRemoveNodeCacheRequest(). This response indicates whether the sending node has successfully removed from its primary discovery cache all discovery information relating to a given End Device node. The ZPS_tsAplZdpRemoveNodeCacheRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpRemoveNodeCacheRsp; where u8status is the return status for the function ZPS_eAplZdpRemoveNodeCacheRequest() ZPS_tsAplZdpEndDeviceBindRsp This structure is used to store End_Device_Bind_rsp message data - a response to a call to the function ZPS_eAplZdpEndDeviceBindRequest(). This response is issued by the Co-ordinator to indicate the status of an End Device binding request. The ZPS_tsAplZdpEndDeviceBindRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpEndDeviceBindRsp; where u8status is the return status for ZPS_eAplZdpEndDeviceBindRequest() ZPS_tsAplZdpBindRsp This structure is used to store Bind_rsp message data - a response to a call to the function ZPS_eAplZdpBindUnbindRequest(). This response indicates the status of a binding request (a request to modify of a binding table). The ZPS_tsAplZdpBindRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpBindRsp; where u8status is the return status for ZPS_eAplZdpBindUnbindRequest(). 352 NXP Laboratories UK 2017 JN-UG-3101 v1.5

353 ZigBee PRO Stack ZPS_tsAplZdpUnbindRsp This structure is used to store Unbind_rsp message data - a response to a call to the function ZPS_eAplZdpBindUnbindRequest(). This response indicates the status of an unbinding request (a request to modify of a binding table). The ZPS_tsAplZdpUnbindRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpUnbindRsp; where u8status is the return status for ZPS_eAplZdpBindUnbindRequest() ZPS_tsAplZdpBindRegisterRsp This structure is used to store Bind_Register_rsp message data - a response to a call to the function ZPS_eAplZdpBindRegisterRequest(). This response contains binding information held on the responding node concerning the requesting node. The ZPS_tsAplZdpBindRegisterRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16bindingtableentries; uint16 u16bindingtablelistcount; /* Rest of the message is variable Length */ ZPS_tsAplZdpBindingTable sbindingtablelist; } ZPS_tsAplZdpBindRegisterRsp; where: u8status is the return status for ZPS_eAplZdpBindRegisterRequest() u16bindingtableentries is the total number of binding table entries concerning the requesting node held on the responding node u16bindingtablelistcount is the number of binding table entries concerning the requesting node contained in this response sbindingtablelist is a pointer to the first item in the list of reported binding table entries. A list item is of type ZPS_tsAplZdpBindingTable detailed below JN-UG-3101 v1.5 NXP Laboratories UK

354 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpBindingTable typedef struct { uint64 u64sourceaddress; ZPS_tsAplZdpBindingTableEntry* psbindingtableentryforspsrcaddr; }ZPS_tsAplZdpBindingTable; where: u64sourceaddress is the IEEE address of the node to which the binding table entry relates psbindingtableentryforspsrcaddr is a pointer to the relevant binding table information. This information is contained in a structure of type ZPS_tsAplZdpBindingTableEntry detailed below ZPS_tsAplZdpBindingTableEntry typedef struct { uint8 u8sourceendpoint; uint16 u16clusterid; uint8 u8dstaddrmode; union { struct { uint16 u16dstaddress; } sshort; struct { uint64 u64dstaddress; uint8 u8dstendpoint; } sextended; }; }ZPS_tsAplZdpBindingTableEntry; where: u8sourceendpoint is the number of the bound endpoint (1-240) on the source node of the binding u16clusterid is the ID of the cluster involved in the binding, on the source node of the binding u8dstaddrmode is the addressing mode used in the rest of the structure (see Table 16 below) u16dstaddress is the network address of the destination node of the binding (this is only application if u8dstaddrmode is set to 0x03) u64dstaddress is the IEEE address of the destination node of the binding (this is only application if u8dstaddrmode is set to 0x04) u8dstendpoint is the number of the bound endpoint (1-240) on the destination node of the binding 354 NXP Laboratories UK 2017 JN-UG-3101 v1.5

355 ZigBee PRO Stack u8dstaddrmode Code Description 0x00 ZPS_E_ADDR_MODE_BOUND Bound endpoint 0x01 ZPS_E_ADDR_MODE_GROUP 16-bit Group address 0x02 ZPS_E_ADDR_MODE_SHORT 16-bit Network (Short) address 0x03 ZPS_E_ADDR_MODE_IEEE 64-bit IEEE/MAC address Table 16: Addressing Modes ZPS_tsAplZdpReplaceDeviceRsp This structure is used to store Replace_Device_rsp message data - a response to a call to the function ZPS_eAplZdpReplaceDeviceRequest(). This response indicates the status of the replace request. The ZPS_tsAplZdpReplaceDeviceRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpReplaceDeviceRsp; where u8status is the return status for ZPS_eAplZdpReplaceDeviceRequest() ZPS_tsAplZdpStoreBkupBindEntryRsp This structure is used to store Store_Bkup_Bind_Entry_rsp message data - a response to a call to the function ZPS_eAplZdpStoreBkupBindEntryRequest(). This response indicates the status of the back-up request. The ZPS_tsAplZdpStoreBkupBindEntryRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpStoreBkupBindEntryRsp; where u8status is the return status for the function ZPS_eAplZdpStoreBkupBindEntryRequest(). JN-UG-3101 v1.5 NXP Laboratories UK

356 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpRemoveBkupBindEntryRsp This structure is used to store Remove_Bkup_Bind_Entry_rsp message data - a response to a call to the function ZPS_eAplZdpRemoveBkupBindEntryRequest(). This response indicates the status of the remove request. The ZPS_tsAplZdpRemoveBkupBindEntryRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpRemoveBkupBindEntryRsp; where u8status is the return status for the function ZPS_eAplZdpRemoveBkupBindEntryRequest() ZPS_tsAplZdpBackupBindTableRsp This structure is used to store Backup_Bind_Table_rsp message data - a response to a call to the function ZPS_eAplZdpBackupBindTableRequest(). This response indicates the status of the back-up request. The ZPS_tsAplZdpBackupBindTableRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16entrycount; } ZPS_tsAplZdpBackupBindTableRsp; where: u8status is the return status for ZPS_eAplZdpBackupBindTableRequest() u16entrycount is the number of binding table entries that have been backed up 356 NXP Laboratories UK 2017 JN-UG-3101 v1.5

357 ZigBee PRO Stack ZPS_tsAplZdpRecoverBindTableRsp This structure is used to store Recover_Bind_Table_rsp message data - a response to a call to the function ZPS_eAplZdpRecoverBindTableRequest(). This response indicates the status of the recover request and contains the recovered binding table entries. The ZPS_tsAplZdpRecoverBindTableRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16startindex; uint16 u16bindingtableentries; uint16 u16bindingtablelistcount; /* Rest of the message is variable length */ ZPS_tsAplZdpBindingTable sbindingtablelist; } ZPS_tsAplZdpRecoverBindTableRsp; where: u8status is the return status for ZPS_eAplZdpRecoverBindTableRequest() u16startindex is the binding table index of the first entry in the set of recovered binding table entries (sbindingtablelist) u16bindingtableentries is the total number of entries in the back-up binding table cache u16bindingtablelistcount is the number of entries in the set of recovered binding table entries (sbindingtablelist) sbindingtablelist is a pointer to the first item in the list of recovered binding table entries. A list item is of type ZPS_tsAplZdpBindingTable, detailed in Section ZPS_tsAplZdpBackupSourceBindRsp This structure is used to store Backup_Source_Bind_rsp message data - a response to a call to the function ZPS_eAplZdpBackupSourceBindRequest(). This response indicates the status of the back-up request. The ZPS_tsAplZdpBackupSourceBindRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpBackupSourceBindRsp; where u8status is the return status for the function ZPS_eAplZdpBackupSourceBindRequest(). JN-UG-3101 v1.5 NXP Laboratories UK

358 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpRecoverSourceBindRsp This structure is used to store Recover_Source_Bind_rsp message data - a response to a call to the function ZPS_eAplZdpRecoverSourceBindRequest(). This response indicates the status of the recover request and contains the recovered binding table entries. The ZPS_tsAplZdpRecoverSourceBindRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16startindex; uint16 u16sourcetableentries; uint16 u16sourcetablelistcount; /* Rest of the message is variable length */ uint64* pu64sourcetablelist; } ZPS_tsAplZdpRecoverSourceBindRsp; where: u8status is the return status for the function ZPS_eAplZdpRecoverSourceBindRequest() u16startindex is the binding table index of the first entry in the set of recovered binding table entries (pu64sourcetablelist) u16sourcetableentries is the total number of source binding table entries in the back-up binding table cache u16sourcetablelistcount is the number of entries in the set of recovered binding table entries (pu64sourcetablelist) pu64sourcetablelist is a pointer to the first item in the list of recovered binding table entries 358 NXP Laboratories UK 2017 JN-UG-3101 v1.5

359 ZigBee PRO Stack ZPS_tsAplZdpMgmtNwkDiscRsp This structure is used to store Mgmt_NWK_Disc_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtNwkDiscRequest(). This response reports the networks discovered in a network discovery (all the networks or a subset). The ZPS_tsAplZdpMgmtNwkDiscRsp structure is detailed below. typedef struct { uint8 u8status; uint8 u8networkcount; uint8 u8startindex; uint8 u8networklistcount; /* Rest of the message is variable length */ ZPS_tsAplZdpNetworkDescr* psnetworkdescrlist; } ZPS_tsAplZdpMgmtNwkDiscRsp; where: u8status is the return status for ZPS_eAplZdpMgmtNwkDiscRequest() u8networkcount is the total number of networks discovered u8startindex is the index, in the complete list of discovered networks, of the first network reported in this response (through psnetworkdescrlist) u8networklistcount is the number of discovered networks reported in this response (through psnetworkdescrlist) psnetworkdescrlist is a pointer to the first entry in a list of network descriptors for the discovered networks. Each entry is of the type ZPS_tsAplZdpNetworkDescr detailed below ZPS_tsAplZdpNetworkDescr typedef struct { uint64 u64extpanid; uint8 u8logicalchan; uint8 u8stackprofile; uint8 u8zigbeeversion; uint8 u8permitjoining; uint8 u8routercapacity; uint8 u8enddevicecapacity; } ZPS_tsAplZdpNetworkDescr; where: u64extpanid is the 64-bit extended PAN ID of the discovered network u8logicalchan is the radio channel in which the discovered network operates (value in range 0 to 26, but only channels 11 to 26 relevant to 2400-MHz band) u8stackprofile is the 4-bit identifier of the ZigBee stack profile used by the discovered network (0 - manufacturer-specific, 1 - ZigBee, 2 - ZigBee PRO, other values reserved) and is fixed at 2 for the NXP stack JN-UG-3101 v1.5 NXP Laboratories UK

360 Chapter 8 ZigBee Device Profile (ZDP) API u8zigbeeversion is the 4-bit version of the ZigBee protocol used by the discovered network u8permitjoining indicates whether the discovered network is currently allowing joinings - that is, at least one node (a Router or the Co-ordinator) of the network is allowing other nodes to join it: 0x01: Joinings allowed 0x00: Joinings not allowed All other values reserved u8routercapacity indicates whether the device is capable of accepting join requests from Routers - set to TRUE if capable, FALSE otherwise u8enddevicecapacity indicates whether the device is capable of accepting join requests from End Devices - set to TRUE capable, FALSE otherwise ZPS_tsAplZdpMgmtLqiRsp This structure is used to store Mgmt_Lqi_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtLqiRequest(). This response reports a list of neighbouring nodes along with their LQI (link quality) values. The ZPS_tsAplZdpMgmtLqiRsp structure is detailed below. typedef struct { uint8 u8status; uint8 u8neighbortableentries; uint8 u8startindex; uint8 u8neighbortablelistcount; /* Rest of the message is variable length */ ZPS_tsAplZdpNtListEntry* pnetworktablelist; } ZPS_tsAplZdpMgmtLqiRsp; where: u8status is the return status for ZPS_eAplZdpMgmtLqiRequest() u8neighbortableentries is the total number of Neighbour table entries on the remote node u8startindex is the Neighbour table index of the first entry reported in this response (through pnetworktablelist) u8networklistcount is the number of Neighbour table entries reported in this response (through pnetworktablelist) pnetworktablelist is a pointer to the first entry in the list of reported Neighbour table entries. Each entry is of the type ZPS_tsAplZdpNtListEntry detailed below 360 NXP Laboratories UK 2017 JN-UG-3101 v1.5

361 ZigBee PRO Stack ZPS_tsAplZdpNtListEntry typedef struct { uint64 u64extpanid; uint64 u64extendedaddress; uint16 u16nwkaddr; uint8 u8linkquality; uint8 u8depth; /* * Bitfields are used for syntactic neatness and space saving. * May need to assess whether these are suitable for embedded environment and may need to watch endianness on u8assignment */ union { struct { unsigned u1reserved1:1; unsigned u2relationship:3; unsigned u2rxonwhenidle:2; unsigned u2devicetype:2; unsigned u6reserved2:6; unsigned u2permitjoining:2; } ; uint8 au8field[2]; } uancattrs; } ZPS_tsAplZdpNtListEntry; where: u64extpanid is the 64-bit extended PAN ID of the network u64extendedaddress is the IEEE address of the neighbouring node u16nwkaddr is the network address of the neighbouring node u8linkquality is the estimated LQI (link quality) value for radio transmissions from the neighbouring node u8depth is the tree depth of the neighbouring node (where the Co-ordinator is at depth zero) u1reserved1:1 is a 1-bit reserved value and should be set zero. u2relationship:3 is a 3-bit value representing the neighbouring node s relationship to the local node: 0: Neighbour is the parent 1: Neighbour is a child 2: Neighbour is a sibling (has same parent) 3: None of the above JN-UG-3101 v1.5 NXP Laboratories UK

362 Chapter 8 ZigBee Device Profile (ZDP) API 4: Neighbour is a former child u2rxonwhenidle:2 is a 2-bit value indicating whether the neighbouring node s receiver is enable during idle periods: 0: Receiver off when idle (sleeping device) 1: Receiver on when idle (non-sleeping device) 2: Unknown u2devicetype:2 is a 2-bit value representing the ZigBee device type of the neighbouring node: 0: Co-ordinator 1: Router 2: End Device 3: Unknown u6reserved2:6 is a 6-bit reserved value and should be set zero. u2permitjoining:2 is a 2-bit value indicating whether the neighbouring node is accepting joining requests: 0: Not accepting join requests 1: Accepting join requests 2: Unknown au8field[2] is the allocation of two bytes for the union ZPS_tsAplZdpMgmtRtgRsp This structure is used to store Mgmt_Rtg_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtRtgRequest(). This response reports the contents of the remote node s Routing table The ZPS_tsAplZdpMgmtRtgRsp structure is detailed below. typedef struct { uint8 u8status; uint8 u8routingtableentries; uint8 u8startindex; uint8 u8routingtablecount; /* Rest of the message is variable length */ ZPS_tsAplZdpRtEntry* proutingtablelist; } ZPS_tsAplZdpMgmtRtgRsp; where: u8status is the return status for ZPS_eAplZdpMgmtRtgRequest() u8routingtableentries is the total number of Routing table entries on the remote node u8startindex is the Routing table index of the first entry reported in this response (through proutingtablelist) 362 NXP Laboratories UK 2017 JN-UG-3101 v1.5

363 ZigBee PRO Stack u8routingtablecount is the number of Routing table entries reported in this response (through proutingtablelist) proutingtablelist is a pointer to the first entry in the list of reported Routing table entries. Each entry is of the type ZPS_tsAplZdpRtEntry detailed below ZPS_tsAplZdpRtEntry typedef struct { uint16 u16nwkdstaddr; /**< Destination Network address */ uint16 u16nwknxthopaddr; /**< Next hop Network address */ union { struct { unsigned u3status:3; unsigned u1memconst:1; unsigned u1manytoone:1; unsigned u1routerecordreqd:1; unsigned u1reserved:2; } bfbitfields; uint8 u8field; } uancattrs; } ZPS_tsAplZdpRtEntry; where: u16nwkdstaddr is the destination network address of the route u16nwknxthopaddr is the next hop network address of the route u3status:3 is the 3-bit status for the route: 000 = ACTIVE 001 = DISCOVERY_UNDERWAY 010 = DISCOVERY_FAILED 011 = INACTIVE 100 = VALIDATION_UNDERWAY = Reserved u1memconst:1 is a bit indicating whether the device is a memory-constrained concentrator u1manytoone:1 is a bit indicating whether the destination node is a concentrator that issued a many-to-one request u1routerecordreqd:1 is a bit indicating whether a route record command frame should be sent to the destination before the next data packet u1reserved:2 are reserved bits JN-UG-3101 v1.5 NXP Laboratories UK

364 Chapter 8 ZigBee Device Profile (ZDP) API u8field contains the full set of flags of the bfbitfields sub-structure, with u3status:3 occupying the most significant bits and u1reserved:2 occupying the least significant bits (for a big-endian device) ZPS_tsAplZdpMgmtBindRsp This structure is used to store Mgmt_Bind_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtBindRequest(). This response reports the contents of the remote node s Binding table. The ZPS_tsAplZdpMgmtBindRsp structure is detailed below. typedef struct { uint8 u8status; uint16 u16bindingtableentries; uint16 u16startindex; uint16 u16bindingtablelistcount; /* Rest of the message is variable length */ ZPS_tsAplZdpBindingTable sbindingtablelist; } ZPS_tsAplZdpMgmtBindRsp; where: u8status is the return status for ZPS_eAplZdpMgmtBindRequest() u16bindingtableentries is the total number of Binding table entries on the remote node u8startindex is the Binding table index of the first entry reported in this response (through sbindingtablelist) u16bindingtablelistcount is the number of Binding table entries reported in this response (through sbindingtablelist) sbindingtablelist is a pointer to the first entry in the list of reported Binding table entries. Each entry is of the type ZPS_tsAplZdpBindingTable, detailed in Section ZPS_tsAplZdpMgmtLeaveRsp This structure is used to store Mgmt_Leave_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtLeaveRequest(). This response is issued by a remote node that has been requested to leave the network. The ZPS_tsAplZdpMgmtLeaveRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpMgmtLeaveRsp; where u8status is the return status for ZPS_eAplZdpMgmtLeaveRequest(). 364 NXP Laboratories UK 2017 JN-UG-3101 v1.5

365 ZigBee PRO Stack ZPS_tsAplZdpMgmtDirectJoinRsp This structure is used to store Mgmt_Direct_Join_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtDirectJoinRequest(). This response is issued by a remote node (Router or Co-ordinator) that has been requested to allow a particular device to join the network as a child of the node. The ZPS_tsAplZdpMgmtDirectJoinRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpMgmtDirectJoinRsp; where u8status is the return status for ZPS_eAplZdpMgmtDirectJoinRequest() ZPS_tsAplZdpMgmtPermitJoiningRsp This structure is used to store Mgmt_Permit_Joining_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtPermitJoiningRequest(). This response is issued by a remote node (Router or Co-ordinator) that has been requested to enable or disable joining for a specified amount of time. The response is only sent if the original request was unicast (and not if it was broadcast). The ZPS_tsAplZdpMgmtPermitJoiningRsp structure is detailed below. typedef struct { uint8 u8status; } ZPS_tsAplZdpMgmtPermitJoiningRsp; where u8status is the return status for the function ZPS_eAplZdpMgmtPermitJoiningRequest(). JN-UG-3101 v1.5 NXP Laboratories UK

366 Chapter 8 ZigBee Device Profile (ZDP) API ZPS_tsAplZdpMgmtCacheRsp This structure is used to store Mgmt_Cache_rsp message data - a response to a call to the function ZPS_eAplZdpMgmtCacheRequest(). This response reports a list of the End Devices registered in the node s primary discovery cache. The ZPS_tsAplZdpMgmtCacheRsp structure is detailed below. typedef struct { uint8 u8status; uint8 u8discoverycacheentries; uint8 u8startindex; uint8 u8discoverycachelistcount; /* Rest of the message is variable length */ ZPS_tsAplDiscoveryCache* pdiscoverycachelist; } ZPS_tsAplZdpMgmtCacheRsp; where: u8status is the return status for ZPS_eAplZdpMgmtCacheRequest() u8discoverycacheentries is the total number of discovery cache entries on the remote node u8startindex is the discovery cache index of the first entry reported in this response (through pdiscoverycachelist) u8discoverycachelistcount is the number of discovery cache entries reported in this response (through pdiscoverycachelist) proutingtablelist is a pointer to the first entry in the list of reported discovery cache entries. Each entry is of the type ZPS_tsAplDiscoveryCache detailed below ZPS_tsAplDiscoveryCache typedef struct { uint64 u64extendedaddress; uint16 u16nwkaddress; } ZPS_tsAplDiscoveryCache; where: u64extendedaddress is the IEEE address of the End Device u16nwkaddress is the network address of the End Device 366 NXP Laboratories UK 2017 JN-UG-3101 v1.5

367 ZigBee PRO Stack ZPS_tsAplZdpMgmtNwkUpdateNotify This structure is used to store Mgmt_NWK_Update_notify message data - a notification which can be sent in response to a call to the function ZPS_eAplZdpMgmtNwkUpdateRequest(). This notification reports the results of an energy scan on the wireless network radio channels. The ZPS_tsAplZdpMgmtNwkUpdateNotify structure is detailed below. typedef struct { uint8 u8status; uint32 u32scannedchannels; uint16 u16totaltransmissions; uint16 u16transmissionfailures; uint8 u8scannedchannellistcount; /* Rest of the message is variable Length */ uint8* u8energyvalueslist; } ZPS_tsAplZdpMgmtNwkUpdateNotify; where: u8status is the return status for ZPS_eAplZdpMgmtNwkUpdateRequest() u32scannedchannels is a bitmask of the set of scanned radio channels ( 1 means scanned, 0 means not scanned): Bits 0 to 26 respectively represent channels 0 to 26 (only bits 11 to 26 are relevant to the 2400-MHz band) Bits 27 to 31 are reserved u16totaltransmissions is the total number of transmissions (from other networks) detected during the scan u16transmissionfailures is the number of failed transmissions detected during the scan u8scannedchannellistcount is the number of energy-level measurements (one per scanned channel) reported in this notification (through u8energyvalueslist) u8energyvalueslist is a pointer to the first in the set of reported energy-level measurements (the value 0xFF indicates there is too much interference on the channel) JN-UG-3101 v1.5 NXP Laboratories UK

368 Chapter 8 ZigBee Device Profile (ZDP) API 8.3 Broadcast Addresses When sending a request using a ZDP API function, the request can be broadcast to all nodes in the network by specifying a special 16-bit network address (0xFFFF) or 64-bit IEEE/MAC address (0xFFFFFFFFFFFFFFFF). Other broadcast options are also available in order to target particular groups of nodes, as indicated in the table below. Address Type Broadcast Address Target Nodes Network (16-bit) 0xFFFF All nodes in the network 0xFFFD 0xFFFC All nodes for which Rx on when idle is TRUE All Routers and the Co-ordinator IEEE/MAC (64-bit) 0xFFFFFFFFFFFFFFFF All nodes in the network Table 17: Broadcast Addresses and Target Nodes 368 NXP Laboratories UK 2017 JN-UG-3101 v1.5

369 ZigBee PRO Stack 9. Event and Status Codes This chapter summarises the event and return/status codes of the ZigBee PRO stack. 9.1 Events The events that can be generated by the ZigBee PRO stack are enumerated in the structure ZPS_teAfEventType (from the AF API), shown below. typedef enum { ZPS_EVENT_NONE, ZPS_EVENT_APS_DATA_INDICATION, ZPS_EVENT_APS_DATA_CONFIRM, ZPS_EVENT_APS_DATA_ACK, ZPS_EVENT_NWK_STARTED, ZPS_EVENT_NWK_JOINED_AS_ROUTER, ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE, ZPS_EVENT_NWK_FAILED_TO_START, ZPS_EVENT_NWK_FAILED_TO_JOIN, ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED, ZPS_EVENT_NWK_DISCOVERY_COMPLETE, ZPS_EVENT_NWK_LEAVE_INDICATION, ZPS_EVENT_NWK_LEAVE_CONFIRM, ZPS_EVENT_NWK_STATUS_INDICATION, ZPS_EVENT_NWK_ROUTE_DISCOVERY_CONFIRM, ZPS_EVENT_NWK_POLL_CONFIRM, ZPS_EVENT_NWK_ED_SCAN, ZPS_EVENT_ZDO_BIND, ZPS_EVENT_ZDO_UNBIND, ZPS_EVENT_ZDO_LINK_KEY, ZPS_EVENT_BIND_REQUEST_SERVER ZPS_EVENT_ERROR, ZPS_EVENT_APS_INTERPAN_DATA_INDICATION, ZPS_EVENT_APS_INTERPAN_DATA_CONFIRM, } ZPS_teAfEventType; The events in the above structure are outlined in Table 18 below. Note: The AF structures which contain the data for the above events are detailed in Section JN-UG-3101 v1.5 NXP Laboratories UK

370 Chapter 9 Event and Status Codes Stack Event ZPS_EVENT_NONE ZPS_EVENT_APS_DATA_INDICATION ZPS_EVENT_APS_DATA_CONFIRM ZPS_EVENT_APS_DATA_ACK ZPS_EVENT_NWK_STARTED Description Used as initial value in structure which receives a message collected from a message queue. Indicates that data has arrived on the local node. The event provides information about the data packet through the structure ZPS_tsAfDataIndEvent - see Section Indicates whether a sent data packet has been successfully passed down the stack and has reached the next hop node towards its destination. The results are reported through the structure ZPS_tsAfDataConfEvent - see Section Indicates that a sent message has reached its destination node. Details of the received acknowledgement are reported through the structure ZPS_tsAfDataAckEvent - see Section Indicates that network has started on Co-ordinator. This is reported through the structure ZPS_tsAfNwkFormationEvent - see Section Permit joining state is set as specified in APL data structure. ZPS_EVENT_NWK_JOINED_AS_ROUTER Indicates that device has successfully joined network - as Router and reports allocated network address through the structure ZPS_tsAfNwkJoinedEvent - see Section ZPS_EVENT_NWK_JOINED_AS_ENDDEVICE ZPS_EVENT_NWK_FAILED_TO_START ZPS_EVENT_NWK_FAILED_TO_JOIN ZPS_EVENT_NWK_NEW_NODE_HAS_JOINED ZPS_EVENT_NWK_DISCOVERY_COMPLETE Indicates that device has successfully joined network as End Device and reports allocated network address through the structure ZPS_tsAfNwkJoinedEvent - see Section Indicates that network has failed to start on Co-ordinator. Indicates that device failed to join network. This is reported through the structure ZPS_tsAfNwkJoinFailedEvent - see Section Indicates to Co-ordinator or Router that new node has joined as child and reports details of new child through the structure ZPS_tsAfNwkJoinIndEvent - see Section Indicates that network discovery on Router or End Device has finished and reports details of detected network through the structure ZPS_tsAfNwkDiscoveryEvent - see Section This event (and associated structure) is generated for each network detected. Table 18: Stack Events 370 NXP Laboratories UK 2017 JN-UG-3101 v1.5

371 ZigBee PRO Stack Stack Event ZPS_EVENT_NWK_LEAVE_INDICATION ZPS_EVENT_NWK_LEAVE_CONFIRM ZPS_EVENT_NWK_STATUS_INDICATION ZPS_EVENT_NWK_ROUTE_DISCOVERY_CONFIRM ZPS_EVENT_NWK_POLL_CONFIRM ZPS_EVENT_NWK_ED_SCAN ZPS_EVENT_ZDO_BIND ZPS_EVENT_ZDO_UNBIND ZPS_EVENT_ZDO_LINK_KEY ZPS_EVENT_BIND_REQUEST_SERVER ZPS_EVENT_ERROR Description Indicates that a neighbouring node has left the network or a remote node has requested the local node to leave. Details are provided through the structure ZPS_tsAfNwkLeaveIndEvent - see Section Reports the results of a node leave request issued by the local node. The results are reported through the structure ZPS_tsAfNwkLeaveConfEvent - see Section Reports network status event from a remote or local node through the structure ZPS_tsAfNwkStatusIndEvent - see Section Indicates that a route discovery has been performed. The results are reported in the structure ZPS_tsAfNwkRouteDiscoveryConfEvent - see Section Generated on an End Device to indicate that a poll request submitted to its parent has completed. The outcome of the poll request is indicated through the structure ZPS_tsAfPollConfEvent - see Section Indicates that an energy detect scan in the 2.4-GHz radio band has completed. The results of the scan are reported through the structure ZPS_tsAfNwkEdScanConfEvent - see Section Indicates that the local node has been successfully bound to one or more remote nodes. The details of the binding are reported through the structure ZPS_tsAfZdoBindEvent - see Section Indicates that the local node has been successfully unbound from one or more remote nodes. The details of the unbinding are reported through the structure ZPS_tsAfZdoUnbindEvent - see Section Indicates that a new application link key has been received and installed, and is ready for use. The details of the link key are reported through the structure ZPS_tsAfZdoLinkKeyEvent - see Section Indicates the results of a bound data transmission. The results are reported through the structure ZPS_tsAfBindRequestServerEvent - see Section Indicates that an error has occurred on the local node. The nature of the error is reported through the structure ZPS_tsAfErrorEvent - see Section Table 18: Stack Events JN-UG-3101 v1.5 NXP Laboratories UK

372 Chapter 9 Event and Status Codes Stack Event ZPS_EVENT_APS_INTERPAN_DATA_INDICATION ZPS_EVENT_APS_INTERPAN_DATA_CONFIRM Description Indicates that an inter-pan communication has arrived (from a node in another network). Details of the inter- PAN communication are reported through the structure ZPS_tsAfInterPanDataIndEvent - see Section Indicates that an inter-pan communication (to another network) has been sent by the local node and an acknowledgement has been received from the first hop node (this acknowledgement is not generated in the case of a broadcast). The status of the inter-pan communication is reported through the structure ZPS_tsAfInterPanDataConfEvent - see Section Table 18: Stack Events Note: Events are handled using the JenOS RTOS. Event handling is outlined in Appendix A. 372 NXP Laboratories UK 2017 JN-UG-3101 v1.5

373 ZigBee PRO Stack 9.2 Return/Status Codes The return/status codes that can result from ZigBee PRO API function calls are divided into the following groups: ZDP codes - see Section APS codes - see Section NWK codes - see Section MAC codes - see Section Extended error codes - see Section ZDP Codes The ZDP codes are carried in request and response messages. Name Value Description ZPS_APL_ZDP_E_INV_REQUESTTYPE 0x80 The supplied request type was invalid. ZPS_APL_ZDP_E_DEVICE_NOT_FOUND 0x81 The requested device did not exist on a device following a child descriptor request to a parent. ZPS_APL_ZDP_E_INVALID_EP 0x82 The supplied endpoint was equal to 0x00 or between 0xF1 and 0xFF. ZPS_APL_ZDP_E_NOT_ACTIVE 0x83 The requested endpoint is not described by a Simple descriptor. ZPS_APL_ZDP_E_NOT_SUPPORTED 0x84 The requested optional feature is not supported on the target device. ZPS_APL_ZDP_E_TIMEOUT 0x85 A timeout has occurred with the requested operation. ZPS_APL_ZDP_E_NO_MATCH 0x86 The End Device bind request was unsuccessful due to a failure to match any suitable clusters. ZPS_APL_ZDP_E_NO_ENTRY 0x88 The unbind request was unsuccessful due to the Coordinator or source device not having an entry in its binding table to unbind. ZPS_APL_ZDP_E_NO_DESCRIPTOR 0x89 A child descriptor was not available following a discovery request to a parent. ZPS_APL_ZDP_E_INSUFFICIENT_SPACE 0x8A The device does not have storage space to support the requested operation. ZPS_APL_ZDP_E_NOT_PERMITTED 0x8B The device is not in the proper state to support the requested operation. ZPS_APL_ZDP_E_TABLE_FULL 0x8C The device does not have table space to support the operation. ZPS_APL_ZDP_E_NOT_AUTHORIZED 0x8D The permissions configuration table on the target indicates that the request is not authorised from this device. Table 19: ZDP Codes JN-UG-3101 v1.5 NXP Laboratories UK

374 Chapter 9 Event and Status Codes APS Codes The APS codes relate to sending/receiving messages. Name Value Description ZPS_APL_APS_E_ASDU_TOO_LONG 0xA0 A transmit request failed since the ASDU is too large and fragmentation is not supported. ZPS_APL_APS_E_DEFRAG_DEFERRED 0xA1 A received fragmented frame could not be defragmented at the current time. ZPS_APL_APS_E_DEFRAG_UNSUPPORTED 0xA2 A received fragmented frame could not be defragmented since the device does not support fragmentation. ZPS_APL_APS_E_ILLEGAL_REQUEST 0xA3 A parameter value was out of range. ZPS_APL_APS_E_INVALID_BINDING 0xA4 An APSME-UNBIND.request failed due to the requested binding link not existing in the binding table. ZPS_APL_APS_E_INVALID_GROUP 0xA5 An APSME-REMOVE-GROUP.request has been issued with a group identifier that does not appear in the group table. ZPS_APL_APS_E_INVALID_PARAMETER 0xA6 A parameter value was invalid or out of range. ZPS_APL_APS_E_NO_ACK 0xA7 An APSDE-DATA.request requesting acknowledged transmission failed due to no acknowledgement being received. ZPS_APL_APS_E_NO_BOUND_DEVICE 0xA8 An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to there being no devices bound to this device. ZPS_APL_APS_E_NO_SHORT_ADDRESS 0xA9 An APSDE-DATA.request with a destination addressing mode set to 0x03 failed due to no corresponding short address found in the address map table. ZPS_APL_APS_E_NOT_SUPPORTED 0xAA An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to a binding table not being supported on the device. ZPS_APL_APS_E_SECURED_LINK_KEY 0xAB An ASDU was received that was secured using a link key. ZPS_APL_APS_E_SECURED_NWK_KEY 0xAC An ASDU was received that was secured using a network key. ZPS_APL_APS_E_SECURITY_FAIL 0xAD An APSDE-DATA.request requesting security has resulted in an error during the corresponding security processing. Table 20: APS Codes 374 NXP Laboratories UK 2017 JN-UG-3101 v1.5

375 ZigBee PRO Stack Name Value Description ZPS_APL_APS_E_TABLE_FULL 0xAE An APSME-BIND.request or APSME.ADDGROUP.request issued when the binding or group tables, respectively, were full. ZPS_APL_APS_E_UNSECURED 0xAF An ASDU was received without any security. ZPS_APL_APS_E_UNSUPPORTED_ATTRIBUTE 0xB0 An APSME-GET.request or APSMESET. request has been issued with an unknown attribute identifier. Table 20: APS Codes JN-UG-3101 v1.5 NXP Laboratories UK

376 Chapter 9 Event and Status Codes NWK Codes The NWK codes come from the NWK layer of the stack and may be returned by any ZigBee PRO API function with a non-void return. Name Value Description ZPS_NWK_ENUM_SUCCESS 0x00 Success ZPS_NWK_ENUM_INVALID_PARAMETER 0xC1 An invalid or out-of-range parameter has been passed ZPS_NWK_ENUM_INVALID_REQUEST 0xC2 Request cannot be processed ZPS_NWK_ENUM_NOT_PERMITTED 0xC3 NLME-JOIN.request not permitted ZPS_NWK_ENUM_STARTUP_FAILURE 0xC4 NLME-NETWORK-FORMATION.request failed ZPS_NWK_ENUM_ALREADY_PRESENT 0xC5 NLME-DIRECT-JOIN.request failure - device already present ZPS_NWK_ENUM_SYNC_FAILURE 0xC6 NLME-SYNC.request has failed ZPS_NWK_ENUM_NEIGHBOR_TABLE_FULL 0xC7 NLME-DIRECT-JOIN.request failure - no space in Router table ZPS_NWK_ENUM_UNKNOWN_DEVICE 0xC8 NLME-LEAVE.request failure - device not in Neighbour table ZPS_NWK_ENUM_UNSUPPORTED_ATTRIBUTE 0xC9 NLME-GET/SET.request unknown attribute identifier ZPS_NWK_ENUM_NO_NETWORKS 0xCA NLME-JOIN.request detected no networks ZPS_NWK_ENUM_RESERVED_1 0xCB Reserved ZPS_NWK_ENUM_MAX_FRM_CTR 0xCC Security processing has failed on outgoing frame due to maximum frame counter ZPS_NWK_ENUM_NO_KEY 0xCD Security processing has failed on outgoing frame due to no key ZPS_NWK_ENUM_BAD_CCM_OUTPUT 0xCE Security processing has failed on outgoing frame due CCM ZPS_NWK_ENUM_NO_ROUTING_CAPACITY 0xCF Attempt at route discovery has failed due to lack of table space ZPS_NWK_ENUM_ROUTE_DISCOVERY_FAILED 0xD0 Attempt at route discovery has failed due to any reason except lack of table space ZPS_NWK_ENUM_ROUTE_ERROR 0xD1 NLDE-DATA.request has failed due to routing failure on sending device ZPS_NWK_ENUM_BT_TABLE_FULL 0xD2 Broadcast or broadcast-mode multicast has failed as there is no room in BTT ZPS_NWK_ENUM_FRAME_NOT_BUFFERED 0xD3 Unicast mode multi-cast frame was discarded pending route discovery Table 21: NWK Codes 376 NXP Laboratories UK 2017 JN-UG-3101 v1.5

377 ZigBee PRO Stack MAC Codes The MAC codes come from the IEEE MAC layer of the stack and may be returned by any ZigBee PRO API function with a non-void return. The codes are also described in the IEEE Stack (JN-UG-3024). Name Value Description MAC_ENUM_SUCCESS 0x00 Success MAC_ENUM_BEACON_LOSS 0xE0 Beacon loss after synchronisation request MAC_ENUM_CHANNEL_ACCESS_FAILURE 0xE1 CSMA/CA channel access failure MAC_ENUM_DENIED 0xE2 GTS request denied MAC_ENUM_DISABLE_TRX_FAILURE 0xE3 Could not disable transmit or receive MAC_ENUM_FAILED_SECURITY_CHECK 0xE4 Incoming frame failed security check MAC_ENUM_FRAME_TOO_LONG 0xE5 Frame too long, after security processing, to be sent MAC_ENUM_INVALID_GTS 0xE6 GTS transmission failed MAC_ENUM_INVALID_HANDLE 0xE7 Purge request failed to find entry in queue MAC_ENUM_INVALID_PARAMETER 0xE8 Out-of-range parameter in function MAC_ENUM_NO_ACK 0xE9 No acknowledgement received when expected MAC_ENUM_NO_BEACON 0xEA Scan failed to find any beacons MAC_ENUM_NO_DATA 0xEB No response data after a data request MAC_ENUM_NO_SHORT_ADDRESS 0xEC No allocated network (short) address for operation MAC_ENUM_OUT_OF_CAP 0xED Receiver-enable request could not be executed, as CAP finished MAC_ENUM_PAN_ID_CONFLICT 0xEE PAN ID conflict has been detected MAC_ENUM_REALIGNMENT 0xEF Co-ordinator realignment has been received MAC_ENUM_TRANSACTION_EXPIRED 0xF0 Pending transaction has expired and data discarded MAC_ENUM_TRANSACTION_OVERFLOW 0xF1 No capacity to store transaction MAC_ENUM_TX_ACTIVE 0xF2 Receiver-enable request could not be executed, as in transmit state MAC_ENUM_UNAVAILABLE_KEY 0xF3 Appropriate key is not available in ACL MAC_ENUM_UNSUPPORTED_ATTRIBUTE 0xF4 PIB Set/Get on unsupported attribute Table 22: MAC Codes JN-UG-3101 v1.5 NXP Laboratories UK

378 Chapter 9 Event and Status Codes Extended Error Codes If extended error handling is implemented (see Section 5.7), it provides more detail about the error that led to any one of the following function return codes: APS codes 0xA3 and 0xA6 (see Section 9.2.2) NWK code 0xC2 (see Section 9.2.3) The extended error codes which elaborate on the above codes are provided in the ZPS_teExtendedStatus enumerations. Name Value Description ZPS_XS_OK 0x00 Success ZPS_XS_E_FATAL 0x01 Fatal error - retrying will cause the error again ZPS_XS_E_LOOPBACK_BAD_ENDPOINT 0x02 Endpoint is not valid for loopback (fatal error) ZPS_XS_E_SIMPLE_DESCRIPTOR_NO_ OUTPUT_CLUSTER 0x03 No output cluster in the Simple descriptor for this endpoint/cluster (fatal error) ZPS_XS_E_FRAG_NEEDS_ACK 0x04 Fragmented data requests must be sent with APS ack (fatal error) ZPS_XS_E_COMMAND_MANAGER_BAD_ PARAMETER 0x05 Bad parameter has been passed to the command manager (fatal error) ZPS_XS_E_INVALID_ADDRESS 0x06 Address parameter is out-of-range (fatal error), e.g. broadcast address when calling unicast function ZPS_XS_E_INVALID_TX_ACK_FOR_LOCAL_EP 0x07 TX ACK bit has been set when attempting to post to a local endpoint (fatal error) ZPS_XS_E_RESOURCE 0x08 Resource error/shortage - retrying may succeed ZPS_XS_E_NO_FREE_NPDU 0x80 No free NPDUs (resource error) - the number of NPDUs is set in the "Number of NPDUs" property of the "PDU Manager" section of the ZPS Configuration Editor ZPS_XS_E_NO_FREE_APDU 0x81 No free APDUs (resource error) - the number of APDUs is set in the "Instances" property of the appropriate "APDU" child of the "PDU Manager" section of the ZPS Configuration Editor ZPS_XS_E_NO_FREE_SIM_DATA_REQ 0x82 No free simultaneous data request handles (resource error) - the number of handles is set in the "Maximum Number of Simultaneous Data Requests" field of the "APS layer configuration" section of the ZPS Configuration Editor Table 23: Extended Error Codes 378 NXP Laboratories UK 2017 JN-UG-3101 v1.5

379 ZigBee PRO Stack Name Value Description ZPS_XS_E_NO_FREE_APS_ACK 0x83 No free APS acknowledgement handles (resource error) - the number of handles is set in the "Maximum Number of Simultaneous Data Requests with Acks" field of the "APS layer configuration" section of the ZPS Configuration Editor ZPS_XS_E_NO_FREE_FRAG_RECORD 0x84 No free fragment record handles (resource error) - the number of handles is set in the "Maximum Number of Transmitted Simultaneous Fragmented Messages" field of the "APS layer configuration" section of the ZPS Configuration Editor ZPS_XS_E_NO_FREE_MCPS_REQ 0x85 No free MCPS request descriptors (resource error) - there are 8 MCPS request descriptors and these are only ever likely to be exhausted under a very heavy network load or when trying to transmit too many frames too close together ZPS_XS_E_NO_FREE_LOOPBACK 0x86 Loopback send is currently busy (resource error) - there can be only one loopback request at a time ZPS_XS_E_NO_FREE_EXTENDED_ADDR 0x87 No free entries in the extended address table (resource error) - this table is configured in the ZPS Configuration Editor ZPS_XS_E_SIMPLE_DESCRIPTOR_NOT_ FOUND 0x88 Simple descriptor does not exist for this endpoint/ cluster ZPS_XS_E_BAD_PARAM_APSDE_REQ_RSP 0x89 Bad parameter has been found while processing an APSDE request or response Table 23: Extended Error Codes JN-UG-3101 v1.5 NXP Laboratories UK

380 Chapter 9 Event and Status Codes 380 NXP Laboratories UK 2017 JN-UG-3101 v1.5

381 ZigBee PRO Stack 10. ZigBee Network Parameters This chapter lists and describes the ZigBee network parameters that can be set using the ZPS Configuration Editor described in Chapter 11 and Chapter Basic Parameters The basic parameters are listed and described in the table below. Parameter Name Description Default Value Range Default Extended Pan ID The default Extended PAN ID (EPID) when adding new devices to the wireless network. The extended PAN ID is the globally unique 64-bit identifier for the network. This identifier is used to avoid PAN ID conflicts between distinct networks and must be unique among the networks overlapping in a given area. If the value is zero on the Co-ordinator, the device will use its own IEEE/ MAC address as the EPID. A zero value on a Router/End Device means that the device will not look for a particular EPID when joining a network. Note that this value is the default EPID used when adding devices in the ZPS Configuration Editor. The actual EPID used for an individual device can be set via the parameter APS Use Extended PAN ID see Section bits Default Security Enabled The default setting for Security Enabled when adding new devices to the wireless network. true true / false Maximum Number of Nodes The maximum number of nodes for the wireless network. This setting controls the size of tables when adding new devices to the network to ensure adequate resources are available for correct operation a network of the specified size. 20 Table 24: ZigBee Wireless Network Parameters The rest of the network parameters are detailed in the sections that follow, according to their area of application. JN-UG-3101 v1.5 NXP Laboratories UK

382 Chapter 10 ZigBee Network Parameters 10.2 Profile Definition Parameters There is one ZigBee Device Profile (ZDP) and there can be one or more Application Profiles associated with a project. Application profiles are agreements for messages, message formats and processing actions that enable developers to create an interoperable, distributed application employing application entities that reside on separate devices. These application profiles enable applications to send commands, request data, and process commands and requests. Frames to the application layer are normally filtered by the ZigBee PRO stack unless the profile ID in the frame matches the local profile ID. The wild card profile can be used to bypass this check. Parameter Name Description Default Value Range Profile Id Name The profile number. These are obtained from the ZigBee Alliance for public profiles, unless using a private profile. Textual name for the profile. This is used as a prefix for generated macro definitions in zps_gen.h. Table 25: Profile Definition Parameters 16 bits (Value 0 is reserved for the ZDP, 0xFFFF is wild card profile) Valid C identifier. ( ZDP is reserved for the ZigBee Device Profile) 10.3 Cluster Definition Parameters A cluster is an application message, which may be a container for one or more attributes. As an example, the ZigBee Device Profile (ZDP) defines commands and responses. These are contained in Clusters with the cluster identifiers enumerated for each command and response. Each ZDP message is then defined as a cluster. Alternatively, an application profile may create sub-types within the cluster known as attributes. In this case, the cluster is a collection of attributes specified to accompany a specific cluster identifier (sub-type messages). Parameter Name Description Default Value Range Cluster Id The cluster number. These are defined in public profiles by ZigBee Alliance or can be manufacturer specific. This is a reference to an enumeration of clusters within a specific application profile or collection of application profiles. The cluster identifier is a 16-bit number unique within the scope of each application profile and identifies a specific cluster. Conventions may be established across application profiles for common definitions of cluster identifiers whereby each application profile defines a set of cluster identifiers identically. Cluster identifiers are designated as inputs or outputs in the simple descriptor for use in creating a binding table. Table 26: Cluster Definition Parameters 16 bits 382 NXP Laboratories UK 2017 JN-UG-3101 v1.5

383 ZigBee PRO Stack Name Textual name for the cluster. This is used as a prefix for generated macro definitions in zps_gen.h. Table 26: Cluster Definition Parameters Valid C identifier 10.4 Co-ordinator Parameters Parameter Name Description Default Value Range Miscellaneous Co-ordinator Parameters Name Permit Joining Time Textual name for the node. Used as a prefix when generating macro definitions in zps_gen.h. Default number of seconds for which permit joining is enabled. 255 means permanently on 0 means permanently off Valid C identifier Security Enabled Specifies whether the Co-ordinator will secure communication with other devices in the network. true true / false Initial Security Key The initial key that will be used when security is enabled. These are selected from the keys available on the Trust Centre. Default Network Key Table 27: Co-ordinator Node Type Parameters JN-UG-3101 v1.5 NXP Laboratories UK

384 Chapter 10 ZigBee Network Parameters 10.5 Router Parameters Parameter Name Description Default Value Range Miscellaneous Router Parameters Name Permit Joining Time Scan Duration Time Textual name for the node. Used as a prefix when generating macro definitions in zps_gen.h. Default number of seconds for which permit joining is enabled. 255 means permanently on 0 means permanently off The length of time to scan the selected RF channels when searching for a netwok to join. The time spent scanning each channel is: [abasesuperframeduration x (2n + 1)] symbols where n is the value of the Scan Duration Time parameter Valid C identifier Security Enabled Specifies whether the Router will secure communication with other devices in the network. true true / false Initial Security Key The initial key that will be used when security is enabled. These are selected from the keys available on the Trust Centre. Default Network Key Table 28: Router Node Type Parameters 384 NXP Laboratories UK 2017 JN-UG-3101 v1.5

385 ZigBee PRO Stack 10.6 End Device Parameters Parameter Name Description Default Value Range Miscellaneous End Device Parameters Name Scan Duration Time Textual name for the node. Used as a prefix when generating macro definitions in zps_gen.h. The length of time to scan the selected RF channels when searching for a netwok to join. The time spent scanning each channel is: (abasesuperframeduration * (2n + 1)) symbols where n is the value of the Scan Duration Time parameter Valid C identifier Security Enabled Specifies whether the End Device will secure communication with other devices in the network. true true / false Initial Security Key The initial key that will be used when security is enabled. These are selected from the keys available on the Trust Centre. Default Network Key Sleeping Indicates whether the device will turn its receiver off and enter a low-power mode. The End Device s parent will buffer any incoming data until the device returns to its normal operating state and issues a poll request. false true / false Number of Poll Failures Before Rejoin This parameter controls the number of consecutive poll failures from when the device returns to its normal operating state before attempting to find a new parent by initiating a network rejoin. 5 0 will disable this behaviour Table 29: End Device Node Type Parameters JN-UG-3101 v1.5 NXP Laboratories UK

386 Chapter 10 ZigBee Network Parameters 10.7 Advanced Device Parameters These are advanced parameters for Co-ordinator, Router and End Device. Parameter Name Description Default Value Range AF Parameters Default Event RTOS Message Name The default RTOS message that will receive events from the stack if no other message has been configured. APP_msgZps Events Valid C identifier AIB Parameters APS Designated Coordinator (read only) Indicates that on start-up the node should assume the Co-ordinator role within the network. true for Co-ordinator false for Routers / End Devices true / false APS Use Extended PAN ID Indicates the Extended PAN ID (EPID) that the device will use. This is the globally unique 64-bit identifier for the network. This identifier is used to avoid PAN ID conflicts between distinct networks and must be unique among the networks overlapping in a given area. If the value is zero on the Co-ordinator, the device will use its own IEEE/MAC address as the EPID. A zero value on a Router/End Device means that the device will not look for a particular EPID when joining a network. Default Extended PAN ID 64 bits APS Inter-frame Delay Number of milliseconds between APS data frames. Following transmission of each data block, the APS starts a timer. If there are more unacknowledged blocks to send in the current transmission window then, after a delay of apsinterframedelay milliseconds the next block is passed to the NWK data service. Otherwise, the timer is set to apscackwaitduration seconds Table 30: Advanced Device Parameters 386 NXP Laboratories UK 2017 JN-UG-3101 v1.5

387 ZigBee PRO Stack APS Max Window Size APS Non-member Radius APS Security Timeout Period APS fragmented data window size. Fragmentation is a way of sending messages (APDUs) longer than the payload of a single NPDU. The ASDU is segmented and split across a number of NPDUs, then reassembled at the destination. APS Max Window Size defines how many fragments are sent before an acknowledgement is expected. For example, if APS Max Window Size is set to 4 and a message is split into 16 fragments, then an acknowledgement is expected after sending fragments 1-4. Sending of fragments 5-8 does not commence until this acknowledgement is received. Multicast non-member radius size. Defines the number of hops away from the core multi-cast members that a multi-cast transmission can be received. Authentication timeout period in milliseconds for nodes joining the network. If either the initiator or responder waits for an expected incoming message for a time greater than APS Security Timeout Period then a TIMEOUT error is generated (6000 is advised) APS Use Insecure Join Controls action when a secured network rejoin fails. If true, a join using the MAC layer association procedure is performed when a secure rejoin fails. true true / false APS Layer Configuration Parameters APS Duplicate Table Size APS Persistence Time Maximum Number of Simultaneous Data Requests The size of the APS layer duplicate rejection table. This removes duplicated APS packets. Time, in milliseconds, for which the resources associated with an incoming fragmented message will be retained after the complete message has been received. The maximum number of simultaneous APSDE data requests without APS acknowledgements. Should be set to the maximum number of target nodes in one bound transmission. 8 1 or higher or higher Table 30: Advanced Device Parameters JN-UG-3101 v1.5 NXP Laboratories UK

388 Chapter 10 ZigBee Network Parameters Maximum Number of Simultaneous Data Requests with Acks The maximum number of simultaneous APSDE data requests with APS acknowledgements. Should be set to the maximum number of target nodes in one bound transmission. Note that the maximum number of APDU instances must be set to three times this value - see Table 36 on page or higher Inter PAN True if inter PAN functionality is enabled, see Section false true or false APS Poll Period Maximum Number of Received Simultaneous Fragmented Messages Maximum Number of Transmitted Simultaneous Fragmented Messages The polling period, in milliseconds, of a sleeping End Device collecting data of any kind (received messages, received fragmented messages and all transmit acknowledgements). Maximum number of simultaneous fragmented APSDE incoming data requests. Set to a non-zero value to enable reception of fragmented messages (note that this will increase the stack size). Maximum number of simultaneous fragmented APSDE outgoing data requests. Set to a non-zero value to enable transmission of fragmented messages (note that this will increase the stack size) or higher 0 1 or higher 0 1 or higher Network Layer Configuration Parameters for Co-ordinator and Routers Active Neighbour Table Size Child Table Size Address Map Table Size Broadcast Transaction Table Size Size of the active Neighbour table. Each routing node (Co-ordinator or Router) has a Neighbour table which must be large enough to accommodate entries for the node s immediate children, for its own parent and, in a Mesh network, for all peer Routers with which the node has direct radio communication. Size of the child sub-table of the active Neighbour table. This value determines the number of children that the node is allowed to have. Size of the address map, which maps 64-bit IEEE addresses to 16-bit network (short) addresses. Should be set to the number of nodes in the network. Size of broadcast transaction table. The broadcast transaction table stores the broadcast transaction records, which are records of the broadcast messages received by the node or higher 5 1 or higher 10 1 or higher 9 1 or higher Table 30: Advanced Device Parameters 388 NXP Laboratories UK 2017 JN-UG-3101 v1.5

389 ZigBee PRO Stack Discovery Neighbour Table Size Route Discovery Table Size Route Record Table Size Routing Table Size Size of the Discovery Neighbour table. This table keeps a list of the neighbouring devices associated with the node. Size of the Route Discovery table. This table is used by the node to store temporary information used during route discovery. Route Discovery table entries last only as long as the duration of a single route discovery operation. Size of the Route Record table. Each route record contains the destination network address, a count of the number of relay nodes to reach the destination, and a list of the network addresses of the relay nodes. Size of the Routing table. This table stores the information required for the node to participate in the routing of message packets. Each table entry contains the destination address, the status of the route, various flags and the network address of the next hop on the way to the destination. A Routing table entry is made when a new route is initiated by the node or routed via the node. The entry is stored in the Routing table and is read whenever that route is used; the entry is only deleted if the route is no longer valid. A node is said to have routing capacity if there are free entries in the routing table or higher 1 1 or higher 70 1 or higher Security Material Sets Number of supported network keys. 2 1 or higher Network Layer Configuration Parameters for End Devices Active Neighbour Table Size Address Map Table Size Broadcast Transaction Table Size Discovery Neighbour Table Size Size of the active Neighbour table. Set to one (for the parent). Size of the address map, which maps 64-bit IEEE addresses to 16-bit network (short) addresses. Should be set to the number of nodes that the End Device application needs to communicate with plus one (for the parent). Size of broadcast transaction table. The broadcast transaction table stores the broadcast transaction records, which are records of the broadcast messages received by the node. Size of the Discovery Neighbour table. This table keeps a list of the neighbouring devices associated with the node or higher 9 1 or higher Table 30: Advanced Device Parameters JN-UG-3101 v1.5 NXP Laboratories UK

390 Chapter 10 ZigBee Network Parameters Route Discovery Table Size Not applicable - set to one. 2 1 Route Record Table Size Not applicable - set to one. 1 1 Routing Table Size Not applicable - set to one Security Material Sets Number of supported network keys. 2 1 or higher Stack Profile The Zigbee Stack Profile which defines the stack features supported. Set to one for Zigbee, two for Zigbee Pro or any other value for a private stack profile. 2 0 to 15 Table 30: Advanced Device Parameters Endpoint Parameters Parameter Name Description Default Value Range Application Device Id Device ID for the endpoint. Application Device Version Version number for the device. Enabled Whether the endpoint is enabled or disabled. true true / false End Point Id The endpoint number (must be unique within the network) RTOS Message The RTOS message that will receive data events for this endpoint. If unspecified the endpoint uses the default message for the node (AF.Default Message Name). Name Textual name for the endpoint. Used as a prefix when generating macro definitions. Valid C identifier Profile The profile for the endpoint. This as a link to a profile definition. Table 31: Endpoint Parameters 390 NXP Laboratories UK 2017 JN-UG-3101 v1.5

391 ZigBee PRO Stack Input Cluster Specifies that the endpoint will receive the specified cluster. Parameter Name Description Default Value Range Cluster A link to a cluster defined within the profile specified by the endpoint that will be received. Receive APDU A link to an APDU that will buffer any incoming messages. Discoverable Defines whether the input cluster will be present in the endpoints simple descriptor which is used for service discovery. true true / false Table 32: Input Cluster Parameters Output Cluster Specifies that the endpoint will transmit the specified cluster. Parameter Name Description Default Value Range Cluster A link to a cluster defined within the profile specified by the endpoint that is to be transmitted. Transmit APDUs List of APDUs that will be used to transmit the cluster. Discoverable Defines whether the input cluster will be present in the endpoints Simple descriptor which is used for service discovery. true true / false Table 33: Output Cluster Parameters JN-UG-3101 v1.5 NXP Laboratories UK

392 Chapter 10 ZigBee Network Parameters Bound Addressing Table Specifies that the device should include a Binding table. Binding is optional. If Binding tables are used, they are located on any node which is a source for a binding, but the ZigBee Co-ordinator handles end device bind requests on behalf of all devices in the network. Nodes that use Binding tables should be allocated enough Binding table entries to handle their own communication needs. Parameter Name Description Default Value Range Size The size of the Binding table. Each binding table entry contains: The node address and endpoint number of the source of the binding The node address and endpoint number of the destination of the binding The cluster ID for the binding If a binding is one-to-many then a table entry is required for each destination. Table 34: Bound Addressing Table Parameters PDU Manager The Protocol Data Unit Manager (PDUM) configuration is mandatory and must always be present. Parameter Name Description Default Value Range Number of NPDUs The number of NPDUs available to the ZigBee stack. These are internal to the stack or higher Table 35: PDU Manager Parameters APDU Specifies a buffer to contain instances of a cluster. Parameter Name Description Default Value Range Instances Name Size The maximum number of instances of this APDU. Note that this value must be set to three times the value of the parameter Maximum Number of Simultaneous Data Requests with Acks - see Table 30 on page 386. The name of the APDU. This is the identifier that should be used in the application C code to refer to the APDU. The maximum size of the APDU. Table 36: APDU Parameters Valid C identifier 392 NXP Laboratories UK 2017 JN-UG-3101 v1.5

393 ZigBee PRO Stack Group Addressing Table Specifies that the device contains a Group table. Parameter Name Description Default Value Range Size The size of the Group table. Group membership for endpoints on the current device is controlled by adding and removing entries in the Group table. Table 37: Group Addressing Table Parameters RF Channels Specifies the default RF channels that the device will operate on. If not present, the default will be all channels. Parameter Name Description Default Value Range Channel x (x=11-26) Control for channel x setting to true includes the channel in energy scan. By default, only channel 15 is included. true for x=15, false for all other values true / false Table 38: RF Channels Parameters JN-UG-3101 v1.5 NXP Laboratories UK

394 Chapter 10 ZigBee Network Parameters Node Descriptor This is mandatory and defines the type and capabilities of the node. Parameter Name Description Default Value Range Descriptor Availability Parameters Complex Descriptor Available Complex descriptors are not supported. Not editable. false false User Descriptor Available Indicates whether a user descriptor is present. Not editable. false true / false Descriptor Capabilities Parameters Extended Active Endpoint List Available Indicates whether an extended active endpoint list is available. Not editable. false false Extended Simple Descriptor List Available Indicates whether an extended simple descriptor list is available. Not editable. false false MAC Capability Flags Allocate Address Indicates whether the device will allocate short (network) addresses or not. Not editable. true / false Alternate PAN Coordinator Indicates whether the device will act as an alternative PAN Co-ordinator. Not editable. true / false Device type Indicates whether the device is a Full Functionality Device (FFD) or Reduced Functionality Device (RFD). Not editable. true / false Power source Indicates whether the device is mains powered or not. Not editable. true / false Rx On When Idle Indicates whether the device has its receiver enabled while the device is idle. Not editable. true / false Security Indicates whether the device uses high or standard security. Only standard security is supported. Not editable. false true / false Miscellaneous parameters APS flags Not editable. 0 0 Frequency Band Logical Type Frequency band of radio. Only 2.4 GHz is supported by JN516x hardware. Not editable. The device type (i.e. Co-ordinator, Router or End Device). Not editable. 2.4 GHz 2.4 GHz ZC/ZR/ZED Table 39: Node Descriptor Parameters 394 NXP Laboratories UK 2017 JN-UG-3101 v1.5

395 ZigBee PRO Stack Manufacturer Code The manufacturer ID code. These are allocated by the ZigBee Alliance Maximum buffer size The maximum buffer size. Not editable. 127 Maximum incoming transfer size Maximum outgoing transfer size The maximum incoming transfer size supported by the device. This is calculated from the APDU sizes for input clusters. Not editable. The maximum incoming transfer size supported by the device. This is calculated from the APDU sizes for output clusters. Not editable System Server Capabilities parameters Backup binding table cache Indicates if the node can act as a backup binding table cache. Not supported and not editable. false true / false Backup discovery cache Indicates if the node can act as a backup discovery cache. Not supported and not editable. false true / false Backup trust center Indicates if the node can act as a backup trust centre. Not supported and not editable. false true / false Network manager Indicates if the node can act as a network manager. Not editable. false true / false Primary binding table cache Indicates if the node can act as a primary binding table cache. Not supported and not editable. false true / false Primary discovery cache Indicates if the node can act as a primary discovery cache. Not supported and not editable. false true / false Primary trust center Indicates if the node can act as a trust center. Not editable. false Table 39: Node Descriptor Parameters true / false JN-UG-3101 v1.5 NXP Laboratories UK

396 Chapter 10 ZigBee Network Parameters Node Power Descriptor The Node Power descriptor for the device is mandatory. Parameter Name Description Default Value Range Available Power Sources parameters Constant power Indicates whether a constant power source is available. false true / false Disposable Battery Indicates whether a disposable battery power source is available. false true / false Rechargable Battery Indicates whether a rechargable battery power source is available. false true / false Miscellaneous parameters Default power mode The default power mode of the device. Synchronised with RxOn- WhenIdle Default power source The default power source of the device. Constant / rechargeable / disposable Synchronised with RxOnWhenIdle / Periodic / Constant Power Constant Table 40: Node Power Descriptor Parameters Key Descriptor Table Specifies that the device should contain a Key Descriptor Table (for APS security). Parameter Name Description Default Value Range Size The size of the key descriptor table. 1 or higher Table 41: Key Descriptor Table Parameters Preconfigured Key Specifies a pre-configured link key for the Key Descriptor Table. Parameter Name Description Default Value Range IEEE address The IEEE address to use with the key. 64 bit Key The pre-configured key value. 128 bit Table 42: Preconfigured Key Parameters 396 NXP Laboratories UK 2017 JN-UG-3101 v1.5

397 ZigBee PRO Stack Trust Centre Specifies that the device will have the capability to act as a Trust Centre. Parameter Name Description Default Value Range Device Table Size The size of the Trust Centre's device table. Maximum Number of Nodes setting from the ZigBee PRO Wireless Network 1 or higher One (and only one) of the following keys can be defined for use in network-level security set-up: Default Network Key, Preconfigured Network Key, Preconfigured Trust Center Link Key. The properties of these objects are detailed below. Default Network Key Table 43: Trust Centre Parameters Parameter Name Description Default Value Range Random Indicates whether the default network key will be randomly generated (true) or pre-set (false) by the Trust Centre. true true / false Key Pre-set default network key (only required if Random set to false). Key Seq Num Unique sequence number of pre-set default network key (only required if Random set to false). Preconfigured Network Key Table 44: Default Network Key Parameters Parameter Name Description Default Value Range Key Key Seq Num Pre-configured network key (which is pre-programmed into all nodes). Unique sequence number of pre-configured network key. Table 45: Preconfigured Network Key Parameters Preconfigured Trust Center Link Key No parameters, but the link key must be pre-set in the Key Descriptor Table (see Section ) on each node. JN-UG-3101 v1.5 NXP Laboratories UK

398 Chapter 10 ZigBee Network Parameters ZDO Configuration Specifies which ZigBee Device Object (ZDO) servers are present on the device. Most of these are mandatory for a ZCP. The ZDO configuration parameters are detailed in the following categories: Category Page Default Server 399 ZDO Client 399 Device Annce Server 399 Active Ep Server 399 Nwk Addr Server 399 IEEE Address Server 400 System Server Discovery Server 400 Permit Joining Server 400 Node Descriptor Server 400 Power Descriptor Server 400 Match Descriptor Server 401 Simple Descriptor Server 401 Mgmt Lqi Server 401 Mgmt Rtg Server 401 Mgmt Leave Server 401 Mgmt NWK Update Server 402 Bind Unbind Server 402 Extended Active Ep Server 402 Extended Simple Descriptor Server 402 End Device Bind Server NXP Laboratories UK 2017 JN-UG-3101 v1.5

399 ZigBee PRO Stack Default Server Mandatory. Replies to any unimplemented server requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to unimplemented server request messages. apduzdp Table 46: Default Server Parameters ZDO Client Mandatory. Processes ZDO client messages. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to ZDO client messages. apduzdp Table 47: ZDO Client Parameters Device Annce Server Mandatory. Processes device announcements. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to device announcement messages. apduzdp Table 48: Default Server Parameters Active Ep Server Mandatory. Processes active endpoint requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to active endpoint request messages. apduzdp Table 49: Active Ep Server Parameters Nwk Addr Server Mandatory. Processes network address discovery requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to network address discovery request messages. apduzdp Table 50: Nwk Addr Server Parameters JN-UG-3101 v1.5 NXP Laboratories UK

400 Chapter 10 ZigBee Network Parameters IEEE Address Server Mandatory. Processes IEEE address discovery requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to IEEE address discovery request messages. apduzdp Table 51: IEEE Address Server Parameters System Server Discovery Server Mandatory. Processes system server discovery requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to system server discovery request messages. apduzdp Table 52: System Server Discovery Server Parameters Permit Joining Server Mandatory. Processes 'permit joining' requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to permit joining request messages. apduzdp Table 53: Permit Joining Server Parameters Node Descriptor Server Mandatory. Processes Node descriptor requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to node descriptor request messages. apduzdp Table 54: Node Descriptor Server Parameters Power Descriptor Server Mandatory. Processes Node Power descriptor requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to power descriptor request messages. apduzdp Table 55: Power Descriptor Server Parameters 400 NXP Laboratories UK 2017 JN-UG-3101 v1.5

401 ZigBee PRO Stack Match Descriptor Server Mandatory. Processes Match descriptor requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to Match descriptor request messages. apduzdp Table 56: Match Descriptor Server Parameters Simple Descriptor Server Mandatory. Processes simple descriptor requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to Simple descriptor request messages. apduzdp Table 57: Simple Descriptor Server Parameters Mgmt Lqi Server Mandatory. Processes management LQI requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to Link Quality Indicator (LQI) request messages. apduzdp Table 58: Mgmt Lqi Server Parameters Mgmt Rtg Server Mandatory. Processes management routing requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to management routing request messages. apduzdp Table 59: Mgmt Rtg Server Parameters Mgmt Leave Server Mandatory. Processes management leave requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to management leave request messages. apduzdp Table 60: Mgmt Leave Server Parameters JN-UG-3101 v1.5 NXP Laboratories UK

402 Chapter 10 ZigBee Network Parameters Mgmt NWK Update Server Mandatory. Processes management network update requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to management network update request messages. apduzdp Table 61: Mgmt NWK Update Server Parameters Bind Unbind Server Mandatory. Processes both bind and unbind requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to bind and unbind request messages. apduzdp Table 62: Bind Unbind Server Parameters Extended Active Ep Server Mandatory. Processes extended active endpoint discovery requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to extended active endpoint discovery request messages. apduzdp Table 63: Active Ep Server Parameters Extended Simple Descriptor Server Mandatory. Processes extended Simple descriptor discovery requests. Parameter Name Description Default Value Range Output APDU The APDU to use when replying to extended Simple descriptor discovery request messages. apduzdp Table 64: Extended Simple Descriptor Server Parameters 402 NXP Laboratories UK 2017 JN-UG-3101 v1.5

403 End Device Bind Server Mandatory (Co-ordinator only). Processes End Device bind requests. Parameter Name Description Default Value Range ZigBee PRO Stack Output APDU Timeout Bind Num Retries The APDU to use when replying to end device bind request messages. Number of seconds before timing out an End Device bind request. Number of binding retries attempted if a binding request (zdo_bind_req or end_device_bind_req) fails. apduzdp 5 1 or higher Table 65: End Device Bind Server Parameters JN-UG-3101 v1.5 NXP Laboratories UK

404 Chapter 10 ZigBee Network Parameters 404 NXP Laboratories UK 2017 JN-UG-3101 v1.5

405 ZigBee PRO Stack Part III: Configuration Information JN-UG-3101 v1.5 NXP Laboratories Ltd

406 406 NXP Laboratories Ltd 2017 JN-UG-3101 v1.5

407 ZigBee PRO Stack 11. Network and OS Configuration In developing a ZigBee PRO application, certain static configuration is required for ZigBee PRO and JenOS (in particular, the RTOS and PDU Manager) before the application is built. This chapter introduces the configuration editors that are used to simplify this static configuration. These editors are supplied as NXP plug-ins for the BeyondStudio for NXP platform and are provided in the JN516x ZigBee SDKs. For more details of the SDKs, refer to Section 4.1. The following editors provide easy-to-use interfaces which streamline network and OS configuration for a ZigBee PRO wireless application: ZPS Configuration Editor: This editor provides a convenient way to set ZigBee network parameters, such as the properties of the Co-ordinator, Routers and End Devices (for example, by setting elements of the device descriptors). For more information, refer to Section JenOS Configuration Editor: This editor provides a graphical interface for configuring the way an application uses JenOS resources, such as timers, mutexes and ISRs. For more information, refer to the JenOS (JN-UG-3075). The principles of this configuration are described in Section Configuration Principles The build process for a ZigBee PRO application takes a number of configuration files, in addition to the application source file and header file. The following files are generated from BeyondStudio to feed into the build process: ZigBee PRO Stack files: zps_gen.c zps_gen.h PDU Manager files: pdum_gen.c pdum_gen.h RTOS files: os_gen.c os_gen.h os_irq.s All of the above files are produced according to the same basic principles. The NXP plug-ins in BeyondStudio are used to edit the configuration data and output this data as XML files (the XML files can be coded manually, outside of BeyondStudio, but this is not recommended). As part of the build process, the application's makefile invokes command line utilities that use the XML files to generate the files listed above. JN-UG-3101 v1.5 NXP Laboratories UK

408 Chapter 11 Network and OS Configuration The full build process is illustrated in Figure 13. BeyondStudio user_app.c user_app.h ZPS Configuration Editor XML zps_gen.c zps_gen.h JenOS Configuration Editor XML XML File generation by command line utilities pdum_gen.c pdum_gen.h os_gen.c os_gen.h os_irq.s Compiler Application (unlinked) ZigBee Libraries Linker user_app.bin Figure 13: Application Build Process 408 NXP Laboratories UK 2017 JN-UG-3101 v1.5

409 ZigBee PRO Stack 11.2 Configuring ZigBee Network Parameters The ZPS Configuration Editor allows ZigBee network parameters to be configured through an easy-to-use Windows Explorer-style interface. This interface is outlined below, but is more fully described in Chapter 12. The parameter values for the whole network are stored in a file with extension.zpscfg, and the ZPS Configuration Editor provides a convenient way to view and edit the contents of this file. The network parameters are presented in an expandible tree, as shown below. Figure 14: Network Parameters Entries that sit at the same level in the tree are termed siblings, while an entry that sits under another entry in the tree (a sub-entry) is termed a child. The top level of the tree shows the Extended PAN ID. The next level shows the following siblings: Entries for the ZigBee application profiles used in the network Entry for the Co-ordinator Entries for the Routers Entries for the End Devices The information under each of these entries is described below. Profile An application profile has a numeric ID and a name. The Profile entry contains child entries for the clusters supported by the profile - each cluster is identified by a numeric ID and a name. Note: There must be entries for all application profiles supported by the network. An individual device may not use all profiles, although a device can use more than one profile to support multiple features (for example, measurement of temperature, humidity and light level). JN-UG-3101 v1.5 NXP Laboratories UK

410 Chapter 11 Network and OS Configuration Co-ordinator The Co-ordinator entry contains a name and a number of associated parameters, mainly related to the APS and NWK layers of the ZigBee PRO stack. The child entries for the Co-ordinator are shown above and include the following: Endpoint entries, one for each endpoint on the Co-ordinator, with each endpoint having child entries specifying the input and output clusters used (note that each input cluster must be paired with an APDU) PDU Manager, with child entries specifying the APDUs used Channel Mask, specifying the 2.4-GHz band channels to scan when creating the network Node Descriptor for the Co-ordinator Node Power Descriptor for the Co-ordinator Router Each Router entry contains a name and a number of associated parameters, mainly related to the APS and NWK layers of the ZigBee PRO stack. The child entries for a Router include the following: Endpoint entries, one for each endpoint on the Router, with each endpoint having child entries specifying input and output clusters used (note that each input cluster must be paired with an APDU) PDU Manager, with child entries specifying the APDUs used Channel Mask, specifying the 2.4-GHz band channels to scan when attempting to join a network Node Descriptor for the Router Node Power Descriptor for the Router 410 NXP Laboratories UK 2017 JN-UG-3101 v1.5

411 ZigBee PRO Stack End Device Each End Device entry contains a name and a number of associated parameters, mainly related to the APS and NWK layers of the ZigBee PRO stack. The child entries for an End Device include the following: Endpoint entries, one for each endpoint on the End Device, with each endpoint having child entries specifying the input and output clusters used (note that each input cluster must be paired with an APDU) PDU Manager, with child entries specifying the APDUs used Channel Mask, specifying the 2.4-GHz band channels to scan when attempting to join a network Node Descriptor for the End Device Node Power Descriptor for the End Device JN-UG-3101 v1.5 NXP Laboratories UK

412 Chapter 11 Network and OS Configuration 412 NXP Laboratories UK 2017 JN-UG-3101 v1.5

413 ZigBee PRO Stack 12. ZPS Configuration Editor The ZigBee PRO Stack (ZPS) Configuration Editor is a graphical editor which runs as a plug-in within the Eclipse-based BeyondStudio for NXP IDE. It is used to create a network configuration for a ZigBee PRO project, allowing ZigBee network parameters to be set (see Chapter 10). The ZPS Configuration Editor is introduced in Section This chapter provides operational instructions for this editor Getting Started Before you can start to create a new ZigBee PRO stack configuration, the ZPS Configuration Editor plug-in must be installed in the BeyondStudio/Eclipse IDE. To check if the plug-in is already installed, start Eclipse and select File > New > Other from the main menu. Check that a Jennic option exists in the Select a Wizard dialogue box - expanding the Jennic option should show "ZBPro Configuration", as illustrated in the screenshot below. If this is not present, install the ZPS Configuration Editor plug-in, which is supplied in the JN516x ZigBee SDKs. Figure 15: Select a Wizard Using the wizard shown in the screenshot above, you can start to create a new ZigBee PRO configuration. JN-UG-3101 v1.5 NXP Laboratories UK

414 Chapter 12 ZPS Configuration Editor 12.2 Using the ZPS Configuration Editor Note: This section assumes that you wish to add a ZigBee PRO stack configuration to a project which you have already created in Eclipse (in this example, HelloWorld) Creating a New ZPS Configuration Step 1 In the Eclipse Select a wizard box shown in Figure 15 in Section 12.1, click Next. The New dialogue box opens for the ZBPro Configuration. Figure 16: New ZPS Configuration Step 2 Click on your project to select it as the parent folder. In the File name field, enter a name for the configuration file (keep the extension.zpscfg) and then click Finish. A new configuration (with the default set of parameters) will open in the editor, as shown below. 414 NXP Laboratories UK 2017 JN-UG-3101 v1.5

415 ZigBee PRO Stack Figure 17: ZPS Configuration Editor Window Adding Device Types To add devices Step 1 Right-click on ZigBee PRO Wireless Network and select New Child > Coordinator from the drop-down menu. This inserts a Co-ordinator with the minimum necessary child elements. Step 2 Add Routers and End Devices in the same way, as required. The network can only have one Co-ordinator, but as many different Router or End Device types (i.e. running different application features and with different endpoints) as required. Step 3 For each new device, use the Properties tab (bottom pane) to enter the required toplevel parameters. For a sleeping End Device, set Sleeping to True (by right-clicking on the value and using the drop-down box). Note: To display the advanced properties, click the Advanced tool button to the right of the Properties view tab - see Section These properties are all set to default values and can be left unchanged, unless specific changes are required. JN-UG-3101 v1.5 NXP Laboratories UK

416 Chapter 12 ZPS Configuration Editor To add a profile Step 1 Right-click on ZigBee PRO Wireless Network and select New Child > Profile from the drop-down menu. This inserts a profile with no child elements. Step 2 Edit the properties in the Properties tab to set Name and Id for the new profile. To add clusters to the new profile Step 1 Right-click on the new profile created above and select New Child > Cluster from the drop-down menu. Step 2 Edit the properties in the Properties tab to set Name and Id for the new cluster. Step 3 Repeat Step 1 and Step 2 to add more clusters, as required. Figure 18: Cluster Properties 416 NXP Laboratories UK 2017 JN-UG-3101 v1.5

417 ZigBee PRO Stack Setting Co-ordinator Properties To set the channel mask and Node Power descriptor Step 1 Expand the Co-ordinator node in the editor. This will reveal the default set of features for the Co-ordinator, ZDO endpoint and ZDO servers. Step 2 Click on the RF Channels element to modify the channel mask. There are 16 channels available, numbered 11 to 26, which are now shown in the Properties tab. A single channel or a set of channels can be selected for the channel mask, as required. Step 3 In the Properties tab, set the desired channel(s) to true (by right-clicking on the value and using the drop-down box). Figure 19: Channel Mask Selection Step 4 Step 5 Click to select the Node Power Descriptor. Edit the properties in the Properties tab, as required. JN-UG-3101 v1.5 NXP Laboratories UK

418 Chapter 12 ZPS Configuration Editor To add a new endpoint Step 1 Right-click on the Co-ordinator node and select New Child > End Point from the drop-down menu. Step 2 Edit the properties in the Properties tab to set Name and Profile for the endpoint (the profile is selected from the drop-down box). Step 3 Edit the properties to set RTOS Message with the name of the message queue to which the stack will deliver events for the endpoint, or leave it blank if the default queue is to be used (the default queue is named in the AF section of the Advanced properties of each node). Step 4 Repeat Step 1 to Step 3 for as many endpoints as are required. Figure 20: Endpoint Properties 418 NXP Laboratories UK 2017 JN-UG-3101 v1.5

419 ZigBee PRO Stack To add an APDU At least one APDU is required before an endpoint can send or receive data. The same APDU can be used to send and receive data, or different APDUs can be set up for send and receive - this allows control of buffering and memory resources, and is the decision of the application designer. Step 1 Right-click on PDU Manager and select New Child > APDU from the drop-down menu. Step 2 Edit the properties in the Properties tab to set Name, Instances (number of) and Size (of each instance - this should be set to the size of the largest APDU to be received). Figure 21: APDU Properties JN-UG-3101 v1.5 NXP Laboratories UK

420 Chapter 12 ZPS Configuration Editor To add input and output clusters to an endpoint Step 1 Right-click on the endpoint and select New Child > Input Cluster or New Child > Output Cluster, as required, from the drop-down menu. Step 2 Edit the properties in the Properties tab to set Cluster - select from the available clusters in the drop-down list. Step 3 Edit the Rx APDU or Tx APDU property to assign an APDU to the cluster - select from the available APDUs in the drop-down list. To receive data, a cluster must have an assigned APDU. The same cluster can be both an input and output cluster, i.e. it will both send and receive data. When an endpoint with an output cluster sends data, the receiving endpoint must have an input cluster in order to receive the data, otherwise the stack will reject it and will not notify the receiving endpoint. However, the Default cluster can be added to the endpoint in order to deal with received data that is destined for input clusters not supported by the endpoint (see the Note below this procedure). Step 4 Repeat Step 1 to Step 3 to add as many clusters as are required for the endpoint. Figure 22: Input and Output Clusters Step 5 Repeat Step 1 to Step 4 for Routers and End Devices, as required. 420 NXP Laboratories UK 2017 JN-UG-3101 v1.5

ZigBee Green Power (for ZigBee 3.0) User Guide

ZigBee Green Power (for ZigBee 3.0) User Guide ZigBee Green Power (for ZigBee 3.0) JN-UG-3119 Revision 1.1 6 July 2016 ZigBee Green Power (for ZigBee 3.0) 2 NXP Laboratories UK 2016 JN-UG-3119 v1.1 ZigBee Green Power (for ZigBee 3.0) Contents Preface

More information

JN517x-DK005 Development Kit User Guide

JN517x-DK005 Development Kit User Guide JN517x-DK005 Development Kit JN-UG-3121 Revision 1.1 8 February 2017 JN517x-DK005 Development Kit 2 NXP Semiconductors 2017 JN-UG-3121 v1.1 JN517x-DK005 Development Kit Contents Preface 5 Organisation

More information

JN516x-EK004 Evaluation Kit User Guide

JN516x-EK004 Evaluation Kit User Guide JN516x-EK004 Evaluation Kit JN-UG-3108 Revision 2.0 20 June 2016 JN516x-EK004 Evaluation Kit 2 NXP Semiconductors 2016 JN-UG-3108 v2.0 JN516x-EK004 Evaluation Kit Contents Preface 5 Organisation 5 Conventions

More information

Getting Started with ZigBee and IEEE

Getting Started with ZigBee and IEEE Getting Started with ZigBee and IEEE 802.15.4 DT200 (Rev.10.2.17) ZigBee is a registered trademark of the ZigBee Alliance. 802.15.4 is a trademark of the Institute of Electrical and Electronics Engineers

More information

ZIGBEE. Erkan Ünal CSE 401 SPECIAL TOPICS IN COMPUTER NETWORKS

ZIGBEE. Erkan Ünal CSE 401 SPECIAL TOPICS IN COMPUTER NETWORKS ZIGBEE Erkan Ünal CSE 401 SPECIAL TOPICS IN COMPUTER NETWORKS OUTLINE ZIGBEE AND APPLICATIONS IEEE 802.15.4 PROTOCOL ZIGBEE PROTOCOL ZIGBEE ALLIANCE ZIGBEE APPLICATIONS PHYSICAL LAYER MAC LAYER ZIGBEE

More information

JN5148-EK010 ZigBee PRO Evaluation Kit User Guide

JN5148-EK010 ZigBee PRO Evaluation Kit User Guide JN5148-EK010 ZigBee PRO Evaluation Kit JN-UG-3062 Revision 1.0 3 July 2009 JN5148-EK010 ZigBee PRO Evaluation Kit 2 2009 JN-UG-3062 v1.0 JN5148-EK010 ZigBee PRO Evaluation Kit Contents About this Manual

More information

WPAN/WBANs: ZigBee. Dmitri A. Moltchanov kurssit/elt-53306/

WPAN/WBANs: ZigBee. Dmitri A. Moltchanov    kurssit/elt-53306/ WPAN/WBANs: ZigBee Dmitri A. Moltchanov E-mail: dmitri.moltchanov@tut.fi http://www.cs.tut.fi/ kurssit/elt-53306/ IEEE 802.15 WG breakdown; ZigBee Comparison with other technologies; PHY and MAC; Network

More information

Application Note: JN-AN-1123 ZigBee PRO Application Template

Application Note: JN-AN-1123 ZigBee PRO Application Template Application Note: JN-AN-1123 This Application Note provides a set of ZigBee PRO application code templates based on the Jennic ZigBee PRO and JenOS APIs. These templates which are sufficient to produce

More information

Davide Quaglia Assistant CS depart University of Verona, Italy

Davide Quaglia Assistant CS depart University of Verona, Italy Emad Ebeid Ph.D. student @ CS depart University of Verona, Italy EmadSamuelMalki.Ebeid@univr.it Davide Quaglia Assistant Professor @ CS depart University of Verona, Italy Davide.Quaglia@univr.it 2 1 ZigBee

More information

AT THE END OF THIS SECTION, YOU SHOULD HAVE AN UNDERSTANDING OF THE

AT THE END OF THIS SECTION, YOU SHOULD HAVE AN UNDERSTANDING OF THE Wireless Technology AT THE END OF THIS SECTION, YOU SHOULD HAVE AN UNDERSTANDING OF THE UNDERLYING WIRELESS TECHNOLOGIES. References 2 The physical layer provides mechanical, electrical, l functional,

More information

Modulation. Propagation. Typical frequency bands

Modulation. Propagation. Typical frequency bands References Wireless Technology 2 AT THE END OF THIS SECTION, YOU SHOULD HAVE AN UNDERSTANDING OF THE UNDERLYING WIRELESS TECHNOLOGIES. The physical layer provides mechanical, electrical, l functional,

More information

RELEASE NOTES. JN517x ZigBee 3.0 SDK JN-SW Build NXP Semiconductors

RELEASE NOTES. JN517x ZigBee 3.0 SDK JN-SW Build NXP Semiconductors RELEASE NOTES JN517x ZigBee 3.0 SDK JN-SW-4270 Build 1746 NXP Semiconductors For the contact details of your local NXP office or distributor, refer to: www.nxp.com CONTENTS RELEASE SUMMARY (v1746) 3 1.

More information

Introduction to the ZigBee Application Framework

Introduction to the ZigBee Application Framework Wireless Control That Simply Works Introduction to the ZigBee Application Framework Phil Jamieson, ZigBee AFG Chair BuilConn - ZigBee Workshop, Amsterdam, November 8 th, 2005 Copyright 2005 ZigBee TM Alliance.

More information

Wireless communication standards: What makes them unattractive for WSN:

Wireless communication standards: What makes them unattractive for WSN: Wireless communication standards: IEEE 802.11 a/b/g Bluetooth GSM What makes them unattractive for WSN: Power hungry (need big batteries) Complexity (need lots of clock cycles and memory) New protocol

More information

Mesh networking with ZigBee. A dive into the ZigBee ecosystem

Mesh networking with ZigBee. A dive into the ZigBee ecosystem Mesh networking with ZigBee A dive into the ZigBee ecosystem Agenda THEORETICAL PART What is ZigBee ZigBee Networking ZigBee Application Support ZigBee Security PRACTICAL PART XBee intro Exercise A Exercise

More information

WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH

WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH WIRELESS MESH NETWORKING: ZIGBEE VS. DIGIMESH Mesh networking is a powerful way to route data. This methodology

More information

Zigbee protocol stack overview

Zigbee protocol stack overview Zigbee protocol stack overview 2018 ASSUMPTIONS FOR USING THIS TEACHING MATERIAL DSR and OTSL takes no responsibility about the problem which occurs as a result of applying the technical information written

More information

ENSC 427: COMMUNICATION NETWORKS

ENSC 427: COMMUNICATION NETWORKS ENSC 427: COMMUNICATION NETWORKS Simulation of ZigBee Wireless Sensor Networks Final Report Spring 2012 Mehran Ferdowsi Mfa6@sfu.ca Table of Contents 1. Introduction...2 2. Project Scope...2 3. ZigBee

More information

By Nick Giannaris. ZigBee

By Nick Giannaris. ZigBee By Nick Giannaris ZigBee Personal Area Network (PAN) A computer network used for communication among devices in a close proximity. Wireless Personal Area Network (WPAN) A wireless personal area network

More information

Application Note: JN-AN-1122

Application Note: JN-AN-1122 Application Note: JN-AN-1122 This Application Note describes the implementation of the ZigBee PRO Home Sensor Demonstration, providing an overview of the application s architecture and a description of

More information

Message acknowledgement and an optional beacon. Channel Access is via Carrier Sense Multiple Access with

Message acknowledgement and an optional beacon. Channel Access is via Carrier Sense Multiple Access with ZigBee IEEE 802.15.4 Emerging standard for low-power wireless monitoring and control Scale to many devices Long lifetime is important (contrast to Bluetooth) 10-75m range typical Designed for industrial

More information

By Ambuj Varshney & Akshat Logar

By Ambuj Varshney & Akshat Logar By Ambuj Varshney & Akshat Logar Wireless operations permits services, such as long range communications, that are impossible or impractical to implement with the use of wires. The term is commonly used

More information

Topics. Introduction Architecture Node Types Network Topologies Traffic Modes Frame Format Applications Conclusion

Topics. Introduction Architecture Node Types Network Topologies Traffic Modes Frame Format Applications Conclusion ZigBee Topics Introduction Architecture Node Types Network Topologies Traffic Modes Frame Format Applications Conclusion Introduction The Wireless technologies (WiFi,GSM,and Bluetooth) All have one thing

More information

Guide to Wireless Communications, 3 rd Edition. Objectives

Guide to Wireless Communications, 3 rd Edition. Objectives Guide to Wireless Communications, 3 rd Edition Chapter 5 Wireless Personal Area Networks Objectives Describe a wireless personal area network (WPAN) List the different WPAN standards and their applications

More information

Wireless Sensor Networks

Wireless Sensor Networks Wireless Sensor Networks c.buratti@unibo.it +39 051 20 93147 Office Hours: Tuesday 3 5 pm @ Main Building, second floor Credits: 6 Protocol Stack Time Synchronization Energy Efficiency Application Layer

More information

ZIGBEE AND PROTOCOL IEEE : THEORETICAL STUDY

ZIGBEE AND PROTOCOL IEEE : THEORETICAL STUDY ZIGBEE AND PROTOCOL IEEE 802.15.4: THEORETICAL STUDY 1 NAYAN DUBAY, 2 VISHANK PATEL 1 Learner and Researcher, Indore ²Fourth Semester M.Tech, Oriental university, Indore Email: 1 nayandubey18@gmail.com,

More information

CHAPTER 3 BLUETOOTH AND IEEE

CHAPTER 3 BLUETOOTH AND IEEE CHAPTER 3 BLUETOOTH AND IEEE 802.15 These slides are made available to faculty in PowerPoint form. Slides can be freely added, modified, and deleted to suit student needs. They represent substantial work

More information

Radiocrafts Embedded Wireless Solutions

Radiocrafts Embedded Wireless Solutions Selecting an IEEE 802.15.4, 2.4 GHz wireless solution By Ø.Nottveit Abstract Companies searching for a low power 2.45 GHz wireless solution will find many different technical solutions. This white paper

More information

International Journal of Electronics and Communication Engineering & Technology (IJECET), INTERNATIONAL JOURNAL OF ELECTRONICS AND

International Journal of Electronics and Communication Engineering & Technology (IJECET), INTERNATIONAL JOURNAL OF ELECTRONICS AND International Journal of Electronics and Communication Engineering & Technology (IJECET), INTERNATIONAL JOURNAL OF ELECTRONICS AND ISSN 0976 6464(Print), ISSN 0976 6472(Online) Volume 3, Issue 2, July-September

More information

The ZigBee Architecture An Introduction

The ZigBee Architecture An Introduction The ZigBee Architecture An Introduction May 18 th, 2011 Session I Introduction & Architecture I, 1 Contents Outline 1. Architectural Overview 2. Market Positioning 3. Convergence 4. Summary 2 ch.1: IEEE802.15.4

More information

KW41Z IEEE and BLE Coexistence Performance

KW41Z IEEE and BLE Coexistence Performance NXP Semiconductors Document Number: AN12231 Application Note Rev. 0, 08/2018 KW41Z IEEE 802.15.4 and BLE Coexistence Performance MWS module 1. About this manual This document aims to evaluate the performance

More information

A Comprehensive Study of ZigBee. Presented by Dr. K F Tsang Citycom Technology Ltd. Tel:

A Comprehensive Study of ZigBee. Presented by Dr. K F Tsang Citycom Technology Ltd. Tel: A Comprehensive Study of ZigBee Presented by Dr. K F Tsang Citycom Technology Ltd. Tel: 2788-7806 Email: ee330015@cityu.edu.hk 1 1 Outline Introduction of ZigBee Market analysis Characteristics of ZigBee

More information

DASH7 ALLIANCE PROTOCOL - WHERE RFID MEETS WSN. public

DASH7 ALLIANCE PROTOCOL - WHERE RFID MEETS WSN. public DASH7 ALLIANCE PROTOCOL - WHERE RFID MEETS WSN public DASH7 ALLIANCE PROTOCOL OPEN STANDARD OF ULTRA LOW POWER MID-RANGE SENSOR AND ACTUATOR COMMUNICATION Wireless Sensor and Actuator Network Protocol

More information

Designing a ZigBee Network

Designing a ZigBee Network Wireless Control That Simply Works Designing a ZigBee Network ESS 2006, Birmingham David Egan Ember Corporation Copyright 2004 ZigBee TM Alliance. All Rights Reserved. Contents: Typical Network Design

More information

UG103.2: Zigbee Fundamentals

UG103.2: Zigbee Fundamentals This document describes the key features and characteristics of a Zigbee solution. It also includes a section on Zigbee 3.0. Silicon Labs Application Development Fundamentals series covers topics that

More information

RESOURCES. By: Chris Downey, Laird Technologies Product Manager, Telematics & Wireless M2M Date: May 25, 2011

RESOURCES. By: Chris Downey, Laird Technologies Product Manager, Telematics & Wireless M2M Date: May 25, 2011 Moving Beyond Zigbee for Star Networks RESOURCES By: Chris Downey, Laird Technologies Product Manager, Telematics & Wireless M2M Date: May 25, 2011 Multi-hop mesh protocols, such as Zigbee, are getting

More information

A smart Home Security system based on ARM9

A smart Home Security system based on ARM9 A smart Home Security system based on ARM9 B. Srinivasa sarma, Dr. P. Sudhakar Reddy, IEEE member Department of Electronics and communications engineering, Sri Kalahastheeswara Institute of Technology,

More information

Telegesis ZigBee technology

Telegesis ZigBee technology Telegesis ZigBee technology What is ZigBee and what does it do? February 2013 Ollie Smith Business Development Director ollie.smith@telegesis.com Steve Diaper Sales Manager steve.diaper@telegesis.com Telegesis

More information

ZigBee Wireless Transceiver Engineering Options

ZigBee Wireless Transceiver Engineering Options White Paper ZigBee Wireless Transceiver Engineering Options Murata Electronics, North America Realizing this new standard s automation benefits and there are many requires navigating your engineering options

More information

Communications Options for Wireless Sensor Networks. Marco Zennaro and Antoine Bagula ICTP and UWC Italy and South Africa

Communications Options for Wireless Sensor Networks. Marco Zennaro and Antoine Bagula ICTP and UWC Italy and South Africa Communications Options for Wireless Sensor Networks Marco Zennaro and Antoine Bagula ICTP and UWC Italy and South Africa WSN communications options When considering communications options, parameters to

More information

WIRELESS TECHNOLOGIES

WIRELESS TECHNOLOGIES WIRELESS TECHNOLOGIES Bluetooth, ZigBee and ANT Thomas Aasebø OVERVIEW What are wireless sensor networks? What are personal area networks? What are these networks typically used for? Bluetooth, ZigBee

More information

ZigBee/ David Sanchez Sanchez.

ZigBee/ David Sanchez Sanchez. ZigBee/802.15.4 David Sanchez Sanchez david.sanchezs@upf.edu Lecture Overview 1. Introduction and motivation to ZigBee 2. ZigBee/802.15.4 specification 1. Definitions 2. MAC communication modes 3. Network

More information

Lecture 6 ZigBee Device Object (ZDO) and Network Layer (NWK)

Lecture 6 ZigBee Device Object (ZDO) and Network Layer (NWK) Lecture 6 ZigBee Device Object (ZDO) and Network Layer (NWK) Jingcheng Zhang Linköping University 2013-01-28 1 Content ZDO general introduction ZDO function description Device discovery Service discovery

More information

ZigBee Security Specification Overview

ZigBee Security Specification Overview Wireless Control That Simply Works ZigBee Security Specification Overview Copyright 2005 ZigBee TM Alliance. All Rights Reserved. Agenda ZigBee Security Overview Residential Applications Guidelines Typical

More information

Embedded Smart Home System Based on ZigBee Song Chi

Embedded Smart Home System Based on ZigBee Song Chi International Conference on Intelligent Systems Research and Mechatronics Engineering (ISRME 2015) Embedded Smart Home System Based on ZigBee Song Chi Liaoning Jidian Polytechnic North Gold and Jewelry

More information

Wireless Personal Area Networks (WPANs) Wireless PAN

Wireless Personal Area Networks (WPANs) Wireless PAN Wireless Personal Area Networks (WPANs) IEEE P802.15 Working Group Wireless PAN Applications Home Networking Automotive Networks Industrial Networks Interactive Toys Remote Metering Overview Data rates

More information

Freescale BeeStack. Software Reference Manual for ZigBee 2007

Freescale BeeStack. Software Reference Manual for ZigBee 2007 Freescale BeeStack Software Reference Manual for ZigBee 2007 Document Number: BSSRMZB2007 Rev. 1.0 10/2008 How to Reach Us: Home Page: www.freescale.com E-mail: support@freescale.com USA/Europe or Locations

More information

ISSN (PRINT): , (ONLINE): , VOLUME-6, ISSUE-1,

ISSN (PRINT): , (ONLINE): , VOLUME-6, ISSUE-1, DESIGN OF MULTIMODE GATEWAY FOR DATA ACQUISITION TO HIGH END DATA MONITORING USING IEEE802.15.4 Madhhav G.Raut 1 & Pradip B.Dahikar 2 Hislop College,Civil Lines, Nagpur & Kamala Nehru Mahavidyalaya,Nagpur,India

More information

What do we expect from Wireless in the Factory?

What do we expect from Wireless in the Factory? What do we expect from Wireless in the Factory? And what are we doing about it? ETSI Wireless Factory Workshop, 15 December 2008 Tim Whittaker System Architect, Wireless Division 11 December 2008 S4989-P-188

More information

ZigBee. Jan Dohl Fabian Diehm Patrick Grosa. Dresden,

ZigBee. Jan Dohl Fabian Diehm Patrick Grosa. Dresden, Faculty of Computer Science Chair of Computer Networks, Wireless Sensor Networks, Dr. W. Dargie ZigBee Jan Dohl Fabian Diehm Patrick Grosa Dresden, 14.11.2006 Structure Introduction Concepts Architecture

More information

Content 1/28/2013. Lecture 6. Network Layer (NWK) Z-Stack ZDO Interface

Content 1/28/2013. Lecture 6. Network Layer (NWK) Z-Stack ZDO Interface Content Lecture 6 ZigBee Device Object (ZDO) and Network Layer (NWK) ZDO general introduction ZDO function description Device discovery Service discovery Binding service Management service Jingcheng Zhang

More information

WP-PD Wirepas Mesh Overview

WP-PD Wirepas Mesh Overview WP-PD-123 - Wirepas Mesh Overview Product Description Version: v1.0a Wirepas Mesh is a de-centralized radio communications protocol for devices. The Wirepas Mesh protocol software can be used in any device,

More information

1. IEEE and ZigBee working model.

1. IEEE and ZigBee working model. ZigBee SoCs provide cost-effective solutions Integrating a radio transceiver, data processing unit, memory and user-application features on one chip combines high performance with low cost Khanh Tuan Le,

More information

WZRDnet. A Low-Power Wireless Ad-Hoc Mesh Network for Austere Tactical Environments. February 14, 2018

WZRDnet. A Low-Power Wireless Ad-Hoc Mesh Network for Austere Tactical Environments. February 14, 2018 White Paper TELEGRID Technologies, Inc. WZRDnet A Low-Power Wireless Ad-Hoc Mesh Network for Austere Tactical Environments February 14, 2018 23 Vreeland Road Suite 290 Florham Park, NJ 07932 www.telegrid.com

More information

ENSC 427 SPRING Communication Networks 4/12/2012. Long Fei Zhao Jordan Angelov StoyanPetrov

ENSC 427 SPRING Communication Networks 4/12/2012. Long Fei Zhao Jordan Angelov StoyanPetrov 4/12/2012 ENSC 427 SPRING 2012 Communication Networks Long Fei Zhao lfz2@sfu.ca Jordan Angelov jga21@sfu.ca StoyanPetrov svp1@sfu.ca http://www.sfu.ca/~lfz2/index3.html Evaluation of ZigBee Remote Sensor

More information

ZigBee in Commercial Buildings

ZigBee in Commercial Buildings ZigBee in Commercial Buildings Ember Corporation Bob Gohn VP Marketing bob.gohn@ember.com Who is? Ember is the leading supplier of ZigBee Semiconductors, Software, and Development Tools HVAC Controls Lighting

More information

Application Note: JN-AN-1134

Application Note: JN-AN-1134 Application Note: JN-AN-1134 This Application Note describes how to create a wireless UART link between the UARTs on two Jennic JN5148 evaluation kit boards. The features of the application include: Replacement

More information

Bluetooth low energy technology Bluegiga Technologies

Bluetooth low energy technology Bluegiga Technologies Bluetooth low energy technology Bluegiga Technologies Topics Background What is Bluetooth low energy? Basic concepts Architecture Differentiation and comparison Markets and applications Background Background

More information

UG103.2: Zigbee Fundamentals

UG103.2: Zigbee Fundamentals UG103.2: Zigbee Fundamentals This document describes the key features and characteristics of a ZigBee solution. It also includes a section on ZigBee 3.0. Silicon Labs Application Development Fundamentals

More information

Victor Kwong Marketing Manager

Victor Kwong Marketing Manager Nov, 2008 Introduction to Freescale's Synkro Platform: Wireless Control and Automation for Next-Generation Home Entertainment Products PC106 Victor Kwong Marketing Manager of Freescale Semiconductor, Inc.

More information

JenNet-IP EK040 Evaluation Kit User Guide

JenNet-IP EK040 Evaluation Kit User Guide JenNet-IP EK040 Evaluation Kit JN-UG-3089 Revision 1.2 9 November 2012 JenNet-IP EK040 Evaluation Kit 2 NXP Laboratories UK 2012 JN-UG-3089 v1.2 JenNet-IP EK040 Evaluation Kit Contents About this Manual

More information

Outline. TWR Module. Different Wireless Protocols. Section 7. Wireless Communication. Wireless Communication with

Outline. TWR Module. Different Wireless Protocols. Section 7. Wireless Communication. Wireless Communication with Section 7. Wireless Communication Outline Wireless Communication with 802.15.4/Zigbee Protocol Introduction to Freescale MC12311 802.15.4/Zigbee Protocol TWR-12311 Module TWR-MC12311 Smart Radio Features

More information

ZigBee: The New Frontier for Energy Efficiency

ZigBee: The New Frontier for Energy Efficiency ZigBee: The New Frontier for Energy Efficiency Brent Hodges VP Marketing and Business Development ZigBee Alliance April 2008 Copyright 2008 All Rights Reserved. Metering, Billing/CIS America 2008, San

More information

Sensor-to-cloud connectivity using Sub-1 GHz and

Sensor-to-cloud connectivity using Sub-1 GHz and Sensor-to-cloud connectivity using Sub-1 GHz and 802.15.4 Nick Lethaby, IoT, Ecosystem Manager, Texas Instruments Agenda Key design considerations for a connected IoT sensor Overview of the Sub-1 GHz band

More information

BeyondStudio for NXP Installation and User Guide

BeyondStudio for NXP Installation and User Guide BeyondStudio for NXP JN-UG-3098 Revision 1.2 13 March 2015 BeyondStudio for NXP 2 NXP Laboratories UK 2015 JN-UG-3098 v1.2 BeyondStudio for NXP Contents Preface 5 Organisation 5 Conventions 6 Acronyms

More information

International Journal of Advance Engineering and Research Development. Comparative Analysis Of Zigbee With Other Wireless Technologies - Survey

International Journal of Advance Engineering and Research Development. Comparative Analysis Of Zigbee With Other Wireless Technologies - Survey Scientific Journal of Impact Factor (SJIF): 4.72 International Journal of Advance Engineering and Research Development Volume 4, Issue 12, December -2017 e-issn (O): 2348-4470 p-issn (P): 2348-6406 Comparative

More information

AIM: To create a project for implement a wireless communication protocol on an embedded system- ZigBee.

AIM: To create a project for implement a wireless communication protocol on an embedded system- ZigBee. AIM: To create a project for implement a wireless communication protocol on an embedded system- ZigBee. Introduction ZigBee is one of the Advanced Wireless Technology and CC2430 is the first single-chip

More information

Mobile Communications

Mobile Communications Mobile Communications Wireless Personal Area Networks Manuel P. Ricardo Faculdade de Engenharia da Universidade do Porto 1 IEEE Standards 2 IEEE 802.15.4 Wireless PAN (Sensor Networks) 3 Information Current

More information

Public Review Draft. ASHRAE Standard

Public Review Draft. ASHRAE Standard BSR/ASHRAE Addendum q to ANSI/ASHRAE Standard 135-2004 Public Review Draft ASHRAE Standard Proposed Addendum q to Standard 135-2004, BACnet A Data Communication Protocol for Building Automation and Control

More information

WirelessHART, Technology and Deployment ( ETSI Nov. 09 ) Jean-Luc Griessmann, HART Communication Foundation Europe

WirelessHART, Technology and Deployment ( ETSI Nov. 09 ) Jean-Luc Griessmann, HART Communication Foundation Europe WirelessHART, Technology and Deployment ( ETSI Nov. 09 ) Jean-Luc Griessmann, HART Communication Foundation Europe Introduction Wireless devices are everywhere! We use wireless devices in everyday life.

More information

Introduction to Wireless Networking ECE 401WN Spring 2009

Introduction to Wireless Networking ECE 401WN Spring 2009 I. Overview of Bluetooth Introduction to Wireless Networking ECE 401WN Spring 2009 Lecture 6: Bluetooth and IEEE 802.15 Chapter 15 Bluetooth and IEEE 802.15 What is Bluetooth? An always-on, short-range

More information

Logitech Advanced 2.4 GHz Technology With Unifying Technology

Logitech Advanced 2.4 GHz Technology With Unifying Technology Logitech Advanced 2.4 GHz Technology Revision 070709 December 8, 2009 TABLE OF CONTENTS 1 INTRODUCTION: THE MOVE TO WIRELESS PERIPHERALS IN BUSINESS... 3 2 SYSTEM OVERVIEW... 4 2.1 NETWORK TOPOLOGY...4

More information

Chapter 7. ZigBee (IEEE ) Liang Zhao, Andreas Timm-Giel

Chapter 7. ZigBee (IEEE ) Liang Zhao, Andreas Timm-Giel Chapter 7 ZigBee (IEEE 802.15.4) Liang Zhao, Andreas Timm-Giel Outline 7.1 Introduction and Overview of IEEE 802.15.4 / ZigBee 7.2 IEEE 802.15.4: Physical Layer Protocols 7.3 IEEE 802.15.4: MAC Layer Protocols

More information

The challenge with IoT

The challenge with IoT 1 Agenda The challenge with IoT Sensor to Cloud solution Sensor to Cloud system details SimpleLink Sub-1GHz hardware & software solution Getting started 2 The challenge with IoT We are trying to connect

More information

Wireless control that simply works CES January 9, Bob Heile Chairman, Zigbee Alliance

Wireless control that simply works CES January 9, Bob Heile Chairman, Zigbee Alliance Wireless control that simply works CES 2004 January 9, 2004 Bob Heile Chairman, Zigbee Alliance 2 What is the ZigBee Alliance? A rapidly growing, worldwide, non-profit industry consortium consisting of

More information

UG103.11: Thread Fundamentals

UG103.11: Thread Fundamentals UG103.11: Thread Fundamentals This document includes a brief background on the emergence of Thread, provides a technology overview, and describes some key features of Thread to consider when implementing

More information

Design and implementation of ZigBee/IEEE Nodes for

Design and implementation of ZigBee/IEEE Nodes for Design and implementation of ZigBee/IEEE 802.15.4 Nodes for Wireless Sensor Networks Jin-Shyan Lee and Yang-Chih Huang Information and Communications Research Laboratory, Industrial Technology Research

More information

Application Note AN013

Application Note AN013 Implementing ZigBee Smart Energy (SE) s with RC2400-ZNM by Ø. Nottveit Introduction Radiocrafts offers two ZigBee Network Modules (ZNM, and ZNM-SE) with preloaded ZigBee PRO compliant stack. The ZigBee

More information

Smart Home Technology: Zigbee and Z-Wave

Smart Home Technology: Zigbee and Z-Wave Smart Home Technology: Zigbee and Z-Wave Wesley Peck, PhD wesleygpeck@lowescom Iris Smart Home Lowe s Companies, Inc Background Education 2003, BS from KU in Computer Science 2012, PhD from KU in Computer

More information

RFP ZigBee API

RFP ZigBee API RFP 142 - ZigBee API Draft 12 Pages Abstract This document describes needs and requirements of Java API to control and manage ZigBee devices on an OSGi platform according to OSGi best practices.. All company,

More information

Application Note: JN-AN-1236

Application Note: JN-AN-1236 Application Note: JN-AN-1236 ZigBee 3.0 Migration Guidelines for JN517x This Application Note provides guidance on migrating ZigBee PRO applications, initially designed for the NXP JN516x wireless microcontrollers,

More information

IEEE Testing Signal Compliance of ZigBee Standard

IEEE Testing Signal Compliance of ZigBee Standard IEEE802.15.4 Testing Signal Compliance of ZigBee Standard Tektronix 1 Agenda: 1: What is ZigBee 2: ZigBee Specification 3: ZigBee Signal Analysis 4: Demonstration for ZigBee analysis 2 What is ZigBee (1)

More information

DATASHEET Pepwave Mesh Connector

DATASHEET Pepwave Mesh Connector Features Vendor Neutral Repeater, Interoperability Certified The allows you to seamlessly extend the coverage of an existing Wi-Fi network, without messy configurations or having to run cables! Simply

More information

Standard for wireless sensor networks. Developed and promoted by the ZigBee alliance

Standard for wireless sensor networks. Developed and promoted by the ZigBee alliance Stefano Chessa Zigbee Standard for wireless sensor networks Developed and promoted by the ZigBee alliance Applications: Home automation (domotics, ambient assisted living,...) Health care Consumer electronics

More information

ZigBee Home Sensor Demonstration User Guide

ZigBee Home Sensor Demonstration User Guide ZigBee Home Sensor Demonstration JN-UG-3033 Revision 1.3 5-Feb-2008 Jennic ZigBee Home Sensor Demonstration 2 Jennic 2008 JN-UG-3033 v1.3 ZigBee Home Sensor Demonstration Jennic Contents About this Manual

More information

Simulation Analysis of Tree and Mesh Topologies in Zigbee Network

Simulation Analysis of Tree and Mesh Topologies in Zigbee Network Vol.8, No.1 (2015), pp.81-92 http://dx.doi.org/10.14257/ijgdc.2015.8.1.08 Simulation Analysis of Tree and Mesh Topologies in Zigbee Network Manpreet, Jyoteesh Malhotra CSE Department Guru Nanak Dev University

More information

UG103.13: Application Development Fundamentals: RAIL

UG103.13: Application Development Fundamentals: RAIL UG103.13: Application Development Fundamentals: RAIL Silicon Labs RAIL (Radio Abstraction Interface Layer) provides an intuitive, easily-customizable radio interface layer that is designed to support proprietary

More information

White Paper Integrating Wireless Communications and Controls Into Lighting Fixtures

White Paper Integrating Wireless Communications and Controls Into Lighting Fixtures White Paper Integrating Wireless Communications and Controls Into Lighting Fixtures DT2005 (Rev.10.2.17) Abstract Wireless is fast becoming the preferred communications & controls technology for lighting.

More information

Introduction to Z-Wave SmartStart. Whitepaper

Introduction to Z-Wave SmartStart. Whitepaper Introduction to Z-Wave SmartStart Whitepaper TABLE OF CONTENTS Summary... 3 Abbreviations and Terminology... 3 Z-Wave SmartStart under the Hood... 5 Improved Inclusion Process...5 QR Data Structure...7

More information

Case study of Wireless Technologies in Industrial Applications

Case study of Wireless Technologies in Industrial Applications International Journal of Scientific and Research Publications, Volume 7, Issue 1, January 2017 257 Case study of Wireless Technologies in Industrial Applications Rahul Hanumanth Rao Computer Information

More information

Chapter 7. IEEE ZigBee. Liang Zhao, Andreas Timm-Giel

Chapter 7. IEEE ZigBee. Liang Zhao, Andreas Timm-Giel Chapter 7 IEEE 802.15.4 ZigBee Liang Zhao, Andreas Timm-Giel Outline 7.1 Introduction and Overview of IEEE 802.15.4 / ZigBee 7.2 IEEE 802.15.4: Physical Layer Protocols 7.3 IEEE 802.15.4: MAC Layer Protocols

More information

Freescale BeeStack Software Reference Manual

Freescale BeeStack Software Reference Manual Freescale BeeStack Software Reference Manual Document Number: BSSRM Rev. 0.0 02/2007 How to Reach Us: Home Page: www.freescale.com E-mail: support@freescale.com USA/Europe or Locations Not Listed: Freescale

More information

ZigBee----free as a bee!

ZigBee----free as a bee! ZigBee----free as a bee! ZigBee is the perfect wireless solution for industrial control, medical purposes, alarm systems, building automation, and so many others. You just name it! ICP DAS releases the

More information

Wireless Sensor Networks BLUETOOTH LOW ENERGY. Flavia Martelli

Wireless Sensor Networks BLUETOOTH LOW ENERGY. Flavia Martelli Wireless Sensor Networks BLUETOOTH LOW ENERGY Flavia Martelli flavia.martelli@unibo.it Outline Introduction Applications Architecture Topology Controller specifications: Physical Layer Link Layer Host

More information

Distributed Systems 26. Mobile Ad Hoc Mesh Networks

Distributed Systems 26. Mobile Ad Hoc Mesh Networks Distributed Systems 26. Mobile Ad Hoc Mesh Networks Paul Krzyzanowski pxk@cs.rutgers.edu 12/16/2011 1 Mesh Networks Mobile Ad-hoc networks, sensor networks, Decentralized networking No need for routers

More information

Understanding the ZigBee Stack and Application Profiles

Understanding the ZigBee Stack and Application Profiles Understanding the ZigBee Stack and Application Profiles Tim Gillman and Drew Gislason There are many emerging wireless standards. Some seem to overlap in the space that they occupy in the market. ZigBee

More information

A TVWS ZigBee Prototype

A TVWS ZigBee Prototype A TVWS ZigBee Prototype James Jody Neel james.neel@crtwireless.com SDR 11 Nov 29-Dec 2, 2011 Cognitive Plane Control Plane Protocol Plane Application API Security Propagation 32- / 64- / 128-bit benefits

More information

Agriculture Wireless Temperature and Humidity Sensor Network Based on ZigBee Technology

Agriculture Wireless Temperature and Humidity Sensor Network Based on ZigBee Technology Agriculture Wireless Temperature and Humidity Sensor Network Based on ZigBee Technology Xi Wang 1 and Hui Gao 2 1 Heilongjiang Bayi Agricultural Reclamation University, Daqing 163319, China 2 Lanzhou Jiaotong

More information

WT-4000 Wireless System

WT-4000 Wireless System WT-4000 Wireless System Best Practices WT-BAC-IP Code No. LIT-12012551 Issued July 2017 Background and Wireless Network Components Refer to the QuickLIT website for the most up-to-date version of this

More information

USB Wireless Network Adapter User s Manual

USB Wireless Network Adapter User s Manual USB Wireless Network Adapter User s Manual Rev 0.9 Regulatory compliance FCC Warning This equipment has been tested and found to comply with the limits for a Class B digital device, pursuant to part 15

More information