Developing with ZBOSS for Zigbee
ZCL Time cluster

Modules

 Time cluster attributes
 
 Time cluster commands
 

Data Structures

struct  zb_zcl_time_attrs_s
 Time cluster attributes. More...
 

Macros

#define ZB_ZCL_TIME_SET_REAL_TIME_CLOCK_CB(func_ptr)   (zb_zcl_set_real_time_clock_callback((func_ptr)))
 Set user's callback that will be initialize real time clock on device by specified value. "If the Master bit of the @ref ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute has a value of 0, writing to @ref ZB_ZCL_ATTR_TIME_TIME_ID "Time" attribute SHALL set the real time clock to the written value, otherwise it cannot be written.". More...
 
#define ZB_TIME_COMPARE_AUTH_LEVEL(new_level, new_short_addr, old_level, old_short_addr)
 
#define ZB_ZCL_DECLARE_TIME_ATTR_LIST(attr_list, attrs)
 Declare attribute list for Time cluster. More...
 

Typedefs

typedef zb_bool_t(* zb_zcl_time_set_real_time_clock_t) (zb_uint32_t time)
 Set real time clock callback. More...
 
typedef void(* zb_zcl_time_sync_time_server_found_cb_t) (zb_ret_t status, zb_uint32_t auth_level, zb_uint16_t short_addr, zb_uint8_t ep, zb_uint32_t nw_time)
 Callback to call when new time server found during synchronization.
 
typedef struct zb_zcl_time_attrs_s zb_zcl_time_attrs_t
 

Functions

void zb_zcl_time_server_synchronize (zb_uint8_t endpoint, zb_zcl_time_sync_time_server_found_cb_t cb)
 Start time synchronization. More...
 
zb_bool_t zb_zcl_time_server_read_attr_handle (zb_uint8_t param)
 Handle read attribute response for time cluster. More...
 

Detailed Description

Macro Definition Documentation

◆ ZB_TIME_COMPARE_AUTH_LEVEL

#define ZB_TIME_COMPARE_AUTH_LEVEL (   new_level,
  new_short_addr,
  old_level,
  old_short_addr 
)
Value:
(((new_level) > (old_level)) || \
(((old_level) > ZB_ZCL_TIME_SERVER_NOT_CHOSEN) && \
((new_level) == (old_level)) && \
((new_short_addr) < (old_short_addr))))

◆ ZB_ZCL_DECLARE_TIME_ATTR_LIST

#define ZB_ZCL_DECLARE_TIME_ATTR_LIST (   attr_list,
  attrs 
)
Value:
&attrs.time, &attrs.time_status, &attrs.time_zone, \
&attrs.dst_start, &attrs.dst_end, &attrs.dst_shift, \
&attrs.standard_time, &attrs.local_time, \
&attrs.last_set_time, &attrs.valid_until_time )

Declare attribute list for Time cluster.

Parameters
[in]attr_list- attribute list variable name
[in]attrs- variable of zb_zcl_time_attrs_s type (containing Time cluster attributes)

◆ ZB_ZCL_TIME_SET_REAL_TIME_CLOCK_CB

#define ZB_ZCL_TIME_SET_REAL_TIME_CLOCK_CB (   func_ptr)    (zb_zcl_set_real_time_clock_callback((func_ptr)))

Set user's callback that will be initialize real time clock on device by specified value. "If the Master bit of the @ref ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute has a value of 0, writing to @ref ZB_ZCL_ATTR_TIME_TIME_ID "Time" attribute SHALL set the real time clock to the written value, otherwise it cannot be written.".

See also
ZCL spec, subclause 3.12.2.2.1

Typedef Documentation

◆ zb_zcl_time_set_real_time_clock_t

typedef zb_bool_t(* zb_zcl_time_set_real_time_clock_t) (zb_uint32_t time)

Set real time clock callback.

Parameters
[in]time- UTC time at which real time clock will be set
Returns
ZB_TRUE if real time clock was set to new value and ZB_FALSE otherwise

Function Documentation

◆ zb_zcl_time_server_read_attr_handle()

zb_bool_t zb_zcl_time_server_read_attr_handle ( zb_uint8_t  param)

Handle read attribute response for time cluster.

Handles read attribute response while time synchronization process running. If time synchronization process is not started or finished there will be no processing.

◆ zb_zcl_time_server_synchronize()

void zb_zcl_time_server_synchronize ( zb_uint8_t  endpoint,
zb_zcl_time_sync_time_server_found_cb_t  cb 
)

Start time synchronization.

Parameters
endpointenpoint for each time server synchronization shall be started.
cbcallback that will be called on each successfull time server discovery.

Start time synchronization process. If device doesn't have master bit set in Time Status attribute of Time Cluster then starts to search available time server in Zigbee network and tries to read status and time attributes. After time server successfully found and gathered attributes their values will be passed to application to take further actions.

ZB_ZCL_DECLARE_TIME_ATTRIB_LIST
#define ZB_ZCL_DECLARE_TIME_ATTRIB_LIST(attr_list, time, time_status, time_zone, dst_start, dst_end, dst_shift, standard_time, local_time, last_set_time, valid_until_time)
Declare attribute list for Time cluster.
Definition: zb_zcl_time.h:259