Digi XBee(R) ANSI C Host Library
|
Header for implementation of ZigBee Cluster Library. More...
Go to the source code of this file.
Data Structures | |
struct | zcl_header_common_t |
Common portion of ZCL header (appears after optional Manufacturer Code) More... | |
struct | zcl_header_t |
General header for casting onto an incoming frame. More... | |
struct | zcl_header_response_t |
ZCL header structure used for building response frames that may or may not be manufacturer-specific. More... | |
struct | zcl_header_withmfg_t |
ZLC header structure used when building a manufacturer-specific response frame. More... | |
struct | zcl_header_nomfg_t |
ZLC header structure used when building a normal (non-manufacturer-specific response frame. More... | |
struct | zcl_attrib_t |
General format for an attribute, used for Write Attributes and Report Attributes commands. More... | |
struct | zcl_rec_read_attrib_resp_t |
Used for ZCL_CMD_READ_ATTRIB_RESP. More... | |
struct | zcl_rec_read_attrib_error_resp_t |
struct | zcl_rec_read_attrib_array_resp_t |
< one of ZCL_TYPE_ARRAY, ZCL_TYPE_SET, ZCL_TYPE_BAG More... | |
struct | zcl_rec_read_attrib_struct_resp_t |
< always ZCL_TYPE_STRUCT number of elements to follow mult. More... | |
struct | zcl_rec_write_attrib_status_t |
Used for ZCL_CMD_WRITE_ATTRIB_RESP. More... | |
struct | zcl_rec_report_send_t |
struct | zcl_rec_report_receive_t |
union | zcl_rec_reporting_config_t |
struct | zcl_rec_reporting_status_t |
struct | zcl_rec_read_report_cfg_t |
struct | zcl_rec_report_error_resp_t |
struct | zcl_rec_report_send_resp_t |
struct | zcl_rec_report_receive_resp_t |
struct | zcl_default_response_t |
Used for ZCL_CMD_DEFAULT_RESP. More... | |
struct | zcl_discover_attrib_t |
Used for ZCL_CMD_DISCOVER_ATTRIB. More... | |
struct | zcl_rec_attrib_report_t |
Used for ZCL_CMD_DISCOVER_ATTRIB_RESP. More... | |
struct | zcl_discover_attrib_resp_t |
Used for ZCL_CMD_DISCOVER_ATTRIB_RESP. More... | |
struct | zcl_selector_t |
struct | zcl_read_struct_attrib_t |
struct | zcl_rec_write_struct_attrib_t |
struct | zcl_rec_write_struct_attrib_resp_t |
union | zcl_attribute_minmax_t |
struct | zcl_attribute_write_rec_t |
struct | zcl_attribute_base_t |
Basic structure for storing a list of attributes in a cluster. More... | |
struct | zcl_attribute_full_t |
Use this structure for attributes with min/max values or the need to have a read/write function. More... | |
struct | zcl_array_t |
If a zcl_attribute_base_t has a type of ZCL_TYPE_ARRAY, its .value points to this structure. More... | |
struct | zcl_struct_element_t |
A zcl_struct_t contains an array of these elements, describing each element in the structure and its offset from the zcl_struct_t.base_address. More... | |
struct | zcl_struct_t |
If a zcl_attribute_base_t has a type of ZCL_TYPE_STRUCT, its .value points to this structure. More... | |
struct | zcl_attribute_tree_t |
struct | zcl_command_t |
Structure populated by zcl_command_build() with the ZCL header from a received ZCL command frame. More... | |
Macros | |
#define | ZCL_CMD_MATCH(p, mfg, dir, type) |
Macro for checking the frame control field of a ZCL command. More... | |
#define | ZCL_CMD_IS_PROFILE(p) (ZCL_FRAME_TYPE_PROFILE == (*(const uint8_t FAR *)(p) & ZCL_FRAME_TYPE_MASK)) |
Identify profile commands (as opposed to cluster commands) using the frame control field of a ZCL command. More... | |
#define | ZCL_CMD_IS_MFG_CLUSTER(p) |
Identify manufacturer-specific cluster commands using the frame control field of a ZCL command. More... | |
#define | ZCL_CMD_IS_CLUSTER(p) |
Identify cluster commands that are not manufacturer-specific, using the frame control field of a ZCL command. More... | |
#define | ZCL_DIRECTION_SEND 0x00 |
#define | ZCL_DIRECTION_RECEIVE 0x01 |
#define | ZCL_ATTR_WRITE_FLAG_NONE 0x00 |
#define | ZCL_ATTR_WRITE_FLAG_ASSIGN 0x01 |
Assign the new value to the attribute (if not set, just checks the validity of the data). More... | |
#define | ZCL_ATTR_WRITE_FLAG_WRITE_REQ 0x00 |
Parsing a Write Attribute Request record. | |
#define | ZCL_ATTR_WRITE_FLAG_READ_RESP 0x02 |
Parsing a Read Attribute Response record. | |
#define | ZCL_ATTRIBUTE_END_OF_LIST 0xFFFF |
Attribute ID for end of list marker. | |
#define | ZCL_MFG_NONE 0x0000 |
Typedefs | |
typedef uint_fast8_t(* | zcl_attribute_update_fn) (const struct zcl_attribute_full_t FAR *entry) |
Function pointer assigned to a ZCL attribute record, called to update the value of the given attribute. More... | |
typedef int(* | zcl_attribute_write_fn) (const struct zcl_attribute_full_t FAR *entry, zcl_attribute_write_rec_t *rec) |
Function pointer assigned to a ZCL attribute record, called instead of zcl_decode_attribute() to process a Write Request for the attribute. More... | |
Functions | |
const char * | zcl_status_text (uint_fast8_t status) |
Converts a ZCL status byte (one of the ZCL_STATUS_* macros) into a string. More... | |
int | zcl_command_build (zcl_command_t *cmd, const wpan_envelope_t FAR *envelope, zcl_attribute_tree_t FAR *tree) |
Parse a ZCL request and store in a zcl_command_t structure with fields in fixed locations (therefore easier to use than the variable-length frame header). More... | |
void | zcl_command_dump (const zcl_command_t *cmd) |
Debugging routine that dumps contents of a parsed ZCL command structure to STDOUT. More... | |
void | zcl_envelope_payload_dump (const wpan_envelope_t *envelope) |
Debugging routine that parses an envelope payload as a ZCL command and dumps a parsed copy to STDOUT. More... | |
int | zcl_general_command (const wpan_envelope_t FAR *envelope, void FAR *context) |
Handler for ZCL General Commands. More... | |
int | zcl_invalid_cluster (const wpan_envelope_t FAR *envelope, wpan_ep_state_t FAR *ep_state) |
Called if a request comes in for an invalid endpoint/cluster combination. More... | |
int | zcl_invalid_command (const wpan_envelope_t FAR *envelope) |
Called if a request comes in for an invalid command on a valid endpoint/cluster combination. More... | |
int | zcl_build_header (zcl_header_response_t *rsp, zcl_command_t *cmd) |
Support function to fill in a ZCL response header. More... | |
int | zcl_parse_attribute_record (const zcl_attribute_base_t FAR *entry, zcl_attribute_write_rec_t *write_rec) |
Parse an attribute record from a Write Attributes Request or a Read Attributes Response and possibly store the new attribute value. More... | |
int | zcl_default_response (zcl_command_t *request, uint8_t status) |
Send a Default Response (ZCL_CMD_DEFAULT_RESP) to a given command. More... | |
int | zcl_check_minmax (const zcl_attribute_base_t FAR *entry, const uint8_t FAR *buffer_le) |
Checks whether a new value from a Write Attributes command is within the limits specified for a given attribute. More... | |
uint32_t | zcl_convert_24bit (const void FAR *value_le, bool_t extend_sign) |
Convert a 24-bit (3-byte) little-endian value to a 32-bit value in host byte order. More... | |
int | zcl_decode_attribute (const zcl_attribute_base_t FAR *entry, zcl_attribute_write_rec_t *rec) |
Decode attribute value from a Write Attribute Request or Read Attribute Response record and optionally write to entry . More... | |
int | zcl_encode_attribute_value (uint8_t FAR *buffer, int16_t bufsize, const zcl_attribute_base_t FAR *entry) |
Format a ZCL attribute's value for a Read Attributes Response or a Write Attributes Request. More... | |
const zcl_attribute_base_t FAR * | zcl_attribute_get_next (const zcl_attribute_base_t FAR *entry) |
Return a pointer to the next attribute entry from an attribute table. More... | |
const zcl_attribute_base_t FAR * | zcl_find_attribute (const zcl_attribute_base_t FAR *entry, uint16_t search_id) |
Search the attribute table starting at entry , for attribute ID search_id . More... | |
int | zcl_send_response (zcl_command_t *request, const void FAR *response, uint16_t length) |
Send a response to a ZCL command. More... | |
Variables | |
const zcl_attribute_tree_t FAR | zcl_attributes_none [1] |
If a cluster doesn't have attributes, use zcl_attributes_none (a single, empty attribute list) in the cluster definition. More... | |
0x0100-0x01ff Closure Clusters | |
#define | ZCL_CLUST_SHADE_CONFIG 0x0100 |
0x0300-0x03ff Lighting Clusters | |
#define | ZCL_CLUST_COLOR_CONTROL 0x0300 |
#define | ZCL_CLUST_BALLAST_CONFIG 0x0301 |
0x0500-0x05ff Security and Safety Clusters | |
#define | ZCL_CLUST_IAS_ZONE 0x0500 |
#define | ZCL_CLUST_IAS_ACE 0x0501 |
#define | ZCL_CLUST_IAS_WD 0x0502 |
0x0600-0x06ff Protocol Interface Clusters | |
#define | ZCL_CLUST_GENERIC_TUNNEL 0x0600 |
#define | ZCL_CLUST_BACNET_TUNNEL 0x0601 |
#define | ZCL_CLUST_BACNET_REG_ANALOG_IN 0x0602 |
#define | ZCL_CLUST_BACNET_EXT_ANALOG_IN 0x0603 |
#define | ZCL_CLUST_BACNET_REG_ANALOG_OUT 0x0604 |
#define | ZCL_CLUST_BACNET_EXT_ANALOG_OUT 0x0605 |
#define | ZCL_CLUST_BACNET_REG_ANALOG_VALUE 0x0606 |
#define | ZCL_CLUST_BACNET_EXT_ANALOG_VALUE 0x0607 |
#define | ZCL_CLUST_BACNET_REG_BINARY_IN 0x0608 |
#define | ZCL_CLUST_BACNET_EXT_BINARY_IN 0x0609 |
#define | ZCL_CLUST_BACNET_REG_BINARY_OUT 0x060a |
#define | ZCL_CLUST_BACNET_EXT_BINARY_OUT 0x060b |
#define | ZCL_CLUST_BACNET_REG_BINARY_VALUE 0x060c |
#define | ZCL_CLUST_BACNET_EXT_BINARY_VALUE 0x060d |
#define | ZCL_CLUST_BACNET_REG_MULTI_IN 0x060e |
#define | ZCL_CLUST_BACNET_EXT_MULTI_IN 0x060f |
#define | ZCL_CLUST_BACNET_REG_MULTI_OUT 0x0610 |
#define | ZCL_CLUST_BACNET_EXT_MULTI_OUT 0x0611 |
#define | ZCL_CLUST_BACNET_REG_MULTI_VALUE 0x0612 |
#define | ZCL_CLUST_BACNET_EXT_MULTI_VALUE 0x0613 |
Bit masks for the frame_control field of a ZCL header (zcl_header_t, zcl_header_response_t, zcl_header_withmfg_t, or zcl_header_nomfg_t) | |
#define | ZCL_FRAME_TYPE_MASK 0x03 |
Bits of frame type. | |
#define | ZCL_FRAME_TYPE_PROFILE 0x00 |
cmd acts across entire profile | |
#define | ZCL_FRAME_TYPE_CLUSTER 0x01 |
cmd is specific to a cluster | |
#define | ZCL_FRAME_TYPE_RESERVED1 0x02 |
#define | ZCL_FRAME_TYPE_RESERVED2 0x03 |
#define | ZCL_FRAME_GENERAL 0x00 |
mfg code field not present | |
#define | ZCL_FRAME_MFG_SPECIFIC 0x04 |
mfg code field present | |
#define | ZCL_FRAME_DIRECTION 0x08 |
direction bit | |
#define | ZCL_FRAME_CLIENT_TO_SERVER 0 |
cmd sent from client to server | |
#define | ZCL_FRAME_SERVER_TO_CLIENT ZCL_FRAME_DIRECTION |
cmd sent from server to client | |
#define | ZCL_FRAME_DISABLE_DEF_RESP 0x10 |
default response only on error | |
#define | ZCL_FRAME_RESERVED_BITS 0xE0 |
should be set to 0 | |
ZCL General Command IDs | |
Used for the .command element of the ZCL header. Command IDs 0x11 to 0x7F (Standard ZigBee command) and 0x80 to 0xFF are reserved.
| |
#define | ZCL_CMD_READ_ATTRIB 0x00 |
Read Attributes Command, payload is 1 to n 2-byte attribute IDs. | |
#define | ZCL_CMD_READ_ATTRIB_RESP 0x01 |
Read Attributes Response Command, payload is 1 to n variable-length Read Attribute Status records (zcl_rec_read_attrib_status_t). More... | |
#define | ZCL_CMD_WRITE_ATTRIB 0x02 |
Write Attributes Command, payload is 1 to n variable-length Write Attribute Record fields (same as zcl_attrib_t). More... | |
#define | ZCL_CMD_WRITE_ATTRIB_UNDIV 0x03 |
Write Attributes Undivided Command, same payload as Write Attributes Command (zcl_attrib_t), but attributes are only written if all attributes can be written successfully. More... | |
#define | ZCL_CMD_WRITE_ATTRIB_RESP 0x04 |
Write Attributes Response Command, payload is a single byte (ZCL_STATUS_SUCCESS) if all writes were successful or 1 to n 3-byte Write Attribute Status records (zcl_rec_write_attrib_status_t) for each write that failed. | |
#define | ZCL_CMD_WRITE_ATTRIB_NORESP 0x05 |
Write Attributes No Response Command, same payload as Write Attributes Command (ZCL_CMD_WRITE_ATTRIB), handled as a Write Attributes Command except the response is not sent. More... | |
#define | ZCL_CMD_CONFIGURE_REPORT 0x06 |
#define | ZCL_CMD_CONFIGURE_REPORT_RESP 0x07 |
#define | ZCL_CMD_READ_REPORT_CFG 0x08 |
#define | ZCL_CMD_READ_REPORT_CFG_RESP 0x09 |
#define | ZCL_CMD_REPORT_ATTRIB 0x0a |
#define | ZCL_CMD_DEFAULT_RESP 0x0b |
Default Response Command, payload is 2 bytes; Command ID and Status Code (zcl_default_response_t). More... | |
#define | ZCL_CMD_DISCOVER_ATTRIB 0x0c |
Discover Attributes Command, payload is 3 bytes; start attribute ID and maximum number of attributes to return (zcl_discover_attrib_t). More... | |
#define | ZCL_CMD_DISCOVER_ATTRIB_RESP 0x0d |
Discover Attributes Response Command payload is a "discovery complete" byte (done = ZCL_BOOL_TRUE, more attributes = ZCL_BOOL_TRUE), followed by 1 to n 3-byte Attribute Report fields (zcl_rec_attrib_report_t). More... | |
#define | ZCL_CMD_READ_STRUCT_ATTRIB 0x0e |
#define | ZCL_CMD_WRITE_STRUCT_ATTRIB 0x0f |
#define | ZCL_CMD_WRITE_STRUCT_ATTRIB_RESP 0x10 |
Values for | |
#define | ZCL_ATTRIB_FLAG_NONE 0x00 |
no flags | |
#define | ZCL_ATTRIB_FLAG_WRITEONLY 0x01 |
attribute is write-only | |
#define | ZCL_ATTRIB_FLAG_READONLY 0x02 |
attribute is read-only | |
#define | ZCL_ATTRIB_FLAG_HAS_MIN 0x04 |
/c min value set | |
#define | ZCL_ATTRIB_FLAG_HAS_MAX 0x08 |
/c max value set | |
#define | ZCL_ATTRIB_FLAG_REPORTABLE 0x10 |
attribute is reportable | |
#define | ZCL_ATTRIB_FLAG_UNUSED1 0x20 |
unused flag for future use | |
#define | ZCL_ATTRIB_FLAG_RAW 0x40 |
Data is stored as sent/received in ZCL requests (little-endian, 24-bit types stored as 3 bytes instead of 4). More... | |
#define | ZCL_ATTRIB_FLAG_FULL 0x80 |
If set, this is part of a zcl_attribute_full_t structure. | |
Header for implementation of ZigBee Cluster Library.
Type definitions and frame formats.
Based on document 075123r01ZB, updated for 075123r02ZB
Even though the XBee modules uses big-endian byte order for its API, the payload data should be in the correct format for Rabbit (little-endian). Multi-byte variables and structure members use an "_le" suffix if the value is little-endian, a "_be" suffix if the value is big-endian, and no suffix if the value is in host byte order.
See xbee/byteorder.h for functions to convert between big/little-endian and host byte order.
#define ZCL_ATTR_WRITE_FLAG_ASSIGN 0x01 |
Assign the new value to the attribute (if not set, just checks the validity of the data).
Referenced by _zcl_comm_startup_control_set(), _zcl_identify_time_set(), _zcl_time_time_set(), _zcl_time_timestatus_set(), _zcl_write_attributes(), zcl_decode_attribute(), zcl_parse_attribute_record(), and zcl_process_read_attr_response().
#define ZCL_ATTRIB_FLAG_RAW 0x40 |
Data is stored as sent/received in ZCL requests (little-endian, 24-bit types stored as 3 bytes instead of 4).
Not applicable to string types.
Referenced by _zcl_comm_startup_control_set(), zcl_decode_attribute(), and zcl_encode_attribute_value().