nRF5 SDK for Thread and Zigbee v3.2.0
Macros
Level Controllable Output

Macros

#define ZB_HA_DEVICE_VER_LEVEL_CONTROLLABLE_OUTPUT   0
 
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_IN_CLUSTER_NUM   6
 
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_OUT_CLUSTER_NUM   0
 
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_NUM
 
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_REPORT_ATTR_COUNT   (ZB_ZCL_LEVEL_CONTROL_REPORT_ATTR_COUNT + ZB_ZCL_ON_OFF_REPORT_ATTR_COUNT)
 
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_CVC_ATTR_COUNT   1
 
#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_LIST(cluster_list_name,basic_attr_list,identify_attr_list,scenes_attr_list,groups_attr_list,on_off_attr_list,level_control_attr_list)
 Declare cluster list for Level Controllable Output device. More...
 
#define ZB_ZCL_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_SIMPLE_DESC(ep_name, ep_id, in_clust_num, out_clust_num)
 
#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_EP(ep_name, ep_id, cluster_list)
 Declare endpoint for Level Controllable Output device. More...
 
#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CTX(device_ctx, ep_name)   ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx, ep_name)
 Declare application's device context for Level Control Switch device. More...
 

Detailed Description

Level Control device has 6 clusters (see spec 7.4.4):

Sample use Level Control device

Example
Declaration clusters
/******************* Declare attributes ************************/
/* Basic cluster attributes data */
zb_uint8_t g_attr_zcl_version = ZB_ZCL_VERSION;
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(basic_attr_list, &g_attr_zcl_version, &g_attr_power_source);
/* Identify cluster attributes data */
zb_uint16_t g_attr_identify_time = 0;
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_uint8_t g_attr_scenes_current_scene;
zb_uint16_t g_attr_scenes_current_group;
zb_uint8_t g_attr_scenes_scene_valid;
zb_uint8_t g_attr_scenes_name_support;
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);
/* On/Off cluster attributes data */
zb_uint8_t g_attr_on_off = ZB_FALSE;
ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(on_off_attr_list, &g_attr_on_off);
/* Level Control cluster attribute variables */
zb_uint16_t g_remaining_time = ZB_ZCL_LEVEL_CONTROL_REMAINING_TIME_DEFFAULT_VALUE_ZLL;
ZB_ZCL_DECLARE_LEVEL_CONTROL_ATTRIB_LIST(level_control_attr_list, &g_current_level, &g_remaining_time);
/********************* Declare device **************************/
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_LIST(level_controllable_output_clusters,
basic_attr_list,
identify_attr_list,
scenes_attr_list,
groups_attr_list,
on_off_attr_list,
level_control_attr_list);
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_EP(level_controllable_output_ep,
HA_LEVEL_CONTROLLABLE_OUTPUT_ENDPOINT,
level_controllable_output_clusters);
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CTX(level_controllable_output_ctx,
level_controllable_output_ep);
Register device list
ZB_AF_REGISTER_DEVICE_CTX(&level_controllable_output_ctx);
ZB_AF_SET_ENDPOINT_HANDLER(HA_LEVEL_CONTROLLABLE_OUTPUT_ENDPOINT,
zcl_specific_cluster_cmd_handler);
Sample handler
if (cmd_info->cmd_id == ZB_ZCL_CMD_LEVEL_CONTROL_MOVE_TO_LEVEL)
{
TRACE_MSG(TRACE_ZCL3, "Got cluster command 0x%04x", (FMT__D, cmd_info->cmd_id));
/* Process cluster command */
cmd_processed = ZB_TRUE;
}
else
{
TRACE_MSG(TRACE_ZCL2, "Cluster command %hd, skip it", (FMT__H, cmd_info->cmd_id));
}

The complete set of Level Control device samples can be found in /snippet/ha_level_controllable_output_sample.c.

Macro Definition Documentation

#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_LIST (   cluster_list_name,
  basic_attr_list,
  identify_attr_list,
  scenes_attr_list,
  groups_attr_list,
  on_off_attr_list,
  level_control_attr_list 
)

Declare cluster list for Level Controllable Output device.

Parameters
cluster_list_name- cluster list variable name
basic_attr_list- attribute list for Basic cluster
identify_attr_list- attribute list for Identify cluster
scenes_attr_list- attribute list for Scenes cluster
groups_attr_list- attribute list for Groups cluster
on_off_attr_list- attribute list for On/Off cluster
level_control_attr_list- attribute list for Level Control cluster
#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CTX (   device_ctx,
  ep_name 
)    ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx, ep_name)

Declare application's device context for Level Control Switch device.

Parameters
device_ctx- device context variable
ep_name- endpoint variable name
#define ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_EP (   ep_name,
  ep_id,
  cluster_list 
)
Value:
ZB_ZCL_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_SIMPLE_DESC(ep_name, \
ep_id, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_OUT_CLUSTER_NUM); \
ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## device_ctx_name, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_REPORT_ATTR_COUNT); \
ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX(cvc_alarm_info## device_ctx_name, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_CVC_ATTR_COUNT); \
0, \
NULL, \
ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), cluster_list, \
(zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_REPORT_ATTR_COUNT, \
reporting_info## device_ctx_name, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_CVC_ATTR_COUNT, \
cvc_alarm_info## device_ctx_name)
ZCL cluster description.
Definition: zb_zcl_common.h:143
Definition: zboss_api_af.h:287
#define ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX(lev_ctrl_ctx, lev_ctrl_count)
Definition: zboss_api_af.h:587
#define ZBOSS_DEVICE_DECLARE_REPORTING_CTX(rep_ctx, rep_count)
Definition: zboss_api_af.h:579
#define ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,ep_id,profile_id,reserved_length,reserved_ptr,cluster_number,cluster_list,simple_desc,rep_count,rep_ctx,lev_ctrl_count,lev_ctrl_ctx)
Initialize endpoint descriptor.
Definition: zboss_api_af.h:490
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_IN_CLUSTER_NUM
Definition: zb_ha_level_controllable_output.h:80
Definition: zboss_api_af.h:201

Declare endpoint for Level Controllable Output device.

Parameters
ep_name- endpoint variable name
ep_id- endpoint ID
cluster_list- endpoint cluster list
#define ZB_HA_DEVICE_VER_LEVEL_CONTROLLABLE_OUTPUT   0

< Level Controllable Output device version Level Controllable Output IN (server) clusters number

#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_NUM
Value:
+ ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_OUT_CLUSTER_NUM)
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_IN_CLUSTER_NUM
Definition: zb_ha_level_controllable_output.h:80
#define ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_IN_CLUSTER_NUM   6

Level Controllable Output OUT (client) clusters number

#define ZB_ZCL_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_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_HA_PROFILE_ID, \
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_DEVICE_ID, \
ZB_HA_DEVICE_VER_LEVEL_CONTROLLABLE_OUTPUT, \
0, \
in_clust_num, \
out_clust_num, \
{ \
ZB_ZCL_CLUSTER_ID_BASIC, \
ZB_ZCL_CLUSTER_ID_IDENTIFY, \
ZB_ZCL_CLUSTER_ID_SCENES, \
ZB_ZCL_CLUSTER_ID_GROUPS, \
ZB_ZCL_CLUSTER_ID_ON_OFF, \
ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL \
} \
}
#define ZB_DECLARE_SIMPLE_DESC(in_clusters_count, out_clusters_count)
Definition: zboss_api_af.h:185
#define ZB_AF_SIMPLE_DESC_TYPE(in_num, out_num)
Definition: zboss_api_af.h:172

Documentation feedback | Developer Zone | Subscribe | Updated