|
XBee Firmware Library
1.6.0
|
Files | |
| file | zcl_client.c |
| file | zcl_client.h |
Data Structures | |
| struct | zcl_client_read |
Typedefs | |
| typedef XBEE_BEGIN_DECLS struct zcl_client_read | zcl_client_read_t |
| typedef const char *(* | zcl_format_utctime_fn) (char dest[40], zcl_utctime_t utctime) |
Functions | |
| const char * | _zcl_format_utctime (char dest[40], zcl_utctime_t utctime) |
| int | _zcl_send_read_from_zdo_match (wpan_conversation_t FAR *conversation, const wpan_envelope_t FAR *envelope) |
| int | zcl_client_read_attributes (wpan_envelope_t FAR *envelope, const zcl_client_read_t *client_read) |
Send a Read Attributes request for attributes listed in client_read. More... | |
| int | zcl_create_attribute_records (void FAR *buffer, uint8_t bufsize, const zcl_attribute_base_t FAR **p_attr_list) |
| From a list of attributes, write ID (in little-endian byte order), type and value to a buffer as would be done in a Write Attributes Request. More... | |
| int | zcl_find_and_read_attributes (wpan_dev_t *dev, const uint16_t *clusters, const zcl_client_read_t FAR *cr) |
| Use ZDO Match Descriptor Requests to find devices with a given profile/cluster and then automatically send a ZCL Read Attributes request for some of that cluster's attributes. More... | |
| int | zcl_print_array_value (const void *value, int value_length) |
| Print Read Attributes Response value of an array attribute. More... | |
| int | zcl_print_attribute_value (uint8_t type, const void *value, int value_length) |
| int | zcl_print_struct_value (const void *value, int value_length) |
| Print Read Attributes Response value of a structure attribute. More... | |
| int | zcl_process_read_attr_response (zcl_command_t *zcl, const zcl_attribute_base_t FAR *attr_table) |
| Process a Read Attributes Response and populate the attibute values into an attribute table as if it was a Write Attributes Request. More... | |
| int | zcl_send_write_attributes (wpan_envelope_t *envelope, const zcl_attribute_base_t FAR *attr_list) |
| int | zdo_send_match_desc (wpan_dev_t *dev, const uint16_t *clusters, uint16_t profile_id, wpan_response_fn callback, const void FAR *context) |
| Send a ZDO Match Descriptor request for a list of cluster IDs. More... | |
Variables | |
| const uint16_t FAR * | attribute_list |
| uint16_t | cluster_id |
| const wpan_endpoint_table_entry_t * | ep |
| uint16_t | mfg_id |
| zcl_format_utctime_fn | zcl_format_utctime |
| Pointer to function that converts a zcl_utctime_t value to a human-readable timestamp. More... | |
| zcl_format_utctime_fn | zcl_format_utctime = _zcl_format_utctime |
| Pointer to function that converts a zcl_utctime_t value to a human-readable timestamp. More... | |
| typedef XBEE_BEGIN_DECLS struct zcl_client_read zcl_client_read_t |
| typedef const char*(* zcl_format_utctime_fn) (char dest[40], zcl_utctime_t utctime) |
| const char* _zcl_format_utctime | ( | char | dest[40], |
| zcl_utctime_t | utctime | ||
| ) |
| zcl_client_debug int _zcl_send_read_from_zdo_match | ( | wpan_conversation_t FAR * | conversation, |
| const wpan_envelope_t FAR * | envelope | ||
| ) |
| zcl_client_debug int zcl_client_read_attributes | ( | wpan_envelope_t FAR * | envelope, |
| const zcl_client_read_t * | client_read | ||
| ) |
Send a Read Attributes request for attributes listed in client_read.
| [in,out] | envelope | addressing information for sending a ZCL Read Attributes request; this function fills in the payload and length |
| [in] | client_read | data structure used by ZCL clients to do ZDO discovery followed by ZCL attribute reads |
| 0 | successfully sent request |
| !0 | error sending request |
| zcl_client_debug int zcl_create_attribute_records | ( | void FAR * | buffer, |
| uint8_t | bufsize, | ||
| const zcl_attribute_base_t FAR ** | p_attr_list | ||
| ) |
From a list of attributes, write ID (in little-endian byte order), type and value to a buffer as would be done in a Write Attributes Request.
The attribute list should be an array of attribute records, ending with an attribute ID of ZCL_ATTRIBUTE_END_OF_LIST.
| [out] | buffer | buffer to write values to |
| [in] | bufsize | size of buffer |
| [in,out] | p_attr_list | pointer to the attribute list to encode in buffer; points to next attribute to encode if buffer is filled |
| zcl_client_debug int zcl_find_and_read_attributes | ( | wpan_dev_t * | dev, |
| const uint16_t * | clusters, | ||
| const zcl_client_read_t FAR * | cr | ||
| ) |
Use ZDO Match Descriptor Requests to find devices with a given profile/cluster and then automatically send a ZCL Read Attributes request for some of that cluster's attributes.
| [in] | dev | device to use for time request |
| [in] | clusters | pointer to list of server clusters to search for, must end with #WPAN_CLUSTER_END_OF_LIST |
| [in] | cr | zcl_client_read record containing information on the request (endpoint, attributes, etc.); must be a static object (not an auto variable) since the ZDO responder will need to access it |
| 0 | request sent |
| !0 | error sending request |
| int zcl_print_array_value | ( | const void * | value, |
| int | value_length | ||
| ) |
Print Read Attributes Response value of an array attribute.
Helper function for zcl_print_attribute_value(), takes a pointer to the "value" field of a Read Attributes Response for an array type, formats it and prints to stdout.
@param[in] value pointer to ZCL-encoded array value
@param[in] value_length number of bytes at value
@retval -EINVAL \p value is NULL or \value_length is too small
@retval >=3 number of bytes from \p value consumed by function
@sa zcl_print_attribute_value, zcl_print_struct_value
| int zcl_print_attribute_value | ( | uint8_t | type, |
| const void * | value, | ||
| int | value_length | ||
| ) |
Formats an attribute value and prints it to stdout.
| [in] | type | ZCL datatype of attribute's value |
| [in] | value | pointer to the ZCL-encoded value |
| [in] | value_length | number of bytes at value |
| -EINVAL | value is NULL or is too small |
| >=2 | number of bytes from value consumed by function |
| int zcl_print_struct_value | ( | const void * | value, |
| int | value_length | ||
| ) |
Print Read Attributes Response value of a structure attribute.
Helper function for zcl_print_attribute_value(), takes a pointer to the "value" field of a Read Attributes Response for a structure type, formats it and prints to stdout.
@param[in] value pointer to ZCL-encoded structure value
@param[in] value_length number of bytes at value
@retval -EINVAL \p value is NULL or \value_length is too small
@retval >=2 number of bytes from \p value consumed by function
@sa zcl_print_attribute_value, zcl_print_array_value
| zcl_client_debug int zcl_process_read_attr_response | ( | zcl_command_t * | zcl, |
| const zcl_attribute_base_t FAR * | attr_table | ||
| ) |
Process a Read Attributes Response and populate the attibute values into an attribute table as if it was a Write Attributes Request.
Used in ZCL clients that want to read a lot of ZCL attributes. The client has a mirrored copy of the attributes on the target, and this function is used to populate that copy using the Read Attributes Responses.
| [in] | zcl | ZCL command to process |
| [in] | attr_list | start of the attribute list to use for storing attribute responses |
| zcl_client_debug int zcl_send_write_attributes | ( | wpan_envelope_t * | envelope, |
| const zcl_attribute_base_t FAR * | attr_list | ||
| ) |
| zcl_client_debug int zdo_send_match_desc | ( | wpan_dev_t * | dev, |
| const uint16_t * | clusters, | ||
| uint16_t | profile_id, | ||
| wpan_response_fn | callback, | ||
| const void FAR * | context | ||
| ) |
Send a ZDO Match Descriptor request for a list of cluster IDs.
| [in] | dev | device to use for time request |
| [in] | clusters | pointer to list of server clusters to search for, must end with #WPAN_CLUSTER_END_OF_LIST |
| [in] | profile_id | profile ID associated with the cluster IDs (cannot be WPAN_APS_PROFILE_ANY) |
| [in] | callback | function that will process the ZDO Match Descriptor responses; see wpan_response_fn for the callback's API |
| [in] | context | context to pass to callback in the wpan_conversation_t structure |
| 0 | request sent |
| !0 | error sending request |
update API to allow for unicast request in addition to broadcast
| const uint16_t FAR* attribute_list |
| uint16_t cluster_id |
| const wpan_endpoint_table_entry_t* ep |
| uint16_t mfg_id |
| zcl_format_utctime_fn zcl_format_utctime |
Pointer to function that converts a zcl_utctime_t value to a human-readable timestamp.
Defaults to a function that formats timestamps as "YYYY-MM-DD HH:MM:SS UTC" or "[Invalid Timestamp] if utctime is 0xFFFFFFFF. Can be overriden by the user program to a function that uses another format. Strings must be limited to 40 characters.
| [out] | dest | buffer to hold the formatted string |
| [in] | utctime | time value to format |
dest. | zcl_format_utctime_fn zcl_format_utctime = _zcl_format_utctime |
Pointer to function that converts a zcl_utctime_t value to a human-readable timestamp.
Defaults to a function that formats timestamps as "YYYY-MM-DD HH:MM:SS UTC" or "[Invalid Timestamp] if utctime is 0xFFFFFFFF. Can be overriden by the user program to a function that uses another format. Strings must be limited to 40 characters.
| [out] | dest | buffer to hold the formatted string |
| [in] | utctime | time value to format |
dest.
1.8.10