Developing with ZBOSS for Zigbee
|
Modules | |
General attributes' description | |
Types and macros shared among all attributes' definitions.Use ZB_ZCL_SET_ATTRIBUTE. | |
General frame description | |
Types and macros required for ZCL frame manipulations. | |
Fill ZCL packet low-level API | |
Types and macros shared fill Fill ZCL packet. | |
Data Structures | |
struct | zb_zcl_cluster_desc_s |
ZCL cluster description. More... | |
Macros | |
#define | ZB_ZCL_HI_MAX_PAYLOAD_SIZE 66U |
#define | ZB_ZCL_HI_WO_IEEE_MAX_PAYLOAD_SIZE 82U |
#define | ZB_ZCL_IS_CLUSTER_MANUF_SPEC(_cluster_id) ((_cluster_id) > 0xfbff) |
Check whether cluster is manufacturer specific. | |
#define | ZB_ZCL_MANUF_CODE_INVALID 0x0000 |
Internal invalid manufacturer code value. | |
#define | ZB_ZCL_GLOBAL_CLUSTER_VERSION_DEFAULT 1 |
ZCL global attribute: cluster version returned by default. Used if the GLOBAL_CLUSTER_REVISION attribute is undefined for the cluster/role. | |
#define | ZB_ZCL_ATTR_GET16(value) (*((zb_uint16_t *)value)) |
#define | ZB_ZCL_ATTR_GETS16(value) (*((zb_int16_t *)value)) |
#define | ZB_ZCL_ATTR_GET32(value) (*((zb_uint32_t *)value)) |
#define | ZB_ZCL_ATTR_GETS32(value) (*((zb_int32_t *)value)) |
#define | ZB_ZCL_ATTR_GET24(value) (*((zb_int24_t *)value)) |
#define | ZB_ZCL_ATTR_GET48(value) (*((zb_uint48_t *)value)) |
Typedefs | |
typedef void(* | zb_zcl_cluster_init_t) (void) |
ZCL Cluster Init Handler. This handler is called on registering device context (ZB_AF_REGISTER_DEVICE_CTX). Initialization of the cluster should include zb_zcl_add_cluster_handlers call, if any of the cluster handlers are implemented. More... | |
typedef zb_bool_t(* | zb_zcl_cluster_handler_t) (zb_uint8_t param) |
ZCL Cluster Command Handler. This handler is called on incoming ZCL command for corresponding cluster. More... | |
typedef zb_ret_t(* | zb_zcl_cluster_check_value_t) (zb_uint16_t attr_id, zb_uint8_t endpoint, zb_uint8_t *value) |
ZCL Cluster Check Value Handler. This handler is called before attribute change (for corresponding cluster) and checks if new value is in correct range and can be applied. More... | |
typedef void(* | zb_zcl_cluster_write_attr_hook_t) (zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value) |
ZCL Cluster Write Attribute Hook Handler. This handler is called before attribute change (if any cluster-specific action needs to be bound to attribute change, it can be placed in this handler). More... | |
typedef struct zb_zcl_cluster_desc_s | zb_zcl_cluster_desc_t |
ZCL cluster description. | |
typedef zb_uint16_t | zb_zcl_cluster_id_t |
Type for cluster roles in message exchange. More... | |
typedef enum zb_zcl_parse_status_e | zb_zcl_parse_status_t |
Parse frame operation status. | |
typedef enum zb_zcl_attribute_reporting_status_e | zb_zcl_attribute_reporting_status_t |
Attribute Reporting Status. | |
typedef zb_uint8_t | zb_zcl_status_t |
Type for ZCL status values. More... | |
typedef void(* | zb_zcl_modify_attr_value_cb_t) (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id, zb_uint8_t *value) |
Informs application that some attribute value is being updated by Write attribute command. More... | |
Enumerations | |
enum | zb_zcl_parse_status_e { ZB_ZCL_PARSE_STATUS_SUCCESS, ZB_ZCL_PARSE_STATUS_FAILURE } |
Parse frame operation status. More... | |
enum | zb_zcl_attribute_reporting_status_e { ZB_ZCL_AR_STATUS_PENDING =0x00, ZB_ZCL_AR_STATUS_COMPLETE =0x01 } |
Attribute Reporting Status. More... | |
Functions | |
zb_ret_t | zb_zcl_add_cluster_handlers (zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_zcl_cluster_check_value_t cluster_check_value, zb_zcl_cluster_write_attr_hook_t cluster_write_attr_hook, zb_zcl_cluster_handler_t cluster_handler) |
Add ZCL cluster handlers for Cluster ID and Cluster Role. More... | |
Cluster roles in message exchange | |
Note: These values were members of | |
#define | ZB_ZCL_CLUSTER_SERVER_ROLE 0x01U |
#define | ZB_ZCL_CLUSTER_CLIENT_ROLE 0x02U |
#define | ZB_ZCL_CLUSTER_ANY_ROLE 0x03U |
#define | ZB_ZCL_REVERT_CLUSTER_ROLE(_d) |
The section contains enumerations defining cluster identifiers and inter-device operation statuses, and a callback type used to notify application on attribute value change (see Write attributes command description).
#define ZB_ZCL_CLUSTER_ANY_ROLE 0x03U |
Internal value - used for searching any role (on the moment when cluster role is not known yet).
#define ZB_ZCL_CLUSTER_CLIENT_ROLE 0x02U |
Client cluster role
#define ZB_ZCL_CLUSTER_ID_ALARMS 0x0009U |
Alarms cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ANALOG_INPUT 0x000cU |
Analog input (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT 0x000dU |
Analog output (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ANALOG_VALUE 0x000eU |
Analog value (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS 0x0b02U |
Appliance events and alerts cluster identifier
#define ZB_ZCL_CLUSTER_ID_BALLAST_CONFIG 0x0301U |
Ballast configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_BASIC 0x0000U |
Basic cluster identifier.
#define ZB_ZCL_CLUSTER_ID_BINARY_INPUT 0x000fU |
Binary input (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_BINARY_OUTPUT 0x0010U |
Binary output (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_BINARY_VALUE 0x0011U |
Binary value (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_CALENDAR 0x0707U |
Calendar cluster identifier.
#define ZB_ZCL_CLUSTER_ID_COLOR_CONTROL 0x0300U |
Color control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_COMMISSIONING 0x0015U |
Commissioning cluster identifier.
#define ZB_ZCL_CLUSTER_ID_CUSTOM_ATTR 0xffeeU |
Custom Attributes
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE 0x070DU |
Daily Schedule cluster identifier.
#define ZB_ZCL_CLUSTER_ID_DEHUMID_CONTROL 0x203U |
Dehumidification control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_DEVICE_MANAGEMENT 0x0708U |
Device Management cluster identifier.
#define ZB_ZCL_CLUSTER_ID_DEVICE_TEMP_CONFIG 0x0002U |
Device temperature configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_DIAGNOSTICS 0x0b05U |
Home Automation Diagnostics
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK 0x0101U |
Door lock cluster identifier.
#define ZB_ZCL_CLUSTER_ID_DRLC 0x0701U |
Demand-Response cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT 0x0b04U |
Electrical Measurement cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT 0x0706U |
Energy Management cluster identifier.
#define ZB_ZCL_CLUSTER_ID_EVENTS 0x0709U |
Events cluster identifier.
#define ZB_ZCL_CLUSTER_ID_FAN_CONTROL 0x202U |
Fan control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_GREEN_POWER 0x0021U |
Green Power cluster identifier.
#define ZB_ZCL_CLUSTER_ID_GROUPS 0x0004U |
Groups cluster identifier.
#define ZB_ZCL_CLUSTER_ID_IAS_ACE 0x0501U |
IAS ACE cluster identifier
#define ZB_ZCL_CLUSTER_ID_IAS_WD 0x0502U |
IAS WD cluster identifier
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE 0x0500U |
IAS Zone cluster identifier
#define ZB_ZCL_CLUSTER_ID_IDENTIFY 0x0003U |
Identify cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT 0x0400U |
Illuminance measurement
#define ZB_ZCL_CLUSTER_ID_IR_BLASTER 0xfc01U |
Manufacturer specific IR Blaster cluster
#define ZB_ZCL_CLUSTER_ID_KEEP_ALIVE 0x0025U |
Keep Alive cluster identifier.
#define ZB_ZCL_CLUSTER_ID_KEY_ESTABLISHMENT 0x0800U |
Key Establishment cluster identifier.
#define ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL 0x0008U |
Level control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING 0x070AU |
MDU Pairing cluster identifier.
#define ZB_ZCL_CLUSTER_ID_MESSAGING 0x0703U |
Messaging cluster identifier.
#define ZB_ZCL_CLUSTER_ID_METER_IDENTIFICATION 0x0B01U |
Meter Identification cluster identifier
#define ZB_ZCL_CLUSTER_ID_METERING 0x0702U |
Metering cluster identifier.
#define ZB_ZCL_CLUSTER_ID_MULTI_INPUT 0x0012U |
Multistate input (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_MULTI_OUTPUT 0x0013U |
Multistate output (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_MULTI_VALUE 0x0014U |
Multistate value (basic) cluster identifier.
#define ZB_ZCL_CLUSTER_ID_OCCUPANCY_SENSING 0x0406U |
Occupancy sensing
#define ZB_ZCL_CLUSTER_ID_ON_OFF 0x0006U |
On/Off cluster identifier.
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG 0x0007U |
On/Off switch configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_OTA_UPGRADE 0x0019U |
Over The Air cluster identifier.
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL 0x0020U |
Poll control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_POWER_CONFIG 0x0001U |
Power configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_PREPAYMENT 0x0705U |
Prepayment cluster identifier.
#define ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT 0x0403U |
Pressure measurement
#define ZB_ZCL_CLUSTER_ID_PRICE 0x0700U |
Price cluster identifier.
#define ZB_ZCL_CLUSTER_ID_PUMP_CONFIG_CONTROL 0x200U |
Pump configuration and control cluster identifier.
#define ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT 0x0405U |
Relative humidity measurement
#define ZB_ZCL_CLUSTER_ID_RSSI_LOCATION 0x000bU |
RSSI location cluster identifier.
#define ZB_ZCL_CLUSTER_ID_SCENES 0x0005U |
Scenes cluster identifier.
#define ZB_ZCL_CLUSTER_ID_SHADE_CONFIG 0x0100U |
Shade configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_SUB_GHZ 0x070BU |
Sub-GHz cluster identifier.
#define ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT 0x0402U |
Temperature measurement
#define ZB_ZCL_CLUSTER_ID_THERMOSTAT 0x201U |
Thermostat cluster identifier.
#define ZB_ZCL_CLUSTER_ID_THERMOSTAT_UI_CONFIG 0x204U |
Thermostat user interface configuration cluster identifier.
#define ZB_ZCL_CLUSTER_ID_TIME 0x000aU |
Time cluster identifier.
#define ZB_ZCL_CLUSTER_ID_TUNNEL 0xfc00U |
Manufacturer specific Tunnel cluster
#define ZB_ZCL_CLUSTER_ID_TUNNELING 0x0704U |
Tunneling cluster identifier.
#define ZB_ZCL_CLUSTER_ID_WINDOW_COVERING 0x0102U |
Window covering cluster identifier.
#define ZB_ZCL_CLUSTER_ID_WWAH 0xFC57U |
Works with All Hubs cluster identifier
#define ZB_ZCL_CLUSTER_SERVER_ROLE 0x01U |
Server cluster role
#define ZB_ZCL_HI_MAX_PAYLOAD_SIZE 66U |
ZCL payload maximum size; is used to calculate number of available bytes in variable-size commands
Maximal payload size
#define ZB_ZCL_HI_WO_IEEE_MAX_PAYLOAD_SIZE 82U |
Maximal payload size without long address sending
#define ZB_ZCL_REVERT_CLUSTER_ROLE | ( | _d | ) |
Reverts cluster role
#define ZB_ZCL_STATUS_ABORT 0x95U |
Abort
#define ZB_ZCL_STATUS_ACTION_DENIED 0x93U |
The credentials presented by the device sending the command are not sufficient to perform this action.
#define ZB_ZCL_STATUS_CALIB_ERR 0xc2U |
Calibration error
#define ZB_ZCL_STATUS_DUPE_EXISTS 0x8aU |
Duplicate exists
#define ZB_ZCL_STATUS_FAIL 0x01U |
ZCL Fail
#define ZB_ZCL_STATUS_HW_FAIL 0xc0U |
Hardware failure
#define ZB_ZCL_STATUS_INCONSISTENT 0x92U |
Supplied values are inconsistent
#define ZB_ZCL_STATUS_INSUFF_SPACE 0x89U |
Insufficient space
#define ZB_ZCL_STATUS_INVALID_FIELD 0x85U |
Invalid field
#define ZB_ZCL_STATUS_INVALID_IMAGE 0x96U |
Invalid OTA upgrade image
#define ZB_ZCL_STATUS_INVALID_TYPE 0x8dU |
Invalid type
#define ZB_ZCL_STATUS_INVALID_VALUE 0x87U |
Invalid value
#define ZB_ZCL_STATUS_LIMIT_REACHED 0xc4U |
Cluster is not found on the target endpoint
#define ZB_ZCL_STATUS_MALFORMED_CMD 0x80U |
Malformed command
#define ZB_ZCL_STATUS_NOT_AUTHORIZED 0x7EU |
Server is not authorized to upgrade the client
#define ZB_ZCL_STATUS_NOT_FOUND 0x8bU |
Not found
#define ZB_ZCL_STATUS_NOTIFICATION_PENDING 0x9AU |
The command has been received and is being processed.
#define ZB_ZCL_STATUS_READ_ONLY 0x88U |
Read only
#define ZB_ZCL_STATUS_REQUIRE_MORE_IMAGE 0x99U |
The client still requires more OTA upgrade image files in order to successfully upgrade.
#define ZB_ZCL_STATUS_SUCCESS 0x00U |
ZCL Success
#define ZB_ZCL_STATUS_SW_FAIL 0xc1U |
Software failure
#define ZB_ZCL_STATUS_TIMEOUT 0x94U |
Timeout
#define ZB_ZCL_STATUS_UNREPORTABLE_ATTRIB 0x8cU |
Unreportable attribute
#define ZB_ZCL_STATUS_UNSUP_ATTRIB 0x86U |
Unsupported attribute
#define ZB_ZCL_STATUS_UNSUP_CLUST 0xc3U |
Cluster is not found on the target endpoint
#define ZB_ZCL_STATUS_UNSUP_CLUST_CMD 0x81U |
Unsupported cluster command
#define ZB_ZCL_STATUS_UNSUP_GEN_CMD 0x82U |
Unsupported general command
#define ZB_ZCL_STATUS_UNSUP_MANUF_CLUST_CMD 0x83U |
Unsupported manuf-specific clust command
#define ZB_ZCL_STATUS_UNSUP_MANUF_GEN_CMD 0x84U |
Unsupported manuf-specific general command
#define ZB_ZCL_STATUS_WAIT_FOR_DATA 0x97U |
Server does not have data block available yet No OTA upgrade image available for a particular client.
#define ZB_ZCL_STATUS_WRITE_ONLY 0x8fU |
Write only
typedef zb_ret_t(* zb_zcl_cluster_check_value_t) (zb_uint16_t attr_id, zb_uint8_t endpoint, zb_uint8_t *value) |
ZCL Cluster Check Value Handler. This handler is called before attribute change (for corresponding cluster) and checks if new value is in correct range and can be applied.
attr_id | - ZCL Attribute ID |
endpoint | - Device Endpoint |
value | - pointer to the new Attribute Value |
typedef zb_bool_t(* zb_zcl_cluster_handler_t) (zb_uint8_t param) |
ZCL Cluster Command Handler. This handler is called on incoming ZCL command for corresponding cluster.
param | - pointer to buffer with ZCL command |
typedef zb_uint16_t zb_zcl_cluster_id_t |
Type for cluster roles in message exchange.
Holds one of zcl_cluster_id. Kept for backward compatibility as zcl_cluster_id were declared previously as enum.
typedef void(* zb_zcl_cluster_init_t) (void) |
ZCL Cluster Init Handler. This handler is called on registering device context (ZB_AF_REGISTER_DEVICE_CTX). Initialization of the cluster should include zb_zcl_add_cluster_handlers call, if any of the cluster handlers are implemented.
Cluster Init handler is bound to the cluster declaration via ZB_ZCL_CLUSTER_DESC macro. Every cluster should implement "<cluster_id>_<cluster_role>_INIT" macro, for example:
If cluster does not have any initialization steps and does not need any cluster handlers, Cluster Init handler may be NULL, for example:
typedef void(* zb_zcl_cluster_write_attr_hook_t) (zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value) |
ZCL Cluster Write Attribute Hook Handler. This handler is called before attribute change (if any cluster-specific action needs to be bound to attribute change, it can be placed in this handler).
endpoint | - Device Endpoint |
attr_id | - ZCL Attribute ID |
value | - pointer to the new Attribute Value |
typedef void(* zb_zcl_modify_attr_value_cb_t) (zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id, zb_uint8_t *value) |
Informs application that some attribute value is being updated by Write attribute command.
ep | - endpoint number |
cluster_id | - cluster ID |
attr_id | - attribute ID of the attribute being updated |
value | - pointer to new data |
typedef zb_uint8_t zb_zcl_status_t |
Type for ZCL status values.
Holds one of zcl_status. Kept only for backward compatibility as zcl_status were declared previously as enum.
zb_ret_t zb_zcl_add_cluster_handlers | ( | zb_uint16_t | cluster_id, |
zb_uint8_t | cluster_role, | ||
zb_zcl_cluster_check_value_t | cluster_check_value, | ||
zb_zcl_cluster_write_attr_hook_t | cluster_write_attr_hook, | ||
zb_zcl_cluster_handler_t | cluster_handler | ||
) |
Add ZCL cluster handlers for Cluster ID and Cluster Role.
cluster_id | - ZCL Cluster ID |
cluster_role | - ZCL Cluster Role, see zcl_cluster_role |
cluster_check_value | - "Check Value" handler, see zb_zcl_cluster_check_value_t; may be NULL if this handler is not needed |
cluster_write_attr_hook | - "Write Attr Hook" handler, see zb_zcl_cluster_write_attr_hook_t; may be NULL if this handler is not needed |
cluster_handler | - "Cluster Commands" handler, see zb_zcl_cluster_handler_t; may be NULL if this handler is not needed |