Trident IoT Zigbee SDK
Loading...
Searching...
No Matches
tr_zcl_common.h
Go to the documentation of this file.
1
10#ifndef TR_ZCL_COMMON_H
11#define TR_ZCL_COMMON_H
12
13#define TR_ZCL_INVALID_ENDPOINT_NUMBER 0xFF
14#define TR_ZCL_INVALID_INSTANCE_NUMBER 0xFF
15
16// ZCL frame direction
17#define TR_ZCL_FRAME_DIRECTION_TO_SERVER 0x00U
18#define TR_ZCL_FRAME_DIRECTION_TO_CLIENT 0x01U
19
20// ZCL frame control type field
21#define TR_ZCL_FRAME_TYPE_MASK 0x03
22#define TR_ZCL_FRAME_TYPE_GLOBAL 0x00
23#define TR_ZCL_FRAME_TYPE_SPECIFIC 0x01
24
25// *****************************************************************************
26// this macro sets a ZCL frame control byte in the buffer passed in and then
27// increments the buffer.
28// This one is for server-to-client commands from the ZCL plugins.
29// the ZCL frame control byte is set to:
30// 1. cluster specific command,
31// 2. not mfg specific,
32// 3. use the Trident global policy for default responses to this command
33// *****************************************************************************
34#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_CLIENT(buf_ptr) \
35 (ZB_ZCL_CONSTRUCT_SET_FRAME_CONTROL(*(buf_ptr), \
36 ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
37 ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
38 TR_ZCL_FRAME_DIRECTION_TO_CLIENT, \
39 TR_GLOBAL_RESPONSE_POLICY), \
40 (buf_ptr)++)
41
42// *****************************************************************************
43// this macro sets a ZCL frame control byte in the buffer passed in and then
44// increments the buffer.
45// This one is for client-to-server commands from the ZCL plugins.
46// the ZCL frame control byte is set to:
47// 1. cluster specific command,
48// 2. not mfg specific,
49// 3. use the Trident global policy for default responses to this command
50// *****************************************************************************
51#define TR_ZCL_CONSTRUCT_FRAME_CONTROL_TO_SERVER(buf_ptr) \
52 (ZB_ZCL_CONSTRUCT_SET_FRAME_CONTROL(*(buf_ptr), \
53 ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
54 ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
55 TR_ZCL_FRAME_DIRECTION_TO_SERVER, \
56 TR_GLOBAL_RESPONSE_POLICY), \
57 (buf_ptr)++)
58
59// *****************************************************************************
60// enum used in tr_zcl_cmd_handler_status_t struct
61// USER_PROCESSED = user handled, no default resp, no buffer free
62// SENT_RESPONSE = cmd had a resp, no default resp, no buffer free
63// ATTEMPT_DEF_RESP = send a def resp unless disabled && status == SUCCESS
64// *****************************************************************************
72
73// *****************************************************************************
74// struct for specifying if a default resp should be tried or not
75// *****************************************************************************
81
87
93zb_uint8_t tr_zcl_command_cb(zb_uint8_t param);
94
96
100zb_uint8_t tr_zcl_specific_cluster_cmd_handler(zb_uint8_t param);
101
107zb_uint8_t tr_zcl_get_endpoint_by_cluster(zb_uint8_t ep_instance,
108 zb_uint16_t cluster_id,
109 zb_uint16_t cluster_role);
110
116zb_uint8_t tr_zcl_get_instance_by_cluster(zb_uint8_t endpoint_looking_for,
117 zb_uint16_t cluster_id,
118 zb_uint16_t cluster_role);
119
125void tr_zcl_send_default_resp(zb_uint8_t param,
126 zb_zcl_parsed_hdr_t *cmd_info,
127 tr_zcl_cmd_handler_status_t handler_status,
128 zb_uint16_t cluster_id);
129
142 zb_zcl_parsed_hdr_t *cmd_info,
143 zb_uint16_t cluster_id,
144 zb_uint8_t direction,
145 zb_uint8_t zcl_cmd,
146 zb_uint8_t payload_len,
147 zb_uint8_t *payload,
148 zb_callback_t sent_callback);
149
152
157
158#endif /* TR_ZCL_COMMON_H */
zb_uint8_t * buffer
Definition tr_zcl_cmd_structs.h:3277
zb_uint8_t direction
Definition tr_zcl_cmd_structs.h:1564
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
Definition tr_zcl_common.h:77
zb_uint8_t zcl_status
Definition tr_zcl_common.h:79
tr_zcl_cmd_handler_enum_t status
Definition tr_zcl_common.h:78
zb_uint16_t cluster_id
Definition tr_nvram_attr.h:177
zb_uint8_t cluster_role
Definition tr_nvram_attr.h:179
zb_uint8_t payload[TR_THERMOSTAT_SERVER_MAX_SET_CMD_PAYLOAD]
Definition tr_thermostat_server.h:48
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
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_plugin_attributes_ready(void)
this is called once the attributes are loaded from NVM
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
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
char * tr_zcl_find_cluster_name(zb_uint16_t cluster_id)
get cluster name based on cluster ID
tr_zcl_cmd_handler_enum_t
Definition tr_zcl_common.h:66
@ TR_ZCL_CMD_HDLR_USER_PROCESSED
Definition tr_zcl_common.h:67
@ TR_ZCL_CMD_HDLR_PLUGIN_SENT_RESPONSE
Definition tr_zcl_common.h:68
@ TR_ZCL_CMD_HDLR_ATTEMPT_DEF_RESP
Definition tr_zcl_common.h:69