Application Framework Architecture#
The Zigbee Application Framework sits on top of the Zigbee stack, consumes the stack “handler” interfaces, and exposes its own more highly abstracted and application-specific interface to the developer.
One of the main features of the Zigbee Application Framework is its ability to separate user-created and Silicon Labs-created code. While Silicon Labs provides all the source code for the Zigbee Application Framework, user-created code should live outside the framework and should interact with the framework through the Zigbee Application Framework API exposed by the framework utilities and callbacks. The block diagram in the following figure shows a high-level overview of the Zigbee Application Framework architecture and how the two code bases are separated.
Each application has its own main.c which implements the main()
function and the main loop.
The Silicon Labs SDK is based on a component structure, where a component describes a software module (files, defines, and so on) with a well-defined function. The Zigbee Application Framework Common component included in app/framework/common consumes the Zigbee Stack handler interface and integrates the Zigbee Application Framework into the Zigbee EmberZNet PRO stack. This component provides a compile-time subscription mechanism for other Zigbee components. When a component subscribes to one of the stack handlers, a function call to the component callback is generated and will be invoked every time the stack handler is invoked. In addition, two main files are located in the app/framework/util directory, one (af-soc.c) for a System-on-Chip (SoC) and the other (af-host.c) for a host micro-processor paired with a Network Co-Processor (NCP) or Radio Co-Processor (RCP).
For example, the sample application projects subscribe to the sl_zigbee_incoming_message_handler()
stack handler and pass all incoming messages off to the Zigbee Application Framework for command processing. Once incoming messages are processed, they are passed off to the appropriate cluster for handling.
The application can choose to implement any of the public Application Framework level stack callbacks by simply declaring such callbacks in the application code. Every sample application included in the Silicon Labs SDK Suite implements a subset of callbacks in the application-specific app.c file. Application Framework-level stack callbacks are documented in the Zigbee Application Framework API reference.