Macros | |
| #define | ZB_HA_DEVICE_VER_DOOR_LOCK 0 |
| #define | ZB_HA_DECLARE_DOOR_LOCK_CLUSTER_LIST( cluster_list_name, door_lock_attr_list, basic_attr_list, identify_attr_list, groups_attr_list) |
| Declare cluster list for Door Lock device. More... | |
| #define | ZB_HA_DECLARE_DOOR_LOCK_EP(ep_name, ep_id, cluster_list) |
| Declare endpoint for Door Lock device. More... | |
| #define | ZB_HA_DECLARE_DOOR_LOCK_CTX(device_ctx, ep_name) ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx, ep_name) |
| Declares Door Lock device context. More... | |
Detailed Description
Door Lock device has 5 clusters (see spec 7.4.11):
Door Lock device sample
- Example
Declaring clusters:
/* Basic cluster attributes data */zb_uint8_t g_attr_basic_zcl_version = ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE;zb_uint8_t g_attr_basic_application_version = ZB_ZCL_BASIC_APPLICATION_VERSION_DEFAULT_VALUE;zb_uint8_t g_attr_basic_stack_version = ZB_ZCL_BASIC_STACK_VERSION_DEFAULT_VALUE;zb_uint8_t g_attr_basic_hw_version = ZB_ZCL_BASIC_HW_VERSION_DEFAULT_VALUE;zb_char_t g_attr_basic_manufacturer_name[] = ZB_ZCL_BASIC_MANUFACTURER_NAME_DEFAULT_VALUE;zb_char_t g_attr_basic_model_identifier[] = ZB_ZCL_BASIC_MODEL_IDENTIFIER_DEFAULT_VALUE;zb_char_t g_attr_basic_date_code[] = ZB_ZCL_BASIC_DATE_CODE_DEFAULT_VALUE;zb_uint8_t g_attr_basic_power_source = ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE;zb_char_t g_attr_basic_location_description[] = ZB_ZCL_BASIC_LOCATION_DESCRIPTION_DEFAULT_VALUE;zb_uint8_t g_attr_basic_physical_environment = ZB_ZCL_BASIC_PHYSICAL_ENVIRONMENT_DEFAULT_VALUE;zb_char_t g_attr_sw_build_id[] = ZB_ZCL_BASIC_SW_BUILD_ID_DEFAULT_VALUE;ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST_EXT(basic_attr_list, &g_attr_basic_zcl_version, &g_attr_basic_application_version, &g_attr_basic_stack_version, &g_attr_basic_hw_version, &g_attr_basic_manufacturer_name, &g_attr_basic_model_identifier, &g_attr_basic_date_code, &g_attr_basic_power_source, &g_attr_basic_location_description, &g_attr_basic_physical_environment, &g_attr_sw_build_id);/* Identify cluster attributes data */zb_uint16_t g_attr_identify_identify_time = ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;/* Groups cluster attributes data */zb_uint8_t g_attr_groups_name_support = 0;/* Scenes cluster attributes 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 = 0;/* Door Lock cluster attributes data */zb_uint8_t g_attr_door_lock_lock_state = 0;zb_uint8_t g_attr_door_lock_lock_type = 0;ZB_ZCL_DECLARE_DOOR_LOCK_ATTRIB_LIST(door_lock_attr_list, &g_attr_door_lock_lock_state, &g_attr_door_lock_lock_type, &g_attr_door_lock_actuator_enabled);ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &g_attr_identify_identify_time);ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(groups_attr_list, &g_attr_groups_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);/********************* Declare device **************************/ZB_HA_DECLARE_DOOR_LOCK_CLUSTER_LIST(door_lock_clusters, door_lock_attr_list, basic_attr_list, identify_attr_list, groups_attr_list, scenes_attr_list);ZB_HA_DECLARE_DOOR_LOCK_EP(door_lock_ep, ENDPOINT_C, door_lock_clusters);ZB_HA_DECLARE_DOOR_LOCK_CTX(device_ctx, door_lock_ep);Registering device list:
/* Register device list */ZB_AF_REGISTER_DEVICE_CTX(&device_ctx);ZB_ZCL_REGISTER_DEVICE_CB(test_device_interface_cb);Example of command handler:
void test_device_interface_cb(zb_uint8_t param){zb_zcl_device_callback_param_t *device_cb_param =TRACE_MSG(TRACE_APP1, "> test_device_interface_cb param %hd id %hd", (FMT__H_H,param, device_cb_param->device_cb_id));switch (device_cb_param->device_cb_id){device_cb_param->cb_param.set_attr_value_param.attr_id == ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID){if (device_cb_param->cb_param.set_attr_value_param.values.data8){TRACE_MSG(TRACE_APP1, "set ON", (FMT__0));#ifdef ZB_USE_BUTTONSzb_osif_led_on(0);#endif}else{TRACE_MSG(TRACE_APP1, "set OFF", (FMT__0));#ifdef ZB_USE_BUTTONSzb_osif_led_off(0);#endif}}break;{zb_uint8_t lock_state = ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_LOCKED;TRACE_MSG(TRACE_APP1, "Lock the door", (FMT__0));ZVUNUSED(zb_zcl_set_attr_val(ENDPOINT_C,&lock_state,ZB_FALSE));}break;{zb_uint8_t lock_state = ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_UNLOCKED;TRACE_MSG(TRACE_APP1, "Unlock the door", (FMT__0));ZVUNUSED(zb_zcl_set_attr_val(ENDPOINT_C,&lock_state,ZB_FALSE));}break;default:break;}}
Macro Definition Documentation
◆ ZB_HA_DECLARE_DOOR_LOCK_CLUSTER_LIST
| #define ZB_HA_DECLARE_DOOR_LOCK_CLUSTER_LIST | ( | cluster_list_name, | |
| door_lock_attr_list, | |||
| basic_attr_list, | |||
| identify_attr_list, | |||
| groups_attr_list | |||
| ) |
Declare cluster list for Door Lock device.
- Parameters
-
cluster_list_name - cluster list variable name door_lock_attr_list - attribute list for On/off switch configuration cluster basic_attr_list - attribute list for Basic cluster identify_attr_list - attribute list for Identify cluster groups_attr_list - attribute list for Groups cluster
◆ ZB_HA_DECLARE_DOOR_LOCK_CTX
| #define ZB_HA_DECLARE_DOOR_LOCK_CTX | ( | device_ctx, | |
| ep_name | |||
| ) | ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx, ep_name) |
Declares Door Lock device context.
- Parameters
-
device_ctx - device context variable name. ep_name - endpoint variable name.
◆ ZB_HA_DECLARE_DOOR_LOCK_EP
| #define ZB_HA_DECLARE_DOOR_LOCK_EP | ( | ep_name, | |
| ep_id, | |||
| cluster_list | |||
| ) |
Value:
ZB_ZCL_DECLARE_DOOR_LOCK_SIMPLE_DESC(ep_name, ep_id, \ ZB_HA_DOOR_LOCK_IN_CLUSTER_NUM, ZB_HA_DOOR_LOCK_OUT_CLUSTER_NUM); \ ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## device_ctx_name, \ ZB_HA_DOOR_LOCK_REPORT_ATTR_COUNT); \ ZB_AF_DECLARE_ENDPOINT_DESC(ep_name, ep_id, ZB_AF_HA_PROFILE_ID, \ 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_DOOR_LOCK_REPORT_ATTR_COUNT, \ reporting_info## device_ctx_name, \ 0, NULL)
Declare endpoint for Door Lock device.
- Parameters
-
ep_name - endpoint variable name ep_id - endpoint ID cluster_list - endpoint cluster list
◆ ZB_HA_DEVICE_VER_DOOR_LOCK
| #define ZB_HA_DEVICE_VER_DOOR_LOCK 0 |
Door Lock device version