Command Discovery

The ZCL provides the facility to discover the commands that a cluster instance on a remote device can receive and generate. This is useful since an individual cluster instance may not be able to receive or generate all of the commands that are theoretically supported by the cluster.

The commands that are supported by a cluster (and that can therefore potentially be discovered) are defined in a Command Definition table which is enabled in the cluster definition when Command Discovery is enabled (see Section 6.1.2).

Two ZCL functions are provided to implement the Command Discovery feature (as indicated in Section 2.9.1 below and fully described in Section 5.3).

Discovering Command Sets

The commands supported by a remote cluster instance can be discovered as described below.

Discovering commands that can be received

The commands that can be received by an instance of a cluster on a remote device can be discovered using the function

eZCL_SendDiscoverCommandReceivedRequest()

This function sends a request to the remote cluster instance, which responds with a list of commands (identified by their Command IDs). On receiving this response, the following events are generated on the local device:

  • E_ZCL_CBET_DISCOVER_INDIVIDUAL_COMMAND_RECEIVED_RESPONSE

    • This event is generated for each individual command reported in the response. The reported information is contained in a structure of the type tsZCL_CommandDiscoveryIndividualResponse (see Section 6.1.17).

  • E_ZCL_CBET_DISCOVER_COMMAND_RECEIVED_RESPONSE

    • This event is generated after all the above individual events, in order to indicate the end of these events. The reported information is contained in a structure of the type tsZCL_CommandDiscoveryResponse (see Section 6.1.18).

Discovering commands that can be generated

The commands that can be generated by an instance of a cluster on a remote device can be discovered using the function

eZCL_SendDiscoverCommandGeneratedRequest()

This function sends a request to the remote cluster instance, which responds with a list of commands (identified by their Command IDs). On receiving this response, the following events are generated on the local device:

  • E_ZCL_CBET_DISCOVER_INDIVIDUAL_COMMAND_GENERATED_RESPONSE

    • This event is generated for each individual command reported in the response. The reported information is contained in a structure of the type tsZCL_CommandDiscoveryIndividualResponse (see Section 6.1.17).

  • E_ZCL_CBET_DISCOVER_COMMAND_GENERATED_RESPONSE

    • This event is generated after all the above individual events, in order to indicate the end of these events. The reported information is contained in a structure of the type tsZCL_CommandDiscoveryResponse (see Section 6.1.18).

Note: The above functions can be called multiple times to discover the commands in stages. After each call, the tsZCL_CommandDiscoveryResponse structure contains a Boolean flag which indicates whether there are more commands to be discovered (see Section 6.1.18). For complete details, refer to the function descriptions in Section 5.3.

Parent topic:Command Discovery

Compile-time Options

If required, the Command Discovery feature must be enabled at compile-time.

To enable the feature, the following must be defined at both the local and remote ends:

#define ZCL_COMMAND_DISCOVERY_SUPPORTED

To enable the handling of Command Discovery requests and the generation of responses at the remote end, the following must be defined on the remote device:

#define ZCL_COMMAND_RECEIVED_DISCOVERY_SERVER_SUPPORTED
#define ZCL_COMMAND_GENERATED_DISCOVERY_SERVER_SUPPORTED

To enable the handling of Command Discovery responses at the local end, the following must be defined on the local device:

#define ZCL_COMMAND_RECEIVED_DISCOVERY_CLIENT_SUPPORTED
#define ZCL_COMMAND_GENERATED_DISCOVERY_CLIENT_SUPPORTED

Parent topic:Command Discovery

Parent topic:ZCL Fundamentals and Features