XBee Firmware Library
1.6.0
|
Files | |
file | zcl_time.c |
file | zcl_time.h |
Functions | |
uint_fast8_t | _zcl_time_time_get (const zcl_attribute_full_t FAR *attribute) |
int | _zcl_time_time_set (const zcl_attribute_full_t FAR *attribute, zcl_attribute_write_rec_t *rec) |
_zcl_time_debug int | _zcl_time_timestatus_set (const zcl_attribute_full_t FAR *attribute, zcl_attribute_write_rec_t *rec) |
int | zcl_time_client (const wpan_envelope_t FAR *envelope, void FAR *context) |
Handle Read Attribute Responses to requests sent as part of the zcl_time_find_servers() process. More... | |
int | zcl_time_find_servers (wpan_dev_t *dev, uint16_t profile_id) |
Find Time Servers on the network, query them for the current time and then synchronize this device's clock to that time. More... | |
zcl_utctime_t | zcl_time_now (void) |
Returns the current date/time, using the ZCL epoch of January 1, 2000. More... | |
Variables | |
uint16_t end_of_list | |
zcl_attribute_full_t time | |
zcl_attribute_full_t time_status | |
struct { | |
uint16_t end_of_list | |
zcl_attribute_full_t time | |
zcl_attribute_full_t time_status | |
} | zcl_time_attr |
XBEE_BEGIN_DECLS const zcl_attribute_tree_t | zcl_time_attribute_tree [] |
const zcl_attribute_tree_t | zcl_time_attribute_tree [] |
int32_t | zcl_time_skew = 0 |
difference between xbee_seconds_timer() and actual calendar time More... | |
zcl_utctime_t | zcl_time_time |
uint8_t | zcl_time_timestatus = ZCL_TIME_STATUS_MASTER |
Current value of TimeStatus Attribute (#ZCL_TIME_ATTR_TIME_STATUS) More... | |
_zcl_time_debug uint_fast8_t _zcl_time_time_get | ( | const zcl_attribute_full_t FAR * | attribute | ) |
_zcl_time_debug int _zcl_time_time_set | ( | const zcl_attribute_full_t FAR * | attribute, |
zcl_attribute_write_rec_t * | rec | ||
) |
_zcl_time_debug int _zcl_time_timestatus_set | ( | const zcl_attribute_full_t FAR * | attribute, |
zcl_attribute_write_rec_t * | rec | ||
) |
_zcl_time_debug int zcl_time_client | ( | const wpan_envelope_t FAR * | envelope, |
void FAR * | context | ||
) |
Handle Read Attribute Responses to requests sent as part of the zcl_time_find_servers() process.
This function expects to receive "read attribute response" packets ONLY for reads of Time and TimeStatus.
If responding device is a master or is synchronized with one, use it's Time value to update a "skew" global used to track the offset between system time (which may just be "seconds of uptime") and calendar time.
[in] | envelope | envelope from received message |
[in] | context | pointer to attribute list for cluster (typically passed in via endpoint dispatcher) |
0 | Command was processed and default response (with either success or error status) was sent. |
!0 | Error sending default response; time may or may not have been set. |
int zcl_time_find_servers | ( | wpan_dev_t * | dev, |
uint16_t | profile_id | ||
) |
Find Time Servers on the network, query them for the current time and then synchronize this device's clock to that time.
[in] | dev | device to send query on |
[in] | profile_id | profile ID to match in endpoint table or #WPAN_APS_PROFILE_ANY to use the first endpoint with a Time Cluster Client |
0 | Successfully issued ZDO Match Descriptor Request to find Time Cluster Servers on the network. No guarantee that we'll get a response. |
!0 | Some sort of error occurred in generating or sending the ZDO Match Descriptor Request. |
-EINVAL | Couldn't find a Time Cluster Client with profile_id in the endpoint table of dev . |
zcl_utctime_t zcl_time_now | ( | void | ) |
Returns the current date/time, using the ZCL epoch of January 1, 2000.
Assumes that device has connected to a time server and updated its clock accordingly. Returns ZCL_UTCTIME_INVALID if the device has not synchronized its clock.
Do not use this value for tracking elapsed time – use xbee_seconds_timer() or xbee_millisecond_timer() instead. The value may jump forward (or even backward) when the device decides to synchronize with a time server.
ZCL_UTCTIME_INVALID | Clock not synchronized to a time source. |
0-0xFFFFFFFE | Number of elapsed seconds since midnight UTC on January 1, 2000. |
uint16_t end_of_list |
uint16_t end_of_list |
zcl_attribute_full_t time |
zcl_attribute_full_t time |
zcl_attribute_full_t time_status |
zcl_attribute_full_t time_status |
const { ... } zcl_time_attr |
Global attribute list used in #ZCL_CLUST_ENTRY_TIME_SERVER and for adding a Time Cluster Server to an endpoint. The Time Cluster Client does not have any attributes.
XBEE_BEGIN_DECLS const zcl_attribute_tree_t zcl_time_attribute_tree[] |
const zcl_attribute_tree_t zcl_time_attribute_tree[] |
int32_t zcl_time_skew = 0 |
difference between xbee_seconds_timer() and actual calendar time
zcl_utctime_t zcl_time_time |
Current value of Time Attribute (#ZCL_TIME_ATTR_TIME), start value doesn't matter since it is set by _zcl_time_time_get().
uint8_t zcl_time_timestatus = ZCL_TIME_STATUS_MASTER |
Current value of TimeStatus Attribute (#ZCL_TIME_ATTR_TIME_STATUS)