nRF5 SDK for Thread and Zigbee v1.0.0
Macros
On/Off light device.

Macros

#define ZB_ZLL_DEVICE_VER_ON_OFF_LIGHT   0
 
#define ZB_ZLL_ON_OFF_LIGHT_IN_CLUSTER_NUM   6
 
#define ZB_ZLL_ON_OFF_LIGHT_OUT_CLUSTER_NUM   0
 
#define ZB_ZLL_ON_OFF_LIGHT_REPORT_ATTR_COUNT   (ZB_ZCL_ON_OFF_REPORT_ATTR_COUNT)
 
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_CLUSTER_LIST(cluster_list_name,basic_attr_list,identify_attr_list,groups_attr_list,scenes_attr_list,on_off_attr_list,commissioning_declare_both)
 Declare cluster list for On/Off light device. More...
 
#define ZB_ZCL_DECLARE_ON_OFF_LIGHT_SIMPLE_DESC(ep_name, ep_id, in_clust_num, out_clust_num)
 Declare simple descriptor for On/Off light device. More...
 
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_EP(ep_name, ep_id, cluster_list)
 Declare endpoint for dimmable light device. More...
 
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_CTX(device_ctx, ep_name)
 

Detailed Description

ZLL On/Off light device.

On/Off light device has 5 clusters (see spec 5.2.1):

Sample use On/Off light device

Example
Delcaration clusters
/******************* Declare attributes ************************/
//* On/Off cluster attributes data */
zb_uint8_t g_attr_on_off = ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE;
/* On/Off cluster attributes additions data */
zb_bool_t g_attr_global_scene_ctrl = ZB_TRUE;
zb_uint16_t g_attr_on_time = 0;
zb_uint16_t g_attr_off_wait_time = 0;
ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_ZLL(on_off_attr_list, &g_attr_on_off,
&g_attr_global_scene_ctrl, &g_attr_on_time, &g_attr_off_wait_time);
/* Basic cluster attributes data */
zb_uint8_t g_attr_zcl_version = ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE;
zb_uint8_t g_attr_app_version = 0;
zb_uint8_t g_attr_stack_version = 0;
zb_uint8_t g_attr_hardware_version = 0;
zb_char_t g_attr_manufacturer_name[] = "\x15" "Test manufacture name";
zb_char_t g_attr_model_id[] = "\x03" "1.0";
zb_char_t g_attr_date_code[] = "\x0a" "20130509GP";
zb_uint8_t g_attr_power_source = ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE;
zb_char_t g_attr_sw_build_id[] = "\x0f" "111.111.111.111";
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST_ZLL(basic_attr_list, &g_attr_zcl_version, &g_attr_app_version,
&g_attr_stack_version, &g_attr_hardware_version, &g_attr_manufacturer_name, &g_attr_model_id,
&g_attr_date_code, &g_attr_power_source, &g_attr_sw_build_id);
/* Identify cluster attributes data */
zb_uint16_t g_attr_identify_time = ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &g_attr_identify_time);
/* Groups cluster attributes data */
zb_uint8_t g_attr_name_support = 0;
ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(groups_attr_list, &g_attr_name_support);
/* Scenes cluster attribute data */
zb_uint8_t g_attr_scenes_scene_count = ZB_ZCL_SCENES_SCENE_COUNT_DEFAULT_VALUE;
zb_uint8_t g_attr_scenes_current_scene = ZB_ZCL_SCENES_CURRENT_SCENE_DEFAULT_VALUE;
zb_uint16_t g_attr_scenes_current_group = ZB_ZCL_SCENES_CURRENT_GROUP_DEFAULT_VALUE;
zb_uint8_t g_attr_scenes_scene_valid = ZB_ZCL_SCENES_SCENE_VALID_DEFAULT_VALUE;
zb_uint8_t g_attr_scenes_name_support = ZB_ZCL_SCENES_NAME_SUPPORT_DEFAULT_VALUE;
ZB_ZCL_DECLARE_SCENES_ATTRIB_LIST(scenes_attr_list, &g_attr_scenes_scene_count,
&g_attr_scenes_current_scene, &g_attr_scenes_current_group,
&g_attr_scenes_scene_valid, &g_attr_scenes_name_support);
/********************* Declare device **************************/
on_off_light_clusters,
basic_attr_list, identify_attr_list, groups_attr_list,
scenes_attr_list, on_off_attr_list, ZB_FALSE);
ZB_ZLL_DECLARE_ON_OFF_LIGHT_EP(on_off_light_ep, ENDPOINT, on_off_light_clusters);
ZB_ZLL_DECLARE_ON_OFF_LIGHT_CTX(on_off_light_ctx, on_off_light_ep);
Register device list
/* Register device list */
ZB_AF_REGISTER_DEVICE_CTX(&on_off_light_ctx);
ZB_ZCL_REGISTER_DEVICE_CB(test_device_cb);

See ll/all_devices test

Macro Definition Documentation

#define ZB_ZCL_DECLARE_ON_OFF_LIGHT_SIMPLE_DESC (   ep_name,
  ep_id,
  in_clust_num,
  out_clust_num 
)
Value:
ZB_DECLARE_SIMPLE_DESC(in_clust_num, out_clust_num); \
ZB_AF_SIMPLE_DESC_TYPE(in_clust_num, out_clust_num) simple_desc_##ep_name = \
{ \
ep_id, \
ZB_AF_ZLL_PROFILE_ID, \
ZB_ZLL_ON_OFF_LIGHT_DEVICE_ID, \
ZB_ZLL_DEVICE_VER_ON_OFF_LIGHT, \
0, \
in_clust_num, \
out_clust_num, \
{ \
ZB_ZCL_CLUSTER_ID_BASIC, \
ZB_ZCL_CLUSTER_ID_IDENTIFY, \
ZB_ZCL_CLUSTER_ID_GROUPS, \
ZB_ZCL_CLUSTER_ID_SCENES, \
ZB_ZCL_CLUSTER_ID_ON_OFF, \
ZB_ZLL_CLUSTER_ID_COMMISSIONING \
} \
}

Declare simple descriptor for On/Off light device.

Parameters
ep_name- endpoint variable name.
ep_id[IN] - endpoint ID.
in_clust_num[IN] - number of supported input clusters.
out_clust_num[IN] - number of supported output clusters.
Note
in_clust_num, out_clust_num should be defined by numeric constants, not variables or any definitions, because these values are used to form simple descriptor type name.
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_CLUSTER_LIST (   cluster_list_name,
  basic_attr_list,
  identify_attr_list,
  groups_attr_list,
  scenes_attr_list,
  on_off_attr_list,
  commissioning_declare_both 
)

Declare cluster list for On/Off light device.

Parameters
cluster_list_name[IN] - cluster list variable name.
basic_attr_list[IN] - attribute list for Basic cluster.
identify_attr_list[IN] - attribute list for Identify cluster.
groups_attr_list[IN] - attribute list for Groups cluster.
scenes_attr_list[IN] - attribute list for Scenes cluster.
on_off_attr_list[IN] - attribute list for On/Off cluster.
commissioning_declare_both[IN] - determines Commissioning cluster role: ZB_TRUE implies both client and server, and ZB_FALSE implies server role only.
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_CTX (   device_ctx,
  ep_name 
)
Value:
ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## device_ctx_name, \
ZB_ZLL_ON_OFF_LIGHT_REPORT_ATTR_COUNT); \
ZBOSS_DECLARE_DEVICE_CTX(device_ctx, ep_name, \
ZB_ZCL_ARRAY_SIZE(ep_name, zb_af_endpoint_desc_t), \
ZB_ZLL_ON_OFF_LIGHT_REPORT_ATTR_COUNT, reporting_info## device_ctx_name, \
0, NULL)
#define ZB_ZLL_DECLARE_ON_OFF_LIGHT_EP (   ep_name,
  ep_id,
  cluster_list 
)
Value:
zb_zll_on_off_light_scene_table_ ## ep_name ## _t, \
ZB_ZCL_SCENES_FIELDSETS_LENGTH(ZB_ZCL_CLUSTER_ID_ON_OFF)); \
ZB_ZCL_DEFINE_DEVICE_SCENE_TABLE_ZLL( \
zb_zll_on_off_light_scene_table_ ## ep_name ## _t, \
g_zb_zll_on_off_light_scene_table_ ## ep_name); \
ZB_ZCL_DECLARE_ON_OFF_LIGHT_SIMPLE_DESC( \
ep_name, \
ep_id, \
ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_name) \
ZB_AF_SET_ENDPOINT_DESC( \
ep_id, \
sizeof(zb_zll_on_off_light_scene_table_ ## ep_name ## _t), \
&g_zb_zll_on_off_light_scene_table_ ## ep_name, \
ZB_ZCL_ARRAY_SIZE( \
cluster_list, \
cluster_list, \
(zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name) \
ZB_AF_FINISH_DECLARE_ENDPOINT_LIST

Declare endpoint for dimmable light device.

Parameters
ep_name[IN] - endpoint variable name.
ep_id[IN] - endpoint ID.
cluster_list[IN] - endpoint cluster list.
#define ZB_ZLL_DEVICE_VER_ON_OFF_LIGHT   0

Device version

#define ZB_ZLL_ON_OFF_LIGHT_IN_CLUSTER_NUM   6

On/Off light input clusters number.

#define ZB_ZLL_ON_OFF_LIGHT_OUT_CLUSTER_NUM   0

On/Off light output clusters number.


Documentation feedback | Developer Zone | Subscribe | Updated