Trident IoT Zigbee SDK
Loading...
Searching...
No Matches
tr_scenes_server.h
Go to the documentation of this file.
1
10#ifndef TR_SCENES_SERVER_H
11#define TR_SCENES_SERVER_H
12
13#include "tr_af.h"
14
18#if defined(TR_SCENES_SERVER_PLUGIN_PRINT_ENABLE) && (TR_SCENES_SERVER_PLUGIN_PRINT_ENABLE == 1)
19#define tr_scenes_server_printf(...) tr_zcl_printf(__VA_ARGS__)
20#define tr_scenes_server_println(...) tr_zcl_println(__VA_ARGS__)
21#else
22#define tr_scenes_server_printf(...)
23#define tr_scenes_server_println(...)
24#endif
25
26// maximum size of scene name
27#define TR_SCENES_SERVER_SCENE_NAME_MAX_LEN 16
28
29#define TR_SCENES_SERVER_MAX_GROUP_ID 0xFFF7
30#define TR_SCENES_SERVER_MIN_GROUP_ID 1
31
32// *******************************************************************
33// scene extensions lengths
34// support on/off, level control, and door lock currently
35// *******************************************************************
36#define TR_SCENES_SERVER_EXT_LEVEL_CONTROL_LEN 4
37#define TR_SCENES_SERVER_EXT_ON_OFF_LEN 4
38#define TR_SCENES_SERVER_EXT_DOOR_LOCK_LEN 4
39// max if we have ALL extensions which is needed for parsing the packet
40#define TR_SCENES_SERVER_EXT_EXPECTED_LEN \
41 (TR_SCENES_SERVER_EXT_LEVEL_CONTROL_LEN \
42 + TR_SCENES_SERVER_EXT_ON_OFF_LEN \
43 + TR_SCENES_SERVER_EXT_DOOR_LOCK_LEN)
44
45// onOff (4) + level (4) + thermostat (14) + door lock(4)
46#define TR_SCENES_SERVER_EXT_MAX_LEN 26
47
48// *******************************************************************
49// struct for entries in the scene table
50// *******************************************************************
51typedef struct
52{
53 zb_uint8_t endpoint;
54 zb_uint16_t group_id;
55 zb_uint8_t scene_id;
56 zb_uint16_t transition_time;
59 zb_uint8_t ext_on_off_value;
61 zb_uint8_t ext_level_value;
65
71
75
79zb_bool_t tr_scenes_server_command_received_cb(zb_zcl_parsed_hdr_t *cmd_info);
80
87 zb_uint16_t attr_id,
88 zb_uint8_t *new_value,
89 zb_uint16_t manuf_code);
90
101zb_bool_t tr_scenes_server_add_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
102 zb_uint8_t endpoint,
103 zb_uint16_t group_id,
104 zb_uint8_t scene_id,
105 zb_uint16_t transition_time,
106 zb_uint8_t *scene_name,
107 zb_uint8_t *extension_field_sets,
108 zb_uint8_t extensions_len);
109
116zb_bool_t tr_scenes_server_view_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
117 zb_uint8_t endpoint,
118 zb_uint16_t group_id,
119 zb_uint8_t scene_id);
120
127zb_bool_t tr_scenes_server_remove_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
128 zb_uint8_t endpoint,
129 zb_uint16_t group_id,
130 zb_uint8_t scene_id);
131
137zb_bool_t tr_scenes_server_remove_all_scenes_cb(zb_zcl_parsed_hdr_t *cmd_info,
138 zb_uint8_t endpoint,
139 zb_uint16_t group_id);
140
147zb_bool_t tr_scenes_server_store_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
148 zb_uint8_t endpoint,
149 zb_uint16_t group_id,
150 zb_uint8_t scene_id);
151
159zb_bool_t tr_scenes_server_recall_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
160 zb_uint8_t endpoint,
161 zb_uint16_t group_id,
162 zb_uint8_t scene_id,
163 zb_uint16_t transition_time);
164
170zb_bool_t tr_scenes_server_get_scene_membership_cb(zb_zcl_parsed_hdr_t *cmd_info,
171 zb_uint8_t endpoint,
172 zb_uint16_t group_id);
173
184zb_bool_t tr_scenes_server_enhanced_add_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
185 zb_uint8_t endpoint,
186 zb_uint16_t group_id,
187 zb_uint8_t scene_id,
188 zb_uint16_t transition_time,
189 zb_uint8_t *scene_name,
190 zb_uint8_t *extension_field_sets,
191 zb_uint8_t extensions_len);
192
199zb_bool_t tr_scenes_server_enhanced_view_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
200 zb_uint8_t endpoint,
201 zb_uint16_t group_id,
202 zb_uint8_t scene_id);
203
213zb_bool_t tr_scenes_server_copy_scene_cb(zb_zcl_parsed_hdr_t *cmd_info,
214 zb_uint8_t endpoint,
215 zb_uint8_t mode,
216 zb_uint16_t group_id_from,
217 zb_uint8_t scene_id_from,
218 zb_uint16_t group_id_to,
219 zb_uint8_t scene_id_to);
220
226 tr_scenes_table_entry_t *scene_entry);
227
236void tr_scenes_server_message_sent_cb(zb_bufid_t param);
237
239
245
246#endif // TR_SCENES_SERVER_H
zb_uint8_t scene_id_from
Definition tr_zcl_cmd_structs.h:182
zb_uint16_t group_id_to
Definition tr_zcl_cmd_structs.h:183
zb_uint8_t scene_id_to
Definition tr_zcl_cmd_structs.h:184
zb_uint8_t * extension_field_sets
Definition tr_zcl_cmd_structs.h:116
zb_uint16_t group_id_from
Definition tr_zcl_cmd_structs.h:181
zb_uint8_t mode
Definition tr_zcl_cmd_structs.h:180
zb_bool_t tr_scenes_server_add_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id, zb_uint16_t transition_time, zb_uint8_t *scene_name, zb_uint8_t *extension_field_sets, zb_uint8_t extensions_len)
Callback that user can declare to handle scenes cluster add scene command.
zb_bool_t tr_scenes_server_recall_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id, zb_uint16_t transition_time)
Callback that user can declare to handle scenes cluster recall scene command.
zb_bool_t tr_scenes_server_get_scene_membership_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id)
Callback that user can declare to handle scenes cluster get scene membership command.
zb_bool_t tr_scenes_server_enhanced_add_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id, zb_uint16_t transition_time, zb_uint8_t *scene_name, zb_uint8_t *extension_field_sets, zb_uint8_t extensions_len)
Callback that user can declare to handle scenes cluster enhanced add scene command.
zb_bool_t tr_scenes_server_command_received_cb(zb_zcl_parsed_hdr_t *cmd_info)
Callback that user can declare to handle any Scenes server commands.
zb_bool_t tr_scenes_server_view_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id)
Callback that user can declare to handle scenes cluster view scene command.
void tr_scenes_server_message_sent_cb(zb_bufid_t param)
Callback fires when scenes plugin response has a message sent status. This status is based on the APS...
void tr_scenes_server_init_cb(zb_uint8_t endpoint)
Callback fires when the Scenes server cluster plugin is initialized.
zb_bool_t tr_scenes_server_copy_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint8_t mode, zb_uint16_t group_id_from, zb_uint8_t scene_id_from, zb_uint16_t group_id_to, zb_uint8_t scene_id_to)
Callback that user can declare to handle scenes cluster copy scene command.
zb_bool_t tr_scenes_server_remove_all_scenes_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id)
Callback that user can declare to handle scenes cluster remove all scenes command.
zb_bool_t tr_scenes_server_store_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id)
Callback that user can declare to handle scenes cluster store scene command.
zb_bool_t tr_scenes_server_remove_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id)
Callback that user can declare to handle scenes cluster remove scene command.
zb_bool_t tr_scenes_server_scene_is_activated_cb(zb_uint8_t endpoint, tr_scenes_table_entry_t *scene_entry)
Callback that fires when a scene is activated.
zb_bool_t tr_scenes_server_enhanced_view_scene_cb(zb_zcl_parsed_hdr_t *cmd_info, zb_uint8_t endpoint, zb_uint16_t group_id, zb_uint8_t scene_id)
Callback that user can declare to handle scenes cluster enhanced view scene command.
void tr_scenes_server_write_attr_cb(zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value, zb_uint16_t manuf_code)
Callback fires when an Scenes server attribute is about to be written.
Definition tr_scenes_server.h:52
zb_bool_t ext_on_off_present
Definition tr_scenes_server.h:58
zb_bool_t ext_door_lock_present
Definition tr_scenes_server.h:62
zb_uint16_t group_id
Definition tr_scenes_server.h:54
zb_uint8_t scene_id
Definition tr_scenes_server.h:55
zb_uint16_t transition_time
Definition tr_scenes_server.h:56
zb_uint8_t ext_on_off_value
Definition tr_scenes_server.h:59
zb_bool_t ext_level_present
Definition tr_scenes_server.h:60
zb_uint8_t endpoint
Definition tr_scenes_server.h:53
zb_uint8_t scene_name[TR_SCENES_SERVER_SCENE_NAME_MAX_LEN]
Definition tr_scenes_server.h:57
zb_uint8_t ext_level_value
Definition tr_scenes_server.h:61
zb_uint8_t ext_door_lock_value
Definition tr_scenes_server.h:63
Trident application framework include.
zb_uint16_t group_id
Definition tr_groups_server.h:25
zb_uint8_t endpoint
Definition tr_nvram_attr.h:176
zb_uint16_t manuf_code
Definition tr_nvram_attr.h:180
zb_uint16_t attr_id
Definition tr_nvram_attr.h:178
zb_uint8_t scene_name[TR_SCENES_COMMON_SCENE_NAME_MAX_LEN]
Definition tr_scenes_common.h:50
zb_uint8_t scene_id
Definition tr_scenes_common.h:40
zb_uint16_t transition_time
Definition tr_scenes_common.h:49
void tr_scenes_server_init(void)
#define TR_SCENES_SERVER_SCENE_NAME_MAX_LEN
Definition tr_scenes_server.h:27
void tr_scenes_server_register_nv(void)