Digi XBee(R) ANSI C Host Library
Macros | Functions | Variables

Client and server code to implement the ZigBee Time Cluster. More...

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "xbee/platform.h"
#include "xbee/byteorder.h"
#include "zigbee/zcl_time.h"
#include "zigbee/zdo.h"
#include "zigbee/zcl_client.h"

Functions

int _zcl_time_time_set (const zcl_attribute_full_t FAR *attribute, zcl_attribute_write_rec_t *rec)
 Function registered to ZCL_TIME_ATTR_TIME attribute of Time Cluster and called to modify the attribute. Also called internally to update the zcl_time_skew global. More...
 
uint_fast8_t _zcl_time_time_get (const zcl_attribute_full_t FAR *attribute)
 Function registered to ZCL_TIME_ATTR_TIME attribute of Time Cluster and called to refresh the Time attribute (global zcl_time_time). More...
 
int _zcl_time_timestatus_set (const zcl_attribute_full_t FAR *attribute, zcl_attribute_write_rec_t *rec)
 Special code for setting bitfield of TimeStatus attribute. More...
 
zcl_utctime_t zcl_time_now (void)
 Returns the current date/time, using the ZCL epoch of January 1, 2000. More...
 
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...
 

Variables

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(). More...
 
uint8_t zcl_time_timestatus = 0
 Current value of TimeStatus Attribute (ZCL_TIME_ATTR_TIME_STATUS)
 
int32_t zcl_time_skew = 0
 difference between xbee_seconds_timer() and actual calendar time
 
struct {
   zcl_attribute_full_t   time
 
   zcl_attribute_full_t   time_status
 
   uint16_t   end_of_list
 
zcl_time_attr
 Global attribute list used in ZCL_CLUST_ENTRY_TIME_SERVER and for adding a Time Cluster Server to an endpoint. More...
 
const zcl_attribute_tree_t zcl_time_attribute_tree []
 

Detailed Description

Client and server code to implement the ZigBee Time Cluster.

This is an attribute-only cluster, so it could use the General Command handler in its cluster definition, but we use a special client to intercept Read Attribute Responses so we don't take up an entry in the conversation table.