![]() |
Developing with ZBOSS for Zigbee
|
Modules | |
ZCL common types | |
Data Structures | |
struct | zb_zcl_command_send_status_s |
struct | zb_zcl_set_attr_value_param_s |
Declare for change attribute for User Application. More... | |
Macros | |
#define | ZB_ZCL_FIX_ENDIAN(data_ptr, data_type) |
Fix data endian, if needed, and store it in the same buffer. More... | |
#define | ZB_ZCL_PROCESS_COMMAND_FINISH(buffer, pcmd_info, status) zb_zcl_process_command_finish(buffer, pcmd_info, status) |
#define | ZB_ZCL_PROCESS_COMMAND_FINISH_NEW(buffer, pcmd_info, status) zb_zcl_process_command_finish_new(buffer, pcmd_info, status) |
Typedefs | |
typedef struct zb_zcl_command_send_status_s | zb_zcl_command_send_status_t |
typedef void(* | zb_zcl_set_default_value_attr_cb_t) (zb_uint8_t ep) |
Set default value attribute callback. More... | |
typedef zb_ret_t(* | zb_zcl_app_check_attr_value_cb_t) (zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *value) |
Check attribute value callback. More... | |
typedef struct zb_zcl_set_attr_value_param_s | zb_zcl_set_attr_value_param_t |
Declare for change attribute for User Application. More... | |
Functions | |
zb_zcl_attr_t * | zb_zcl_get_attr_desc (zb_zcl_cluster_desc_t *cluster_desc, zb_uint16_t attr_id) |
Get registered attribute description by cluster descriptor. More... | |
zb_uint8_t | zb_zcl_check_attribute_writable (zb_zcl_attr_t *attr_desc, zb_uint8_t endpoint, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint8_t *new_value, zb_bool_t check_access) |
Check registered attribute is writable one. More... | |
void | zb_zcl_write_attr_hook (zb_uint8_t endpoint, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint8_t *new_value) |
zb_uint8_t | zb_zcl_get_attribute_size (zb_uint8_t attr_type, zb_uint8_t *attr_value) |
Get size of value of given attribute type. More... | |
zb_uint8_t | zb_zcl_get_analog_attribute_size (zb_uint8_t attr_type) |
Get size of analog data type. More... | |
zb_bool_t | zb_zcl_is_analog_data_type (zb_uint8_t attr_type) |
Check whether type of ZCL attrbiute is analog. More... | |
zb_ret_t | zb_zcl_check_attr_value (zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *value) |
Check if attribute value is valid or not. More... | |
zb_bool_t | zb_zcl_is_target_endpoint (zb_af_endpoint_desc_t *ep_desc, zb_uint16_t profile_id) |
zb_uint8_t | zb_zcl_get_next_target_endpoint (zb_uint8_t start_from_ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t profile_id) |
zb_zcl_cluster_desc_t * | get_cluster_desc (const zb_af_endpoint_desc_t *ep_desc, zb_uint16_t cluster_id, zb_uint8_t cluster_role) |
Search endpoint for cluster with given id. More... | |
zb_uint8_t | get_endpoint_by_cluster (zb_uint16_t cluster_id, zb_uint8_t cluster_role) |
Find endpoint which has cluster with given ID. More... | |
zb_bool_t | is_cluster_present (zb_uint16_t cluster_id) |
Find if device has cluster with given ID. More... | |
zb_uint16_t | get_profile_id_by_endpoint (zb_uint8_t endpoint_id) |
zb_af_endpoint_desc_t * | get_endpoint_by_cluster_with_role (zb_uint16_t cluster_id, zb_uint8_t cluster_role) |
Find endpoint which has cluster with given ID and role. More... | |
zb_zcl_attr_t * | zb_zcl_get_attr_desc_a (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id) |
zb_uint8_t * | zb_zcl_put_value_to_packet (zb_uint8_t *cmd_ptr, zb_uint8_t attr_type, zb_uint8_t *attr_value) |
zb_zcl_status_t | zb_zcl_set_attr_val (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint8_t *value, zb_bool_t check_access) |
Sets attribute value, perform all needed checks before and after setting new value. More... | |
zb_ret_t | zb_zcl_register_cb (zb_uint8_t param, zb_callback_t cb) |
Register callback that should be called when APS acknowledge is received for ZCL command. More... | |
zb_ret_t | zb_zcl_ack_callback (zb_uint8_t param) |
Call callback on receiving APS acknowledge for ZCL command. More... | |
zb_uint8_t | zb_zcl_check_accept_command (zb_uint8_t param) |
void | zb_zcl_process_command_finish (zb_bufid_t buffer, zb_zcl_parsed_hdr_t *pcmd_info, zb_uint8_t status) |
Common continue command. More... | |
void | zb_zcl_process_command_finish_new (zb_bufid_t buffer, zb_zcl_parsed_hdr_t *pcmd_info, zb_uint8_t status) |
#define ZB_ZCL_FIX_ENDIAN | ( | data_ptr, | |
data_type | |||
) |
Fix data endian, if needed, and store it in the same buffer.
data_ptr | - pointer to data value |
data_type | - ZCL data type |
typedef zb_ret_t(* zb_zcl_app_check_attr_value_cb_t) (zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *value) |
Check attribute value callback.
cluster_id | - Cluster ID |
cluster_role | - cluster role (zcl_cluster_role) |
endpoint | - endpoint number |
attr_id | - attribute ID |
value | - new attribute value |
typedef struct zb_zcl_command_send_status_s zb_zcl_command_send_status_t |
Command send status structure
typedef struct zb_zcl_set_attr_value_param_s zb_zcl_set_attr_value_param_t |
Declare for change attribute for User Application.
typedef void(* zb_zcl_set_default_value_attr_cb_t) (zb_uint8_t ep) |
Set default value attribute callback.
ep | - endpoint number |
zb_zcl_cluster_desc_t* get_cluster_desc | ( | const zb_af_endpoint_desc_t * | ep_desc, |
zb_uint16_t | cluster_id, | ||
zb_uint8_t | cluster_role | ||
) |
Search endpoint for cluster with given id.
ep_desc | - application endpoint description |
cluster_id | - cluster ID (see zcl_cluster_id) |
cluster_role | - role (see zcl_cluster_role) |
zb_uint8_t get_endpoint_by_cluster | ( | zb_uint16_t | cluster_id, |
zb_uint8_t | cluster_role | ||
) |
Find endpoint which has cluster with given ID.
cluster_id | - cluster ID (see zcl_cluster_id) |
cluster_role | - role (see zcl_cluster_role) |
zb_af_endpoint_desc_t* get_endpoint_by_cluster_with_role | ( | zb_uint16_t | cluster_id, |
zb_uint8_t | cluster_role | ||
) |
Find endpoint which has cluster with given ID and role.
cluster_id | - cluster ID (see zcl_cluster_id) |
cluster_role | - role (see zcl_cluster_role) |
zb_bool_t is_cluster_present | ( | zb_uint16_t | cluster_id | ) |
Find if device has cluster with given ID.
cluster_id | - cluster ID (see zcl_cluster_id) |
zb_ret_t zb_zcl_ack_callback | ( | zb_uint8_t | param | ) |
Call callback on receiving APS acknowledge for ZCL command.
param | - buffer with ZCL command |
zb_uint8_t zb_zcl_check_accept_command | ( | zb_uint8_t | param | ) |
Check whether ZCL command should be handled by stack
param | - reference to buffer with parsed ZCL command |
zb_ret_t zb_zcl_check_attr_value | ( | zb_uint16_t | cluster_id, |
zb_uint8_t | cluster_role, | ||
zb_uint8_t | endpoint, | ||
zb_uint16_t | attr_id, | ||
zb_uint8_t * | value | ||
) |
Check if attribute value is valid or not.
cluster_id | - cluster ID |
cluster_role | - cluster role (zcl_cluster_role) |
endpoint | - endpoint |
attr_id | - attribute ID |
value | - pointer to attribute data |
zb_uint8_t zb_zcl_check_attribute_writable | ( | zb_zcl_attr_t * | attr_desc, |
zb_uint8_t | endpoint, | ||
zb_uint16_t | cluster_id, | ||
zb_uint8_t | cluster_role, | ||
zb_uint8_t * | new_value, | ||
zb_bool_t | check_access | ||
) |
Check registered attribute is writable one.
attr_desc | - attribute descriptor |
endpoint | - endpoint |
cluster_id | - cluster identifier |
cluster_role | - cluster role (zcl_cluster_role) |
new_value | - new value for an attribute |
check_access | - check READ_ONLY access or not |
zb_uint8_t zb_zcl_get_analog_attribute_size | ( | zb_uint8_t | attr_type | ) |
Get size of analog data type.
attr_type | - attribute type in question (see zcl_attr_type) |
zb_zcl_attr_t* zb_zcl_get_attr_desc | ( | zb_zcl_cluster_desc_t * | cluster_desc, |
zb_uint16_t | attr_id | ||
) |
Get registered attribute description by cluster descriptor.
cluster_desc | - cluster descriptor |
attr_id | - attribute identifier |
zb_zcl_attr_t* zb_zcl_get_attr_desc_a | ( | zb_uint8_t | ep, |
zb_uint16_t | cluster_id, | ||
zb_uint8_t | cluster_role, | ||
zb_uint16_t | attr_id | ||
) |
Find attribute descriptor by given endpoint number, cluster ID and attribute ID
ep | - endpoint number (must exist) |
cluster_id | - cluster ID (must exist on given ep, see zb_zcl_cluster_id_t) |
cluster_role | - role (see zcl_cluster_role) |
attr_id | - attribute ID |
zb_uint8_t zb_zcl_get_attribute_size | ( | zb_uint8_t | attr_type, |
zb_uint8_t * | attr_value | ||
) |
Get size of value of given attribute type.
attr_type | - attribute type in question (see zcl_attr_type) |
attr_value | - pointer to value in question (needed for variable sized types) |
zb_bool_t zb_zcl_is_analog_data_type | ( | zb_uint8_t | attr_type | ) |
Check whether type of ZCL attrbiute is analog.
attr_type | - attribute type in question (see zcl_attr_type) |
void zb_zcl_process_command_finish | ( | zb_bufid_t | buffer, |
zb_zcl_parsed_hdr_t * | pcmd_info, | ||
zb_uint8_t | status | ||
) |
Common continue command.
Usually use after invoke User App. If invoke User App finished with error (status!=RET_OK), send error response, else if not disabled default response send it or free buffer
buffer | - buffer for send response |
pcmd_info | - pointer of cmd_info (see zb_zcl_parsed_hdr_s) |
status | - status of operation (see zb_zcl_status_t) |
zb_uint8_t* zb_zcl_put_value_to_packet | ( | zb_uint8_t * | cmd_ptr, |
zb_uint8_t | attr_type, | ||
zb_uint8_t * | attr_value | ||
) |
Put attribute value to command packet, fix endian if needed.
cmd_ptr | - pointer to destination |
attr_type | - type of attribute being written (see zcl_attr_type) |
attr_value | - pointer to value to be put into packet |
zb_ret_t zb_zcl_register_cb | ( | zb_uint8_t | param, |
zb_callback_t | cb | ||
) |
Register callback that should be called when APS acknowledge is received for ZCL command.
param | - pointer to buffer with ZCL command |
cb | - pointer to callback function |
zb_zcl_status_t zb_zcl_set_attr_val | ( | zb_uint8_t | ep, |
zb_uint16_t | cluster_id, | ||
zb_uint8_t | cluster_role, | ||
zb_uint16_t | attr_id, | ||
zb_uint8_t * | value, | ||
zb_bool_t | check_access | ||
) |
Sets attribute value, perform all needed checks before and after setting new value.
ep | - endpoint number |
cluster_id | - cluster ID (see zb_zcl_cluster_id_t) |
cluster_role | - role (see zcl_cluster_role) |
attr_id | - ID of the attribute being set |
value | - pointer to new value |
check_access | - whether read-only check should be performed |
void zb_zcl_write_attr_hook | ( | zb_uint8_t | endpoint, |
zb_uint16_t | cluster_id, | ||
zb_uint8_t | cluster_role, | ||
zb_uint16_t | attr_id, | ||
zb_uint8_t * | new_value | ||
) |
Hook on Write Attribute command
endpoint | - endpoint |
cluster_id | - cluster ID |
cluster_role | - cluster role (zcl_cluster_role) |
attr_id | - attribute ID |
new_value | - pointer to newly assigned value |