Trident IoT Zigbee SDK
Loading...
Searching...
No Matches
tr_zcl_common.h File Reference

entry point for all incoming ZCL messages More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tr_zcl_cmd_handler_status_t

Macros

#define TR_ZCL_INVALID_ENDPOINT_NUMBER   0xFF
#define TR_ZCL_INVALID_INSTANCE_NUMBER   0xFF
#define TR_ZCL_FRAME_DIRECTION_TO_SERVER   0x00U
#define TR_ZCL_FRAME_DIRECTION_TO_CLIENT   0x01U
#define TR_ZCL_FRAME_TYPE_MASK   0x03
#define TR_ZCL_FRAME_TYPE_GLOBAL   0x00
#define TR_ZCL_FRAME_TYPE_SPECIFIC   0x01
#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_CLIENT(buf_ptr)
#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_SERVER(buf_ptr)

Enumerations

enum  tr_zcl_cmd_handler_enum_t {
  TR_ZCL_CMD_HDLR_USER_PROCESSED = 0 ,
  TR_ZCL_CMD_HDLR_PLUGIN_SENT_RESPONSE = 1 ,
  TR_ZCL_CMD_HDLR_ATTEMPT_DEF_RESP = 2
}

Functions

zb_uint8_t tr_zcl_command_cb (zb_uint8_t param)
 callback that can be defined in the user application to handle incoming ZCL messages
zb_uint8_t tr_zcl_specific_cluster_cmd_handler (zb_uint8_t param)
 called when a ZCL command is received
zb_uint8_t tr_zcl_get_endpoint_by_cluster (zb_uint8_t ep_instance, zb_uint16_t cluster_id, zb_uint16_t cluster_role)
 get the endpoint number of the cluster at specified index in list of endpoints
zb_uint8_t tr_zcl_get_instance_by_cluster (zb_uint8_t endpoint_looking_for, zb_uint16_t cluster_id, zb_uint16_t cluster_role)
 get the endpoint number of the cluster by index
void tr_zcl_send_default_resp (zb_uint8_t param, zb_zcl_parsed_hdr_t *cmd_info, tr_zcl_cmd_handler_status_t handler_status, zb_uint16_t cluster_id)
 determines whether or not to send a default response
void tr_zcl_send_cluster_command_resp (zb_bufid_t buffer, zb_zcl_parsed_hdr_t *cmd_info, zb_uint16_t cluster_id, zb_uint8_t direction, zb_uint8_t zcl_cmd, zb_uint8_t payload_len, zb_uint8_t *payload, zb_callback_t sent_callback)
 used by cluster plugins to send a response and re-use the buffer for the command received
void tr_zcl_plugin_attributes_ready (void)
 this is called once the attributes are loaded from NVM
char * tr_zcl_find_cluster_name (zb_uint16_t cluster_id)
 get cluster name based on cluster ID

Detailed Description

entry point for all incoming ZCL messages


SPDX-License-Identifier: LicenseRef-TridentMSLA SPDX-FileCopyrightText: 2025 Trident IoT, LLC https://www.tridentiot.com


Macro Definition Documentation

◆ TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_CLIENT

#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_CLIENT ( buf_ptr)
Value:
(ZB_ZCL_CONSTRUCT_SET_FRAME_CONTROL(*(buf_ptr), \
ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
(buf_ptr)++)
#define TR_GLOBAL_RESPONSE_POLICY
Definition tr_zcl_endpoint_config.h:22
#define TR_ZCL_FRAME_DIRECTION_TO_CLIENT
Definition tr_zcl_common.h:18

◆ TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_SERVER

#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_SERVER ( buf_ptr)
Value:
(ZB_ZCL_CONSTRUCT_SET_FRAME_CONTROL(*(buf_ptr), \
ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
(buf_ptr)++)
#define TR_ZCL_FRAME_DIRECTION_TO_SERVER
Definition tr_zcl_common.h:17

◆ TR_ZCL_FRAME_DIRECTION_TO_CLIENT

#define TR_ZCL_FRAME_DIRECTION_TO_CLIENT   0x01U

◆ TR_ZCL_FRAME_DIRECTION_TO_SERVER

#define TR_ZCL_FRAME_DIRECTION_TO_SERVER   0x00U

◆ TR_ZCL_FRAME_TYPE_GLOBAL

#define TR_ZCL_FRAME_TYPE_GLOBAL   0x00

◆ TR_ZCL_FRAME_TYPE_MASK

#define TR_ZCL_FRAME_TYPE_MASK   0x03

◆ TR_ZCL_FRAME_TYPE_SPECIFIC

#define TR_ZCL_FRAME_TYPE_SPECIFIC   0x01

◆ TR_ZCL_INVALID_ENDPOINT_NUMBER

#define TR_ZCL_INVALID_ENDPOINT_NUMBER   0xFF

◆ TR_ZCL_INVALID_INSTANCE_NUMBER

#define TR_ZCL_INVALID_INSTANCE_NUMBER   0xFF

Enumeration Type Documentation

◆ tr_zcl_cmd_handler_enum_t

Enumerator
TR_ZCL_CMD_HDLR_USER_PROCESSED 
TR_ZCL_CMD_HDLR_PLUGIN_SENT_RESPONSE 
TR_ZCL_CMD_HDLR_ATTEMPT_DEF_RESP 

Function Documentation

◆ tr_zcl_find_cluster_name()

char * tr_zcl_find_cluster_name ( zb_uint16_t cluster_id)

get cluster name based on cluster ID

Parameters
cluster_idcluster ID to get name for
Returns
name of the cluster

◆ tr_zcl_get_endpoint_by_cluster()

zb_uint8_t tr_zcl_get_endpoint_by_cluster ( zb_uint8_t ep_instance,
zb_uint16_t cluster_id,
zb_uint16_t cluster_role )

get the endpoint number of the cluster at specified index in list of endpoints

Parameters
ep_instanceendpoint instance indexed at 0
cluster_idZCL cluster ID
cluster_roleclient or server side
Returns
endpoint number

◆ tr_zcl_get_instance_by_cluster()

zb_uint8_t tr_zcl_get_instance_by_cluster ( zb_uint8_t endpoint_looking_for,
zb_uint16_t cluster_id,
zb_uint16_t cluster_role )

get the endpoint number of the cluster by index

Parameters
endpoint_looking_forwhich endpoint number to look for
cluster_idZCL cluster ID
cluster_roleclient or server side
Returns
endpoint instance indexed at 0

◆ tr_zcl_plugin_attributes_ready()

void tr_zcl_plugin_attributes_ready ( void )

this is called once the attributes are loaded from NVM

◆ tr_zcl_send_cluster_command_resp()

void tr_zcl_send_cluster_command_resp ( zb_bufid_t buffer,
zb_zcl_parsed_hdr_t * cmd_info,
zb_uint16_t cluster_id,
zb_uint8_t direction,
zb_uint8_t zcl_cmd,
zb_uint8_t payload_len,
zb_uint8_t * payload,
zb_callback_t sent_callback )

used by cluster plugins to send a response and re-use the buffer for the command received

Parameters
bufferzb_bufid_t of the buffer to re-use
cmd_infostruct that contains zcl header info
cluster_idZCL cluster ID to use when sending
directioneither ZB_ZCL_FRAME_DIRECTION_TO_SRV or ZB_ZCL_FRAME_DIRECTION_TO_CLI
zcl_cmdone byte value representing the ZCL command to send for the cluster ID specified
payload_lenlength of the ZCL payload (does not include the ZCL header)
payloadpointer to an array of bytes that is the payload. length is specified in prior argument
sent_callbackpointer to a function to be called when the send is complete so the status of the sent command can be read. If sent_callback is NULL, the Zigbee stack will free the internal buffer. If sent_callback is not NULL, the callback is responsible for freeing the buffer by calling zb_buf_free().

◆ tr_zcl_send_default_resp()

void tr_zcl_send_default_resp ( zb_uint8_t param,
zb_zcl_parsed_hdr_t * cmd_info,
tr_zcl_cmd_handler_status_t handler_status,
zb_uint16_t cluster_id )

determines whether or not to send a default response

Parameters
paramzb_bufid_t of a buffer
cmd_infostruct that contains zcl header info
handler_statusstruct that contains ZCL status and info used to make send decision
cluster_idZCL cluster ID

◆ tr_zcl_specific_cluster_cmd_handler()

zb_uint8_t tr_zcl_specific_cluster_cmd_handler ( zb_uint8_t param)

called when a ZCL command is received

Parameters
paramget ZCL packet info using: zb_zcl_parsed_hdr_t *cmd_info = ZB_BUF_GET_PARAM(param, zb_zcl_parsed_hdr_t);
Returns
tr_zcl_command_cb