Trident IoT Zigbee SDK
 
Loading...
Searching...
No Matches
Plugin Configuration Guide

Back to Trident IoT SDK

Overview


Plugins are source code modules that provide functionality for common device behavior. These are designed to build in helpful functionality into user applications by adding things like ZCL cluster functionality, best practices for common needs such as network rejoins backoff delay algorithms, or providing useful tools like the Trident command line interface and debug print utility. All plugins are completely optional and are up to the user to decide if they want to use them or not. Also, plugin source code is copied into projects during project generation so feel free to modify any plugins that you wish.

Plugin configuration is what gives users the ability to add, remove, or modify the built in Trident plugins to an application. The concept of adding plugins to a project involves adding the C source file(s) and the C header file include path(s) into the CMakeLists.txt file in the framework section, adding any #defines needed to enable the plugin inside of project_dir/generated/tr_plugin_config.h, then doing a clean build of the project.

Once a plugin has been added, there are optional Application Callbacks (See Application Callbacks Guide) that can be implemented to provide application level insight and control of plugin behavior wihout needing to modify the plugin itself.

See below for some examples on how to enable this.

Note
tr_plugin_config.h is a manually edited file right now but a configuration tool is in the works...stay tuned.

How to Add a Trident Plugin


Overview

Adding a Trident plugin consists of 4 steps for non-ZCL plugins and 5 steps for ZCL plugins. If adding a non-ZCL plugin, start from step 2.

  1. If adding a ZCL plugin, the cluster must be added to the project using ZAP before the plugin will do anything.
  2. Add the C source files into the PLUGIN_FILES list of the project CMakeLists.txt file.
  3. Add the include directories into the FRAMEWORK_INCLUDE list of the project CMakeLists.txt file.
  4. Add #defines to enable the plugin in the project and to add/configure any optional features.
  5. Perform a build clean followed by a build command to do a full rebuild of the project.

Example: Adding Groups Server Plugin with Optional Features

The following is an example of how to add the Groups Server plugin with some additional details about what goes into each step. This example adds the required components as well as the optional feature that allows for group bindings to be created automatically when an add groups command is received.

Note
This assumes that Command Line Interface (CLI) and Debug Print already exist in the project

Step 1: Add Groups Server cluster via ZAP

The Trident ZCL plugins provide cluster functionality and give access to optional ZCL Plugins Application Callbacks. However, adding a ZCL plugin does not add the cluster to the ZCL profile of the device without also adding the cluster to a project via the ZAP tool. Please see ZAP User Guide for how to add clusters to a project via ZAP.

Step 2: Add the C source files into the PLUGIN_FILES list of the project CMakeLists.txt file

This step adds the necessary source files to include the mandatory groups plugin behavior, the optional CLI component, and the optional auto-bind feature. The auto-bind feature has a dependency on the Bind plugin which is why the tr_bind.c file is included as part of this step.

  1. Navigate to the Groups Server to get the source files that need to be added to the project CMakeLists.txt file. The files in the plugin table can be copied directly from the table into the CMakeLists.txt file with no modifications necessary.
  2. Open the project CMakeLists.txt file and search for the PLUGIN_FILES section.
    Note
    Common places to edit in the CMakeLists.txt file are marked with [USER HELP] comments.
  3. Paste the files copied from step 1 into the CMakeLists.txt file.
    # [USER HELP] Add additional plugin source path/to/filename.c here
    set(PLUGIN_FILES
    ...
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server.c
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server_cb_stubs.c
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server_cli.c
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/services/bind/tr_bind.c
    )

Step 3: Add the include directories into the FRAMEWORK_INCLUDE list of the project CMakeLists.txt file

This step adds the necessary include directory paths into the CMakeLists.txt file so the include files can be found by the build system.

  1. Navigate to the Groups Server to get the include paths that need to be added to the project CMakeLists.txt file. The include paths in the plugin table can be copied directly from the table into the CMakeLists.txt file with no modifications necessary.
  2. Open the project CMakeLists.txt file and search for the FRAMEWORK_INCLUDE section.
    Note
    Common places to edit in the CMakeLists.txt file are marked with [USER HELP] comments.
  3. Paste the include directories copied from step 1 into the CMakeLists.txt file.
    # [USER HELP] Add additional plugin include directory paths here
    set(FRAMEWORK_INCLUDE
    ...
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server
    ${ZIGBEE_FRAMEWORK_PATH}/plugin/services/bind
    )

Step 4: Add #defines to enable the plugin in the project and to add/configure any optional features

Now that the plugin builds as part of the project, the tr_plugin_config.h file needs to be updated to tell the application to use the plugin. This file lives in the project_name/generated directory.

Note
This is in the generated directory because a configuration tool is in the works but it must be edited manually for the time being
  1. Navigate to the Groups Server to get the definitions that need to be added to the project CMakeLists.txt file. The include paths in the plugin table can be copied directly from the table into the CMakeLists.txt file with no modifications necessary.
    Note
    In the case where the definitions have values that can be set, default values from the plugin tables can be used but it is up to the user to modify those values as needed.
  2. Paste the #defines copied from step 1 into tr_plugin_config.h.
    #define TR_GROUPS_SERVER_PLUGIN_ENABLE
    #define TR_GROUPS_SERVER_CLI_ENABLE
    #define TR_GROUPS_SERVER_PLUGIN_PRINT_ENABLE 1
    #define TR_GROUPS_SERVER_AUTO_BIND_ENABLE

Step 5: Perform a build clean followed by a build command to do a full rebuild of the project

Now the plugin has been added and all is left is to build it! Doing a full build clean is a best practice though not always necessary.

  1. Use elcap to clean the project using command elcap build --clean
  2. User elcap to build the project using command elcap build

See elcap page for more information.

Note
See Application Callbacks Guide for more ways to take advantage of Trident plugins.

How to Remove a Trident Plugin


To remove a plugin the process is esentially the same as How to Add a Trident Plugin but in reverse.

  1. Remove pluign #defines from tr_plugin_config.h.
  2. Remove the plugin include directory paths from CMakeLists.txt FRAMEWORK_INCLUDE section.
  3. Remove the plugin source files from CMakeLists.txt PLUGIN_FILES section.
  4. Perform a build clean followed by a build command to rebuild the project.

How to Read Plugin Tables


The plugin tables show what required and optional functionality exists as well as the information needed to add each plugin into a project. All non-optional definitions must be added to tr_plugin_config.h and all associated source files and include directories must be added into the project's CMakeLists.txt file. The required values can be copied directly from the plugin tables and pasted into the project files to add the plugin to a project.

Define Value Optional Depends On Source Files Include Paths
#defines to add to tr_plugin_config.h
value to set #define to, if any NO if settings in this row are required for this plugin, YES if it is an optional feauture of this plugin plugins that this one depends on
path/to/src file to add to CMakeLists.txt
path/to/include directory to add to CMakeLists.txt

Plugins - Services


Services plugins are used for adding "services" to a device that are not explicitly ZCL cluster related. These are intended to improve the quality of life for a product developer by providing configurable functionality that is commonly added to devices during product development. If there is anything you would like to see added to this list please let us know!

Bind

This is an extension to the default binding capabilities that are found in the stack. This is primarily intended to be used along with the Groups Server plugin to interact with groups bindings.

Define Value Optional Depends On Source Files Include Paths
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/bind/tr_bind.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/bind

Command Line Interface (CLI)

This plugin includes the cli engine with up/down arrow command history, left/right arrow command editing, command parsing, command option and argument parsing, and numerous built-in CLI commands. Built-in commands include general commands like "info", "version", and "reset", mac control commands, network commands, print commands, plugin commands, debug commands, global cluster specific ZCL commands, and ZDO commands.

See Zigbee Command Line Interface for information on configuring the HAL for CLI use.

Note
Currently the CLI prompt is truncated to 10 characters, even if TR_CLI_MAX_PROMPT_LEN is set to a larger value
Define Value Optional Depends On Source Files Include Paths
NO Debug Print
${TRIDENT_FRAMEWORK_PATH}/utility/cli/tr_cli.c
${TRIDENT_FRAMEWORK_PATH}/utility/cli/tr_cli_buffer.c
${TRIDENT_FRAMEWORK_PATH}/utility/cli/tr_cli_command_parser.c
${TRIDENT_FRAMEWORK_PATH}/utility/ring_buffer/tr_ring_buffer.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_argument_parser.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_general_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_zcl_global_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_network_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_print_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_zdo_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_reporting_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_binding_table_cmds.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli/tr_cli_find_and_bind_cmds.c
${TRIDENT_FRAMEWORK_PATH}/utility/cli
${TRIDENT_FRAMEWORK_PATH}/utility/ring_buffer
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/cli
#ifdef TR_CLI_PROMPT
#undef TR_CLI_PROMPT
#endif
#define TR_CLI_PROMPT "prompt> "
prompt string to show up in the CLI terminal YES
#ifdef TR_CLI_MAX_PROMPT_LEN
#undef TR_CLI_MAX_PROMPT_LEN
#endif
#define TR_CLI_MAX_PROMPT_LEN sizeof(TR_CLI_PROMPT)
size of custom prompt YES

Debug Print

The debug print plugin provides a build-time and run-time configurable print feature for use in product debug. It also works hand-in-hand with the Command Line Interface (CLI) plugin by providing the character output. Debug prints are classified into groups and each group can be configured to a specific color or color can be turned off, and there are APIs available for enabling and disabling print groups at run time.

Print output is associated with a print group by using the appropriate printf function. Using the proper print function is necessary to maintain group identity. In other words, application code should NOT use tr_app_printf() and tr_app_println() directly! The print groups, functions, and usage are:

Debug Print Group Functions Used For
TR_DEBUG_PRINT_STACK tr_stack_printf(...)
tr_stack_println(...)
Prints from the Zigbee stack will be in this group
TR_DEBUG_PRINT_CORE tr_core_printf(...)
tr_core_println(...)
Core prints are used in the CLI
TR_DEBUG_PRINT_APP tr_app_printf(...)
tr_app_println(...)
Prints from the application should be in this group
TR_DEBUG_PRINT_ZCL tr_zcl_printf(...)
tr_zcl_println(...)
ZCL prints from the ZCL plugins will be in this group
TR_DEBUG_PRINT_RX_MSGS tr_rxmsgs_printf(...)
tr_rxmsgs_println(...)
All Zigbee messages recived will print from this group

Print group build-time configuration is accomplished in the project tr_plugin_config.h file by modifying the options shown below.

Note
Using xxx_println(...) function is less efficient than using xxx_printf(...) with a \n at the end of the format string
Disabling a print group removes it from the build and it cannot be enabled at run-time! Enabling a print group sets the runtime enable to true by default.
// Debug print user configuration
#ifndef TR_TEST_BUILD
#define TR_DEBUG_PRINT_COLOR_ENABLED
#endif
#define TR_DEBUG_PRINT_STACK_ENABLED
#define TR_DEBUG_PRINT_CORE_ENABLED
#define TR_DEBUG_PRINT_APP_ENABLED
#define TR_DEBUG_PRINT_ZCL_ENABLED
#define TR_DEBUG_PRINT_RX_MSGS_ENABLED
// Debug print color configuration
#ifdef TR_DEBUG_PRINT_COLOR_ENABLED
#define TR_DEBUG_PRINT_STACK_COLOR DEBUG_BLUE
#define TR_DEBUG_PRINT_CORE_COLOR DEBUG_DEFAULT
#define TR_DEBUG_PRINT_APP_COLOR DEBUG_MAGENTA
#define TR_DEBUG_PRINT_ZCL_COLOR DEBUG_GREEN
#define TR_DEBUG_PRINT_RX_MSGS_COLOR DEBUG_YELLOW
#endif
Debug Print Color Options
DEBUG_BLACK
DEBUG_RED
DEBUG_GREEN
DEBUG_YELLOW
DEBUG_BLUE
DEBUG_MAGENTA
DEBUG_CYAN
DEBUG_WHITE
DEBUG_DEFAULT
DEBUG_RESET


Define Value Optional Depends On Source Files Include Paths
NO
${TRIDENT_FRAMEWORK_PATH}/utility/printf/tr_printf.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/debug_print/tr_debug_print.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/debug_print/tr_debug_print_cli.c
${TRIDENT_FRAMEWORK_PATH}/utility/printf
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/debug_print
#define TR_DEBUG_PRINT_STACK_ENABLED
none, define to enable stack print group YES
#define TR_DEBUG_PRINT_CORE_ENABLED
none, define to enable core print group YES
#define TR_DEBUG_PRINT_APP_ENABLED
none, define to enable app print group YES
#define TR_DEBUG_PRINT_ZCL_ENABLED
none, define to enable ZCL print group YES
#define TR_DEBUG_PRINT_RX_MSGS_ENABLED
none, define to enable printing of received messages YES
#define TR_DEBUG_PRINT_COLOR_ENABLED
none, define to enable color prints YES
#define TR_DEBUG_PRINT_STACK_COLOR DEBUG_BLUE
color to use, select option from color table above. YES color prints being enabled
#define TR_DEBUG_PRINT_CORE_COLOR DEBUG_DEFAULT
color to use, select option from color table above. YES color prints being enabled
#define TR_DEBUG_PRINT_APP_COLOR DEBUG_MAGENTA
color to use, select option from color table above. YES color prints being enabled
#define TR_DEBUG_PRINT_ZCL_COLOR DEBUG_GREEN
color to use, select option from color table above. YES color prints being enabled
#define TR_DEBUG_PRINT_RX_MSGS_COLOR DEBUG_YELLOW
color to use, select option from color table above. YES color prints being enabled

Network Rejoin

As its name indicates, the network rejoin plugin provides control over Zigbee network rejoins with configurable backoff times between rejoin attempts. Rejoin backoffs reduce battery drain when the network is not immediately available, and also reduces chatter on the Zigbee channels.

Rejoins are done in blocks with the backoff applying between each block of rejoins. The rejoin order within each block is:

Rejoin Attempt Description
1 Secure rejoin on the current channel
2 Trust center rejoin on the current channel
3 Secure rejoin attempt across the primary channel set
4 Trust center rejoin across the primary channel set
5 Secure rejoin across the seconday channel set
6 Trust center rejoin across the secondary channel set


The rejoin backoff is configured using several macros to set the initial backoff time, the maximum backoff time, and the backoff multiplier. At boot or on successful rejoin, the backoff time is set to TR_NWK_REJOIN_INITIAL_DELAY_SEC. If the execution of a rejoin block fails to get the device back on the network, the rejoin backoff time is multiplied by TR_NWK_REJOIN_DELAY_MULTIPLIER, but the rejoin backoff time is never allowed to be longer than TR_NWK_REJOIN_MAX_DELAY_SEC. The network rejoin plugin then waits rejoin time before executing the next rejoin block.

The network rejoin plugin configuration can be set in tr_plugin_config.h, but the default values shown below will apply if the configuration is not set.

Rejoin Backoff Setting Default Value Description
#define TR_NWK_REJOIN_INITIAL_DELAY_SEC 1 second Minimum rejoin backoff
#define TR_NWK_REJOIN_MAX_DELAY_SEC 900 seconds Maximum rejoin backoff
#define TR_NWK_REJOIN_DELAY_MULTIPLIER 2 Rejoin backoff multiplier


Define Value Optional Depends On Source Files Include Paths
#define TR_NETWORK_REJOIN_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/network_rejoin/tr_network_rejoin.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/network_rejoin/tr_network_rejoin_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/network_rejoin
#define TR_NETWORK_REJOIN_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Sleep

The sleep plugin provides APIs and callbacks for application management of sleep for a sleepy end device. The APIs allow sleep to be blocked or enabled, and the pre-sleep callback allows the application to block sleep on a per-event basis as needed. A post-wake callback allows the application to perform processing upon a wake from sleep if needed.

The wake source for the project is defined in tr_hal_config.h. The macro TR_WAKE_SOURCES is configured as a list of wake reasons such as GPIO pins, timers, UARTs, etc. An example from the Door Lock SZED sample app is shown below. Also refer to the On/Off Switch SZED sample application.

#define TR_WAKE_SOURCES \
LOW_POWER_WAKEUP_GPIO4, \
LOW_POWER_WAKEUP_GPIO5, \
LOW_POWER_WAKEUP_GPIO6, \
LOW_POWER_WAKEUP_GPIO9, \
LOW_POWER_WAKEUP_GPIO20, \
LOW_POWER_WAKEUP_GPIO21, \
LOW_POWER_WAKEUP_32K_TIMER, \
LOW_POWER_WAKEUP_UART0_RX
#define TR_LOW_POWER_LEVEL LOW_POWER_LEVEL_SLEEP0

The possible wake sources are:

Wake Sources
LOW_POWER_WAKEUP_RTC_TIMER
LOW_POWER_WAKEUP_COMPARATOR
LOW_POWER_WAKEUP_32K_TIMER
LOW_POWER_WAKEUP_GPIO0
LOW_POWER_WAKEUP_GPIO1
LOW_POWER_WAKEUP_GPIO2
LOW_POWER_WAKEUP_GPIO3
LOW_POWER_WAKEUP_GPIO4
LOW_POWER_WAKEUP_GPIO5
LOW_POWER_WAKEUP_GPIO6
LOW_POWER_WAKEUP_GPIO7
LOW_POWER_WAKEUP_GPIO8
LOW_POWER_WAKEUP_GPIO9
LOW_POWER_WAKEUP_GPIO10
LOW_POWER_WAKEUP_GPIO11
LOW_POWER_WAKEUP_GPIO12
LOW_POWER_WAKEUP_GPIO13
LOW_POWER_WAKEUP_GPIO14
LOW_POWER_WAKEUP_GPIO15
LOW_POWER_WAKEUP_GPIO16
LOW_POWER_WAKEUP_GPIO17
LOW_POWER_WAKEUP_GPIO18
LOW_POWER_WAKEUP_GPIO19
LOW_POWER_WAKEUP_GPIO20
LOW_POWER_WAKEUP_GPIO21
LOW_POWER_WAKEUP_GPIO22
LOW_POWER_WAKEUP_GPIO23
LOW_POWER_WAKEUP_GPIO24
LOW_POWER_WAKEUP_GPIO25
LOW_POWER_WAKEUP_GPIO26
LOW_POWER_WAKEUP_GPIO27
LOW_POWER_WAKEUP_GPIO28
LOW_POWER_WAKEUP_GPIO29
LOW_POWER_WAKEUP_GPIO30
LOW_POWER_WAKEUP_GPIO31
LOW_POWER_WAKEUP_UART0_RX
LOW_POWER_WAKEUP_UART1_RX
LOW_POWER_WAKEUP_UART2_RX
Note
The only supported value for TR_LOW_POWER_LEVEL at this time is LOW_POWER_LEVEL_SLEEP0
Define Value Optional Depends On Source Files Include Paths
#define TR_IS_SLEEPY_ZED
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/sleep/tr_sleep.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/sleep/tr_sleep_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/services/sleep
#define TR_STAY_AWAKE_WHEN_NOT_JOINED
none, define to prevent device from sleeping when not joined to a network YES

Plugins - Zigbee Stack


The stack configuration options in this section are not really plugins but things that can be defined in tr_plugin_config.h to modify stack behavior. These are all optional as sane default values already exist.

Primary/Secondary Channel Masks

The Zigbee Base Device Behavior (BDB) specification calls for prioritizing the 16 Zigbee channels for inital joins and for rejoins. In most deployments this reduces the time that a device is off the network by scanning the more commonly used channels first. Those channels are typically 11, 15, 20, and 25. The primary and secondary channel masks for a project is defined in tr_plugin_config.h. All 16 channels should be accounted for between the 2 masks. The masks simply contain a 1 in the bit position corresponding to the desired channel. The default settings are shown below, but can be changed as desired.

Define Value Optional Depends On Source Files Include Paths
#define TR_PRIMARY_CHANNEL_MASK 0x02108800
primary channel bitmask YES
#define TR_SECONDARY_CHANNEL_MASK 0x05EF7000
secondary channel bitmask YES

End Device Keepalive

Zigbee End Devices (ZEDs and SZEDs) establish a "parent/child" relationship with a Zigbee Router (ZR) or Zigbee Coordinator (ZC) when they join or rejoin a network. That relationship can become disfunctional if the end device child and its parent don't agree. As in all relationships, communication is key. The Zigbee stack specification defines methods that end device children may use to keep their relationship with their parent in good standing.

Timeout Request

One method of maintaining the parent/child relationship is via the end device timeout request. The end device timeout request allows an end device to tell its parent what the child timeout should be, and sending that request periodically will maintain the parent/child relationship. This is a very efficient method of maintaing network connectivity, especially for battery powered devices because it reduces the number of transmits that a ZED must make.

Data Poll

MAC Data Polls can be used as a keepalive when an end device's parent is on an older Zigbee stack or does not support the end device timeout requests. Sleepy ZEDs normally implement some method for sending MAC Data Polls such as the Poll Control Server or a hardcoded Data Poll rate as a way of receiving messages. That by itself is often enough to maintain the parent/child relationship. Non-sleepy ZEDs however do not need to send MAC Data Polls in order to receive messages, but they do need to communicate with their parent on a periodic basis to maintain a functional relationship. Enabling the MAC Data Poll Keeplive will fulfill this need for a healthy relationship.

Configuration

The End Device Keepalive plugin can be configured to use data polls as a keepalive, end device timeouts, both, or neither. If both methods are selected and the parent does not support end device timeout, then the ZED will fall back to data polls. The configuration is set in tr_plugin_config.h and the options are shown below:

End Device Timeout Configurations
ED_AGING_TIMEOUT_10SEC
ED_AGING_TIMEOUT_2MIN
ED_AGING_TIMEOUT_4MIN
ED_AGING_TIMEOUT_8MIN
ED_AGING_TIMEOUT_16MIN
ED_AGING_TIMEOUT_32MIN
ED_AGING_TIMEOUT_64MIN
ED_AGING_TIMEOUT_128MIN
ED_AGING_TIMEOUT_256MIN
ED_AGING_TIMEOUT_512MIN
ED_AGING_TIMEOUT_1024MIN
ED_AGING_TIMEOUT_2048MIN
ED_AGING_TIMEOUT_4096MIN
ED_AGING_TIMEOUT_8192MIN
ED_AGING_TIMEOUT_16384MIN


End Device Keepalive Method
ED_KEEPALIVE_DISABLED
MAC_DATA_POLL_KEEPALIVE
ED_TIMEOUT_REQUEST_KEEPALIVE
BOTH_KEEPALIVE_METHODS


Define Value Optional Depends On Source Files Include Paths
#define TR_ED_AGING_TIMEOUT ED_AGING_TIMEOUT_64MIN
timeout duration macro YES
#define TR_KEEPALIVE_INTERVAL_MS 300000
keepalive interval in milliseconds YES
#define TR_KEEPALIVE_METHOD BOTH_KEEPALIVE_METHODS
keepalive method macro YES

Plugins - ZCL


ZCL plugins are used to add cluster functionality to a device once the cluster has been added to the project via ZAP (see ZAP User Guide). Some of these add only what the ZCL specification requires while others add some extra options on top to help bridge the gap from what the specification requires to what a real world device requires. There are often optional CLI commands that can be included in a project to give a useful interface for testing cluster functionality via the command line interface. There are also configurable debug prints for each cluster implementation that can be turned on or off to add or remove additional debug print information.

Alarms Client

Implementation of the ZCL Alarms Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_ALARMS_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_client/tr_alarms_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_client/tr_alarms_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_client
#define TR_ALARMS_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_client/tr_alarms_client_cli.c
#define TR_ALARMS_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Alarms Server

Implementation of the ZCL Alarms Server cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_ALARMS_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_server/tr_alarms_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_server/tr_alarms_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/alarms_server
#define TR_ALARMS_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Basic Client

Implementation of the ZCL Basic Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_BASIC_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_client/tr_basic_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_client/tr_basic_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_client
#define TR_BASIC_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_client/tr_basic_client_cli.c
#define TR_BASIC_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Basic Server

Implementation of the ZCL Basic Server cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_BASIC_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_server/tr_basic_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_server/tr_basic_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/basic_server
#define TR_BASIC_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Door Lock Server

Implementation of the ZCL Door Lock server cluster. This implementation is NOT complete. It provides manadory functionality and management of a user table including PIN code verification.
This implementation does not include the following:

  • storing user table in NVRAM
  • user schedules
  • logging
Define Value Optional Depends On Source Files Include Paths
#define TR_DOOR_LOCK_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/door_lock_server/tr_door_lock_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/door_lock_server/tr_door_lock_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/door_lock_server
#define TR_DOOR_LOCK_SERVER_MAX_PIN_LEN 4
Max pin code length NO
#define TR_DOOR_LOCK_SERVER_MAX_NUM_USERS 8
Max number of PIN users NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/door_lock_server/tr_door_lock_server_users.c
#define TR_DOOR_LOCK_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Door Lock Server Plugin Received Commands Implemented
The following received commands are implemented in the door lock server plugin. Application callbacks are available for each command, allowing door lock server plugin functionality to be overridden on a per-command basis.

Command Description
TR_ZCL_CMD_LOCK_DOOR_ID Lock the door, with optional PIN/RFID code
TR_ZCL_CMD_UNLOCK_DOOR_ID Unlock the door, with optional PIN/RFID code
TR_ZCL_CMD_SET_PIN_ID Set the PIN code for the specified user ID in the user table
TR_ZCL_CMD_GET_PIN_ID Retrieve the PIN code for the specified user ID from the user table
TR_ZCL_CMD_CLEAR_PIN_ID Delete the PIN code for the specified user ID from the user table
TR_ZCL_CMD_CLEAR_ALL_PINS_ID Clear the PIN codes for all user IDs from the user table
TR_ZCL_CMD_SET_USER_STATUS_ID Set the status of a user ID in the user table
TR_ZCL_CMD_GET_USER_STATUS_ID Retrieve the status of a user ID from the user table
TR_ZCL_CMD_SET_USER_TYPE_ID Set the user type of a user ID in the user table
TR_ZCL_CMD_GET_USER_TYPE_ID Retrieve the user type of a user ID from the user table

Groups Client

Implementation of the ZCL Groups Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_GROUPS_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_client/tr_groups_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_client/tr_groups_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_client
#define TR_GROUPS_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_client/tr_groups_client_cli.c
#define TR_GROUPS_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Groups Server

Implementation of the ZCL Groups Server cluster. This plugin contains an optional feature that allows bindings to be created automatically when an add to group command is received. This is done by defining TR_GROUPS_SERVER_AUTO_BIND_ENABLE in tr_plugin_config.h and including the required dependency outlined in the below table.

Define Value Optional Depends On Source Files Include Paths
#define TR_GROUPS_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server
#define TR_GROUPS_SERVER_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/groups_server/tr_groups_server_cli.c
#define TR_GROUPS_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print
#define TR_GROUPS_SERVER_AUTO_BIND_ENABLE
YES Bind

Identify Client

Implementation of the ZCL Identify Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_IDENTIFY_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_client/tr_identify_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_client/tr_identify_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_client
#define TR_IDENTIFY_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_client/tr_identify_client_cli.c
#define TR_IDENTIFY_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Identify Server

Implementation of the ZCL Identify Server cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_IDENTIFY_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_server/tr_identify_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_server/tr_identify_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/identify_server
#define TR_IDENTIFY_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

On/Off Client

Implementation of the ZCL On/Off Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_ON_OFF_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_client/tr_on_off_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_client/tr_on_off_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_client
#define TR_ON_OFF_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_client/tr_on_off_client_cli.c
#define TR_ON_OFF_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

On/Off Server

Implementation of the ZCL On/Off Server cluster. This is currently a wrapper of the existing ZBOSS ZCL implementation and will be updated to be a full Trident plugin soon.

Define Value Optional Depends On Source Files Include Paths
#define TR_ON_OFF_SERVER_PLUGIN_ENABLE
NO
${ZBOSS_STABLE_PATH}/zcl/zcl_on_off_commands.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_server/tr_on_off_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_server/tr_on_off_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_server
#define TR_ON_OFF_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

On/Off Switch Configuration Client

Implementation of the ZCL On/Off Switch Configuration Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_ON_OFF_SWITCH_CONFIGURATION_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_client/tr_on_off_switch_configuration_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_client/tr_on_off_switch_configuration_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_client
#define TR_ON_OFF_SWITCH_CONFIGURATION_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

On/Off Switch Configuration Server

Implementation of the ZCL On/Off Switch Configuration Server cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_ON_OFF_SWITCH_CONFIGURATION_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_server/tr_on_off_switch_configuration_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_server/tr_on_off_switch_configuration_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/on_off_switch_configuration_server
#define TR_ON_OFF_SWITCH_CONFIGURATION_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Over the Air Upgrade Client

The Over the Air (OTA) Upgrade Client plugin is an impelementation of the OTA client cluster. It provides APIs and callbacks that can be used by the application for managing firmware upgrades and also provides an interface to the FLASH and the bootloader. The OTA client plugin will start when a device successfuly joins or rejoins a network. The first Query Next Image Request (QNIR) will be sent at a random time between 1 and 5 minutes after the network achieves the joined state. After that, QNIRs will be sent based on the value of the TR_OTA_UPGRADE_QUERY_DELAY_MIN macro. The TR_OTA_UPGRADE_MAX_DATA_SIZE macro is used to limit the amount of data returned by the OTA Upgrade Server. The server will also limit the data based the avaialble payload in the Zigbee packet. For greatest efficiency (i.e. fewest packets), keep this macro set to a large number like 64. This plugin also has features that are enabled by the configuration of certain attributes.

Rate Limiting

This plugin supports rate limiting IF the "Minimum Block Period" attribute is implemented. Rate limiting allows both the OTA Upgrade client and server to set the minimum block request period. Some devices may want to limit how often image block requests are sent to manage their battery, and OTA Upgrade servers may want to limit image block requests in order to manage network bandwidth.

Resume Upgrade on Reboot

This plugin supports "resume upgrade on reboot" IF the "File Offset" attribute is implemented and stored in NVRAM and if the "Image Upgrade Status" attribute is also configured to be stored in NVRAM. This feature allows a partial upgrade to be resumed upon device reboot rather than requiring a full restart.

More details of the application interface can be found in Over the Air Bootloading Client Callbacks and the Over the Air Bootloading Client APIs.

Configuration

Define Value Optional Depends On Source Files Include Paths
#define TR_OVER_THE_AIR_BOOTLOADING_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client/tr_osif_ota.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client/tr_over_the_air_bootloading_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client/tr_ota_upgrade_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client/tr_ota_upgrade_client_minimal.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_common/tr_ota_upgrade_common.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_common
#define TR_OVER_THE_AIR_BOOTLOADING_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/ota_upgrade_client/tr_over_the_air_bootloading_client_cli.c
#define TR_OVER_THE_AIR_BOOTLOADING_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print
#define TR_OTA_UPGRADE_QUERY_DELAY_MIN 60
how often to send query next image requests in minutes YES
#define TR_OTA_UPGRADE_MAX_DATA_SIZE 64
maximum number of bytes to request in an image block request YES

Poll Control Server

Implementation of the ZCL Poll Control Server cluster. See Poll Control Server Callbacks for all the application callbacks that can be implemented for this plugin.

Define Value Optional Depends On Source Files Include Paths
#define TR_POLL_CONTROL_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/poll_control_server/tr_poll_control_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/poll_control_server/tr_poll_control_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/poll_control_server
#define TR_POLL_CONTROL_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Power Configuration Client

Implementation of the ZCL Power Configuration Client cluster.

Define Value Optional Depends On Source Files Include Paths
#define TR_POWER_CONFIGURATION_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_client/tr_power_configuration_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_client/tr_power_configuration_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_client
#define TR_POWER_CONFIGURATION_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Power Configuration Server

Implementation of the ZCL Power Configuration Server cluster. This plugin contains an additional configuration option to latch the low battery status bits in the battery alarm state attribute when the TR_POWER_CONFIGURATION_SERVER_BATTERY_LATCHING option is defined in tr_plugin_config.h. This prevents the battery alarm state from being cleared when a voltage level drifts back above the respective trip points and requires a device reboot to show a good battery status again.

Define Value Optional Depends On Source Files Include Paths
#define TR_POWER_CONFIGURATION_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_server/tr_power_configuration_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_server/tr_power_configuration_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_server
#define TR_POWER_CONFIGURATION_SERVER_PLUGIN_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/power_configuration_server/tr_power_configuration_server_cli.c
#define TR_POWER_CONFIGURATION_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print
#define TR_POWER_CONFIGURATION_SERVER_BATTERY_LATCHING
YES Bind

Remote CLI Client

This plugin enables the sending of Zigbee Command Line Interface command strings to other nodes on the Zigbee network. In order to receive the CLI commands and handle them appropriately, the recieving node must support the Remote CLI Server.

Define Value Optional Depends On Source Files Include Paths
#define TR_REMOTE_CLI_CLIENT_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_client/tr_remote_cli_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_client/tr_remote_cli_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_client
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_common
#define TR_REMOTE_CLI_CLIENT_CLI_ENABLE
YES Command Line Interface (CLI)
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_client/tr_remote_cli_client_cli.c
#define TR_REMOTE_CLI_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Remote CLI Server

This plugin enables Trident CLI command strings to be received over the air via Zigbee packets. The command strings are passed to the Zigbee Command Line Interface for parsing just like UART command strings are. The output from the CLI command execution is then packaged up and sent back out over Zigbee.

Define Value Optional Depends On Source Files Include Paths
#define TR_REMOTE_CLI_SERVER_PLUGIN_ENABLE
NO
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_server/tr_remote_cli_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_server/tr_remote_cli_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/utility/circular_buffer/tr_circular_buffer.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_server
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/remote_cli_common
${ZIGBEE_FRAMEWORK_PATH}/utility/circular_buffer
#define TR_REMOTE_CLI_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print
#define TR_REMOTE_CLI_SEND_BUFFER_SIZE 4096
size of remote cli transmit buffer YES
#define TR_REMOTE_CLI_SEND_PACKET_PAYLOAD_SIZE 47
max size of remote cli packet payload YES

Scenes Client

Implementation of the ZCL Scenes Client cluster. This is currently a wrapper of the existing ZBOSS ZCL implementation and will be updated to be a full Trident plugin soon.

Define Value Optional Depends On Source Files Include Paths
#define TR_SCENES_CLIENT_PLUGIN_ENABLE
NO
${ZBOSS_STABLE_PATH}/zcl/zcl_scenes.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_client/tr_scenes_client.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_client/tr_scenes_client_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_client
#define TR_SCENES_CLIENT_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print

Scenes Server

Implementation of the ZCL Scenes Server cluster. This is currently a wrapper of the existing ZBOSS ZCL implementation and will be updated to be a full Trident plugin soon.

Define Value Optional Depends On Source Files Include Paths
#define TR_SCENES_SERVER_PLUGIN_ENABLE
NO
${ZBOSS_STABLE_PATH}/zcl/zcl_scenes.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_server/tr_scenes_server.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_server/tr_scenes_server_cb_stubs.c
${ZIGBEE_FRAMEWORK_PATH}/plugin/zcl/scenes_server
#define TR_SCENES_SERVER_PLUGIN_PRINT_ENABLE 1
1 to enable, 0 to disable YES Debug Print