Zigbee Host SLC Project Wrapper Library

This directory creates a CMake target that abstracts functionality offered by a Zigbee Host framework as a static library. This wrapper library is used by ZigPC to send/receive events from the Zigbee network. The current implementation uses the Silicon Labs EmberZNet host framework to provide this functionality.

File structure

|- CMakeLists.txt       CMake Configuration file.
|- include/             Wrapper API for Zigbee Host framework
                        accessible to other CMake targets.
|- src/                 Source files used to satisfy the API requirements.
|- gen/                 [Implementation-specific] Autogenerated files
                        used in combination with source files to build
                        Zigbee Host library.

Implementation Details

The current implementation of the Wrapper API uses a Silicon Labs Universal Configurator (UC) based project. This project is derived used the ZigbeeHost Host UC project accessible at: protocol/zigbee/app/framework/scenarios/z3/ZigbeeHost/ZigbeeHost.slcp

Dependencies

The CMake target has dependencies on two vendor tools:

  1. Silicon Labs Configurator(slc): This tool is used to autogenerate all the source-code needed to compile a UC project. This tool uses the configuration specified in ./src/libzigbee_host.slcp. See the following user guide for more details: UG520

  2. ZCL Configurator (zap): This tool is used to generate the ZCL-specific behavior needed in a UC project. This tool is used by slc to generated these files. See the following application note for more details: AN1325: Zigbee Cluster Configurator User’s Guide.

Build Process

The CMake target uses the ExternalProject_Add step to define 2 commands to be executed in-order:

  1. CONFIGURE: This step invokes slc to autogenerate the UC project based on any changes to ./src/libzigbee_host.slcp; To force slc re-build, run the cmake clean target for this component (i.e. for Ninja build system, execute: ninja -t clean zigbee_host).

  2. BUILD: This step invokes the following Makefile: ./gen/Makefile which calls the UC generated Makefile project to compile and create the Zigbee host framework as a static library.

NOTE: The currently supported compiler is GCC.

Adding Functionality

The two configuration files are used to modify UC project:

  • src/libzigbee_host.slcp: Configures Zigbee host related functionality offered by EmberZNet.

  • src/confg/zcl/zcl_config.zap: Configures ZCL related functionality.

Adding an EmberZNet Component(a.k.a Plugin)

To add an additional component to the UC project, add the component’s ID under the component list defined in ./src/libzigbee_host.slcp:

component:
  ...
  - id: "my_extra_component"

Supporting Additional ZCL Clusters

To add additional ZCL clusters to the UC project:

  • Modify the ZAP ZCL configuration file in ./src/config/zcl/zcl_config.zap to modify the ZCL request/response behavior for messages received on the Zigbee network.

TODO: Include steps on how to modify ZCL config using ZAP

Add ZCL Cluster Command Message to Generic CommandReceieved Handler

The Wrapper API contains a callback that is invoked for commands sent to supported ZCL clusters. To add to this support set: To add additional ZCL clusters to the UC project, do the following steps:

  • Add the following 2 lines to the template_contribution list: ./src/libzigbee_host.slcp with <CLUSTER_ID_HEX4> replaced with the ClusterID of choice:

    # Redirecting ZCL commands sent for <CLUSTER_ID_HEX4> server cluster to emberAfClusterServiceCallback()
     - {name: cluster_service, value: {cluster_id: "<CLUSTER_ID_HEX4>", mfg_id: "NOT_MFG_SPECIFIC", side: "SERVER", service_function: "emberAfClusterServiceCallback"}}
    
    # Redirecting ZCL commands sent for <CLUSTER_ID_HEX4> client cluster to emberAfClusterServiceCallback()
     - {name: cluster_service, value: {cluster_id: "CLUSTER_ID_HEX4", mfg_id: "NOT_MFG_SPECIFIC", side: "CLIENT", service_function: "emberAfClusterServiceCallback"}}