2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef __TIZEN_CAPI_NETWORK_ZIGBEE_PRIVATE_H__
17 #define __TIZEN_CAPI_NETWORK_ZIGBEE_PRIVATE_H__
23 #include <tizen_type.h>
26 #include <zigbee-zdo_internal.h>
27 #include <zigbee-zcl_internal.h>
30 * @file zigbee_private.h
34 * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
35 * @brief The events for zb_event_cb().
40 ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT = 0x06, /**< A device updated its network information */
41 ZB_ZDP_BIND_RSP_EVENT = 0x07, /**< Binding end-points result */
42 ZB_ZDP_UNBIND_RSP_EVENT = 0x08, /**< Unbinding end-points result */
43 ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT = 0x11, /**< This event is took place when report attribute command is received */
44 ZB_ZCL_ALARM_EVENT = 0x20, /**< Events related to alarm cluster */
45 ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT = 0x30, /**< This event will be received after level control cluster attribute changed */
46 ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT = 0x31, /**< This event will be received after color control cluster X attribute changed */
47 ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT = 0x32, /**< This event will be received after color control cluster Y attribute changed */
48 ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT = 0x33, /**< This event will be received after color control cluster hue attribute changed */
49 ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT = 0x34, /**< This event will be received after color control cluster saturation attribute changed */
50 ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT = 0x35, /**< This event will be received after color control cluster temperature attribute changed */
51 ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT = 0x40, /**< This event is received when door-lock operation has been finished */
52 ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT = 0x41, /**< This event is received when door-lock programming has been changed */
53 ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT = 0x51, /**< This event is used to request the ESP to remove its mirror of Metering */
54 ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT = 0x52, /**< This event is used to request the ESP to mirror Metering Device data */
58 * @brief Called after getting end-device information.
62 * @remarks The @a child should not be released.
63 * The @a child can be used only in the callback. To use outside, make a copy
65 * @param[out] index nth child
66 * @param[out] child handle of a end-device
67 * @param[out] user_data user data
69 * @return #ZIGBEE_FUNC_CONTINUE to continue iteration, otherwise #ZIGBEE_FUNC_STOP to stop iteration.
70 * @retval #ZIGBEE_FUNC_CONTINUE Continue iteration
71 * @retval #ZIGBEE_FUNC_STOP Stop iteration
73 * @pre The callback must be registered when using zb_devices_info_foreach_end_device()
75 * @see zb_foreach_end_dev_info()
77 typedef bool (*zb_end_dev_info_cb)(int index, zb_end_dev_info_h child, void *user_data);
80 * @brief Calls a function for each children end-point of parent.
84 * @privilege %http://tizen.org/privilege/zigbee
86 * @param[in] list handle of end-devices parent
87 * @param[in] cb zb_end_dev_info_cb()
88 * @param[in] user_data user data
90 * @return 0 on success, otherwise a negative error value.
91 * @retval #ZIGBEE_ERROR_NONE Successful
92 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
93 * @retval #ZIGBEE_ERROR_PERMISSION_DENIED Permission denied
94 * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
96 * @see zb_end_dev_info_cb()
98 int zb_foreach_end_dev_info(zb_end_dev_info_h *list,
99 zb_end_dev_info_cb cb, void *user_data);
103 * @brief Gets the records of the received global command.
106 * @remarks The returned records are managed by the platform and will be released when
107 * caller's stack is released
108 * @remarks The returned records is a variable or a set of variables that represent the
109 * functional state of the cluster. The records are characterized by a name, data type,
110 * range, access type (read/write), and report ability. Attributes are defined to be
111 * mandatory/ optional per cluster. (see more #zb_zcl_global_rec_data_s.)
113 * @param[in] ev Event data structure
114 * @param[out] records Set of attributes
115 * @param[out] count The number of attributes
117 * @return 0 on success, otherwise a negative error value.
118 * @retval #ZIGBEE_ERROR_NONE Successful
119 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
120 * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
123 int zb_ev_get_global_attr_report_records(zb_event_data_h ev,
124 zb_zcl_attr_report_h* records, unsigned char *count);
127 * @brief Gets the alarm count.
130 * @param[in] ev Event data structure
131 * @param[out] count Alarm count
133 * @return 0 on success, otherwise a negative error value.
134 * @retval #ZIGBEE_ERROR_NONE Successful
135 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
136 * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
139 int zb_ev_get_alarm_count(zb_event_data_h ev, unsigned short* count);
144 * @brief Resets chip for the zigbee transceiver.
145 * @details If the Zigbee transceiver works abnormally, this function do HW reset.
148 * @privlevel platform
149 * @privilege %http://tizen.org/privilege/zigbee.admin
151 * @param[in] handle The handle of zigbee
153 * @return 0 on success, otherwise a negative error value.
154 * @retval #ZIGBEE_ERROR_NONE Successful
155 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
156 * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
157 * @retval #ZIGBEE_ERROR_PERMISSION_DENIED Permission denied
158 * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
161 int zb_hw_reset(zb_zigbee_h handle);
166 * @brief Switches channel when an occupied channel is noisy.
167 * @details When noisy, do energy scan and active scan to switch operational channel.
170 * @privlevel platform
171 * @privilege %http://tizen.org/privilege/zigbee.admin
173 * @param[in] handle The handle of zigbee
174 * @param[in] channel target channel number to switch
176 * @return 0 on success, otherwise a negative error value.
177 * @retval #ZIGBEE_ERROR_NONE Successful
178 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
179 * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
180 * @retval #ZIGBEE_ERROR_PERMISSION_DENIED Permission denied
182 * @see zb_coex_stop()
185 int zb_coex_start(zb_zigbee_h handle, unsigned char channel);
190 * @brief Stops channel switching operation.
191 * @details Halt current operation related to channel switching.
194 * @privlevel platform
195 * @privilege %http://tizen.org/privilege/zigbee.admin
197 * @param[in] handle The handle of zigbee
199 * @return 0 on success, otherwise a negative error value.
200 * @retval #ZIGBEE_ERROR_NONE Successful
201 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
202 * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
203 * @retval #ZIGBEE_ERROR_PERMISSION_DENIED Permission denied
205 * @see zb_coex_start()
208 int zb_coex_stop(zb_zigbee_h handle);
213 * @brief Sets start-up attribute set.
214 * @details In order to ensure interoperability, all ZigBee HA devices should implement
215 * compatible Startup Attribute Sets (SAS). This does not mean that set must be
216 * modifiable through a commissioning cluster, but that the device must internally
217 * implement these stack settings to ensure compatibility and consistent user
218 * experience. The start up set parameters described by the Commissioning cluster
219 * provide a good basis to specify a HA startup set.
222 * @privlevel platform
223 * @privilege %http://tizen.org/privilege/zigbee.admin
225 * @param[in] handle The handle of zigbee
226 * @param[in] pan_id Short address
227 * @param[in] epan_id Usually 00-50-C2-77-10-00-00-00 is the global commissioning EPID
228 * @param[in] channel_mask Channel mask
229 * @param[in] start_control Start control
230 * @param[in] trust_center_addr Trust center addr
231 * @param[in] master_key Master key
232 * @param[in] master_key_len Master key length
233 * @param[in] network_key Network key
234 * @param[in] network_key_len Network key length
235 * @param[in] default_link_key_join Default link key join
237 * @return 0 on success, otherwise a negative error value.
238 * @retval #ZIGBEE_ERROR_NONE Successful
239 * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
240 * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
241 * @retval #ZIGBEE_ERROR_PERMISSION_DENIED Permission denied
242 * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
244 int zb_zdo_set_compatible_startup_parameters(
247 zb_ieee_addr epan_id,
248 unsigned int channel_mask,
249 unsigned char start_control,
250 zb_ieee_addr trust_center_addr,
251 const unsigned char *master_key,
252 unsigned char master_key_len,
253 const unsigned char *network_key,
254 unsigned char network_key_len,
255 unsigned char default_link_key_join);
262 #endif /* __TIZEN_CAPI_NETWORK_ZIGBEE_PRIVATE_H__ */