Initial commit: ESP32-C6 Zigbee Router project
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: HA configuration
|
||||
*/
|
||||
|
||||
#ifndef ZB_HA_CONFIG_H
|
||||
#define ZB_HA_CONFIG_H 1
|
||||
|
||||
#include "zb_vendor.h"
|
||||
|
||||
#if defined ZB_ENABLE_HA || defined DOXYGEN
|
||||
|
||||
/** @cond DOXYGEN_HA_SECTION */
|
||||
|
||||
/* Specify a list of devices that should be supported */
|
||||
#define xZB_ALL_DEVICE_SUPPORT /* Attention! use this macro in testing purposes */
|
||||
|
||||
/* Normally startup attribute sets should be processed */
|
||||
/* TODO Re-enable HA SAS processing when appropriate */
|
||||
#define xZB_ENABLE_HA_SAS
|
||||
|
||||
/* NK: why Gateway is always defined? */
|
||||
#define xZB_HA_DEFINE_DEVICE_GATEWAY
|
||||
|
||||
|
||||
#include "zb_ha_device_config.h"
|
||||
#include "zcl/zb_zcl_config.h"
|
||||
|
||||
/** @endcond */ /* DOXYGEN_HA_SECTION */
|
||||
|
||||
#endif /* ZB_ENABLE_HA */
|
||||
|
||||
#endif /* ZB_HA_CONFIG_H */
|
||||
@@ -0,0 +1,602 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: HA devices configuration
|
||||
*/
|
||||
|
||||
#ifndef ZB_HA_DEVICE_CONFIG_H
|
||||
#define ZB_HA_DEVICE_CONFIG_H 1
|
||||
|
||||
#if defined ZB_ENABLE_HA || defined DOXYGEN
|
||||
|
||||
/** @cond DOXYGEN_HA_SECTION */
|
||||
|
||||
/*! @defgroup ha_config_params HA Device types */
|
||||
/*! @{
|
||||
*/
|
||||
|
||||
/** @brief HA Device identifiers. */
|
||||
enum zb_ha_standard_devs_e
|
||||
{
|
||||
/*! General On/Off switch */
|
||||
ZB_HA_ON_OFF_SWITCH_DEVICE_ID = 0x0000,
|
||||
/*! Level Control Switch */
|
||||
ZB_HA_LEVEL_CONTROL_SWITCH_DEVICE_ID = 0x0001,
|
||||
/*! General On/Off output */
|
||||
ZB_HA_ON_OFF_OUTPUT_DEVICE_ID = 0x0002,
|
||||
/*! Level Controllable Output */
|
||||
ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_DEVICE_ID = 0x0003,
|
||||
/*! Scene Selector */
|
||||
ZB_HA_SCENE_SELECTOR_DEVICE_ID = 0x0004,
|
||||
/*! Configuration Tool */
|
||||
ZB_HA_CONFIGURATION_TOOL_DEVICE_ID = 0x0005,
|
||||
/*! Remote Control */
|
||||
ZB_HA_REMOTE_CONTROL_DEVICE_ID = 0x0006,
|
||||
/*! Combined Interface */
|
||||
ZB_HA_COMBINED_INTERFACE_DEVICE_ID = 0x0007,
|
||||
/*! Range Extender */
|
||||
ZB_HA_RANGE_EXTENDER_DEVICE_ID = 0x0008,
|
||||
/*! Mains Power Outlet */
|
||||
ZB_HA_MAINS_POWER_OUTLET_DEVICE_ID = 0x0009,
|
||||
/*! Door lock client */
|
||||
ZB_HA_DOOR_LOCK_DEVICE_ID = 0x000A,
|
||||
/*! Door lock controller */
|
||||
ZB_HA_DOOR_LOCK_CONTROLLER_DEVICE_ID = 0x000B,
|
||||
/*! Simple Sensor device */
|
||||
ZB_HA_SIMPLE_SENSOR_DEVICE_ID = 0x000C,
|
||||
/*! Consumption Awareness Device */
|
||||
ZB_HA_CONSUMPTION_AWARENESS_DEVICE_ID = 0x000D,
|
||||
/*! Home Gateway */
|
||||
ZB_HA_HOME_GATEWAY_DEVICE_ID = 0x0050,
|
||||
/*! Smart plug */
|
||||
ZB_HA_SMART_PLUG_DEVICE_ID = 0x0051,
|
||||
/*! White Goods */
|
||||
ZB_HA_WHITE_GOODS_DEVICE_ID = 0x0052,
|
||||
/*! Meter Interface */
|
||||
ZB_HA_METER_INTERFACE_DEVICE_ID = 0x0053,
|
||||
/* Lightning */
|
||||
/*! On/Off Light Device */
|
||||
ZB_HA_ON_OFF_LIGHT_DEVICE_ID = 0x0100,
|
||||
/*! Dimmable Light Device */
|
||||
ZB_HA_DIMMABLE_LIGHT_DEVICE_ID = 0x0101,
|
||||
/*! Color Dimmable Light Device */
|
||||
ZB_HA_COLOR_DIMMABLE_LIGHT_DEVICE_ID = 0x0102,
|
||||
/*! Dimmer Switch Device */
|
||||
ZB_HA_DIMMER_SWITCH_DEVICE_ID = 0x0104,
|
||||
/*! Color Dimmer Switch Device */
|
||||
ZB_HA_COLOR_DIMMER_SWITCH_DEVICE_ID = 0x0105,
|
||||
/*! Shade */
|
||||
ZB_HA_SHADE_DEVICE_ID = 0x0200,
|
||||
/*! Shade controller */
|
||||
ZB_HA_SHADE_CONTROLLER_DEVICE_ID = 0x0201,
|
||||
/*! Window Covering client*/
|
||||
ZB_HA_WINDOW_COVERING_DEVICE_ID = 0x0202,
|
||||
/*! Window Covering controller */
|
||||
ZB_HA_WINDOW_COVERING_CONTROLLER_DEVICE_ID = 0x0203,
|
||||
/* HVAC */
|
||||
/*! Heating/Cooling Unit device */
|
||||
ZB_HA_HEATING_COOLING_UNIT_DEVICE_ID = 0x0300,
|
||||
/*! Thermostat Device */
|
||||
ZB_HA_THERMOSTAT_DEVICE_ID = 0x0301,
|
||||
/*! Temperature Sensor */
|
||||
ZB_HA_TEMPERATURE_SENSOR_DEVICE_ID = 0x0302,
|
||||
/* IAS */
|
||||
/*! IAS Control and Indicating Equipment */
|
||||
ZB_HA_IAS_CONTROL_INDICATING_EQUIPMENT_ID = 0x0400,
|
||||
/*! IAS Ancillary Control Equipment */
|
||||
ZB_HA_IAS_ANCILLARY_CONTROL_EQUIPMENT_ID = 0x0401,
|
||||
/*! IAS Zone */
|
||||
ZB_HA_IAS_ZONE_ID = 0x0402,
|
||||
/*! IAS Warning Device */
|
||||
ZB_HA_IAS_WARNING_DEVICE_ID = 0x0403,
|
||||
/*! Custom HA device for test */
|
||||
ZB_HA_TEST_DEVICE_ID = 0xfff0,
|
||||
/*! Custom Tunnel device (should declared in private profile) */
|
||||
ZB_HA_CUSTOM_TUNNEL_DEVICE_ID = 0xfff1,
|
||||
/*! Custom Attributes Device */
|
||||
ZB_HA_CUSTOM_ATTR_DEVICE_ID = 0xfff2
|
||||
};
|
||||
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/* Define supported devices here */
|
||||
#ifdef ZB_ALL_DEVICE_SUPPORT
|
||||
|
||||
#define ZB_HA_DEFINE_DEVICE_ON_OFF_SWITCH
|
||||
#define ZB_HA_DEFINE_DEVICE_ON_OFF_OUTPUT
|
||||
#define ZB_HA_DEFINE_DEVICE_DOOR_LOCK
|
||||
#define ZB_HA_DEFINE_DEVICE_DOOR_LOCK_CONTROLLER
|
||||
#define ZB_HA_DEFINE_DEVICE_SIMPLE_SENSOR
|
||||
#define ZB_HA_DEFINE_DEVICE_COMBINED_INTERFACE
|
||||
#define ZB_HA_DEFINE_DEVICE_SCENE_SELECTOR
|
||||
#define ZB_HA_DEFINE_DEVICE_CONFIGURATION_TOOL
|
||||
#define ZB_HA_DEFINE_DEVICE_MAINS_POWER_OUTLET
|
||||
#define ZB_HA_DEFINE_DEVICE_RANGE_EXTENDER
|
||||
#define ZB_HA_DEFINE_DEVICE_LEVEL_CONTROL_SWITCH
|
||||
#define ZB_HA_DEFINE_DEVICE_LEVEL_CONTROLLABLE_OUTPUT
|
||||
#define ZB_HA_DEFINE_DEVICE_WINDOW_COVERING
|
||||
#define ZB_HA_DEFINE_DEVICE_WINDOW_COVERING_CONTROLLER
|
||||
#define ZB_HA_DEFINE_DEVICE_SHADE
|
||||
#define ZB_HA_DEFINE_DEVICE_SHADE_CONTROLLER
|
||||
/* HVAC */
|
||||
#define ZB_HA_DEFINE_DEVICE_TEMPERATURE_SENSOR
|
||||
/* IAS*/
|
||||
#define ZB_HA_DEFINE_DEVICE_IAS_CONTROL_INDICATING_EQUIPMENT
|
||||
#define ZB_HA_DEFINE_DEVICE_IAS_ANCILLARY_CONTROL_EQUIPMENT
|
||||
#define ZB_HA_DEFINE_DEVICE_IAS_ZONE
|
||||
#define ZB_HA_DEFINE_DEVICE_IAS_WARNING_DEVICE
|
||||
|
||||
#define ZB_HA_DEFINE_DEVICE_CUSTOM_ATTR
|
||||
#define ZB_HA_DEFINE_DEVICE_DIMMABLE_LIGHT
|
||||
#define ZB_HA_DEFINE_DEVICE_DIMMER_SWITCH
|
||||
|
||||
#define ZB_HA_DEFINE_DEVICE_SMART_PLUG
|
||||
#define ZB_HA_DEFINE_DEVICE_THERMOSTAT
|
||||
|
||||
#define ZB_HA_DEFINE_DEVICE_TEST_DEVICE
|
||||
|
||||
/************** Custom Devices ******************/
|
||||
/* Define device support for custom security sensor */
|
||||
#define ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_SENSOR
|
||||
/* this device definition - for coordinator (CIE) role, need for test
|
||||
* only - remove it in release build */
|
||||
#define ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_CONTROL
|
||||
/* Define device support for Low Cost Gateway */
|
||||
#define ZB_HA_DEFINE_DEVICE_GATEWAY
|
||||
#define ZB_HA_DEFINE_DEVICE_CUSTOM_DIMMABLE_LIGHT
|
||||
/* Linky */
|
||||
#define ZB_HA_DEFINE_DEVICE_ERL_INTERFACE_DEVICE
|
||||
#define ZB_HA_DEFINE_DEVICE_ERL_GW
|
||||
|
||||
#ifdef ZB_ENABLE_CUSTOM_CLUSTERS
|
||||
#define ZB_PROFILE_DEFINE_DEVICE_CUSTOM_TUNNEL
|
||||
#endif
|
||||
|
||||
#ifdef ZB_ENABLE_SE_CLUSTERS
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_EVENTS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_CALENDAR 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_PREPAYMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DEVICE_MANAGEMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_MDU_PAIRING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ENERGY_MANAGEMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TIME 1
|
||||
#endif
|
||||
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DRLC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_PRICE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TUNNELING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_MESSAGING 1
|
||||
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_METER_IDENTIFICATION 1
|
||||
|
||||
/* Define optional common clusters. These clusters are common to all devices
|
||||
* and expected to be part of the build if ZB_ALL_DEVICE_SUPPORT is declared.
|
||||
* For example, application 'multi_ep' expects "Alarms" cluster to be present.
|
||||
*
|
||||
* Clusters with reporting capability are omitted since common part implies
|
||||
* client role which receives attribute reports. It is not necessary to enable
|
||||
* ZB_ZCL_SUPPORT_* during stack build. It will be enough for applications to
|
||||
* define corresponding ZB_ZCL_SUPPORT_* during application's build because
|
||||
* only headers should be included, no *.c files.
|
||||
*
|
||||
* Also, common manufacturer-specific clusters are ignored here.
|
||||
*/
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POWER_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ALARMS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ELECTRICAL_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL 1
|
||||
|
||||
/* Define clusters which are not used by any device but expected to be
|
||||
* supported in ZBOSS stack when ZB_ALL_DEVICE_SUPPORT is defined.
|
||||
*
|
||||
* The main intention of ZB_ALL_DEVICE_SUPPORT define is to compile in ZBOSS
|
||||
* stack as much HA-related functionality as possible so declaring support for
|
||||
* clusters not being used by any device but used by some sample seems to be
|
||||
* fine.
|
||||
*/
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DEHUMIDIFICATION_CONTROL 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_OCCUPANCY_SENSING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ANALOG_INPUT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ANALOG_VALUE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_MULTISTATE_VALUE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DEVICE_TEMP_CONFIG 1
|
||||
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_CARBON_DIOXIDE_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_PM2_5_MEASUREMENT 1
|
||||
|
||||
#endif /* ZB_ALL_DEVICE_SUPPORT */
|
||||
|
||||
//#define ZB_HA_DEFINE_DEVICE_SMART_PLUG
|
||||
|
||||
/*********************** HA devices to cluster configuration **********************/
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_ON_OFF_SWITCH
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF_SWITCH_CONFIG 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_ON_OFF_OUTPUT */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_ON_OFF_OUTPUT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_ON_OFF_OUTPUT */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_BASIC_LIGHT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_BASIC_LIGHT */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_DOOR_LOCK
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DOOR_LOCK 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_DOOR_LOCK */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_DOOR_LOCK_CONTROLLER
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DOOR_LOCK 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_DOOR_LOCK_CONTROLLER */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_SIMPLE_SENSOR
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BINARY_INPUT 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_SIMPLE_SENSOR */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_COMBINED_INTERFACE
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF_SWITCH_CONFIG 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_COMBINED_INTERFACE */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_SCENE_SELECTOR
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_SCENE_SELECTOR */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_CONFIGURATION_TOOL
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_CONFIGURATION_TOOL */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_MAINS_POWER_OUTLET
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_MAINS_POWER_OUTLET */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_RANGE_EXTENDER
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_RANGE_EXTENDER */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_LEVEL_CONTROL_SWITCH
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_LEVEL_CONTROL_SWITCH */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_LEVEL_CONTROLLABLE_OUTPUT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_LEVEL_CONTROLLABLE_OUTPUT */
|
||||
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_WINDOW_COVERING
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_WINDOW_COVERING 1
|
||||
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_WINDOW_COVERING */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_CUSTOM_ATTR
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_WINDOW_COVERING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_CUSTOM_ATTR 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_CUSTOM_ATTR */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_DIMMABLE_LIGHT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_DIMMABLE_LIGHT */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_DIMMER_SWITCH
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_DIMMER_SWITCH */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_WINDOW_COVERING_CONTROLLER
|
||||
#define ZB_HA_DEFINE_DEVICE_WINDOW_COVERING_CONTROLLER
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_WINDOW_COVERING 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_WINDOW_COVERING_CONTROLLER */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_SHADE
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SHADE_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_SHADE */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_SHADE_CONTROLLER
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_SHADE_CONTROLLER */
|
||||
|
||||
/* HVAC */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_TEMPERATURE_SENSOR
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TEMP_MEASUREMENT 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_TEMPERATURE_SENSOR */
|
||||
|
||||
/* IAS*/
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_IAS_CONTROL_INDICATING_EQUIPMENT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ACE 1
|
||||
//#define ZB_ZCL_SUPPORT_CLUSTER_IAS_WD 1
|
||||
//#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_IAS_CONTROL_INDICATING_EQUIPMENT */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_IAS_ANCILLARY_CONTROL_EQUIPMENT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
//#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ACE 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_IAS_ANCILLARY_CONTROL_EQUIPMENT */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_IAS_ZONE
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_IAS_ZONE */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_IAS_WARNING_DEVICE
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_WD 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_IAS_WARNING_DEVICE */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_SENSOR
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TEMP_MEASUREMENT 1
|
||||
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POWER_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ILLUMINANCE_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_REL_HUMIDITY_MEASUREMENT 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_SENSOR */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_CONTROL
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
//#define ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_CUSTOM_SECURITY_CONTROL */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_THERMOSTAT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_THERMOSTAT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_THERMOSTAT_UI_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_FAN_CONTROL 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ELECTRICAL_MEASUREMENT 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_THERMOSTAT */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_GATEWAY
|
||||
/*
|
||||
* Gateway supports many clusters, but in the client role and in general it's
|
||||
* not necessary to define their support with ZB_ZCL_SUPPORT_CLUSTER_xxx.
|
||||
* Such defines are necessary only for clusters in the server role.
|
||||
* The only exception is poll control cluster for now.
|
||||
*/
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ZONE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TIME 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS_CLIENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_EN50523_APPLIANCE_EVENTS_AND_ALERTS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POWER_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_REL_HUMIDITY_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TEMP_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_PRESSURE_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_METERING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IAS_ACE 1
|
||||
/*
|
||||
* Gateway uses EZ mode only for Gemtek smartplug, which is
|
||||
* currently excluded from build.
|
||||
*/
|
||||
/* #define ZB_HA_SUPPORT_EZ_MODE 1 */
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_GATEWAY */
|
||||
|
||||
/* Custom device should not be declared as a part of HA, keep it
|
||||
* here foe simplicity */
|
||||
#ifdef ZB_PROFILE_DEFINE_DEVICE_CUSTOM_TUNNEL
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TUNNEL 1
|
||||
#endif
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_SMART_PLUG
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_METERING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
/* FIXME: Are Scenes really needed? */
|
||||
/* #define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1 */
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_SMART_PLUG */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_IR_BLASTER
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_POWER_CONFIG 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IR_BLASTER 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_IR_BLASTER */
|
||||
|
||||
#ifdef ZB_HA_DEFINE_DEVICE_CUSTOM_DIMMABLE_LIGHT
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_SCENES 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_GROUPS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ON_OFF 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_LEVEL_CONTROL 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_COLOR_CONTROL 1
|
||||
#endif /* ZB_HA_DEFINE_DEVICE_CUSTOM_DIMMABLE_LIGHT */
|
||||
|
||||
#if defined ZB_HA_DEFINE_DEVICE_ERL_INTERFACE_DEVICE || defined ZB_HA_DEFINE_DEVICE_ERL_GW
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_BASIC 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_TIME 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_METER_IDENTIFICATION 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_ELECTRICAL_MEASUREMENT 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_METERING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_MESSAGING 1
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_DAILY_SCHEDULE 1
|
||||
#endif /* defined ZB_HA_DEFINE_DEVICE_ERL_INTERFACE_DEVICE || defined ZB_HA_DEFINE_DEVICE_ERL_GW */
|
||||
|
||||
/* BDB uses identify */
|
||||
#if defined ZB_BDB_MODE && !defined ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY
|
||||
#define ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY 1
|
||||
#endif
|
||||
|
||||
/** @endcond */
|
||||
|
||||
/** @} */ /* ha_api */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_HA_SECTION */
|
||||
|
||||
#ifdef ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS
|
||||
/* need to define it here because that .h file can be included after zb_config.h */
|
||||
#ifndef ZB_MAC_DIAGNOSTICS
|
||||
#define ZB_MAC_DIAGNOSTICS
|
||||
#endif
|
||||
#ifndef ZDO_DIAGNOSTICS
|
||||
#define ZDO_DIAGNOSTICS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* ZB_ENABLE_HA */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS && ! defined ZDO_DIAGNOSTICS
|
||||
#error Define ZDO_DIAGNOSTICS in vendor file if you need Diagnostic cluster!
|
||||
#endif
|
||||
|
||||
#endif /* ZB_HA_DEVICE_CONFIG_H */
|
||||
646
managed_components/espressif__esp-zboss-lib/include/zb_address.h
Normal file
646
managed_components/espressif__esp-zboss-lib/include/zb_address.h
Normal file
@@ -0,0 +1,646 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Zigbee address management
|
||||
*/
|
||||
|
||||
#ifndef ZB_ADDRESS_H
|
||||
#define ZB_ADDRESS_H 1
|
||||
|
||||
/*! \addtogroup ZB_NWK_ADDR */
|
||||
/*! @{ */
|
||||
|
||||
|
||||
/*! @cond internals_doc */
|
||||
|
||||
#define ZB_UNKNOWN_SHORT_ADDR 0xFFFFU
|
||||
|
||||
#ifdef ZB_DEBUG_ADDR
|
||||
#define TRACE_ADDR_PROTO_VOID zb_uint16_t from_file, zb_uint16_t from_line
|
||||
#define TRACE_ADDR_CALL_VOID ZB_TRACE_FILE_ID, __LINE__
|
||||
#define TRACE_ADDR_FORWARD_VOID from_file, from_line
|
||||
#define TRACE_ADDR_PROTO TRACE_ADDR_PROTO_VOID ,
|
||||
#define TRACE_ADDR_CALL TRACE_ADDR_CALL_VOID ,
|
||||
#define TRACE_ADDR_FORWARD TRACE_ADDR_FORWARD_VOID ,
|
||||
#else
|
||||
#define TRACE_ADDR_PROTO_VOID
|
||||
#define TRACE_ADDR_CALL_VOID
|
||||
#define TRACE_ADDR_FORWARD_VOID
|
||||
#define TRACE_ADDR_PROTO
|
||||
#define TRACE_ADDR_CALL
|
||||
#define TRACE_ADDR_FORWARD
|
||||
#endif /* ZB_DEBUG_ADDR */
|
||||
|
||||
/**
|
||||
Compressed IEEE address. One byte device manufacturer - reference to
|
||||
\see zb_dev_manufacturer_t array.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_ieee_addr_compressed_s
|
||||
{
|
||||
zb_uint8_t dev_manufacturer; /*!< Index from dev manufacturer array */
|
||||
zb_uint8_t device_id[5]; /*!< Device ID */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_ieee_addr_compressed_t;
|
||||
|
||||
/*! @endcond */
|
||||
|
||||
|
||||
/**
|
||||
Pan ID reference
|
||||
|
||||
Should be used inside protocol tables instead of 64-bit Pan ID
|
||||
*/
|
||||
typedef zb_uint8_t zb_address_pan_id_ref_t;
|
||||
|
||||
|
||||
/**
|
||||
IEEE address reference
|
||||
|
||||
Should be used inside protocol tables instead of 64/16-bit IEEE.
|
||||
*/
|
||||
typedef zb_uint8_t zb_address_ieee_ref_t;
|
||||
|
||||
/*! @cond internals_doc */
|
||||
|
||||
/**
|
||||
64-bit / 16-bit address map
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_address_map_s
|
||||
{
|
||||
zb_ieee_addr_compressed_t ieee_addr; /*!< Compressed IEEE address */
|
||||
zb_uint16_t addr; /*!< 16-bit device address */
|
||||
zb_address_ieee_ref_t redirect_ref; /*!< Reference to redirected or regular record */
|
||||
|
||||
zb_bitfield_t lock_cnt:8; /*!< lock counter. not locked if 0 */
|
||||
zb_bitfield_t used:1; /*!< if 0, this entry is free (never used) */
|
||||
zb_bitfield_t has_address_conflict:1; /*!< Set to 1 if device discovers address conflict
|
||||
* Cleared when conflict is resolved:
|
||||
* - Device that discovers conflict sending Network Status
|
||||
* - or another Network Status with identical payload was received */
|
||||
zb_bitfield_t padding:2; /*!< Explicit padding bits */
|
||||
zb_bitfield_t clock:1; /*!< clock value for the clock usage algorithm */
|
||||
zb_bitfield_t redirect_type:2; /*!< redirect type @ref addr_redirect_type */
|
||||
zb_bitfield_t pending_for_delete:1; /*!< record is pending for deletion */
|
||||
|
||||
} ZB_PACKED_STRUCT zb_address_map_t;
|
||||
|
||||
|
||||
/**
|
||||
\par work with compressed addresses
|
||||
*/
|
||||
|
||||
/*
|
||||
* AS: Fixed wrong division 64-bit extended address into
|
||||
* manufacturer specific and device unique parts.
|
||||
*/
|
||||
#define ZB_ADDRESS_DECOMPRESS(address, compressed_address) \
|
||||
do \
|
||||
{ \
|
||||
if (ZB_ADDRESS_COMPRESSED_IS_UNKNOWN(compressed_address)) \
|
||||
{ \
|
||||
ZB_64BIT_ADDR_UNKNOWN(address); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ZB_MEMCPY(&((address)[5]), \
|
||||
&(ZG->addr.dev_manufacturer[(compressed_address).dev_manufacturer].device_manufacturer[0]), \
|
||||
(sizeof((address)[0]) * 3U)); \
|
||||
ZB_MEMCPY(&((address)[0]), &((compressed_address).device_id[0]), (sizeof((address)[0]) * 5U)); \
|
||||
\
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/*
|
||||
#define ZB_ADDRESS_COMPRESSED_CMP(one, two) ( \
|
||||
(one).dev_manufacturer == (two).dev_manufacturer \
|
||||
&& (one).device_id[0] == (two).device_id[0] \
|
||||
&& (one).device_id[1] == (two).device_id[1] \
|
||||
&& (one).device_id[2] == (two).device_id[2] \
|
||||
&& (one).device_id[3] == (two).device_id[3] \
|
||||
&& (one).device_id[4] == (two).device_id[4] )
|
||||
*/
|
||||
zb_bool_t zb_address_compressed_cmp(zb_ieee_addr_compressed_t *one, zb_ieee_addr_compressed_t *two);
|
||||
#define ZB_ADDRESS_COMPRESSED_CMP(one, two) zb_address_compressed_cmp(&one, &two)
|
||||
|
||||
#define ZB_ADDRESS_COMPRESSED_COPY(dest, src) \
|
||||
ZB_MEMCPY(&(dest).dev_manufacturer, &(src).dev_manufacturer, sizeof(zb_ieee_addr_compressed_t))
|
||||
|
||||
/* g_zero_addr is declared as ZB_CONST which allows IAR to place it in CODE memory.
|
||||
Compiled this by IAR 7.60 for 8051.
|
||||
This placement changes pointer type making it unusable
|
||||
Is this cast needed here?
|
||||
*/
|
||||
#define ZB_ADDRESS_COMPRESSED_IS_ZERO(dest) \
|
||||
(ZB_MEMCMP(&(dest).dev_manufacturer, (void const *)g_zero_addr, sizeof(zb_ieee_addr_compressed_t)) == 0)
|
||||
|
||||
#define ZB_ADDRESS_COMPRESSED_IS_UNKNOWN(dest) \
|
||||
(ZB_MEMCMP(&(dest).dev_manufacturer, (void const *)g_unknown_ieee_addr, sizeof(zb_ieee_addr_compressed_t)) == 0)
|
||||
|
||||
#define ZB_ADDRESS_COMPRESS_UNKNOWN(dest) \
|
||||
(ZB_MEMCPY(&(dest).dev_manufacturer, (void const *)g_unknown_ieee_addr, sizeof(zb_ieee_addr_compressed_t)))
|
||||
|
||||
/**
|
||||
Add Pan ID to address storage and return reference.
|
||||
|
||||
@param short_pan_id - 16-bit Pan ID identifier
|
||||
@param pan_id - 64-bit Pan ID identifier
|
||||
@param ref - (output) reference to Pan ID.
|
||||
|
||||
@return RET_OK - when success, error code otherwise.
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_address_pan_id_ref_t panid_ref;
|
||||
zb_ret_t ret;
|
||||
|
||||
ret = zb_address_set_pan_id(mhr.src_pan_id, beacon_payload->extended_panid, &panid_ref);
|
||||
if (ret == RET_ALREADY_EXISTS)
|
||||
{
|
||||
ret = RET_OK;
|
||||
}
|
||||
@endcode
|
||||
|
||||
*/
|
||||
zb_ret_t zb_address_set_pan_id(zb_uint16_t short_pan_id, zb_ext_pan_id_t pan_id, zb_address_pan_id_ref_t *ref);
|
||||
|
||||
|
||||
/**
|
||||
Get extended Pan ID with reference.
|
||||
|
||||
@param pan_id_ref - reference to Pan ID
|
||||
@param pan_id - (output) Pan ID.
|
||||
|
||||
@return nothing
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_uint8_t i;
|
||||
ZB_BUF_INITIAL_ALLOC((zb_bufid_t )ZB_BUF_FROM_REF(param),
|
||||
sizeof(*discovery_confirm) + sizeof(*network_descriptor) * ZB_PANID_TABLE_SIZE,
|
||||
discovery_confirm);
|
||||
zb_nlme_network_descriptor_t *network_descriptor = (zb_nlme_network_descriptor_t *)(discovery_confirm + 1);
|
||||
for (i = 0 ; i < ZG->nwk.neighbor.ext_neighbor_used ; ++i)
|
||||
{
|
||||
zb_address_get_pan_id(ZG->nwk.neighbor.ext_neighbor[i].panid_ref, network_descriptor[j].extended_pan_id);
|
||||
network_descriptor[j].logical_channel = ZG->nwk.neighbor.ext_neighbor[i].logical_channel;
|
||||
...
|
||||
n_nwk_dsc++;
|
||||
}
|
||||
discovery_confirm->network_count = n_nwk_dsc;
|
||||
discovery_confirm->status = (zb_mac_status_t)((zb_bufid_t )ZB_BUF_FROM_REF(param))->u.hdr.status;
|
||||
ZB_SCHEDULE_CALLBACK(zb_nlme_network_discovery_confirm, param);
|
||||
@endcode
|
||||
|
||||
*/
|
||||
void zb_address_get_pan_id(zb_address_pan_id_ref_t pan_id_ref, zb_ext_pan_id_t pan_id);
|
||||
|
||||
/**
|
||||
Clears Pan ID table except own pan_id.
|
||||
|
||||
@param pan_id - (our) Pan ID.
|
||||
|
||||
@return nothing
|
||||
|
||||
*/
|
||||
void zb_address_clear_pan_id_table(zb_ext_pan_id_t pan_id);
|
||||
|
||||
/**
|
||||
Clears whole Pan ID table
|
||||
|
||||
@return nothing
|
||||
|
||||
*/
|
||||
void zb_address_reset_pan_id_table(void);
|
||||
|
||||
/*! @endcond */
|
||||
|
||||
/**
|
||||
Get Pan ID reference with extended Pan ID.
|
||||
|
||||
@param pan_id - Pan ID
|
||||
@param ref - (output) reference to Pan ID
|
||||
|
||||
@return RET_OK - when success, error code otherwise.
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_address_pan_id_ref_t my_panid_ref;
|
||||
if ( zb_address_get_pan_id_ref(ZB_NIB_EXT_PAN_ID(), &my_panid_ref) != RET_OK )
|
||||
{
|
||||
TRACE_MSG(TRACE_NWK1, "Pan ID " TRACE_FORMAT_64 " not in Pan ID arr - ?", (FMT__A,
|
||||
TRACE_ARG_64(ZB_NIB_EXT_PAN_ID())));
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
zb_ret_t zb_address_get_pan_id_ref(zb_ext_pan_id_t pan_id, zb_address_pan_id_ref_t *ref);
|
||||
|
||||
/**
|
||||
Get short Pan ID with reference.
|
||||
|
||||
@param pan_id_ref - reference to Pan ID
|
||||
@param pan_id_p - (output) Pan ID.
|
||||
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_uint16_t nt_panid;
|
||||
zb_address_get_short_pan_id(ZG->nwk.neighbor.ext_neighbor[i].panid_ref, &nt_panid);
|
||||
if (nt_panid == pan_id)
|
||||
{
|
||||
TRACE_MSG(TRACE_NWK1, "pan_id %d is on ch %hd", (FMT__D_H, pan_id, channel));
|
||||
unique_pan_id = 0;
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void zb_address_get_short_pan_id(zb_address_pan_id_ref_t pan_id_ref, zb_uint16_t *pan_id_p);
|
||||
|
||||
|
||||
/**
|
||||
Compare Pan ID in the source form with Pan ID reference.
|
||||
|
||||
@param pan_id_ref - Pan ID ref
|
||||
@param pan_id - Pan ID (64-bit)
|
||||
|
||||
@return ZB_TRUE if addresses are equal, ZB_FALSE otherwise
|
||||
|
||||
@b Example
|
||||
@code
|
||||
for (i = 0 ; i < ZG->nwk.neighbor.ext_neighbor_used ; ++i)
|
||||
{
|
||||
for (j = 0 ; j < n_nwk_dsc &&
|
||||
!zb_address_cmp_pan_id_by_ref(ZG->nwk.neighbor.ext_neighbor[i].panid_ref, network_descriptor[j].extended_pan_id) ;
|
||||
++j)
|
||||
{
|
||||
...
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
zb_bool_t zb_address_cmp_pan_id_by_ref(zb_address_pan_id_ref_t pan_id_ref, zb_ext_pan_id_t pan_id);
|
||||
|
||||
/**
|
||||
Update long/short address pair. Create the pair if not exist. Optionally, lock.
|
||||
Reaction on device announce etc. Long and short addresses are present. Must
|
||||
synchronize the address translation table with this information.
|
||||
|
||||
@note Never call zb_address_update() with empty (zero) ieee_address or empty
|
||||
(-1) short_address.
|
||||
|
||||
@param ieee_address - long address
|
||||
@param short_address - short address
|
||||
@param lock - if TRUE, lock address entry
|
||||
@param ref_p - (out) address reference
|
||||
|
||||
@return RET_OK or error code
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_address_ieee_ref_t addr_ref;
|
||||
zb_uint16_t nwk_addr;
|
||||
zb_zdo_nwk_addr_resp_head_t *resp = (zb_zdo_nwk_addr_resp_head_t*)zb_buf_begin(buf);
|
||||
if (resp->status == ZB_ZDP_STATUS_SUCCESS)
|
||||
{
|
||||
ZB_LETOH64(ieee_addr, resp->ieee_addr);
|
||||
ZB_LETOH16(&nwk_addr, &resp->nwk_addr);
|
||||
zb_address_update(ieee_addr, nwk_addr, ZB_TRUE, &addr_ref);
|
||||
}
|
||||
@endcode
|
||||
|
||||
*/
|
||||
zb_ret_t zb_address_update(zb_ieee_addr_t ieee_address, zb_uint16_t short_address, zb_bool_t lock, zb_address_ieee_ref_t *ref_p);
|
||||
|
||||
void zb_long_address_update_by_ref(zb_ieee_addr_t ieee_address, zb_address_ieee_ref_t ref);
|
||||
|
||||
/**
|
||||
Get address with address reference.
|
||||
|
||||
Get existing IEEE (long) and short addresses with address reference. Update address alive
|
||||
time if it not locked.
|
||||
|
||||
@param ieee_address - (out) long address
|
||||
@param short_address_p - (out) short address
|
||||
@param ref - address reference
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_address_ieee_ref_t addr_ref;
|
||||
zb_nlme_join_indication_t *resp = ZB_BUF_GET_PARAM((zb_bufid_t )ZB_BUF_FROM_REF(param), zb_nlme_join_indication_t);
|
||||
zb_address_by_ref(resp->extended_address, &resp->network_address, addr_ref);
|
||||
@endcode
|
||||
|
||||
*/
|
||||
void zb_address_by_ref(zb_ieee_addr_t ieee_address, zb_uint16_t *short_address_p, zb_address_ieee_ref_t ref);
|
||||
|
||||
/**
|
||||
Get IEEE address with address reference.
|
||||
|
||||
Get existing IEEE address(long address) with address reference. Update address alive time if it not locked.
|
||||
|
||||
@param ieee_address - (out) long address
|
||||
@param ref - address reference
|
||||
|
||||
@b Example
|
||||
@code
|
||||
void func(zb_neighbor_tbl_ent_t *nbt)
|
||||
{
|
||||
zb_ieee_addr_t ieee_addr;
|
||||
zb_address_ieee_by_ref(ieee_addr, nbt->addr_ref);
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
|
||||
*/
|
||||
void zb_address_ieee_by_ref(zb_ieee_addr_t ieee_address, zb_address_ieee_ref_t ref);
|
||||
|
||||
|
||||
/**
|
||||
Get short address by address reference.
|
||||
|
||||
Get existing short address with address reference. Update address alive time if it not locked.
|
||||
|
||||
@param short_address_p - (out) short address
|
||||
@param ref - address reference
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_neighbor_tbl_ent_t *nbt;
|
||||
if(zb_nwk_neighbor_with_address_conflict(&nbt)==RET_OK)
|
||||
{
|
||||
zb_uint16_t addr;
|
||||
zb_address_short_by_ref(&addr, nbt->addr_ref);
|
||||
func(addr);
|
||||
}
|
||||
@endcode
|
||||
|
||||
*/
|
||||
void zb_address_short_by_ref(zb_uint16_t *short_address_p, zb_address_ieee_ref_t ref);
|
||||
|
||||
/**
|
||||
Get address ref by long address, optionally create if not exist, optionally lock.
|
||||
Update address alive time if not locked.
|
||||
@param ieee - IEEE device address
|
||||
@param create - if TRUE, create address entry if it does not exist
|
||||
@param lock - if TRUE, lock address entry
|
||||
@param ref_p - (out) address reference
|
||||
|
||||
@note: never call zb_address_by_ieee() with empty (zero) ieee_address
|
||||
|
||||
@return RET_OK or error code
|
||||
|
||||
@b Example
|
||||
@code
|
||||
void test_get_short_addr(zb_uint8_t param)
|
||||
{
|
||||
zb_address_ieee_ref_t ref_p;
|
||||
zb_bufid_t buf = ZB_BUF_FROM_REF(param);
|
||||
|
||||
if (zb_address_by_ieee(g_ieee_addr_r2, ZB_TRUE, ZB_FALSE, &ref_p) == RET_OK)
|
||||
{
|
||||
...
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
|
||||
*/
|
||||
zb_ret_t zb_address_by_ieee(const zb_ieee_addr_t ieee, zb_bool_t create, zb_bool_t lock, zb_address_ieee_ref_t *ref_p);
|
||||
|
||||
|
||||
/**
|
||||
Get short address by IEEE address (long).
|
||||
|
||||
@param ieee_address - long address
|
||||
|
||||
@return short address if ok, -1 otherwise.
|
||||
|
||||
@par Example
|
||||
@snippet thermostat/thermostat_zc/thermostat_zc.c default_short_addr
|
||||
@snippet thermostat/thermostat_zc/thermostat_zc.c address_short_by_ieee
|
||||
@par
|
||||
|
||||
*/
|
||||
zb_uint16_t zb_address_short_by_ieee(zb_ieee_addr_t ieee_address);
|
||||
|
||||
|
||||
/**
|
||||
Get IEEE address (long) with short address.
|
||||
|
||||
@param short_addr - short address
|
||||
@param ieee_address - (out)long address
|
||||
|
||||
@return RET_OK or RET_NOT_FOUND
|
||||
|
||||
@b Example
|
||||
@snippet light_sample_HA_1_2_bulb/light_coordinator_HA_1_2_bulb/light_zc_HA_1_2_bulb.c address_ieee_by_short
|
||||
|
||||
*/
|
||||
zb_ret_t zb_address_ieee_by_short(zb_uint16_t short_addr, zb_ieee_addr_t ieee_address);
|
||||
|
||||
|
||||
/**
|
||||
Get address reference with long address. Create the reference if it does not exist.
|
||||
Optionally, lock the address. Update address alive time if not locked.
|
||||
@param short_address - 16bit device address
|
||||
@param create - if TRUE, create address entry if it does not exist
|
||||
@param lock - if TRUE, lock address entry
|
||||
@param ref_p - (out) address reference
|
||||
|
||||
@note Never call zb_address_by_short() with empty (-1) short_address
|
||||
|
||||
@return RET_OK or error code
|
||||
|
||||
@b Example
|
||||
@snippet simple_gw/simple_gw.c address_by_short
|
||||
|
||||
*/
|
||||
zb_ret_t zb_address_by_short(zb_uint16_t short_address, zb_bool_t create, zb_bool_t lock, zb_address_ieee_ref_t *ref_p);
|
||||
|
||||
|
||||
/*! @cond internals_doc */
|
||||
/**
|
||||
Get address ref by index from short_sorted table.
|
||||
@param index - index address short_sorted table
|
||||
@param ref_p - (out) address reference
|
||||
|
||||
@return RET_OK or error code
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_address_ieee_ref_t ref_p;
|
||||
if( ZG->nwk.neighbor.base_neighbor_used > 0 &&
|
||||
zb_address_by_sorted_table_index(ZG->nwk.neighbor.send_link_status_index, &ref_p)==RET_OK
|
||||
)
|
||||
{
|
||||
...
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
zb_ret_t zb_address_by_sorted_table_index(zb_ushort_t index, zb_address_ieee_ref_t *ref_p);
|
||||
/*! @endcond */
|
||||
|
||||
/**
|
||||
Check that address is locked (has lock counter > 0)
|
||||
|
||||
@param ref - IEEE/network address pair reference
|
||||
|
||||
@return ZB_TRUE if address is locked
|
||||
*/
|
||||
zb_bool_t zb_address_is_locked(zb_address_ieee_ref_t ref);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Increase address lock counter, when it used in some table.
|
||||
Address must be already locked.
|
||||
|
||||
@param ref - IEEE/network address pair reference
|
||||
|
||||
@return RET_OK or RET_ERROR
|
||||
*/
|
||||
#define zb_address_lock(ref) zb_address_lock_func(TRACE_ADDR_CALL ref)
|
||||
|
||||
zb_ret_t zb_address_lock_func(TRACE_ADDR_PROTO zb_address_ieee_ref_t ref);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Unlock address counter. Decrease lock counter.
|
||||
|
||||
@param ref - IEEE/network address pair reference
|
||||
*/
|
||||
#define zb_address_unlock(ref) zb_address_unlock_func(TRACE_ADDR_CALL ref)
|
||||
|
||||
void zb_address_unlock_func(TRACE_ADDR_PROTO zb_address_ieee_ref_t ref);
|
||||
|
||||
/**
|
||||
Delete address.
|
||||
|
||||
@return RET_OK or RET_ERROR
|
||||
|
||||
@param ref - IEEE/network address pair reference
|
||||
*/
|
||||
zb_ret_t zb_address_delete(zb_address_ieee_ref_t ref);
|
||||
|
||||
|
||||
/*! @cond internals_doc */
|
||||
|
||||
/**
|
||||
Compress long address: store manufacturer address part elsewhere
|
||||
|
||||
This routine packs 8 bytes address to 6 bytes
|
||||
|
||||
@param address - uncompressed address
|
||||
@param compressed_address - (out) compressed address
|
||||
|
||||
@b Example
|
||||
@code
|
||||
void func(zb_address_pan_id_ref_t panid_ref, zb_ieee_addr_t long_addr, zb_ext_neighbor_tbl_ent_t **enbt)
|
||||
{
|
||||
zb_ieee_addr_compressed_t compressed_addr;
|
||||
zb_ieee_addr_compress(long_addr, &compressed_addr);
|
||||
|
||||
for (i = 0 ; i < ZG->nwk.neighbor.ext_neighbor_used ; ++i)
|
||||
{
|
||||
if (ZG->nwk.neighbor.ext_neighbor[i].panid_ref == panid_ref
|
||||
&& ZB_ADDRESS_COMPRESSED_CMP(ZG->nwk.neighbor.ext_neighbor[i].long_addr, compressed_addr))
|
||||
{
|
||||
*enbt = &ZG->nwk.neighbor.ext_neighbor[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void zb_ieee_addr_compress(const zb_ieee_addr_t address, zb_ieee_addr_compressed_t *compressed_address);
|
||||
|
||||
|
||||
/**
|
||||
Decompress compressed long address.
|
||||
|
||||
This routine unpacks 6 bytes address to 8 bytes
|
||||
|
||||
@param address - (out) uncompressed address
|
||||
@param compressed_address - compressed address
|
||||
|
||||
@b Example
|
||||
@code
|
||||
zb_ieee_addr_t long_address;
|
||||
if (ZG->nwk.neighbor.ext_neighbor[i].short_addr != (zb_uint16_t)~0)
|
||||
{
|
||||
if (!ZB_ADDRESS_COMPRESSED_IS_UNKNOWN(ZG->nwk.neighbor.ext_neighbor[i].long_addr))
|
||||
{
|
||||
zb_ieee_addr_decompress(long_address, &ZG->nwk.neighbor.ext_neighbor[i].long_addr);
|
||||
zb_address_update(long_address, ZG->nwk.neighbor.ext_neighbor[i].short_addr, ZB_FALSE, &addr_ref);
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void zb_ieee_addr_decompress(zb_ieee_addr_t address, zb_ieee_addr_compressed_t *compressed_address);
|
||||
|
||||
/**
|
||||
Check that two address refs refer to the one address.
|
||||
In this case one record is regular, second - redirect.
|
||||
Also returns returns true if addr_ref_a is equal to addr_ref_b.
|
||||
|
||||
@param addr_ref_a Address ref to compare.
|
||||
@param addr_ref_b Address ref to compare.
|
||||
@return zb_bool_t ZB_FALSE if these address refs refer to different addresses.
|
||||
ZB_TRUE otherwise.
|
||||
*/
|
||||
zb_bool_t zb_address_cmp_two_refs(zb_address_ieee_ref_t addr_ref_a, zb_address_ieee_ref_t addr_ref_b);
|
||||
|
||||
/**
|
||||
* @brief Check that address reference is used
|
||||
*
|
||||
* @param ref Address ref to check
|
||||
* @return zb_bool_t ZB_TRUE if address is used, ZB_FALSE otherwise.
|
||||
*/
|
||||
zb_bool_t zb_address_in_use(zb_address_ieee_ref_t ref);
|
||||
|
||||
/**
|
||||
* @brief Check if address tables have enough memory for the new address
|
||||
*
|
||||
@param new_addr - new uncompressed IEEE address
|
||||
* @return zb_bool_t ZB_TRUE if there is enough memory, ZB_FALSE otherwise.
|
||||
*/
|
||||
zb_bool_t zb_address_check_mem_for_new_addr(const zb_ieee_addr_t new_addr);
|
||||
/*! @endcond */
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
||||
#endif /* ZB_ADDRESS_H */
|
||||
@@ -0,0 +1,564 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Channel page header file. All channel-related stuff.
|
||||
*/
|
||||
#ifndef ZB_CHANNEL_PAGE_H
|
||||
#define ZB_CHANNEL_PAGE_H 1
|
||||
|
||||
#include "zb_config.h"
|
||||
#include "zb_types.h"
|
||||
#include "zb_errors.h"
|
||||
|
||||
/*! \addtogroup channel_page */
|
||||
/*! @{ */
|
||||
|
||||
#define ZB_CHANNEL_PAGE_PAGE_BITMASK 0xF8000000u
|
||||
#define ZB_CHANNEL_PAGE_MASK_BITMASK 0x07FFFFFFu
|
||||
|
||||
/**
|
||||
* Represents the fields of the Channel Page structure (binary encoded channel
|
||||
* page and channels mask).
|
||||
*/
|
||||
typedef zb_uint32_t zb_channel_page_t;
|
||||
|
||||
/**
|
||||
* Channel list structure (ZBOSS internal)
|
||||
*/
|
||||
typedef zb_channel_page_t zb_channel_list_t[ZB_CHANNEL_PAGES_NUM];
|
||||
|
||||
/* Private API */
|
||||
#define ZB_CHANNEL_LIST_PAGE0_IDX 0U
|
||||
#define ZB_CHANNEL_LIST_PAGE23_IDX 1U
|
||||
#define ZB_CHANNEL_LIST_PAGE24_IDX 2U
|
||||
#define ZB_CHANNEL_LIST_PAGE25_IDX 3U
|
||||
#define ZB_CHANNEL_LIST_PAGE26_IDX 4U
|
||||
#define ZB_CHANNEL_LIST_PAGE27_IDX 5U
|
||||
#define ZB_CHANNEL_LIST_PAGE28_IDX 6U
|
||||
#define ZB_CHANNEL_LIST_PAGE29_IDX 7U
|
||||
#define ZB_CHANNEL_LIST_PAGE30_IDX 8U
|
||||
#define ZB_CHANNEL_LIST_PAGE31_IDX 9U
|
||||
|
||||
#define ZB_PAGE0_2_4_GHZ_CHANNEL_FROM 11U
|
||||
#define ZB_PAGE0_2_4_GHZ_CHANNEL_TO 26U
|
||||
|
||||
#define ZB_PAGE23_SUB_GHZ_CHANNEL_FROM 0U
|
||||
#define ZB_PAGE23_SUB_GHZ_CHANNEL_TO 24U
|
||||
|
||||
#define ZB_PAGE24_SUB_GHZ_CHANNEL_FROM 56U
|
||||
#define ZB_PAGE24_SUB_GHZ_CHANNEL_TO 76U
|
||||
|
||||
#define ZB_PAGE25_SUB_GHZ_CHANNEL_FROM 0U
|
||||
#define ZB_PAGE25_SUB_GHZ_CHANNEL_TO 26U
|
||||
|
||||
#define ZB_PAGE26_SUB_GHZ_CHANNEL_FROM 27U
|
||||
#define ZB_PAGE26_SUB_GHZ_CHANNEL_TO 34U
|
||||
|
||||
#define ZB_PAGE27_SUB_GHZ_CHANNEL_FROM 35U
|
||||
#define ZB_PAGE27_SUB_GHZ_CHANNEL_TO 55U
|
||||
|
||||
#define ZB_PAGE28_SUB_GHZ_CHANNEL_FROM 0U
|
||||
#define ZB_PAGE28_SUB_GHZ_CHANNEL_TO 26U
|
||||
|
||||
#define ZB_PAGE29_SUB_GHZ_CHANNEL_FROM 27U
|
||||
#define ZB_PAGE29_SUB_GHZ_CHANNEL_TO 34U
|
||||
|
||||
#define ZB_PAGE30_SUB_GHZ_CHANNEL_FROM 35U
|
||||
#define ZB_PAGE30_SUB_GHZ_CHANNEL_TO 61U
|
||||
|
||||
#define ZB_PAGES_28_29_30_SUG_GHZ_CHANNEL_FROM ZB_PAGE28_SUB_GHZ_CHANNEL_FROM
|
||||
/**
|
||||
* NR: Adding one more channel since page 29 takes channels (27-34) and 62
|
||||
*/
|
||||
#define ZB_PAGES_28_29_30_SUG_GHZ_CHANNEL_TO 62U
|
||||
#define ZB_PAGE29_SUB_GHZ_CHANNEL_62 62U
|
||||
|
||||
#define ZB_PAGE31_SUB_GHZ_CHANNEL_FROM 0U
|
||||
#define ZB_PAGE31_SUB_GHZ_CHANNEL_TO 26U
|
||||
|
||||
#define ZB_CHANNEL_PAGE_TO_IDX(channel_page) (((channel_page) > 0U) ? ((channel_page) - 22U) : 0U)
|
||||
#define ZB_CHANNEL_PAGE_FROM_IDX(channel_page_idx) (((channel_page_idx) > 0U) ? ((channel_page_idx) + 22U) : 0U)
|
||||
|
||||
#ifdef ZB_PAGES_REMAP_TO_2_4GHZ
|
||||
/**
|
||||
The following remap stuff allows to remap Sub GHz pages/channel to 2.4GHz.
|
||||
This is used to test Sub GHz without getting out from the town to desert
|
||||
island due to wide range of Sub GHz.
|
||||
|
||||
Remap is based on using of channels range of 2.4GHz to imitate working with
|
||||
Sub GHz. The main idea is to divide channels range of 2.4GHz, where each
|
||||
channels area corresponds to particular channel page. We have 5 channel
|
||||
pages, so the range of channel numbers of 2.4GHz is divided into 5 areas:
|
||||
|
||||
* 0-2 - PAGE0
|
||||
* 3-5 - PAGE28
|
||||
* 6-8 - PAGE29
|
||||
* 9-11 - PAGE30
|
||||
* 12-14 - PAGE31
|
||||
|
||||
So whole range of used channel numbers starts from 0 and ends with 14
|
||||
(15 channels of 2.4GHz are used).
|
||||
|
||||
The following formula is used to remap channel number into 2.4GHz channel number.
|
||||
* remap_channel_number = (channel_number % 3) + page_shift
|
||||
*/
|
||||
|
||||
#define ZB_PAGES_REMAP_PAGE_CHANNELS_NUM 3U
|
||||
|
||||
#define ZB_PAGES_REMAP_PAGE0_SHIFT 0U
|
||||
#define ZB_PAGES_REMAP_PAGE28_SHIFT (ZB_PAGES_REMAP_PAGE0_SHIFT + ZB_PAGES_REMAP_PAGE_CHANNELS_NUM)
|
||||
#define ZB_PAGES_REMAP_PAGE29_SHIFT (ZB_PAGES_REMAP_PAGE28_SHIFT + ZB_PAGES_REMAP_PAGE_CHANNELS_NUM)
|
||||
#define ZB_PAGES_REMAP_PAGE30_SHIFT (ZB_PAGES_REMAP_PAGE29_SHIFT + ZB_PAGES_REMAP_PAGE_CHANNELS_NUM)
|
||||
#define ZB_PAGES_REMAP_PAGE31_SHIFT (ZB_PAGES_REMAP_PAGE30_SHIFT + ZB_PAGES_REMAP_PAGE_CHANNELS_NUM)
|
||||
|
||||
#define ZB_PAGES_REMAP_CHANNEL_PAGE ZB_CHANNEL_PAGE0_2_4_GHZ
|
||||
#define ZB_PAGES_REMAP_CHANNEL_NUMBER(page, channel_number) (((channel_number % ZB_PAGES_REMAP_PAGE_CHANNELS_NUM)) + ZB_PAGE0_2_4_GHZ_START_CHANNEL_NUMBER + \
|
||||
(page == ZB_CHANNEL_PAGE28_SUB_GHZ ? ZB_PAGES_REMAP_PAGE28_SHIFT : \
|
||||
(page == ZB_CHANNEL_PAGE29_SUB_GHZ ? ZB_PAGES_REMAP_PAGE29_SHIFT : \
|
||||
(page == ZB_CHANNEL_PAGE30_SUB_GHZ ? ZB_PAGES_REMAP_PAGE30_SHIFT : \
|
||||
(page == ZB_CHANNEL_PAGE31_SUB_GHZ ? ZB_PAGES_REMAP_PAGE31_SHIFT : \
|
||||
ZB_PAGES_REMAP_PAGE0_SHIFT)))))
|
||||
|
||||
/**
|
||||
Remaps logical channel into corresponding logical channel in 2.4GHz range.
|
||||
|
||||
@param channel_page - original channel page
|
||||
@param logical_channel - original logical channel in scope of original channel page
|
||||
@param remap_logical_channel [out] - remapped logical channel in scope of 2.4GHz
|
||||
|
||||
@return remapped channel if success
|
||||
0xff in case of error
|
||||
*/
|
||||
zb_uint8_t zb_pages_remap_logical_channel(zb_uint8_t channel_page,
|
||||
zb_uint8_t logical_channel);
|
||||
|
||||
#define ZB_PAGES_REMAP_LOGICAL_CHANNEL(page, lchannel_number) zb_pages_remap_logical_channel(page, lchannel_number)
|
||||
|
||||
#else
|
||||
|
||||
#define ZB_PAGES_REMAP_LOGICAL_CHANNEL(page, lchannel_number) (lchannel_number)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gets channel page field from Channel page structure
|
||||
*
|
||||
* @param channel_page - binary encoded channel page and channels mask
|
||||
*/
|
||||
#define ZB_CHANNEL_PAGE_GET_PAGE(channel_page) (((channel_page) & ZB_CHANNEL_PAGE_PAGE_BITMASK) >> 27U)
|
||||
|
||||
/**
|
||||
* Gets channels mask field from Channel page structure
|
||||
*
|
||||
* @param channel_page - binary encoded channel page and channels mask
|
||||
*/
|
||||
#define ZB_CHANNEL_PAGE_GET_MASK(channel_page) ((channel_page) & ZB_CHANNEL_PAGE_MASK_BITMASK)
|
||||
|
||||
/**
|
||||
* Sets channel page field for Channel page structure
|
||||
*
|
||||
* @param channel_page - binary encoded channel page and channels mask
|
||||
* @param page - channel page to set
|
||||
*/
|
||||
#define ZB_CHANNEL_PAGE_SET_PAGE(channel_page, page) (channel_page) = ((channel_page) & ZB_CHANNEL_PAGE_MASK_BITMASK) | (((zb_uint32_t)(page)) << 27U)
|
||||
|
||||
/**
|
||||
* Sets channels mask field for Channel page structure
|
||||
*
|
||||
* @param channel_page - binary encoded channel page and channels mask
|
||||
* @param mask - channels mask to set
|
||||
*/
|
||||
#define ZB_CHANNEL_PAGE_SET_MASK(channel_page, mask) (channel_page) = ((channel_page) & ZB_CHANNEL_PAGE_PAGE_BITMASK) | ((mask) & ZB_CHANNEL_PAGE_MASK_BITMASK)
|
||||
|
||||
/* Numbers [23 - 31] have common first bit
|
||||
*
|
||||
* 23 = 0b10111
|
||||
* 24 = 0b11000
|
||||
* 25 = 0b11001
|
||||
* 26 = 0b11010
|
||||
* 27 = 0b11011
|
||||
* 28 = 0b11100
|
||||
* 29 = 0b11101
|
||||
* 30 = 0b11110
|
||||
* 31 = 0b11111
|
||||
*
|
||||
* So, it is enough to compare it with 0b10111 mask = 0x17 = 23 (dec).
|
||||
*/
|
||||
#define ZB_LOGICAL_PAGE_SUB_GHZ_PAGE_MASK ZB_CHANNEL_PAGE23_SUB_GHZ
|
||||
|
||||
#define ZB_LOGICAL_PAGE_IS_SUB_GHZ(logical_page) \
|
||||
(ZB_U2B((logical_page) & ZB_LOGICAL_PAGE_SUB_GHZ_PAGE_MASK))
|
||||
|
||||
#define ZB_LOGICAL_PAGE_IS_SUB_GHZ_NA_FSK(logical_page) \
|
||||
((logical_page) == ZB_CHANNEL_PAGE23_SUB_GHZ)
|
||||
|
||||
#define ZB_LOGICAL_PAGE_IS_SUB_GHZ_EU_FSK(logical_page) \
|
||||
((logical_page) >= ZB_CHANNEL_PAGE24_SUB_GHZ && (logical_page) <= ZB_CHANNEL_PAGE27_SUB_GHZ)
|
||||
|
||||
#define ZB_LOGICAL_PAGE_IS_SUB_GHZ_GB_FSK(logical_page) \
|
||||
((logical_page) >= ZB_CHANNEL_PAGE28_SUB_GHZ && (logical_page) <= ZB_CHANNEL_PAGE31_SUB_GHZ)
|
||||
|
||||
#define ZB_LOGICAL_PAGE_IS_2_4GHZ(logical_page) \
|
||||
((logical_page) == ZB_CHANNEL_PAGE0_2_4_GHZ)
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_SUB_GHZ(channel_page) \
|
||||
(ZB_LOGICAL_PAGE_IS_SUB_GHZ(ZB_CHANNEL_PAGE_GET_PAGE(channel_page)))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_SUB_GHZ_NA_FSK(channel_page) \
|
||||
(ZB_LOGICAL_PAGE_IS_SUB_GHZ_NA_FSK(ZB_CHANNEL_PAGE_GET_PAGE(channel_page)))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_SUB_GHZ_EU_FSK(channel_page) \
|
||||
(ZB_LOGICAL_PAGE_IS_SUB_GHZ_EU_FSK(ZB_CHANNEL_PAGE_GET_PAGE(channel_page)))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_SUB_GHZ_GB_FSK(channel_page) \
|
||||
(ZB_LOGICAL_PAGE_IS_SUB_GHZ_GB_FSK(ZB_CHANNEL_PAGE_GET_PAGE(channel_page)))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_2_4GHZ(channel_page) \
|
||||
(ZB_LOGICAL_PAGE_IS_2_4GHZ(ZB_CHANNEL_PAGE_GET_PAGE(channel_page)))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_IS_MASK_EMPTY(channel_page) \
|
||||
(ZB_CHANNEL_PAGE_GET_MASK(channel_page) == 0U)
|
||||
|
||||
/**
|
||||
* @brief Copies source channel page list to the destination. Destination list
|
||||
* must be allocated.
|
||||
*
|
||||
* @note Number of elements in both lists must be equal to ZB_CHANNEL_PAGES_NUM.
|
||||
*
|
||||
* @param dst - destination channel page list
|
||||
* @param src - source channel page list
|
||||
*/
|
||||
void zb_channel_page_list_copy(zb_channel_list_t dst,
|
||||
zb_channel_list_t src);
|
||||
|
||||
/**
|
||||
* @brief Sets channels mask for specified element of channel page list.
|
||||
*
|
||||
* @param list - channel page list
|
||||
* @param idx - index of the list element
|
||||
* @param mask - channels mask to set
|
||||
*/
|
||||
void zb_channel_page_list_set_mask(zb_channel_list_t list,
|
||||
zb_uint8_t idx,
|
||||
zb_uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Gets channels mask of specified element of channel page list.
|
||||
*
|
||||
* @param list - channel page list
|
||||
* @param idx - index of the list element
|
||||
*
|
||||
* @return Channels mask.
|
||||
*/
|
||||
zb_uint32_t zb_channel_page_list_get_mask(zb_channel_list_t list,
|
||||
zb_uint8_t idx);
|
||||
|
||||
/**
|
||||
* @brief Sets channel page for specified element of channel page list.
|
||||
*
|
||||
* @param list - channel page list
|
||||
* @param idx - index of the list element
|
||||
* @param page - channel page to set
|
||||
*/
|
||||
void zb_channel_page_list_set_page(zb_channel_list_t list,
|
||||
zb_uint8_t idx,
|
||||
zb_uint8_t page);
|
||||
|
||||
/**
|
||||
* @brief Gets channel page of specified element of channel page list.
|
||||
*
|
||||
* @param list - channel page list
|
||||
* @param idx - index of the list element
|
||||
*
|
||||
* @return Channel page.
|
||||
*/
|
||||
zb_uint8_t zb_channel_page_list_get_page(zb_channel_list_t list,
|
||||
zb_uint8_t idx);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gets channel page index in channel lists.
|
||||
*
|
||||
* @param page - channel page
|
||||
* @param idx [out] - index of the channel page in channel lists
|
||||
*
|
||||
* @return RET_OK or RET_NOT_FOUND.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_list_get_page_idx(zb_uint8_t page, zb_uint8_t *idx);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gets page number by channel page index.
|
||||
*
|
||||
* @param idx - index of the channel page in channel lists
|
||||
* @param page[out] - channel page
|
||||
*
|
||||
* @return RET_OK or RET_NOT_FOUND.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_get_page_by_idx(zb_uint8_t idx, zb_uint8_t *page);
|
||||
|
||||
/**
|
||||
* @brief Gets all channels mask by a page number
|
||||
*
|
||||
* @param page - channel page
|
||||
*
|
||||
* @return the all channels mask for a certain page
|
||||
*/
|
||||
zb_uint32_t zb_channel_page_get_all_channels_mask_by_page(zb_uint8_t page);
|
||||
|
||||
/**
|
||||
* @brief Sets channels mask for the list element of channel page list that
|
||||
* corresponds to 2.4GHz.
|
||||
*
|
||||
* @param list - channel page list
|
||||
* @param mask - channels mask to set
|
||||
*/
|
||||
void zb_channel_page_list_set_2_4GHz_mask(zb_channel_list_t list,
|
||||
zb_uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Gets channels mask of the list element of channel page list that
|
||||
* corresponds to 2.4GHz.
|
||||
*
|
||||
* @param list - channel page list
|
||||
*
|
||||
* @return 2.4GHz channels mask.
|
||||
*/
|
||||
zb_uint32_t zb_channel_page_list_get_2_4GHz_mask(zb_channel_list_t list);
|
||||
|
||||
/*
|
||||
* @brief Gets the first filled page index of channel page list.
|
||||
*
|
||||
* @param list - channel page list
|
||||
*
|
||||
* @return Page index of the first used page or number of pages if all list is empty.
|
||||
*/
|
||||
zb_uint8_t zb_channel_page_list_get_first_filled_page(zb_channel_list_t list);
|
||||
|
||||
/**
|
||||
* @brief Sets channels mask for specified element of the AIB channel page list.
|
||||
*
|
||||
* @param idx - index of the list element
|
||||
* @param mask - channels mask to set
|
||||
*/
|
||||
void zb_aib_channel_page_list_set_mask(zb_uint8_t idx,
|
||||
zb_uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Gets channels mask of specified element of the AIB channel page list.
|
||||
*
|
||||
* @param idx - index of the list element
|
||||
*
|
||||
* @return Channels mask.
|
||||
*/
|
||||
zb_uint32_t zb_aib_channel_page_list_get_mask(zb_uint8_t idx);
|
||||
|
||||
/**
|
||||
* @brief Sets channel page for specified element of the AIB channel page list.
|
||||
*
|
||||
* @param idx - index of the list element
|
||||
* @param page - channel page to set
|
||||
*/
|
||||
void zb_aib_channel_page_list_set_page(zb_uint8_t idx,
|
||||
zb_uint8_t page);
|
||||
|
||||
/**
|
||||
* @brief Gets channels page of specified element of the AIB channel page list.
|
||||
*
|
||||
* @param idx - index of the list element
|
||||
*
|
||||
* @return Channel page.
|
||||
*/
|
||||
zb_uint8_t zb_aib_channel_page_list_get_page(zb_uint8_t idx);
|
||||
|
||||
/**
|
||||
* @brief Sets channels mask for the list element of the AIB channel page list that
|
||||
* corresponds to 2.4GHz.
|
||||
*
|
||||
* @param mask - channels mask to set
|
||||
*/
|
||||
void zb_aib_channel_page_list_set_2_4GHz_mask(zb_uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Gets channels mask of the list element of the AIB channel page list that
|
||||
* corresponds to 2.4GHz.
|
||||
*
|
||||
* @return 2.4GHz channels mask.
|
||||
*/
|
||||
zb_uint32_t zb_aib_channel_page_list_get_2_4GHz_mask(void);
|
||||
|
||||
/*
|
||||
* @brief Gets the first filled page index of the AIB channel page list.
|
||||
*
|
||||
* @return Page index of the first used AIB channel page or number of pages if all list is empty.
|
||||
*/
|
||||
zb_uint8_t zb_aib_channel_page_list_get_first_filled_page(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the first channel number for specified channel page.
|
||||
*
|
||||
* @note The channel number is returned in inner representation as channels bits
|
||||
* stored in channel mask internally, it may differ from real channel numbers
|
||||
* specified by spec.
|
||||
*
|
||||
* @param page - channel page
|
||||
* @param channel_number [out] - channel number
|
||||
*
|
||||
* @return RET_OK or RET_NOT_FOUND.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_get_start_channel_number(zb_uint8_t page, zb_uint8_t *channel_number);
|
||||
|
||||
/**
|
||||
* @brief Gets the last channel number for specified channel page.
|
||||
*
|
||||
* @note The channel number is returned in inner representation as channels bits
|
||||
* stored in channel mask internally, it may differ from real channel numbers
|
||||
* specified by spec.
|
||||
*
|
||||
* @param page - channel page
|
||||
* @param channel_number [out] - channel number
|
||||
*
|
||||
* @return RET_OK or RET_NOT_FOUND.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_get_max_channel_number(zb_uint8_t page, zb_uint8_t *channel_number);
|
||||
|
||||
/**
|
||||
* @brief Converts logical channel to channel number within channel mask for
|
||||
* specified channel page. For example:
|
||||
* - page [in] = 30
|
||||
* - logical channel [in] = 36
|
||||
* - channel number [out] = 1
|
||||
*
|
||||
* @param page [in] - channel page
|
||||
* @param logical_channel [in] - logical channel (e.g. simply channel)
|
||||
* @param channel_number [out] - channel number within channel mask (inner representation)
|
||||
*
|
||||
* @return RET_OK - success,
|
||||
* RET_NOT_FOUND - unknown channel page,
|
||||
* RET_INVALID_PARAMETER - unacceptable logical channel for specified channel page.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_channel_logical_to_number(zb_uint8_t page,
|
||||
zb_uint8_t logical_channel,
|
||||
zb_uint8_t *channel_number);
|
||||
|
||||
/**
|
||||
* @brief Converts channel number within channel mask to logical channel for
|
||||
* specified channel page. For example:
|
||||
* - page [in] = 30
|
||||
* - channel number [in] = 1
|
||||
* - logical channel [out] = 36
|
||||
*
|
||||
* @param page - channel page
|
||||
* @param channel_number - channel number within channel mask (inner representation)
|
||||
* @param logical_channel [out] - logical channel (e.g. simply channel)
|
||||
*
|
||||
* @return RET_OK - success,
|
||||
* RET_NOT_FOUND - unknown channel page,
|
||||
* RET_INVALID_PARAMETER - unacceptable logical channel for specified channel page.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_channel_number_to_logical(zb_uint8_t page,
|
||||
zb_uint8_t channel_number,
|
||||
zb_uint8_t *logical_channel);
|
||||
|
||||
/**
|
||||
* @brief Sets bit in channel mask corresponding to specified channel number.
|
||||
*
|
||||
* @param list - channel list
|
||||
* @param idx - index of channel page which channel mask will be modified
|
||||
* @param channel_number - channel number within channel mask (inner representation)
|
||||
*
|
||||
* @return RET_OK - success,
|
||||
* RET_INVALID_PARAMETER - unacceptable channel number for specified channel page.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_list_set_channel(zb_channel_list_t list,
|
||||
zb_uint8_t idx,
|
||||
zb_uint8_t channel_number);
|
||||
|
||||
/**
|
||||
* @brief Sets bit in channel mask corresponding to specified channel number.
|
||||
*
|
||||
* @param list - channel list
|
||||
* @param page - logicl page number
|
||||
* @param channel_number - logical channel number
|
||||
*
|
||||
* @return RET_OK - success,
|
||||
* RET_INVALID_PARAMETER - unacceptable channel number for specified channel page.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_list_set_logical_channel(zb_channel_list_t list,
|
||||
zb_uint8_t page,
|
||||
zb_uint8_t channel_number);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Unsets bit in channel mask corresponding to specified channel number.
|
||||
*
|
||||
* @param list - channel list
|
||||
* @param idx - index of channel page which channel mask will be modified
|
||||
* @param channel_number - channel number within channel mask (inner representation)
|
||||
*
|
||||
* @return RET_OK - success,
|
||||
* RET_INVALID_PARAMETER - unacceptable channel number for specified channel page.
|
||||
*/
|
||||
zb_ret_t zb_channel_page_list_unset_channel(zb_channel_list_t list,
|
||||
zb_uint8_t idx,
|
||||
zb_uint8_t channel_number);
|
||||
|
||||
zb_uint8_t zb_channel_page_list_get_channels_num(zb_channel_list_t list,
|
||||
zb_uint8_t idx);
|
||||
|
||||
|
||||
#ifdef ZB_MAC_CONFIGURABLE_TX_POWER
|
||||
/**
|
||||
* @brief Get offsets for MAC TX power stored in the production config for
|
||||
* specified channel and page
|
||||
*
|
||||
* @param page - logicl page number
|
||||
* @param channel_number - logical channel number
|
||||
* @param array_idx [out] - pointer to store array id. The value -1 is an invalid value.
|
||||
* @param array_ofs [out] - pointer to store array offset. The value -1 is an invalid value.
|
||||
*
|
||||
*/
|
||||
void zb_channel_get_tx_power_offset(zb_uint8_t page, zb_uint8_t channel,
|
||||
zb_uint8_t *array_idx, zb_uint8_t *array_ofs);
|
||||
|
||||
#endif /* ZB_MAC_CONFIGURABLE_TX_POWER */
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif /* ZB_CHANNEL_PAGE_H */
|
||||
2319
managed_components/espressif__esp-zboss-lib/include/zb_config.h
Normal file
2319
managed_components/espressif__esp-zboss-lib/include/zb_config.h
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "hal/gpio_types.h"
|
||||
#include "hal/uart_types.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_ieee802154_types.h"
|
||||
|
||||
#define ZB_ESP
|
||||
#define ZB_CONFIG_ESP
|
||||
|
||||
#define ZB_LEDS_MASK
|
||||
#define ZB_USE_BUTTONS
|
||||
#define ZB_SOFT_SECURITY
|
||||
|
||||
#define MAC_TRANSPORT_USES_SELECT
|
||||
|
||||
#define ZB_LITTLE_ENDIAN
|
||||
#define ZB_NEED_ALIGN
|
||||
|
||||
/* our MAC */
|
||||
#define ZB_MANUAL_ACK
|
||||
#define ZB_AUTO_ACK_TX
|
||||
#define ZB_MAC_AUTO_ACK_RECV
|
||||
#define ZB_MAC_RX_QUEUE_CAP 20
|
||||
#define ZB_MAC_TIMESTAMP_IN_PKT
|
||||
#define MAC_AUTO_DELAY_IN_MAC_GP_SEND
|
||||
|
||||
/* MAC Pending Bit Matching */
|
||||
#define ZB_MAC_PENDING_BIT_SOURCE_MATCHING
|
||||
#define ZB_MAC_HARDWARE_PB_MATCHING
|
||||
|
||||
#define ZB_GPD_TX_OFFSET_US \
|
||||
(ZB_MILLISECONDS_TO_USEC(ZB_GPD_RX_OFFSET_MS) - \
|
||||
2 * ZB_MAC_A_UNIT_BACKOFF_PERIOD * ZB_SYMBOL_DURATION_USEC \
|
||||
- 900)
|
||||
|
||||
/* Default long poll interval */
|
||||
uint32_t zb_get_default_long_poll_interval(void);
|
||||
#define ESP_ZB_PIM_DEFAULT_LONG_POLL_INTERVAL zb_get_default_long_poll_interval()
|
||||
263
managed_components/espressif__esp-zboss-lib/include/zb_debug.h
Normal file
263
managed_components/espressif__esp-zboss-lib/include/zb_debug.h
Normal file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Tests and debug macros
|
||||
*/
|
||||
#ifndef ZB_DEBUG_H
|
||||
#define ZB_DEBUG_H 1
|
||||
|
||||
/*! \addtogroup ZB_ASSERT_DYNAMIC */
|
||||
/*! @{ */
|
||||
|
||||
#if (defined USE_ASSERT)
|
||||
/**
|
||||
Trace current location, abort current program execution, with core dump if possible.
|
||||
|
||||
@param caller_file - source file name
|
||||
@param caller_line - line in the source
|
||||
*/
|
||||
void zb_abort(char *caller_file, int caller_line);
|
||||
|
||||
#if !defined(ZB_BINARY_TRACE) || defined(ESP_ZB_USE_ASSERT)
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Assert: print diagnostic and force core dump
|
||||
|
||||
@param file_name - source file name
|
||||
@param line_number - line in the source
|
||||
*/
|
||||
ZB_NORETURN void zb_assert(const zb_char_t *file_name, zb_int_t line_number);
|
||||
/** @endcond */
|
||||
/**
|
||||
Check for expression in runtime and call zb_assert() if it is false.
|
||||
|
||||
Compiled to nothing if USE_ASSERT is not defined.
|
||||
|
||||
@param expr expression to check
|
||||
*/
|
||||
#define ZB_ASSERT(expr) do {if(!(expr)){zb_assert(__FILE__, __LINE__);}} while (0)
|
||||
/** @cond internals_doc */
|
||||
#define ZB_INLINE_ASSERT_SIMPLE(expr) ((expr) ? 1 : (zb_assert(__FILE__, __LINE__), 1))
|
||||
/** @endcond */
|
||||
|
||||
#else /* !ZB_BINARY_TRACE */
|
||||
/**
|
||||
Assert: print diagnostic and force core dump
|
||||
|
||||
@param file_id - source file id
|
||||
@param line_number - line in the source
|
||||
*/
|
||||
ZB_NORETURN void zb_assert(zb_uint16_t file_id, zb_int_t line_number);
|
||||
/**
|
||||
Check for expression in runtime and call zb_assert() if it is false.
|
||||
|
||||
Compiled to nothing if USE_ASSERT is not defined.
|
||||
|
||||
@param expr expression to check
|
||||
*/
|
||||
#define ZB_ASSERT(expr) do {if(!(expr)) { zb_assert(ZB_TRACE_FILE_ID, __LINE__);} } while (0)
|
||||
/** @cond internals_doc */
|
||||
#define ZB_INLINE_ASSERT_SIMPLE(expr) ((expr) ? 1 : (zb_assert(ZB_TRACE_FILE_ID, __LINE__), 1))
|
||||
/** @endcond */
|
||||
|
||||
#endif /* !ZB_BINARY_TRACE */
|
||||
|
||||
/** @cond internals_doc */
|
||||
void lwip_zb_assert(zb_uint16_t file_id, zb_int_t line_number);
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
Assert which can be used inside an expression.
|
||||
|
||||
@param expr - expression to check.
|
||||
@return always 1 (true)
|
||||
*/
|
||||
#define ZB_INLINE_ASSERT(expr) ZB_INLINE_ASSERT_SIMPLE((expr)),
|
||||
|
||||
#else /* release */
|
||||
|
||||
#define ZB_ASSERT(expr) ((void)(expr))
|
||||
#define ZB_INLINE_ASSERT_SIMPLE(expr) -1
|
||||
#define ZB_INLINE_ASSERT(expr)
|
||||
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
|
||||
/** \addtogroup ZB_ASSERT_STATIC */
|
||||
/** @{ */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Tricks to force preprocessor to substitute __LINE__ in macros */
|
||||
#define ZB_ASSERT_CAT_(a, b) a##_##b
|
||||
#define ZB_ASSERT_CAT(a, b) ZB_ASSERT_CAT_(a, b)
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
Check condition at compile time in the code (not declaration block)
|
||||
|
||||
@param expr - expression to check.
|
||||
*/
|
||||
#if defined SDCC || defined KEIL
|
||||
#define ZB_ASSERT_COMPILE_TIME(expr)
|
||||
#else
|
||||
#define ZB_ASSERT_COMPILE_TIME(expr) ((void)(zb_int_t (*)[(expr) ? 1 : -1])0)
|
||||
#endif
|
||||
/**
|
||||
Check condition at compile time in the code (not declaration block), return 0
|
||||
To be used inside an expressions.
|
||||
|
||||
@param expr - expression to check.
|
||||
*/
|
||||
#define ZB_ASSERT_COMPILE_TIME_EXPR(expr) ((zb_int_t)((zb_int_t (*)[(expr) ? 1 : -1])0))
|
||||
|
||||
/**
|
||||
Check condition at compile time in the declaration block
|
||||
|
||||
@param expr - expression to check.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define ZB_ASSERT_COMPILE_DECL(expr) __extension__ static_assert(expr, "Assert at line __LINE__")
|
||||
#elif (defined __GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
|
||||
#define ZB_ASSERT_COMPILE_DECL(expr) __extension__ _Static_assert(expr, "Assert at line __LINE__")
|
||||
#elif defined(__COUNTER__)
|
||||
#define ZB_ASSERT_COMPILE_DECL(expr) typedef zb_int_t ZB_ASSERT_CAT(assert, ZB_ASSERT_CAT(__LINE__, __COUNTER__))[(expr) ? 1 : -1]
|
||||
#else
|
||||
#define ZB_ASSERT_COMPILE_DECL(expr)
|
||||
#endif
|
||||
|
||||
#define ZB_ASSERT_PRINTF(expr, format, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
fprintf(stderr, format"\n", ##__VA_ARGS__); \
|
||||
ZB_ASSERT(0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
Ensures, that size of type `type' is not greater than `limit'. If it is not,
|
||||
compilation is aborted.
|
||||
|
||||
@param type - type name
|
||||
@param limit - size limit
|
||||
*/
|
||||
#define ZB_ASSERT_TYPE_SIZE_NOT_GREATER(type, limit) ZB_ASSERT_COMPILE_DECL(sizeof(type) <= (limit))
|
||||
|
||||
/**
|
||||
Ensures, that size of type `type' is not less than `limit'. If it is not,
|
||||
compilation is aborted.
|
||||
|
||||
@param type - type name
|
||||
@param limit - size limit
|
||||
*/
|
||||
#define ZB_ASSERT_TYPE_SIZE_NOT_LESS(type, limit) ZB_ASSERT_COMPILE_DECL(sizeof(type) >= (limit))
|
||||
|
||||
/**
|
||||
Ensures, that size of type `type' is equal to the `limit'. If it is not,
|
||||
compilation is aborted.
|
||||
|
||||
@param type - type name
|
||||
@param limit - size limit
|
||||
*/
|
||||
#define ZB_ASSERT_TYPE_SIZE_EQ(type, limit) ZB_ASSERT_COMPILE_DECL(sizeof(type) == (limit))
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef ZB_ARRAYS_CHECK
|
||||
/**
|
||||
Address all array elements. Use this macro to test that array really inited
|
||||
by valgrind in Linux
|
||||
*/
|
||||
#define ZB_CHK_ARR(arr, len) \
|
||||
do \
|
||||
{ \
|
||||
zb_ushort_t _ii; \
|
||||
zb_ushort_t n = 0; \
|
||||
for (_ii = 0 ; _ii < (len) ; ++_ii) \
|
||||
{ \
|
||||
if ((arr)[_ii] < 2) \
|
||||
{ \
|
||||
n++; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
n--; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
#define ZB_CHK_ARR(arr, len)
|
||||
#endif /* ZB_ARRAYS_CHECK */
|
||||
|
||||
#if defined ZB_TRAFFIC_DUMP_ON
|
||||
/**
|
||||
Dump array of byte
|
||||
|
||||
@param buf - array of byte
|
||||
@param len - size of array
|
||||
*/
|
||||
void dump_traf(zb_uint8_t *buf, zb_ushort_t len);
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef ZB_TRAFFIC_DUMP_ON
|
||||
void dump_usb_traf(zb_uint8_t *buf, zb_ushort_t len);
|
||||
#else
|
||||
#define dump_usb_traf(buf, len)
|
||||
#endif
|
||||
|
||||
#if (defined ZB_MAC_TESTING_MODE) && (defined ZB_TRAFFIC_DUMP_ON)
|
||||
#define DUMP_TRAF(cmt, buf, len, total) TRACE_MSG(TRACE_MAC3, #cmt, (FMT__0)); dump_traf(buf, len)
|
||||
#else
|
||||
#define DUMP_TRAF(comment, buf, len, total)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void dump_hex_data(zb_uint_t trace_mask, zb_uint8_t trace_level, const zb_uint8_t *buf, zb_ushort_t len);
|
||||
|
||||
void trace_hex_data_func(const zb_uint8_t *ptr, zb_short_t size, zb_bool_t format);
|
||||
#define trace_8hex_per_line(ptr, size) trace_hex_data_func((ptr), (size), ZB_FALSE)
|
||||
#define trace_16hex_per_line(ptr, size) trace_hex_data_func((ptr), (size), ZB_TRUE)
|
||||
#else
|
||||
#define dump_hex_data(trace_mask, trace_level, buf, len)
|
||||
|
||||
#define trace_8hex_per_line(ptr, size)
|
||||
#define trace_16hex_per_line(ptr, size)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif /* ZB_DEBUG_H */
|
||||
148
managed_components/espressif__esp-zboss-lib/include/zb_errors.h
Normal file
148
managed_components/espressif__esp-zboss-lib/include/zb_errors.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Error codes
|
||||
*/
|
||||
|
||||
#ifndef ZB_ERRORS_H
|
||||
#define ZB_ERRORS_H 1
|
||||
|
||||
/**
|
||||
* @addtogroup base_types
|
||||
* @{
|
||||
*/
|
||||
/** @brief Return type for ZB functions returning execution status. @see ::RET_OK. */
|
||||
typedef zb_int32_t zb_ret_t;
|
||||
/** @} */
|
||||
|
||||
/*! @cond internals_doc */
|
||||
|
||||
/* categories */
|
||||
|
||||
#define ERROR_CATEGORY_INTERVAL 256
|
||||
|
||||
#define ERROR_CATEGORY_GENERIC 0
|
||||
#define ERROR_CATEGORY_SYSTEM 1
|
||||
#define ERROR_CATEGORY_MAC 2
|
||||
#define ERROR_CATEGORY_NWK 3
|
||||
#define ERROR_CATEGORY_APS 4
|
||||
#define ERROR_CATEGORY_ZDO 5
|
||||
#define ERROR_CATEGORY_CBKE 6
|
||||
#define ERROR_CATEGORY_WATCHDOG 7
|
||||
#define ERROR_CATEGORY_SERIAL 8
|
||||
#define ERROR_CATEGORY_NVRAM 9
|
||||
#define ERROR_CATEGORY_MACSPLIT 10
|
||||
#define ERROR_CATEGORY_NCP 11
|
||||
|
||||
/* Let's always return 0 for RET_OK - in any category. */
|
||||
#define ERROR_CODE(category, code) ((zb_ret_t)(((zb_ret_t)code) != 0 ? -(((category) * ERROR_CATEGORY_INTERVAL) + ((zb_ret_t)code)) : 0))
|
||||
#define GENERIC_ERROR_CODE(code) ERROR_CODE(ERROR_CATEGORY_GENERIC, code)
|
||||
#define SYSTEM_ERROR_CODE(code) ERROR_CODE(ERROR_CATEGORY_SYSTEM, code)
|
||||
|
||||
#define ERROR_GET_CATEGORY(err) (((-(zb_int_t)(err))) / ERROR_CATEGORY_INTERVAL)
|
||||
#define ERROR_GET_CODE(err) ((-(zb_int_t)(err)) % ERROR_CATEGORY_INTERVAL)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
* @addtogroup error_codes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Error codes for non-void stack functions.
|
||||
* In general, function can return OK, BLOCKED or some error. Errors are negative.
|
||||
*
|
||||
* Error can be "generic" or some additional error code.
|
||||
*/
|
||||
|
||||
/* Most common return types: ok, generic error, BLOCKED, thread exit indication. */
|
||||
#define RET_OK 0
|
||||
#define RET_ERROR ERROR_CODE(ERROR_CATEGORY_GENERIC, 1) /* -1 indeed */
|
||||
#define RET_BLOCKED ERROR_CODE(ERROR_CATEGORY_GENERIC, 2)
|
||||
#define RET_EXIT ERROR_CODE(ERROR_CATEGORY_GENERIC, 3)
|
||||
#define RET_BUSY ERROR_CODE(ERROR_CATEGORY_GENERIC, 4)
|
||||
#define RET_EOF ERROR_CODE(ERROR_CATEGORY_GENERIC, 5)
|
||||
#define RET_OUT_OF_RANGE ERROR_CODE(ERROR_CATEGORY_GENERIC, 6)
|
||||
#define RET_EMPTY ERROR_CODE(ERROR_CATEGORY_GENERIC, 7)
|
||||
#define RET_CANCELLED ERROR_CODE(ERROR_CATEGORY_GENERIC, 8)
|
||||
|
||||
|
||||
#define RET_INVALID_PARAMETER_1 ERROR_CODE(ERROR_CATEGORY_GENERIC, 10)
|
||||
#define RET_INVALID_PARAMETER_2 ERROR_CODE(ERROR_CATEGORY_GENERIC, 11)
|
||||
#define RET_INVALID_PARAMETER_3 ERROR_CODE(ERROR_CATEGORY_GENERIC, 12)
|
||||
#define RET_INVALID_PARAMETER_4 ERROR_CODE(ERROR_CATEGORY_GENERIC, 13)
|
||||
#define RET_INVALID_PARAMETER_6 ERROR_CODE(ERROR_CATEGORY_GENERIC, 15)
|
||||
#define RET_PENDING ERROR_CODE(ERROR_CATEGORY_GENERIC, 21)
|
||||
#define RET_NO_MEMORY ERROR_CODE(ERROR_CATEGORY_GENERIC, 22)
|
||||
#define RET_INVALID_PARAMETER ERROR_CODE(ERROR_CATEGORY_GENERIC, 23)
|
||||
#define RET_OPERATION_FAILED ERROR_CODE(ERROR_CATEGORY_GENERIC, 24)
|
||||
#define RET_BUFFER_TOO_SMALL ERROR_CODE(ERROR_CATEGORY_GENERIC, 25)
|
||||
#define RET_END_OF_LIST ERROR_CODE(ERROR_CATEGORY_GENERIC, 26)
|
||||
#define RET_ALREADY_EXISTS ERROR_CODE(ERROR_CATEGORY_GENERIC, 27)
|
||||
#define RET_NOT_FOUND ERROR_CODE(ERROR_CATEGORY_GENERIC, 28)
|
||||
#define RET_OVERFLOW ERROR_CODE(ERROR_CATEGORY_GENERIC, 29)
|
||||
#define RET_TIMEOUT ERROR_CODE(ERROR_CATEGORY_GENERIC, 30)
|
||||
#define RET_NOT_IMPLEMENTED ERROR_CODE(ERROR_CATEGORY_GENERIC, 31)
|
||||
#define RET_NO_RESOURCES ERROR_CODE(ERROR_CATEGORY_GENERIC, 32)
|
||||
#define RET_UNINITIALIZED ERROR_CODE(ERROR_CATEGORY_GENERIC, 33)
|
||||
#define RET_INVALID_STATE ERROR_CODE(ERROR_CATEGORY_GENERIC, 35)
|
||||
#define RET_CONNECTION_FAILED ERROR_CODE(ERROR_CATEGORY_GENERIC, 37)
|
||||
#define RET_CONNECTION_LOST ERROR_CODE(ERROR_CATEGORY_GENERIC, 38)
|
||||
#define RET_UNAUTHORIZED ERROR_CODE(ERROR_CATEGORY_GENERIC, 40)
|
||||
#define RET_CONFLICT ERROR_CODE(ERROR_CATEGORY_GENERIC, 41)
|
||||
#define RET_INVALID_FORMAT ERROR_CODE(ERROR_CATEGORY_GENERIC, 42)
|
||||
#define RET_NO_MATCH ERROR_CODE(ERROR_CATEGORY_GENERIC, 43)
|
||||
#define RET_PROTOCOL_ERROR ERROR_CODE(ERROR_CATEGORY_GENERIC, 44)
|
||||
#define RET_VERSION ERROR_CODE(ERROR_CATEGORY_GENERIC, 45)
|
||||
#define RET_FILE_NOT_FOUND ERROR_CODE(ERROR_CATEGORY_GENERIC, 48)
|
||||
#define RET_CONVERSION_ERROR ERROR_CODE(ERROR_CATEGORY_GENERIC, 50)
|
||||
#define RET_FILE_CORRUPTED ERROR_CODE(ERROR_CATEGORY_GENERIC, 56)
|
||||
#define RET_PAGE_NOT_FOUND ERROR_CODE(ERROR_CATEGORY_GENERIC, 57)
|
||||
#define RET_ILLEGAL_REQUEST ERROR_CODE(ERROR_CATEGORY_GENERIC, 62)
|
||||
#define RET_INVALID_GROUP ERROR_CODE(ERROR_CATEGORY_GENERIC, 64)
|
||||
#define RET_TABLE_FULL ERROR_CODE(ERROR_CATEGORY_GENERIC, 65)
|
||||
#define RET_IGNORE ERROR_CODE(ERROR_CATEGORY_GENERIC, 69)
|
||||
#define RET_AGAIN ERROR_CODE(ERROR_CATEGORY_GENERIC, 70)
|
||||
#define RET_DEVICE_NOT_FOUND ERROR_CODE(ERROR_CATEGORY_GENERIC, 71)
|
||||
#define RET_OBSOLETE ERROR_CODE(ERROR_CATEGORY_GENERIC, 72)
|
||||
#define RET_INTERRUPTED ERROR_CODE(ERROR_CATEGORY_GENERIC, 73)
|
||||
#define RET_NULL_POINTER ERROR_CODE(ERROR_CATEGORY_GENERIC, 74)
|
||||
|
||||
/** @} */ /* Error codes */
|
||||
|
||||
#endif /* ZB_ERRORS_H */
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_ENABLE && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "esp_err.h"
|
||||
/**
|
||||
* @brief This function initializes the Zigbee sleep.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_FAIL on failure
|
||||
*
|
||||
*/
|
||||
esp_err_t zb_esp_sleep_init(void);
|
||||
|
||||
/**
|
||||
* @brief This function performs the Zigbee sleep process.
|
||||
*
|
||||
*/
|
||||
void zb_esp_sleep_process(uint32_t sleep_time_ms);
|
||||
|
||||
/**
|
||||
* @brief This function performs the Zigbee wakeup process.
|
||||
*
|
||||
*/
|
||||
void zb_esp_wakeup_process(void);
|
||||
|
||||
/**
|
||||
* @brief This function enable the Zigbee sleep.
|
||||
*
|
||||
* @param[in] enable Zigbee sleep enable set
|
||||
*
|
||||
*/
|
||||
void zb_esp_sleep_enable_set(bool enable);
|
||||
|
||||
/**
|
||||
* @brief This function get the Zigbee sleep enable or not.
|
||||
*
|
||||
* @return
|
||||
* - True Zigbee sleep has been enable
|
||||
* - False Zigbee sleep has been disable
|
||||
*
|
||||
*/
|
||||
bool zb_esp_sleep_enable_get(void);
|
||||
|
||||
/**
|
||||
* @brief The sleep task iteration.
|
||||
*
|
||||
* @param[in] time_ms The max block time for each iteration, in milliseconds.
|
||||
*
|
||||
*/
|
||||
void zb_osif_sleep_iteration(uint32_t time_ms);
|
||||
|
||||
#endif // CONFIG_PM_ENABLE && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
47
managed_components/espressif__esp-zboss-lib/include/zb_ha.h
Normal file
47
managed_components/espressif__esp-zboss-lib/include/zb_ha.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: HA global definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_HA_H
|
||||
#define ZB_HA_H 1
|
||||
|
||||
#ifdef ZB_ENABLE_HA
|
||||
#include "ha/zb_ha_config.h"
|
||||
#endif
|
||||
#endif /* ZB_HA_H */
|
||||
931
managed_components/espressif__esp-zboss-lib/include/zb_osif.h
Normal file
931
managed_components/espressif__esp-zboss-lib/include/zb_osif.h
Normal file
@@ -0,0 +1,931 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Main header for OS and platform dependent stuff
|
||||
*/
|
||||
|
||||
#ifndef ZB_OSIF_H
|
||||
#define ZB_OSIF_H 1
|
||||
|
||||
|
||||
/**
|
||||
@internal
|
||||
|
||||
\addtogroup ZB_OSIF */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
@par OS/HW abstraction
|
||||
OS/HW platform abstraction is necessary to achieve high portability.
|
||||
C language tool to separate abstraction layer is C preprocessor.
|
||||
|
||||
Main idea is to avoid number of ifdefs related to portability in the code, and
|
||||
decrease number of ifdefs in the header files not related to the OS abstraction
|
||||
layer.
|
||||
|
||||
Platform abstraction is implemented as C functions placed into OS abstraction
|
||||
layers and platform-dependent global typedefs and definitions placed into header
|
||||
files. All platform-related stuff is in osif/ directory. Global definitions
|
||||
and typedefs can be used anywhere - that is why on the architecture picture OS
|
||||
abstraction layer depicted as global.
|
||||
|
||||
Following things are platform-dependent:
|
||||
* typedefs for base types (8-bit controller vs 32-bit Linux device)
|
||||
* definitions for different 8051 compilers (SDCC and Keil)
|
||||
* transceiver i/o (interrupts handling for 8051 vs file i/o in Linux);
|
||||
* wait for i/o (device sleep for 8051, wait in select() in Linux)
|
||||
* trace i/o (UART for 8051, file in Linux);
|
||||
* MAC traffic dump (UART for 8051, file in Linux);
|
||||
* Timer (8051 timer at device, select() timeout in Linux)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "zb_config.h"
|
||||
|
||||
/**
|
||||
OSIF platform selection. One of pre-defined platform should be selected in
|
||||
zb_config.h configurations.
|
||||
zb_osif_platform.h is different in different platforms repo.
|
||||
*/
|
||||
/**
|
||||
* OSIF timer expiration callback type
|
||||
* @param user_data - any user specified data which will be sent to this callback
|
||||
* Might be used to determine particular timer which cause callback
|
||||
*
|
||||
*/
|
||||
typedef void (*zb_osif_timer_exp_cb_t)(void *user_data);
|
||||
|
||||
#include "zb_osif_platform.h"
|
||||
|
||||
#include "zb_ringbuffer.h"
|
||||
|
||||
#ifndef ZB_PLATFORM_INIT
|
||||
#error Define ZB_PLATFORM_INIT in you platform file
|
||||
//#define ZB_PLATFORM_INIT()
|
||||
#endif
|
||||
|
||||
#ifndef ZB_OSIF_IS_EXIT
|
||||
#define ZB_OSIF_IS_EXIT() ZB_FALSE
|
||||
#endif
|
||||
|
||||
/* Default (C standard) definition of MAIN() if not redefined in zb_osif_platform.h */
|
||||
#ifndef MAIN
|
||||
#define MAIN() int main(int argc, char *argv[])
|
||||
#define FAKE_ARGV
|
||||
#define ARGV_UNUSED ZVUNUSED(argc) ; ZVUNUSED(argv)
|
||||
#define MAIN_RETURN(v) return (v)
|
||||
#endif
|
||||
|
||||
#ifndef ZB_SET_TRACE_TRANSPORT
|
||||
/*
|
||||
* If platform supports choosing transport at runtime
|
||||
* (i.e. Telink can choose between UART and USB debug interface)
|
||||
* define this macro.
|
||||
* Note that this is intended to be called before ZB_TRACE_INIT is called as
|
||||
* only one interface will be configured and the rest of them will be left as is
|
||||
* so that it would be usable from non-Zigbee purposes (application) if needed.
|
||||
*/
|
||||
#define ZB_SET_TRACE_TRANSPORT(transport)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If platform supports NCP architecture and the ability to put the SoC to
|
||||
* sleep state, this function should be implemented.
|
||||
*
|
||||
* This function is meant to be called from zboss_signal_handler(), after
|
||||
* receiving ZB_COMMON_SIGNAL_CAN_SLEEP signal.
|
||||
* It should configure the NCP transport in a way that is can wake up the MCU
|
||||
* through external interrupt and call the zb_sleep_now().
|
||||
* Afterwards, it should recover the NCP transport, so it is able to continue
|
||||
* its normal operation.
|
||||
*/
|
||||
#ifndef ZB_OSIF_NCP_TRANSPORT_PREPARE_TO_SLEEP
|
||||
#define ZB_OSIF_NCP_TRANSPORT_PREPARE_TO_SLEEP()
|
||||
#endif
|
||||
|
||||
#if !defined ZB_KICK_HW_WATCHDOG
|
||||
#define ZB_KICK_HW_WATCHDOG()
|
||||
#endif
|
||||
|
||||
#ifndef ZB_THREADS
|
||||
#ifndef ZB_OSIF_TIME_LOCK
|
||||
#define ZB_OSIF_TIME_LOCK() (void)0
|
||||
#endif
|
||||
#ifndef ZB_OSIF_TIME_UNLOCK
|
||||
#define ZB_OSIF_TIME_UNLOCK() (void)0
|
||||
#endif
|
||||
#endif /* ZB_THREADS */
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
||||
/* common osif API */
|
||||
zb_uint32_t zb_random_seed(void);
|
||||
zb_uint32_t zb_get_utc_time(void);
|
||||
#ifdef ZB_RANDOM_HARDWARE
|
||||
/**
|
||||
* Generate random 32-bit value using hardware capability
|
||||
*
|
||||
* @return random value between 0 to 2^32-1
|
||||
*/
|
||||
zb_uint32_t zb_osif_random_hw(void);
|
||||
#endif
|
||||
|
||||
zb_uint32_t osif_get_time_ms(void);
|
||||
|
||||
/* note: that api is only for some platforms */
|
||||
zb_ret_t osif_set_transmit_power(zb_uint8_t channel, zb_int8_t power);
|
||||
void osif_set_default_trasnmit_powers(zb_int8_t *tx_powers);
|
||||
|
||||
#if defined ZB_MACSPLIT_TRANSPORT_SERIAL || defined ZB_MUX_TRANSPORT_OSIF_SERIAL || defined ZB_NCP_TRANSPORT_TYPE_SERIAL
|
||||
void zb_osif_serial_transport_init();
|
||||
void zb_osif_serial_transport_put_bytes(zb_uint8_t *buf, zb_short_t len);
|
||||
#endif
|
||||
|
||||
#ifndef ZB_SERIAL_INT_DISABLE
|
||||
#define ZB_SERIAL_INT_DISABLE() ZB_OSIF_GLOBAL_LOCK()
|
||||
#endif /* ZB_SERIAL_INT_DISABLE */
|
||||
|
||||
#ifndef ZB_SERIAL_INT_ENABLE
|
||||
#define ZB_SERIAL_INT_ENABLE() ZB_OSIF_GLOBAL_UNLOCK()
|
||||
#endif /* ZB_SERIAL_INT_ENABLE */
|
||||
|
||||
#if defined ZB_HAVE_SERIAL || defined DOXYGEN
|
||||
|
||||
/* Serial interface (trace, traffic dump, serial transport) */
|
||||
|
||||
/** @cond DOXYGEN_UART_SECTION */
|
||||
/*! \addtogroup uart */
|
||||
/*! @{ */
|
||||
|
||||
typedef zb_int8_t zb_serial_port_t;
|
||||
#define SERIAL_PORT_INVALID ((zb_serial_port_t)(-1))
|
||||
|
||||
/**
|
||||
Initialize UART low level.
|
||||
|
||||
If ZBOSS uses UART for trace or traffic dump, it calls zb_osif_serial_init()
|
||||
itself.
|
||||
If UART is used by application, application must call zb_osif_serial_init().
|
||||
|
||||
@param portname A platform-specific string describing a serial port location
|
||||
@param speed Serial port speed in bauds
|
||||
|
||||
@return a platform-specific reference to the initialized port for further
|
||||
use in other mserial routines.
|
||||
*/
|
||||
zb_serial_port_t zb_osif_mserial_open(const char *portname, zb_uint32_t speed);
|
||||
|
||||
/**
|
||||
Creates a master PTY file and creates a symlink with a given name to it.
|
||||
|
||||
@param symlink A platform-specific string describing a serial port location
|
||||
@param speed Serial port speed in bauds
|
||||
|
||||
@return a platform-specific reference to the initialized port for further
|
||||
use in other mserial routines.
|
||||
*/
|
||||
zb_serial_port_t zb_osif_mserial_create_pty(const char *symlink, zb_uint32_t speed);
|
||||
|
||||
/**
|
||||
Deinitialize UART low level.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
*/
|
||||
void zb_osif_mserial_close(zb_serial_port_t port_instance);
|
||||
|
||||
/**
|
||||
Setup callback to be called when single byte received over UART
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param hnd user's rx callback
|
||||
*/
|
||||
void zb_osif_mserial_set_byte_received_cb(zb_serial_port_t port_instance, zb_callback_t hnd);
|
||||
|
||||
|
||||
/* errors generated by serial transport */
|
||||
|
||||
#define ZB_ERROR_SERIAL_INIT_FAILED 1U
|
||||
#define ZB_ERROR_SERIAL_READ_FAILED 2U
|
||||
|
||||
/**
|
||||
Set user's buffer to be used by UART TX logic.
|
||||
|
||||
ZBOSS normally uses its internal UART buffer. The buffer is not too big -
|
||||
about 200 bytes which is enough for its usage by ZBOSS (trace).
|
||||
Some applications needs large io buffers. So declare there type placeholder for use ringbuffer zb_byte_array_t;
|
||||
by default application will set user tx buffer to stack tx buffer and access it through pointer;
|
||||
User can override this pointer to use it's own serial buffer.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param buf_ptr user's buffer
|
||||
@param capacity buffer capacity
|
||||
*/
|
||||
void zb_osif_mserial_set_user_io_buffer(zb_serial_port_t port_instance, zb_byte_array_t *buf_ptr, zb_ushort_t capacity);
|
||||
|
||||
#if defined(ZB_HAVE_SERIAL_SINGLE)
|
||||
/**
|
||||
* This is a version of @ref zb_osif_mserial_open for single-port serial interface, see its
|
||||
* documentation for more information
|
||||
*/
|
||||
void zb_osif_serial_init();
|
||||
|
||||
/**
|
||||
* This is a version of @ref zb_osif_mserial_close for single-port serial interface, see its
|
||||
* documentation for more information
|
||||
*/
|
||||
void zb_osif_serial_deinit();
|
||||
|
||||
/**
|
||||
* This is a version of @ref zb_osif_mserial_set_byte_received_cb for single-port serial interface, see its
|
||||
* documentation for more information
|
||||
*/
|
||||
void zb_osif_set_uart_byte_received_cb(zb_callback_t hnd);
|
||||
|
||||
/**
|
||||
* This is a version of @ref zb_osif_mserial_set_user_io_buffer for single-port serial interface, see its
|
||||
* documentation for more information
|
||||
*/
|
||||
void zb_osif_set_user_io_buffer(zb_byte_array_t *buf_ptr, zb_ushort_t capacity);
|
||||
|
||||
/**
|
||||
* This is a version of @ref zb_osif_mserial_put_bytes for single-port serial interface, see its
|
||||
* documentation for more information
|
||||
*/
|
||||
void zb_osif_serial_put_bytes(const zb_uint8_t *buf, zb_short_t len);
|
||||
#endif /* ZB_HAVE_SERIAL_SINGLE */
|
||||
|
||||
#if defined(ZB_HAVE_ASYNC_SERIAL) || defined(DOXYGEN)
|
||||
/* Asynchronous API extension for serial interface. */
|
||||
|
||||
#define SERIAL_SEND_SUCCESS 0U /**< Serial interface has sent the data. */
|
||||
#define SERIAL_SEND_BUSY 1U /**< Serial interface is busy. */
|
||||
#define SERIAL_SEND_TIMEOUT_EXPIRED 2U /**< Transmission operation timed out. */
|
||||
#define SERIAL_SEND_ERROR 255U /**< Serial interface internal error. */
|
||||
|
||||
|
||||
/**
|
||||
Type of callback called by serial interface when it received requested buffer.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param buf - pointer to data received
|
||||
@param len - length of received data
|
||||
*/
|
||||
typedef void (*zb_mserial_recv_data_cb_t)(zb_serial_port_t port_instance, zb_uint8_t *buf, zb_ushort_t len);
|
||||
|
||||
/**
|
||||
Type of callback called by serial interface when it completed transmission of data.
|
||||
|
||||
@param status - status of the transmission
|
||||
*/
|
||||
typedef void (*zb_serial_send_data_cb_t)(zb_uint8_t status);
|
||||
|
||||
/**
|
||||
Receive data from serial interface.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param buf - pointer to the buffer for received data
|
||||
@param len - length of the buffer
|
||||
*/
|
||||
void zb_osif_mserial_recv_data(zb_serial_port_t port_instance, zb_uint8_t *buf, zb_ushort_t len);
|
||||
|
||||
/**
|
||||
Set serial interface callback for receiving completion.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param cb - receiving completion callback
|
||||
*/
|
||||
void zb_osif_mserial_set_cb_recv_data(zb_serial_port_t port_instance, zb_mserial_recv_data_cb_t cb);
|
||||
|
||||
/**
|
||||
Send data over serial interface.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param buf - pointer to the buffer with data to send
|
||||
@param len - length of the buffer
|
||||
*/
|
||||
void zb_osif_mserial_send_data(zb_serial_port_t port_instance, zb_uint8_t *buf, zb_ushort_t len);
|
||||
|
||||
/**
|
||||
Set serial interface callback for transmission completion.
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param cb - transmission completion callback
|
||||
*/
|
||||
void zb_osif_mserial_set_cb_send_data(zb_serial_port_t port_instance, zb_serial_send_data_cb_t cb);
|
||||
|
||||
#endif /* ZB_HAVE_ASYNC_SERIAL */
|
||||
|
||||
#endif /* ZB_HAVE_SERIAL || DOXYGEN */
|
||||
|
||||
#if defined ZB_BINARY_TRACE || defined ZB_HAVE_SERIAL || defined ZB_TRACE_OVER_USART || defined DOXYGEN || defined ZB_NSNG
|
||||
|
||||
/**
|
||||
TX data over UART
|
||||
|
||||
Put data to internal buffer to be transmitted over UART.
|
||||
It is guaranteed that all data will be sent.
|
||||
Block is no space in the buffer waiting for previous TX complete.
|
||||
|
||||
Note: this is low level routine. Its direct usage may conflict with ZBOSS
|
||||
debug trace and traffic dump (if enabled).
|
||||
|
||||
@param port_instance A reference to the port returned by zb_osif_mserial_open()
|
||||
@param buf data buffer
|
||||
@param len data length.
|
||||
*/
|
||||
void zb_osif_mserial_put_bytes(zb_serial_port_t port_instance, const zb_uint8_t *buf, zb_short_t len);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined ZB_SERIAL_FOR_TRACE && !defined ZB_OSIF_SERIAL_FLUSH
|
||||
#define ZB_OSIF_SERIAL_FLUSH()
|
||||
#endif /* ZB_SERIAL_FOR_TRACE && !ZB_OSIF_SERIAL_FLUSH */
|
||||
|
||||
#ifdef ZB_TRACE_OVER_JTAG
|
||||
void zb_osif_jtag_put_bytes(const zb_uint8_t *buf, zb_short_t len);
|
||||
void zb_osif_jtag_flush(void);
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
/** @endcond */ /* DOXYGEN_UART_SECTION */
|
||||
|
||||
|
||||
|
||||
#ifdef ZB_TRACE_OVER_SIF
|
||||
void zb_osif_sif_put_bytes(const zb_uint8_t *buf, zb_short_t len);
|
||||
void zb_osif_sif_init(void);
|
||||
void zb_osif_sif_debug_trace(zb_uint8_t param);
|
||||
#endif
|
||||
|
||||
#ifdef ZB_HAVE_FILE
|
||||
/* File */
|
||||
zb_uint32_t zb_osif_get_file_size(zb_char_t *name);
|
||||
zb_bool_t zb_osif_check_dir_exist(const zb_char_t *name);
|
||||
int zb_osif_create_dir(const zb_char_t *name);
|
||||
zb_bool_t zb_osif_check_file_exist(const zb_char_t *name, const zb_uint8_t mode);
|
||||
void zb_osif_file_copy(const zb_char_t *name_src, const zb_char_t *name_dst);
|
||||
zb_osif_file_t *zb_osif_file_open(const zb_char_t *name, const zb_char_t *mode);
|
||||
zb_osif_file_t *zb_osif_init_trace(zb_char_t *name);
|
||||
zb_osif_file_t *zb_osif_file_stdout(void);
|
||||
zb_osif_file_t *zb_osif_file_stdin(void);
|
||||
void zb_osif_file_close(zb_osif_file_t *f);
|
||||
int zb_osif_file_remove(const zb_char_t *name);
|
||||
void zb_osif_trace_printf(zb_osif_file_t *f, const zb_char_t *format, ...);
|
||||
void zb_osif_trace_vprintf(zb_osif_file_t *f, const zb_char_t *format, va_list arglist);
|
||||
void zb_osif_trace_lock(void);
|
||||
void zb_osif_trace_unlock(void);
|
||||
zb_osif_file_t *zb_osif_init_dump(zb_char_t *name);
|
||||
int zb_osif_file_read(zb_osif_file_t *f, zb_uint8_t *buf, zb_uint_t len);
|
||||
int zb_osif_file_write(zb_osif_file_t *f, const zb_uint8_t *buf, zb_uint_t len);
|
||||
int zb_osif_file_is_eof(zb_osif_file_t *f);
|
||||
int zb_osif_file_is_err(zb_osif_file_t *f);
|
||||
int zb_osif_file_flush(zb_osif_file_t *f);
|
||||
int zb_osif_file_seek(zb_osif_file_t *f, zb_uint32_t off, zb_uint8_t mode);
|
||||
int zb_osif_file_get_size(zb_osif_file_t *f);
|
||||
int zb_osif_file_truncate(zb_osif_file_t *f, zb_uint32_t off);
|
||||
int zb_osif_file_sync(zb_osif_file_t *f);
|
||||
const zb_char_t* zb_osif_file_get_name_by_path(const zb_char_t *path);
|
||||
void zb_osif_trace_get_time(zb_uint_t *sec, zb_uint_t *msec, zb_uint_t *usec);
|
||||
zb_osif_file_t *zb_osif_popen(zb_char_t *arg);
|
||||
|
||||
int zb_osif_stream_read(zb_osif_file_t *stream, zb_uint8_t *buf, zb_uint_t len);
|
||||
int zb_osif_stream_write(zb_osif_file_t *stream, zb_uint8_t *buf, zb_uint_t len);
|
||||
|
||||
enum zb_file_path_base_type_e
|
||||
{
|
||||
ZB_FILE_PATH_BASE_NOT_SPECIFIED, /* not specified base type - allows to use default base path */
|
||||
ZB_FILE_PATH_BASE_ROMFS_BINARIES, /* ROM FS */ /* elf binaries, etc */
|
||||
ZB_FILE_PATH_BASE_MNTFS_BINARIES, /* RW FS */ /* prod config, etc */
|
||||
ZB_FILE_PATH_BASE_MNTFS_USER_DATA, /* RW FS */ /* nvram. etc */
|
||||
ZB_FILE_PATH_BASE_MNTFS_TRACE_LOGS, /* RW FS */
|
||||
ZB_FILE_PATH_BASE_RAMFS_UNIX_SOCKET, /* RAM FS */
|
||||
ZB_FILE_PATH_BASE_RAMFS_TRACE_LOGS, /* RAM FS */
|
||||
ZB_FILE_PATH_BASE_RAMFS_TMP_DATA, /* RAM FS */
|
||||
|
||||
ZB_FILE_PATH_BASE_MAX_TYPE
|
||||
};
|
||||
|
||||
#ifndef ZB_TRACE_LOG_FILE_EXTENSION
|
||||
#define ZB_TRACE_LOG_FILE_EXTENSION ""
|
||||
#endif /* ZB_TRACE_LOG_FILE_EXTENSION */
|
||||
|
||||
#define ZB_MAX_FILE_PATH_SIZE 256
|
||||
|
||||
#ifdef ZB_FILE_PATH_MGMNT
|
||||
#ifndef ZB_FILE_PATH_MAX_TYPES
|
||||
#define ZB_FILE_PATH_MAX_TYPES ZB_FILE_PATH_BASE_MAX_TYPE
|
||||
#endif
|
||||
|
||||
typedef struct zb_file_path_base_type_s
|
||||
{
|
||||
zb_bool_t declared;
|
||||
char base[ZB_MAX_FILE_PATH_SIZE];
|
||||
} zb_file_path_base_type_t;
|
||||
|
||||
void zb_file_path_init(void);
|
||||
zb_ret_t zb_file_path_declare(zb_uint8_t base_type, const char *base);
|
||||
const char* zb_file_path_get(zb_uint8_t base_type, const char *default_base);
|
||||
void zb_file_path_get_with_postfix(zb_uint8_t base_type, const char *default_base, const char *postfix, char *file_path);
|
||||
#define ZB_FILE_PATH_GET(base_type, default_base) \
|
||||
zb_file_path_get(base_type, default_base)
|
||||
#define ZB_FILE_PATH_GET_WITH_POSTFIX(base_type, default_base, postfix, file_path) \
|
||||
zb_file_path_get_with_postfix(base_type, default_base, postfix, file_path)
|
||||
#else
|
||||
#define ZB_FILE_PATH_GET(base_type, default_base) default_base
|
||||
#define ZB_FILE_PATH_GET_WITH_POSTFIX(base_type, default_base, postfix, file_path) \
|
||||
{ \
|
||||
zb_uint_t sn_ret; \
|
||||
sn_ret = snprintf(file_path, ZB_MAX_FILE_PATH_SIZE, "%s", (default_base postfix)); \
|
||||
ZB_ASSERT(sn_ret > 0); \
|
||||
ZB_ASSERT(sn_ret < ZB_MAX_FILE_PATH_SIZE); \
|
||||
}
|
||||
#endif /* ZB_FILE_PATH_MGMNT */
|
||||
|
||||
#ifdef ZB_USE_LOGFILE_ROTATE
|
||||
zb_uint32_t zb_osif_get_max_logfile_size(void);
|
||||
zb_ret_t zb_osif_set_max_logfile_size(zb_uint32_t val);
|
||||
|
||||
zb_uint32_t zb_osif_get_max_logfiles_count(void);
|
||||
zb_ret_t zb_osif_set_max_logfiles_count(zb_uint32_t val);
|
||||
|
||||
zb_ret_t zb_osif_file_rotate(const zb_char_t *file_path, const zb_char_t *file_name);
|
||||
#endif /* ZB_USE_LOGFILE_ROTATE */
|
||||
#endif /* ZB_HAVE_FILE */
|
||||
|
||||
/*! \addtogroup zb_platform */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
Platform dependent soft reset
|
||||
*/
|
||||
void zb_reset(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @name Possible reset sources
|
||||
* @anchor reset_source
|
||||
*
|
||||
* Note: These values were members of `enum zb_reset_source_e` type but were
|
||||
* converted to a set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_RESET_SRC_POWER_ON 0U
|
||||
#define ZB_RESET_SRC_SW_RESET 1U
|
||||
#define ZB_RESET_SRC_RESET_PIN 2U
|
||||
#define ZB_RESET_SRC_BROWN_OUT 3U
|
||||
#define ZB_RESET_SRC_CLOCK_LOSS 4U
|
||||
#define ZB_RESET_SRC_OTHER 5U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Get the reason that triggered the last reset
|
||||
*
|
||||
* @return @ref reset_source
|
||||
* */
|
||||
zb_uint8_t zb_get_reset_source(void);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined ZB_USE_NVRAM || defined DOXYGEN
|
||||
/**
|
||||
* @brief osif NVRAM initializer
|
||||
*/
|
||||
void zb_osif_nvram_init(const zb_char_t *name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Deinitialize osif-layer NVRAM support
|
||||
*/
|
||||
void zb_osif_nvram_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Get NVRAM page length
|
||||
*
|
||||
* @return NVRAM page length
|
||||
*/
|
||||
zb_uint32_t zb_get_nvram_page_length(void);
|
||||
|
||||
/**
|
||||
* @brief Get NVRAM page count
|
||||
*
|
||||
* @return NVRAM page count
|
||||
*/
|
||||
zb_uint8_t zb_get_nvram_page_count(void);
|
||||
|
||||
/**
|
||||
* @brief Read from NVRAM directly, by address
|
||||
* Read some bytes from NVRAM use address
|
||||
*
|
||||
* @param address - NVRAM address
|
||||
* @param len - count bytes from read data
|
||||
* @param buf - (in) buffer for contains read data
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_read_memory(zb_uint32_t address, zb_uint32_t len, zb_uint8_t *buf);
|
||||
|
||||
/**
|
||||
* @brief Read from NVRAM page
|
||||
* Read some bytes from NVRAM
|
||||
*
|
||||
* @param page - NVRAM page
|
||||
* @param pos - Start position
|
||||
* @param buf - (in) buffer for contains read data
|
||||
* @param len - count bytes from read data
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_read(zb_uint8_t page, zb_uint32_t pos, zb_uint8_t *buf, zb_uint16_t len );
|
||||
|
||||
/**
|
||||
* @brief Read from NVRAM page with test
|
||||
* Read some bytes from NVRAM with test contents.
|
||||
* If all byte equal 0xFF then return RET_ERROR
|
||||
* Exists not for all platforms.
|
||||
*
|
||||
* @param page - NVRAM page
|
||||
* @param pos - Start position
|
||||
* @param buf - (in) buffer for contains read data
|
||||
* @param len - count bytes from read data
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_read_test(zb_uint8_t page, zb_uint32_t pos, zb_uint8_t *buf, zb_uint16_t len );
|
||||
|
||||
/**
|
||||
* @brief Write from NVRAM page
|
||||
* Write some bytes to NVRAM
|
||||
*
|
||||
* @param page - NVRAM page
|
||||
* @param pos - Start position
|
||||
* @param buf - buffer contains data for write
|
||||
* @param len - count bytes for write data
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_write(zb_uint8_t page, zb_uint32_t pos, void *buf, zb_uint16_t len );
|
||||
|
||||
/**
|
||||
* @brief Write to NVRAM directly, by address
|
||||
* Write bytes into NVRAM use address
|
||||
*
|
||||
* @param address - NVRAM address
|
||||
* @param len - count bytes for write data
|
||||
* @param buf - (in) buffer contains data to write
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_write_memory(zb_uint32_t address, zb_uint32_t len, zb_uint8_t *buf);
|
||||
|
||||
/**
|
||||
* @brief Erase NVRAM directly, by address
|
||||
*
|
||||
* @param address - NVRAM address
|
||||
* @param len - count bytes for erase, aligned
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_erase_memory(zb_uint32_t address, zb_uint32_t len);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Erase NVRAM page
|
||||
* Fill NVRAM page by 0xFF.
|
||||
*
|
||||
* @param page - page index
|
||||
*
|
||||
* @return RET_OK if success or code error
|
||||
*/
|
||||
zb_ret_t zb_osif_nvram_erase_async(zb_uint8_t page);
|
||||
|
||||
void zb_osif_nvram_wait_for_last_op(void);
|
||||
|
||||
/**
|
||||
* @brief Flush NVRAM page
|
||||
* Flash NVRAM page to file or NVRAM.
|
||||
* Different to hardware device
|
||||
*
|
||||
*/
|
||||
void zb_osif_nvram_flush(void);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ZB_USE_OSIF_OTA_ROUTINES
|
||||
/**
|
||||
* @addtogroup ll
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ota Low level API for OTA
|
||||
*/
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* Size of sub-element includes OTA header.
|
||||
*
|
||||
* @see Zigbee Cluster Library specification revision 7 subsection 11.4.3 Sub-element Format
|
||||
*/
|
||||
#define OTA_UPGRADE_HEADING_DATA \
|
||||
(sizeof(zb_zcl_ota_upgrade_file_header_t) + 2 /* fw tag Id */ + 4 /* fw length */)
|
||||
|
||||
/**
|
||||
* Size of the OTA image hash.
|
||||
*
|
||||
* @see Zigbee Cluster Library specification revision 7 subsection 11.7.2.1 Hash Value Calculation
|
||||
*/
|
||||
#define OTA_UPGRADE_HASH_SIZE 16
|
||||
|
||||
/**
|
||||
* Size of sub-element includes a hash value.
|
||||
*
|
||||
* @see Zigbee Cluster Library specification revision 7 subsection 11.4.8 Image Integrity Code Sub-element
|
||||
*/
|
||||
#define OTA_UPGRADE_TRAILING_DATA \
|
||||
(2 /* hash tag Id */ + 4 /* hash length */ + OTA_UPGRADE_HASH_SIZE /* Hash */)
|
||||
|
||||
|
||||
/**
|
||||
Open device to be used for OTA image write or read.
|
||||
|
||||
Take into account which flash (A or B) current FW is running at.
|
||||
@see zb_osif_ota_close_storage
|
||||
|
||||
@return handle
|
||||
*/
|
||||
void *zb_osif_ota_open_storage(void);
|
||||
|
||||
/**
|
||||
Close device used for OTA image write
|
||||
|
||||
@param dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
*/
|
||||
void zb_osif_ota_close_storage(void *dev);
|
||||
|
||||
/**
|
||||
Erase flash to be used for OTA image store.
|
||||
|
||||
@note: offset and size must be aligned to minimal eraseable page boundary -
|
||||
see zb_osif_ota_get_erase_portion().
|
||||
|
||||
@param dev flash device handle @see zb_osif_ota_open_storage
|
||||
@param offset file offset in flash memory
|
||||
@param size OTA file image size
|
||||
*/
|
||||
void zb_osif_ota_erase_fw(void *dev, zb_uint_t offset, zb_uint_t size);
|
||||
|
||||
/**
|
||||
Get portion of OTA storage which can be erased at once.
|
||||
|
||||
@return erase block size in bytes
|
||||
*/
|
||||
zb_uint32_t zb_osif_ota_get_erase_portion(void);
|
||||
|
||||
/**
|
||||
Write OTA image data to flash.
|
||||
|
||||
Deal with alignment.
|
||||
|
||||
@param dev flash device handle @see zb_osif_ota_open_storage
|
||||
@param data pointer to the data to write
|
||||
@param off offset in OTA file
|
||||
@param block_size amount of data to write
|
||||
@param image_size total image size
|
||||
*/
|
||||
void zb_osif_ota_write(void *dev, zb_uint8_t *data, zb_uint32_t off, zb_uint32_t block_size, zb_uint32_t image_size);
|
||||
|
||||
/**
|
||||
Mark FW as downloaded and ready to use by bootloader.
|
||||
|
||||
To be called when finishing OTA, after FW loaded and verified.
|
||||
|
||||
@param ota_dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
@param size OTA image size, without CRC
|
||||
@param revision OTA image revision
|
||||
*/
|
||||
void zb_osif_ota_mark_fw_ready(void *ota_dev, zb_uint32_t size, zb_uint32_t revision);
|
||||
|
||||
|
||||
/**
|
||||
Mark new FW as absent so bootloader does not attempt to re-flash it.
|
||||
|
||||
To be called when starting OTA.
|
||||
*/
|
||||
void zb_osif_ota_mark_fw_absent(void);
|
||||
|
||||
|
||||
/**
|
||||
Mark FW upgrade finished, so bootloader just loads current FW.
|
||||
|
||||
To be called from newly started application FW.
|
||||
Usually not need to be called by the application. ZBOSS kernel cares about it.
|
||||
*/
|
||||
void zb_osif_ota_mark_fw_updated(void);
|
||||
|
||||
/**
|
||||
Verify OTA file image written to device @p dev.
|
||||
|
||||
@param dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
@param raw_len - OTA image file length
|
||||
@return ZB_TRUE if ok, ZB_FALSE if error
|
||||
*/
|
||||
zb_bool_t zb_osif_ota_verify_integrity(void *dev, zb_uint32_t raw_len);
|
||||
|
||||
/**
|
||||
Verify OTA file image written to device @p dev asynchronously.
|
||||
|
||||
@param dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
@param raw_len - OTA image file length
|
||||
@return ZB_TRUE if ok, ZB_FALSE if error
|
||||
*/
|
||||
zb_bool_t zb_osif_ota_verify_integrity_async(void *dev, zb_uint32_t raw_len);
|
||||
|
||||
/**
|
||||
* Check whether OTA image recording was successful and finalize OTA.
|
||||
*
|
||||
* @param integrity_is_ok - is verification of OTA image recording successful
|
||||
*/
|
||||
void zb_osif_ota_verify_integrity_done(zb_uint8_t integrity_is_ok);
|
||||
|
||||
/**
|
||||
* Read OTA image data from flash.
|
||||
*
|
||||
* @param dev flash device handle @see zb_osif_ota_open_storage
|
||||
* @param data pointer to the read data
|
||||
* @param addr
|
||||
* @param size amount of data to read
|
||||
*/
|
||||
void zb_osif_ota_read(void *dev, zb_uint8_t *data, zb_uint32_t addr, zb_uint32_t size);
|
||||
|
||||
/**
|
||||
Check whether the current device flash memory has enough space for the OTA file image.
|
||||
|
||||
@param image_size OTA file image size
|
||||
@return ZB_TRUE if ok, ZB_FALSE if error
|
||||
*/
|
||||
zb_bool_t zb_osif_ota_fw_size_ok(zb_uint32_t image_size);
|
||||
|
||||
/**
|
||||
Get OTA image data at OTA server
|
||||
|
||||
@param dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
@param offset offset in the OTA image
|
||||
@param len - length of image block to get
|
||||
@return pointer to image block
|
||||
*/
|
||||
zb_uint8_t *zb_osif_ota_srv_get_image(void *dev, zb_uint32_t offset, zb_uint32_t len);
|
||||
|
||||
/**
|
||||
Get OTA header at OTA server
|
||||
|
||||
@param dev flash device handle used to write OTA image @see zb_osif_ota_open_storage
|
||||
@return pointer to header block
|
||||
*/
|
||||
zb_uint8_t *zb_osif_ota_srv_get_image_header(void *dev);
|
||||
|
||||
/** @} */ /* ota */
|
||||
/** @} */ /* ll */
|
||||
|
||||
#endif /* ZB_USE_OSIF_OTA_ROUTINES */
|
||||
|
||||
/**
|
||||
* Run the bootloader after next reset
|
||||
*
|
||||
* @return RET_OK is success, RET_ERROR otherwise
|
||||
*/
|
||||
zb_ret_t zb_osif_bootloader_run_after_reboot(void);
|
||||
|
||||
/**
|
||||
* Inform that image was successfully loaded
|
||||
*/
|
||||
void zb_osif_bootloader_report_successful_loading(void);
|
||||
|
||||
|
||||
#if defined ZB_PROFILE_STACK_USAGE
|
||||
/* Both functions are platform-specific */
|
||||
|
||||
/**
|
||||
* @brief Prepare stack profiler.
|
||||
* Fill stack area with a predefined pattern.
|
||||
*
|
||||
*/
|
||||
void zb_stack_profiler_pre(void);
|
||||
|
||||
/**
|
||||
* @brief Get stack usage by previously called function.
|
||||
*
|
||||
* @return Count of bytes in stack area used
|
||||
*/
|
||||
zb_uint16_t zb_stack_profiler_usage(void);
|
||||
|
||||
#endif /* ZB_PROFILE_STACK_USAGE */
|
||||
|
||||
|
||||
#ifdef ZB_USE_SLEEP
|
||||
zb_uint32_t zb_osif_sleep(zb_uint32_t sleep_tmo);
|
||||
void zb_osif_wake_up(void);
|
||||
#endif
|
||||
|
||||
#ifdef ZB_PRODUCTION_CONFIG
|
||||
|
||||
/* Check whether production configuration block is present in memory */
|
||||
zb_bool_t zb_osif_prod_cfg_check_presence(void);
|
||||
|
||||
/* Read data from production configuration header
|
||||
*
|
||||
* @param prod_cfg_hdr - pointer to production configuration header
|
||||
* @param hdr_len - size of production configuration header
|
||||
*
|
||||
* @return RET_OK is success, RET_ERROR otherwise
|
||||
*/
|
||||
zb_ret_t zb_osif_prod_cfg_read_header(zb_uint8_t *prod_cfg_hdr, zb_uint16_t hdr_len);
|
||||
|
||||
/* Read data from production configuration block
|
||||
*
|
||||
* @param buffer - buffer to read into
|
||||
* @param len - length of block to read
|
||||
* @param offset - offset to read from
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
zb_ret_t zb_osif_prod_cfg_read(zb_uint8_t *buffer, zb_uint16_t len, zb_uint16_t offset);
|
||||
|
||||
#ifdef ZB_OSIF_CONFIGURABLE_TX_POWER
|
||||
/* Set transmit power of radio on selected channel
|
||||
*
|
||||
* @param channel - channel on which radio applies new transmit power
|
||||
* @param power - transmit power in dBm
|
||||
*
|
||||
* return RET_OK if power was set successfully, RET_ERROR otherwise
|
||||
*/
|
||||
zb_ret_t zb_osif_set_transmit_power(zb_uint8_t channel, zb_int8_t power);
|
||||
#endif /* ZB_OSIF_CONFIGURABLE_TX_POWER */
|
||||
|
||||
#endif
|
||||
|
||||
/* Wait for a given number of empty cycle iterations. Timeout of 1 iteration is platform-specific
|
||||
*
|
||||
* @param count - number of empty wait cycles
|
||||
*/
|
||||
void zb_osif_busy_loop_delay(zb_uint32_t count);
|
||||
|
||||
|
||||
/* Get OSIF timer counter value in microseconds
|
||||
*
|
||||
* @return Timer counter value in microseconds
|
||||
*/
|
||||
zb_uint32_t zb_osif_get_timer_reminder(void);
|
||||
|
||||
/* Configure one LED to be dimmable
|
||||
*
|
||||
* @param led_no - Led id to be dimmable
|
||||
*/
|
||||
zb_bool_t zb_osif_led_level_init(zb_uint8_t led_no);
|
||||
|
||||
/* Set level of a dimmable LED (only one led is supported)
|
||||
* It must be initialized first with zb_osif_led_level_init(zb_uint8_t led_no)
|
||||
*
|
||||
* @param level - brightness level to set from (0 to 255) to the dimmable led
|
||||
*/
|
||||
void zb_osif_led_on_set_level(zb_uint8_t level);
|
||||
|
||||
/* Shut, recover by hard reset */
|
||||
ZB_NORETURN void zb_osif_shut_down(zb_uint8_t param);
|
||||
|
||||
#endif /* ZB_OSIF_H */
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* PURPOSE: Header to combine osif dependent files with stack
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include "freertos/portmacro.h"
|
||||
#include "zb_config.h"
|
||||
#include "zb_types.h"
|
||||
#include "zb_errors.h"
|
||||
#if CONFIG_PM_ENABLE && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "zb_esp_sleep.h"
|
||||
#endif /* CONFIG_PM_ENABLE && CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
|
||||
/**
|
||||
* @brief ZBOSS platform interface
|
||||
*
|
||||
*/
|
||||
/* At ARM all types from 1 to 4 bytes are passed to vararg with casting to 4 bytes */
|
||||
typedef zb_uint32_t zb_minimal_vararg_t;
|
||||
|
||||
/* use macros to be able to redefine */
|
||||
#define ZB_VOLATILE
|
||||
#define ZB_SDCC_XDATA
|
||||
#define ZB_CALLBACK
|
||||
#define ZB_SDCC_BANKED
|
||||
#define ZB_KEIL_REENTRANT
|
||||
#define ZB_MEMCPY memcpy
|
||||
#define ZB_MEMMOVE memmove
|
||||
#define ZB_MEMSET memset
|
||||
#define ZB_MEMCMP memcmp
|
||||
#define ZB_BZERO(s,l) ZB_MEMSET((char*)(s), 0, (l))
|
||||
#define ZB_BZERO2(s) ZB_BZERO(s, 2)
|
||||
#define ZB_ABORT abort
|
||||
#define ZB_GO_IDLE()
|
||||
#define ZVUNUSED(v) (void)v
|
||||
|
||||
/* Initialize platform */
|
||||
#define ZB_PLATFORM_INIT() zb_esp_init()
|
||||
|
||||
/* Random */
|
||||
void random_init(unsigned short seed);
|
||||
uint32_t random_rand(void);
|
||||
#define ZB_RANDOM_INIT()
|
||||
#define ZB_RANDOM_RAND() random_rand()
|
||||
|
||||
/* Timer */
|
||||
#define ZB_CHECK_TIMER_IS_ON() 1
|
||||
#define ZB_START_HW_TIMER()
|
||||
#define ZB_STOP_HW_TIMER()
|
||||
|
||||
/* Iteration */
|
||||
void zb_osif_iteration(bool block);
|
||||
#if CONFIG_PM_ENABLE && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#define ZB_TRANSPORT_BLOCK() zb_osif_iteration(!zb_esp_sleep_enable_get())
|
||||
#else
|
||||
#define ZB_TRANSPORT_BLOCK() zb_osif_iteration(true)
|
||||
#endif
|
||||
|
||||
#define ZB_TRANSPORT_NONBLOCK_ITERATION() zb_osif_iteration(false)
|
||||
|
||||
/* Scheduler */
|
||||
void zb_osif_scheduler_event(void);
|
||||
#define ZB_OSIF_SCHEDULER_EVENT() zb_osif_scheduler_event()
|
||||
|
||||
/* Interrupts */
|
||||
zb_bool_t zb_osif_is_inside_isr(void);
|
||||
void zb_osif_enable_all_interrupts(void);
|
||||
void zb_osif_disable_all_interrupts(void);
|
||||
#define ZB_ENABLE_ALL_INTER() zb_osif_enable_all_interrupts()
|
||||
#define ZB_DISABLE_ALL_INTER() zb_osif_disable_all_interrupts()
|
||||
#define ZB_OSIF_GLOBAL_LOCK() ZB_DISABLE_ALL_INTER()
|
||||
#define ZB_OSIF_GLOBAL_UNLOCK() ZB_ENABLE_ALL_INTER()
|
||||
|
||||
/* Trace log */
|
||||
void zb_trace_msg_port_platform(zb_uint_t mask, zb_uint_t level, zb_char_t *fmt, const zb_char_t *file_name,
|
||||
zb_uint16_t file_id, zb_uint16_t line_number, zb_uint_t args_size, ...);
|
||||
#define ZB_T1_TRACE(s, l, fmt, args) zb_trace_msg_port_platform(s, l, fmt, ZB_T0_TRACE args)
|
||||
|
||||
/* Userial */
|
||||
void zb_osif_userial_poll(void);
|
||||
|
||||
/* Product configurations */
|
||||
zb_bool_t zb_osif_prod_cfg_check_presence(void);
|
||||
zb_ret_t zb_osif_prod_cfg_read_header(zb_uint8_t *prod_cfg_hdr, zb_uint16_t hdr_len);
|
||||
zb_ret_t zb_osif_prod_cfg_read(zb_uint8_t *buffer, zb_uint16_t len, zb_uint16_t offset);
|
||||
|
||||
/* Zboss stack lock */
|
||||
esp_err_t zb_esp_osif_lock_init(void);
|
||||
bool zb_esp_osif_lock_acquire(TickType_t block_ticks);
|
||||
void zb_esp_osif_lock_release(void);
|
||||
|
||||
/**
|
||||
* @brief ESP tools for zboss osif
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
fd_set read_fds; /* The read file descriptors.*/
|
||||
fd_set write_fds; /* The write file descriptors.*/
|
||||
fd_set error_fds; /* The error file descriptors.*/
|
||||
int max_fd; /* The max file descriptor.*/
|
||||
struct timeval timeout; /* The timeout.*/
|
||||
} zb_osif_iteration_context_t;
|
||||
|
||||
void zb_esp_init(void);
|
||||
void zb_esp_abort(void);
|
||||
void zb_esp_set_event(int event);
|
||||
void zb_esp_clr_event(int event);
|
||||
void zb_esp_console_update(zb_osif_iteration_context_t *iteration);
|
||||
void zb_esp_radio_update(zb_osif_iteration_context_t *iteration);
|
||||
void zb_esp_console_process(zb_osif_iteration_context_t *iteration);
|
||||
void zb_esp_radio_process(zb_osif_iteration_context_t *iteration);
|
||||
|
||||
#ifdef ZB_SERIAL_FOR_TRACE
|
||||
#define ZB_OSIF_SERIAL_FLUSH() zb_esp_console_process(NULL)
|
||||
#endif
|
||||
|
||||
void zb_esp_trace_config(uint32_t trace_level, uint32_t trace_mask);
|
||||
typedef uint32_t (*get_utc_time_callback_t)(void);
|
||||
void esp_zb_get_utc_time_callback_register(get_utc_time_callback_t cb);
|
||||
|
||||
uint8_t esp_zb_rssi_to_lqi(int8_t rssi);
|
||||
|
||||
#define is_ack_required(frame) (frame[1] & BIT(5))
|
||||
#define is_ack_pending(frame) (frame[1] & BIT(4))
|
||||
@@ -0,0 +1,609 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: simple lists operations (macros). Use 1- or 2-bytes instead
|
||||
instead of pointer.
|
||||
*/
|
||||
#ifndef POOLED_LIST_H
|
||||
#define POOLED_LIST_H 1
|
||||
|
||||
/*! @cond internals_doc */
|
||||
/**
|
||||
@addtogroup ZB_BASE
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ZB_POOLED_LIST_INCLUDED
|
||||
#define ZB_POOLED_LIST_INCLUDED
|
||||
|
||||
#define ZP_POOLED_LIST_NULL -1
|
||||
|
||||
#define ZP_TYPE8( x ) ( ( zb_uint8_t ) ( x ) )
|
||||
#define ZP_RIND8( x ) ( ( x ) - ZP_TYPE8( 1U ) )
|
||||
|
||||
#define ZP_TYPE16( x ) ( ( zb_uint16_t ) ( x ) )
|
||||
#define ZP_RIND16( x ) ( ( x ) - ZP_TYPE16( 1U ) )
|
||||
|
||||
#define ZP_NULL8 ( ZP_TYPE8 ( ZP_POOLED_LIST_NULL ) )
|
||||
#define ZP_NULL16 ( ZP_TYPE16 ( ZP_POOLED_LIST_NULL ) )
|
||||
|
||||
#define ZB_POOLED_LIST8_FIELD( link_field ) zb_uint8_t link_field ## _next; zb_uint8_t link_field ## _prev
|
||||
#define ZB_POOLED_LIST16_FIELD( link_field ) zb_uint16_t link_field ## _next; zb_uint16_t link_field ## _prev
|
||||
|
||||
#define ZB_POOLED_LIST8_DEF( list ) zb_uint8_t list = ZP_NULL8
|
||||
#define ZB_POOLED_LIST16_DEF( list ) zb_uint16_t list = ZP_NULL16
|
||||
|
||||
#define ZB_POOLED_LIST8_DEFINE( list ) zb_uint8_t list
|
||||
#define ZB_POOLED_LIST16_DEFINE( list ) zb_uint16_t list
|
||||
|
||||
|
||||
#define ZB_POOLED_LIST8_INIT( list ) (list) = ZP_NULL8
|
||||
#define ZB_POOLED_LIST16_INIT( list ) (list) = ZP_NULL16
|
||||
|
||||
|
||||
#define ZB_POOLED_LIST8_IS_EMPTY( list ) ( ( list ) == ZP_NULL8 )
|
||||
#define ZB_POOLED_LIST8_IS_NOT_EMPTY( list ) ( ( list ) != ZP_NULL8 )
|
||||
|
||||
#define ZB_POOLED_LIST16_IS_EMPTY( list ) ( ( list ) == ZP_NULL16 )
|
||||
#define ZB_POOLED_LIST16_IS_NOT_EMPTY( list ) ( ( list ) != ZP_NULL16 )
|
||||
|
||||
#define ZB_POOLED_LIST8_NEXT( base, index, link_field ) ( ( ZP_NULL8 == ( index ) ) ? ZP_NULL8 : ( base )[ ( index ) ].link_field##_next)
|
||||
#define ZB_POOLED_LIST8_PREV( base, index, link_field ) ( ( ZP_NULL8 == ( index ) ) ? ZP_NULL8 : ( base )[ ( index ) ].link_field##_prev)
|
||||
|
||||
#define ZB_POOLED_LIST8_GET_HEAD( base, list, link_field ) ( list )
|
||||
#define ZB_POOLED_LIST8_GET_TAIL( base, list, link_field ) ( ( ZP_NULL8 != list ) ? base[ list ].link_field##_prev : ZP_NULL8 )
|
||||
|
||||
#define ZB_POOLED_LIST16_GET_HEAD( base, list, link_field ) ( list )
|
||||
#define ZB_POOLED_LIST16_GET_TAIL( base, list, link_field ) ( ( ZP_NULL16 != list ) ? base[ list ].link_field##_prev : ZP_NULL16 )
|
||||
|
||||
#define ZB_POOLED_LIST16_NEXT( base, index, link_field ) ( ( ZP_NULL16 == index ) ) ? ZP_NULL16 : base[ index ].link_field##_next ) )
|
||||
#define ZB_POOLED_LIST16_PREV( base, index, link_field ) ( ( ZP_NULL16 == index ) ) ? ZP_NULL16 : base[ index ].link_field##_prev ) )
|
||||
|
||||
/**
|
||||
Remove element from the list head, and store it in removed_entry
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_CUT_HEAD( base,list, link_field, removed_elem_index ) do \
|
||||
{ \
|
||||
removed_elem_index = list; \
|
||||
if( ( list ) != ZP_NULL8 ) \
|
||||
{ \
|
||||
if( ( base )[ list ].link_field##_next != ZP_NULL8 ) \
|
||||
{ \
|
||||
( base )[ ( base )[ list ].link_field##_next ].link_field##_prev = \
|
||||
( base )[ list ].link_field##_prev; \
|
||||
} \
|
||||
( base )[ list ].link_field##_prev = ZP_NULL8; \
|
||||
( list ) = ( base )[ list ].link_field##_next ; \
|
||||
} \
|
||||
} while (0) \
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list head
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_INSERT_HEAD( base, list, link_field, elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( ( elem_index ) != ZP_NULL8 ); \
|
||||
( base )[ elem_index ].link_field##_next = ( list ); \
|
||||
if( ( list ) != ZP_NULL8 ) \
|
||||
{ \
|
||||
( base )[ ( elem_index ) ].link_field##_prev = ( base )[ list ].link_field##_prev; \
|
||||
( base )[ ( list ) ].link_field##_prev = ( elem_index ) ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
( base )[ elem_index ].link_field##_prev = ( elem_index ); \
|
||||
} \
|
||||
( list ) = ( elem_index ); \
|
||||
} while( 0 )
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list tail
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_INSERT_TAIL( base, list, link_field, elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( ( elem_index ) != ZP_NULL8 ); \
|
||||
( base )[ ( elem_index ) ].link_field##_next = ZP_NULL8; \
|
||||
if( ( list ) != ZP_NULL8 ) \
|
||||
{ \
|
||||
( base )[ ( elem_index ) ].link_field##_prev = ( base )[ ( list ) ].link_field##_prev; \
|
||||
( base )[ ( base )[ ( list ) ].link_field##_prev ].link_field##_next = ( elem_index ); \
|
||||
( base )[ ( list ) ].link_field##_prev = ( elem_index ); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
( base )[ ( elem_index ) ].link_field##_prev = ( elem_index ); \
|
||||
( list ) = ( elem_index ); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Insert after existed elem_indexry
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_INSERT_AFTER( base, list, link_field, elem_index, new_elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( ( new_elem_index ) != ZP_NULL8 ); \
|
||||
if( ( elem_index ) != ZP_NULL8 ) \
|
||||
{ \
|
||||
if( ( ( elem_index ) ) == ZB_POOLED_LIST8_GET_TAIL( ( base ), ( list ), link_field ) ) \
|
||||
{ \
|
||||
ZB_POOLED_LIST8_INSERT_TAIL( ( base ), ( list ), link_field, ( new_elem_index ) ); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
( base )[ new_elem_index ].link_field##_next = ( base )[ ( elem_index ) ].link_field##_next ; \
|
||||
( base )[ new_elem_index ].link_field##_prev = ( elem_index ); \
|
||||
( base )[ ( base )[ ( elem_index ) ].link_field##_next ].link_field##_prev = ( new_elem_index ); \
|
||||
( base )[ ( elem_index ) ].link_field##_next = ( new_elem_index ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
/**
|
||||
Remove from the list head
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_REMOVE_HEAD( base, list, link_field ) do \
|
||||
{ \
|
||||
if( list != ZP_NULL8 ) \
|
||||
{ \
|
||||
if( base[ list ].link_field##_next != ZP_NULL8 ) \
|
||||
{ \
|
||||
base[ base[ list ].link_field##_next ].link_field##_prev = base[ list ].link_field##_prev; \
|
||||
} \
|
||||
base[ list ].link_field##_prev = ZP_NULL8; \
|
||||
list = base[ list ].link_field##_next; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
Remove from the list tail
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_REMOVE_TAIL( base, list, link_field ) do \
|
||||
{ \
|
||||
if( list != ZP_NULL8 ) \
|
||||
{ \
|
||||
if( base[ list ].link_field ## _prev == ( list ) ) /* made an empty list */ \
|
||||
{ \
|
||||
base[ list ].link_field ## _prev = ZP_NULL8; \
|
||||
( list ) = ZP_NULL8; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
base[ base[ base[ list ].link_field##_prev ].link_field##_prev ].link_field##_next = ZP_NULL8; \
|
||||
\
|
||||
/* This is a bit tricky: we need to assign list->prev and set \
|
||||
* tail->prev to 0, but we can't use temporary variable because \
|
||||
* we have no type here. Use _next as temporary variable. */ \
|
||||
\
|
||||
base[ base[ list ].link_field##_prev ].link_field##_next = \
|
||||
base[ base[ list ].link_field##_prev ].link_field##_prev; \
|
||||
\
|
||||
base[ base[ list ].link_field##_prev ].link_field##_prev = ZP_NULL8; \
|
||||
\
|
||||
base[ list ].link_field##_prev = base[ base[ list ].link_field##_prev ].link_field##_next; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ZB_POOLED_LIST8_ITERATE( base, list, link_field, elem_index ) \
|
||||
for( ( elem_index ) = ( list ) ; ( elem_index != ZP_NULL8 ) ; ( elem_index ) = base[ elem_index ].link_field##_next )
|
||||
|
||||
|
||||
#define ZB_POOLED_LIST8_ITERATE_BACK( base, list, link_field, elem_index) \
|
||||
for( ( elem_index ) = ( list ) ? base[ list ].link_field##_prev : ZP_NULL8; \
|
||||
( elem_index != ZP_NULL8 ); \
|
||||
( elem_index ) = ( ( base[ base[ elem_index ].link_field##_prev ].link_field##_next != ZP_NULL8 ) ? \
|
||||
base[ elem_index ].link_field##_prev : ZP_NULL8 ) )
|
||||
|
||||
/* NOTE! elem_index is just some index from base array, but not
|
||||
ordinary number of the list. So, if you remove elem_index == 2,
|
||||
it doesn't mean that you remove third element from the list. It means
|
||||
just that you remove some element placed in base[ 2 ] from the list which can
|
||||
be actually any ordinary number of the list.
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST8_REMOVE( base, list, link_field, elem_index ) \
|
||||
do \
|
||||
{ \
|
||||
ZB_ASSERT( ( elem_index ) != ZP_NULL8 ); \
|
||||
if( base[ ( elem_index ) ].link_field##_prev != ZP_NULL8 ) \
|
||||
{ \
|
||||
if( ( base )[ ( elem_index ) ].link_field##_next != ZP_NULL8 ) /* this is not a tail */ \
|
||||
{ \
|
||||
( base )[ ( base )[ ( elem_index ) ].link_field##_next ].link_field##_prev = ( base )[ ( elem_index ) ].link_field##_prev; \
|
||||
} \
|
||||
else /* this is a tail */ \
|
||||
{ \
|
||||
( base )[ ( list ) ].link_field##_prev = ( base )[ ( elem_index ) ].link_field##_prev; \
|
||||
} \
|
||||
if( ( elem_index ) == ( list ) ) /* this is a head */ \
|
||||
{ \
|
||||
( list ) = ( base )[ ( elem_index ) ].link_field##_next; \
|
||||
} \
|
||||
else /* this is not a head */ \
|
||||
{ \
|
||||
( base )[ ( base )[ ( elem_index ) ].link_field##_prev ].link_field##_next = ( base )[ ( elem_index ) ].link_field##_next; \
|
||||
} \
|
||||
( base )[ ( elem_index ) ].link_field##_prev = ZP_NULL8; \
|
||||
} \
|
||||
} \
|
||||
while( 0 ) \
|
||||
|
||||
|
||||
/**
|
||||
Remove element from the list head, and store it in removed_entry
|
||||
*/
|
||||
#define ZB_POOLED_LIST16_CUT_HEAD( base,list, link_field, removed_elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( removed_elem_index != ZP_NULL16 ); \
|
||||
removed_elem_index = list; \
|
||||
if( ( list ) != ZP_NULL16 ) \
|
||||
{ \
|
||||
if( base[ list ].link_field##_next != ZP_NULL16 ) \
|
||||
{ \
|
||||
base[ base[ list ].link_field##_next ].link_field##_prev = \
|
||||
base[ list ].link_field##_prev; \
|
||||
} \
|
||||
base[ list ].link_field##_prev = ZP_NULL16; \
|
||||
( list ) = base[ list ].link_field##_next ; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list head
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_INSERT_HEAD( base, list, link_field, elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( ( elem_index ) != ZP_NULL16 ); \
|
||||
base[ elem_index ].link_field##_next = ( list ); \
|
||||
if( ( list ) != ZP_NULL16 ) \
|
||||
{ \
|
||||
base[ elem_index ].link_field##_prev = base[ list ].link_field##_prev; \
|
||||
base[ list ].link_field##_prev = elem_index ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
base[ elem_index ].link_field##_prev = elem_index; \
|
||||
} \
|
||||
( list ) = ( elem_index ); \
|
||||
} while( 0 )
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list tail
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_INSERT_TAIL( base, list, link_field, elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( ( elem_index ) != ZP_NULL16 ); \
|
||||
base[ elem_index ].link_field##_next = ZP_NULL16; \
|
||||
if( ( list ) != ZP_NULL16 ) \
|
||||
{ \
|
||||
base[ elem_index ].link_field##_prev = base[ list ].link_field##_prev; \
|
||||
base[ base[ list ].link_field##_prev ].link_field##_next = elem_index; \
|
||||
base[ list ].link_field##_prev = elem_index; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
base[ elem_index ].link_field##_prev = elem_index; \
|
||||
( list ) = ( elem_index ); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Insert after existed elem_indexry
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_INSERT_AFTER( base, list, link_field, elem_index, new_elem_index ) do \
|
||||
{ \
|
||||
ZB_ASSERT( new_elem_index != ZP_NULL16 ); \
|
||||
if( elem_index != ZP_NULL16 ) \
|
||||
{ \
|
||||
if( elem_index == ZB_POOLED_LIST16_GET_TAIL( base, list, link_field ) ) \
|
||||
{ \
|
||||
ZB_POOLED_LIST16_INSERT_TAIL( base, list, link_field, new_elem_index ); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
base[ new_elem_index ].link_field##_next = base[ elem_index ].link_field##_next ; \
|
||||
base[ new_elem_index ].link_field##_prev = elem_index; \
|
||||
base[ base[ elem_index ].link_field##_next ].link_field##_prev = new_elem_index; \
|
||||
base[ elem_index ].link_field##_next = ( new_elem_index ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
/**
|
||||
Remove from the list head
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_REMOVE_HEAD( base, list, link_field ) do \
|
||||
{ \
|
||||
if( list != ZP_NULL16 ) \
|
||||
{ \
|
||||
if( base[ list ].link_field##_next != ZP_NULL16 ) \
|
||||
{ \
|
||||
base[ base[ list ].link_field##_next ].link_field##_prev = base[ list ].link_field##_prev; \
|
||||
} \
|
||||
base[ list ].link_field##_prev = ZP_NULL16; \
|
||||
list = base[ list ].link_field##_next; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
Remove from the list tail
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_REMOVE_TAIL( base, list, link_field ) do \
|
||||
{ \
|
||||
if( list != ZP_NULL16 ) \
|
||||
{ \
|
||||
if( base[ list ].link_field ## _prev == ( list ) ) /* made an empty list */ \
|
||||
{ \
|
||||
base[ list ].link_field ## _prev = ZP_NULL16; \
|
||||
( list ) = ZP_NULL16; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
base[ base[ base[ list ].link_field##_prev ].link_field##_prev ].link_field##_next = ZP_NULL16; \
|
||||
\
|
||||
/* This is a bit tricky: we need to assign list->prev and set \
|
||||
* tail->prev to 0, but we can't use temporary variable because \
|
||||
* we have no type here. Use _next as temporary variable. */ \
|
||||
\
|
||||
base[ base[ list ].link_field##_prev ].link_field##_next = \
|
||||
base[ base[ list ].link_field##_prev ].link_field##_prev; \
|
||||
\
|
||||
base[ base[ list ].link_field##_prev ].link_field##_prev = ZP_NULL16; \
|
||||
\
|
||||
base[ list ].link_field##_prev = base[ base[ list ].link_field##_prev ].link_field##_next; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ZB_POOLED_LIST16_ITERATE( base, list, link_field, elem_index ) \
|
||||
for( ( elem_index ) = ( list ) ; ( elem_index != ZP_NULL16 ) ; ( elem_index ) = base[ elem_index ].link_field##_next )
|
||||
|
||||
|
||||
#define ZB_POOLED_LIST16_ITERATE_BACK( base, list, link_field, elem_index) \
|
||||
for( ( elem_index ) = ( list ) ? base[ list ].link_field##_prev : ZP_NULL16; \
|
||||
( elem_index != ZP_NULL16 ); \
|
||||
( elem_index ) = ( ( base[ base[ elem_index ].link_field##_prev ].link_field##_next != ZP_NULL16 ) ? \
|
||||
base[ elem_index ].link_field##_prev : ZP_NULL16 ) )
|
||||
|
||||
/* NOTE! elem_index is just some index from base array, but not
|
||||
ordinary number of the list. So, if you remove elem_index == 2,
|
||||
it doesn't mean that you remove third element from the list. It means
|
||||
just that you remove some element placed in base[ 2 ] from the list which can
|
||||
be actually any ordinary number of the list.
|
||||
*/
|
||||
|
||||
#define ZB_POOLED_LIST16_REMOVE( base, list, link_field, elem_index ) \
|
||||
do \
|
||||
{ \
|
||||
ZB_ASSERT( elem_index != ZP_NULL16 ); \
|
||||
if( base[ elem_index ].link_field##_prev != ZP_NULL16 ) \
|
||||
{ \
|
||||
if( base[ elem_index ].link_field##_next != ZP_NULL16 ) /* this is not a tail */ \
|
||||
{ \
|
||||
base[ base[ elem_index ].link_field##_next ].link_field##_prev = base[ elem_index ].link_field##_prev; \
|
||||
} \
|
||||
else /* this is a tail */ \
|
||||
{ \
|
||||
base[ list ].link_field##_prev = base[ elem_index ].link_field##_prev; \
|
||||
} \
|
||||
if( ( elem_index ) == ( list ) ) /* this is a head */ \
|
||||
{ \
|
||||
( list ) = base[ elem_index ].link_field##_next; \
|
||||
} \
|
||||
else /* this is not a head */ \
|
||||
{ \
|
||||
base[ base[ elem_index ].link_field##_prev ].link_field##_next = base[ elem_index ].link_field##_next; \
|
||||
} \
|
||||
base[ elem_index ].link_field##_prev = ZP_NULL16; \
|
||||
} \
|
||||
} \
|
||||
while( 0 )
|
||||
|
||||
|
||||
/* Single liked lists */
|
||||
#define ZP_POOLED_SL_LIST8_NULL 255U
|
||||
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_DEFINE(type, list) type list ## _head; type list ## _tail
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_INIT(list) list ## _head = ZP_POOLED_SL_LIST8_NULL; list ## _tail = ZP_POOLED_SL_LIST8_NULL
|
||||
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_FIELD(type, name) type name ## _next
|
||||
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_NEXT(base, index, name) ( ( (index) == ZP_POOLED_SL_LIST8_NULL ) ? ZP_POOLED_SL_LIST8_NULL : (base)[index].name ## _next )
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_HEAD(list) list ## _head
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_TAIL(list) list ## _tail
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_IS_EMPTY(list) ( list ## _head == ZP_POOLED_SL_LIST8_NULL )
|
||||
#define ZB_POOLED_SL_LIST8_IS_NOT_EMPTY(list) ( list ## _head != ZP_POOLED_SL_LIST8_NULL )
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list head
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_INSERT_HEAD(base, list, name, index) \
|
||||
do \
|
||||
{ \
|
||||
(base)[index].name ## _next = list ## _head; \
|
||||
if ( (list ## _head) + 1 == ZP_POOLED_SL_LIST8_NULL ) \
|
||||
{ \
|
||||
(list ## _tail) = (index); \
|
||||
} \
|
||||
list ## _head = (index); \
|
||||
} while( 0 )
|
||||
|
||||
|
||||
/**
|
||||
Insert to the list tail
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_INSERT_TAIL(base, list, name, index) \
|
||||
do \
|
||||
{ \
|
||||
(base)[index].name##_next = ZP_POOLED_SL_LIST8_NULL; \
|
||||
if ( (list ## _tail) != ZP_POOLED_SL_LIST8_NULL) \
|
||||
{ \
|
||||
(base)[list ## _tail].name##_next = index; \
|
||||
list ## _tail = (index); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(list ## _head) = (index); \
|
||||
(list ## _tail) = (index); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Remove from the list head
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_REMOVE_HEAD(base, list, name) \
|
||||
do \
|
||||
{ \
|
||||
if ( (list ## _head) != ZP_POOLED_SL_LIST8_NULL ) \
|
||||
{ \
|
||||
list ## _head = (base)[list ## _head].name ## _next; \
|
||||
if ( (list ## _head) == ZP_POOLED_SL_LIST8_NULL) \
|
||||
{ \
|
||||
(list ## _tail) = ZP_POOLED_SL_LIST8_NULL; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Remove element from the list head, and store it in index
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_CUT_HEAD(base, list, name, index) \
|
||||
do \
|
||||
{ \
|
||||
if ( (list ## _head) != ZP_POOLED_SL_LIST8_NULL ) \
|
||||
{ \
|
||||
(index) = (list ## _head); \
|
||||
(list ## _head) = (base)[list ## _head].name ## _next; \
|
||||
if ( (list ## _head) == ZP_POOLED_SL_LIST8_NULL) \
|
||||
{ \
|
||||
(list ## _tail) = ZP_POOLED_SL_LIST8_NULL; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(index) = ZP_POOLED_SL_LIST8_NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Remove element from the list tail
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_CUT_TAIL(base, list, name, index) \
|
||||
do \
|
||||
{ \
|
||||
(index) = (list ## _tail); \
|
||||
ZB_POOLED_SL_LIST8_REMOVE(base, list, name, index); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Remove index from list
|
||||
*/
|
||||
#define ZB_POOLED_SL_LIST8_REMOVE(base, list, name, index) \
|
||||
do \
|
||||
{ \
|
||||
zb_uint8_t p; \
|
||||
zb_uint8_t prev = ZP_POOLED_SL_LIST8_NULL; \
|
||||
for (p = (list ## _head); \
|
||||
p != ZP_POOLED_SL_LIST8_NULL; \
|
||||
prev = p, p = (base)[p].name ## _next ) \
|
||||
{ \
|
||||
if ( p == (index) ) \
|
||||
{ \
|
||||
if ( prev != ZP_POOLED_SL_LIST8_NULL ) \
|
||||
{ \
|
||||
(base)[prev].name ## _next = (base)[p].name ## _next; \
|
||||
if ((list ## _tail) == index) \
|
||||
{ \
|
||||
(list ## _tail) = prev; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(list ## _head) = (base)[p].name ## _next; \
|
||||
} \
|
||||
if ( (list ## _head) == ZP_POOLED_SL_LIST8_NULL ) \
|
||||
{ \
|
||||
(list ## _tail) = ZP_POOLED_SL_LIST8_NULL; \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while( 0 )
|
||||
|
||||
|
||||
#define ZB_POOLED_SL_LIST8_ITERATE(base, list, name, index) \
|
||||
for( (index) = (list); (index != ZP_POOLED_SL_LIST8_NULL); (index) = base[index].name##_next )
|
||||
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
/*! @endcond */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Declare ring buffer internals
|
||||
*/
|
||||
|
||||
#ifndef ZB_RINGBUFFER_H
|
||||
#define ZB_RINGBUFFER_H 1
|
||||
|
||||
/*! @cond internals_doc */
|
||||
/**
|
||||
@addtogroup ZB_BASE
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\par Generic ring buffer macros
|
||||
*/
|
||||
|
||||
/**
|
||||
Declare ring buffer for entries of given type and capacity.
|
||||
This is typedef, not variable declaration.
|
||||
|
||||
@param type_name_prefix - prefix for names (like xxx_s, xxx_t)
|
||||
@param ent_type - type of the ring buffer entry
|
||||
@param capacity - ring buffer capacity
|
||||
*/
|
||||
#define ZB_RING_BUFFER_DECLARE(type_name_prefix, ent_type, capacity) \
|
||||
typedef struct type_name_prefix ## _s \
|
||||
{ \
|
||||
zb_ushort_t read_i; \
|
||||
zb_ushort_t write_i; \
|
||||
zb_ushort_t written; \
|
||||
ent_type ring_buf[capacity]; \
|
||||
} type_name_prefix ## _t
|
||||
|
||||
|
||||
/**
|
||||
* Initialize ring buffer internals
|
||||
*/
|
||||
#define ZB_RING_BUFFER_INIT(rb) ( (rb)->read_i = (rb)->write_i = (rb)->written = 0U)
|
||||
|
||||
/**
|
||||
* Return ring buffer capacity
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*/
|
||||
#define ZB_RING_BUFFER_CAPACITY(rb) ((sizeof((rb)->ring_buf) / sizeof((rb)->ring_buf[0])))
|
||||
|
||||
/**
|
||||
* Return 1 if ring buffer is full
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*/
|
||||
#define ZB_RING_BUFFER_IS_FULL(rb) ((zb_uint_t)(rb)->written >= ZB_RING_BUFFER_CAPACITY(rb))
|
||||
|
||||
/**
|
||||
* Return 1 if ring buffer is empty
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*/
|
||||
#define ZB_RING_BUFFER_IS_EMPTY(rb) ((rb)->written == 0U)
|
||||
|
||||
|
||||
/**
|
||||
* Return free space available in the ring buffer
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*/
|
||||
#define ZB_RING_BUFFER_FREE_SPACE(rb) (ZB_RING_BUFFER_CAPACITY(rb) - (zb_uint_t)(rb)->written)
|
||||
|
||||
/**
|
||||
* Reserve slot in the ring buffer but do not update pointers
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @return Pointer to the ring buffer entry or NULL if ring buffer is full
|
||||
*/
|
||||
#define ZB_RING_BUFFER_PUT_RESERVE(rb) \
|
||||
( \
|
||||
ZB_RING_BUFFER_IS_FULL(rb) ? NULL \
|
||||
: (rb)->ring_buf + (rb)->write_i \
|
||||
)
|
||||
|
||||
#define ZB_RING_BUFFER_PUT_HEAD_RESERVE_IDX(rb) \
|
||||
( \
|
||||
((rb)->read_i > 0U) ? \
|
||||
((rb)->read_i - 1U) : (ZB_RING_BUFFER_CAPACITY(rb) - 1U) \
|
||||
)
|
||||
|
||||
#define ZB_RING_BUFFER_PUT_HEAD_RESERVE(rb) \
|
||||
( \
|
||||
ZB_RING_BUFFER_IS_FULL(rb) ? NULL \
|
||||
: ((rb)->ring_buf + ZB_RING_BUFFER_PUT_HEAD_RESERVE_IDX(rb)) \
|
||||
)
|
||||
|
||||
/**
|
||||
* Put to the ring buffer.
|
||||
* Get free slot from the ring buffer, return pointer to it.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_FLUSH_PUT(rb) \
|
||||
( \
|
||||
(rb)->written++, \
|
||||
(rb)->write_i = ((rb)->write_i + 1U) % ZB_RING_BUFFER_CAPACITY(rb) \
|
||||
)
|
||||
|
||||
#define ZB_RING_BUFFER_FLUSH_PUT_HEAD(rb) \
|
||||
do \
|
||||
{ \
|
||||
(rb)->written++; \
|
||||
if ((rb)->read_i > 0U) \
|
||||
{ \
|
||||
--((rb)->read_i); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(rb)->read_i = ZB_RING_BUFFER_CAPACITY(rb) - 1U; \
|
||||
} \
|
||||
} while(ZB_FALSE)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Return amount of data which can be put into ring buffer tail starting from write_i
|
||||
|
||||
@param rb - ring buffer pointer
|
||||
@param size - requested data size
|
||||
*/
|
||||
#define ZB_RING_BUFFER_LINEAR_PORTION(rb, size) \
|
||||
( \
|
||||
ZB_RING_BUFFER_CAPACITY(rb) - (rb)->write_i < size ? \
|
||||
ZB_RING_BUFFER_CAPACITY(rb) - (rb)->write_i : size \
|
||||
)
|
||||
|
||||
/**
|
||||
Return amount of data which can be put into ring buffer tail starting from write_i using external rb capacity
|
||||
|
||||
@param rb - ring buffer pointer
|
||||
@param size - requested data size
|
||||
*/
|
||||
#define ZB_RING_BUFFER_LINEAR_PORTION_BY_CAP(rb, size, rb_cap) \
|
||||
( \
|
||||
(rb_cap) - (rb)->write_i < (size) ? \
|
||||
(rb_cap) - (rb)->write_i : (size) \
|
||||
)
|
||||
|
||||
/**
|
||||
* Get the size of available for writing continuous portion in ring buffer.
|
||||
*
|
||||
* That portion is from write_i index to the end of the buffer or
|
||||
* from write_i index to the beginning of previously written but still not read data
|
||||
*
|
||||
* @param buf - ring buffer pointer
|
||||
* @return size of available continuous portion
|
||||
*/
|
||||
#define ZB_RING_BUFFER_AVAILABLE_CONTINUOUS_PORTION(rb) \
|
||||
ZB_RING_BUFFER_LINEAR_PORTION((rb), ZB_RING_BUFFER_FREE_SPACE(rb))
|
||||
|
||||
/**
|
||||
Batch put data into ringbuffer
|
||||
|
||||
To be used to copy from external buffer to ring buffer
|
||||
|
||||
@param rb - ring buffer pointer
|
||||
@param data - data ptr
|
||||
@param size - requested data size
|
||||
@param entries_written - (out) amount of data put
|
||||
*/
|
||||
#define ZB_RING_BUFFER_BATCH_PUT(rb, data, size, entries_written) \
|
||||
do \
|
||||
{ \
|
||||
(entries_written) = ZB_RING_BUFFER_LINEAR_PORTION((rb), (size)); \
|
||||
ZB_MEMCPY((rb)->ring_buf + (rb)->write_i, (data), (entries_written)); \
|
||||
(rb)->written += (entries_written); \
|
||||
(rb)->write_i = (((rb)->write_i + (entries_written)) % ZB_RING_BUFFER_CAPACITY(rb)); \
|
||||
} while(ZB_FALSE)
|
||||
|
||||
/**
|
||||
Batch put data into ringbuffer using external rb capacity
|
||||
|
||||
To be used to copy from external buffer to ring buffer
|
||||
|
||||
@param rb - ring buffer pointer
|
||||
@param data - data ptr
|
||||
@param size - requested data size
|
||||
@param entries_written - (out) amount of data put
|
||||
@param rb_cap - cap of the ring buffer
|
||||
*/
|
||||
#define ZB_RING_BUFFER_BATCH_PUT_BY_CAP(rb, data, size, entries_written, rb_cap) \
|
||||
do \
|
||||
{ \
|
||||
(entries_written) = ZB_RING_BUFFER_LINEAR_PORTION_BY_CAP((rb), (size), (rb_cap)); \
|
||||
ZB_MEMCPY((rb)->ring_buf + (rb)->write_i, (data), (entries_written)); \
|
||||
(rb)->written += (entries_written); \
|
||||
(rb)->write_i = (((rb)->write_i + (entries_written)) % (rb_cap)); \
|
||||
} while(ZB_FALSE)
|
||||
|
||||
|
||||
/**
|
||||
* Flush after put more then 1 element to the ring buffer
|
||||
*
|
||||
* Do not check for write_i overflow!
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param size - number of items put
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_FLUSH_BATCH_PUT(rb, size) \
|
||||
( \
|
||||
(rb)->written += size, \
|
||||
(rb)->write_i = (((rb)->write_i) + size) % ZB_RING_BUFFER_CAPACITY(rb) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Put value to the ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param value - value to put to ring buffer
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_PUT(rb, value) \
|
||||
( \
|
||||
(rb)->ring_buf[(rb)->write_i] = (value), \
|
||||
(rb)->written++, \
|
||||
(rb)->write_i = ((rb)->write_i + 1U) % ZB_RING_BUFFER_CAPACITY(rb) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Put value to the ring buffer using memcpy.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param value_ptr - pointer to value to put to ring buffer
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_PUT_PTR(rb, value_ptr) \
|
||||
( \
|
||||
memcpy(&((rb)->ring_buf[(rb)->write_i]), (value_ptr), sizeof((rb)->ring_buf[0])), \
|
||||
(rb)->written++, \
|
||||
(rb)->write_i = ((rb)->write_i + 1U) % ZB_RING_BUFFER_CAPACITY(rb) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Reinsert last value into the ring buffer using memcpy.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param value_ptr - pointer to value to put to ring buffer
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_PUT_REUSE_LAST(rb, value_ptr) \
|
||||
( \
|
||||
memcpy(&((rb)->ring_buf[((rb)->write_i ? (rb)->write_i - 1U : (rb)->write_i + ZB_RING_BUFFER_CAPACITY(rb) - 1U)]), \
|
||||
(value_ptr), \
|
||||
sizeof((rb)->ring_buf[0])) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Get entry from the ring buffer read pointer position
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*
|
||||
* @return pointer to the ring buffer entry or NULL if it is empty
|
||||
*/
|
||||
#define ZB_RING_BUFFER_PEEK(rb) \
|
||||
( \
|
||||
ZB_RING_BUFFER_IS_EMPTY(rb) ? NULL \
|
||||
: (rb)->ring_buf + (rb)->read_i \
|
||||
)
|
||||
|
||||
/**
|
||||
* Get entry from the ring buffer read pointer position
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*
|
||||
* @return pointer to the ring buffer entry
|
||||
*/
|
||||
#define ZB_RING_BUFFER_GET(rb) \
|
||||
( \
|
||||
(rb)->ring_buf + (rb)->read_i \
|
||||
)
|
||||
|
||||
/**
|
||||
* Get entry from the ring buffer write pointer position
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*
|
||||
* @return pointer to the ring buffer entry
|
||||
*/
|
||||
#define ZB_RING_BUFFER_GETW(rb) \
|
||||
( (rb)->ring_buf + (rb)->write_i )
|
||||
|
||||
/**
|
||||
* Move ring buffer read pointer.
|
||||
*
|
||||
* To be used after ZB_RING_BUFFER_PEEK().
|
||||
* @note This macro does not check for an empty ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_FLUSH_GET(rb) \
|
||||
( \
|
||||
(rb)->written--, \
|
||||
((rb)->read_i = ((rb)->read_i + 1U) % ZB_RING_BUFFER_CAPACITY(rb)) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Get entries from the ring buffer read pointer position which can be get at once
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param size - (out) number of entries which can be got
|
||||
*
|
||||
* @return pointer to the ring buffer entry
|
||||
*/
|
||||
#define ZB_RING_BUFFER_GET_BATCH(rb, size) \
|
||||
( \
|
||||
(size) = ((rb)->written <= (ZB_RING_BUFFER_CAPACITY(rb) - (rb)->read_i) \
|
||||
? \
|
||||
(rb)->written \
|
||||
: \
|
||||
(ZB_RING_BUFFER_CAPACITY(rb) - (rb)->read_i)), \
|
||||
(rb)->ring_buf + (rb)->read_i \
|
||||
) \
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Move ring buffer read pointer for more than 1 element
|
||||
*
|
||||
* @note This macro does not check for empty ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param size - number of elements to mark as read
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_FLUSH_GET_BATCH(rb, size) \
|
||||
( \
|
||||
(rb)->written -= (size), \
|
||||
((rb)->read_i = ((rb)->read_i + (size)) % ZB_RING_BUFFER_CAPACITY((rb))) \
|
||||
)
|
||||
|
||||
/**
|
||||
* Move ring buffer's read and write pointers to the specified pos
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param b - new position of read_i buffer's pointer
|
||||
* @param e - new position of write_i buffer's pointer
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_RING_BUFFER_LOCATE(rb, b, e) \
|
||||
( (rb)->read_i = b, \
|
||||
(rb)->write_i = e, \
|
||||
(rb)->written = e - b \
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns number of used entries
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
*/
|
||||
|
||||
#define ZB_RING_BUFFER_USED_SPACE(rb) \
|
||||
( \
|
||||
(rb)->written \
|
||||
)
|
||||
|
||||
#define ZB_RING_BUFFER_SEARCH_GET(_rb, _i) \
|
||||
( \
|
||||
ZB_RING_BUFFER_IS_EMPTY(_rb) ? NULL \
|
||||
: (_rb)->ring_buf + ((_rb)->read_i +(_i)) % ZB_RING_BUFFER_CAPACITY(_rb) \
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* This is a fake type used for type casting.
|
||||
* Represents array of bytes, used for serial trace e.t.c.
|
||||
*
|
||||
* @Example:
|
||||
* @code
|
||||
* ZB_RING_BUFFER_DECLARE(sniffer_io_buffer, zb_uint8_t, 4096);
|
||||
* ...
|
||||
* zb_osif_set_user_io_buffer((zb_byte_array_t*)&gs_sniffer_io_buf, 4096);
|
||||
* @endcode
|
||||
*/
|
||||
ZB_RING_BUFFER_DECLARE(zb_byte_array, zb_uint8_t, 1);
|
||||
|
||||
/**
|
||||
* @see ZB_RING_BUFFER_IS_EMPTY
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_IS_EMPTY(rb) ZB_RING_BUFFER_IS_EMPTY(rb)
|
||||
|
||||
/**
|
||||
* @see ZB_RING_BUFFER_PEEK
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_PEEK(rb) ZB_RING_BUFFER_PEEK(rb)
|
||||
|
||||
/**
|
||||
* Return 1 if ring buffer is full
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param cap - ring buffer capacity (number of bytes)
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_IS_FULL(rb, cap) ((zb_uint_t)(rb)->written >= cap)
|
||||
|
||||
/**
|
||||
* Move ring buffer read pointer.
|
||||
*
|
||||
* To be used after ZB_BYTE_ARRAY_PEEK().
|
||||
* @note This macro does not check for empty ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param cap - ring buffer capacity (number of bytes)
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_FLUSH_GET(rb, cap) \
|
||||
( \
|
||||
(rb)->written--, \
|
||||
((rb)->read_i = ((rb)->read_i + 1U) % (cap)) \
|
||||
)
|
||||
|
||||
/* 10/04/17 CR Ustimenko start */
|
||||
/**
|
||||
* Get entries from the ring buffer read pointer position which can be get at once
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param size - (out) number of entries which can be got
|
||||
* @param cap - ring buffer capacity (number of bytes)
|
||||
*
|
||||
* @return pointer to the ring buffer entry
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_GET_BATCH(rb, size, cap) \
|
||||
( \
|
||||
size = ((rb)->written <= (cap - (rb)->read_i) \
|
||||
? \
|
||||
(rb)->written \
|
||||
: \
|
||||
(cap - (rb)->read_i)), \
|
||||
(rb)->ring_buf + (rb)->read_i \
|
||||
)
|
||||
|
||||
/**
|
||||
* Move ring buffer read pointer for more than 1 element
|
||||
*
|
||||
* This macro does not check for an empty ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param size - number of elements to mark as read
|
||||
* @param cap - ring buffer capacity (number of bytes)
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_FLUSH_GET_BATCH(rb, size, cap) \
|
||||
( \
|
||||
(rb)->written -= size, \
|
||||
((rb)->read_i = ((rb)->read_i + size) % cap) \
|
||||
)
|
||||
/* 10/04/17 CR Ustimenko end */
|
||||
|
||||
/**
|
||||
* Put value to the ring buffer.
|
||||
*
|
||||
* @param rb - ring buffer pointer.
|
||||
* @param value - value to put to ring buffer
|
||||
* @param cap - ring buffer capacity (number of bytes)
|
||||
* @return nothing
|
||||
*/
|
||||
#define ZB_BYTE_ARRAY_PUT(rb, value, cap) \
|
||||
( \
|
||||
(rb)->ring_buf[(rb)->write_i] = (value), \
|
||||
(rb)->written++, \
|
||||
(rb)->write_i = ((rb)->write_i + 1U) % cap \
|
||||
)
|
||||
|
||||
#define ZB_BYTE_ARRAY_PUT_HEAD_RESERVE_IDX(rb, cap) \
|
||||
( \
|
||||
((rb)->read_i > 0U) ? \
|
||||
((rb)->read_i - 1U) : ((cap) - 1U) \
|
||||
)
|
||||
|
||||
#define ZB_BYTE_ARRAY_PUT_HEAD_RESERVE(rb, cap) \
|
||||
( \
|
||||
((rb)->ring_buf + ZB_BYTE_ARRAY_PUT_HEAD_RESERVE_IDX(rb, (cap))) \
|
||||
)
|
||||
|
||||
#define ZB_BYTE_ARRAY_FLUSH_PUT_HEAD(rb, cap) \
|
||||
do \
|
||||
{ \
|
||||
(rb)->written++; \
|
||||
if ((rb)->read_i > 0U) \
|
||||
{ \
|
||||
--((rb)->read_i); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(rb)->read_i = (cap) - 1U; \
|
||||
} \
|
||||
} while(ZB_FALSE)
|
||||
|
||||
#define ZB_BYTE_ARRAY_FLUSH_PUT(rb, cap) \
|
||||
( \
|
||||
(rb)->written++, \
|
||||
(rb)->write_i = ((rb)->write_i + 1U) % (cap) \
|
||||
)
|
||||
|
||||
/*! @} */
|
||||
/*! @endcond */
|
||||
|
||||
#endif /* ZB_RINGBUFFER_H */
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Zigbee scheduler: cooperative multitasking.
|
||||
*/
|
||||
|
||||
#ifndef ZB_SCHEDULER_H
|
||||
#define ZB_SCHEDULER_H 1
|
||||
#include "zboss_api_core.h"
|
||||
#include "zb_osif.h"
|
||||
#include "zb_pooled_list.h"
|
||||
#include "zboss_api_internal.h" /* zb_cb_q_ent_t */
|
||||
|
||||
/*! \addtogroup sched */
|
||||
/*! @{ */
|
||||
|
||||
#include "zb_time.h"
|
||||
#include "zb_ringbuffer.h"
|
||||
|
||||
/*! @cond internals_doc */
|
||||
#define ZB_CB_SCHEDULER_EVENT() ZB_OSIF_SCHEDULER_EVENT()
|
||||
|
||||
#ifdef ZB_INTERRUPT_SAFE_ALARMS
|
||||
#define ZB_ALARM_INT_DISABLE() ZB_OSIF_GLOBAL_LOCK()
|
||||
#define ZB_ALARM_INT_ENABLE() ZB_OSIF_GLOBAL_UNLOCK()
|
||||
#else /* ZB_INTERRUPT_SAFE_ALARMS */
|
||||
#define ZB_ALARM_INT_DISABLE()
|
||||
#define ZB_ALARM_INT_ENABLE()
|
||||
#endif /* ZB_INTERRUPT_SAFE_ALARMS */
|
||||
|
||||
#ifdef ZB_INTERRUPT_SAFE_CALLBACKS
|
||||
#define ZB_CB_INT_DISABLE() ZB_OSIF_GLOBAL_LOCK()
|
||||
#define ZB_CB_INT_ENABLE() ZB_OSIF_GLOBAL_UNLOCK()
|
||||
#else /* ZB_INTERRUPT_SAFE_CALLBACKS */
|
||||
#define ZB_CB_INT_DISABLE()
|
||||
#define ZB_CB_INT_ENABLE()
|
||||
#endif /* ZB_INTERRUPT_SAFE_CALLBACKS */
|
||||
|
||||
/* When running in multithreaded environment, is it possible
|
||||
when a callback is scheduled from another thread.
|
||||
The scheduler itself if thread-safe, so, this is possible.
|
||||
However, if scheduler is sleeping in a main ZBOSS thread now,
|
||||
it should be signalled somehow.
|
||||
In this case there is a zb_scheduler_wakeup() routine shall be defined.
|
||||
Since it is a platform-specific item, it shall be defined in OSIF */
|
||||
#if defined(ZB_THREADS) && !defined(ZB_SCHEDULER_NO_AUTOWAKEUP)
|
||||
#define ZB_SCHEDULER_WAKEUP() zb_scheduler_wakeup()
|
||||
#else
|
||||
#define ZB_SCHEDULER_WAKEUP()
|
||||
#endif
|
||||
|
||||
#if defined ZB_NWK_STOCHASTIC_ADDRESS_ASSIGN && defined ZB_ROUTER_ROLE /* Zigbee pro */
|
||||
|
||||
/**
|
||||
Callback function typedef.
|
||||
Callback is function planned to execute by another function.
|
||||
@note The callback must be declared as reentrant for dscc.
|
||||
|
||||
@param param - callback parameter equals schedule record param fields
|
||||
@param param2 - callback parameter contains test value
|
||||
|
||||
@return is equal.
|
||||
*/
|
||||
typedef zb_bool_t (ZB_CODE * zb_callback_compare_t)(zb_uint8_t param, void* param2);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ZB_PRO_ADDRESS_ASSIGNMENT_CB
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Callback function typedef.
|
||||
Callback is function planned to execute by another function.
|
||||
@note The callback must be declared as reentrant for dscc.
|
||||
|
||||
@param param - callback parameter equals schedule record param fields
|
||||
@return short address for joining device, or -1 (0xFFFF) which means using the internal mechanisms of addresses assignment
|
||||
*/
|
||||
typedef zb_uint16_t (ZB_CODE * zb_addr_assignment_cb_t)(zb_ieee_addr_t ieee_addr);
|
||||
|
||||
/*! @cond internals_doc */
|
||||
#endif
|
||||
|
||||
/* zb_cb_q_ent_t moved to zboss_api_internal.h */
|
||||
|
||||
#define ZB_SCHEDULER_SET_2PARAM_CB(i) (ZG->sched.cb_flag_bm[(i)/32U] |= (1UL << ((i)%32U)))
|
||||
#define ZB_SCHEDULER_RESET_2PARAM_CB(i) (ZG->sched.cb_flag_bm[(i)/32U] &= ~(1UL << ((i)%32U)))
|
||||
#define ZB_SCHEDULER_IS_2PARAM_CB(i) (ZG->sched.cb_flag_bm[(i)/32U] & (1UL << ((i)%32U)))
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_mac_cb_ent_s
|
||||
{
|
||||
zb_callback_t func; /* currently, it is the same as common queue, */
|
||||
zb_uint8_t param; /* but, possibly, it is better to remove param from it */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_mac_cb_ent_t;
|
||||
|
||||
/* zb_tm_q_ent_t moved to zboss_api_core.h */
|
||||
|
||||
/**
|
||||
Immediate pending callbacks queue (ring buffer)
|
||||
*/
|
||||
#ifndef ZB_CONFIGURABLE_MEM
|
||||
ZB_RING_BUFFER_DECLARE(zb_cb_q, zb_cb_q_ent_t, ZB_SCHEDULER_Q_SIZE);
|
||||
#else
|
||||
/* declare a header and 1 entry */
|
||||
ZB_RING_BUFFER_DECLARE(zb_cb_q, zb_cb_q_ent_t, 1);
|
||||
#endif
|
||||
/* Mac "clear to tx" queue. */
|
||||
ZB_RING_BUFFER_DECLARE(zb_mac_tx_q, zb_mac_cb_ent_t, ZB_MAC_QUEUE_SIZE);
|
||||
|
||||
/* Ring buffer for storing callbacks waiting for delayed buffers */
|
||||
ZB_RING_BUFFER_DECLARE(zb_delayed_cb_q, zb_delayed_buf_q_ent_t, ZB_BUF_Q_SIZE);
|
||||
|
||||
/**
|
||||
Data structures for the delayed execution.
|
||||
*/
|
||||
|
||||
typedef void (ZB_CODE * zb_zdo_sleep_ind_cb_t)(zb_uint32_t sleep_tmo);
|
||||
|
||||
typedef zb_bool_t (* zb_sched_stopping_cb_checker_t)(zb_callback_t cb);
|
||||
|
||||
typedef struct zb_sched_globals_s
|
||||
{
|
||||
#ifndef ZB_CONFIGURABLE_MEM
|
||||
zb_cb_q_t cb_q; /*!< immediate callbacks queue */
|
||||
#define ZB_CB_Q (&ZG->sched.cb_q)
|
||||
zb_uint32_t cb_flag_bm[(ZB_SCHEDULER_Q_SIZE + 31U)/32U];
|
||||
#else
|
||||
zb_cb_q_t *cb_q;
|
||||
#define ZB_CB_Q (ZG->sched.cb_q)
|
||||
zb_uint32_t *cb_flag_bm;
|
||||
#endif
|
||||
#ifndef ZB_ALIEN_SCHEDULER
|
||||
zb_mac_tx_q_t mac_tx_q; /* queue of callback's waiting for tx */
|
||||
#endif
|
||||
#if defined( ENABLE_USB_SERIAL_IMITATOR )
|
||||
zb_callback_t usbc_rx_cb; /*!< Callback to be called on USB data presence. */
|
||||
#endif /* defined( ENABLE_USB_SERIAL_IMITATOR ) */
|
||||
#ifndef ZB_CONFIGURABLE_MEM
|
||||
zb_tm_q_ent_t tm_buffer[ZB_SCHEDULER_Q_SIZE]; /*!< buffer for the timer queue entries */
|
||||
#else
|
||||
zb_tm_q_ent_t *tm_buffer;
|
||||
#endif
|
||||
/* Use list macros for indexed lists and use byte instead pointer here. */
|
||||
ZB_POOLED_LIST8_DEFINE(tm_queue); /*!< delayed callbacks queue */
|
||||
ZB_POOLED_LIST8_DEFINE(tm_freelist); /*!< freelist of the timer queue entries */
|
||||
zb_delayed_cb_q_t delayed_queue[2]; /*!< queue to store delayed callbacks for getting in and out buffers (@ref buffer_types)*/
|
||||
zb_uint8_t tm_buffer_usage; /*!< Usage of timer queue */
|
||||
zb_bool_t stop;
|
||||
zb_bool_t stopping;
|
||||
zb_sched_stopping_cb_checker_t stopping_cb_checker;
|
||||
} zb_sched_globals_t;
|
||||
|
||||
/**
|
||||
Initialize scheduler subsystem.
|
||||
*/
|
||||
void zb_sched_init(void);
|
||||
|
||||
/**
|
||||
* Stop scheduler subsystem.
|
||||
*/
|
||||
void zb_sched_stop(void);
|
||||
|
||||
/**
|
||||
Call all callbacks.
|
||||
All cooperative multitasking done here.
|
||||
|
||||
Call all callbacks from the queue. Callbacks can schedule other callbacks, so
|
||||
potentially stay here infinite.
|
||||
In practice at some point callbacks ring buffer became empty.
|
||||
Put device into asleep waiting for interrupts (8051) or wait for data from
|
||||
other source (Linux).
|
||||
|
||||
This function usually placed into main loop.
|
||||
|
||||
This function MUST be reentrant in Keil: must not share its xdata segment with
|
||||
functions called from it by pointers.
|
||||
|
||||
@return none
|
||||
|
||||
See sched sample
|
||||
*/
|
||||
void zb_sched_loop_iteration(void);
|
||||
|
||||
#ifndef ZB_ALIEN_SCHEDULER
|
||||
/* Schedules a callback, that requires NORMAL_FIFO for transfer or security operations,
|
||||
it will be called after current tx finished or just during next scheduler loop */
|
||||
#define ZB_SCHEDULE_TX_CB(func, param) zb_schedule_tx_cb(func, param, 0)
|
||||
#define ZB_SCHEDULE_TX_CB_WITH_HIGH_PRIORITY(func, param) zb_schedule_tx_cb(func, param, 1)
|
||||
#else
|
||||
|
||||
#define ZB_SCHEDULE_TX_CB ZB_SCHEDULE_CALLBACK
|
||||
#endif
|
||||
|
||||
#if defined ZB_TRACE_LEVEL && defined ZB_TRACE_MASK
|
||||
void zb_scheduler_trace_file_line(zb_uint32_t file_id, zb_uint32_t line_number, zb_callback_t func);
|
||||
#endif /* ZB_TRACE_LEVEL && ZB_TRACE_MASK */
|
||||
|
||||
#if defined ZB_NWK_STOCHASTIC_ADDRESS_ASSIGN && defined ZB_ROUTER_ROLE /* Zigbee pro */
|
||||
|
||||
#ifndef ZB_MINIMAL_CONTEXT
|
||||
/**
|
||||
Cancel scheduled alarm with test by custom compare function.
|
||||
|
||||
This function cancel previously scheduled alarm. Function is identified by
|
||||
the pointer. Parameter is identified by compare func (comp) and default parameter (param).
|
||||
|
||||
Record (rec) if found if rec.func==func and comp(rec.param, param)=true
|
||||
|
||||
@param func - function to cancel
|
||||
@param comp - custom comparer
|
||||
@param param - default parameter for comparer
|
||||
@return param of scheduled function or 0 if not found.
|
||||
*/
|
||||
zb_uint8_t zb_schedule_alarm_cancel_compare(zb_callback_t func, zb_callback_compare_t comp, void* param);
|
||||
#endif /* !ZB_MINIMAL_CONTEXT */
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
Return true if scheduler has any pending callbacks
|
||||
*/
|
||||
#define ZB_SCHED_HAS_PENDING_CALLBACKS() !ZB_RING_BUFFER_IS_EMPTY(&ZG->sched.cb_q)
|
||||
|
||||
|
||||
/**
|
||||
Wait (block, go idle) until condition will not be true.
|
||||
|
||||
@param condition - condition to check for
|
||||
*/
|
||||
#define ZB_SCHED_WAIT_COND(condition) \
|
||||
do \
|
||||
{ \
|
||||
ZB_SCHED_GLOBAL_LOCK(); \
|
||||
while ( !(condition) ) \
|
||||
{ \
|
||||
ZB_SCHED_GLOBAL_UNLOCK(); \
|
||||
ZB_GO_IDLE(); \
|
||||
ZB_SCHED_GLOBAL_LOCK(); \
|
||||
} \
|
||||
ZB_SCHED_GLOBAL_UNLOCK(); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
|
||||
/**
|
||||
Global lock operation
|
||||
Protect manipulation with queues in the main loop by this macro.
|
||||
It disables interrupts on 8051 device and locks mutex in Linux.
|
||||
*/
|
||||
#define ZB_SCHED_GLOBAL_LOCK ZB_OSIF_GLOBAL_LOCK
|
||||
|
||||
|
||||
/**
|
||||
Global unlock operation
|
||||
Protect manipulation with queues by this macro.
|
||||
It enables interrupts on 8051 device and unlocks mutex in Linux.
|
||||
*/
|
||||
#define ZB_SCHED_GLOBAL_UNLOCK ZB_OSIF_GLOBAL_UNLOCK
|
||||
|
||||
/**
|
||||
Global lock operation - call from the interrupt handler
|
||||
|
||||
@return RET_OK if success, RET_BUSY if locked by userspace
|
||||
*/
|
||||
#define ZB_SCHED_GLOBAL_LOCK_INT() ZB_OSIF_GLOBAL_LOCK_INT
|
||||
|
||||
/**
|
||||
Global unlock operation - call from the interrupt handler
|
||||
*/
|
||||
#define ZB_SCHED_GLOBAL_UNLOCK_INT() ZB_OSIF_GLOBAL_UNLOCK_INT
|
||||
|
||||
#ifndef ZB_MINIMAL_CONTEXT
|
||||
/**
|
||||
* @brief Schedules a callback, that requires NORMAL_FIFO for transfer or security operations, it
|
||||
* will be called after current tx finished or just during next scheduler loop.
|
||||
* @param func - callback function.
|
||||
* @param param - parameter for callback.
|
||||
* @returns schedule status.
|
||||
*/
|
||||
zb_ret_t zb_schedule_tx_cb(zb_callback_t func, zb_uint8_t param, zb_uint8_t prior);
|
||||
#endif /* !ZB_MINIMAL_CONTEXT */
|
||||
|
||||
|
||||
/**
|
||||
Set a callback to be called when USB serial data is available.
|
||||
|
||||
Callback is called with param 0.
|
||||
To actually read serial data, call @ref usbc_serial_data_rx.
|
||||
This function could be called, for example, after successful join.
|
||||
|
||||
|
||||
@param usbc_rx_cb - callback to be called. If NULL, effectively
|
||||
unregister USB rx callback.
|
||||
*/
|
||||
void zb_sched_register_usbc_rx_cb(zb_callback_t usbc_rx_cb);
|
||||
|
||||
#ifdef ZB_LWIP
|
||||
/**
|
||||
Set a callback to be called when ethernet data is available.
|
||||
*/
|
||||
void zb_sched_register_ethernet_cb(zb_callback_t usbc_rx_cb);
|
||||
#endif /* ZB_LWIP */
|
||||
|
||||
#define ZB_SCHED_TX_CB_HIGH_PRIOR_RESERVE 1U
|
||||
|
||||
/**
|
||||
Schedule callback from another thread
|
||||
|
||||
* @param func - callback function.
|
||||
* @param param - parameter for callback.
|
||||
*/
|
||||
void zb_schedule_callback_from_alien(zb_callback_t func, zb_uint8_t param);
|
||||
|
||||
#ifdef ZB_DEBUG_BUFFERS_EXT
|
||||
void zb_schedule_trace_queue();
|
||||
#define ZB_SCHEDULE_TRACE_QUEUE() zb_schedule_trace_queue()
|
||||
#else
|
||||
#define ZB_SCHEDULE_TRACE_QUEUE()
|
||||
#endif
|
||||
|
||||
zb_ret_t zb_schedule_callback(zb_callback_t func, zb_uint8_t param);
|
||||
|
||||
/**
|
||||
Schedule single-param callback execution.
|
||||
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
The return was intentionally suppressed to avoid MISRA 17.7 violation.
|
||||
If its return is needed the API should be called directly
|
||||
|
||||
@param func - function to execute
|
||||
@param param - callback parameter - usually, but not always ref to packet buffer
|
||||
|
||||
See sched sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_CALLBACK(func, param) (void)zb_schedule_callback(func, param)
|
||||
|
||||
zb_ret_t zb_schedule_callback2(zb_callback2_t func, zb_uint8_t param, zb_uint16_t user_param);
|
||||
|
||||
/**
|
||||
Schedule two-param callback execution.
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
The return was intentionally suppressed to avoid MISRA 17.7 violation.
|
||||
If its return is needed the API should be called directly
|
||||
|
||||
@param func - function to execute
|
||||
@param param - zb_uint8_t callback parameter - usually, but not always ref to
|
||||
packet buffer
|
||||
@param user_param - zb_uint16_t user parameter - usually, but not
|
||||
always short address
|
||||
|
||||
See sched sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_CALLBACK2(func, param, user_param) (void)zb_schedule_callback2(func, param, user_param)
|
||||
|
||||
zb_ret_t zb_schedule_callback_prior(zb_callback_t func, zb_uint8_t param);
|
||||
|
||||
/**
|
||||
Schedule single-param high priority callback execution.
|
||||
|
||||
Schedule high priority execution of function `func' in the main scheduler loop.
|
||||
|
||||
The return was intentionally suppressed to avoid MISRA 17.7 violation.
|
||||
If its return is needed the API should be called directly
|
||||
|
||||
@param func - function to execute
|
||||
@param param - callback parameter - usually, but not always ref to packet buffer
|
||||
|
||||
See sched sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_CALLBACK_PRIOR(func, param) (void)zb_schedule_callback_prior(func, param)
|
||||
|
||||
zb_ret_t zb_schedule_alarm(zb_callback_t func, zb_uint8_t param, zb_time_t timeout_bi);
|
||||
|
||||
/**
|
||||
Schedule alarm - callback to be executed after timeout.
|
||||
|
||||
Function will be called via scheduler after timeout expired (maybe, plus some
|
||||
additional time).
|
||||
Timer resolution depends on implementation.
|
||||
Same callback can be scheduled for execution more then once.
|
||||
|
||||
The return was intentionally suppressed to avoid MISRA 17.7 violation.
|
||||
If its return is needed the API should be called directly
|
||||
|
||||
@param func - function to call via scheduler
|
||||
@param param - parameter to pass to the function
|
||||
@param timeout_bi - timeout, in beacon intervals
|
||||
|
||||
See any sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_ALARM(func, param, timeout_bi) (void)zb_schedule_alarm(func, param, timeout_bi)
|
||||
|
||||
/**
|
||||
Cancel scheduled alarm.
|
||||
|
||||
This function cancel previously scheduled alarm. Function is identified by
|
||||
the pointer.
|
||||
|
||||
@param func - function to cancel
|
||||
@param param - parameter to cancel. \see ZB_ALARM_ANY_PARAM. \see ZB_ALARM_ALL_CB
|
||||
@return RET_OK or error code
|
||||
|
||||
See reporting_srv sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_ALARM_CANCEL(func, param) (void)zb_schedule_alarm_cancel((func), (param), NULL)
|
||||
|
||||
/**
|
||||
Cancel scheduled alarm and get buffer.
|
||||
|
||||
This function cancel previously scheduled alarm and returns buffer ref associated with alarm.
|
||||
Function is identified by the pointer.
|
||||
|
||||
@param func - function to cancel
|
||||
@param param - parameter to cancel. \see ZB_ALARM_ANY_PARAM. \see ZB_ALARM_ALL_CB
|
||||
@param p_param - [out] pointer of ref buffer from cancelled flag: free buffer if its alarm will be cancel
|
||||
@return RET_OK or error code
|
||||
|
||||
@b Example:
|
||||
@code
|
||||
{
|
||||
zb_uint8_t cancelled_param;
|
||||
|
||||
ZB_SCHEDULE_ALARM_CANCEL_AND_GET_BUF(my_func1, ZB_ALARM_ANY_PARAM, &cancelled_param);
|
||||
my_func1(cancelled_param);
|
||||
}
|
||||
@endcode
|
||||
|
||||
See reporting_srv sample
|
||||
*/
|
||||
#define ZB_SCHEDULE_ALARM_CANCEL_AND_GET_BUF(func, param, p_param) (void)zb_schedule_alarm_cancel((func), (param), (p_param))
|
||||
|
||||
|
||||
/**
|
||||
Start ZBOSS shutdown procedure in the scheduler.
|
||||
|
||||
Drop all callbacks and alarms, disable alarms planning - but keep callbacks
|
||||
planning and scheduler working.
|
||||
That is necessary to complete MAC reset at shut.
|
||||
*/
|
||||
void zb_scheduler_start_shutting(void);
|
||||
|
||||
void zb_scheduler_set_cb_checker(zb_sched_stopping_cb_checker_t checker);
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
/*! @} */
|
||||
|
||||
|
||||
#endif /* ZB_SCHEDULER_H */
|
||||
160
managed_components/espressif__esp-zboss-lib/include/zb_time.h
Normal file
160
managed_components/espressif__esp-zboss-lib/include/zb_time.h
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Common definitions for time functionality
|
||||
*/
|
||||
|
||||
#ifndef ZB_TIME_H
|
||||
#define ZB_TIME_H 1
|
||||
|
||||
#include "zboss_api_core.h"
|
||||
|
||||
|
||||
/*! @cond internals_doc */
|
||||
/*! \addtogroup time */
|
||||
/*! @{ */
|
||||
|
||||
#define ZB_HALF_MAX_TIME32_VAL (ZB_UINT32_MAX / 2U)
|
||||
|
||||
/**
|
||||
Time subtraction: subtract 'b' from 'a'for 32bit-time
|
||||
|
||||
Take overflow into account: change sign (subtraction order) if result >
|
||||
values_diapason/2.
|
||||
Suppose a always >= b, so result is never negative.
|
||||
This macro will be used to calculate, for example, amount of time to sleep
|
||||
- it is positive by definition.
|
||||
Do not use it to compare time values! Use ZB_TIME32_GE() instead.
|
||||
@note Both a and b is of type @ref zb_time_t. Can't decrease time (subtract
|
||||
constant from it) using this macro.
|
||||
|
||||
@param a - time to subtract from
|
||||
@param b - time to subtract
|
||||
@return subtraction result
|
||||
*/
|
||||
#define ZB_TIME32_SUBTRACT(a, b) ((zb_uint32_t)((a) - (b)) < ZB_HALF_MAX_TIME32_VAL ? (zb_uint32_t)((a) - (b)) : (zb_uint32_t)((b) - (a)))
|
||||
|
||||
/**
|
||||
Time add: add 'a' to 'b' for 32-bit time
|
||||
|
||||
Overflow is possible, but this is ok - it handled by subtraction and compare macros.
|
||||
|
||||
@param a - time to add to
|
||||
@param b - value to add
|
||||
@return addition result
|
||||
*/
|
||||
#define ZB_TIME32_ADD(a, b) (zb_uint32_t)((a) + (b))
|
||||
|
||||
/**
|
||||
Compare times a and b - check that a >= b for 32-bit time
|
||||
|
||||
Taking into account overflow and unsigned values arithmetic and supposing
|
||||
difference between a and b can't be > 1/2 of the overall time values
|
||||
diapason,
|
||||
a >= b only if a - b < values_diapason/2
|
||||
|
||||
@param a - first time value to compare
|
||||
@param b - second time value to compare
|
||||
@return 1 is a >= b, 0 otherwise
|
||||
*/
|
||||
#define ZB_TIME32_GE(a, b) ((zb_uint32_t)((a) - (b)) < ZB_HALF_MAX_TIME32_VAL)
|
||||
|
||||
#ifndef ZB_ALIEN_TIMER
|
||||
/**
|
||||
Start timer - assign time to sleep
|
||||
|
||||
@param timeout - time in internal format to sleep before delayed callback run
|
||||
*/
|
||||
void zb_timer_start(zb_time_t timeout);
|
||||
|
||||
/**
|
||||
Stop timer - timer stop and callback not run
|
||||
*/
|
||||
void zb_timer_stop(void);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
Timer internals
|
||||
|
||||
'timer' always ticks (if some timer is started), usually with overflow.
|
||||
Timer unit is beacon interval, for every system.
|
||||
*/
|
||||
typedef struct zb_timer_s
|
||||
{
|
||||
zb_time_t timer; /*!< current time, measured in beacon intervals */
|
||||
|
||||
#ifndef ZB_ALIEN_TIMER
|
||||
zb_uint32_t sleep_tmo_remainder_ms; /*!< slept time remainder, used for timer corrections */
|
||||
zb_time_t timer_stop; /*!< time to stop timer (disable timer interrupts etc) */
|
||||
zb_bool_t started; /*!< flag - timer is started */
|
||||
zb_bool_t canstop; /*!< flag - Can the timer be stopped? */
|
||||
#endif
|
||||
}
|
||||
zb_timer_t;
|
||||
|
||||
/**
|
||||
Enable ability to stop times saving power.
|
||||
|
||||
Might be used for ZED. Not sure will use it for now.
|
||||
*/
|
||||
void zb_timer_enable_stop(void);
|
||||
|
||||
/**
|
||||
Disable ability to stop times saving power.
|
||||
*/
|
||||
void zb_timer_disable_stop(void);
|
||||
|
||||
/**
|
||||
Get current transceiver time value in usec
|
||||
*/
|
||||
zb_time_t osif_transceiver_time_get(void);
|
||||
|
||||
/**
|
||||
Sleep for required interval using transceiver timer.
|
||||
|
||||
Can be implemented as a busy wait or as a real sleep.
|
||||
|
||||
@param interval - time to sleep in microseconds
|
||||
*/
|
||||
void osif_sleep_using_transc_timer(zb_time_t interval);
|
||||
|
||||
|
||||
/*! @} */
|
||||
/*! @endcond */
|
||||
|
||||
#endif /* ZB_TIME_H */
|
||||
1310
managed_components/espressif__esp-zboss-lib/include/zb_trace.h
Normal file
1310
managed_components/espressif__esp-zboss-lib/include/zb_trace.h
Normal file
File diff suppressed because it is too large
Load Diff
1609
managed_components/espressif__esp-zboss-lib/include/zb_types.h
Normal file
1609
managed_components/espressif__esp-zboss-lib/include/zb_types.h
Normal file
File diff suppressed because it is too large
Load Diff
114
managed_components/espressif__esp-zboss-lib/include/zb_vendor.h
Normal file
114
managed_components/espressif__esp-zboss-lib/include/zb_vendor.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#if CONFIG_ZB_ZCZR || CONFIG_ZB_ZED
|
||||
#include "zb_vendor_default.h"
|
||||
#elif CONFIG_ZB_ZGPD
|
||||
#include "zb_vendor_zgpd.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ZB_R22_ENABLE
|
||||
#define ZB_ENABLE_SE
|
||||
#define ZB_ENABLE_ZGP
|
||||
#endif
|
||||
|
||||
#define ZB_CONFIG_ESP
|
||||
|
||||
/* use assert in ZBOSS */
|
||||
#define USE_ASSERT
|
||||
/* Using for ZBOSS assert and change ZBOSS assert logic*/
|
||||
#define ESP_ZB_USE_ASSERT
|
||||
|
||||
/* ESP Zigbee Trace Log */
|
||||
#if defined CONFIG_ESP_ZB_TRACE_ENABLE
|
||||
/* ZBOSS TRACE LOG is controlled by TRACE_ENABLED and TRACE_MSG.
|
||||
* - TRACE_ENABLED determines which logs are compiled into the binary and available for
|
||||
* printing at runtime.
|
||||
* - TRACE_MSG enables logs to be printed according to the configured ZB_TRACE_LEVEL
|
||||
* and ZB_TRACE_MASK at runtime.
|
||||
*/
|
||||
#define TRACE_ENABLED(m) (true)
|
||||
#define ZB_BINARY_TRACE
|
||||
#define ZB_BINARY_AND_TEXT_TRACE_MODE
|
||||
#define ZB_TRACE_TO_PORT
|
||||
#define ZB_TRACE_FROM_INTR
|
||||
#define ZB_TRAFFIC_DUMP_ON
|
||||
#define ZB_TRACE_LEVEL CONFIG_ZB_TRACE_LEVEL
|
||||
#define ZB_TRACE_MASK CONFIG_ZB_TRACE_MASK
|
||||
|
||||
/* Trace JTAG */
|
||||
#ifndef ZB_TRACE_OVER_JTAG
|
||||
#define ZB_TRACE_OVER_USART
|
||||
#endif /* ZB_TRACE_OVER_JTAG */
|
||||
|
||||
/* Trace USART */
|
||||
#if defined ZB_TRACE_OVER_USART
|
||||
#define ZB_SERIAL_FOR_TRACE
|
||||
#endif /* ZB_TRACE_OVER_USART */
|
||||
#endif /* CONFIG_ESP_ZB_TRACE_ENABLE */
|
||||
|
||||
#define ZB_HAVE_SERIAL
|
||||
#define ZB_HAVE_SERIAL_SINGLE
|
||||
|
||||
/* Macsplit SoC does not use prod cfg indeed, but that define is necessary for constants definition */
|
||||
#define ZB_PRODUCTION_CONFIG
|
||||
#define ZB_PROMISCUOUS_MODE
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
#if defined ZB_SUBGHZ_ONLY_MODE || defined ZB_R22_MULTIMAC_MODE
|
||||
#define ZB_MAC_QUEUE_SIZE 15U
|
||||
#else
|
||||
#define ZB_MAC_QUEUE_SIZE 10U
|
||||
#endif
|
||||
|
||||
/* The time allotted for adding route information using frame data at the beginning (beacon interval units) */
|
||||
#define ZB_NWK_AGGRESSIVE_ROUTE_ADD_TIME 10U
|
||||
|
||||
/* Memory configuration */
|
||||
#define ZB_CONFIGURABLE_MEM
|
||||
|
||||
/* Bind translation */
|
||||
#define ZB_BIND_TRANS_PARALLEL
|
||||
|
||||
/* Disable Children count feature */
|
||||
#define ZB_NO_COUNT_CHILDREN
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Number of buttons supported */
|
||||
#define ZB_N_BUTTONS 5
|
||||
#define ZB_ENABLE_HA
|
||||
#define ZB_ENABLE_ZCL
|
||||
#define ZB_TEST_PROFILE
|
||||
/* Enable Rejoin Backoff (used in Smart Plug and IAS Zone samples). */
|
||||
#define ZB_REJOIN_BACKOFF
|
||||
#define ZB_USE_SLEEP
|
||||
#define ZB_CERTIFICATION_HACKS /*Special modes for testing see zb_config.h*/
|
||||
#ifdef ZB_USE_SLEEP
|
||||
#define ZB_MEMORY_COMPACT
|
||||
#endif
|
||||
|
||||
/* ZB3.0 BDB mode */
|
||||
#define ZB_BDB_MODE
|
||||
#define ZB_BDB_ENABLE_FINDING_BINDING
|
||||
#define ZB_DISTRIBUTED_SECURITY_ON
|
||||
#define ZB_SECURITY_INSTALLCODES
|
||||
|
||||
/* ZGP */
|
||||
#ifdef CONFIG_ZB_GP_ENABLED
|
||||
#define ZB_ENABLE_ZGP
|
||||
#define ZB_ENABLE_ZGP_COMBO
|
||||
#define ZB_ENABLE_ZGP_GPCB
|
||||
#define ZB_ZGP_SINK_TBL_SIZE 10
|
||||
// #define ZB_ZGP_SIMPLE_COMBO_START_AS_ZR
|
||||
#define ZB_ZGP_TRANSL_CMD_PLD_MAX_SIZE 3
|
||||
#define ZGP_CLUSTER_TEST
|
||||
#define ZB_ZGP_SKIP_GPDF_ON_NWK_LAYER
|
||||
#define ZB_ZGP_RUNTIME_WORK_MODE_WITH_PROXIES
|
||||
#define ZB_ZGP_PROXY_TBL_SIZE 8
|
||||
#endif /* CONFIG_ZB_GP_ENABLED */
|
||||
|
||||
/* Device support */
|
||||
#define ZB_ALL_DEVICE_SUPPORT
|
||||
|
||||
/* OOM detection */
|
||||
#define ZB_CHECK_OOM_STATUS
|
||||
#define ZB_SEND_OOM_STATUS
|
||||
|
||||
#define ZB_NO_NVRAM_VER_MIGRATION
|
||||
|
||||
#define ZB_LIMIT_VISIBILITY
|
||||
|
||||
#define ZB_TEST_GROUP_ZCP_R22_APS
|
||||
#define ZB_TEST_GROUP_ZCP_R22_BDB
|
||||
#define ZB_TEST_GROUP_ZCP_R22_NWK
|
||||
#define ZB_TEST_GROUP_ZCP_R22_PED
|
||||
#define ZB_TEST_GROUP_ZCP_R22_PRO
|
||||
#define ZB_TEST_GROUP_ZCP_R22_R20
|
||||
#define ZB_TEST_GROUP_ZCP_R22_R21
|
||||
#define ZB_TEST_GROUP_ZCP_R22_R22
|
||||
#define ZB_TEST_GROUP_ZCP_R22_SEC
|
||||
#define ZB_TEST_GROUP_ZCP_R22_ZDO
|
||||
|
||||
#ifdef CONFIG_ZB_ZCZR
|
||||
#define ZB_COORDINATOR_ROLE
|
||||
#define ZB_ROUTER_ROLE
|
||||
#else
|
||||
#define ZB_ED_ROLE
|
||||
#define ZB_ED_FUNC
|
||||
#endif
|
||||
|
||||
/* APS GROUP TABLE SIZE */
|
||||
#ifndef ZB_ED_ROLE
|
||||
#define ZB_APS_GROUP_TABLE_SIZE 32
|
||||
#define ZB_APS_ENDPOINTS_IN_GROUP_TABLE 64U
|
||||
#else
|
||||
#define ZB_APS_GROUP_TABLE_SIZE 32
|
||||
#define ZB_APS_ENDPOINTS_IN_GROUP_TABLE 64U
|
||||
#endif
|
||||
#define ZB_MULTITEST_CONSOLE_SLEEP_TIMEOUT 1000000
|
||||
|
||||
/* TRACE FILE ID NO NEED */
|
||||
#define ZB_DONT_NEED_TRACE_FILE_ID
|
||||
|
||||
/* Support Max Endpoint Number */
|
||||
#define ZB_MAX_EP_NUMBER 64U
|
||||
|
||||
/* Interrupt Safe */
|
||||
#define ZB_INTERRUPT_SAFE_ALARMS
|
||||
#define ZB_INTERRUPT_SAFE_CALLBACKS
|
||||
|
||||
/* Touchlink */
|
||||
#define ZB_BDB_TOUCHLINK
|
||||
#ifdef ZB_BDB_TOUCHLINK
|
||||
#define ZB_ENABLE_ZLL
|
||||
#define ZB_ENABLE_INTER_PAN_EXCHANGE
|
||||
#endif // ZB_BDB_TOUCHLINK
|
||||
/* Add dependency to the Inter-Pan exchange */
|
||||
#ifdef ZB_ENABLE_INTER_PAN_NON_DEFAULT_CHANNEL
|
||||
#ifndef ZB_ENABLE_INTER_PAN_EXCHANGE
|
||||
#define ZB_ENABLE_INTER_PAN_EXCHANGE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable APS Fragmentation */
|
||||
#define APS_FRAGMENTATION
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Number of buttons supported */
|
||||
#define ZB_ENABLE_HA
|
||||
#define ZB_ENABLE_ZCL
|
||||
#define ZB_TEST_PROFILE
|
||||
/* Enable Rejoin Backoff (used in Smart Plug and IAS Zone samples). */
|
||||
#define ZB_REJOIN_BACKOFF
|
||||
#define ZB_USE_SLEEP
|
||||
#define ZB_CERTIFICATION_HACKS /*Special modes for testing see zb_config.h*/
|
||||
#ifdef ZB_USE_SLEEP
|
||||
#define ZB_MEMORY_COMPACT
|
||||
#endif
|
||||
|
||||
/* ZB3.0 BDB mode */
|
||||
#define ZB_BDB_MODE
|
||||
#define ZB_BDB_ENABLE_FINDING_BINDING
|
||||
#define ZB_DISTRIBUTED_SECURITY_ON
|
||||
#define ZB_SECURITY_INSTALLCODES
|
||||
|
||||
/* ZGP */
|
||||
#define ZB_ENABLE_ZGP
|
||||
#define ZB_ENABLE_ZGP_GPCB
|
||||
#define ZB_ZGP_TRANSL_CMD_PLD_MAX_SIZE 3
|
||||
#define ZGP_CLUSTER_TEST
|
||||
#define ZB_ZGP_SKIP_GPDF_ON_NWK_LAYER
|
||||
#define ZB_ZGP_RUNTIME_WORK_MODE_WITH_PROXIES
|
||||
#define ZB_ZGP_SINK_TBL_SIZE 10
|
||||
#define ZB_ZGP_PROXY_TBL_SIZE 4
|
||||
|
||||
/* Device support */
|
||||
#define ZB_ALL_DEVICE_SUPPORT
|
||||
|
||||
/* OOM detection */
|
||||
#define ZB_CHECK_OOM_STATUS
|
||||
#define ZB_SEND_OOM_STATUS
|
||||
|
||||
#define ZB_NO_NVRAM_VER_MIGRATION
|
||||
|
||||
#define ZB_LIMIT_VISIBILITY
|
||||
|
||||
#define ZB_ZGPD_ROLE
|
||||
|
||||
/* TRACE FILE ID NO NEED */
|
||||
#define ZB_DONT_NEED_TRACE_FILE_ID
|
||||
|
||||
/* ZGP configuration */
|
||||
#define ZB_ZGP_MAX_PAIRED_CONF_CLUSTERS 2
|
||||
#define ZB_ZGP_MAX_PAIRED_CONF_GPD_COMMANDS 6
|
||||
#define ZB_ZGP_APP_DESCR_REPORT_DATA_SIZE 32
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS version declare
|
||||
*/
|
||||
|
||||
#ifndef ZB_VERSION_H
|
||||
#define ZB_VERSION_H 1
|
||||
|
||||
/*
|
||||
ZBOSS Core version: A.B.C
|
||||
<A> - ZBOSS_MAJOR (defines ZBOSS core version)
|
||||
<B> - ZBOSS_MINOR (defines ZBOSS core version)
|
||||
<C> - ZBOSS SDK revision
|
||||
*/
|
||||
|
||||
#ifndef ZBOSS_MAJOR
|
||||
#define ZBOSS_MAJOR 3U
|
||||
#endif
|
||||
|
||||
#ifndef ZBOSS_MINOR
|
||||
#define ZBOSS_MINOR 15U
|
||||
#endif
|
||||
|
||||
#endif /* ZB_VERSION_H */
|
||||
1915
managed_components/espressif__esp-zboss-lib/include/zboss_api.h
Normal file
1915
managed_components/espressif__esp-zboss-lib/include/zboss_api.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,783 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS AF API
|
||||
*/
|
||||
|
||||
#ifndef ZBOSS_API_AF_H
|
||||
#define ZBOSS_API_AF_H 1
|
||||
|
||||
/**
|
||||
* @addtogroup af_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup af_data_service AF data service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
Node descriptor
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_af_node_desc_s
|
||||
{
|
||||
zb_uint16_t node_desc_flags; /*!< node description */
|
||||
zb_uint8_t mac_capability_flags; /*!< mac capability */
|
||||
zb_uint16_t manufacturer_code; /*!< Manufacturer code */
|
||||
zb_uint8_t max_buf_size; /*!< Maximum buffer size */
|
||||
zb_uint16_t max_incoming_transfer_size; /*!< Maximum incoming transfer size */
|
||||
zb_uint16_t server_mask; /*!< Server mask */
|
||||
zb_uint16_t max_outgoing_transfer_size; /*!< Maximum outgoing transfer size */
|
||||
zb_uint8_t desc_capability_field; /*!< Descriptor capability field */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_af_node_desc_t;
|
||||
|
||||
typedef zb_nwk_device_type_t zb_logical_type_t;
|
||||
|
||||
/** @} */ /* af_data_service */
|
||||
|
||||
/**
|
||||
* @addtogroup af_node_desc_dev_types AF device types
|
||||
* @{
|
||||
*/
|
||||
/** Device type - Coordinator */
|
||||
#define ZB_COORDINATOR ZB_NWK_DEVICE_TYPE_COORDINATOR
|
||||
/** Device type - Router */
|
||||
#define ZB_ROUTER ZB_NWK_DEVICE_TYPE_ROUTER
|
||||
/** Device type - End Device */
|
||||
#define ZB_END_DEVICE ZB_NWK_DEVICE_TYPE_ED
|
||||
/*! @} */ /* af_node_desc_dev_types */
|
||||
|
||||
/**
|
||||
* @addtogroup af_common_constants AF common constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @name Node descriptor - frequency value
|
||||
* @anchor freq_band
|
||||
*
|
||||
* Note: These values were members of `enum zb_freq_band_e` type but were converted to a
|
||||
* set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_FREQ_BAND_868 1U /*!< 868-868.6 MHz BPSK */
|
||||
#define ZB_FREQ_BAND_SUB_GHZ_NA_FSK (1U << 2) /*!< 902-928 MHz BPSK */
|
||||
#define ZB_FREQ_BAND_2400 (1U << 3) /*!< 2400-2483.5 MHz */
|
||||
/** Zigbee R22: European FSK sub-GHz bands (863-876MHz, 915-921MHz) */
|
||||
#define ZB_FREQ_BAND_SUB_GHZ_EU_FSK (1U << 4)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Node descriptor - server mask
|
||||
* @anchor server_mask_bit
|
||||
*
|
||||
* Note: These values were members of `enum zb_server_mask_bit_e` type but were converted to a
|
||||
* set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_PRIMARY_TRUST_CENTER 1U /*!< Primary Trust Center */
|
||||
#define ZB_BACKUP_TRUST_CENTER (1U << 1) /*!< Backup Trust Center */
|
||||
#define ZB_PRIMARY_BINDING_TABLE_CENTER (1U << 2) /*!< Primary Binding Table Center */
|
||||
#define ZB_BACKUP_BINDING_TABLE_CENTER (1U << 3) /*!< Backup Binding Table Center */
|
||||
#define ZB_PRIMARY_DISCOVERY_CACHE (1U << 4) /*!< Primary Discovery Cache */
|
||||
#define ZB_BACKUP_DISCOVERY_CACHE (1U << 5) /*!< Backup Discovery Cache */
|
||||
#define ZB_NETWORK_MANAGER (1U << 6) /*!< Network Manager */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Node descriptor - capability mask
|
||||
* @anchor desc_capability
|
||||
*
|
||||
* Note: These values were members of `enum zb_desc_capability_e` type but were converted to a
|
||||
* set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_EXT_ACTIVE_EP_LIST 1U /*!< Extended Active Endpoint List Available */
|
||||
#define ZB_EXT_SIMPLE_DESC_LIST (1U << 1) /*!< Extended Simple Descriptor List Available */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Power descriptor types
|
||||
* @anchor current_power_mode
|
||||
*/
|
||||
/** @{ */
|
||||
/*!< Receiver synchronized with the receiver on when idle subfield of the node descriptor. */
|
||||
#define ZB_POWER_MODE_SYNC_ON_WHEN_IDLE 0U
|
||||
/*!< Receiver comes on periodically as defined by the node power descriptor. */
|
||||
#define ZB_POWER_MODE_COME_ON_PERIODICALLY 1U
|
||||
/*!< Receiver comes on when stimulated, for example, by a user pressing a button. */
|
||||
#define ZB_POWER_MODE_COME_ON_WHEN_STIMULATED 2U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for power descriptor types.
|
||||
*
|
||||
* Holds one of @ref current_power_mode. Kept only for backward compatibility as
|
||||
* @ref current_power_mode were declared previously as enum. Can be removed in future releases.
|
||||
*/
|
||||
typedef zb_uint8_t zb_current_power_mode_t;
|
||||
|
||||
/**
|
||||
* @name Power source types
|
||||
* @anchor power_src
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_POWER_SRC_CONSTANT 1U /*!< Constant (mains) power */
|
||||
#define ZB_POWER_SRC_RECHARGEABLE_BATTERY (1U << 1) /*!< Rechargeable battery */
|
||||
#define ZB_POWER_SRC_DISPOSABLE_BATTERY (1U << 2) /*!< Disposable battery */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for power source types.
|
||||
*
|
||||
* @deprecated holds one of @ref power_src. Kept only for backward compatibility as
|
||||
* @ref power_src were declared previously as enum. Can be removed in future releases.
|
||||
*/
|
||||
typedef zb_uint8_t zb_power_src_t;
|
||||
|
||||
/**
|
||||
* @name Power source level values
|
||||
* @anchor power_source_level
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_POWER_LEVEL_CRITICAL 0U /*!< Critical */
|
||||
#define ZB_POWER_LEVEL_33 4U /*!< 33% */
|
||||
#define ZB_POWER_LEVEL_66 8U /*!< 66% */
|
||||
#define ZB_POWER_LEVEL_100 12U /*!< 100% */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for power source level values.
|
||||
*
|
||||
* Holds one of @ref power_source_level. Kept only for backward compatibility as
|
||||
* @ref power_source_level were declared previously as enum. Can be removed in future releases.
|
||||
*/
|
||||
typedef zb_uint8_t zb_power_source_level_t;
|
||||
|
||||
/** @} */ /* af_common_constants */
|
||||
|
||||
/**
|
||||
* @addtogroup af_data_service AF data service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
Node power descriptor
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_af_node_power_desc_s
|
||||
{
|
||||
/** Field name Bits
|
||||
* Current power mode: 4@n
|
||||
* Available power sources: 4@n
|
||||
* Current power source: 4@n
|
||||
* Current power source level: 4
|
||||
*/
|
||||
zb_uint16_t power_desc_flags;
|
||||
} ZB_PACKED_STRUCT zb_af_node_power_desc_t;
|
||||
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
#define CAT5(a, b, c, d, e) a##b##c##d##e
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/** Generate simple descriptor type name */
|
||||
#define ZB_AF_SIMPLE_DESC_TYPE(in_num, out_num) CAT5(zb_af_simple_desc_,in_num,_,out_num,_t)
|
||||
|
||||
/**
|
||||
Declares Simple descriptor type
|
||||
|
||||
@param in_clusters_count - number of input clusters in descriptor
|
||||
@param out_clusters_count - number of output clusters in descriptor
|
||||
|
||||
@b Example:
|
||||
@code
|
||||
ZB_DECLARE_SIMPLE_DESC(5, 5);
|
||||
@endcode
|
||||
*/
|
||||
#if defined ZB_APS_ENCRYPTION_PER_CLUSTER
|
||||
|
||||
#define ZB_DECLARE_SIMPLE_DESC(in_clusters_count, out_clusters_count) \
|
||||
typedef ZB_PACKED_PRE struct zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _s \
|
||||
{ \
|
||||
zb_uint8_t endpoint; /* Endpoint */ \
|
||||
zb_uint16_t app_profile_id; /* Application profile identifier */ \
|
||||
zb_uint16_t app_device_id; /* Application device identifier */ \
|
||||
zb_bitfield_t app_device_version:4; /* Application device version */ \
|
||||
zb_bitfield_t reserved:4; /* Reserved */ \
|
||||
zb_uint8_t app_input_cluster_count; /* Application input cluster count */ \
|
||||
zb_uint8_t app_output_cluster_count; /* Application output cluster count */ \
|
||||
/* Application input and output cluster list */ \
|
||||
zb_uint16_t app_cluster_list[(in_clusters_count) + (out_clusters_count)]; \
|
||||
zb_uint8_t cluster_encryption[((in_clusters_count) + (out_clusters_count) + 7)/8]; \
|
||||
} ZB_PACKED_STRUCT \
|
||||
zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _t
|
||||
|
||||
#else /* ZB_APS_ENCRYPTION_PER_CLUSTER */
|
||||
|
||||
#define ZB_DECLARE_SIMPLE_DESC(in_clusters_count, out_clusters_count) \
|
||||
typedef ZB_PACKED_PRE struct zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _s \
|
||||
{ \
|
||||
zb_uint8_t endpoint; /* Endpoint */ \
|
||||
zb_uint16_t app_profile_id; /* Application profile identifier */ \
|
||||
zb_uint16_t app_device_id; /* Application device identifier */ \
|
||||
zb_bitfield_t app_device_version:4; /* Application device version */ \
|
||||
zb_bitfield_t reserved:4; /* Reserved */ \
|
||||
zb_uint8_t app_input_cluster_count; /* Application input cluster count */ \
|
||||
zb_uint8_t app_output_cluster_count; /* Application output cluster count */ \
|
||||
/* Application input and output cluster list */ \
|
||||
zb_uint16_t app_cluster_list[(in_clusters_count) + (out_clusters_count)]; \
|
||||
} ZB_PACKED_STRUCT \
|
||||
zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _t
|
||||
|
||||
#endif /* ZB_APS_ENCRYPTION_PER_CLUSTER */
|
||||
/** @} */ /* af_data_service */
|
||||
|
||||
/**
|
||||
* @addtogroup af_management_service AF management service
|
||||
* @{
|
||||
*/
|
||||
/** General descriptor type */
|
||||
ZB_DECLARE_SIMPLE_DESC(1,1);
|
||||
/** ZDO descriptor type */
|
||||
ZB_DECLARE_SIMPLE_DESC(8,9);
|
||||
/** @} */ /* af_management_service */
|
||||
|
||||
/**
|
||||
* @addtogroup af_common_constants AF common constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Profile identifiers
|
||||
* @anchor af_profile_id
|
||||
*
|
||||
* Note: These values were members of `enum zb_af_profile_id_e` type but were converted to a
|
||||
* set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
/** ZDO profile ID */
|
||||
#define ZB_AF_ZDO_PROFILE_ID 0x0000U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE1_ID 0x0101U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE2_ID 0x0102U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE3_ID 0x0103U
|
||||
/** HA profile ID*/
|
||||
#define ZB_AF_HA_PROFILE_ID 0x0104U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE4_ID 0x0105U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE5_ID 0x0106U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE6_ID 0x0107U
|
||||
/** Legacy profile */
|
||||
#define ZB_AF_LEGACY_PROFILE7_ID 0x0108U
|
||||
/** SE profile ID */
|
||||
#define ZB_AF_SE_PROFILE_ID 0x0109U
|
||||
/** ZLL profile identifier. */
|
||||
#define ZB_AF_ZLL_PROFILE_ID 0xC05EU
|
||||
/** Wildcard profile identifier. */
|
||||
#define ZB_AF_WILDCARD_PROFILE_ID 0xFFFFU
|
||||
/** GreenPower profile ID */
|
||||
#define ZB_AF_GP_PROFILE_ID 0xA1E0U
|
||||
#ifdef ZB_CONTROL4_NETWORK_SUPPORT
|
||||
/** Control4 profile identifier. */
|
||||
#define ZB_AF_CONTROL4_PROFILE_ID 0xC25DU
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/** @} */ /* af_common_constants */
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
#if !(defined ZB_ZCL_DISABLE_REPORTING) || defined(DOXYGEN)
|
||||
struct zb_zcl_reporting_info_s; /* Forward declaration */
|
||||
#endif
|
||||
struct zb_zcl_cluster_desc_s; /* Forward declaration */
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/**
|
||||
* @addtogroup af_management_service AF management service
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* Device command handler
|
||||
*
|
||||
* @param param - index of buffer with ZCL command
|
||||
* @return status (see @ref zb_bool_t)
|
||||
*/
|
||||
typedef zb_uint8_t (*zb_device_handler_t)(zb_uint8_t param);
|
||||
/** @} */ /* af_management_service */
|
||||
/**
|
||||
* @addtogroup af_data_service AF data service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Endpoint description for user applications. */
|
||||
|
||||
/*! @brief Endpoint descriptor. */
|
||||
typedef ZB_PACKED_PRE struct zb_af_endpoint_desc_s
|
||||
{
|
||||
zb_uint8_t ep_id; /*!< Endpoint ID */
|
||||
zb_uint16_t profile_id; /*!< Application profile, which implemented on endpoint */
|
||||
zb_device_handler_t device_handler; /*!< Device specific callback, handles all commands */
|
||||
/*! @brief Identify notification callback
|
||||
|
||||
If set, will be called on identification start and stop indicating start
|
||||
event with a non-zero argument
|
||||
|
||||
@deprecated will be removed after June 2023. Use @ref ZB_ZCL_REGISTER_DEVICE_CB
|
||||
with @ref ZB_ZCL_SET_ATTR_VALUE_CB_ID instead of it.
|
||||
*/
|
||||
zb_callback_t identify_handler;
|
||||
zb_uint8_t reserved_size; /*!< Unused parameter (reserved for future use) */
|
||||
void* reserved_ptr; /*!< Unused parameter (reserved for future use) */
|
||||
zb_uint8_t cluster_count; /*!< Number of supported clusters */
|
||||
struct zb_zcl_cluster_desc_s *cluster_desc_list; /*!< Supported clusters list */
|
||||
zb_af_simple_desc_1_1_t *simple_desc; /*!< Simple descriptor */
|
||||
#if defined ZB_ENABLE_ZLL || defined DOXYGEN
|
||||
zb_uint8_t group_id_count;
|
||||
#endif /* defined ZB_ENABLE_ZLL || defined DOXYGEN */
|
||||
|
||||
/* Moved here from device descriptor */
|
||||
zb_uint8_t rep_info_count; /*!< Number of reporting info slots */
|
||||
/* Reporting info structure should be better stored in ZCL main,
|
||||
* moved here to allow compile-time memory allocating for
|
||||
* reporting_info array, see ZB_AF_DECLARE_DEVICE_CTX() */
|
||||
struct zb_zcl_reporting_info_s *reporting_info; /*!< Attributes reporting information */
|
||||
|
||||
zb_uint8_t cvc_alarm_count; /*!< Number of continuous value change alarm slots */
|
||||
struct zb_zcl_cvc_alarm_variables_s *cvc_alarm_info;
|
||||
}ZB_PACKED_STRUCT
|
||||
zb_af_endpoint_desc_t;
|
||||
/** @} */ /* af_data_service */
|
||||
|
||||
/**
|
||||
* @addtogroup af_management_service AF management service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Search for endpoint (device) descriptor by endpoint ID.
|
||||
* @param ep_id - identifier of the endpoint.
|
||||
* @returns NULL if no endpoint found, or pointer to the endpoint descriptor.
|
||||
*/
|
||||
zb_af_endpoint_desc_t* zb_af_get_endpoint_desc(zb_uint8_t ep_id);
|
||||
|
||||
/**
|
||||
* @brief Check endpoint registration in ZCL.
|
||||
* @param _ep - identifier of the endpoint under consideration.
|
||||
* @returns ZB_TRUE if endpoint is registered, ZB_FALSE otherwise.
|
||||
*/
|
||||
#define ZB_AF_IS_EP_REGISTERED( _ep ) ((zb_af_get_endpoint_desc( _ep ) != NULL)?(ZB_TRUE):(ZB_FALSE))
|
||||
/** @} */ /* af_management_service */
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/**
|
||||
AF device context, contains a list of registered endpoints
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_af_device_ctx_s
|
||||
{
|
||||
zb_uint8_t ep_count; /*!< Number of endpoints on device */
|
||||
zb_af_endpoint_desc_t **ep_desc_list; /*!< Endpoint list */
|
||||
}ZB_PACKED_STRUCT
|
||||
zb_af_device_ctx_t;
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/**
|
||||
* @addtogroup af_management_service AF management service
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
General macro to declare endpoint description list
|
||||
@param ep_list_name - name of ep list structure
|
||||
*/
|
||||
#define ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_list_name) \
|
||||
zb_af_endpoint_desc_t *ep_list_name[] = {
|
||||
|
||||
#if defined ZB_ENABLE_ZLL
|
||||
#define ZB_AF_SET_ENDPOINT_DESC_ZLL( \
|
||||
ep_id, \
|
||||
profile_id, \
|
||||
reserved_length, \
|
||||
reserved_ptr, \
|
||||
cluster_number, \
|
||||
cluster_list, \
|
||||
simple_desc, \
|
||||
group_id_count, \
|
||||
rep_count, \
|
||||
rep_ctx, \
|
||||
lev_ctrl_count, \
|
||||
lev_ctrl_ctx) \
|
||||
{ \
|
||||
ep_id, \
|
||||
profile_id, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
reserved_length, \
|
||||
reserved_ptr, \
|
||||
cluster_number, \
|
||||
cluster_list, \
|
||||
simple_desc, \
|
||||
group_id_count, \
|
||||
rep_count, \
|
||||
rep_ctx, \
|
||||
lev_ctrl_count, \
|
||||
lev_ctrl_ctx \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize endpoint descriptor
|
||||
*
|
||||
* @param ep_name - endpoint name
|
||||
* @param ep_id - endpoint ID
|
||||
* @param profile_id - ID of profile deployed on this endpoint
|
||||
* @param reserved_length - unused parameter
|
||||
* @param reserved_ptr - unused parameter
|
||||
* @param cluster_number - number of clusters deployed on endpoint
|
||||
* @param cluster_list - pointer to cluster list structure
|
||||
* @param simple_desc - pointer to simple descriptor structure
|
||||
* @param rep_count - number of reporting info slots
|
||||
* @param rep_ctx - pointer to attributes reporting information
|
||||
* @param lev_ctrl_count - number of continuous value change alarm slots
|
||||
* @param lev_ctrl_ctx - pointer to CVC context
|
||||
*/
|
||||
#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) \
|
||||
zb_af_endpoint_desc_t ep_name = \
|
||||
ZB_AF_SET_ENDPOINT_DESC_ZLL( \
|
||||
ep_id, \
|
||||
profile_id, \
|
||||
reserved_length, \
|
||||
(void*)reserved_ptr, \
|
||||
cluster_number, \
|
||||
cluster_list, \
|
||||
simple_desc, \
|
||||
0, \
|
||||
rep_count, \
|
||||
rep_ctx, \
|
||||
lev_ctrl_count, \
|
||||
lev_ctrl_ctx)
|
||||
#else /* defined ZB_ENABLE_ZLL */
|
||||
/**
|
||||
@brief Initialize endpoint descriptor
|
||||
|
||||
@param ep_name - endpoint name
|
||||
@param ep_id - endpoint ID
|
||||
@param profile_id - ID of profile deployed on this endpoint
|
||||
@param reserved_length - unused parameter
|
||||
@param reserved_ptr - unused parameter
|
||||
@param cluster_number - number of clusters deployed on endpoint
|
||||
@param cluster_list - pointer to cluster list
|
||||
@param simple_desc - pointer to simple descriptor
|
||||
@param rep_count - maximum number of attributes that are
|
||||
being reported on a device
|
||||
@param rep_ctx - reporting context variable name (NULL if no reporting context)
|
||||
@param lev_ctrl_count - number of level control attributes
|
||||
@param lev_ctrl_ctx - level control context variable name (NULL if no level control context)
|
||||
*/
|
||||
#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) \
|
||||
zb_af_endpoint_desc_t ep_name = \
|
||||
{ \
|
||||
ep_id, \
|
||||
profile_id, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
reserved_length, \
|
||||
(void*)reserved_ptr, \
|
||||
cluster_number, \
|
||||
cluster_list, \
|
||||
simple_desc, \
|
||||
rep_count, \
|
||||
rep_ctx, \
|
||||
lev_ctrl_count, \
|
||||
lev_ctrl_ctx \
|
||||
}
|
||||
#endif /* defined ZB_ENABLE_ZLL */
|
||||
|
||||
/** Finishes endpoint list declaration */
|
||||
#define ZB_AF_FINISH_DECLARE_ENDPOINT_LIST }
|
||||
|
||||
/**
|
||||
* @brief Allows application to register cluster commands handler for a specific endpoint
|
||||
* @param endpoint - Endpoint number
|
||||
* @param handler - Pointer to a function, function type zb_device_handler_t
|
||||
* @attention Endpoint should be registered. ZB_AF_SET_ENDPOINT_HANDLER() should be called after
|
||||
* device context is registered, using call to ZB_AF_REGISTER_DEVICE_CTX()
|
||||
*
|
||||
* @cond DOXYGEN_INTERNAL_DOC
|
||||
* TODO: add snippet
|
||||
* @endcond
|
||||
*/
|
||||
#define ZB_AF_SET_ENDPOINT_HANDLER(endpoint, handler) \
|
||||
(zb_af_get_endpoint_desc((endpoint))->device_handler = (handler))
|
||||
|
||||
/*! @brief Sets identify notification handler for endpoint
|
||||
|
||||
Utilized by ZCL Identify cluster
|
||||
@param endpoint number
|
||||
@param handler to set
|
||||
@attention Assumes that endpoint already registered
|
||||
*
|
||||
* @cond DOXYGEN_INTERNAL_DOC
|
||||
* TODO: add snippet
|
||||
* @endcond
|
||||
*/
|
||||
#define ZB_AF_SET_IDENTIFY_NOTIFICATION_HANDLER(endpoint, handler) \
|
||||
(zb_af_get_endpoint_desc((endpoint))->identify_handler = (handler))
|
||||
|
||||
#define ZB_ZCL_CLUSTER_DESC(cluster_id, attr_count, attr_desc_list, cluster_role_mask, manuf_code) \
|
||||
{ \
|
||||
(cluster_id), \
|
||||
(attr_count), \
|
||||
(attr_desc_list), \
|
||||
(cluster_role_mask), \
|
||||
(manuf_code), \
|
||||
(((cluster_role_mask) == ZB_ZCL_CLUSTER_SERVER_ROLE) ? cluster_id##_SERVER_ROLE_INIT : \
|
||||
(((cluster_role_mask) == ZB_ZCL_CLUSTER_CLIENT_ROLE) ? cluster_id##_CLIENT_ROLE_INIT : NULL)) \
|
||||
}
|
||||
|
||||
/** WARNING: This API is deprecated, use ZBOSS_DECLARE_DEVICE_CTX instead. */
|
||||
#define ZB_AF_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_name, ep_count, reporting_attr_count) \
|
||||
zb_zcl_reporting_info_t reporting_info## device_ctx_name[reporting_attr_count]; \
|
||||
zb_af_device_ctx_t device_ctx_name = \
|
||||
{ \
|
||||
ep_count, \
|
||||
ep_list_name, \
|
||||
reporting_attr_count, \
|
||||
reporting_info## device_ctx_name, \
|
||||
0, \
|
||||
NULL \
|
||||
}
|
||||
|
||||
/** WARNING: This API is deprecated, use ZBOSS_DECLARE_DEVICE_CTX instead. */
|
||||
#define ZB_AF_DECLARE_DEVICE_CTX_NO_REP(device_ctx_name, ep_list_name, ep_count) \
|
||||
zb_af_device_ctx_t device_ctx_name = \
|
||||
{ \
|
||||
ep_count, \
|
||||
ep_list_name, \
|
||||
0, \
|
||||
NULL, \
|
||||
0, \
|
||||
NULL \
|
||||
}
|
||||
|
||||
/**
|
||||
Declare device reporting context
|
||||
@param rep_ctx - reporting context variable name
|
||||
@param rep_count - number of reporting attributes
|
||||
*/
|
||||
#define ZBOSS_DEVICE_DECLARE_REPORTING_CTX(rep_ctx, rep_count) \
|
||||
zb_zcl_reporting_info_t rep_ctx[rep_count]
|
||||
|
||||
/**
|
||||
Declare device level control context
|
||||
@param lev_ctrl_ctx - level control context variable name
|
||||
@param lev_ctrl_count - number of level control attributes
|
||||
*/
|
||||
#define ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX(lev_ctrl_ctx, lev_ctrl_count) \
|
||||
zb_zcl_cvc_alarm_variables_t lev_ctrl_ctx[lev_ctrl_count]
|
||||
|
||||
/**
|
||||
Declare application's device context
|
||||
@param device_ctx_name - device context variable name
|
||||
@param ep_list_name - name of endpoint list
|
||||
@param ep_count - number of supported endpoints
|
||||
*/
|
||||
#define ZBOSS_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_name, ep_count) \
|
||||
zb_af_device_ctx_t device_ctx_name = \
|
||||
{ \
|
||||
ep_count, \
|
||||
ep_list_name, \
|
||||
}
|
||||
|
||||
/**
|
||||
Declare application's device context for single-endpoint device
|
||||
|
||||
@note Device has an additional Green Power endpoint if it is ZC or ZR
|
||||
and GPPB feature is enabled (Mandatory for Zigbee 3.0 ZC/ZR).
|
||||
|
||||
@param device_ctx_name - device context variable name
|
||||
@param ep_name - variable holding endpoint context
|
||||
*/
|
||||
#define ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx_name, ep_name) \
|
||||
ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_list_##device_ctx_name) \
|
||||
&ep_name, \
|
||||
ZB_AF_FINISH_DECLARE_ENDPOINT_LIST; \
|
||||
ZBOSS_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_##device_ctx_name, \
|
||||
(ZB_ZCL_ARRAY_SIZE(ep_list_##device_ctx_name, zb_af_endpoint_desc_t*)))
|
||||
|
||||
/**
|
||||
Declare application's device context for two-endpoint device
|
||||
|
||||
@note Device has an additional Green Power endpoint if it is ZC or ZR
|
||||
and GPPB feature (Mandatory for Zigbee 3.0 ZC/ZR) is enabled.
|
||||
|
||||
@param device_ctx_name - device context variable name
|
||||
@param ep1_name - variable holding context for endpoint 1
|
||||
@param ep2_name - variable holding context for endpoint 2
|
||||
*/
|
||||
#define ZBOSS_DECLARE_DEVICE_CTX_2_EP(device_ctx_name, ep1_name, ep2_name) \
|
||||
ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_list_##device_ctx_name) \
|
||||
&ep1_name, \
|
||||
&ep2_name, \
|
||||
ZB_AF_FINISH_DECLARE_ENDPOINT_LIST; \
|
||||
ZBOSS_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_##device_ctx_name, \
|
||||
(ZB_ZCL_ARRAY_SIZE(ep_list_##device_ctx_name, zb_af_endpoint_desc_t*)))
|
||||
|
||||
/**
|
||||
Declare application's device context for three-endpoint device
|
||||
|
||||
@note Device has an additional Green Power endpoint if it is ZC or ZR
|
||||
and GPPB feature (Mandatory for Zigbee 3.0 ZC/ZR) is enabled.
|
||||
|
||||
@param device_ctx_name - device context variable name
|
||||
@param ep1_name - variable holding context for endpoint 1
|
||||
@param ep2_name - variable holding context for endpoint 2
|
||||
@param ep3_name - variable holding context for endpoint 3
|
||||
*/
|
||||
#define ZBOSS_DECLARE_DEVICE_CTX_3_EP(device_ctx_name, ep1_name, ep2_name, ep3_name) \
|
||||
ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_list_##device_ctx_name) \
|
||||
&ep1_name, \
|
||||
&ep2_name, \
|
||||
&ep3_name, \
|
||||
ZB_AF_FINISH_DECLARE_ENDPOINT_LIST; \
|
||||
ZBOSS_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_##device_ctx_name, \
|
||||
(ZB_ZCL_ARRAY_SIZE(ep_list_##device_ctx_name, zb_af_endpoint_desc_t*)))
|
||||
|
||||
/**
|
||||
Declare application's device context for for-endpoint device
|
||||
|
||||
@note Device has an additional Green Power endpoint if it is ZC or ZR
|
||||
and GPPB feature (Mandatory for Zigbee 3.0 ZC/ZR) is enabled.
|
||||
|
||||
@param device_ctx_name - device context variable name
|
||||
@param ep1_name - variable holding context for endpoint 1
|
||||
@param ep2_name - variable holding context for endpoint 2
|
||||
@param ep3_name - variable holding context for endpoint 3
|
||||
@param ep4_name - variable holding context for endpoint 4
|
||||
*/
|
||||
#define ZBOSS_DECLARE_DEVICE_CTX_4_EP(device_ctx_name, ep1_name, ep2_name, ep3_name, ep4_name) \
|
||||
ZB_AF_START_DECLARE_ENDPOINT_LIST(ep_list_##device_ctx_name) \
|
||||
&ep1_name, \
|
||||
&ep2_name, \
|
||||
&ep3_name, \
|
||||
&ep4_name, \
|
||||
ZB_AF_FINISH_DECLARE_ENDPOINT_LIST; \
|
||||
ZBOSS_DECLARE_DEVICE_CTX(device_ctx_name, ep_list_##device_ctx_name, \
|
||||
(ZB_ZCL_ARRAY_SIZE(ep_list_##device_ctx_name, zb_af_endpoint_desc_t*)))
|
||||
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
#if defined ZB_ENABLE_ZCL && !defined ZB_ZCL_DISABLE_REPORTING
|
||||
void zb_zcl_init_reporting_ctx(void);
|
||||
void zb_zcl_reset_reporting_ctx(void);
|
||||
#endif /* ZB_ENABLE_ZCL && !ZB_ZCL_DISABLE_REPORTING */
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/* TODO: extend this ifdef*/
|
||||
#if defined ZB_ENABLE_ZCL || DOXYGEN
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/**
|
||||
Register device context.
|
||||
@param device_ctx - pointer to device context
|
||||
*/
|
||||
void zb_af_register_device_ctx(zb_af_device_ctx_t *device_ctx);
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
/**
|
||||
Register device context.
|
||||
@param _device_ctx - Pointer to the device context
|
||||
|
||||
@b Example:
|
||||
@snippet onoff_server/on_off_output_zc.c af_register_device_context
|
||||
*/
|
||||
#define ZB_AF_REGISTER_DEVICE_CTX(_device_ctx) zb_af_register_device_ctx(_device_ctx)
|
||||
#endif /* defined ZB_ENABLE_ZCL */
|
||||
/**
|
||||
* @brief Set Device user application callback.
|
||||
* The macro sets a callback being called upon to need inform User App about change device attribute or
|
||||
* need to execute H/W command
|
||||
* @param func_ptr - a callback to set (of type @ref zb_callback_t).
|
||||
* @hideinitializer
|
||||
*
|
||||
* @b Example:
|
||||
* @snippet onoff_server/on_off_output_zc.c zcl_register_device_cb_example_cb
|
||||
* @par Register callback:
|
||||
* @snippet onoff_server/on_off_output_zc.c zcl_register_device_cb
|
||||
*/
|
||||
#define ZB_ZCL_REGISTER_DEVICE_CB(func_ptr) ZCL_CTX().device_cb = (func_ptr)
|
||||
|
||||
/**
|
||||
Callback for notifying user about status of ZCL/ZDO command transmission
|
||||
*/
|
||||
typedef void (*zb_af_transmission_res_cb_t) (zb_uint8_t status);
|
||||
|
||||
/**
|
||||
Continue inconimg packet proicessing after ZG->zdo.af_data_cb returned TRUE
|
||||
|
||||
@param param - incoming packet. Be sure it was initially passed to ZG->zdo.af_data_cb.
|
||||
*/
|
||||
void zb_apsde_data_indication_cont(zb_uint8_t param);
|
||||
/** @} */ /* af_management_service */
|
||||
/*! @} */
|
||||
|
||||
#endif /* ZBOSS_API_AF_H */
|
||||
@@ -0,0 +1,627 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Public APS layer API
|
||||
*/
|
||||
#ifndef ZB_ZBOSS_API_APS_H
|
||||
#define ZB_ZBOSS_API_APS_H 1
|
||||
|
||||
/*! \addtogroup aps_api */
|
||||
/*! @{ */
|
||||
|
||||
/** @addtogroup aps_common_constants APS common constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "zb_config.h"
|
||||
#include "zb_address.h"
|
||||
#include "zboss_api_aps_interpan.h"
|
||||
|
||||
/**
|
||||
* @name APS status constants
|
||||
* @anchor aps_status
|
||||
*/
|
||||
/** @{ */
|
||||
|
||||
/** A request has been executed successfully. */
|
||||
#define ZB_APS_STATUS_SUCCESS 0x00U
|
||||
/** A transmit request failed since the ASDU is too large and fragmentation is not supported.*/
|
||||
#define ZB_APS_ASDU_TOO_LONG 0xa0U
|
||||
/** A received fragmented frame could not be defragmented at the current time. */
|
||||
#define ZB_APS_DEFRAG_DEFERRED 0xa1U
|
||||
/** A received fragmented frame could not be defragmented since the device does not support
|
||||
* fragmentation. */
|
||||
#define ZB_APS_DEFRAG_UNSUPPORTED 0xa2U
|
||||
/** A parameter value was out of range. */
|
||||
#define ZB_APS_STATUS_ILLEGAL_REQUEST 0xa3U
|
||||
/** An APSME-UNBIND.request failed due to the requested binding link not existing in the binding
|
||||
* table. */
|
||||
#define ZB_APS_STATUS_INVALID_BINDING 0xa4U
|
||||
/** An APSME-REMOVE-GROUP.request has been issued with a group identifier that does not appear in
|
||||
* the group table. */
|
||||
#define ZB_APS_STATUS_INVALID_GROUP 0xa5U
|
||||
/** A parameter value was invalid or out of range. */
|
||||
#define ZB_APS_STATUS_INVALID_PARAMETER 0xa6U
|
||||
/** An APSDE-DATA.request requesting acknowledged transmission failed due to no acknowledgement
|
||||
* being received. */
|
||||
#define ZB_APS_STATUS_NO_ACK 0xa7U
|
||||
/** An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to there being
|
||||
* no devices bound to this device. */
|
||||
#define ZB_APS_STATUS_NO_BOUND_DEVICE 0xa8U
|
||||
/** An APSDE-DATA.request with a destination addressing mode set to 0x03 failed due to no
|
||||
* corresponding short address found in the address map table. */
|
||||
#define ZB_APS_STATUS_NO_SHORT_ADDRESS 0xa9U
|
||||
/** An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to a binding
|
||||
* table not being supported on the device. */
|
||||
#define ZB_APS_STATUS_NOT_SUPPORTED 0xaaU
|
||||
/** An ASDU was received that was secured using a link key. */
|
||||
#define ZB_APS_STATUS_SECURED_LINK_KEY 0xabU
|
||||
/** An ASDU was received that was secured using a network key. */
|
||||
#define ZB_APS_STATUS_SECURED_NWK_KEY 0xacU
|
||||
/** An APSDE-DATA.request requesting security has resulted in an error during the corresponding
|
||||
* security processing. */
|
||||
#define ZB_APS_STATUS_SECURITY_FAIL 0xadU
|
||||
/** An APSME-BIND.request or APSME.ADD-GROUP.request issued when the binding or group tables,
|
||||
* respectively, were full. */
|
||||
#define ZB_APS_STATUS_TABLE_FULL 0xaeU
|
||||
/** An ASDU was received without any security. */
|
||||
#define ZB_APS_STATUS_UNSECURED 0xafU
|
||||
/** An APSME-GET.request or APSME-SET.request has been issued with an unknown attribute identifier.
|
||||
*/
|
||||
#define ZB_APS_STATUS_UNSUPPORTED_ATTRIBUTE 0xb0U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for APS status constants
|
||||
*
|
||||
* @deprecated holds one of @ref aps_status. Kept only for backward compatibility as
|
||||
* @ref aps_status were declared previously as enum. Can be removed in future releases.
|
||||
*/
|
||||
typedef zb_uint8_t zb_aps_status_t;
|
||||
|
||||
/**
|
||||
* @name APS addressing mode constants
|
||||
* @anchor aps_addr_mode
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT 0x00U /*!< DstAddress and DstEndpoint not present */
|
||||
#define ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT 0x01U /*!< 16-bit group address for DstAddress; DstEndpoint not present */
|
||||
#define ZB_APS_ADDR_MODE_16_ENDP_PRESENT 0x02U /*!< 16-bit address for DstAddress and DstEndpoint present */
|
||||
#define ZB_APS_ADDR_MODE_64_ENDP_PRESENT 0x03U /*!< 64-bit extended address for DstAddress and DstEndpoint present */
|
||||
#define ZB_APS_ADDR_MODE_BIND_TBL_ID 0x04U /*!< "destination endpoint" is interpreted as an index in the binding table,
|
||||
all other destination address information is ignored */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for APS addressing mode constants.
|
||||
*
|
||||
* Holds one of @ref aps_addr_mode. Kept only for backward compatibility as
|
||||
* @ref aps_addr_mode were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_aps_addr_mode_t;
|
||||
|
||||
/** @brief Minimum valid endpoint number. */
|
||||
#define ZB_MIN_ENDPOINT_NUMBER 1U
|
||||
|
||||
/** @brief Maximum valid endpoint number. */
|
||||
#define ZB_MAX_ENDPOINT_NUMBER 240U
|
||||
|
||||
/** @brief Broadcast endpoint number. */
|
||||
#define ZB_APS_BROADCAST_ENDPOINT_NUMBER 255U
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @} */ /* aps_api */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! \addtogroup aps_ib */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* @name APS Information Base constants
|
||||
* @anchor aps_aib_attr_id
|
||||
*/
|
||||
/** @{ */
|
||||
/** The current set of binding table entries in the device (@see subclause 2.2.8.2.1). */
|
||||
#define ZB_APS_AIB_BINDING 0xc1U
|
||||
/** TRUE if the device should become the Zigbee Coordinator on startupU FALSE if otherwise. */
|
||||
#define ZB_APS_AIB_DESIGNATED_COORD 0xc2U
|
||||
/** The list of masks of allowable channels for this device to use for network operations. */
|
||||
#define ZB_APS_AIB_CHANNEL_MASK_LIST 0xc3U
|
||||
/** The 64-bit address of a network to form or to join. */
|
||||
#define ZB_APS_AIB_USE_EXT_PANID 0xc4U
|
||||
/** The current set of group table entries (@see Table 2.25). */
|
||||
#define ZB_APS_AIB_GROUP_TABLE 0xc5U
|
||||
/** The value to be used for the NonmemberRadius parameter when using NWK layer multicast. */
|
||||
#define ZB_APS_AIB_NONMEMBER_RADIUS 0xc6U
|
||||
/** The current set of permission configuration items. */
|
||||
#define ZB_APS_AIB_PERMISSION_CONFIG 0xc7U
|
||||
/** A flag controlling the use of insecure join at startup. */
|
||||
#define ZB_APS_AIB_USE_INSECURE_JOIN 0xc8U
|
||||
/** Fragmentation parameter - the standard delayU in millisecondsU between sending two blocks of a
|
||||
* fragmented transmission (@see subclause 2.2.8.4.5). */
|
||||
#define ZB_APS_AIB_INTERFRAME_DELAY 0xc9U
|
||||
/** The energy measurement for the channel energy scan performed on the previous channel just before
|
||||
* a channel change (in accordance with [B1]). */
|
||||
#define ZB_APS_AIB_LAST_CHANNEL_ENERGY 0xcaU
|
||||
/** The latest percentage of transmission network transmission failures for the previous channel
|
||||
* just before a channel change (in percentage of failed transmissions to the total number of
|
||||
* transmissions attempted) */
|
||||
#define ZB_APS_AIB_LAST_CHANNEL_FAILURE_RATE 0xcbU
|
||||
/** A countdown timer (in hours) indicating the time to the next permitted frequency agility channel
|
||||
* change. A value of NULL indicates the channel has not been changed previously. */
|
||||
#define ZB_APS_AIB_CHANNEL_TIMER 0xccU
|
||||
/** A table with the active endpoints and their respective apsMaxWin-dowSize where frag-mentation is
|
||||
* used (active endpoints not supporting fragmentations shall be omitted from the list). */
|
||||
#define ZB_APS_AIB_MAX_WINDOW_SIZE 0xcdU
|
||||
/** The value of the current countdown timer before the next Parent_annce is sent. */
|
||||
#define ZB_APS_AIB_PARENT_ANNOUNCE_TIMER 0xceU
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for APS Information Base constants.
|
||||
*
|
||||
* Holds one of @ref aps_aib_attr_id. Kept for backward compatibility as
|
||||
* @ref aps_aib_attr_id were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_aps_aib_attr_id_t;
|
||||
|
||||
/*! @} */ /* aps_ib */
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @addtogroup aps_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup aps_data_service APS data service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Parsed APS header.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_hdr_s
|
||||
{
|
||||
/* TODO: rearrange fields to make that structure packet and exclude "packed" attribute. Don't forget to update NCP side. */
|
||||
zb_uint8_t fc; /*!< Frame control. */
|
||||
zb_uint16_t src_addr; /*!< Source address of packet originator. */
|
||||
zb_uint16_t dst_addr; /*!< The destination address of the packet. */
|
||||
zb_uint16_t group_addr; /*!< If send to group then group address destination else 0. */
|
||||
zb_uint8_t dst_endpoint; /*!< The destination endpoint of the packet receiver. */
|
||||
zb_uint8_t src_endpoint; /*!< The source endpoint from which that packet was send. */
|
||||
zb_uint16_t clusterid; /*!< The identifier of the cluster on the source device. */
|
||||
zb_uint16_t profileid; /*!< Profile ID */
|
||||
zb_uint8_t aps_counter; /*!< APS Counter for check APS dup command. */
|
||||
zb_uint16_t mac_src_addr; /*!< Source address of device that transmit that packet. */
|
||||
zb_uint16_t mac_dst_addr; /*!< Next hop address used for frame transmission. */
|
||||
zb_uint8_t lqi;
|
||||
zb_int8_t rssi;
|
||||
/* attributes of the key used to unsecure this frame */
|
||||
zb_bitfield_t aps_key_source:1; /*!< @if ZB_SECUR
|
||||
* @ref secur_key_sources
|
||||
* @endif
|
||||
*/
|
||||
zb_bitfield_t aps_key_attrs:2; /*!< @if ZB_SECUR
|
||||
* @ref secur_key_attributes
|
||||
* @endif
|
||||
*/
|
||||
zb_bitfield_t aps_key_from_tc:1; /* Denotes that packet received from TC and properly
|
||||
* encrypted with TCLK by any appropriate method:
|
||||
* 1) BDB Request key (with Key Type: TCLK) ->
|
||||
* Transport Key -> Verify Key
|
||||
* 2) BDB+SE Mixed CBKE
|
||||
* 3) SE CBKE */
|
||||
zb_bitfield_t extended_fc:2;
|
||||
zb_bitfield_t reserved:2;
|
||||
|
||||
#define FIRST_INTERNAL_APSIND_FIELD tsn
|
||||
zb_uint8_t tsn; /*!< Transaction sequence number for ZDO/ZCL command. */
|
||||
zb_uint8_t block_num; /*!< Fragmentation: block number. */
|
||||
zb_uint8_t block_ack; /*!< Fragmentation: block ack. */
|
||||
zb_uint8_t radius; /*!< radius from nwk header */
|
||||
zb_uint8_t align[7];
|
||||
} ZB_PACKED_STRUCT zb_aps_hdr_t;
|
||||
|
||||
|
||||
/**
|
||||
Parameters of the APSDE-DATA.indication primitive.
|
||||
|
||||
Also used as a parameter in different APS calls.
|
||||
*/
|
||||
typedef zb_aps_hdr_t zb_apsde_data_indication_t;
|
||||
ZB_ASSERT_IF_NOT_ALIGNED_TO_16(zb_apsde_data_indication_t);
|
||||
|
||||
/** @} */ /* APS data service */
|
||||
/** @} */
|
||||
|
||||
/** @addtogroup aps_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup aps_management_service APS management service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief APSME binding structure.
|
||||
*
|
||||
* This data structure passed to @ref zb_apsme_bind_request()
|
||||
* and to @ref zb_apsme_unbind_request().
|
||||
*
|
||||
* @deprecated Corresponding function @ref zb_apsme_unbind_request() is deprecated and it will be
|
||||
* moved to the private header in November 2022. Do not use this structure and corresponding function
|
||||
* in the applications.
|
||||
*/
|
||||
typedef struct zb_apsme_binding_req_s
|
||||
{
|
||||
zb_ieee_addr_t src_addr; /*!< The source IEEE address for the binding entry. */
|
||||
zb_uint8_t src_endpoint; /*!< The source endpoint for the binding entry. */
|
||||
zb_uint16_t clusterid; /*!< The identifier of the cluster on the source
|
||||
device that is to be bound to the destination device.*/
|
||||
zb_uint8_t addr_mode; /*!< The type of destination address supplied by
|
||||
the DstAddr parameter - see @ref aps_addr_mode */
|
||||
zb_addr_u dst_addr; /*!< The destination address for the binding entry. */
|
||||
zb_uint8_t dst_endpoint; /*!< This parameter will be present only if
|
||||
the DstAddrMode parameter has a value of
|
||||
0x03 and, if present, will be the
|
||||
destination endpoint for the binding entry.*/
|
||||
#ifdef SNCP_MODE
|
||||
zb_uint8_t remote_bind; /*!< Indication if the bind req is local or remote */
|
||||
zb_uint8_t id; /*!< unique identifier of the entry for NCP, updated only in
|
||||
zb_apsme_bind_request and zb_apsme_unbind_request and used to
|
||||
notify NCP */
|
||||
/* confirm_cb is not sent in payload by NCP, keep it in the end of this structure */
|
||||
#endif
|
||||
zb_callback_t confirm_cb; /*!< The callback to be called when the operation is completed. */
|
||||
} zb_apsme_binding_req_t;
|
||||
|
||||
|
||||
/**
|
||||
* This data structure passed to @ref zb_zdo_check_binding_request().
|
||||
*/
|
||||
typedef struct zb_aps_check_binding_req_s
|
||||
{
|
||||
zb_uint8_t src_endpoint; /* a source endpoint, if ZB_ZCL_BROADCAST_ENDPOINT - any endpoint */
|
||||
zb_uint16_t cluster_id; /* a source cluster ID */
|
||||
zb_callback_t response_cb;
|
||||
} zb_aps_check_binding_req_t;
|
||||
|
||||
|
||||
/**
|
||||
* This data structure passed to callback passed to @ref zb_zdo_check_binding_request().
|
||||
*/
|
||||
typedef struct zb_aps_check_binding_resp_s
|
||||
{
|
||||
zb_uint8_t src_endpoint; /* a source endpoint from the corresponding request */
|
||||
zb_uint16_t cluster_id; /* a source cluster ID from the corresponding request */
|
||||
zb_bool_t exists; /* whether the binding with specified parameters exists */
|
||||
} zb_aps_check_binding_resp_t;
|
||||
|
||||
/** @brief APSME-ADD-GROUP.request primitive parameters, should be passed to @ref zb_zdo_add_group_req() */
|
||||
typedef struct zb_apsme_add_group_req_s
|
||||
{
|
||||
zb_uint16_t group_address; /*!< The 16-bit address of the group being added. */
|
||||
zb_uint8_t endpoint; /*!< The endpoint to which the given group is being added. */
|
||||
zb_callback_t confirm_cb; /*!< The callback to be called when the operation is completed. */
|
||||
} zb_apsme_add_group_req_t;
|
||||
|
||||
/** @brief APSME-ADD-GROUP.confirm primitive parameters. */
|
||||
typedef struct zb_apsme_add_group_conf_s
|
||||
{
|
||||
zb_uint16_t group_address; /*!< The 16-bit address of the group being added. */
|
||||
zb_uint8_t endpoint; /*!< The endpoint to which the given group is being added. */
|
||||
zb_ret_t status; /*!< Request send status. */
|
||||
} zb_apsme_add_group_conf_t;
|
||||
|
||||
/** @brief APSME-REMOVE-GROUP.request primitive parameters, should be passed to @ref zb_zdo_add_group_req() */
|
||||
typedef struct zb_apsme_add_group_req_s zb_apsme_remove_group_req_t;
|
||||
|
||||
/** @brief APSME-REMOVE-GROUP.confirm primitive parameters. */
|
||||
typedef struct zb_apsme_add_group_conf_s zb_apsme_remove_group_conf_t;
|
||||
|
||||
/** @brief APSME-REMOVE-ALL-GROUPS.request primitive parameters, should be passed to @ref zb_zdo_remove_all_groups_req(). */
|
||||
typedef struct zb_apsme_remove_all_groups_req_s
|
||||
{
|
||||
zb_uint8_t endpoint; /*!< The endpoint to which the given group is being removed. */
|
||||
zb_callback_t confirm_cb; /*!< The callback to be called when the operation is completed. */
|
||||
} zb_apsme_remove_all_groups_req_t;
|
||||
|
||||
/** @brief APSME-REMOVE-ALL-GROUPS.confirm primitive parameters. */
|
||||
typedef struct zb_apsme_remove_all_groups_conf_s
|
||||
{
|
||||
zb_uint8_t endpoint; /*!< The endpoint which is to be removed from all groups. */
|
||||
zb_ret_t status; /*!< The status of the request to remove all groups. */
|
||||
} zb_apsme_remove_all_groups_conf_t;
|
||||
|
||||
zb_bool_t zb_aps_is_endpoint_in_group(
|
||||
zb_uint16_t group_id,
|
||||
zb_uint8_t endpoint);
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/** @brief APSME GET request structure. */
|
||||
typedef struct zb_apsme_get_request_s
|
||||
{
|
||||
zb_aps_aib_attr_id_t aib_attr; /*!< The identifier of the AIB attribute to read. */
|
||||
zb_callback_t confirm_cb; /*!< User's callback to be called as APSME-GET.confirm */
|
||||
} zb_apsme_get_request_t;
|
||||
|
||||
/** @brief APSME GET confirm structure. */
|
||||
typedef ZB_PACKED_PRE struct zb_apsme_get_confirm_s
|
||||
{
|
||||
zb_ret_t status; /*!< The results of the request to read an AIB attribute value. */
|
||||
zb_aps_aib_attr_id_t aib_attr; /*!< The identifier of the AIB attribute that was read.*/
|
||||
zb_uint8_t aib_length; /*!< The length, in octets, of the attribute value being returned.*/
|
||||
/* Various */ /* The value of the AIB attribute that was read.*/
|
||||
} ZB_PACKED_STRUCT zb_apsme_get_confirm_t;
|
||||
|
||||
/** @brief APSME SET request structure. */
|
||||
typedef ZB_PACKED_PRE struct zb_apsme_set_request_s
|
||||
{
|
||||
zb_aps_aib_attr_id_t aib_attr; /*!< The identifier of the AIB attribute to be written. */
|
||||
zb_uint8_t aib_length; /*!< The length, in octets, of the attribute value being set. */
|
||||
zb_callback_t confirm_cb; /*!< User's callback to be called as APSME-SET.confirm */
|
||||
/* Various */ /* The value of the AIB attribute that should be written. */
|
||||
} ZB_PACKED_STRUCT zb_apsme_set_request_t;
|
||||
|
||||
/** @brief APSME SET confirm structure. */
|
||||
typedef ZB_PACKED_PRE struct zb_apsme_set_confirm_s
|
||||
{
|
||||
zb_ret_t status; /*!< The result of the request to write the AIB Attribute. */
|
||||
zb_aps_aib_attr_id_t aib_attr; /*!< The identifier of the AIB attribute that was written. */
|
||||
} ZB_PACKED_STRUCT zb_apsme_set_confirm_t;
|
||||
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/**
|
||||
* @brief APSME-BIND.request primitive.
|
||||
* @param param - index of buffer containing request data (see @ref
|
||||
* zb_apsme_binding_req_t).
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_bind_req() instead.
|
||||
*/
|
||||
void zb_apsme_bind_request(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @brief APSME-UNBIND.request primitive.
|
||||
* @param param - index of buffer containing request data (see @ref
|
||||
* zb_apsme_binding_req_t).
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_unbind_req() instead.
|
||||
*/
|
||||
void zb_apsme_unbind_request(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
*@brief Perform unbind all entries. This custom function and it is not described
|
||||
* in Zigbee specification.
|
||||
* @param param - not used.
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_unbind_all_local() instead.
|
||||
*/
|
||||
void zb_apsme_unbind_all(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @brief Checks if the binding with specified parameters exists
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_check_binding_request() instead.
|
||||
*/
|
||||
void zb_aps_check_binding_request(zb_bufid_t param);
|
||||
|
||||
/**
|
||||
* @brief APSME-ADD-GROUP.request primitive.
|
||||
*
|
||||
* @param param - index of buffer with parameter. See @ref zb_apsme_add_group_req_t.
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_add_group_req() instead.
|
||||
*/
|
||||
void zb_apsme_add_group_request(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @brief APSME-REMOVE-GROUP.request primitive.
|
||||
*
|
||||
* @internal
|
||||
* Use macro @ref ZDO_REGISTER_CALLBACK to register APSME-REMOVE-GROUP.confirm callback.
|
||||
* @endinternal
|
||||
* @param param - index of buffer with parameter. See @ref zb_apsme_remove_group_req_t.
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_remove_group_req() instead.
|
||||
*
|
||||
*/
|
||||
void zb_apsme_remove_group_request(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @brief APSME-REMOVE-ALL-GROUPS.request primitive.
|
||||
*
|
||||
* @internal
|
||||
* Use macro @ref ZDO_REGISTER_CALLBACK to register APSME-REMOVE-ALL-GROUPS.confirm callback.
|
||||
* @endinternal
|
||||
* @param param - index of buffer with parameter. See @ref zb_apsme_remove_all_groups_req_t.
|
||||
*
|
||||
* @deprecated This function will be moved to the private header in November 2022. Use @ref
|
||||
* zb_zdo_remove_all_groups_req() instead.
|
||||
*
|
||||
*/
|
||||
void zb_apsme_remove_all_groups_request(zb_uint8_t param);
|
||||
|
||||
/** @} */ /* APS management service data structures and API. */
|
||||
|
||||
/*! @} */ /* aps_api */
|
||||
|
||||
|
||||
#ifdef APS_FRAGMENTATION
|
||||
|
||||
|
||||
void zb_aps_add_max_trans_size(zb_uint16_t short_addr, zb_uint16_t max_trans_size, zb_uint8_t max_buffer_size);
|
||||
zb_uint16_t zb_aps_get_max_trans_size(zb_uint16_t short_addr);
|
||||
zb_uint8_t zb_aps_get_max_buffer_size(zb_uint16_t short_addr);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ZB_APS_USER_PAYLOAD
|
||||
/** @addtogroup aps_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup aps_user_payload APS user payload
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief
|
||||
* Callback to notify an application of sending an APS user payload status
|
||||
*
|
||||
* @param param - index of buffer with an APS user payload
|
||||
*/
|
||||
typedef void (*zb_aps_user_payload_callback_t)(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* @brief NLDE-DATA.indication data callback
|
||||
*
|
||||
* @param[in] param index of buffer with an APS indication
|
||||
*
|
||||
* @return
|
||||
* - true: Processed
|
||||
* - false: Not processed
|
||||
*/
|
||||
typedef zb_bool_t (*zb_aps_indication_data_callback_t)(zb_uint8_t param);
|
||||
|
||||
/*!
|
||||
* @brief
|
||||
* APS user payload transmission status
|
||||
*
|
||||
* Stored in the buf->u.hdr.status field
|
||||
*/
|
||||
typedef enum zb_aps_user_payload_cb_status_e
|
||||
{
|
||||
/*! APS user payload transmission is successful*/
|
||||
ZB_APS_USER_PAYLOAD_CB_STATUS_SUCCESS = (zb_uint8_t)0x00,
|
||||
/* Failed to transmit APS user payload - No confirmation from APS*/
|
||||
ZB_APS_USER_PAYLOAD_CB_STATUS_NO_APS_ACK = (zb_uint8_t)0xbe
|
||||
} zb_aps_user_payload_cb_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Send user payload using APS
|
||||
*
|
||||
* @param param - reference to a buffer
|
||||
* @param dst_addr - destination address
|
||||
* @param profile_id - profile ID for which this frame is intended for
|
||||
* @param cluster_id - object ID for which this frame is intended for
|
||||
* @param dst_endpoint - either the endpoint ID
|
||||
* of the entity to which the ASDU is being
|
||||
* transferred or the broadcast endpoint (0xff)
|
||||
* @param src_endpoint - the individual endpoint of the entity from
|
||||
* which the ASDU is being transferred
|
||||
* @param addr_mode - the type of destination address supplied by
|
||||
* the dst_addr parameter - see @ref aps_addr_mode
|
||||
* @param aps_ack_is_enabled - enable (ZB_TRUE) or disable (ZB_FALSE) APS acknowledging
|
||||
* @param *payload_ptr - pointer to user data
|
||||
* @param payload_size - size of user data; not more than 82 bytes
|
||||
*
|
||||
* @return RET_OK - if transmission was successful scheduled;
|
||||
* @return RET_INVALID_PARAMETER_1 - if the buffer is invalid
|
||||
* @return RET_INVALID_PARAMETER_2 - if the payload_ptr parameter is invalid
|
||||
* @return RET_INVALID_PARAMETER_3 - if the payload_size parameter is too large
|
||||
*/
|
||||
zb_ret_t zb_aps_send_user_payload(
|
||||
zb_uint8_t param,
|
||||
zb_addr_u dst_addr,
|
||||
zb_uint16_t profile_id,
|
||||
zb_uint16_t cluster_id,
|
||||
zb_uint8_t dst_endpoint,
|
||||
zb_uint8_t src_endpoint,
|
||||
zb_uint8_t addr_mode,
|
||||
zb_bool_t aps_ack_is_enabled,
|
||||
zb_uint8_t *payload_ptr,
|
||||
zb_uint8_t payload_size);
|
||||
|
||||
/*!
|
||||
* @brief Get pointer to an APS payload
|
||||
*
|
||||
* @param param - reference to a buffer
|
||||
* @param aps_payload_size - [out] pointer to a variable to store
|
||||
* an APS payload size
|
||||
*
|
||||
* @return Pointer to an APS payload;
|
||||
* @return NULL if a buffer is invalid or an aps_payload_size pointer is invalid.
|
||||
*/
|
||||
zb_uint8_t *zb_aps_get_aps_payload(zb_uint8_t param, zb_uint8_t *aps_payload_size);
|
||||
|
||||
/*!
|
||||
* @brief Set callback to notify results of transmitting
|
||||
* an APS frame with user payload
|
||||
*
|
||||
* @param cb - pointer to a callback
|
||||
*/
|
||||
void zb_aps_set_user_data_tx_cb(zb_aps_user_payload_callback_t cb);
|
||||
|
||||
/**
|
||||
* @brief Set callback to notify information of APS frame
|
||||
*
|
||||
* @param cb - pointer to a callback
|
||||
*/
|
||||
void zb_aps_set_indication_data_rx_cb(zb_aps_indication_data_callback_t cb);
|
||||
|
||||
/*!
|
||||
* @brief Set callback to be called when ZDO command packet is sent.
|
||||
*
|
||||
* That callback is to be used when application wants to know the fact that ZDO
|
||||
* command send is completed.
|
||||
*
|
||||
* Callback provided to ZBOSS ZDO request function (second parameter of
|
||||
* zb_zdo_node_desc_req and similar function) not always can be used for that
|
||||
* purpose. ZBOSS calls ZDO callback immediately when a) unicast transmit of APS
|
||||
* message failed (no ACK) and b) this is ZDO message that does not suppose to
|
||||
* have an answer, like broadcast NWK Update req. In other cases if callback is
|
||||
* set using zb_af_set_zdo_data_conf_cb, it is called when outgoing ZDO command
|
||||
* is sent; callback passed to zb_zdo_node_desc_req and friends is called when
|
||||
* ZBOSS got response/responses to ZDO command, or ZDO command is timed out.
|
||||
*
|
||||
* @param cb - callback. The buffer passed to the callback has zb_apsde_data_confirm_t in parameters section.
|
||||
*/
|
||||
void zb_af_set_zdo_data_conf_cb(zb_callback_t cb);
|
||||
|
||||
/** @} */ /* aps_user_payload */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* #ifdef ZB_APS_USER_PAYLOAD */
|
||||
|
||||
#endif /* #ifndef ZB_ZBOSS_API_APS_H */
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Public APS Inter-Pan API
|
||||
*/
|
||||
|
||||
#ifndef ZBOSS_API_APS_INTERPAN_H
|
||||
#define ZBOSS_API_APS_INTERPAN_H 1
|
||||
|
||||
/** @addtogroup aps_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#if defined ZB_ENABLE_INTER_PAN_EXCHANGE || defined DOXYGEN
|
||||
/** @brief INTRP-DATA.request structure.
|
||||
*
|
||||
* This structure passed to @ref zb_intrp_data_request() in the packet buffer parameter.
|
||||
* @see SE spec, clause B.3.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_intrp_data_req_s
|
||||
{
|
||||
/** @brief The addressing mode for the destination address used in this primitive.
|
||||
*
|
||||
* This parameter can take one of the values from the following list:
|
||||
* @li 0x01 = 16-bit group address
|
||||
* @li 0x02 = 16-bit NWK address, normally the broadcast address 0xffff
|
||||
* @li 0x03 = 64-bit extended address
|
||||
*/
|
||||
zb_uint8_t dst_addr_mode;
|
||||
/** The 16-bit Pan identifier of the entity or entities to which the ASDU is being transferred or
|
||||
* the broadcast Pan ID 0xffff.
|
||||
*/
|
||||
zb_uint16_t dst_pan_id;
|
||||
/** The address of the entity or entities to which the ASDU is being transferred. */
|
||||
zb_addr_u dst_addr;
|
||||
/** The identifier of the application profile for which this frame is intended. */
|
||||
zb_uint16_t profile_id;
|
||||
/** The identifier of the cluster, within the profile specified by the ProfileId parameter, which
|
||||
* defines the application semantics of the ASDU.
|
||||
*/
|
||||
zb_uint16_t cluster_id;
|
||||
/** An integer handle associated with the ASDU to be transmitted. */
|
||||
zb_uint8_t asdu_handle;
|
||||
} ZB_PACKED_STRUCT zb_intrp_data_req_t;
|
||||
#endif /* defined ZB_ENABLE_INTER_PAN_EXCHANGE || defined DOXYGEN */
|
||||
|
||||
/** @brief Valid values for inter-PAN destination address mode.
|
||||
* @see SE spec, subclause B.3.1.
|
||||
*/
|
||||
enum zb_intrp_addr_mode_e
|
||||
{
|
||||
/** 16-bit group address */
|
||||
ZB_INTRP_ADDR_GROUP = 0x01,
|
||||
/** 16-bit NWK address */
|
||||
ZB_INTRP_ADDR_NETWORK = 0x02,
|
||||
/** 64-bit extended device address */
|
||||
ZB_INTRP_ADDR_IEEE = 0x03
|
||||
};
|
||||
|
||||
/** @brief Inter-PAN broadcast short network address */
|
||||
#define ZB_INTRP_BROADCAST_SHORT_ADDR 0xffffU
|
||||
|
||||
/** @brief INTRP-DATA.indication parameters.
|
||||
* @see SE spec, subclause B.3.3.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_intrp_data_ind_s
|
||||
{
|
||||
/** @brief Destination address mode.
|
||||
* Valid values are defined by @ref zb_intrp_addr_mode_e enumeration.
|
||||
*/
|
||||
zb_uint8_t dst_addr_mode;
|
||||
/** @brief Destination Pan identifier.
|
||||
* Should be a valid Pan identifier or a broadcast Pan ID 0xffff.
|
||||
*/
|
||||
zb_uint16_t dst_pan_id;
|
||||
/** @brief Destination address. */
|
||||
zb_addr_u dst_addr;
|
||||
/** @brief Source Pan identifier.
|
||||
* Assumed to be a valid Pan identifier in all cases.
|
||||
*/
|
||||
zb_uint16_t src_pan_id;
|
||||
/** @brief Source device address. */
|
||||
zb_ieee_addr_t src_addr;
|
||||
/** @brief Profile identifier. */
|
||||
zb_uint16_t profile_id;
|
||||
/** @brief Cluster identifier. */
|
||||
zb_uint16_t cluster_id;
|
||||
/** @brief The link quality observed during the reception of the ASDU. */
|
||||
zb_uint8_t link_quality;
|
||||
zb_int8_t rssi;
|
||||
} ZB_PACKED_STRUCT zb_intrp_data_ind_t;
|
||||
|
||||
/** @cond DOXYGEN_APS_INTER_PAN_NON_DEFAULT_CHANNEL_FEATURE */
|
||||
#if defined ZB_ENABLE_INTER_PAN_NON_DEFAULT_CHANNEL || defined DOXYGEN
|
||||
/** @brief A multi-channel INTRP-DATA.confirm representation structure.
|
||||
*/
|
||||
typedef struct zb_mchan_intrp_data_confirm_s
|
||||
{
|
||||
zb_channel_page_t channel_status_page_mask; /*!< Channel Page structure - binary encoded channel page
|
||||
and channels mask as list of channels, indicating on which
|
||||
channels the packet was successfully sent. */
|
||||
zb_uint8_t asdu_handle; /*!< An integer handle associated with the transmitted frame. */
|
||||
} zb_mchan_intrp_data_confirm_t;
|
||||
|
||||
/**
|
||||
* Inter-pan packet handler
|
||||
*
|
||||
* @param param - index of buffer with inter-pan packet command
|
||||
* @param current_page - channel page at which packet was received
|
||||
* @param current_channel - channel at which packet was received
|
||||
* @return status (see @ref zb_bool_t)
|
||||
*/
|
||||
typedef zb_uint8_t (*zb_af_inter_pan_handler_t)(zb_uint8_t param, zb_uint8_t current_page, zb_uint8_t current_channel);
|
||||
|
||||
/** @brief Enable interpan procedure. This allows to send interpan frames at multiple channels
|
||||
* and register handler to receive interpan frames.
|
||||
*/
|
||||
void zboss_enable_interpan_with_chan_change(void);
|
||||
|
||||
/** @brief Make INTRP-DATA request at multiple channels with time given as chan_wait_ms
|
||||
* to wait for response packets. Can be used after zboss_enable_interpan_with_chan_change()
|
||||
* was called.
|
||||
*
|
||||
* Assumes buffer contains data in its main part, and INTRP-DATA.request parameters in buffer's
|
||||
* parameter (represented as @ref zb_intrp_data_req_s structure).
|
||||
* @param buffer - reference (index) of the packet buffer.
|
||||
* @param channel_page_mask - Channel Page structure - binary encoded channel page
|
||||
* and channels mask as list of channels to send packet at.
|
||||
* @param chan_wait_ms - time in milliseconds to wait at channel after the packet is sent.
|
||||
* @param cb - user callback function called after the procedure is finished.
|
||||
* @return Returns RET_OK if procedure has started successfully,
|
||||
* RET_BUSY if procedure is on-going,
|
||||
* RET_ERROR if failed to start or procedure was not enabled,
|
||||
* RET_INVALID_PARAMETER if one of function's arguments is invalid.
|
||||
* @note cb buffer's parameter contains status which can be obtained using @ref zb_buf_get_status
|
||||
* function, RET_OK if packet was successfully sent at at least one channel, RET_ERROR otherwise.
|
||||
* @ref zb_mchan_intrp_data_confirm_t is put as buffer's parameter.
|
||||
* User is to free the buffer in the callback, if no callback is given, buffer is freed internally.
|
||||
*/
|
||||
zb_ret_t zb_intrp_data_request_with_chan_change(zb_bufid_t buffer, zb_channel_page_t channel_page_mask, zb_uint32_t chan_wait_ms, zb_callback_t cb);
|
||||
|
||||
/** @brief Register inter-pan indication callback, called when inter-pan packet is received.
|
||||
* Can be used after zboss_enable_interpan_with_chan_change() was called.
|
||||
*
|
||||
* @param cb - callback function to be called when inter-pan packet is received.
|
||||
* @note If packet is processed in the callback function and no longer shall be processed
|
||||
* by the stack, callback function shall free buffer and return ZB_TRUE. Return ZB_FALSE otherwise.
|
||||
* Buffer has data put in the beginning of the buffer with inter-pan header truncated
|
||||
* and contains @ref zb_intrp_data_ind_t given as buffer's parameter.
|
||||
*/
|
||||
void zb_af_interpan_set_data_indication(zb_af_inter_pan_handler_t cb);
|
||||
#endif /* defined ZB_ENABLE_INTER_PAN_NON_DEFAULT_CHANNEL || defined DOXYGEN */
|
||||
/** @endcond */ /* DOXYGEN_APS_INTER_PAN_NON_DEFAULT_CHANNEL_FEATURE */
|
||||
|
||||
#if defined ZB_ENABLE_INTER_PAN_EXCHANGE || defined DOXYGEN
|
||||
/** @brief Make INTRP-DATA request.
|
||||
*
|
||||
* Assumes buffer contains data in its main part, and INTRP-DATA.request parameters in buffer's
|
||||
* parameter (represented as @ref zb_intrp_data_req_s structure).
|
||||
* @param param - reference (index) of the packet buffer.
|
||||
* @see SE spec, subclause B.5.1.
|
||||
*/
|
||||
void zb_intrp_data_request(zb_uint8_t param);
|
||||
#endif /* defined ZB_ENABLE_INTER_PAN_EXCHANGE || defined DOXYGEN */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* ZBOSS_API_APS_INTERPAN_H */
|
||||
@@ -0,0 +1,728 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Public buffer pool API (new version)
|
||||
*/
|
||||
#ifndef ZBOSS_API_BUF_H
|
||||
#define ZBOSS_API_BUF_H 1
|
||||
|
||||
/*! \addtogroup buf */
|
||||
/*! @{ */
|
||||
|
||||
#include "zboss_api_core.h"
|
||||
|
||||
/*
|
||||
Moved here buffer structure to implement configurable mem without enabling legacy buffers
|
||||
*/
|
||||
|
||||
#define ZB_RESERVED_BUF_TO_ALIGN_HDR_SIZE 1u
|
||||
|
||||
/**
|
||||
Packet buffer header.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_buf_hdr_s
|
||||
{
|
||||
zb_ret_t status; /*!< some status to be passed with packet */
|
||||
zb_uint16_t len; /*!< current layer buffer length */
|
||||
zb_uint16_t data_offset; /*!< data offset in buffer buf*/
|
||||
zb_uint8_t multiplicity; /*!< if greater that 1, then the following (multiplicity - 1) buffers
|
||||
* are occupied with payload data and should not be treated as
|
||||
* having valid headers, etc.
|
||||
*/
|
||||
zb_uint8_t handle; /*!< The handle associated with the NSDU to be
|
||||
* transmitted by the NWK layer entity. */
|
||||
zb_bitfield_t is_in_buf:1; /*!< if 1, this is input buffer */
|
||||
|
||||
zb_bitfield_t encrypt_type:3; /*!< payload must be encrypted before send, if
|
||||
* !0. \see zb_secur_buf_encr_type_e.
|
||||
*/
|
||||
zb_bitfield_t use_same_key:1; /*!< if 1, use same nwk key packet was
|
||||
* encrypted by */
|
||||
zb_bitfield_t zdo_cmd_no_resp:1; /*!< if 1, this is ZDO command with no
|
||||
* response - call callback at confirm */
|
||||
zb_bitfield_t is_rx_buf:1; /*!< if 1, this is buffer with received packet and
|
||||
* nwk_mac_addrs_t is at buffer tail */
|
||||
zb_bitfield_t has_aps_payload:1; /*!< if 1, than packet comes from APS, the flag is needed
|
||||
* to increase APS packets counter in diagnostic data on packet sending
|
||||
*/
|
||||
zb_bitfield_t has_aps_user_payload:1; /*!< if 1, than packet comes with APS user's payload */
|
||||
|
||||
zb_bitfield_t tail_len:7; /*!< the length of the parameters section */
|
||||
|
||||
zb_uint16_t layer; /*!< indicate which layer header has been included in buffer. currently, only the APS layer is flagged */
|
||||
|
||||
zb_uint8_t reserve[2]; /*!< Reserve */
|
||||
} ZB_PACKED_STRUCT zb_buf_hdr_t;
|
||||
|
||||
/* if there is a platform with failed assertion, ZB_RESERVED_BUF_TO_ALIGN_HDR_SIZE
|
||||
should be changed to appropriate value*/
|
||||
ZB_ASSERT_COMPILE_DECL((sizeof(zb_buf_hdr_t) % sizeof(zb_uint32_t)) == 0);
|
||||
|
||||
#ifdef ZB_DEBUG_BUFFERS_EXT
|
||||
#define ZB_LINE_IS_UNDEF 0xFFFFU
|
||||
|
||||
/**
|
||||
Extended buffer debug: tracking buffer access
|
||||
*/
|
||||
|
||||
typedef struct zb_buf_usage_s
|
||||
{
|
||||
/* In most cases zb_time_t is zb_uint32_t.
|
||||
* To save memory we we use zb_uint16_t so store time. */
|
||||
zb_uint16_t time;
|
||||
zb_uint16_t file;
|
||||
zb_uint16_t line;
|
||||
}
|
||||
zb_buf_usage_t;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
Packet buffer
|
||||
*/
|
||||
typedef struct zb_mult_buf_s
|
||||
{
|
||||
#ifdef ZB_BUF_SHIELD
|
||||
zb_uint8_t hdr_signature;
|
||||
#endif
|
||||
/* 07/12/2019 EE CR:MINOR Lagecy code will access u.hdr, so need to keep u as union or structure
|
||||
AN: Legacy code inside ZBOSS will use zb_leg_buf_t instead of zb_mult_buf_t.
|
||||
EE: I mean legacy API for the new bufs implementation.
|
||||
*/
|
||||
zb_buf_hdr_t hdr; /*!< Buffer header, if buffer is used */
|
||||
zb_uint8_t buf[ZB_IO_BUF_SIZE]; /*!< Data*/
|
||||
#ifdef ZB_DEBUG_BUFFERS_EXT
|
||||
zb_buf_usage_t buf_allocation;
|
||||
zb_buf_usage_t buf_usages[ZB_DEBUG_BUFFERS_EXT_USAGES_COUNT];
|
||||
#endif
|
||||
#ifdef ZB_BUF_SHIELD
|
||||
zb_uint8_t tail_signature;
|
||||
#endif
|
||||
} zb_mult_buf_t;
|
||||
|
||||
/**
|
||||
Packet buffer (legacy)
|
||||
*/
|
||||
typedef struct zb_leg_buf_s
|
||||
{
|
||||
#ifdef ZB_BUF_SHIELD
|
||||
zb_uint8_t hdr_signature;
|
||||
#endif
|
||||
union
|
||||
{
|
||||
zb_buf_hdr_t hdr; /*!< Buffer header, if buffer is used */
|
||||
#ifndef ZB_USE_STD_MALLOC
|
||||
struct zb_buf_s *next; /*!< Ref to next free buffer, if buffer is not used*/
|
||||
#endif
|
||||
} u; /*!< Buffer header */
|
||||
#if defined ZB_USE_STD_MALLOC && defined ZB_USE_ALLOC_FOR_PAYLOAD_DATA
|
||||
zb_uint8_t *buf; /*!< Dynamically allocated buffer for payload */
|
||||
#else
|
||||
zb_uint8_t buf[ZB_IO_BUF_SIZE]; /*!< Data*/
|
||||
#endif
|
||||
#ifdef ZB_DEBUG_BUFFERS_EXT
|
||||
zb_buf_usage_t buf_allocation;
|
||||
zb_buf_usage_t buf_usages[ZB_DEBUG_BUFFERS_EXT_USAGES_COUNT];
|
||||
#endif
|
||||
#ifdef ZB_BUF_SHIELD
|
||||
zb_uint8_t tail_signature;
|
||||
#endif
|
||||
} zb_leg_buf_t;
|
||||
|
||||
#ifdef ZB_LEGACY_BUFS
|
||||
typedef zb_leg_buf_t zb_buf_ent_t;
|
||||
#else
|
||||
typedef zb_mult_buf_t zb_buf_ent_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Buffer type (direction)
|
||||
* @anchor buffer_types
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_OUT_BUFFER 0U /*!< Out buffer */
|
||||
#define ZB_IN_BUFFER 1U /*!< In buffer */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for Buffer type (direction).
|
||||
*
|
||||
* Holds one of @ref buffer_types. Kept for backward compatibility as
|
||||
* @ref buffer_types were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_buffer_types_t;
|
||||
|
||||
/**
|
||||
@typedef zb_uint8_t zb_bufid_t
|
||||
Buffer handler
|
||||
*/
|
||||
typedef zb_uint8_t zb_bufid_t;
|
||||
|
||||
#define ZB_BUF_INVALID 0U
|
||||
#define ZB_UNDEFINED_BUFFER 0U
|
||||
|
||||
#ifdef ZB_DEBUG_BUFFERS
|
||||
#define TRACE_PROTO_VOID zb_uint16_t from_file, zb_uint16_t from_line
|
||||
#define TRACE_PROTO TRACE_PROTO_VOID ,
|
||||
#define TRACE_CALL_VOID ZB_TRACE_FILE_ID, __LINE__
|
||||
#define TRACE_CALL TRACE_CALL_VOID ,
|
||||
#define TRACE_FORWARD_VOID from_file, from_line
|
||||
#define TRACE_FORWARD TRACE_FORWARD_VOID ,
|
||||
#else
|
||||
#define TRACE_PROTO_VOID void
|
||||
#define TRACE_PROTO
|
||||
#define TRACE_CALL_VOID
|
||||
#define TRACE_CALL
|
||||
#define TRACE_FORWARD_VOID
|
||||
#define TRACE_FORWARD
|
||||
#endif /* ZB_DEBUG_BUFFERS */
|
||||
|
||||
#ifdef ZB_DEBUG_BUFFERS_EXT
|
||||
void zb_trace_bufs_usage(void);
|
||||
#define ZB_TRACE_BUFS_USAGE() zb_trace_bufs_usage()
|
||||
#else
|
||||
#define ZB_TRACE_BUFS_USAGE()
|
||||
#endif
|
||||
|
||||
/** @cond internals_doc */
|
||||
zb_bufid_t zb_buf_get_func(TRACE_PROTO zb_bool_t is_in, zb_uint_t max_size);
|
||||
zb_bufid_t zb_buf_get_out_func(TRACE_PROTO_VOID);
|
||||
zb_bufid_t zb_buf_get_any_func(TRACE_PROTO_VOID);
|
||||
zb_bufid_t zb_buf_get_hipri_func(TRACE_PROTO zb_bool_t is_in);
|
||||
zb_uint_t zb_buf_get_max_size_func(TRACE_PROTO zb_bufid_t buf);
|
||||
zb_ret_t zb_buf_get_out_delayed_func(TRACE_PROTO zb_callback_t callback);
|
||||
zb_ret_t zb_buf_get_in_delayed_func(TRACE_PROTO zb_callback_t callback);
|
||||
zb_ret_t zb_buf_get_out_delayed_ext_func(TRACE_PROTO zb_callback2_t callback, zb_uint16_t arg, zb_uint_t max_size);
|
||||
zb_ret_t zb_buf_get_in_delayed_ext_func(TRACE_PROTO zb_callback2_t callback, zb_uint16_t arg, zb_uint_t max_size);
|
||||
void zb_buf_free_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void* zb_buf_begin_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void* zb_buf_end_func(TRACE_PROTO zb_bufid_t buf);
|
||||
zb_uint_t zb_buf_len_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void zb_buf_copy_func(TRACE_PROTO zb_bufid_t dst_buf, zb_bufid_t src_buf);
|
||||
void *zb_buf_initial_alloc_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void *zb_buf_reuse_func(TRACE_PROTO zb_bufid_t buf);
|
||||
zb_uint_t zb_buf_get_ptr_off_func(TRACE_PROTO zb_bufid_t buf, zb_uint8_t *ptr);
|
||||
void *zb_buf_alloc_tail_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void *zb_buf_get_tail_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void zb_buf_cut_right_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void *zb_buf_cut_left_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void *zb_buf_alloc_right_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
void *zb_buf_alloc_left_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t size);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Synchronous buffer allocation.
|
||||
If no buffers available, does not block.
|
||||
Note: this is low-level API. Usually user calls blocked alloc API.
|
||||
|
||||
@param is_in if ZB_TRUE, allocate IN buffer, else allocate OUT buffer
|
||||
@param max_size required maximum buffer payload size (in bytes). It can be bigger or smaller than
|
||||
the default buffer size. Depending on the specific value, the buffer pool may decide to use
|
||||
a fraction of buffer or long buffers. Special value 0 means "single default buffer".
|
||||
@return buffer ID or ZB_BUF_INVALID if no buffers available
|
||||
*/
|
||||
#define zb_buf_get(is_in,max_size) zb_buf_get_func(TRACE_CALL (is_in), (max_size))
|
||||
|
||||
/**
|
||||
Allocate OUT buffer of the default size.
|
||||
*/
|
||||
#define zb_buf_get_out() zb_buf_get_out_func(TRACE_CALL_VOID)
|
||||
|
||||
/**
|
||||
Allocate IN or OUT buffer balancing @ of allocated IN and OUT
|
||||
|
||||
To be used at ZBOSS init time.
|
||||
*/
|
||||
#define zb_buf_get_any() zb_buf_get_any_func(TRACE_CALL_VOID)
|
||||
|
||||
/**
|
||||
Synchronous allocation of the high-priority buffer
|
||||
*/
|
||||
#define zb_buf_get_hipri(a) zb_buf_get_hipri_func(TRACE_CALL (a))
|
||||
|
||||
/**
|
||||
Return maximum data size for that buffer.
|
||||
*/
|
||||
#define zb_buf_get_max_size(a) zb_buf_get_max_size_func(TRACE_CALL (a))
|
||||
|
||||
/**
|
||||
* @brief Allocate OUT buffer, call a callback when the buffer is available.
|
||||
*
|
||||
* Use default buffer size _func(alloc single standard buffer).
|
||||
* If buffer is available, schedules callback for execution immediately. If no buffers are available now,
|
||||
* schedule callback later, when buffer will be available.
|
||||
*
|
||||
* @param callback - callback to call.
|
||||
* @return RET_OK or error code.
|
||||
*/
|
||||
#ifndef zb_buf_get_out_delayed
|
||||
#define zb_buf_get_out_delayed(callback) zb_buf_get_out_delayed_func(TRACE_CALL (callback))
|
||||
#endif /* zb_buf_get_out_delayed */
|
||||
|
||||
/**
|
||||
* @brief Allocate IN buffer, call a callback when the buffer is available.
|
||||
*
|
||||
* Use default buffer size _func(alloc single standard buffer).
|
||||
* If buffer is available, schedules callback for execution immediately. If no buffers are available now,
|
||||
* schedule callback later, when buffer will be available.
|
||||
*
|
||||
* @param callback - callback to call.
|
||||
* @return RET_OK or error code.
|
||||
*/
|
||||
#ifndef zb_buf_get_in_delayed
|
||||
#define zb_buf_get_in_delayed(callback) zb_buf_get_in_delayed_func(TRACE_CALL (callback))
|
||||
#endif /* zb_buf_get_in_delayed */
|
||||
|
||||
/**
|
||||
* @brief Allocate OUT buffer, call a callback when the buffer is available.
|
||||
*
|
||||
* If buffer is available, schedules callback for execution immediately. If no buffers are available now,
|
||||
* schedule callback later, when buffer will be available.
|
||||
*
|
||||
* @param callback - callback to call.
|
||||
* @param arg - second argument for a callback
|
||||
* @param max_size - required maximum buffer payload size (in bytes). The buffer payload size
|
||||
* is the sum of both data and parameters, so the max_size parameter should
|
||||
* reflect this. It can be bigger or smaller than the default buffer size.
|
||||
* Depending on the specific value, the buffer pool may decide to use a fraction
|
||||
* of buffer or long buffers. If the value is set to 0, the payload size will be equal
|
||||
* to the size of a single default buffer.
|
||||
* @return RET_OK if allocation has successfully scheduled.
|
||||
* RET_ERROR if there is no room to schedule buffer allocation.
|
||||
* RET_OUT_OF_RANGE if buffer with such payload size can't be allocated.
|
||||
*/
|
||||
#ifndef zb_buf_get_out_delayed_ext
|
||||
#define zb_buf_get_out_delayed_ext(callback,arg,max_size) zb_buf_get_out_delayed_ext_func(TRACE_CALL (callback),(arg),(max_size))
|
||||
#endif /* zb_buf_get_out_delayed_ext */
|
||||
|
||||
/**
|
||||
* @brief Allocate IN buffer, call a callback when the buffer is available.
|
||||
*
|
||||
* If buffer is available, schedules callback for execution immediately. If no buffers are available now,
|
||||
* schedule callback later, when buffer will be available.
|
||||
*
|
||||
* @param callback - callback to call.
|
||||
* @param arg - second argument for a callback
|
||||
* @param max_size required maximum buffer payload size (in bytes). The buffer payload size
|
||||
* is the sum of both data and parameters, so the max_size parameter should
|
||||
* reflect this. It can be bigger or smaller than the default buffer size.
|
||||
* Depending on the specific value, the buffer pool may decide to use a fraction
|
||||
* of buffer or long buffers. If the value is set to 0, the payload size will be equal
|
||||
* to the size of a single default buffer.
|
||||
* @return RET_OK if allocation has successfully scheduled.
|
||||
* RET_ERROR if there is no room to schedule buffer allocation.
|
||||
* RET_OUT_OF_RANGE if buffer with such payload size can't be allocated.
|
||||
*/
|
||||
#ifndef zb_buf_get_in_delayed_ext
|
||||
#define zb_buf_get_in_delayed_ext(callback,arg,max_size) zb_buf_get_in_delayed_ext_func(TRACE_CALL (callback),(arg),(max_size))
|
||||
#endif /* zb_buf_get_in_delayed_ext */
|
||||
|
||||
/**
|
||||
* @brief Free packet buffer and put it into free list.
|
||||
*
|
||||
* Can be called from the main loop.
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
*
|
||||
*/
|
||||
#define zb_buf_free(buf) zb_buf_free_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
* Return pointer to data stored in buffer
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
*
|
||||
* @return pointer to beginning of data in buffer
|
||||
*
|
||||
*/
|
||||
#define zb_buf_begin(buf) zb_buf_begin_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Return pointer to the data section end
|
||||
|
||||
@param buf - buffer ID
|
||||
|
||||
@return pointer to the first byte after data in the buffer
|
||||
*/
|
||||
#define zb_buf_end(buf) zb_buf_end_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
* Return current buffer length
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
*
|
||||
* @return size of data placed in buffer
|
||||
*/
|
||||
#define zb_buf_len(buf) zb_buf_len_func(TRACE_CALL (buf))
|
||||
|
||||
|
||||
/**
|
||||
Copy one buffer to another
|
||||
|
||||
@param src_buf - source buffer
|
||||
@param dst_buf - destination buffer
|
||||
*/
|
||||
#define zb_buf_copy(dst_buf,src_buf) zb_buf_copy_func(TRACE_CALL (dst_buf),(src_buf))
|
||||
|
||||
/**
|
||||
@brief Initial data space allocation in buffer.
|
||||
|
||||
Allocate space in the buffer center (keep space in both buffer head
|
||||
and tail). Use it at upper layers before filling buffer by data.
|
||||
Old buffer contents is lost.
|
||||
|
||||
@param buf - buffer ID
|
||||
@param size - size to allocate
|
||||
@return pointer to buffer data begin
|
||||
*/
|
||||
#define zb_buf_initial_alloc(buf,size) zb_buf_initial_alloc_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
Reuse buffer data space by setting data start and length to 0 and zeroing buffer contents
|
||||
|
||||
@param buf - buffer ID
|
||||
|
||||
@return pointer to the buf data buffer begin
|
||||
*/
|
||||
#define zb_buf_reuse(buf) zb_buf_reuse_func(TRACE_CALL (buf))
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Calculate distance between ptr and buffer's data buffer start.
|
||||
|
||||
That function used internally in ZCL. It is not recommended to be used by the application.
|
||||
|
||||
@param buf - buffer ID
|
||||
@param ptr - user's ptr inside the buffer
|
||||
|
||||
@return offset between ptr and buffer start returned by zb_buf_reuse()
|
||||
*/
|
||||
#define zb_buf_get_ptr_off(buf,ptr) zb_buf_get_ptr_off_func(TRACE_CALL (buf),(ptr))
|
||||
/** @endcond */ /* internals_doc */
|
||||
/**
|
||||
Alloc buffer tail of size 'size', initialize by zero.
|
||||
|
||||
Usually used to place external information (some parameters) to the buffer.
|
||||
|
||||
@param buf - buffer ID
|
||||
@param size - requested size. Must met already allocated size.
|
||||
|
||||
@return pointer to the buffer tail or NULL is buffer has no parameter of such size.
|
||||
*/
|
||||
#define zb_buf_alloc_tail(buf,size) zb_buf_alloc_tail_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
Get or allocate buffer tail of size 'size'. Do not initialize.
|
||||
|
||||
Usually used to get or place external information (some parameters) to the buffer.
|
||||
|
||||
@param buf - buffer ID
|
||||
@param size - requested size
|
||||
|
||||
@return pointer to the buffer tail
|
||||
*/
|
||||
#define zb_buf_get_tail(buf,size) zb_buf_get_tail_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
Get buffer tail of size sizeof(type)
|
||||
|
||||
Usually used to place external information _func(some parameters) to the buffer
|
||||
|
||||
@param[in] buf - buffer ID
|
||||
@param[in] type - data type that will be placed at the buffer end
|
||||
|
||||
@return pointer to the buffer tail casted to _func(type*)
|
||||
|
||||
@b Example
|
||||
@snippet linky_sample/erl_gw/erl_gw.c zb_buf_get_param_snippet
|
||||
*/
|
||||
/* Note: MISRA C-STAT analysis gives false positive for rule 20.7 violation on ZB_BUF_GET_PARAM()
|
||||
* due to missing parenthesis around "type" on pointer type cast. This is a misinterpretation
|
||||
* of the rule by C-STAT tool, since this rule refers only to expressions, and not data type casts
|
||||
* like it is used here. */
|
||||
#define ZB_BUF_GET_PARAM(buf, type) ((type *)zb_buf_get_tail_func(TRACE_CALL (buf), sizeof(type)))
|
||||
|
||||
/**
|
||||
* Cut space at the end of buffer
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
* @param size - size to cut
|
||||
*/
|
||||
#define zb_buf_cut_right(buf,size) zb_buf_cut_right_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
* Cut space at the beginning of buffer
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
* @param size - size to cut
|
||||
* @return pointer to the new data begin
|
||||
*/
|
||||
#define zb_buf_cut_left(buf,size) zb_buf_cut_left_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
* Allocate space at buffer end
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
* @param size - size to allocate
|
||||
* @return pointer to allocated data data begin
|
||||
*/
|
||||
#define zb_buf_alloc_right(buf,size) zb_buf_alloc_right_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
* Allocate space at the beginning of buffer
|
||||
*
|
||||
* @param buf - buffer ID
|
||||
* @param size - size to allocate
|
||||
* @return pointer to new data begin
|
||||
*/
|
||||
#define zb_buf_alloc_left(buf,size) zb_buf_alloc_left_func(TRACE_CALL (buf),(size))
|
||||
|
||||
/**
|
||||
* @name Buffer's internals flags bitmask
|
||||
* @anchor buf_flags_bm
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_BUF_SECUR_NO_ENCR 0U /*!< No encryption */
|
||||
#define ZB_BUF_IS_IN (1U << 0)
|
||||
/* Encrypt flags. That enum is actually bitmask. */
|
||||
#define ZB_BUF_SECUR_NWK_ENCR (1U << 1) /*!< NWK frame encryption */
|
||||
#define ZB_BUF_SECUR_APS_ENCR (1U << 2) /*!< APS encryption. Analyze APS header to define which key to use */
|
||||
#define ZB_BUF_SECUR_MAC_ENCR (1U << 3) /*!< MAC encryption - for 802.15.4 certification only */
|
||||
#define ZB_BUF_SECUR_ALL_ENCR (ZB_BUF_SECUR_NWK_ENCR | ZB_BUF_SECUR_APS_ENCR | ZB_BUF_SECUR_MAC_ENCR)
|
||||
#define ZB_BUF_USE_SAME_KEY (1U << 4)
|
||||
#define ZB_BUF_ZDO_CMD_NO_RESP (1U << 5)
|
||||
#define ZB_BUF_HAS_APS_PAYLOAD (1U << 6) /*!< Flag to indicate whether the buffer contains any APS payload */
|
||||
#define ZB_BUF_HAS_APS_USER_PAYLOAD (1U << 7) /*!< Flag to indicate whether the buffer contains APS user payload */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for buffer's internals flags bitmask.
|
||||
*
|
||||
* @deprecated holds one of @ref buf_flags_bm. Kept only for backward compatibility as
|
||||
* @ref buf_flags_bm were declared previously as enum. Can be removed in future releases.
|
||||
*/
|
||||
typedef zb_uint8_t zb_buf_flags_bm_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
void zb_buf_flags_or_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t val);
|
||||
void zb_buf_flags_clr_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t mask);
|
||||
void zb_buf_flags_clr_encr_func(TRACE_PROTO zb_bufid_t buf);
|
||||
zb_uint_t zb_buf_flags_get_func(TRACE_PROTO zb_bufid_t buf);
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
Add bits to the buffer's flags
|
||||
|
||||
@param buf - buffer ID
|
||||
@param val - value to be ORed with buffer' flags
|
||||
*/
|
||||
#define zb_buf_flags_or(buf,val) zb_buf_flags_or_func(TRACE_CALL (buf),(val))
|
||||
|
||||
/**
|
||||
Clear buffer' flags by mask by doing flags = flags & ~mask
|
||||
|
||||
@param buf - buffer ID
|
||||
@param mask - value to be cleared from the flags - @see @ref buf_flags_bm
|
||||
*/
|
||||
#define zb_buf_flags_clr(buf,mask) zb_buf_flags_clr_func(TRACE_CALL (buf),(mask))
|
||||
|
||||
|
||||
/**
|
||||
Clear buffer's flags related to encryption
|
||||
|
||||
That function calls zb_buf_flags_clr(buf, ZB_BUF_SECUR_ALL_ENCR)
|
||||
@param buf - buffer ID
|
||||
*/
|
||||
#define zb_buf_flags_clr_encr(buf) zb_buf_flags_clr_encr_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Get buffer's flags byte
|
||||
|
||||
@param buf - buffer ID
|
||||
@return flags value - @see @ref buf_flags_bm
|
||||
*/
|
||||
#define zb_buf_flags_get(buf) zb_buf_flags_get_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Check if buffer pool is in Out Of Memory (OOM) state
|
||||
|
||||
@return ZB_TRUE if ZBOSS is in OOM state
|
||||
*/
|
||||
zb_bool_t zb_buf_is_oom_state(void);
|
||||
|
||||
#ifdef ZB_TRACE_LEVEL
|
||||
/**
|
||||
Trace buffer statistics into ZBOSS trace
|
||||
*/
|
||||
void zb_buf_oom_trace(void);
|
||||
#endif /* ZB_TRACE_LEVEL */
|
||||
|
||||
#ifdef ZB_REDUCE_NWK_LOAD_ON_LOW_MEMORY
|
||||
/**
|
||||
Check if buffer pool is close to Out Of Memory (OOM) state
|
||||
|
||||
@return ZB_TRUE if ZBOSS is nearly in OOM state
|
||||
*/
|
||||
zb_bool_t zb_buf_memory_close_to_low(void);
|
||||
#endif /* ZB_REDUCE_NWK_LOAD_ON_LOW_MEMORY */
|
||||
|
||||
/**
|
||||
Check if buffer pool is close to Out Of Memory (OOM) state
|
||||
|
||||
@return ZB_TRUE if ZBOSS is nearly in OOM state
|
||||
*/
|
||||
zb_bool_t zb_buf_memory_low(void);
|
||||
|
||||
/** @cond internals_doc */
|
||||
zb_ret_t zb_buf_get_status_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void zb_buf_set_status_func(TRACE_PROTO zb_bufid_t buf, zb_ret_t status);
|
||||
zb_uint8_t zb_buf_get_handle_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void zb_buf_set_handle_func(TRACE_PROTO zb_bufid_t buf, zb_uint8_t handle);
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
Get 'status' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@return status field value
|
||||
*/
|
||||
#define zb_buf_get_status(buf) zb_buf_get_status_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Set 'status' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@param status - new status field value
|
||||
*/
|
||||
#define zb_buf_set_status(buf,status) zb_buf_set_status_func(TRACE_CALL (buf), (zb_ret_t)(status))
|
||||
|
||||
/**
|
||||
Get 'handle' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@return handle field value
|
||||
*/
|
||||
#define zb_buf_get_handle(buf) zb_buf_get_handle_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Set 'handle' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@param handle - 'handle' field value
|
||||
*/
|
||||
#define zb_buf_set_handle(buf,handle) zb_buf_set_handle_func(TRACE_CALL (buf),(handle))
|
||||
|
||||
/**
|
||||
Set or reset "mac needs more buffers" flag.
|
||||
|
||||
To be used internally by ZBOSS.
|
||||
|
||||
@param needs - new "mac needs more buffers" flag value
|
||||
*/
|
||||
void zb_buf_set_mac_rx_need(zb_bool_t needs);
|
||||
|
||||
/**
|
||||
Get "mac needs more buffers" flag.
|
||||
|
||||
To be used internally by ZBOSS.
|
||||
|
||||
@return "mac needs more buffers" flag value
|
||||
*/
|
||||
zb_bool_t zb_buf_get_mac_rx_need(void);
|
||||
|
||||
zb_bool_t zb_buf_have_rx_bufs(void);
|
||||
|
||||
/**
|
||||
* @name Buffer's layer header bitmask
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_BUF_LAYER_NONE (0U) /*!< Buffer without any Zigbee headers */
|
||||
#define ZB_BUF_LAYER_PHY (1U << 0) /*!< Buffer contains PHY header */
|
||||
#define ZB_BUF_LAYER_MAC (1U << 1) /*!< Buffer contains MAC header */
|
||||
#define ZB_BUF_LAYER_NWK (1U << 2) /*!< Buffer contains NWK header */
|
||||
#define ZB_BUF_LAYER_APS (1U << 3) /*!< Buffer contains APS header */
|
||||
#define ZB_BUF_LAYER_ZCL (1U << 4) /*!< Buffer contains ZCL header */
|
||||
#define ZB_BUF_LAYER_ZLL (1U << 5) /*!< Buffer contains ZLL header */
|
||||
#define ZB_BUF_LAYER_ZGP (1U << 6) /*!< Buffer contains ZGP header */
|
||||
#define ZB_BUF_LAYER_APP (1U << 7) /*!< Buffer contains APP header */
|
||||
/** @} */
|
||||
|
||||
/** @cond internals_doc */
|
||||
zb_uint_t zb_buf_layer_get_func(TRACE_PROTO zb_bufid_t buf);
|
||||
void zb_buf_layer_or_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t mask);
|
||||
void zb_buf_layer_clr_func(TRACE_PROTO zb_bufid_t buf, zb_uint_t mask);
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
Get 'layer' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@return layer field value
|
||||
*/
|
||||
#define zb_buf_layer_get(buf) zb_buf_layer_get_func(TRACE_CALL (buf))
|
||||
|
||||
/**
|
||||
Or mask to 'layer' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@param mask - value will be add to the 'layer' field
|
||||
*/
|
||||
#define zb_buf_layer_or(buf,mask) zb_buf_layer_or_func(TRACE_CALL (buf), (mask))
|
||||
|
||||
/**
|
||||
Clear mask from 'layer' field of the buffer's header
|
||||
|
||||
@param buf - buffer ID
|
||||
@param mask - value will be clear from the 'layer' field
|
||||
*/
|
||||
#define zb_buf_layer_clr(buf,mask) zb_buf_layer_clr_func(TRACE_CALL (buf), (mask))
|
||||
|
||||
#define ZB_BUF_COPY_FLAG_APS_PAYLOAD(dst, src) \
|
||||
do { \
|
||||
if ((zb_buf_flags_get((src)) & ZB_BUF_HAS_APS_PAYLOAD) != 0U) \
|
||||
{ \
|
||||
zb_buf_flags_or((dst), ZB_BUF_HAS_APS_PAYLOAD); \
|
||||
\
|
||||
if ((zb_buf_flags_get((src)) & ZB_BUF_HAS_APS_USER_PAYLOAD) != 0U)\
|
||||
{ \
|
||||
zb_buf_flags_or((dst), ZB_BUF_HAS_APS_USER_PAYLOAD); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif /* ZBOSS_API_BUF_H */
|
||||
@@ -0,0 +1,557 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS core API header. Time, scheduler and memory buffers API.
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZBOSS_API_CORE_H
|
||||
#define ZB_ZBOSS_API_CORE_H 1
|
||||
|
||||
#include "zb_vendor.h"
|
||||
#include "zb_config.h"
|
||||
#include "zb_types.h"
|
||||
#include "zb_errors.h"
|
||||
|
||||
/* zb_callback_t is used in osif if we have serial API */
|
||||
/*! \addtogroup sched */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* Callback function typedef.
|
||||
* Callback is function planned to execute by another function.
|
||||
*
|
||||
* @param param - callback parameter - usually, but not always, ref to packet buf
|
||||
*
|
||||
*/
|
||||
typedef void (ZB_CODE * zb_callback_t)(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* Callback function with 2 parameters typedef.
|
||||
* Callback is function planned to execute by another function.
|
||||
*
|
||||
* @param param - callback parameter - usually, but not always, ref to packet buf
|
||||
* @param cb_param - additional 2-byte callback parameter, user data.
|
||||
*
|
||||
*/
|
||||
typedef void (ZB_CODE * zb_callback2_t)(zb_uint8_t param, zb_uint16_t cb_param);
|
||||
/*! @} */
|
||||
|
||||
|
||||
/*! \addtogroup time */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
\par Timer functionality.
|
||||
|
||||
The idea is: platform has some timer which can be stopped or run.
|
||||
When run, it increments (or decrements - depends on platform) some counter
|
||||
until counter overflow (underflow), then issues interrupt - wakeups main loop
|
||||
if it sleeping.
|
||||
Time stored in ticks; time resolution is platform dependent, its usual value
|
||||
is 15.36 usec - 1 beacon interval.
|
||||
@note Time type has limited capacity (usually 16 bits) and can overflow.
|
||||
Macros which works with time handles overflow. It is supposed that time values will
|
||||
not differ to more then 1/2 of the maximum time value.
|
||||
|
||||
All that timer macros will not be used directly by the application code - it
|
||||
is scheduler internals. The only API for timer is ZB_SCHEDULE_ALARM() call.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
Timer type.
|
||||
*/
|
||||
|
||||
typedef zb_uint64_t zb_time_t;
|
||||
/**
|
||||
* Maximum timer value, if 64-bit timer is used.
|
||||
*/
|
||||
#define ZB_MAX_TIME_VAL ZB_UINT64_MAX
|
||||
/**
|
||||
* Minimum timer value, if 64-bit timer is used.
|
||||
*/
|
||||
#define ZB_MIN_TIME_VAL ZB_UINT64_MIN
|
||||
|
||||
/**
|
||||
* A half of defined maximum timer value.
|
||||
*/
|
||||
#define ZB_HALF_MAX_TIME_VAL (ZB_MAX_TIME_VAL / 2U)
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
* @copydoc ZB_TIMER_GET()
|
||||
*
|
||||
* @note Don't call directly, use @ref ZB_TIMER_GET() instead
|
||||
*/
|
||||
zb_time_t zb_timer_get(void);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
* @return Get current timer value (system timer intervals)
|
||||
*/
|
||||
#define ZB_TIMER_GET() (zb_timer_get())
|
||||
|
||||
/**
|
||||
Time subtraction: subtract 'b' from 'a'
|
||||
|
||||
Take overflow into account: change sign (subtraction order) if result >
|
||||
values_diapason/2.
|
||||
Suppose a always >= b, so result is never negative.
|
||||
This macro will be used to calculate, for example, amount of time to sleep
|
||||
- it is positive by definition.
|
||||
Do not use it to compare time values! Use ZB_TIME_GE() instead.
|
||||
@note Both a and b is of type @ref zb_time_t. Can't decrease time (subtract
|
||||
constant from it) using this macro.
|
||||
|
||||
@param a - time to subtract from
|
||||
@param b - time to subtract
|
||||
@return subtraction result
|
||||
*/
|
||||
#define ZB_TIME_SUBTRACT(a, b) ((zb_time_t)((a) - (b)) < ZB_HALF_MAX_TIME_VAL ? (zb_time_t)((a) - (b)) : (zb_time_t)((b) - (a)))
|
||||
|
||||
/**
|
||||
Time add: add 'a' to 'b'
|
||||
|
||||
Overflow is possible, but this is ok - it handled by subtraction and compare macros.
|
||||
|
||||
@param a - time to add to
|
||||
@param b - value to add
|
||||
@return addition result
|
||||
*/
|
||||
#define ZB_TIME_ADD(a, b) (zb_time_t)((a) + (b))
|
||||
|
||||
/**
|
||||
Compare times a and b - check that a >= b
|
||||
|
||||
Taking into account overflow and unsigned values arithmetic and supposing
|
||||
difference between a and b can't be > 1/2 of the overall time values
|
||||
diapason,
|
||||
a >= b only if a - b < values_diapason/2
|
||||
|
||||
@param a - first time value to compare
|
||||
@param b - second time value to compare
|
||||
@return 1 is a >= b, 0 otherwise
|
||||
*/
|
||||
#define ZB_TIME_GE(a, b) ((zb_time_t)((a) - (b)) < ZB_HALF_MAX_TIME_VAL)
|
||||
|
||||
|
||||
/**
|
||||
One second timeout
|
||||
*/
|
||||
#define ZB_TIME_ONE_SECOND ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL(1000U)
|
||||
|
||||
/**
|
||||
Convert time from milliseconds to system timer intervals. Round the result up.
|
||||
*/
|
||||
#define ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL_CEIL(ms) (((zb_time_t)(ms) * 1000U))
|
||||
|
||||
/**
|
||||
Convert time from milliseconds to system timer intervals. Round the result down.
|
||||
*/
|
||||
#define ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL_FLOOR(ms) ((zb_time_t)(ms) * 1000U)
|
||||
|
||||
/**
|
||||
Convert time from milliseconds to system timer intervals.
|
||||
*/
|
||||
#define ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL(ms) ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL_CEIL(ms)
|
||||
|
||||
/**
|
||||
* Beacon interval in microseconds
|
||||
*
|
||||
* 1 beacon interval = aBaseSuperframeDuration * symbol duration
|
||||
*
|
||||
* 1 symbol = 16e-6 sec (mac spec 6.5.3.2 Symbol rate) for 2.4GHz ZB.
|
||||
* 1 beacon interval = 15.360 ms.
|
||||
*/
|
||||
#define ZB_BEACON_INTERVAL (ZB_SYMBOL_DURATION_USEC * ZB_ABASE_SUPERFRAME_DURATION)
|
||||
|
||||
#define ZB_SYS_TIMER_INTERVAL_TO_MSEC(t) ((zb_time_t)(t) / 1000U)
|
||||
|
||||
/**
|
||||
Convert time from system timer intervals to microseconds
|
||||
|
||||
*/
|
||||
#define ZB_SYS_TIMER_INTERVAL_TO_USEC(t) ((zb_time_t)(t))
|
||||
|
||||
/**
|
||||
Quarterseconds timeout
|
||||
*/
|
||||
#define ZB_SYS_TIMER_QUARTERECONDS(n) (ZB_SYS_TIMER_INTERVAL_TO_MSEC((n)) / 250U)
|
||||
|
||||
/**
|
||||
Convert from msec to quarterseconds
|
||||
*/
|
||||
#define ZB_MSEC_TO_QUARTERECONDS(n) ((n) / 250U)
|
||||
|
||||
/**
|
||||
Convert from quarterseconds to msec
|
||||
*/
|
||||
#define ZB_QUARTERECONDS_TO_MSEC(n) 250UL*(n)
|
||||
|
||||
/**
|
||||
Convert from quarterseconds to system timer interval
|
||||
*/
|
||||
#define ZB_QUARTERECONDS_TO_SYS_TIMER_INTERVAL(qsec) ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL(250U * (qsec))
|
||||
|
||||
/**
|
||||
* Convert from seconds to milliseconds
|
||||
*/
|
||||
#define ZB_SECONDS_TO_MILLISECONDS(_s) (1000ul*(_s))
|
||||
|
||||
/**
|
||||
Convert from seconds to system timer interval
|
||||
|
||||
This macro works correctly on 64-bit platform.
|
||||
The calculation was not tested on 16-bit platforms.
|
||||
*/
|
||||
#define ZB_SECONDS_TO_SYS_TIMER_INTERVAL(_s) ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL(1000UL * (_s))
|
||||
|
||||
/**
|
||||
Convert from milliseconds to microseconds
|
||||
*/
|
||||
#define ZB_MILLISECONDS_TO_USEC(ms) ((ms) * (1000u))
|
||||
|
||||
/**
|
||||
Convert from microseconds to milliseconds
|
||||
*/
|
||||
#define ZB_USECS_TO_MILLISECONDS(usec) ((usec) / (1000u))
|
||||
|
||||
/*! @} */
|
||||
|
||||
#include "zb_osif.h"
|
||||
#include "zb_debug.h"
|
||||
#include "zb_trace.h"
|
||||
|
||||
#include "zb_pooled_list.h"
|
||||
|
||||
/*! \addtogroup sched */
|
||||
/*! @{ */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** Schedule single-param callback execution.
|
||||
(use ZB_SCHEDULE_APP_CALLBACK() macro instead of this function).
|
||||
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
@param func - function to execute
|
||||
@param param - callback parameter - usually, but not always ref to packet buffer
|
||||
|
||||
@return RET_OK or error code.
|
||||
|
||||
*/
|
||||
zb_ret_t zb_schedule_app_callback(zb_callback_t func, zb_uint8_t param);
|
||||
/** @endcond */ /* internals_doc */
|
||||
/**
|
||||
Schedule single-param callback execution.
|
||||
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
@param func - function to execute
|
||||
@param param - callback parameter - usually, but not always ref to packet buffer
|
||||
|
||||
@return RET_OK or RET_OVERFLOW.
|
||||
|
||||
*/
|
||||
#ifndef ZB_SCHEDULE_APP_CALLBACK
|
||||
#define ZB_SCHEDULE_APP_CALLBACK(func, param) zb_schedule_app_callback(func, param)
|
||||
#endif /* ZB_SCHEDULE_APP_CALLBACK */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** Schedule two-param callback execution.
|
||||
(use ZB_SCHEDULE_APP_CALLBACK2() macro instead of this function).
|
||||
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
@param func - function to execute
|
||||
@param param - callback parameter - usually, but not always ref to packet buffer
|
||||
@param user_param - zb_uint16_t user parameter - usually, but not always short address
|
||||
|
||||
@return RET_OK or error code.
|
||||
*/
|
||||
zb_ret_t zb_schedule_app_callback2(zb_callback2_t func, zb_uint8_t param, zb_uint16_t user_param);
|
||||
/** @endcond */ /* internals_doc */
|
||||
/**
|
||||
Schedule two-param callback execution.
|
||||
Schedule execution of function `func' in the main scheduler loop.
|
||||
|
||||
@param func - function to execute
|
||||
@param param - zb_uint8_t callback parameter - usually, but not always ref to
|
||||
packet buffer
|
||||
@param user_param - zb_uint16_t user parameter - usually, but not always short address
|
||||
|
||||
@return RET_OK or RET_OVERFLOW.
|
||||
*/
|
||||
#ifndef ZB_SCHEDULE_APP_CALLBACK2
|
||||
#define ZB_SCHEDULE_APP_CALLBACK2(func, param, user_param) zb_schedule_app_callback2(func, param, user_param)
|
||||
#endif /* ZB_SCHEDULE_APP_CALLBACK2 */
|
||||
|
||||
/** @cond internals_doc */
|
||||
zb_ret_t zb_schedule_app_alarm(zb_callback_t func, zb_uint8_t param, zb_time_t run_after);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Schedule alarm - callback to be executed after timeout.
|
||||
|
||||
Function will be called via scheduler after timeout expired (maybe, plus some
|
||||
additional time).
|
||||
Timer resolution depends on implementation.
|
||||
Same callback can be scheduled for execution more then once.
|
||||
|
||||
@param func - function to call via scheduler
|
||||
@param param - parameter to pass to the function
|
||||
@param timer_interval - timeout, in system timer intervals
|
||||
@return RET_OK or RET_OVERFLOW
|
||||
|
||||
*/
|
||||
#ifndef ZB_SCHEDULE_APP_ALARM
|
||||
#define ZB_SCHEDULE_APP_ALARM(func, param, timer_interval) zb_schedule_app_alarm(func, param, timer_interval)
|
||||
#endif /* ZB_SCHEDULE_APP_ALARM */
|
||||
|
||||
/**
|
||||
Special parameter for zb_schedule_alarm_cancel(): cancel alarm once without
|
||||
parameter check
|
||||
|
||||
Cancel only one alarm without check for parameter
|
||||
*/
|
||||
#define ZB_ALARM_ANY_PARAM (zb_uint8_t)(-1)
|
||||
|
||||
/**
|
||||
Special parameter for zb_schedule_alarm_cancel(): cancel alarm for all
|
||||
parameters
|
||||
*/
|
||||
#define ZB_ALARM_ALL_CB (zb_uint8_t)(-2)
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Cancel scheduled alarm (use macro ZB_SCHEDULE_APP_ALARM_CANCEL()
|
||||
instead of this function).
|
||||
|
||||
This function cancel previously scheduled alarm. Function is identified by
|
||||
the pointer.
|
||||
|
||||
@param func - function to cancel
|
||||
@param param - parameter to cancel. \see ZB_ALARM_ANY_PARAM. \see ZB_ALARM_ALL_CB
|
||||
@param p_param - [out] pointer of ref buffer from cancelled flag: free buffer if its alarm will be cancel
|
||||
@return RET_OK or error code
|
||||
|
||||
*/
|
||||
zb_ret_t zb_schedule_alarm_cancel(zb_callback_t func, zb_uint8_t param, zb_uint8_t *p_param);
|
||||
/** @endcond */ /* internals_doc */
|
||||
/**
|
||||
Cancel scheduled alarm.
|
||||
|
||||
This function cancel previously scheduled alarm. Function is identified by
|
||||
the pointer.
|
||||
|
||||
@param func - function to cancel
|
||||
@param param - parameter to cancel. \see ZB_ALARM_ANY_PARAM. \see ZB_ALARM_ALL_CB
|
||||
@return RET_OK or RET_OVERFLOW
|
||||
|
||||
*/
|
||||
#ifndef ZB_SCHEDULE_APP_ALARM_CANCEL
|
||||
#define ZB_SCHEDULE_APP_ALARM_CANCEL(func, param) zb_schedule_alarm_cancel((func), (param), NULL)
|
||||
#endif /* ZB_SCHEDULE_APP_ALARM_CANCEL */
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Get Schedule alarm time - seek alarm and return alarm time
|
||||
|
||||
@param func - function to call via scheduler
|
||||
@param param - parameter to pass to the function
|
||||
@param timer_interval - pointer on alarm timeout, in system timer intervals
|
||||
@return RET_OK or error code
|
||||
*/
|
||||
zb_ret_t zb_schedule_get_alarm_time(zb_callback_t func, zb_uint8_t param, zb_time_t *timer_interval);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Get Schedule alarm time - seek alarm and return alarm time
|
||||
|
||||
@param func - function to call via scheduler
|
||||
@param param - parameter to pass to the function
|
||||
@param timer_interval - pointer on alarm timeout, in system timer intervals
|
||||
@return RET_OK or error code
|
||||
*/
|
||||
#define ZB_SCHEDULE_GET_ALARM_TIME(func, param, timer_interval) zb_schedule_get_alarm_time(func, param, timer_interval)
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Is scheduler stop - Is scheduler running now
|
||||
|
||||
@return ZB_TRUE in case of scheduler is stopped or ZB_FALSE otherwise
|
||||
*/
|
||||
zb_bool_t zb_scheduler_is_stop(void);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Is scheduler stop - Is scheduler running now
|
||||
|
||||
@return ZB_TRUE in case of scheduler is stopped or ZB_FALSE otherwise
|
||||
*/
|
||||
#define ZB_SCHEDULER_IS_STOP() zb_scheduler_is_stop()
|
||||
|
||||
/**
|
||||
Is scheduler is going to stop/stopped - Is scheduler running now
|
||||
|
||||
@return ZB_TRUE in case of scheduler is going to stop/stopped or ZB_FALSE otherwise
|
||||
*/
|
||||
zb_bool_t zb_scheduler_is_going_to_stop(void);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Is scheduler is going to stop/stopped - Is scheduler running now
|
||||
|
||||
@return ZB_TRUE in case of scheduler is going to stop/stopped or ZB_FALSE otherwise
|
||||
*/
|
||||
#define ZB_SCHEDULER_IS_GOING_TO_STOP() zb_scheduler_is_going_to_stop()
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
||||
/*! \addtogroup rng */
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* Maximal possible value for randomly generated (32-bit) value
|
||||
*/
|
||||
#define ZB_RAND_MAX ((zb_uint32_t)~0U)
|
||||
|
||||
/**
|
||||
* Generate random 32-bit value using zb_random_val() with ZB_UINT32_MAX
|
||||
*
|
||||
* @return random value between 0 to 2^32-1
|
||||
*/
|
||||
zb_uint32_t zb_random(void);
|
||||
|
||||
/**
|
||||
* Generate random value between 0 to max_value, inclusively.
|
||||
*
|
||||
* Internal software algorithm using LFSRs
|
||||
* can be overridden by define ZB_RANDOM_HARDWARE
|
||||
*
|
||||
* @return random value between 0 and 'max_value' (32 bits).
|
||||
*/
|
||||
zb_uint32_t zb_random_val(zb_uint32_t max_value);
|
||||
|
||||
/**
|
||||
* Generate random 8-bit value using zb_random_val() with ZB_UINT8_MAX
|
||||
*
|
||||
* @return random value between 0 to 0xff
|
||||
*/
|
||||
zb_uint8_t zb_random_u8(void);
|
||||
|
||||
/**
|
||||
* Generate random 16-bit value using zb_random_val() with ZB_UINT16_MAX
|
||||
*
|
||||
* @return random value between 0 to 0xffff
|
||||
*/
|
||||
zb_uint16_t zb_random_u16(void);
|
||||
|
||||
/**
|
||||
* Equivalent of zb_random_val(). The macro is left for compatibility reasons.
|
||||
*/
|
||||
#define ZB_RANDOM_VALUE(max_value) zb_random_val(max_value)
|
||||
|
||||
/**
|
||||
* Equivalent of zb_random_u8(). The macro is left for compatibility reasons.
|
||||
*/
|
||||
#define ZB_RANDOM_U8() zb_random_u8()
|
||||
|
||||
/**
|
||||
* Equivalent of zb_random_u16(). The macro is left for compatibility reasons.
|
||||
*/
|
||||
#define ZB_RANDOM_U16() zb_random_u16()
|
||||
|
||||
/**
|
||||
* Analogue of bzero() for volatile data.
|
||||
*
|
||||
* A custom version should be implemented because there is no standard library function for that
|
||||
* purpose. Also, this function is not platform-dependent in contrast to ZB_BZERO() macro and
|
||||
* therefore can't be overridden by specific ZBOSS platform.
|
||||
*
|
||||
* The function sets individually every byte of provided memory region to zero.
|
||||
*/
|
||||
void zb_bzero_volatile(volatile void *s, zb_uint_t size);
|
||||
|
||||
/** @brief Fill in memory with PRBS9 pattern using linear-feedback shift registers.
|
||||
@param dest - Pointer to the block of memory to fill.
|
||||
@param cnt - Number of bytes to be set.
|
||||
@param seed - Random seed
|
||||
*/
|
||||
void zb_generate_prbs9(zb_uint8_t *dest, zb_uint16_t cnt, zb_uint16_t seed);
|
||||
|
||||
/*! @} */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Copy 8 byte array (i.e. long address).
|
||||
*/
|
||||
void zb_memcpy8(void *vptr, void *vsrc);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
Return absolute value
|
||||
*/
|
||||
#define ZB_ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
|
||||
/**
|
||||
* Set of ZB_BITSx() macros return value with bits set in provided positions.
|
||||
* ZB_BITS1(0) = 1
|
||||
* ZB_BITS2(2,3) = 12
|
||||
* ZB_BITS3(0,1,2) = 7
|
||||
*/
|
||||
#define ZB_BITS1(_b) (1UL << (_b))
|
||||
#define ZB_BITS2(_b1, _b2) ((1UL << (_b1)) | (1UL << (_b2)))
|
||||
#define ZB_BITS3(_b1, _b2, _b3) ((1UL << (_b1)) | (1UL << (_b2)) | (1UL << (_b3)))
|
||||
#define ZB_BITS4(_b1, _b2, _b3, _b4) ((1UL << (_b1)) | (1UL << (_b2)) | (1UL << (_b3)) | (1UL << (_b4)))
|
||||
#define ZB_BITS5(_b1, _b2, _b3, _b4, _b5) ((1UL << (_b1)) | (1UL << (_b2)) | (1UL << (_b3)) | \
|
||||
(1UL << (_b4)) | (1UL << (_b5)))
|
||||
|
||||
#define ZB_SET_BIT_IN_BIT_VECTOR(vector, nbit) ( (vector)[ (nbit) / 8U ] |= ( 1U << ( (nbit) % 8U )) )
|
||||
#define ZB_CLR_BIT_IN_BIT_VECTOR(vector, nbit) ( (vector)[ (nbit) / 8U ] &= ~( 1U << ( (nbit) % 8U )) )
|
||||
#define ZB_CHECK_BIT_IN_BIT_VECTOR(vector, nbit) (ZB_U2B( (vector)[ (nbit) / 8U ] & ( 1U << ( (nbit) % 8U )) ))
|
||||
#define ZB_SIZE_OF_BIT_VECTOR(bit_count) (((bit_count) + 7U) / 8U)
|
||||
|
||||
/**
|
||||
* Checks if the bits specified by 'bitmask' are set in the 'val'. Bit-mask may contain one or
|
||||
* several bits set.
|
||||
*
|
||||
* @return ZB_TRUE if the 'bitmask' is set in 'val'. ZB_FALSE otherwise.
|
||||
*/
|
||||
#define ZB_BIT_IS_SET(val, bitmask) (((val) & (bitmask)) != 0U)
|
||||
|
||||
#endif /* ZB_ZBOSS_API_CORE_H */
|
||||
@@ -0,0 +1,692 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS internal data structures required for configurable memory.
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZBOSS_API_INTERNAL_H
|
||||
#define ZB_ZBOSS_API_INTERNAL_H 1
|
||||
|
||||
#include "zb_vendor.h"
|
||||
#include "zb_config.h"
|
||||
#include "zb_types.h"
|
||||
#include "zb_errors.h"
|
||||
#include "zb_osif.h"
|
||||
#include "zb_debug.h"
|
||||
#include "zb_trace.h"
|
||||
#include "zb_pooled_list.h"
|
||||
|
||||
#ifndef ZB_MINIMAL_CONTEXT
|
||||
|
||||
#include "zb_address.h"
|
||||
|
||||
/* Data structures moved from subsystem internal headers for configurable memory implementation. */
|
||||
|
||||
/**
|
||||
Parameters for storing data in a pending queue
|
||||
|
||||
Moved there from MAC to be able to implement MAC indirect quote size configuration.
|
||||
*/
|
||||
typedef struct zb_mac_pending_data_s
|
||||
{
|
||||
zb_addr_u dst_addr; /**< Destination address */
|
||||
zb_uint8_t dst_addr_mode; /**< Destination address mode @ref address_modes */
|
||||
zb_uint8_t pending_param; /**< Pointer to pending data */
|
||||
}
|
||||
zb_mac_pending_data_t;
|
||||
|
||||
|
||||
/**
|
||||
APS retransmissions
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_retrans_ent_s
|
||||
{
|
||||
zb_uint16_t clusterid; /*!< Cluster ID*/
|
||||
zb_address_ieee_ref_t addr_ref; /*!< Destination address*/
|
||||
zb_uint8_t aps_counter; /*!< APS counter */
|
||||
zb_uint8_t src_endpoint; /*!< Source endpoint */
|
||||
zb_uint8_t dst_endpoint; /*!< Destination endpoint */
|
||||
zb_uint8_t buf; /*!< Buffer index for retranslate */
|
||||
|
||||
zb_bitfield_t aps_retries:4; /*!< Number of attempts */
|
||||
zb_bitfield_t nwk_insecure:1; /*!< Flag 'Is NWK secure' */
|
||||
zb_bitfield_t state:3; /*!< @see @ref aps_retrans_ent_state */
|
||||
} ZB_PACKED_STRUCT zb_aps_retrans_ent_t;
|
||||
|
||||
#endif /* !ZB_MINIMAL_CONTEXT */
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_cb_q_ent_s
|
||||
{
|
||||
union {
|
||||
zb_callback_t func_ptr;
|
||||
zb_callback2_t func2_ptr;
|
||||
} u; /*!< function to call */
|
||||
zb_uint16_t user_param; /*!< user parameter */
|
||||
zb_uint8_t param; /*!< parameter to pass to 'func' */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_cb_q_ent_t;
|
||||
|
||||
/**
|
||||
Returns 'zb_cb_q_ent_t' members 'func_ptr' or 'func2_ptr' depending on whether the callback
|
||||
takes one or two parameters.
|
||||
|
||||
@param ent - variable of type 'zb_cb_q_ent_t'
|
||||
@param is2param - boolean value, ZB_TRUE if the callback takes two parameters, ZB_FALSE otherwise
|
||||
|
||||
@return 'func_ptr' or 'func2_ptr'
|
||||
*/
|
||||
#define ZB_CB_QENT_FPTR(ent, is2param) ((!(is2param)) ? (void*)((ent)->u.func_ptr) : (void*)((ent)->u.func2_ptr))
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_delayed_buf_q_ent_s
|
||||
{
|
||||
union {
|
||||
zb_callback_t func_ptr;
|
||||
zb_callback2_t func2_ptr;
|
||||
} u; /*!< function to call */
|
||||
zb_uint16_t user_param; /*!< user parameter */
|
||||
zb_bitfield_t buf_cnt:7; /*!< number of buffers to allocate */
|
||||
zb_bitfield_t is_2param:1; /*!< whether this is a 2param callback */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_delayed_buf_q_ent_t;
|
||||
|
||||
/**
|
||||
Returns 'zb_delayed_buf_q_ent_t' members 'func_ptr' or 'func2_ptr' depending on whether the callback
|
||||
takes one or two parameters.
|
||||
|
||||
@param ent - variable of type 'zb_delayed_buf_q_ent_t'
|
||||
|
||||
@return 'func_ptr' or 'func2_ptr'
|
||||
*/
|
||||
#define ZB_DELAYED_BUF_QENT_FPTR(ent) (((ent)->is_2param == 0U) ? (void*)((ent)->u.func_ptr) : (void*)((ent)->u.func2_ptr))
|
||||
|
||||
/**
|
||||
Delayed (scheduled to run after timeout) callbacks queue entry.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_tm_q_ent_s
|
||||
{
|
||||
zb_callback_t func; /*!< function to call */
|
||||
zb_time_t run_time; /*!< time to run at */
|
||||
zb_uint8_t param; /*!< parameter to pass to 'func' */
|
||||
ZB_POOLED_LIST8_FIELD(next);
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_tm_q_ent_t;
|
||||
|
||||
#ifndef ZB_MINIMAL_CONTEXT
|
||||
/**
|
||||
Installcode hash for TC
|
||||
|
||||
Do not store installcode itself in RAM - keep only 4 bytes per entry in RAM.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_installcode_storage_s
|
||||
{
|
||||
zb_uint32_t nvram_offset:28; /*!< offset of zb_aps_installcode_nvram_t
|
||||
record in nvram. 28 bit supports 256k
|
||||
page - hope, it is enough */
|
||||
zb_bitfield_t nvram_page:4; /*!< nvram page. Hope 16 pages are enough */
|
||||
} ZB_PACKED_STRUCT zb_aps_installcode_storage_t;
|
||||
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_aps_device_key_pair_array_s
|
||||
{
|
||||
zb_uint32_t nvram_offset:27; /*!< offset of zb_aps_device_key_pair_storage_t
|
||||
record in nvram. 27 bit supports 128k
|
||||
page - hope, it is enough */
|
||||
/* Try to fit into 6 bytes instead of 8 */
|
||||
zb_lbitfield_t outgoing_frame_counter:21;/*!< Outgoing value for APS frame
|
||||
* outgoing counter. Used for
|
||||
* communication with TC only, so
|
||||
* hope 2^21 ~ 10^10 values are enough
|
||||
*/
|
||||
#ifndef ZB_NO_CHECK_INCOMING_SECURE_APS_FRAME_COUNTERS
|
||||
zb_uint32_t incoming_frame_counter; /*!< Incoming value,for APS frame incoming counter */
|
||||
#endif
|
||||
} ZB_PACKED_STRUCT zb_aps_device_key_pair_array_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
NWK routing
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_nwk_routing_s /* do not pack for IAR */
|
||||
{
|
||||
zb_bitfield_t used:1; /*!< 1 if entry is used, 0 - otherwise */
|
||||
zb_bitfield_t status:2; /*!< The status of the route, see @ref nwk_route_state */
|
||||
#ifndef ZB_LITE_NO_SOURCE_ROUTING
|
||||
zb_bitfield_t no_route_cache:1; /*!< Dest does not store source routes. */
|
||||
zb_bitfield_t many_to_one:1; /*!< Dest is the concentrator and many-to-one
|
||||
* request was used */
|
||||
zb_bitfield_t route_record_required:1; /*!< Route record command frame should
|
||||
* be sent to the dest prior to the
|
||||
* next data packet */
|
||||
#endif
|
||||
#ifndef ZB_NO_NWK_MULTICAST
|
||||
zb_bitfield_t group_id_flag:1; /*!< Indicates that dest_addr is a Group ID */
|
||||
#endif
|
||||
#if ZB_NWK_ROUTING_TABLE_EXPIRY < 64U
|
||||
zb_bitfield_t expiry:6; /*!< expiration time. max value -
|
||||
* ZB_NWK_ROUTING_TABLE_EXPIRY (60) */
|
||||
#else
|
||||
zb_uint8_t expiry;
|
||||
#endif
|
||||
#if !defined ZB_CONFIGURABLE_MEM && ZB_IEEE_ADDR_TABLE_SIZE <= 127U
|
||||
zb_bitfield_t next_hop_addr_ref:7;
|
||||
#else
|
||||
zb_uint8_t next_hop_addr_ref; /*!< ref to network address of the next
|
||||
* hop on the way to the destination */
|
||||
#endif
|
||||
zb_uint16_t dest_addr; /*!< 16-bit network address or Group ID of this route */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nwk_routing_t;
|
||||
|
||||
/**
|
||||
NWK route discovery
|
||||
*/
|
||||
typedef struct zb_nwk_route_discovery_s /* do not pack for IAR */
|
||||
{
|
||||
zb_bitfield_t used:1; /*!< 1 if entry is used, 0 - otherwise */
|
||||
zb_bitfield_t expiration_time:7; /*!< Countdown timer indicating when route
|
||||
* discovery expires. ZB_NWK_ROUTE_DISCOVERY_EXPIRY 10 */
|
||||
zb_uint8_t request_id; /*!< Sequence number for a route request */
|
||||
/* TODO: use 1 byte - index in the translation table */
|
||||
zb_uint16_t source_addr; /*!< 16-bit network address of the route
|
||||
* requests initiator */
|
||||
/* TODO: use 1 byte - index in the translation table */
|
||||
zb_uint16_t sender_addr; /*!< 16-bit network address of the device that
|
||||
* has sent the most recent lowest cost route
|
||||
* request */
|
||||
zb_uint16_t dest_addr; /*!< 16-bit network destination address of this
|
||||
* request */
|
||||
zb_uint8_t forward_cost; /*!< Path cost from the source of the route request
|
||||
* to the current device */
|
||||
zb_uint8_t residual_cost; /*!< Path cost from the current to the destination
|
||||
* device */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nwk_route_discovery_t;
|
||||
|
||||
#if defined ZB_PRO_STACK && !defined ZB_LITE_NO_SOURCE_ROUTING
|
||||
/**
|
||||
Route Record Table Entry Format, Table 3.45
|
||||
*/
|
||||
typedef struct zb_nwk_rrec_s /* do not pack for IAR */
|
||||
{
|
||||
zb_bitfield_t used:1; /*!< Is record used */
|
||||
zb_bitfield_t expiry:7; /*!< Expiration time */
|
||||
zb_uint8_t count; /*!< Count hops */
|
||||
zb_uint16_t addr; /*!< Destination address */
|
||||
zb_uint16_t path[ZB_NWK_MAX_PATH_LENGTH]; /*!< Full path */
|
||||
} ZB_PACKED_STRUCT zb_nwk_rrec_t;
|
||||
|
||||
#endif
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_aps_dup_tbl_ent_s
|
||||
{
|
||||
zb_uint8_t addr_ref; /*!< Reference to addr_map */
|
||||
zb_uint8_t counter; /*!< APS frame counter */
|
||||
zb_bitfield_t clock:6; /*!< Expiry clock counter. Be sure it can hold 2*ZB_APS_DUP_INITIAL_CLOCK */
|
||||
zb_bitfield_t is_unicast:1; /*!< Is delivery mode unicast */
|
||||
zb_bitfield_t is_command:1; /*!< Is APS command frame */
|
||||
} ZB_PACKED_STRUCT zb_aps_dup_tbl_ent_t;
|
||||
|
||||
|
||||
/**
|
||||
Global binding table - source part
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_bind_src_table_s
|
||||
{
|
||||
zb_address_ieee_ref_t src_addr; /*!< source address as ref from nwkAddressMap */
|
||||
zb_uint8_t src_end; /*!< source endpoint */
|
||||
zb_uint16_t cluster_id; /*!< cluster id */
|
||||
zb_uint8_t align[12];
|
||||
} ZB_PACKED_STRUCT zb_aps_bind_src_table_t;
|
||||
ZB_ASSERT_IF_NOT_ALIGNED_TO_16(zb_aps_bind_src_table_t);
|
||||
/**
|
||||
Global binding table - destination part with 64-bit address
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_bind_long_dst_addr_s
|
||||
{
|
||||
zb_address_ieee_ref_t dst_addr; /*!< destination address as ref from nwkAddressMap */
|
||||
zb_uint8_t dst_end; /*!< destination endpoint */
|
||||
} ZB_PACKED_STRUCT zb_aps_bind_long_dst_addr_t;
|
||||
|
||||
#ifndef ZB_CONFIGURABLE_MEM
|
||||
#define ZB_APS_BIND_TRANS_TABLE_SIZE ((ZB_IOBUF_POOL_SIZE + 15U)/16U *4U)
|
||||
|
||||
/* it should be 4-byte aligned if it is stored in NVRAM */
|
||||
#define ZB_SINGLE_TRANS_INDEX_SIZE (((ZB_APS_BIND_TRANS_TABLE_SIZE + 31U) / 32U) * 4U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
Global binding table - destination part
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_aps_bind_dst_table_s
|
||||
{
|
||||
#ifdef ZB_CONFIGURABLE_MEM
|
||||
/* WARNING: this field will be rewritten if APS binding dataset is present in NVRAM */
|
||||
zb_uint8_t *trans_index;
|
||||
#endif /* defined ZB_CONFIGURABLE_MEM */
|
||||
|
||||
ZB_PACKED_PRE union
|
||||
{
|
||||
zb_uint16_t group_addr; /*!< group address */
|
||||
zb_aps_bind_long_dst_addr_t long_addr; /*!< @see zb_asp_long_dst_addr_t */
|
||||
} u;
|
||||
|
||||
#ifndef ZB_CONFIGURABLE_MEM
|
||||
zb_uint8_t trans_index[ZB_SINGLE_TRANS_INDEX_SIZE];
|
||||
#endif /* defined ZB_CONFIGURABLE_MEM */
|
||||
|
||||
zb_uint8_t dst_addr_mode; /*!< destination address mode flag, 0
|
||||
* - group address, otherwise long
|
||||
* address plus dest endpoint */
|
||||
zb_uint8_t src_table_index; /*!< index from zb_asp_src_table_t */
|
||||
#ifdef SNCP_MODE
|
||||
zb_uint8_t id; /* original index position when inserted, to identify
|
||||
* entry even if moved with the array (on removal of
|
||||
* other elements) */
|
||||
zb_uint8_t align;
|
||||
#endif
|
||||
zb_uint8_t align[8];
|
||||
} ZB_PACKED_STRUCT zb_aps_bind_dst_table_t;
|
||||
|
||||
ZB_ASSERT_IF_NOT_ALIGNED_TO_16(zb_aps_bind_dst_table_t);
|
||||
|
||||
/**
|
||||
Neighbor table entry
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_neighbor_tbl_ent_s /* not need to pack it at IAR */
|
||||
{
|
||||
/* 0 */
|
||||
zb_bitfield_t used:1; /*!< Record has used */
|
||||
zb_bitfield_t ext_neighbor:1; /*!< if 1, this is ext neighbor
|
||||
* record, else base neighbor */
|
||||
|
||||
zb_bitfield_t device_type:2; /*!< Neighbor device type - @see @ref nwk_device_type */
|
||||
|
||||
zb_bitfield_t depth:4; /*!< The network depth of this
|
||||
device. A value of 0x00
|
||||
indicates that this device is the
|
||||
Zigbee coordinator for the
|
||||
network. */
|
||||
/* 1,2 */
|
||||
zb_bitfield_t permit_joining:1; /*!< A value of TRUE indicates that at
|
||||
least one Zigbee router on the
|
||||
network currently permits joining,
|
||||
i.e. its NWK has been issued an
|
||||
NLME-PERMIT-JOINING
|
||||
primitive and, the time limit if
|
||||
given, has not yet expired. */
|
||||
|
||||
zb_bitfield_t rx_on_when_idle:1; /*!< Indicates if neighbor receiver
|
||||
enabled during idle periods:
|
||||
TRUE = Receiver is on
|
||||
FALSE = Receiver is off
|
||||
This field should be present for
|
||||
entries that record the parent or
|
||||
children of a Zigbee router or
|
||||
Zigbee coordinator. */
|
||||
|
||||
zb_bitfield_t relationship:3; /*!< The relationship between the
|
||||
neighbor and the current device:
|
||||
0x00=neighbor is the parent
|
||||
0x01=neighbor is a child
|
||||
0x02=neighbor is a sibling
|
||||
0x03=none of the above
|
||||
0x04=previous child
|
||||
0x05=unauthenticated child
|
||||
This field shall be present in every
|
||||
neighbor table entry.
|
||||
see @ref nwk_relationship
|
||||
*/
|
||||
|
||||
zb_bitfield_t need_rejoin:1; /*!< Need send rejoin response without receive request */
|
||||
|
||||
/* there was send_via_routing field which marked asymmetrical links when we
|
||||
* can head the device but it can't hear us. Now that functionality is
|
||||
* implemented using outgoing_cost field. */
|
||||
zb_bitfield_t reserved:1;
|
||||
|
||||
zb_bitfield_t keepalive_received:1; /*!< This value indicates at least one keepalive
|
||||
* has been received from the end device since
|
||||
* the router has rebooted.
|
||||
*/
|
||||
|
||||
zb_bitfield_t mac_iface_idx:5; /*!< An index into the MAC Interface Table
|
||||
* indicating what interface the neighbor or
|
||||
* child is bound to. */
|
||||
|
||||
zb_bitfield_t transmit_failure_cnt:4; /*!< Transmit failure counter (used to initiate
|
||||
* device address
|
||||
* search). */
|
||||
/* 3 */
|
||||
zb_uint8_t lqi; /*!< Link quality. Also used to calculate
|
||||
* incoming cost */
|
||||
/* 4 */
|
||||
zb_int8_t rssi; /*!< Received signal strength indicator */
|
||||
/* 5 */
|
||||
ZB_PACKED_PRE union {
|
||||
ZB_PACKED_PRE struct zb_ext_neighbor_s
|
||||
{
|
||||
/* 0 */
|
||||
zb_uint16_t short_addr; /*!< 16-bit network address of the
|
||||
neighboring device */
|
||||
/* 2 */
|
||||
|
||||
zb_ieee_addr_compressed_t long_addr; /*!< 64-bit address (packed) */
|
||||
/* 8 */
|
||||
zb_uint8_t update_id; /*!< This field reflects the value of nwkUpdateId from the NIB. */
|
||||
/* 9 */
|
||||
zb_bitfield_t panid_ref:5; /*!< ref to the extended Pan id */
|
||||
|
||||
zb_bitfield_t router_capacity:1; /*!< This value is set to TRUE if this
|
||||
device is capable of accepting
|
||||
join requests from router-
|
||||
capable devices and is set to
|
||||
FALSE otherwise. */
|
||||
zb_bitfield_t end_device_capacity:1; /*!< This value is set to TRUE if the
|
||||
device is capable of accepting
|
||||
join requests from end devices
|
||||
seeking to join the network and
|
||||
is set to FALSE otherwise. */
|
||||
zb_bitfield_t potential_parent:1; /*!< This field usage - see
|
||||
3.6.1.4.1.1 Child Procedure:
|
||||
If the Status parameter indicates a refusal to permit
|
||||
joining on the part of the neighboring device (that is, PAN at capacity or PAN
|
||||
access denied), then the device attempting to join should set the Potential parent
|
||||
bit to 0 in the corresponding neighbor table entry to indicate a failed join attempt.
|
||||
*/
|
||||
/* 10 */
|
||||
zb_uint8_t channel_page; /*!< The current channel page occupied by the network. */
|
||||
/* 11 */
|
||||
zb_bitfield_t logical_channel:6; /*!< The current logical channel
|
||||
occupied by the network. */
|
||||
|
||||
zb_bitfield_t stack_profile:2; /*!< A ZBOSS profile identifier. */
|
||||
|
||||
/* 12 */
|
||||
zb_uint8_t classification_mask;
|
||||
/* 13 */
|
||||
} ZB_PACKED_STRUCT ext;
|
||||
ZB_PACKED_PRE struct zb_base_neighbor_s
|
||||
{
|
||||
zb_uint8_t key_seq_number; /*!< key number for which
|
||||
* incoming_frame_counter is valid */
|
||||
#ifndef ZB_ROUTER_ROLE /* no routing at ZED - simplify*/
|
||||
zb_address_ieee_ref_t addr_ref; /*!< address translation entry */
|
||||
zb_uint8_t nwk_ed_timeout; /*End device timeout - @see @ref nwk_requested_timeout */
|
||||
#else /* ZR,ZC */
|
||||
#if !defined ZB_CONFIGURABLE_MEM && ZB_IEEE_ADDR_TABLE_SIZE < 128
|
||||
/* Won 1 byte here, so base is 11 bytes (== ext) */
|
||||
zb_bitfield_t addr_ref:7; /*!< address translation entry */
|
||||
#else
|
||||
/* If configurable mem build, can have >127 addresses, so need a byte here. */
|
||||
zb_address_ieee_ref_t addr_ref;
|
||||
#endif /* if 7 bits are enough */
|
||||
|
||||
zb_bitfield_t nwk_ed_timeout:4; /*End device timeout - @see @ref nwk_requested_timeout */
|
||||
|
||||
/* Following fields present only if nwkSymLink = TRUE - this is PRO, not 2007 */
|
||||
zb_bitfield_t outgoing_cost:3; /*!< The cost of an outgoing
|
||||
* link. Got from link status. */
|
||||
/* In other words, if a device fails to receive nwkRouterAgeLimit link status
|
||||
messages from a router neighbor in a row, the old outgoing cost information is
|
||||
discarded. In this case, the neighbor entry is considered stale and may be reused if
|
||||
necessary to make room for a new neighbor. */
|
||||
#ifndef ZB_LITE_NO_CONFIGURABLE_LINK_STATUS
|
||||
zb_bitfield_t age:5; /*!< The number of nwkLinkStatusPeriod intervals since a
|
||||
* link status command was received */
|
||||
#else
|
||||
/* actually ZB_NWK_ROUTER_AGE_LIMIT is 3, so 2 bits is enough */
|
||||
zb_bitfield_t age:2;
|
||||
#endif
|
||||
#endif /* ZB_ROUTER_ROLE */
|
||||
zb_uint32_t incoming_frame_counter; /*!< incoming NWK frame counter
|
||||
* for this device after
|
||||
* key change */
|
||||
zb_time_t time_to_expire; /*Time stamp for ED aging*/
|
||||
} ZB_PACKED_STRUCT base;
|
||||
} ZB_PACKED_STRUCT u;
|
||||
/* TODO: move it to base ?? */
|
||||
#if !defined ZB_ED_ROLE && defined ZB_MAC_DUTY_CYCLE_MONITORING
|
||||
zb_bitbool_t is_subghz:1; /*!< if 1, this is Sub-GHz device */
|
||||
zb_bitbool_t suspended:1; /*!< if 1, SuspendZCLMessages was sent to the device */
|
||||
zb_lbitfield_t pkt_count:22; /*!< count of packets received from this device */
|
||||
#define MAX_NBT_PKT_COUNT ((1u<<22U)-1U)
|
||||
zb_lbitfield_t subghz_ep:8; /*!< endpoint with Sub-GHz cluster on remote device */
|
||||
#endif
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_neighbor_tbl_ent_t;
|
||||
|
||||
/**
|
||||
Kind of negotiation before TX
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name MAC TX wait
|
||||
* @anchor mac_tx_wait
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_MAC_TX_WAIT_ACK 0U
|
||||
#define ZB_MAC_TX_WAIT_CSMACA 1U
|
||||
#define ZB_MAC_TX_WAIT_ZGP 2U
|
||||
#define ZB_MAC_TX_WAIT_NONE 3U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name MAC TX status
|
||||
* @anchor mac_tx_status
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_TRANS_TX_OK 0U
|
||||
#define ZB_TRANS_CHANNEL_BUSY_ERROR 1U
|
||||
#define ZB_TRANS_TX_RETRY_COUNT_EXCEEDED 2U
|
||||
#define ZB_TRANS_TX_LBT_TO 3U
|
||||
#define ZB_TRANS_NO_ACK 4U
|
||||
/** @} */
|
||||
|
||||
zb_uint32_t zb_get_channel_mask(void);
|
||||
|
||||
/* MAC diagnostics info */
|
||||
typedef ZB_PACKED_PRE struct zb_mac_diagnostic_info_s
|
||||
{
|
||||
zb_uint32_t mac_rx_bcast; /* A counter that is incremented each time
|
||||
* the MAC layer receives a broadcast. */
|
||||
zb_uint32_t mac_tx_bcast; /* A counter that is incremented each time
|
||||
* the MAC layer transmits a broadcast. */
|
||||
zb_uint32_t mac_rx_ucast; /* A counter that is incremented each time the
|
||||
* MAC layer receives a unicast. */
|
||||
|
||||
/* These 3 counters are required not to break
|
||||
* ZDO channel management logic that
|
||||
* uses normalized counters values.
|
||||
*/
|
||||
zb_uint32_t mac_tx_ucast_total_zcl; /* The same as mac_tx_ucast_total, but non-normalized */
|
||||
zb_uint16_t mac_tx_ucast_failures_zcl; /* The same as mac_tx_ucast_failures, but non-normalized */
|
||||
zb_uint16_t mac_tx_ucast_retries_zcl; /* The same as mac_tx_ucast_retries, but non-normalized*/
|
||||
|
||||
zb_uint16_t mac_tx_ucast_total; /* Total number of Mac Tx Transactions to
|
||||
* attempt to send a message (but not
|
||||
* counting retries) */
|
||||
zb_uint16_t mac_tx_ucast_failures; /* Total number of failed Tx
|
||||
* Transactions. So if the Mac send a
|
||||
* single packet, it will be retried 4
|
||||
* times without ack, that counts as 1 failure */
|
||||
zb_uint16_t mac_tx_ucast_retries; /* Total number of Mac Retries regardless of
|
||||
* whether the transaction resulted in
|
||||
* success or failure. */
|
||||
|
||||
zb_uint16_t phy_to_mac_que_lim_reached; /* A counter that is incremented each time when MAC RX queue if full. */
|
||||
|
||||
zb_uint16_t mac_validate_drop_cnt; /* How many times the packet was dropped at the packet
|
||||
* validation stage for length or bad formatting. */
|
||||
|
||||
zb_uint16_t phy_cca_fail_count; /* Number of the PHY layer was unable
|
||||
* to transmit due to a failed CCA */
|
||||
|
||||
zb_uint8_t period_of_time; /* Time period over which MACTx results are measured */
|
||||
zb_uint8_t last_msg_lqi; /* LQI value of the last received packet */
|
||||
zb_int8_t last_msg_rssi; /* RSSI value of the last received packet */
|
||||
zb_uint32_t cca_retries; /* Total number of CCA retries */
|
||||
zb_uint32_t pta_lo_pri_req; /* Total number of low priority PTA request */
|
||||
zb_uint32_t pta_hi_pri_req; /* Total number of high priority PTA request */
|
||||
zb_uint32_t pta_lo_pri_denied; /* Total number of low priority PTA request denied by master */
|
||||
zb_uint32_t pta_hi_pri_denied; /* Total number of high priority PTA request denied by master */
|
||||
zb_uint32_t pta_denied_rate; /* PTA deny rate*/
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_mac_diagnostic_info_t;
|
||||
|
||||
/* MAC diagnostics info extended struct */
|
||||
typedef ZB_PACKED_PRE struct zb_mac_diagnostic_ex_info_s
|
||||
{
|
||||
zb_mac_diagnostic_info_t mac_diag_info;
|
||||
/* Internal variables/counters that should be transferred
|
||||
* from MAC to ZDO and should not go to the NHLE */
|
||||
zb_uint32_t mac_tx_for_aps_messages; /* Internal counter used to calculate
|
||||
average_mac_retry_per_aps_message_sent in ZDO */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_mac_diagnostic_ex_info_t;
|
||||
|
||||
/*! @brief Structure saved diagnostic counters except MAC
|
||||
* See the ZCL Diagnostics Cluster -> ZCLr7 spec, chapter 3.15 */
|
||||
typedef ZB_PACKED_PRE struct zdo_diagnostics_info_s
|
||||
{
|
||||
/*! @brief An attribute that is incremented
|
||||
* each time the device resets. */
|
||||
zb_uint16_t number_of_resets;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* the APS layer receives a broadcast. */
|
||||
zb_uint16_t aps_tx_bcast;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* the APS layer successfully transmits a unicast. */
|
||||
zb_uint16_t aps_tx_ucast_success;
|
||||
|
||||
/*! @brief A counter that is incremented each time the
|
||||
* APS layer retries the sending of a unicast. */
|
||||
zb_uint16_t aps_tx_ucast_retry;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* the APS layer fails to send a unicast. */
|
||||
zb_uint16_t aps_tx_ucast_fail;
|
||||
|
||||
/*! @brief A counter that is incremented each time the network
|
||||
* layer submits a route discovery message to the MAC. */
|
||||
zb_uint16_t route_disc_initiated;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* an entry is added to the neighbor table. */
|
||||
zb_uint16_t nwk_neighbor_added;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* an entry is removed from the neighbor table. */
|
||||
zb_uint16_t nwk_neighbor_removed;
|
||||
|
||||
/*! @brief A counter that is incremented each time a neighbor table entry
|
||||
* becomes stale because the neighbor has not been heard from. */
|
||||
zb_uint16_t nwk_neighbor_stale;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* a node joins or rejoins the network via this node. */
|
||||
zb_uint16_t join_indication;
|
||||
|
||||
/*! @brief A counter that is incremented each time an entry
|
||||
* is removed from the child table. */
|
||||
zb_uint16_t childs_removed;
|
||||
|
||||
/*! @brief A counter that is incremented each time a message is
|
||||
* dropped at the network layer because the APS frame counter
|
||||
* was not higher than the last message seen from that source. */
|
||||
zb_uint16_t nwk_fc_failure;
|
||||
|
||||
/*! @brief A counter that is incremented each time a message is
|
||||
* dropped at the APS layer because the APS frame counter was
|
||||
* not higher than the last message seen from that source. */
|
||||
zb_uint16_t aps_fc_failure;
|
||||
|
||||
/*! @brief A counter that is incremented each time a message is dropped
|
||||
* at the APS layer because it had APS encryption but the key associated
|
||||
* with the sender has not been authenticated, and thus the key is not
|
||||
* authorized for use in APS data messages. */
|
||||
zb_uint16_t aps_unauthorized_key;
|
||||
|
||||
/*! @brief A counter that is incremented each time a NWK encrypted message
|
||||
* was received but dropped because decryption failed. */
|
||||
zb_uint16_t nwk_decrypt_failure;
|
||||
|
||||
/*! @brief A counter that is incremented each time an APS encrypted message was
|
||||
* received but dropped because decryption failed. */
|
||||
zb_uint16_t aps_decrypt_failure;
|
||||
|
||||
/*! @brief A counter that is incremented each time
|
||||
* the stack failed to allocate a packet buffers. */
|
||||
zb_uint16_t packet_buffer_allocate_failures;
|
||||
|
||||
/*! @brief A counter that is equal to the average number
|
||||
* of MAC retries needed to send an APS message. */
|
||||
zb_uint16_t average_mac_retry_per_aps_message_sent;
|
||||
|
||||
/*! @brief A counter that is incremented on the NWK layer
|
||||
* each time tries number of a packet resending are gone.
|
||||
*
|
||||
* @note It's a non-stanrad counter that depends on ZB_ENABLE_NWK_RETRANSMIT and
|
||||
* will be zero always when the macro isn't set. */
|
||||
zb_uint16_t nwk_retry_overflow;
|
||||
|
||||
/** A non-standard counter of the number of times the NWK broadcast was
|
||||
* dropped because the broadcast table was full.
|
||||
* 01/15/2021 In ZBOSS fired if any of the broadcast_transaction or
|
||||
* broadcast_retransmission tables are full */
|
||||
zb_uint16_t nwk_bcast_table_full;
|
||||
|
||||
} ZB_PACKED_STRUCT zdo_diagnostics_info_t;
|
||||
|
||||
#if defined NCP_MODE && !defined NCP_MODE_HOST
|
||||
typedef ZB_PACKED_PRE struct zb_ncp_pending_calls_s
|
||||
{
|
||||
zb_uint8_t tsn;
|
||||
zb_uint16_t call_id;
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_ncp_pending_calls_t;
|
||||
|
||||
#endif /* NCP_MODE && !NCP_MODE_HOST */
|
||||
|
||||
#endif /* !ZB_MINIMAL_CONTEXT */
|
||||
|
||||
#endif /* ZB_ZBOSS_API_INTERNAL_H */
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Public Multi-MAC layer API
|
||||
*/
|
||||
#ifndef ZBOSS_API_MM_H
|
||||
#define ZBOSS_API_MM_H 1
|
||||
|
||||
/** \addtogroup mm_api */
|
||||
/** @{ */
|
||||
|
||||
enum zb_mac_interfaces_counter_e {
|
||||
#if defined(ZB_MAC_MONOLITHIC)
|
||||
ZB_MAC_INTERFACE_MONOLITHIC,
|
||||
#endif
|
||||
#if defined(ZB_MACSPLIT_HOST)
|
||||
ZB_MAC_INTERFACE_MACSPLIT_HOST,
|
||||
#endif
|
||||
#if defined(ZB_MAC_BLE)
|
||||
ZB_MAC_INTERFACE_BLE,
|
||||
#endif
|
||||
#if defined(ZB_MACSPLIT_DEVICE)
|
||||
ZB_MAC_INTERFACE_MACSPLIT_DEVICE,
|
||||
#endif
|
||||
#if defined(ZB_MAC_SUBGHZ)
|
||||
ZB_MAC_INTERFACE_SUBGHZ,
|
||||
#endif
|
||||
#if defined(ZB_EXTMAC)
|
||||
ZB_MAC_INTERFACE_EXTMAC,
|
||||
#endif
|
||||
ZB_MAC_INTERFACE_MAX
|
||||
};
|
||||
|
||||
#if defined(ZB_MAC_MONOLITHIC)
|
||||
#define ZB_MAC_INTERFACE_MONOLITHIC_ID ((zb_uint8_t)ZB_MAC_INTERFACE_MONOLITHIC)
|
||||
#endif
|
||||
#if defined(ZB_MACSPLIT_HOST)
|
||||
#define ZB_MAC_INTERFACE_MACSPLIT_HOST_ID ((zb_uint8_t)ZB_MAC_INTERFACE_MACSPLIT_HOST)
|
||||
#endif
|
||||
#if defined(ZB_EXTMAC)
|
||||
#define ZB_MAC_INTERFACE_EXTMAC_ID ((zb_uint8_t)ZB_MAC_INTERFACE_EXTMAC)
|
||||
#endif
|
||||
#if defined(ZB_MAC_BLE)
|
||||
#define ZB_MAC_INTERFACE_BLE_ID ((zb_uint8_t)ZB_MAC_INTERFACE_BLE)
|
||||
#endif
|
||||
#if defined(ZB_MACSPLIT_DEVICE)
|
||||
#define ZB_MAC_INTERFACE_MACSPLIT_DEVICE_ID ((zb_uint8_t)ZB_MAC_INTERFACE_MACSPLIT_DEVICE)
|
||||
#endif
|
||||
#if defined(ZB_MAC_SUBGHZ)
|
||||
#define ZB_MAC_INTERFACE_SUBGHZ_ID ((zb_uint8_t)ZB_MAC_INTERFACE_SUBGHZ)
|
||||
#endif
|
||||
|
||||
/* C-STAT does not allow to assign ZB_MAC_INTERFACE_MAX to ZB_NWK_MAC_IFACE_TBL_SIZE,
|
||||
* so check configurations manually */
|
||||
#if defined(ZB_MAC_MONOLITHIC) && defined(ZB_MACSPLIT_HOST)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 2U
|
||||
#elif defined(ZB_MAC_MONOLITHIC) && defined(ZB_MAC_BLE)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 2U
|
||||
#elif defined(ZB_MAC_MONOLITHIC) && !defined(ZB_MACSPLIT_HOST) && !defined(ZB_MAC_BLE) && !defined(ZB_MACSPLIT_DEVICE) && !defined(ZB_MAC_SUBGHZ)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 1U
|
||||
#elif defined(ZB_MACSPLIT_HOST) && !defined(ZB_MAC_MONOLITHIC) && !defined(ZB_MAC_BLE) && !defined(ZB_MACSPLIT_DEVICE) && !defined(ZB_MAC_SUBGHZ)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 1U
|
||||
#elif defined(ZB_MACSPLIT_DEVICE) && !defined(ZB_MAC_MONOLITHIC) && !defined(ZB_MAC_BLE) && !defined(ZB_MACSPLIT_HOST) && !defined(ZB_MAC_SUBGHZ)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 1U
|
||||
/* MAC-split SoC uses default MAC interface, so for building device with only SoC interface just declare monolithic MAC */
|
||||
#define ZB_MAC_INTERFACE_MONOLITHIC_ID ZB_MAC_INTERFACE_MACSPLIT_DEVICE_ID
|
||||
#elif defined(NCP_MODE_HOST)
|
||||
/* Preserve default table size to keep previous stack behaviour, but
|
||||
* do not use any interfaces in that case */
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 1U
|
||||
#elif defined(ZB_EXTMAC)
|
||||
#define ZB_NWK_MAC_IFACE_TBL_SIZE 1U
|
||||
#else
|
||||
#error Multi-MAC configuration is not supported, at least one interface should be enabled
|
||||
#endif
|
||||
|
||||
#if ZB_NWK_MAC_IFACE_TBL_SIZE > 1U && defined(ZB_MAC_INTERFACE_SINGLE)
|
||||
#error ZB_MAC_INTERFACE_SINGLE requires to enable only one interface
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Flag that is used to perform some action on all interfaces together
|
||||
*/
|
||||
#define ZB_NWK_MULTIMAC_ALL_INTERFACES 0xFFU
|
||||
|
||||
/** @} */ /* mm_api */
|
||||
|
||||
#endif /*ZBOSS_API_MM_H*/
|
||||
@@ -0,0 +1,873 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Public Network layer API
|
||||
*/
|
||||
#ifndef ZB_ZBOSS_API_NWK_H
|
||||
#define ZB_ZBOSS_API_NWK_H 1
|
||||
|
||||
#include "zboss_api_mm.h"
|
||||
|
||||
/** \addtogroup nwk_api */
|
||||
/** @{ */
|
||||
|
||||
/** @addtogroup nwk_common_constants NWK common constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Network broadcast addresses types
|
||||
* @anchor nwk_broadcast_addresses
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_NWK_BROADCAST_ALL_DEVICES 0xFFFFu /**< All devices in PAN */
|
||||
#define ZB_NWK_BROADCAST_RX_ON_WHEN_IDLE 0xFFFDu /**< macRxOnWhenIdle = TRUE */
|
||||
#define ZB_NWK_BROADCAST_ROUTER_COORDINATOR 0xFFFCu /**< All routers and coordinator */
|
||||
#define ZB_NWK_BROADCAST_LOW_POWER_ROUTER 0xFFFBu /**< Low power routers only */
|
||||
|
||||
#define ZB_NWK_BROADCAST_RESERVED 0xFFF8u /**< Reserved value */
|
||||
/** @} */ /* nwk_broadcast_addresses */
|
||||
|
||||
/** @} */ /* nwk_common_constants */
|
||||
|
||||
/** @addtogroup nwk_management_service NWK management service
|
||||
* @{
|
||||
*/
|
||||
/** @brief Check that address is broadcast.
|
||||
* @param addr - 16-bit address
|
||||
* @return TRUE if address is broadcast, FALSE otherwise
|
||||
*/
|
||||
/* #define ZB_NWK_IS_ADDRESS_BROADCAST(addr) ( ((addr) & 0xFFF0) == 0xFFF0 ) */
|
||||
#define ZB_NWK_IS_ADDRESS_BROADCAST(addr) ( (addr) >= ZB_NWK_BROADCAST_RESERVED )
|
||||
/** @} */ /* nwk_management_service */
|
||||
|
||||
/** @addtogroup nwk_common_constants NWK common constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Network device type
|
||||
* @anchor nwk_device_type
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_NWK_DEVICE_TYPE_COORDINATOR 0U /*!< Device - Coordinator */
|
||||
#define ZB_NWK_DEVICE_TYPE_ROUTER 1U /*!< Device - Router */
|
||||
#define ZB_NWK_DEVICE_TYPE_ED 2U /*!< Device - End device */
|
||||
#define ZB_NWK_DEVICE_TYPE_NONE 3U /*!< Unknown Device */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for network device type
|
||||
*
|
||||
* Holds one of @ref nwk_device_type. Kept for backward compatibility as
|
||||
* @ref nwk_device_type were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_nwk_device_type_t;
|
||||
|
||||
/**
|
||||
* @name Leave types
|
||||
* @anchor nwk_leave_type
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_NWK_LEAVE_TYPE_RESET 0x00U /**< Leave without rejoin */
|
||||
#define ZB_NWK_LEAVE_TYPE_REJOIN 0x01U /**< Leave with rejoin */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for leave types
|
||||
*
|
||||
* Holds one of @ref nwk_leave_type. Kept for backward compatibility as
|
||||
* @ref nwk_leave_type were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_nwk_leave_type_t;
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
* @name Network command status codes
|
||||
* @anchor nwk_command_status
|
||||
*/
|
||||
/** @{ */
|
||||
#define ZB_NWK_COMMAND_STATUS_NO_ROUTE_AVAILABLE 0x00U /**< No route available */
|
||||
#define ZB_NWK_COMMAND_STATUS_TREE_LINK_FAILURE 0x01U /**< Tree link failure */
|
||||
#define ZB_NWK_COMMAND_STATUS_NONE_TREE_LINK_FAILURE 0x02U /**< None-tree link failure */
|
||||
#define ZB_NWK_COMMAND_STATUS_LOW_BATTERY_LEVEL 0x03U /**< Low battery level */
|
||||
#define ZB_NWK_COMMAND_STATUS_NO_ROUTING_CAPACITY 0x04U /**< No routing capacity */
|
||||
#define ZB_NWK_COMMAND_STATUS_NO_INDIRECT_CAPACITY 0x05U /**< No indirect capacity */
|
||||
#define ZB_NWK_COMMAND_STATUS_INDIRECT_TRANSACTION_EXPIRY 0x06U /**< Indirect transaction expiry */
|
||||
#define ZB_NWK_COMMAND_STATUS_TARGET_DEVICE_UNAVAILABLE 0x07U /**< Target device unavailable */
|
||||
#define ZB_NWK_COMMAND_STATUS_TARGET_ADDRESS_UNALLOCATED 0x08U /**< Target address unallocated */
|
||||
#define ZB_NWK_COMMAND_STATUS_PARENT_LINK_FAILURE 0x09U /**< Parent link failure */
|
||||
#define ZB_NWK_COMMAND_STATUS_VALIDATE_ROUTE 0x0aU /**< Validate route */
|
||||
#define ZB_NWK_COMMAND_STATUS_SOURCE_ROUTE_FAILURE 0x0bU /**< Source route failure */
|
||||
#define ZB_NWK_COMMAND_STATUS_MANY_TO_ONE_ROUTE_FAILURE 0x0cU /**< Many-to-one route failure */
|
||||
#define ZB_NWK_COMMAND_STATUS_ADDRESS_CONFLICT 0x0dU /**< Address conflict */
|
||||
#define ZB_NWK_COMMAND_STATUS_VERIFY_ADDRESS 0x0eU /**< Verify address */
|
||||
#define ZB_NWK_COMMAND_STATUS_PAN_IDENTIFIER_UPDATE 0x0fU /**< Pan ID update */
|
||||
#define ZB_NWK_COMMAND_STATUS_NETWORK_ADDRESS_UPDATE 0x10U /**< Network address update */
|
||||
#define ZB_NWK_COMMAND_STATUS_BAD_FRAME_COUNTER 0x11U /**< Bad frame counter */
|
||||
#define ZB_NWK_COMMAND_STATUS_BAD_KEY_SEQUENCE_NUMBER 0x12U /**< Bad key sequence number */
|
||||
#define ZB_NWK_COMMAND_STATUS_UNKNOWN_COMMAND 0x13U /**< Command received is not known *//** @} */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Type for network command status codes
|
||||
*
|
||||
* Holds one of @ref nwk_command_status. Kept for backward compatibility as
|
||||
* @ref nwk_command_status were declared previously as enum.
|
||||
*/
|
||||
typedef zb_uint8_t zb_nwk_command_status_t;
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
/** @} */ /* nwk_common_constants */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @brief 3.4.3 Network Status Command: Arguments of the NLME-STATUS.indication routine. */
|
||||
typedef ZB_PACKED_PRE struct zb_nlme_status_indication_s
|
||||
{
|
||||
zb_uint8_t status; /**< Error code associated with the failure */
|
||||
zb_uint16_t network_addr; /**< Network device address associated with the status information */
|
||||
zb_uint8_t unknown_command_id; /**< Unknown command ID
|
||||
(required for ZB_NWK_COMMAND_STATUS_UNKNOWN_COMMAND) */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nlme_status_indication_t;
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @addtogroup nwk_common_constants NWK common constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
LQI undefined value
|
||||
*/
|
||||
#define ZB_MAC_LQI_UNDEFINED 0U
|
||||
/**
|
||||
RSSI undefined value
|
||||
*/
|
||||
#define ZB_MAC_RSSI_UNDEFINED 0x7fU
|
||||
|
||||
/**
|
||||
Number of the first channel
|
||||
*/
|
||||
/* #define ZB_MAC_START_CHANNEL_NUMBER 11 */
|
||||
/**
|
||||
Maximal number of the channels
|
||||
*/
|
||||
#define ZB_MAC_MAX_CHANNEL_NUMBER 26U
|
||||
/**
|
||||
Total number of supported channels
|
||||
*/
|
||||
#define ZB_MAC_SUPPORTED_CHANNELS (ZB_MAC_MAX_CHANNEL_NUMBER + 1U)
|
||||
|
||||
/** @cond DOXYGEN_SE_SECTION */
|
||||
/* See D.10.2.1.3.2 Channel Pages */
|
||||
|
||||
/* North America and Mexico region Page 23 */
|
||||
|
||||
/**
|
||||
The first logical channel for Page 23 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE23_SUB_GHZ_START_LOGICAL_CHANNEL 0U
|
||||
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 23 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE23_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 23 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE23_SUB_GHZ_MAX_LOGICAL_CHANNEL 24U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 23 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE23_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE23_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE23_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/* Europe region Pages 24 - 27 */
|
||||
|
||||
/**
|
||||
The first logical channel for Page 24 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE24_SUB_GHZ_START_LOGICAL_CHANNEL 56U
|
||||
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 24 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE24_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 24 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE24_SUB_GHZ_MAX_LOGICAL_CHANNEL 76U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 24 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE24_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE24_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE24_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 25 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE25_SUB_GHZ_START_LOGICAL_CHANNEL 0U
|
||||
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 25 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE25_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 25 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE25_SUB_GHZ_MAX_LOGICAL_CHANNEL 26U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 25 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE25_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE25_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE25_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 26 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE26_SUB_GHZ_START_LOGICAL_CHANNEL 27U
|
||||
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 26 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE26_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 26 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE26_SUB_GHZ_MAX_LOGICAL_CHANNEL 34U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 26 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE26_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE26_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE26_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 27 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE27_SUB_GHZ_START_LOGICAL_CHANNEL 35U
|
||||
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 27 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE27_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 27 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE27_SUB_GHZ_MAX_LOGICAL_CHANNEL 55U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 27 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE27_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE27_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE27_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/* Great Britain region Pages 28 - 31 */
|
||||
|
||||
/**
|
||||
The first logical channel for Page 28 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE28_SUB_GHZ_START_LOGICAL_CHANNEL 0U
|
||||
|
||||
/* 08/21/2017 EE CR:MINOR Am I right this value is always 0 for any page? Do we ever need separate constants? */
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 28 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE28_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 28 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE28_SUB_GHZ_MAX_LOGICAL_CHANNEL 26U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 28 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE28_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE28_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE28_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 29 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_START_LOGICAL_CHANNEL 27U
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 29 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 29 Sub GHz (for solid range 27-34)
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_PRE_MAX_LOGICAL_CHANNEL 34U
|
||||
/**
|
||||
The last logical channel for Page 29 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_MAX_LOGICAL_CHANNEL 62U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 29 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE29_SUB_GHZ_PRE_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE29_SUB_GHZ_START_LOGICAL_CHANNEL + 1U /* 62 channel */)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 30 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE30_SUB_GHZ_START_LOGICAL_CHANNEL 35U
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 30 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE30_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 30 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE30_SUB_GHZ_MAX_LOGICAL_CHANNEL 61U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 30 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE30_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE30_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE30_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
|
||||
/**
|
||||
The first logical channel for Page 31 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE31_SUB_GHZ_START_LOGICAL_CHANNEL 0U
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 31 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE31_SUB_GHZ_START_CHANNEL_NUMBER 0U
|
||||
/**
|
||||
The last logical channel for Page 31 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE31_SUB_GHZ_MAX_LOGICAL_CHANNEL 26U
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 31 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE31_SUB_GHZ_MAX_CHANNEL_NUMBER (ZB_PAGE31_SUB_GHZ_MAX_LOGICAL_CHANNEL - \
|
||||
ZB_PAGE31_SUB_GHZ_START_LOGICAL_CHANNEL)
|
||||
/** @endcond */ /* DOXYGEN_SE_SECTION */
|
||||
/* ZB_MAC_START_CHANNEL_NUMBER */
|
||||
/**
|
||||
The first logical channel for Page 0 2.4GHz
|
||||
*/
|
||||
#define ZB_PAGE0_2_4_GHZ_START_LOGICAL_CHANNEL 11U
|
||||
/* Let's keep compatibility with bits layout in ZBOSS without sub-gig: start from 11 in 2.4.
|
||||
Actually, only subgig pages 28 and 31 are ok too (logical == bit#). Pages 29 and 30 are special case.
|
||||
*/
|
||||
/**
|
||||
Number of the first channel in channel mask for Page 0 2.4GHz
|
||||
*/
|
||||
#define ZB_PAGE0_2_4_GHZ_START_CHANNEL_NUMBER ZB_PAGE0_2_4_GHZ_START_LOGICAL_CHANNEL
|
||||
/**
|
||||
The last logical channel in channel mask for Page 0 2.4GHz
|
||||
*/
|
||||
#define ZB_PAGE0_2_4_GHZ_MAX_LOGICAL_CHANNEL ZB_MAC_MAX_CHANNEL_NUMBER
|
||||
/**
|
||||
Number of the last channel in channel mask for Page 0 2.4GHz
|
||||
*/
|
||||
#define ZB_PAGE0_2_4_GHZ_MAX_CHANNEL_NUMBER ZB_MAC_MAX_CHANNEL_NUMBER
|
||||
/* (ZB_PAGE0_2_4_GHZ_MAX_LOGICAL_CHANNEL - \ */
|
||||
/* ZB_PAGE0_2_4_GHZ_START_LOGICAL_CHANNEL) */
|
||||
|
||||
/** @cond DOXYGEN_SE_SECTION */
|
||||
/**
|
||||
Maximal number of channels for Page 23 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE23_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE23_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE23_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 24 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE24_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE24_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE24_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 25 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE25_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE25_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE25_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 26 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE26_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE26_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE26_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 27 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE27_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE27_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE27_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
|
||||
/**
|
||||
Maximal number of channels for Page 28 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE28_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE28_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE28_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 29 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE29_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE29_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE29_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 30 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE30_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE30_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE30_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/**
|
||||
Maximal number of channels for Page 31 Sub GHz
|
||||
*/
|
||||
#define ZB_PAGE31_SUB_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE31_SUB_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE31_SUB_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/** @endcond */ /* DOXYGEN_SE_SECTION */
|
||||
/**
|
||||
Maximal number of channels for Page 0 2.4GHz
|
||||
*/
|
||||
#define ZB_PAGE0_2_4_GHZ_MAX_CHANNELS_COUNT (ZB_PAGE0_2_4_GHZ_MAX_CHANNEL_NUMBER - \
|
||||
ZB_PAGE0_2_4_GHZ_START_CHANNEL_NUMBER + 1U)
|
||||
/** @cond DOXYGEN_SE_SECTION */
|
||||
/**
|
||||
Maximal number of ed scan channels for all pages
|
||||
*/
|
||||
#define ZB_ED_SCAN_MAX_CHANNELS_COUNT \
|
||||
((ZB_IO_BUF_SIZE - sizeof(zb_uint8_t)) / sizeof(zb_energy_detect_channel_info_t))
|
||||
/**
|
||||
Max # of network descriptors which can fit into a single buffer.
|
||||
*/
|
||||
#define ZB_ACTIVE_SCAN_MAX_NETWORK_COUNT \
|
||||
((ZB_IO_BUF_SIZE - sizeof(zb_nlme_network_discovery_confirm_t)) / sizeof(zb_nlme_network_descriptor_t))
|
||||
|
||||
#define ZB_CHANNEL_PAGE_MAX_CHANNELS_COUNT ZB_PAGE28_SUB_GHZ_MAX_CHANNELS_COUNT
|
||||
/** @endcond */ /* DOXYGEN_SE_SECTION */
|
||||
/** @} */ /* nwk_common_constants */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @addtogroup nwk_pib_cache PIB cache
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
Data structure used to cache frequently used PIB attributes.
|
||||
|
||||
Useful when using alien MAC layer without direct access to PIB: blockable "get"
|
||||
interface to PIB is too complex and slow.
|
||||
*/
|
||||
typedef struct zb_nwk_pib_cache_s
|
||||
{
|
||||
zb_uint16_t mac_short_address; /*!< The 16-bit address that the device uses
|
||||
to communicate in the PAN. */
|
||||
zb_uint16_t mac_pan_id; /*!< The 16-bit identifier of the PAN on which
|
||||
the device is operating. If this value is 0xffff,
|
||||
the device is not associated. */
|
||||
zb_ieee_addr_t mac_extended_address; /*!< The 64-bit (IEEE) address assigned to the device. */
|
||||
|
||||
zb_uint8_t mac_association_permit; /*!< Indication of whether a coordinator is currently
|
||||
allowing association. A value of TRUE indicates*/
|
||||
zb_uint8_t mac_rx_on_when_idle; /*!< Indication of whether the MAC sublayer is to enable
|
||||
its receiver during idle periods. */
|
||||
zb_uint8_t phy_current_page[ZB_NWK_MAC_IFACE_TBL_SIZE]; /*!< Index of current physical channel page */
|
||||
zb_uint8_t phy_current_channel[ZB_NWK_MAC_IFACE_TBL_SIZE]; /*!< Index of current physical channel */
|
||||
zb_uint8_t phy_primary_iface; /*!< Index of MAC interface that is used for joining */
|
||||
} zb_nwk_pib_cache_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name PIB cache mirror
|
||||
* \par Here are cache of PIB / NIB mirror of PIB values.
|
||||
*
|
||||
* After that values modified in NWK or upper, must sync it with MAC using MLME-SET.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
Function used to access PIB cache.
|
||||
@return pointer to PIB cache.
|
||||
*/
|
||||
zb_nwk_pib_cache_t *zb_nwk_get_pib_cache(void);
|
||||
/**
|
||||
Macro used to access PIB cache.
|
||||
@return pointer to PIB cache.
|
||||
*/
|
||||
|
||||
|
||||
/* We get false-positive violations of MISRA rules 5.2 and 5.4 here
|
||||
* because an internal header redefine ZB_PIB_CACHE macro for
|
||||
* optimization purposes, and C-STAT can not properly handle
|
||||
* #undef usage. Only one macro definition is valid at a time,
|
||||
* but MISRA rules 5.2 and 5.4 prohibit two definitions of a
|
||||
* symbol simultaneously.
|
||||
* We ensure that only one instance of the macro is effectively
|
||||
* defined here. */
|
||||
#ifdef ZB_PIB_CACHE
|
||||
#error Please ensure that you are not including any internal headers which redefine ZB_PIB_CACHE macro before including this file
|
||||
#else /* ZB_PIB_CACHE */
|
||||
/*cstat !MISRAC2012-Rule-5.2_c99 !MISRAC2012-Rule-5.4_c99 */
|
||||
#define ZB_PIB_CACHE() zb_nwk_get_pib_cache()
|
||||
#endif /* ZB_PIB_CACHE */
|
||||
|
||||
#ifndef NCP_MODE_HOST
|
||||
/** Cached value of device network address */
|
||||
#define ZB_PIBCACHE_NETWORK_ADDRESS() ZB_PIB_CACHE()->mac_short_address
|
||||
/** Cached value of device Pan ID */
|
||||
#define ZB_PIBCACHE_PAN_ID() ZB_PIB_CACHE()->mac_pan_id
|
||||
/** Cached value of device extended address */
|
||||
#define ZB_PIBCACHE_EXTENDED_ADDRESS() ZB_PIB_CACHE()->mac_extended_address
|
||||
/** Cached value of RxOnWhenIdle attribute */
|
||||
#ifdef ZB_ED_RX_OFF_WHEN_IDLE
|
||||
#define ZB_PIBCACHE_RX_ON_WHEN_IDLE() ZB_B2U(!ZB_IS_DEVICE_ZED())
|
||||
#else
|
||||
#define ZB_PIBCACHE_RX_ON_WHEN_IDLE() ZB_PIB_CACHE()->mac_rx_on_when_idle
|
||||
#endif
|
||||
/** Cached value of AssociationPermit attribute */
|
||||
#define ZB_PIBCACHE_ASSOCIATION_PERMIT() ZB_PIB_CACHE()->mac_association_permit
|
||||
|
||||
#define ZB_PIBCACHE_PRIMARY_IFACE() ZB_PIB_CACHE()->phy_primary_iface
|
||||
#define ZB_PIBCACHE_PRIMARY_IFACE_PAGE() ZB_PIB_CACHE()->phy_current_page[ZB_PIB_CACHE()->phy_primary_iface]
|
||||
#define ZB_PIBCACHE_PRIMARY_IFACE_CHANNEL() ZB_PIB_CACHE()->phy_current_channel[ZB_PIB_CACHE()->phy_primary_iface]
|
||||
|
||||
/** Cached value of CurrentChannel attribute */
|
||||
#define ZB_PIBCACHE_CURRENT_CHANNEL() ZB_PIBCACHE_PRIMARY_IFACE_CHANNEL()
|
||||
#define ZB_PIBCACHE_CURRENT_CHANNEL_BY_IFACE(iface_id) ZB_PIB_CACHE()->phy_current_channel[iface_id]
|
||||
#define ZB_PIBCACHE_CURRENT_CHANNELS_LIST() ZB_PIB_CACHE()->phy_current_channel
|
||||
/** Cached value of CurrentPage attribute */
|
||||
#define ZB_PIBCACHE_CURRENT_PAGE() ZB_PIBCACHE_PRIMARY_IFACE_PAGE()
|
||||
#define ZB_PIBCACHE_CURRENT_PAGE_BY_IFACE(iface_id) ZB_PIB_CACHE()->phy_current_page[iface_id]
|
||||
#define ZB_PIBCACHE_CURRENT_PAGES_LIST() ZB_PIB_CACHE()->phy_current_page
|
||||
|
||||
#else /* NCP_MODE_HOST */
|
||||
|
||||
/** Cached value of device network address */
|
||||
#define ZB_PIBCACHE_NETWORK_ADDRESS() zb_get_short_address()
|
||||
/** Cached value of RxOnWhenIdle attribute */
|
||||
#ifdef ZB_ED_RX_OFF_WHEN_IDLE
|
||||
/* Make simpler checks if ZED always rx-off-when-idle */
|
||||
#undef ZB_PIBCACHE_RX_ON_WHEN_IDLE
|
||||
#define ZB_PIBCACHE_RX_ON_WHEN_IDLE() ZB_B2U(!ZB_IS_DEVICE_ZED())
|
||||
#else
|
||||
#define ZB_PIBCACHE_RX_ON_WHEN_IDLE() ZB_B2U(zb_get_rx_on_when_idle())
|
||||
#endif
|
||||
#endif /* !NCP_MODE_HOST */
|
||||
|
||||
/**
|
||||
Arguments of the NLME-PERMIT_JOINING.request routine.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_nlme_permit_joining_request_s
|
||||
{
|
||||
zb_uint8_t permit_duration; /**< Time in seconds during which the coordinator
|
||||
* or router will allow associations */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nlme_permit_joining_request_t;
|
||||
|
||||
/**
|
||||
NLME-PERMIT-JOINING.request primitive
|
||||
|
||||
Allow/disallow network joining
|
||||
|
||||
@param param - buffer containing parameters - @see
|
||||
zb_nlme_network_formation_request_t
|
||||
@return RET_OK on success, error code otherwise.
|
||||
|
||||
@snippet doxygen_snippets.dox zb_nlme_permit_joining_request
|
||||
*/
|
||||
void zb_nlme_permit_joining_request(zb_uint8_t param);
|
||||
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @addtogroup nwk_panid_conflicts NWK PAN ID conflicts
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_PAN_ID_CONFLICT_INFO_MAX_PANIDS_COUNT 16U
|
||||
|
||||
/** Structure describing a detected PAN ID conflict */
|
||||
typedef ZB_PACKED_PRE struct zb_pan_id_conflict_info_s
|
||||
{
|
||||
zb_uint16_t panid_count; /* <! Count of neighboring PAN IDs. */
|
||||
zb_uint16_t panids[ZB_PAN_ID_CONFLICT_INFO_MAX_PANIDS_COUNT];
|
||||
/* <! Array of such PAN IDs.
|
||||
* Only values at indices 0..(panid_count - 1) will be taken
|
||||
* into consideration. */
|
||||
} ZB_PACKED_STRUCT zb_pan_id_conflict_info_t;
|
||||
|
||||
/**
|
||||
Allow/disallow network joining
|
||||
|
||||
@param param - pointer to a structure containing PAN ID conflict
|
||||
information - @see zb_pan_id_conflict_info_t
|
||||
|
||||
* @b Example:
|
||||
ZB_ZDO_SIGNAL_CUT_HEADER macro may be used to remove from the buffer everything but the signal parameter (zb_pan_id_conflict_info_t structure in this case)
|
||||
@code
|
||||
|
||||
void zboss_signal_handler(zb_uint8_t param)
|
||||
{
|
||||
zb_pan_id_conflict_info_t *info = NULL;
|
||||
zb_zdo_app_signal_hdr_t *sg_p = NULL;
|
||||
zb_zdo_app_signal_type_t sig = zb_get_app_signal(param, &sg_p);
|
||||
|
||||
if (ZB_GET_APP_SIGNAL_STATUS(param) == 0)
|
||||
{
|
||||
switch (sig)
|
||||
{
|
||||
case ZB_NWK_SIGNAL_PANID_CONFLICT_DETECTED:
|
||||
info = ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, zb_pan_id_conflict_info_t);
|
||||
ZB_ZDO_SIGNAL_CUT_HEADER(ZB_BUF_FROM_REF(param));
|
||||
zb_start_pan_id_conflict_resolution(param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void zb_start_pan_id_conflict_resolution(zb_uint8_t param);
|
||||
|
||||
|
||||
/**
|
||||
This function must be used for enabling/disabling automatic PAN ID conflict resolution
|
||||
If the automatic resolution is disabled, ZBOSS will issue a ZB_NWK_SIGNAL_PANID_CONFLICT_DETECTED
|
||||
signal each time it receives Network Report about PAN ID conflict or (in case the device is
|
||||
the network manager) each time it detects such conflicts.
|
||||
|
||||
By default the automatic PAN ID conflict resolution is disabled.
|
||||
|
||||
That call also enabled panid conflict resolution - see zb_enable_panid_conflict_resolution();
|
||||
|
||||
@param status - ZB_TRUE in order to enable automatic PAN ID conflict, ZB_FALSE otherwise
|
||||
*/
|
||||
void zb_enable_auto_pan_id_conflict_resolution(zb_bool_t status);
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Toggles panid conflict resolution.
|
||||
|
||||
Call of that function forces linking of panid conflict resolution
|
||||
code and allows switching on/off panid conflict resolution and detection
|
||||
logic.
|
||||
*/
|
||||
void zb_enable_panid_conflict_resolution(zb_bool_t status);
|
||||
/** @endcond */ /* internals_doc */
|
||||
/** @} */ /* nwk_panid_conflicts */
|
||||
|
||||
/** @addtogroup nwk_management_service NWK management service
|
||||
* @{
|
||||
*/
|
||||
#ifdef ZB_LOW_SECURITY_MODE
|
||||
/**
|
||||
Public API to set device security level to 0
|
||||
@deprecated This function will be removed in the next Major release after june 2023.
|
||||
Now security level is always equal to 5.
|
||||
*/
|
||||
void zb_disable_nwk_security(void);
|
||||
|
||||
/**
|
||||
Public API to set device security level to 5
|
||||
@deprecated This function will be removed in the next Major release after june 2023.
|
||||
Now security level is always equal to 5.
|
||||
*/
|
||||
void zb_enable_nwk_security(void);
|
||||
#endif /* ZB_LOW_SECURITY_MODE */
|
||||
|
||||
#ifdef ZB_NWK_CONFIGURABLE_DST_IEEE_IN_HDR
|
||||
/**
|
||||
Configure Destination IEEE policy for out NWK frames
|
||||
|
||||
@param put_always - if ZB_TRUE, put DST IEEE for all NWK frame types, if it is set to ZB_FALSE -
|
||||
put it for NWK Command frame type only
|
||||
Default value is ZB_TRUE.
|
||||
*/
|
||||
void zb_nwk_set_ieee_policy(zb_bool_t put_always);
|
||||
#endif /* ZB_NWK_CONFIGURABLE_DST_IEEE_IN_HDR */
|
||||
/** @} */ /* nwk_management_service */
|
||||
|
||||
/** @addtogroup nwk_mtorr NWK MTORR functionality
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef ZB_COORDINATOR_ROLE
|
||||
/**
|
||||
Enable Concentrator mode for the device (disabled by default).
|
||||
It's possible to call this function to send MTORR immediately, e.g. after a new device joined the network.
|
||||
It does affect only for Coordinator role.
|
||||
|
||||
@param radius - the hop count radius for concentrator route discoveries.
|
||||
If the value is set zero then the default radius will be used.
|
||||
@param disc_time - the time in seconds between concentrator route discoveries.
|
||||
If the value is set to zero, the route discoveries are done by the application layer only.
|
||||
*/
|
||||
void zb_start_concentrator_mode(zb_uint8_t radius, zb_uint32_t disc_time);
|
||||
|
||||
/**
|
||||
Disable Concentrator mode for the device.
|
||||
It does affect only for Coordinator role.
|
||||
*/
|
||||
void zb_stop_concentrator_mode(void);
|
||||
#endif /* ZB_COORDINATOR_ROLE */
|
||||
/** @} */ /* nwk_mtorr */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
Change Transmit Failure Threshold for Neighbor table.
|
||||
This threshold defines how many packets may fail the delivery before stack will start Address
|
||||
Discovery.
|
||||
Formula for discovery start: if device is a neighbor and packet can not be delivered, try to
|
||||
- do "Transmit Failure Threshold" attempts of packet delivery
|
||||
- if packet is not delivered, wait "Transmit Failure Timeout"
|
||||
- if packet is not delivered, remove device from neighbors and start address discovery procedure
|
||||
@param transmit_failure_cnt - new threshold (1 to 255)
|
||||
Default value - @ref ZB_ZDO_NEIGHBOR_FAILURE_PKT_THRESHOLD
|
||||
*/
|
||||
void zb_set_nbt_transmit_failure_threshold(zb_uint8_t transmit_failure_cnt);
|
||||
/**
|
||||
Change Transmit Failure Timeout for Neighbor table.
|
||||
This timeout defines how much time stack will wait before starting Network Address
|
||||
discovery. Countdown starts after Transmit Failure Threshold condition is met.
|
||||
@param transmit_failure_timeout - new timeout in seconds (0 to 255)
|
||||
Default value - @ref ZB_ZDO_NEIGHBOR_UNREACHABLE_TIMEOUT
|
||||
*/
|
||||
void zb_set_nbt_transmit_failure_timeout(zb_uint8_t transmit_failure_timeout);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @addtogroup nwk_management_service NWK management service
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
Get own device type.
|
||||
|
||||
@return One of the values from @ref nwk_device_type.
|
||||
|
||||
@snippet onoff_server/on_off_output_zc.c zb_get_device_type_example
|
||||
*/
|
||||
zb_nwk_device_type_t zb_get_device_type(void);
|
||||
|
||||
/**
|
||||
Get short address of the parent node.
|
||||
|
||||
@return Short address of the parent node or ZB_UNKNOWN_SHORT_ADDR if the device isn't joined to a network.
|
||||
*/
|
||||
zb_uint16_t zb_nwk_get_parent(void);
|
||||
|
||||
#define ZB_NWK_NBR_ITERATOR_INDEX_EOT 0xFFFFU /*! Index, indicating that the iterator reached boundaries of the neighbour table. */
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_nwk_nbr_iterator_cb_params_s {
|
||||
zb_uint16_t index; /*!< In the callback function:
|
||||
* Index of the returned neighbour table entry.
|
||||
* The value of ZB_NWK_NBR_ITERATOR_INDEX_EOT
|
||||
* indicates that the entry was not returned and
|
||||
* the buffer payload should be ignored.
|
||||
* If the structure is passed as the API call parameters:
|
||||
* Index, from which the next neighbour table
|
||||
* entry should be searched.
|
||||
*/
|
||||
zb_uint32_t update_count; /*!< In the callback function:
|
||||
* The current value of the table update counter.
|
||||
* This parameter is ignored in the API call parameters.
|
||||
*/
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nwk_nbr_iterator_params_t;
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_nwk_nbr_iterator_entry_s
|
||||
{
|
||||
zb_ieee_addr_t ieee_addr; /*!< Long address (EUI64) of the device. */
|
||||
zb_uint16_t short_addr; /*!< Short address (network address) of the device. */
|
||||
|
||||
zb_uint8_t device_type; /*!< Neighbor device type - @see @ref nwk_device_type */
|
||||
zb_uint8_t depth; /*!< The network depth of this device.
|
||||
* A value of 0x00 indicates that this device is the
|
||||
* Zigbee coordinator for the network.
|
||||
*/
|
||||
zb_uint8_t rx_on_when_idle; /*!< Indicates if neighbour receiver enabled during idle periods:
|
||||
* TRUE = Receiver is on
|
||||
* FALSE = Receiver is off
|
||||
* This field should be present for entries that record the parent or
|
||||
* children of a Zigbee router or Zigbee coordinator.
|
||||
*/
|
||||
zb_uint8_t relationship; /*!< The relationship between the neighbour and the current device.
|
||||
* This field shall be present in every neighbour table entry.
|
||||
* @if DOXYGEN_INTERNAL_DOC See @ref nwk_relationship @endif
|
||||
*/
|
||||
zb_uint8_t send_via_routing; /*!< That field is deprecated. Removed
|
||||
* from zb_neighbor_tbl_ent_t, always 0
|
||||
* here. */
|
||||
|
||||
zb_uint8_t keepalive_received; /*!< This value indicates at least one keepalive
|
||||
* has been received from the end device since
|
||||
* the router has rebooted.
|
||||
*/
|
||||
zb_uint8_t mac_iface_idx; /*!< An index into the MAC Interface Table
|
||||
* indicating what interface the neighbour or
|
||||
* child is bound to.
|
||||
*/
|
||||
|
||||
zb_uint8_t transmit_failure_cnt; /*!< Transmit failure counter (used to initiate
|
||||
* device address search).
|
||||
*/
|
||||
zb_uint8_t lqi; /*!< Link quality. Also used to calculate
|
||||
* incoming cost
|
||||
*/
|
||||
zb_int8_t rssi; /*!< Received signal strength indicator */
|
||||
zb_uint8_t outgoing_cost; /*!< The cost of an outgoing link. Got from link status. */
|
||||
zb_uint8_t age; /*!< Counter value for router aging.
|
||||
* The number of nwkLinkStatusPeriod intervals since a
|
||||
* link status command was received.
|
||||
*/
|
||||
zb_uint32_t device_timeout; /*!< Configured end device timeout, in seconds. */
|
||||
zb_uint32_t timeout_counter; /*!< Timeout value ED aging, in milliseconds. */
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_nwk_nbr_iterator_entry_t;
|
||||
|
||||
/**
|
||||
Read the next active entry from the NWK neighbour table.
|
||||
The index indicates the point, from which the entry will be searched in the neighbour table.
|
||||
This API returns neighbour table entry inside the buffer payload, that are connected to the same PAN
|
||||
and their entries are not marked as stale or timed out.
|
||||
The index of the entry is passed as buffer parameters.
|
||||
|
||||
@param bufid The ZBOSS buffer, containing arguments defined by zb_nwk_nbr_iterator_params_t structure, passed as buffer parameters.
|
||||
@param cb Callback function, that will get the next neighbour table entry.
|
||||
*/
|
||||
zb_ret_t zb_nwk_nbr_iterator_next(zb_uint8_t bufid, zb_callback_t cb);
|
||||
|
||||
/** @} */ /* nwk_management_service */
|
||||
|
||||
zb_ret_t zb_mac_enable_interface(zb_uint8_t iface_id);
|
||||
zb_ret_t zb_mac_disable_interface(zb_uint8_t iface_id);
|
||||
|
||||
zb_bool_t zb_mac_is_interface_active(zb_uint8_t iface_id);
|
||||
|
||||
void zb_nwk_mm_set_channel_mask(zb_uint8_t iface_id, zb_uint8_t page_index, zb_uint32_t channel_mask);
|
||||
|
||||
/** @} */ /* nwk_api */
|
||||
|
||||
#endif /*#ifndef ZB_ZBOSS_API_NWK_H*/
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS Zigbee cluster library API header
|
||||
*/
|
||||
#ifndef ZBOSS_API_TL_H
|
||||
#define ZBOSS_API_TL_H 1
|
||||
|
||||
#include "zb_types.h"
|
||||
|
||||
#include "zcl/zb_zcl_config.h"
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
#include "zcl/zb_zcl_touchlink_commissioning.h"
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_TOUCHLINK_FEATURE) */
|
||||
|
||||
/**
|
||||
* @addtogroup ZB_ZCL_TOUCHLINK_COMMON
|
||||
* @{
|
||||
* @details
|
||||
* This section describes data structures and common definitions used by Touchlink cluster.
|
||||
*/
|
||||
|
||||
/** Controls number of device info record stored in Touchlink transaction context. */
|
||||
#define ZB_ZLL_TRANS_CTX_DEV_INFO_MAX_NUMBER 8U
|
||||
|
||||
/** Controls number of endpoint descriptions stored in Touchlink transaction context. */
|
||||
#define ZB_ZLL_TRANS_CTX_EP_INFO_MAX_NUMBER 6U
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @brief Touchlink Address range */
|
||||
typedef struct zb_zll_addr_range_s
|
||||
{
|
||||
zb_uint16_t addr_begin;
|
||||
zb_uint16_t addr_end;
|
||||
}
|
||||
zb_zll_addr_range_t;
|
||||
|
||||
/** @brief Touchlink Group ID range */
|
||||
typedef struct zb_zll_group_id_range_s
|
||||
{
|
||||
zb_uint16_t group_id_begin;
|
||||
zb_uint16_t group_id_end;
|
||||
}
|
||||
zb_zll_group_id_range_t;
|
||||
|
||||
/** Touchlink Sub-device information */
|
||||
typedef struct zb_zll_sub_device_info_s
|
||||
{
|
||||
zb_uint8_t ep_id;
|
||||
zb_uint16_t profile_id;
|
||||
zb_uint16_t device_id;
|
||||
zb_uint8_t version;
|
||||
zb_uint8_t group_id_count;
|
||||
zb_uint8_t dev_idx; /**< Index (in the device info table) of the device endpoint belongs to. */
|
||||
} zb_zll_sub_device_info_t;
|
||||
|
||||
/** Touchlink Discovered device information */
|
||||
typedef struct zb_zll_ext_device_info_s
|
||||
{
|
||||
/** @brief Our custom field to be able to address device information request. */
|
||||
zb_ieee_addr_t device_addr;
|
||||
zb_uint8_t rssi_correction;
|
||||
zb_uint8_t zb_info;
|
||||
zb_uint8_t zll_info;
|
||||
zb_uint16_t key_info;
|
||||
zb_uint32_t resp_id;
|
||||
zb_ext_pan_id_t ext_pan_id;
|
||||
zb_uint8_t nwk_update_id;
|
||||
zb_uint8_t channel_number;
|
||||
zb_uint16_t pan_id;
|
||||
zb_uint16_t nwk_addr;
|
||||
zb_uint8_t sub_device_count;
|
||||
zb_uint8_t total_group_id_count;
|
||||
zb_uint8_t ep_info_idx;
|
||||
zb_int8_t rssi;
|
||||
} zb_zll_ext_device_info_t;
|
||||
|
||||
/**
|
||||
* @brief Structure to store data for Touchlink Start new network command.
|
||||
* Stored in the context on the target side.
|
||||
*/
|
||||
typedef struct zb_zll_start_new_network_target_data_s
|
||||
{
|
||||
zb_uint16_t seq_number; /**< ZCL sequence number. */
|
||||
zb_uint16_t pan_id; /**< Identifier of the PAN to be created. */
|
||||
zb_ext_pan_id_t ext_pan_id; /**< Extended identifier of the PAN to be created. */
|
||||
zb_uint8_t channel; /**< Channel to be used for PAN creation. */
|
||||
zb_uint16_t short_addr; /**< New short addr */
|
||||
zb_ieee_addr_t target_ieee_addr; /**< Target IEEE addr */
|
||||
} zb_zll_start_new_network_target_data_t;
|
||||
|
||||
/** @brief Touchlink Start router struct */
|
||||
typedef struct zb_zll_start_router_param_s
|
||||
{
|
||||
zb_ext_pan_id_t ext_pan_id; /**< Extension Pan ID */
|
||||
zb_uint16_t short_pan_id; /**< Short address Pan ID */
|
||||
zb_uint8_t channel; /**< Channel number */
|
||||
zb_uint16_t short_addr; /**< New short address of router */
|
||||
}
|
||||
zb_zll_start_router_param_t;
|
||||
|
||||
/** @brief Touchlink Rejoin struct */
|
||||
typedef struct zb_zll_rejon_nwk_ed_param_s
|
||||
{
|
||||
zb_ext_pan_id_t ext_pan_id; /**< Extension Pan ID */
|
||||
zb_uint16_t short_pan_id; /**< Short address Pan ID */
|
||||
zb_uint8_t channel; /**< Channel number */
|
||||
}
|
||||
zb_zll_rejon_nwk_ed_param_t;
|
||||
|
||||
/** @brief Touchlink Join router struct */
|
||||
typedef struct zb_zll_network_join_router_data_s
|
||||
{
|
||||
zb_ieee_addr_t target_ieee_addr; /**< Target IEEE addr */
|
||||
} zb_zll_network_join_router_data_t;
|
||||
|
||||
/**
|
||||
* @brief Type of the Touchlink command data storage.
|
||||
* Stored in the context on the target side for to be used in asynchronous chains.
|
||||
*/
|
||||
typedef union zb_zll_command_target_data_u
|
||||
{
|
||||
zb_zll_start_new_network_target_data_t start_new_nwk; /**< "Start new network" command data. */
|
||||
zb_zll_start_router_param_t start_router_param; /**< Parameters for start router command */
|
||||
zb_zll_rejon_nwk_ed_param_t rejoin_nwk_param; /**< Parameters for rejoin nwk end device router
|
||||
* command */
|
||||
zb_zll_network_join_router_data_t nwk_join_router; /**< Parameters for rejoin nwk end device router command */
|
||||
} zb_zll_command_target_data_t;
|
||||
|
||||
/**
|
||||
* @brief Touchlink callback type for checking requested action is allowed.
|
||||
* @param action [IN] - action to check.
|
||||
* @returns ZB_TRUE if action allowed, ZB_FALSE otherwise.
|
||||
*/
|
||||
typedef zb_bool_t (*zb_zll_is_action_allowed_cb_t)(zb_uint8_t action);
|
||||
|
||||
/** Touchlink device info data */
|
||||
typedef struct zb_zll_device_info_s
|
||||
{
|
||||
zb_uint8_t rssi_correction;
|
||||
zb_uint8_t zll_info;
|
||||
zb_uint16_t key_info;
|
||||
zb_uint8_t key_index;
|
||||
zb_zll_addr_range_t addr_range;
|
||||
zb_zll_group_id_range_t group_id_range;
|
||||
zb_uint8_t total_group_id_count; /* TODO: Not sure it is needed maybe calculate it using group ID
|
||||
count for EP? */
|
||||
/** @brief User-provided "report task result" callback. */
|
||||
zb_callback_t report_task_result;
|
||||
|
||||
zb_uint8_t master_key[16];
|
||||
zb_uint8_t certification_key[16];
|
||||
zb_uint32_t transaction_id;
|
||||
zb_uint32_t response_id;
|
||||
zb_uint8_t encr_nwk_key[16]; /* FIXME: do we really need to store it? */
|
||||
|
||||
zb_uint16_t identify_duration; /**< Identify duration period for ZLL commissioning server. */
|
||||
zb_callback_t identify_handler; /**< User-provided identify start/stop handler. */
|
||||
|
||||
zb_uint8_t freqagility_channel;
|
||||
zb_uint8_t nwk_channel; /* Logical channel number for start/join the network (as initiator
|
||||
* role) */
|
||||
zb_int8_t rssi_threshold; /* RSSI threshold */
|
||||
zb_uint32_t target_timeout; /* Timeout for target to wait initiator */
|
||||
}
|
||||
zb_zll_device_info_t;
|
||||
|
||||
/** @brief Touchlink transaction data context */
|
||||
typedef struct zb_zll_transaction_ctx_s
|
||||
{
|
||||
/** @brief Inter-PAN transaction identifier for the transaction under processing. */
|
||||
zb_uint32_t transaction_id;
|
||||
|
||||
/** Specifies if identify request was sent during transaction */
|
||||
zb_bitfield_t identify_sent:1;
|
||||
/** "Send confirmed" flag. */
|
||||
zb_bitfield_t send_confirmed:1;
|
||||
/** "Scan timed out" flag. */
|
||||
zb_bitfield_t scan_timed_out:1;
|
||||
/** "Extended scan" flag. */
|
||||
zb_bitfield_t ext_scan:1;
|
||||
/** "Out of memory" flag. */
|
||||
zb_bitfield_t out_of_memory:1;
|
||||
|
||||
/** Source device address received with the packet in the current transaction stage. */
|
||||
zb_ieee_addr_t src_addr;
|
||||
|
||||
/**
|
||||
* @brief Describe current transaction task. Possible tasks are defined in enumeration @ref
|
||||
* zb_zll_transaction_task_e
|
||||
*/
|
||||
zb_ushort_t transaction_task;
|
||||
|
||||
zb_uint8_t n_device_infos; /**< Number of device infos currently stored in the table. */
|
||||
zb_uint8_t current_dev_info_idx; /**< Index for the device info record iterator. */
|
||||
/** Table of devices reported during the active transaction. */
|
||||
zb_zll_ext_device_info_t device_infos[ZB_ZLL_TRANS_CTX_DEV_INFO_MAX_NUMBER];
|
||||
|
||||
/** Number of filled endpoint info records. */
|
||||
zb_uint8_t n_ep_infos;
|
||||
/** Sub-device (endpoint) info table. */
|
||||
zb_zll_sub_device_info_t ep_infos[ZB_ZLL_TRANS_CTX_DEV_INFO_MAX_NUMBER * ZB_ZLL_TRANS_CTX_EP_INFO_MAX_NUMBER];
|
||||
|
||||
/** @brief User-provided "check action allowed" callback. */
|
||||
zb_zll_is_action_allowed_cb_t check_action_allowed;
|
||||
/** @internal @brief Packet send counter.
|
||||
*
|
||||
* Counts packets sent during particular transaction procedure.
|
||||
* @attention Should be neither referenced nor changed from the userspace.
|
||||
*/
|
||||
zb_uint8_t pckt_cnt;
|
||||
/** Old address range for transaction rollback needs. */
|
||||
zb_zll_addr_range_t addr_range;
|
||||
/** Old group identifiers range for transaction rollback needs. */
|
||||
zb_zll_group_id_range_t group_id_range;
|
||||
/** Callback-chain data for target-side command handling. */
|
||||
zb_zll_command_target_data_t command_data;
|
||||
|
||||
} zb_zll_transaction_ctx_t;
|
||||
|
||||
/** @brief Touchlink context data */
|
||||
typedef struct zb_zll_ctx_s
|
||||
{
|
||||
zb_zll_device_info_t zll_device_info;
|
||||
zb_zll_transaction_ctx_t zll_tran_ctx;
|
||||
} zb_zll_ctx_t;
|
||||
|
||||
/**
|
||||
Returns Touchlink context.
|
||||
@return pointer Touchlink context
|
||||
*/
|
||||
zb_zll_ctx_t *zb_zll_get_ctx(void);
|
||||
|
||||
/**
|
||||
Returns Touchlink device info.
|
||||
@return pointer Touchlink device info
|
||||
*/
|
||||
zb_zll_device_info_t *zb_zll_get_device_info(void);
|
||||
|
||||
/**
|
||||
Returns Touchlink transaction context.
|
||||
@return pointer Touchlink transaction context
|
||||
*/
|
||||
zb_zll_transaction_ctx_t *zb_zll_get_transaction_ctx(void);
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** Returns pointer to Touchlink context */
|
||||
#define ZLL_CTX() (*zb_zll_get_ctx())
|
||||
|
||||
/** Returns pointer to Touchlink device info */
|
||||
#define ZLL_DEVICE_INFO() (*zb_zll_get_device_info())
|
||||
|
||||
/** Returns pointer to Touchlink transaction context */
|
||||
#define ZLL_TRAN_CTX() (*zb_zll_get_transaction_ctx())
|
||||
|
||||
/** @} */ /* ZB_ZCL_TOUCHLINK_COMMON */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION && DOXYGEN_TOUCHLINK_FEATURE */
|
||||
|
||||
#endif /* ZBOSS_API_TL_H */
|
||||
2749
managed_components/espressif__esp-zboss-lib/include/zboss_api_zcl.h
Normal file
2749
managed_components/espressif__esp-zboss-lib/include/zboss_api_zcl.h
Normal file
File diff suppressed because it is too large
Load Diff
3493
managed_components/espressif__esp-zboss-lib/include/zboss_api_zdo.h
Normal file
3493
managed_components/espressif__esp-zboss-lib/include/zboss_api_zdo.h
Normal file
File diff suppressed because it is too large
Load Diff
2343
managed_components/espressif__esp-zboss-lib/include/zboss_api_zgp.h
Normal file
2343
managed_components/espressif__esp-zboss-lib/include/zboss_api_zgp.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,369 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Alarms cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ALARMS_H
|
||||
#define ZB_ZCL_ALARMS_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ALARMS
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_ALARMS */
|
||||
|
||||
/*! @name Alarms cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Alarms cluster attribute identifiers
|
||||
@see ZCL spec, subclause 3.11.2.2
|
||||
*/
|
||||
enum zb_zcl_alarms_attr_e
|
||||
{
|
||||
/*! @brief AlarmCount attribute */
|
||||
ZB_ZCL_ATTR_ALARMS_ALARM_COUNT_ID = 0x0000
|
||||
};
|
||||
|
||||
/*! @} */ /* Alarms cluster attributes */
|
||||
|
||||
/** @brief Default value for Alarms cluster revision global attribute */
|
||||
#define ZB_ZCL_ALARMS_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*!
|
||||
@brief Declare attribute list for Alarms cluster (only cluster revision attribute)
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ALARMS_ATTR_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ALARMS) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @name Alarms cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Alarms cluster command identifiers
|
||||
@see ZCL spec, subclause 3.11.2.4
|
||||
*/
|
||||
enum zb_zcl_alarms_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID = 0x00, /**< "Reset alarm" command. */
|
||||
ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID = 0x01, /**< "Reset all alarms" command. */
|
||||
ZB_ZCL_CMD_ALARMS_GET_ALARM_ID = 0x02, /**< "Get alarms" command. */
|
||||
ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID = 0x03 /**< "Reset alarm log" command. */
|
||||
};
|
||||
|
||||
/*! @brief Structured representation of Reset alarm command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_alarms_reset_alarm_req_s
|
||||
{
|
||||
/** Alarm Code field */
|
||||
zb_uint8_t alarm_code;
|
||||
/** Cluster ID field */
|
||||
zb_uint16_t cluster_id;
|
||||
} ZB_PACKED_STRUCT zb_zcl_alarms_reset_alarm_req_t;
|
||||
|
||||
/** @brief Reset alarm payload length macro */
|
||||
#define ZB_ZCL_ALARMS_RESET_ALARM_REQ_PAYLOAD_LEN \
|
||||
sizeof(zb_zcl_alarms_reset_alarm_req_t)
|
||||
|
||||
/*! @brief Send Reset alarm command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param cb - callback to call to report send status
|
||||
@param alarm_code - Alarm Code field
|
||||
@param cluster_id - Cluster ID field
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb, alarm_code, cluster_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (alarm_code)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (cluster_id)); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ALARMS, cb); \
|
||||
}
|
||||
|
||||
/** @brief Parses Reset alarm command and fills in data request
|
||||
structure. If request contains invalid data, status will set to ZB_FALSE.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command request data
|
||||
@param reset_alarm_req - variable to save command request
|
||||
@param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
@note data_buf buffer should contain command request payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_GET_RESET_ALARM_REQ(data_buf, reset_alarm_req, status) \
|
||||
{ \
|
||||
zb_zcl_alarms_reset_alarm_req_t *reset_alarm_req_ptr; \
|
||||
(reset_alarm_req_ptr) = zb_buf_len(data_buf) >= \
|
||||
ZB_ZCL_ALARMS_RESET_ALARM_REQ_PAYLOAD_LEN ? \
|
||||
(zb_zcl_alarms_reset_alarm_req_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
if (reset_alarm_req_ptr != NULL) \
|
||||
{ \
|
||||
reset_alarm_req.alarm_code = reset_alarm_req_ptr->alarm_code; \
|
||||
ZB_HTOLE16(&(reset_alarm_req).cluster_id, &(reset_alarm_req_ptr->cluster_id)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Reset all alarms command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param cb - callback to call to report send status
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_SEND_RESET_ALL_ALARMS_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ALARMS, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Send Get alarm command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param cb - callback to call to report send status
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_SEND_GET_ALARM_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_GET_ALARM_ID); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ALARMS, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Send Reset alarm log command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param cb - callback to call to report send status
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_SEND_RESET_ALARM_LOG_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_RESET_ALARM_LOG_ID); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ALARMS, cb); \
|
||||
}
|
||||
|
||||
/********************************** Responses *******************/
|
||||
|
||||
/** @brief Alarms cluster response command identifiers
|
||||
@see ZCL spec, subclause 3.6.2.3
|
||||
*/
|
||||
enum zb_zcl_alarms_cmd_resp_e
|
||||
{
|
||||
ZB_ZCL_CMD_ALARMS_ALARM_ID = 0x00, /**< Alarm command identifier. */
|
||||
ZB_ZCL_CMD_ALARMS_GET_ALARM_RES_ID = 0x01 /**< Get alarm response command identifier. */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Alarms cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_CMD_ALARMS_ALARM_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ALARMS_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_ALARMS_RESET_ALARM_ID, \
|
||||
ZB_ZCL_CMD_ALARMS_RESET_ALL_ALARMS_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ALARMS_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/*! @brief Structured representation of Alarm command payload */
|
||||
typedef zb_zcl_alarms_reset_alarm_req_t zb_zcl_alarms_alarm_res_t;
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_alarm_get_alarm_hdr_res_s
|
||||
{
|
||||
zb_uint8_t status; /**< Status field */
|
||||
} ZB_PACKED_STRUCT zb_zcl_alarm_get_alarm_hdr_res_t;
|
||||
|
||||
/** @brief Get alarm response command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_alarm_get_alarm_res_s
|
||||
{
|
||||
zb_uint8_t status; /**< Status field */
|
||||
zb_uint8_t alarm_code; /**< Alarm code field */
|
||||
zb_uint16_t cluster_id; /**< Cluster ID field */
|
||||
zb_uint32_t timestamp; /**< TimeStamp field */
|
||||
} ZB_PACKED_STRUCT zb_zcl_alarm_get_alarm_res_t;
|
||||
|
||||
/** @internal Get alarm response size */
|
||||
#define ZB_ZCL_ALARM_GET_ALARM_RES_SIZE \
|
||||
sizeof(zb_zcl_alarm_get_alarm_res_t)
|
||||
|
||||
/** @internal Get alarm response header size */
|
||||
#define ZB_ZCL_ALARM_GET_ALARM_HDR_RES_SIZE \
|
||||
sizeof(zb_zcl_alarm_get_alarm_hdr_res_t)
|
||||
|
||||
/*! @brief Send Alarm command (to client)
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param cb - callback to call to report send status
|
||||
@param alarm_code - Alarm Code
|
||||
@param cluster_id - Cluster Id
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_SEND_ALARM_RES( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, cb, alarm_code, cluster_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ALARMS_ALARM_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (alarm_code)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (cluster_id)); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ALARMS, cb); \
|
||||
}
|
||||
|
||||
/** @brief Parses Reset alarm command and fills in data request
|
||||
structure. If request contains invalid data, status will set to ZB_FALSE.
|
||||
@param data_ptr - pointer to a variable of type @ref zb_zcl_alarms_alarm_res_t.
|
||||
@param buffer containing the packet (by pointer).
|
||||
@param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_GET_ALARM_RES(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_alarms_alarm_res_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_alarms_alarm_res_t *src_ptr = \
|
||||
(zb_zcl_alarms_alarm_res_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->alarm_code = src_ptr->alarm_code; \
|
||||
ZB_HTOLE16(&((data_ptr)->cluster_id), &(src_ptr->cluster_id)); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/** @brief Parses Get alarm response command and returns response data
|
||||
structure or status = ZB_FALSE if request contains invalid data.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command response data
|
||||
@param get_alarm_res - command response record
|
||||
@param status - variable to put parse status to (see @ref zb_zcl_parse_status_t)
|
||||
@note data_buf buffer should contain response command payload without ZCL header
|
||||
*/
|
||||
#define ZB_ZCL_ALARMS_GET_GET_ALARM_RES(data_buf, get_alarm_res, status) \
|
||||
{ \
|
||||
zb_zcl_alarm_get_alarm_res_t *get_alarm_res_ptr; \
|
||||
if (zb_buf_len(data_buf) >= ZB_ZCL_ALARM_GET_ALARM_HDR_RES_SIZE) \
|
||||
{ \
|
||||
(get_alarm_res_ptr) = zb_buf_begin(data_buf); \
|
||||
get_alarm_res.status = get_alarm_res_ptr->status; \
|
||||
if (zb_buf_len(data_buf) >= ZB_ZCL_ALARM_GET_ALARM_RES_SIZE) \
|
||||
{ \
|
||||
get_alarm_res.alarms_code = get_alarm_res_ptr->alarm_code; \
|
||||
ZB_HTOLE16(&(get_alarm_res).cluster_id, &(get_alarm_res_ptr->cluster_id)); \
|
||||
ZB_HTOLE32(&(get_alarm_res).timestamp, &(get_alarm_res_ptr->timestamp)); \
|
||||
} \
|
||||
status = ZB_TRUE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
status = ZB_FALSE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* Alarms cluster commands */
|
||||
|
||||
/*! @internal @name Alarms cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Alarms cluster */
|
||||
#define ZB_ZCL_ALARMS_REPORT_ATTR_COUNT 0
|
||||
|
||||
|
||||
/*! @} */ /* Alarms cluster internals */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_alarms_init_server(void);
|
||||
void zb_zcl_alarms_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_SERVER_ROLE_INIT zb_zcl_alarms_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ALARMS_CLIENT_ROLE_INIT zb_zcl_alarms_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ALARMS_H */
|
||||
@@ -0,0 +1,817 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Analog Input cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ANALOG_INPUT_H
|
||||
#define ZB_ZCL_ANALOG_INPUT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ANALOG_INPUT
|
||||
* @{
|
||||
* @details
|
||||
* The Analog Input cluster provides an interface for reading the value of an
|
||||
* analog measurement and accessing various characteristics of that measurement.
|
||||
* No cluster specific commands are received or generated.
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_ANALOG_INPUT */
|
||||
|
||||
/** @defgroup ZB_ZCL_ANALOG_INPUT_ATTRS_GROUP Analog Input cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Analog Input cluster attribute identifiers
|
||||
* @see ZCL spec, Analog Input (Basic) Cluster 3.14.2.4.1
|
||||
*/
|
||||
enum zb_zcl_analog_input_attr_e
|
||||
{
|
||||
/** @brief Description attribute, ZCL spec 3.14.11.4 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID = 0x001c,
|
||||
/** @brief MaxPresentValue attribute, ZCL spec 3.14.11.5 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_MAX_PRESENT_VALUE_ID = 0x0041,
|
||||
/** @brief MinPresentValue attribute, ZCL spec 3.14.11.8 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_MIN_PRESENT_VALUE_ID = 0x0045,
|
||||
/** @brief OutOfService attribute, ZCL spec 3.14.11.1 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID = 0x0051,
|
||||
/** @brief PresentValue attribute, ZCL spec 3.14.11.2 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID = 0x0055,
|
||||
/** @brief Reliability attribute, ZCL spec 3.14.11.9 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_RELIABILITY_ID = 0x0067,
|
||||
/** @brief Resolution attribute, ZCL spec 3.14.11.11 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_RESOLUTION_ID = 0x006a,
|
||||
/** @brief StatusFlags attribute, ZCL spec 3.14.11.3 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID = 0x006f,
|
||||
/** @brief EngineeringUnits attribute, ZCL spec 3.14.11.10 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_ENGINEERING_UNITS_ID = 0x0075,
|
||||
/** @brief ApplicationType attribute, ZCL spec 3.14.11.19 */
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_APPLICATION_TYPE_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief StatusFlags attribute values.
|
||||
* @see ZCL spec 3.14.11.3 for details.
|
||||
*/
|
||||
enum zb_zcl_analog_input_status_flags_value_e
|
||||
{
|
||||
ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_NORMAL = 0x00, /**< Normal (default) state. */
|
||||
ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_IN_ALARM = 0x01, /**< In alarm bit. */
|
||||
ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_FAULT = 0x02, /**< Fault bit. */
|
||||
ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_OVERRIDDEN = 0x04, /**< Overridden bit. */
|
||||
ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_OUT_OF_SERVICE = 0x08, /**< Out of service bit. */
|
||||
};
|
||||
|
||||
/** @brief Reliability attribute values.
|
||||
* @see ZCL spec 3.14.11.9 for details.
|
||||
*/
|
||||
enum zb_zcl_analog_input_reliability_value_e
|
||||
{
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_NO_FAULT_DETECTED = 0x00,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_NO_SENSOR = 0x01,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_OVER_RANGE = 0x02,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_UNDER_RANGE = 0x03,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_OPEN_LOOP = 0x04,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_SHORTED_LOOP = 0x05,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_NO_OUTPUT = 0x06,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_UNRELIABLE_OTHER = 0x07,
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_PROCESS_ERROR = 0x08,
|
||||
/* 0x09 is for multistate clusters only */
|
||||
ZB_ZCL_ANALOG_INPUT_RELIABILITY_CONFIGURATION_ERROR = 0x0a,
|
||||
};
|
||||
|
||||
/** @defgroup ZB_ZCL_ANALOG_INPUT_APPLICATION_TYPES Analog Input cluster application types
|
||||
* @{
|
||||
* @details
|
||||
* The ApplicationType attribute indicates the specific application usage
|
||||
* for the cluster. ApplicationType is subdivided into Group, Type and
|
||||
* an Index number, as follows:
|
||||
*
|
||||
* Group = Bits 24 to 31
|
||||
* An indication of the cluster this attribute is part of. Analog Input
|
||||
* clusters have Group = 0x00.
|
||||
*
|
||||
* Type = Bits 16 to 23
|
||||
* The physical quantity that the PresentValue attribute of the cluster
|
||||
* represents.
|
||||
*
|
||||
* Index = Bits 0 to 15
|
||||
* The specific application usage of the cluster.
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(_type, _id) (((_type & 0xff) << 16) | (_id & 0xffff))
|
||||
|
||||
/** @brief Type values for Analog Input cluster applications
|
||||
* @see ZCL spec 3.14.11.19.1
|
||||
*/
|
||||
enum zb_zcl_ai_application_types_e
|
||||
{
|
||||
ZB_ZCL_AI_APP_TYPE_TEMPERATURE,
|
||||
ZB_ZCL_AI_APP_TYPE_HUMIDITY,
|
||||
ZB_ZCL_AI_APP_TYPE_PRESSURE,
|
||||
ZB_ZCL_AI_APP_TYPE_FLOW,
|
||||
ZB_ZCL_AI_APP_TYPE_PERCENTAGE,
|
||||
ZB_ZCL_AI_APP_TYPE_PPM,
|
||||
ZB_ZCL_AI_APP_TYPE_RPM,
|
||||
ZB_ZCL_AI_APP_TYPE_CURRENT_IN_AMPS,
|
||||
ZB_ZCL_AI_APP_TYPE_FREQUENCY,
|
||||
ZB_ZCL_AI_APP_TYPE_POWER_IN_WATTS,
|
||||
ZB_ZCL_AI_APP_TYPE_POWER_IN_KILOWATTS,
|
||||
ZB_ZCL_AI_APP_TYPE_ENERGY,
|
||||
ZB_ZCL_AI_APP_TYPE_COUNT_UNITLESS,
|
||||
ZB_ZCL_AI_APP_TYPE_ENTHALPY,
|
||||
ZB_ZCL_AI_APP_TYPE_TIME,
|
||||
/* Types 0x0f to 0xfe are reserved */
|
||||
ZB_ZCL_AI_APP_TYPE_OTHER = 0xff
|
||||
};
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_TEMPERATURE_APP_TYPE Analog Input cluster representing temperature
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Temperature in degrees Celsius' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.1
|
||||
*/
|
||||
enum zb_zcl_ai_temperature_in_degrees_celsius_e
|
||||
{
|
||||
ZB_ZCL_AI_TEMPERATURE_2_PIPE_ENTERING = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_TEMPERATURE, 0x0000),
|
||||
ZB_ZCL_AI_TEMPERATURE_2_PIPE_LEAVING,
|
||||
ZB_ZCL_AI_TEMPERATURE_BOILER_ENTERING,
|
||||
ZB_ZCL_AI_TEMPERATURE_BOILER_LEAVING,
|
||||
ZB_ZCL_AI_TEMPERATURE_CHILLER_CHILLED_WATER_ENTERING,
|
||||
ZB_ZCL_AI_TEMPERATURE_CHILLER_CHILLED_WATER_LEAVING,
|
||||
ZB_ZCL_AI_TEMPERATURE_CHILLER_CONDENSER_WATER_ENTERING,
|
||||
ZB_ZCL_AI_TEMPERATURE_CHILLER_CONDENSER_WATER_LEAVING,
|
||||
ZB_ZCL_AI_TEMPERATURE_COLD_DECK,
|
||||
ZB_ZCL_AI_TEMPERATURE_COOLING_COIL_DISCHARGE,
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_COOLING_ENTERING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_COOLING_LEAVING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_CONDENSER_WATER_RETURN,
|
||||
ZB_ZCL_AI_TEMPERATURE_CONDENSER_WATER_SUPPLY,
|
||||
ZB_ZCL_AI_TEMPERATURE_DECOUPLE_LOOP_0, /* Note: Decouple Loop is duplicated in spec */
|
||||
ZB_ZCL_AI_TEMPERATURE_BUILDING_LOAD,
|
||||
ZB_ZCL_AI_TEMPERATURE_DECOUPLE_LOOP_1,
|
||||
ZB_ZCL_AI_TEMPERATURE_DEW_POINT,
|
||||
ZB_ZCL_AI_TEMPERATURE_DISCHARGE_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_DISCHARGE,
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_EXHAUST_AIR_AFTER_HEAT_RECOVERY,
|
||||
ZB_ZCL_AI_TEMPERATURE_EXHAUST_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_GLYCOL,
|
||||
ZB_ZCL_AI_TEMPERATURE_HEAT_RECOVERY_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_HOT_DECK,
|
||||
ZB_ZCL_AI_TEMPERATURE_HEAT_EXCHANGER_BYPASS,
|
||||
ZB_ZCL_AI_TEMPERATURE_HEAT_EXCHANGER_ENTERING,
|
||||
ZB_ZCL_AI_TEMPERATURE_HEAT_EXCHANGER_LEAVING,
|
||||
ZB_ZCL_AI_TEMPERATURE_MECHANICAL_ROOM,
|
||||
ZB_ZCL_AI_TEMPERATURE_MIXED_AIR_0, /* Note: Mixed Air is duplicated in spec */
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_MIXED_AIR_1,
|
||||
ZB_ZCL_AI_TEMPERATURE_OUTDOOR_AIR_DEWPOINT,
|
||||
ZB_ZCL_AI_TEMPERATURE_OUTDOOR_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_PREHEAT_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_PREHEAT_ENTERING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_PREHEAT_LEAVING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_PRIMARY_CHILLED_WATER_RETURN,
|
||||
ZB_ZCL_AI_TEMPERATURE_PRIMARY_CHILLED_WATER_SUPPLY,
|
||||
ZB_ZCL_AI_TEMPERATURE_PRIMARY_HOT_WATER_RETURN,
|
||||
ZB_ZCL_AI_TEMPERATURE_PRIMARY_HOT_WATER_SUPPLY,
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_REHEAT_COIL_DISCHARGE,
|
||||
ZB_ZCL_AI_TEMPERATURE_REHEAT_ENTERING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_REHEAT_LEAVING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_RETURN_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_SECONDARY_CHILLED_WATER_RETURN,
|
||||
ZB_ZCL_AI_TEMPERATURE_SECONDARY_CHILLED_WATER_SUPPLY,
|
||||
ZB_ZCL_AI_TEMPERATURE_SECONDARY_HW_RETURN,
|
||||
ZB_ZCL_AI_TEMPERATURE_SECONDARY_HW_SUPPLY,
|
||||
ZB_ZCL_AI_TEMPERATURE_SIDELOOP_RESET,
|
||||
ZB_ZCL_AI_TEMPERATURE_SIDELOOP_SETPOINT,
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_SIDELOOP,
|
||||
ZB_ZCL_AI_TEMPERATURE_SOURCE,
|
||||
ZB_ZCL_AI_TEMPERATURE_SUPPLY_AIR,
|
||||
ZB_ZCL_AI_TEMPERATURE_SUPPLY_LOW_LIMIT,
|
||||
ZB_ZCL_AI_TEMPERATURE_TOWER_BASIN,
|
||||
ZB_ZCL_AI_TEMPERATURE_TWO_PIPE_LEAVING_WATER,
|
||||
ZB_ZCL_AI_TEMPERATURE_RESERVED,
|
||||
ZB_ZCL_AI_TEMPERATURE_ZONE_DEWPOINT,
|
||||
ZB_ZCL_AI_TEMPERATURE_ZONE_SENSOR_SETPOINT,
|
||||
ZB_ZCL_AI_TEMPERATURE_ZONE_SENSOR_SETPOINT_OFFSET,
|
||||
|
||||
ZB_ZCL_AI_TEMPERATURE_ZONE,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_TEMPERATURE_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_TEMPERATURE, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_TEMPERATURE_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_HUMIDITY_APP_TYPE Analog Input cluster representing humidity
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Relative Humidity in %' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.2
|
||||
*/
|
||||
enum zb_zcl_ai_relative_humidity_in_percent_e
|
||||
{
|
||||
ZB_ZCL_AI_HUMIDITY_DISCHARGE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_HUMIDITY, 0x0000),
|
||||
ZB_ZCL_AI_HUMIDITY_EXHAUST,
|
||||
ZB_ZCL_AI_HUMIDITY_HOT_DECK,
|
||||
ZB_ZCL_AI_HUMIDITY_MIXED_AIR,
|
||||
ZB_ZCL_AI_HUMIDITY_OUTDOOR_AIR,
|
||||
ZB_ZCL_AI_HUMIDITY_RETURN,
|
||||
ZB_ZCL_AI_HUMIDITY_SIDELOOP,
|
||||
ZB_ZCL_AI_HUMIDITY_SPACE,
|
||||
ZB_ZCL_AI_HUMIDITY_ZONE,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_HUMIDITY_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_HUMIDITY, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_HUMIDITY_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_PRESSURE_APP_TYPE Analog Input cluster representing pressure
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Pressure in Pascal' type of Analog Input cluster
|
||||
* @see 3.14.11.19.1.3
|
||||
*/
|
||||
enum zb_zcl_ai_pressure_in_pascal_e
|
||||
{
|
||||
ZB_ZCL_AI_PRESSURE_BOILER_PUMP_DIFFERENTIAL = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PRESSURE, 0x0000),
|
||||
ZB_ZCL_AI_PRESSURE_BUILDING_STATIC,
|
||||
ZB_ZCL_AI_PRESSURE_COLD_DECK_DIFFERENTIAL_SENSOR,
|
||||
ZB_ZCL_AI_PRESSURE_CHILLED_WATER_BUILDING_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_COLD_DECK_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_COLD_DECK_STATIC,
|
||||
ZB_ZCL_AI_PRESSURE_CONDENSER_WATER_PUMP_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_DISCHARGE_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_DISCHARGE_STATIC_1,
|
||||
ZB_ZCL_AI_PRESSURE_DISCHARGE_STATIC_2,
|
||||
|
||||
ZB_ZCL_AI_PRESSURE_EXHAUST_AIR_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_EXHAUST_AIR_STATIC,
|
||||
ZB_ZCL_AI_PRESSURE_EXHAUST_DIFFERENTIAL_0, /* Note: Exhaust Differential is duplicated in spec */
|
||||
ZB_ZCL_AI_PRESSURE_EXHAUST_DIFFERENTIAL_1,
|
||||
ZB_ZCL_AI_PRESSURE_HOT_DECK_DIFFERENTIAL_0, /* Note: Hot Deck Differential is duplicated in spec */
|
||||
ZB_ZCL_AI_PRESSURE_HOT_DECK_DIFFERENTIAL_1,
|
||||
ZB_ZCL_AI_PRESSURE_HOT_DECK_STATIC,
|
||||
ZB_ZCL_AI_PRESSURE_HOT_WATER_BLDG_DIFF,
|
||||
ZB_ZCL_AI_PRESSURE_HEAT_EXCHANGER_STEAM,
|
||||
ZB_ZCL_AI_PRESSURE_MIN_OUTDOOR_AIR_DIFFERENTIAL,
|
||||
|
||||
ZB_ZCL_AI_PRESSURE_OUTDOOR_AIR_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_PRIMARY_CHILLED_WATER_PUMP_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_PRIMATY_HOT_WATER_PUMP_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_RELIEF_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_RETURN_AIR_STATIC,
|
||||
ZB_ZCL_AI_PRESSURE_RETURN_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_SECONDARY_CHILLED_WATER_PUMP_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_SECONDARY_HOT_WATER_PUMP_DIFFERENTIAL,
|
||||
ZB_ZCL_AI_PRESSURE_SIDELOOP,
|
||||
ZB_ZCL_AI_PRESSURE_STEAM,
|
||||
|
||||
ZB_ZCL_AI_PRESSURE_SUPPLY_DIFFERENTIAL_SENSOR,
|
||||
/* 0x0200 to 0xffffe are Vendor defined */
|
||||
ZB_ZCL_AI_PRESSURE_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PRESSURE, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_PRESSURE_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_FLOW_APP_TYPE Analog Input cluster representing flow
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Flow in Liters per Second' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.4
|
||||
*/
|
||||
enum zb_zcl_ai_flow_in_liters_per_second_e
|
||||
{
|
||||
ZB_ZCL_AI_FLOW_CHILLED_WATER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_FLOW, 0x0000),
|
||||
ZB_ZCL_AI_FLOW_CHILLER_CHILLED_WATER,
|
||||
ZB_ZCL_AI_FLOW_CHILLER_CONDENSER_WATER,
|
||||
ZB_ZCL_AI_FLOW_COLD_DECK,
|
||||
ZB_ZCL_AI_FLOW_DECOUPLE_LOOP,
|
||||
ZB_ZCL_AI_FLOW_DISCHARGE,
|
||||
ZB_ZCL_AI_FLOW_EXHAUST_FAN,
|
||||
ZB_ZCL_AI_FLOW_EXHAUST,
|
||||
ZB_ZCL_AI_FLOW_FAN,
|
||||
ZB_ZCL_AI_FLOW_HOT_DECK,
|
||||
|
||||
ZB_ZCL_AI_FLOW_HOT_WATER,
|
||||
ZB_ZCL_AI_FLOW_MIN_OUTDOOR_AIR_FAN,
|
||||
ZB_ZCL_AI_FLOW_MIN_OUTDOOR_AIR,
|
||||
ZB_ZCL_AI_FLOW_OUTDOOR_AIR,
|
||||
ZB_ZCL_AI_FLOW_PRIMARY_CHILLED_WATER,
|
||||
ZB_ZCL_AI_FLOW_RELIEF_FAN,
|
||||
ZB_ZCL_AI_FLOW_RELIEF,
|
||||
ZB_ZCL_AI_FLOW_RETURN_FAN,
|
||||
ZB_ZCL_AI_FLOW_RETURN,
|
||||
ZB_ZCL_AI_FLOW_SECONDARY_CHILLED_WATER_FLOW,
|
||||
|
||||
ZB_ZCL_AI_FLOW_SUPPLY_FAN,
|
||||
ZB_ZCL_AI_FLOW_TOWER_FAN,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_FLOW_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_FLOW, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_FLOW_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_PERCENTAGE_APP_TYPE Analog Input cluster representing percentage
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Percentage %' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.5
|
||||
*/
|
||||
enum zb_zcl_ai_percentage_e
|
||||
{
|
||||
ZB_ZCL_AI_PERCENTAGE_CHILLER_FULL_LOAD_AMPERAGE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PERCENTAGE, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_PERCENTAGE_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PERCENTAGE, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_PERCENTAGE_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_PPM_APP_TYPE Analog Input cluster representing parts per million
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Parts per Million PPM' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.6
|
||||
*/
|
||||
enum zb_zcl_ai_ppm_e
|
||||
{
|
||||
ZB_ZCL_AI_PPM_RETURN_CARBON_DIOXIDE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PPM, 0x0000),
|
||||
ZB_ZCL_AI_PPM_ZONE_CARBON_DIOXIDE,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_PPM_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_PPM, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_PPM_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_RPM_APP_TYPE Analog Input cluster representing rotational speed
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Rotational Speed in RPM' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.7
|
||||
*/
|
||||
enum zb_zcl_ai_rpm_e
|
||||
{
|
||||
ZB_ZCL_AI_RPM_EXHAUS_FAN_REMOTE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_RPM, 0x0000),
|
||||
ZB_ZCL_AI_RPM_HEAT_RECOVERY_WHEEL_REMOTE,
|
||||
ZB_ZCL_AI_RPM_MIN_OUTDOOR_AIR_FAN_REMOTE,
|
||||
ZB_ZCL_AI_RPM_RELIEF_FAN_REMOTE,
|
||||
ZB_ZCL_AI_RPM_RETURN_FAN_REMOTE,
|
||||
ZB_ZCL_AI_RPM_SUPPLY_FAN_REMOTE,
|
||||
ZB_ZCL_AI_RPM_VARIABLE_SPEED_DRIVE_MOTOR,
|
||||
ZB_ZCL_AI_RPM_VARIABLE_SPEED_DRIVE_SETPOINT,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_RPM_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_RPM, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_RPM_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_CURRENT_APP_TYPE Analog Input cluster representing current
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Current in Amps' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.8
|
||||
*/
|
||||
enum zb_zcl_ai_current_e
|
||||
{
|
||||
ZB_ZCL_AI_CURRENT_CHILLER_AMPS = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_CURRENT_IN_AMPS, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_CURRENT_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_CURRENT_IN_AMPS, 0xffff),
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_CURRENT_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_FREQUENCY_APP_TYPE Analog Input cluster representing frequency
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Frequency in Hz' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.9
|
||||
*/
|
||||
enum zb_zcl_ai_frequency_e
|
||||
{
|
||||
ZB_ZCL_AI_FREQUENCY_VARIABLE_SPEED_DRIVE_OUTPUT = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_FREQUENCY, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_FREQUENCY_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_FREQUENCY, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_FREQUENCY_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_POWER_IN_WATTS_APP_TYPE Analog Input cluster representing power in Watts
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Power in Watts' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.10
|
||||
*/
|
||||
enum zb_zcl_ai_power_in_watts_e
|
||||
{
|
||||
ZB_ZCL_AI_POWER_IN_WATTS_CONSUMPTION = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_POWER_IN_WATTS, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_POWER_IN_WATTS_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_POWER_IN_WATTS, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_POWER_IN_WATTS_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_POWER_IN_KILOWATTS_APP_TYPE Analog Input cluster representing power in kiloWatts
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Power in kW' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.11
|
||||
*/
|
||||
enum zb_zcl_ai_power_in_kilowatts_e
|
||||
{
|
||||
ZB_ZCL_AI_POWER_IN_KILOWATTS_ABSOLUTE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_POWER_IN_KILOWATTS, 0x0000),
|
||||
ZB_ZCL_AI_POWER_IN_KILOWATTS_CONSUMPTION,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_POWER_IN_KILOWATTS_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_POWER_IN_KILOWATTS, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_POWER_IN_KILOWATTS_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_ENERGY_APP_TYPE Analog Input cluster representing energy
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Energy in kWH' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.12
|
||||
*/
|
||||
enum zb_zcl_ai_energy_kwh_e
|
||||
{
|
||||
ZB_ZCL_AI_ENERGY_KWH_VARIABLE_SPEED_DRIVE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_ENERGY, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_ENERGY_KWH_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_ENERGY, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_ENERGY_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_COUNT_UNITLESS_APP_TYPE Analog Input cluster representing unitless count
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Count - Unitless' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.13
|
||||
*/
|
||||
enum zb_zcl_ai_count_unitless_e
|
||||
{
|
||||
ZB_ZCL_AI_COUNT_UNITLESS_COUNT = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_COUNT_UNITLESS, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_COUNT_UNITLESS_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_COUNT_UNITLESS, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_COUNT_UNITLESS_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_ENTHALPY_APP_TYPE Analog Input cluster representing enthalpy
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Enthalpy in KJoules per Kg' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.14
|
||||
*/
|
||||
enum zb_zcl_ai_enthaply_e
|
||||
{
|
||||
ZB_ZCL_AI_ENTHALPY_OUTDOOR_AIR = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_ENTHALPY, 0x0000),
|
||||
ZB_ZCL_AI_ENTHALPY_RETURN_AIR,
|
||||
ZB_ZCL_AI_ENTHALPY_SPACE,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_ENTHALPY_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_ENTHALPY, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_ENTHALPY_APP_TYPE group */
|
||||
|
||||
/** @defgroup ZB_ZCL_AI_TIME_APP_TYPE Analog Input cluster representing time
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Time in Seconds' type of Analog Input cluster
|
||||
* @see ZCL spec 3.14.11.19.1.15
|
||||
*/
|
||||
enum zb_zcl_ai_time_e
|
||||
{
|
||||
ZB_ZCL_AI_TIME_RELATIVE = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_TIME, 0x0000),
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_AI_TIME_OTHER = ZB_ZCL_AI_SET_APP_TYPE_WITH_ID(ZB_ZCL_AI_APP_TYPE_TIME, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AI_TIME_APP_TYPE group */
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_INPUT_APPLICATION_TYPES */
|
||||
|
||||
/** @brief Default value for Analog Input cluster revision global attribute */
|
||||
#define ZB_ZCL_ANALOG_INPUT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Description attribute */
|
||||
#define ZB_ZCL_ANALOG_INPUT_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for OutOfService attribute */
|
||||
#define ZB_ZCL_ANALOG_INPUT_OUT_OF_SERVICE_DEFAULT_VALUE ZB_FALSE
|
||||
|
||||
/** @brief Default value for Reliability attribute */
|
||||
#define ZB_ZCL_ANALOG_INPUT_RELIABILITY_DEFAULT_VALUE ZB_ZCL_ANALOG_INPUT_RELIABILITY_NO_FAULT_DETECTED
|
||||
|
||||
/** @brief Default value for StatusFlags attribute */
|
||||
#define ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_DEFAULT_VALUE ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_NORMAL
|
||||
|
||||
/** @brief StatusFlags attribute minimum value */
|
||||
#define ZB_ZCL_ANALOG_INPUT_STATUS_FLAGS_MIN_VALUE 0
|
||||
|
||||
/** @brief StatusFlags attribute maximum value */
|
||||
#define ZB_ZCL_ANALOG_INPUT_STATUS_FLAGS_MAX_VALUE 0x0f
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Analog Input cluster internals
|
||||
* Internal structures for Analog Input cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_MAX_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_MAX_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_MIN_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_MIN_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_RELIABILITY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_RELIABILITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_RESOLUTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_RESOLUTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_ENGINEERING_UNITS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_ENGINEERING_UNITS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_16BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_INPUT_APPLICATION_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_APPLICATION_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Analog Input cluster */
|
||||
#define ZB_ZCL_ANALOG_INPUT_REPORT_ATTR_COUNT 2
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Analog Input cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for Analog Input cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param description - pointer to variable storing Description attribute value
|
||||
* @param max_present_value - pointer to variable storing MaxPresentValue attribute value
|
||||
* @param min_present_value - pointer to variable storing MinPresentValue attribute value
|
||||
* @param out_of_service - pointer to variable storing OutOfService attribute value
|
||||
* @param present_value - pointer to variable storing PresentValue attribute value
|
||||
* @param reliability - pointer to variable storing Reliability attribute value
|
||||
* @param resolution - pointer to variable storing Resolution attribute value
|
||||
* @param status_flags - pointer to variable storing StatusFlags attribute value
|
||||
* @param engineering_units - pointer to variable storing EngineeringUnits attribute value
|
||||
* @param app_type - pointer to variable storing ApplicationType attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ANALOG_INPUT_ATTRIB_LIST( \
|
||||
attr_list, \
|
||||
description, \
|
||||
max_present_value, \
|
||||
min_present_value, \
|
||||
out_of_service, \
|
||||
present_value, \
|
||||
reliability, \
|
||||
resolution, \
|
||||
status_flags, \
|
||||
engineering_units, \
|
||||
app_type) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ANALOG_INPUT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID, (description)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_MAX_PRESENT_VALUE_ID, (max_present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_MIN_PRESENT_VALUE_ID, (min_present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID, (out_of_service)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID, (present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_RELIABILITY_ID, (reliability)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_RESOLUTION_ID, (resolution)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, (status_flags)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_ENGINEERING_UNITS_ID, (engineering_units)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_INPUT_APPLICATION_TYPE_ID, (app_type)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_INPUT_ATTRS_GROUP group */
|
||||
|
||||
/** @defgroup ZB_ZCL_ANALOG_INPUT_ATTR_API Analog Input cluster attribute value manipulation API
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Set normal operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_INPUT_SET_NORMAL_MODE(ep) \
|
||||
{ \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_FALSE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
val = ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_NORMAL; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @brief Set Out of service operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_INPUT_SET_OUT_OF_SERVICE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_TRUE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_OUT_OF_SERVICE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set overridden operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_INPUT_SET_OVERRIDDEN_MODE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_OVERRIDDEN;\
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set fault status flag
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_INPUT_SET_FAULT_STATUS(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_INPUT_STATUS_FLAG_FAULT; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_INPUT_ATTR_API group */
|
||||
|
||||
/** @} */ /* ZCL Analog Input cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_analog_input_init_server(void);
|
||||
void zb_zcl_analog_input_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ANALOG_INPUT_SERVER_ROLE_INIT zb_zcl_analog_input_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ANALOG_INPUT_CLIENT_ROLE_INIT zb_zcl_analog_input_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ANALOG_INPUT_H */
|
||||
@@ -0,0 +1,565 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Analog Value cluster definitions */
|
||||
|
||||
#ifndef ZB_ZCL_ANALOG_VALUE_H
|
||||
#define ZB_ZCL_ANALOG_VALUE_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ANALOG_VALUE
|
||||
* @{
|
||||
* @details
|
||||
* The Analog Value (Basic) cluster provides an interface for setting
|
||||
* an analog value, typically used as a control system parameter, and
|
||||
* accessing various characteristics of that value.
|
||||
*/
|
||||
|
||||
|
||||
/* ZB_ZCL_CLUSTER_ID_ANALOG_VALUE = 0x000e defined in zb_zcl_common.h ZCL spec 3.14.4 */
|
||||
|
||||
/** @name Analog Value cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Analog Value cluster attribute identifiers
|
||||
* @see ZCL spec, Analog Value (Basic) Cluster 3.14.4.4.2
|
||||
*/
|
||||
enum zb_zcl_analog_value_attr_e
|
||||
{
|
||||
/** @brief Description attribute, ZCL spec 3.14.11.4 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID = 0x001c,
|
||||
/** @brief OutOfService attribute, ZCL spec 3.14.11.1 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID = 0x0051,
|
||||
/** @brief PresentValue attribute, ZCL spec 3.14.11.2 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID = 0x0055,
|
||||
|
||||
// TODO: Support PriorityArray attribute
|
||||
// @brief PriorityArray attribute, ZCL spec 3.14.11.6
|
||||
//ZB_ZCL_ATTR_ANALOG_VALUE_PRIORITY_ARRAY_ID = 0x0057,
|
||||
|
||||
/** @brief Reliability attribute, ZCL spec 3.14.11.9 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID = 0x0067,
|
||||
/** @brief RelinquishDefault attribute, ZCL spec 3.14.11.7 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID = 0x0068,
|
||||
/** @brief StatusFlags attribute, ZCL spec 3.14.11.3 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID = 0x006f,
|
||||
/** @brief EngineeringUnits attribute, ZCL spec 3.14.11.10 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID = 0x0075,
|
||||
/** @brief ApplicationType attribute, ZCL spec 3.14.11.19 */
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief StatusFlags attribute values.
|
||||
* @see ZCL spec 3.14.11.3 for details.
|
||||
*/
|
||||
enum zb_zcl_analog_value_status_flags_value_e
|
||||
{
|
||||
ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_NORMAL = 0x00, /**< Normal (default) state. */
|
||||
ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_IN_ALARM = 0x01, /**< In alarm bit. */
|
||||
ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_FAULT = 0x02, /**< Fault bit. */
|
||||
ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_OVERRIDDEN = 0x04, /**< Overridden bit. */
|
||||
ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_OUT_OF_SERVICE = 0x08, /**< Out of service bit. */
|
||||
};
|
||||
|
||||
/** @brief Reliability attribute values.
|
||||
* @see ZCL spec 3.14.11.9 for details.
|
||||
*/
|
||||
enum zb_zcl_analog_value_reliability_value_e
|
||||
{
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_NO_FAULT_DETECTED = 0x00, /**< No fault detected */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_NO_SENSOR = 0x01, /**< No sensor */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_OVER_RANGE = 0x02, /**< Over range */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_UNDER_RANGE = 0x03, /**< Under range */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_OPEN_LOOP = 0x04, /**< Open loop */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_SHORTED_LOOP = 0x05, /**< Shorted loop */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_NO_OUTPUT = 0x06, /**< No output */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_UNRELIABLE_OTHER = 0x07, /**< Unreliable other */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_PROCESS_ERROR = 0x08, /**< Process error */
|
||||
/* 0x09 is for multistate clusters only */
|
||||
ZB_ZCL_ANALOG_VALUE_RELIABILITY_CONFIGURATION_ERROR = 0x0a, /**< Configuration error */
|
||||
};
|
||||
|
||||
/** @name Analog Value cluster application types
|
||||
* @{
|
||||
* @details
|
||||
* The ApplicationType attribute indicates the specific application usage
|
||||
* for the cluster. ApplicationType is subdivided into Group, Type and
|
||||
* an Index number, as follows:
|
||||
*
|
||||
* - Group = Bits 24 to 31
|
||||
* An indication of the cluster this attribute is part of. Analog Value
|
||||
* clusters have Group = 0x02.
|
||||
*
|
||||
* - Type = Bits 16 to 23
|
||||
* The physical quantity that the PresentValue attribute of the cluster
|
||||
* represents.
|
||||
*
|
||||
* - Index = Bits 0 to 15
|
||||
* The specific application usage of the cluster.
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_AV_GROUP_ID 0x02
|
||||
#define ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(_type, _id) ((ZB_ZCL_AV_GROUP_ID << 24) | ((_type & 0xff) << 16) | (_id & 0xffff))
|
||||
|
||||
/** @defgroup ZB_ZCL_ANALOG_VALUE_APP_TYPES Analog Value cluster application types */
|
||||
/** @{ */
|
||||
|
||||
/** @brief Type values for Analog Value cluster applications
|
||||
* @see ZCL spec 3.14.11.19.3
|
||||
*/
|
||||
enum zb_zcl_av_application_types_e
|
||||
{
|
||||
ZB_ZCL_AV_APP_TYPE_TEMPERATURE = 0x00, /**< Temperature */
|
||||
ZB_ZCL_AV_APP_TYPE_AREA = 0x01, /**< Area */
|
||||
ZB_ZCL_AV_APP_TYPE_MULTIPLIER = 0x02, /**< Multiplier */
|
||||
ZB_ZCL_AV_APP_TYPE_FLOW = 0x03, /**< Flow */
|
||||
ZB_ZCL_AV_APP_TYPE_OTHER = 0xff, /**< Other */
|
||||
};
|
||||
|
||||
/** @name Analog Value cluster representing temperature
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Temperature in degrees Celsius' type of Analog Value cluster
|
||||
* @see ZCL spec 3.14.11.19.3.1
|
||||
*/
|
||||
enum zb_zcl_av_temperature_in_degrees_celsius_e
|
||||
{
|
||||
ZB_ZCL_AV_TEMPERATURE_SETPOINT_OFFSET_0 /**< Setpoint Offset */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_TEMPERATURE, 0x0000),
|
||||
ZB_ZCL_AV_TEMPERATURE_TEMP_DEADBAND, /**< Temp deadband */
|
||||
ZB_ZCL_AV_TEMPERATURE_OCCUPIED_HEATING_SETPOINT, /**< Occupied heating setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_UNOCCUPIED_HEATING_SETPOINT, /**< Unoccupied heating setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_OCCUPIED_COOLING_SETPOINT, /**< Occupied cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_UNOCCUPIED_COOLING_SETPOINT, /**< Unoccupied cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_STANDBY_HEAT_SETPOINT, /**< Standby heat setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_STANDBY_COOLING_SETPOINT, /**< Standby cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_OCCUPIED_HEATING_SETPOINT, /**< Effective occupied heating setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_UNOCCUPIED_HEATING_SETPOINT, /**< Effective unoccupied heating setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_OCCUPIED_COOLING_SETPOINT, /**< Effective occupied cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_UNOCCUPIED_COOLING_SETPOINT, /**< Effective unoccupied cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_STANDBY_HEAT_SETPOINT, /**< Effective standby heat setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_EFFECTIVE_STANDBY_COOLING_SETPOINT, /**< Effective standby cooling setpoint */
|
||||
ZB_ZCL_AV_TEMPERATURE_SETPOINT_OFFSET_2, /**< Setpoint offset 2 */
|
||||
ZB_ZCL_AV_TEMPERATURE_SETPOINT_SHIFT, /**< Setpoint shift */
|
||||
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
|
||||
ZB_ZCL_AV_TEMPERATURE_OTHER /**< Other*/
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_TEMPERATURE, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AV_TEMPERATURE_APP_TYPE group */
|
||||
|
||||
/** @name Analog Value cluster representing Area
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Area in Square Metres' type of Analog Value cluster
|
||||
* @see 3.14.11.19.3.2
|
||||
*/
|
||||
enum zb_zcl_av_area_in_squares_meters
|
||||
{
|
||||
ZB_ZCL_AV_AREA_DUCT_AREA /**< Duct Area */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_AREA, 0x0000),
|
||||
|
||||
/* 0x0200 to 0xffffe are Vendor defined */
|
||||
|
||||
ZB_ZCL_AV_AREA_OTHER /**< Other */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_AREA, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AV_AREA_APP_TYPE group */
|
||||
|
||||
/** @brief Values for 'Multiplier - Number' type of Analog Value cluster
|
||||
* @see 3.14.11.19.3.3
|
||||
*/
|
||||
enum zb_zcl_av_multiplier_number_e
|
||||
{
|
||||
ZB_ZCL_AV_MULTIPLIER_DUCT_MULTIPLIER /**< Duct Area */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_MULTIPLIER, 0x0000),
|
||||
|
||||
/* 0x0200 to 0xffffe are Vendor defined */
|
||||
|
||||
ZB_ZCL_AV_MULTIPLIER_OTHER /**< Other */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_MULTIPLIER, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AV_AREA_APP_TYPE group */
|
||||
|
||||
/** @name Analog Value cluster representing flow
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Flow in Litres per Second' type of Analog Value cluster
|
||||
* @see ZCL spec 3.14.11.19.3.4
|
||||
*/
|
||||
enum zb_zcl_av_flow_in_liters_per_second_e
|
||||
{
|
||||
ZB_ZCL_AV_FLOW_MINIMUM_AIR_FLOW /**< Minimum Air Flow */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_FLOW, 0x0000),
|
||||
ZB_ZCL_AV_FLOW_MAXIMUM_AIR_FLOW, /**< Maximum Air Flow */
|
||||
ZB_ZCL_AV_FLOW_HEATING_MINIMUM_AIR_FLOW, /**< Heating Minimum Air Flow */
|
||||
ZB_ZCL_AV_FLOW_HEATING_MAXIMUM_AIR_FLOW, /**< Heating Maximum Air Flow */
|
||||
ZB_ZCL_AV_FLOW_STANDBY_MINIMUM_AIR_FLOW, /**< Standby Minimum Air Flow */
|
||||
ZB_ZCL_AV_FLOW_STANDBY_MAXIMUM_AIR_FLOW, /**< Standby Maximum Air Flow */
|
||||
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
|
||||
ZB_ZCL_AV_FLOW_OTHER /**< Other */
|
||||
= ZB_ZCL_AV_SET_APP_TYPE_WITH_ID(ZB_ZCL_AV_APP_TYPE_FLOW, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_AV_FLOW_APP_TYPE group */
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_VALUE_APPLICATION_TYPES */
|
||||
|
||||
/** @brief Default value for Analog Value cluster revision global attribute */
|
||||
#define ZB_ZCL_ANALOG_VALUE_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Description attribute */
|
||||
#define ZB_ZCL_ANALOG_VALUE_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for OutOfService attribute */
|
||||
#define ZB_ZCL_ANALOG_VALUE_OUT_OF_SERVICE_DEFAULT_VALUE ZB_FALSE
|
||||
|
||||
/** @brief Default value for Reliability attribute */
|
||||
#define ZB_ZCL_ANALOG_VALUE_RELIABILITY_DEFAULT_VALUE ZB_ZCL_ANALOG_VALUE_RELIABILITY_NO_FAULT_DETECTED
|
||||
|
||||
/** @brief Default value for StatusFlags attribute */
|
||||
#define ZB_ZCL_ANALOG_VALUE_STATUS_FLAGS_DEFAULT_VALUE ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_NORMAL
|
||||
|
||||
/** @brief StatusFlags attribute minimum value */
|
||||
#define ZB_ZCL_ANALOG_VALUE_STATUS_FLAGS_MIN_VALUE 0
|
||||
|
||||
/** @brief StatusFlags attribute maximum value */
|
||||
#define ZB_ZCL_ANALOG_VALUE_STATUS_FLAGS_MAX_VALUE 0x0f
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Analog Value cluster internals
|
||||
* Internal structures for Analog Value cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_16BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Analog Value cluster */
|
||||
#define ZB_ZCL_ANALOG_VALUE_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Analog Value cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for Analog Value cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param description - pointer to variable storing Description attribute value
|
||||
* @param out_of_service - pointer to variable storing OutOfService attribute value
|
||||
* @param present_value - pointer to variable storing PresentValue attribute value
|
||||
* @param reliability - pointer to variable storing Reliability attribute value
|
||||
* @param relinquish_default - pointer to variable storing RelinquishDefault attribute value
|
||||
* @param status_flags - pointer to variable storing StatusFlags attribute value
|
||||
* @param engineering_units - pointer to variable storing EngineeringUnits attribute value
|
||||
* @param app_type - pointer to variable storing ApplicationType attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ANALOG_VALUE_ATTRIB_LIST( \
|
||||
attr_list, \
|
||||
description, \
|
||||
out_of_service, \
|
||||
present_value, \
|
||||
reliability, \
|
||||
relinquish_default, \
|
||||
status_flags, \
|
||||
engineering_units, \
|
||||
app_type) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ANALOG_VALUE) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID, (description)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID, (out_of_service)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID, (present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID, (reliability)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID, (relinquish_default)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, (status_flags)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID, (engineering_units)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID, (app_type)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! Maximum length of Description string field */
|
||||
#define ZB_ZCL_ANALOG_VALUE_DESCRIPTION_MAX_LEN 16
|
||||
|
||||
/**
|
||||
* @brief Analog Value cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_analog_value_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_DESCRIPTION_ID
|
||||
*/
|
||||
zb_char_t description[ZB_ZCL_ANALOG_VALUE_DESCRIPTION_MAX_LEN + 1];
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID
|
||||
*/
|
||||
zb_bool_t out_of_service;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_PRESENT_VALUE_ID
|
||||
*/
|
||||
zb_single_t present_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_RELIABILITY_ID
|
||||
*/
|
||||
zb_uint8_t reliability;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_RELINQUISH_DEFAULT_ID
|
||||
*/
|
||||
zb_single_t relinquish_default;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID
|
||||
*/
|
||||
zb_uint8_t status_flags;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_ENGINEERING_UNITS_ID
|
||||
*/
|
||||
zb_uint16_t engineering_units;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID
|
||||
* @see ZB_ZCL_ATTR_ANALOG_VALUE_APPLICATION_TYPE_ID
|
||||
*/
|
||||
zb_uint32_t application_type;
|
||||
} zb_zcl_analog_value_attrs_t;
|
||||
|
||||
/** @brief Declare attribute list for Analog Value cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_analog_value_attrs_t type
|
||||
* (containing Analog Value cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ANALOG_VALUE_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_ANALOG_VALUE_ATTRIB_LIST(attr_list, \
|
||||
&attrs.description, \
|
||||
&attrs.out_of_service, \
|
||||
&attrs.present_value, \
|
||||
&attrs.reliability, \
|
||||
&attrs.relinquish_default, \
|
||||
&attrs.status_flags, \
|
||||
&attrs.engineering_units, \
|
||||
&attrs.application_type)
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_VALUE_ATTRS_GROUP group */
|
||||
|
||||
/** @name Analog Value cluster attribute value manipulation API
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Set normal operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_VALUE_SET_NORMAL_MODE(ep) \
|
||||
{ \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_FALSE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
val = ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_NORMAL; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @brief Set Out of service operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_VALUE_SET_OUT_OF_SERVICE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_TRUE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_OUT_OF_SERVICE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set overridden operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_VALUE_SET_OVERRIDDEN_MODE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_OVERRIDDEN;\
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set fault status flag
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_ANALOG_VALUE_SET_FAULT_STATUS(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_ANALOG_VALUE_STATUS_FLAG_FAULT; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_ANALOG_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_ANALOG_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_ANALOG_VALUE_ATTR_API group */
|
||||
|
||||
/** @} */ /* ZCL Analog Value cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_analog_value_init_server(void);
|
||||
void zb_zcl_analog_value_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ANALOG_VALUE_SERVER_ROLE_INIT zb_zcl_analog_value_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ANALOG_VALUE_CLIENT_ROLE_INIT zb_zcl_analog_value_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ANALOG_VALUE_H */ /**< H */
|
||||
@@ -0,0 +1,595 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZCL Basic Cluster definitions
|
||||
*/
|
||||
#ifndef ZB_ZCL_BASIC_H
|
||||
#define ZB_ZCL_BASIC_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_BASIC
|
||||
* @{
|
||||
* @details
|
||||
* According to ZCL spec, clause 3.2, Basic cluster contains attributes only. These attributes
|
||||
* could be queried with @ref ZB_ZCL_COMMANDS "general ZCL commands".
|
||||
*/
|
||||
|
||||
/** @name Basic cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Basic cluster information attribute set identifiers
|
||||
@see ZCL spec, subclauses 3.2.2.2.1 to 3.2.2.2.9
|
||||
*/
|
||||
enum zb_zcl_basic_info_attr_e
|
||||
{
|
||||
/** ZCL version attribute */
|
||||
ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID = 0x0000,
|
||||
/** Application version attribute */
|
||||
ZB_ZCL_ATTR_BASIC_APPLICATION_VERSION_ID = 0x0001,
|
||||
/** Stack version attribute */
|
||||
ZB_ZCL_ATTR_BASIC_STACK_VERSION_ID = 0x0002,
|
||||
/** Hardware version attribute */
|
||||
ZB_ZCL_ATTR_BASIC_HW_VERSION_ID = 0x0003,
|
||||
/** Manufacturer name attribute */
|
||||
ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID = 0x0004,
|
||||
/** Model identifier attribute */
|
||||
ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID = 0x0005,
|
||||
/** Date code attribute */
|
||||
ZB_ZCL_ATTR_BASIC_DATE_CODE_ID = 0x0006,
|
||||
/** Power source attribute */
|
||||
ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID = 0x0007,
|
||||
/** The GenericDeviceClass attribute defines the field of application of the
|
||||
* GenericDeviceType attribute. */
|
||||
ZB_ZCL_ATTR_BASIC_GENERIC_DEVICE_CLASS_ID = 0x0008,
|
||||
/** The GenericDeviceType attribute allows an application to show an icon on
|
||||
* a rich user interface (e.g. smartphone app). */
|
||||
ZB_ZCL_ATTR_BASIC_GENERIC_DEVICE_TYPE_ID = 0x0009,
|
||||
/** The ProductCode attribute allows an application to specify a code for
|
||||
* the product. */
|
||||
ZB_ZCL_ATTR_BASIC_PRODUCT_CODE_ID = 0x000a,
|
||||
/** The ProductURL attribute specifies a link to a web page containing specific
|
||||
* product information. */
|
||||
ZB_ZCL_ATTR_BASIC_PRODUCT_URL_ID = 0x000b,
|
||||
/** Vendor specific human readable (displayable) string representing the versions
|
||||
* of one of more program images supported on the device. */
|
||||
ZB_ZCL_ATTR_BASIC_MANUFACTURER_VERSION_DETAILS_ID = 0x000c,
|
||||
/** Vendor specific human readable (displayable) serial number. */
|
||||
ZB_ZCL_ATTR_BASIC_SERIAL_NUMBER_ID = 0x000d,
|
||||
/** Vendor specific human readable (displayable) product label. */
|
||||
ZB_ZCL_ATTR_BASIC_PRODUCT_LABEL_ID = 0x000e,
|
||||
/** Manufacturer-specific reference to the version of the software. */
|
||||
ZB_ZCL_ATTR_BASIC_SW_BUILD_ID = 0x4000,
|
||||
};
|
||||
|
||||
/** @brief Basic cluster settings attribute set identifiers
|
||||
@see ZCL spec, subclauses 3.2.2.2.10 to 3.2.2.2.15
|
||||
*/
|
||||
enum zb_zcl_basic_settings_attr_e
|
||||
{
|
||||
/*! Location description attribute */
|
||||
ZB_ZCL_ATTR_BASIC_LOCATION_DESCRIPTION_ID = 0x0010,
|
||||
/*! Physical environment attribute */
|
||||
ZB_ZCL_ATTR_BASIC_PHYSICAL_ENVIRONMENT_ID = 0x0011,
|
||||
/*! Device enabled attribute */
|
||||
ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID = 0x0012,
|
||||
/*! Alarm mask attribute */
|
||||
ZB_ZCL_ATTR_BASIC_ALARM_MASK_ID = 0x0013,
|
||||
/*! Disable local config attribute */
|
||||
ZB_ZCL_ATTR_BASIC_DISABLE_LOCAL_CONFIG_ID = 0x0014
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Permitted values for "Power source" attribute.
|
||||
* @see ZCL spec, subclauses 3.2.2.2.9.
|
||||
*/
|
||||
enum zb_zcl_basic_power_source_e
|
||||
{
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN = 0x00, /**< Power source unknown. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_MAINS_SINGLE_PHASE = 0x01, /**< Single-phase mains. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_MAINS_THREE_PHASE = 0x02, /**< 3-phase mains. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_BATTERY = 0x03, /**< Battery source. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_DC_SOURCE = 0x04, /**< DC source. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_EMERGENCY_MAINS_CONST = 0x05, /**< Emergency mains constantly
|
||||
powered. */
|
||||
ZB_ZCL_BASIC_POWER_SOURCE_EMERGENCY_MAINS_TRANSF = 0x06 /**< Emergency mains and transfer
|
||||
switch. */
|
||||
};
|
||||
|
||||
/** @brief Basic permitted values for "Physical environment" attribute.
|
||||
@note most of values are profile-specific.
|
||||
@see ZCL spec, subclause 3.2.2.2.12
|
||||
*/
|
||||
enum zb_zcl_basic_physical_env_e
|
||||
{
|
||||
/*! Environment unspecified */
|
||||
ZB_ZCL_BASIC_ENV_UNSPECIFIED = 0,
|
||||
/*! Environment unknown */
|
||||
ZB_ZCL_BASIC_ENV_UNKNOWN = 0xff
|
||||
};
|
||||
|
||||
/** @brief Permitted bits for "Alarm mask" attribute
|
||||
@see ZCL spec, subclause 3.2.2.2.14
|
||||
*/
|
||||
enum zb_zcl_basic_alarm_mask_e
|
||||
{
|
||||
/*! General hardware fault */
|
||||
ZB_ZCL_BASIC_ALARM_MASK_HW_FAULT = 0,
|
||||
/*! General software fault */
|
||||
ZB_ZCL_BASIC_ALARM_MASK_SW_FAULT = 1
|
||||
};
|
||||
|
||||
/** @brief Value structure for "Disable local config" attribute
|
||||
@see ZCL spec, subclause 3.2.2.2.15
|
||||
*/
|
||||
typedef struct zb_zcl_basic_disable_local_conf_s
|
||||
{
|
||||
/*! Reset to factory defaults disabled */
|
||||
zb_bitfield_t reset_disabled : 1;
|
||||
/*! Device configuration enabled */
|
||||
zb_bitfield_t config_enabled : 1;
|
||||
/*! Reserved bits */
|
||||
zb_bitfield_t reserved : 6;
|
||||
} zb_zcl_basic_disable_local_conf_t;
|
||||
|
||||
/** @brief Default value for Basic cluster revision global attribute */
|
||||
#define ZB_ZCL_BASIC_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/** @brief Default value for ZCL version attribute */
|
||||
#define ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE ((zb_uint8_t)ZB_ZCL_VERSION)
|
||||
|
||||
/** @brief Default value for Application version attribute */
|
||||
#define ZB_ZCL_BASIC_APPLICATION_VERSION_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for Stack version attribute */
|
||||
#define ZB_ZCL_BASIC_STACK_VERSION_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for Hardware version attribute */
|
||||
#define ZB_ZCL_BASIC_HW_VERSION_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for Manufacturer name attribute */
|
||||
#define ZB_ZCL_BASIC_MANUFACTURER_NAME_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for Model identifier attribute */
|
||||
#define ZB_ZCL_BASIC_MODEL_IDENTIFIER_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for Date code attribute */
|
||||
#define ZB_ZCL_BASIC_DATE_CODE_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for Power source attribute */
|
||||
#define ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE (ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN)
|
||||
|
||||
/** @brief Default value for GenericDeviceClass attribute */
|
||||
#define ZB_ZCL_BASIC_GENERIC_DEVICE_CLASS_DEFAULT_VALUE ((zb_uint8_t)0xFF)
|
||||
|
||||
/** @brief Default value for GenericDeviceType attribute */
|
||||
#define ZB_ZCL_BASIC_GENERIC_DEVICE_TYPE_DEFAULT_VALUE ((zb_uint8_t)0xFF)
|
||||
|
||||
/** @brief Default value for ProductCode attribute */
|
||||
#define ZB_ZCL_BASIC_PRODUCT_CODE_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for ProductURL attribute */
|
||||
#define ZB_ZCL_BASIC_PRODUCT_URL_DEFAULT_VALUE {0}
|
||||
/** @brief Default value for ManufacturerVersionDetails attribute */
|
||||
|
||||
#define ZB_ZCL_BASIC_MANUFACTURER_VERSION_DETAILS_DEFAULT_VALUE {0}
|
||||
/** @brief Default value for SerialNumber attribute */
|
||||
|
||||
#define ZB_ZCL_BASIC_SERIAL_NUMBER_DEFAULT_VALUE {0}
|
||||
/** @brief Default value for ProductLabel attribute */
|
||||
|
||||
#define ZB_ZCL_BASIC_PRODUCT_LABEL_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for location description attribute */
|
||||
#define ZB_ZCL_BASIC_LOCATION_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for Physical environment attribute */
|
||||
#define ZB_ZCL_BASIC_PHYSICAL_ENVIRONMENT_DEFAULT_VALUE (ZB_ZCL_BASIC_ENV_UNSPECIFIED)
|
||||
|
||||
/** @brief Default value for Device enabled attribute */
|
||||
#define ZB_ZCL_BASIC_DEVICE_ENABLED_DEFAULT_VALUE ((zb_uint8_t)0x01)
|
||||
|
||||
/** @brief Default value for Alarm mask attribute */
|
||||
#define ZB_ZCL_BASIC_ALARM_MASK_DEFAULT_VALUE (ZB_ZCL_BASIC_ALARM_MASK_HW_FAULT)
|
||||
|
||||
/** @brief Default value for Disable local config attribute */
|
||||
#define ZB_ZCL_BASIC_DISABLE_LOCAL_CONFIG_DEFAULT_VALUE ((zb_zcl_basic_disable_local_conf_t){0,0,0})
|
||||
|
||||
/**
|
||||
* @brief Default value for SWBuildId attribute.
|
||||
* @note Default value supposes that attribute will be stored as Pascal-style string (i. e.
|
||||
* length-byte, then content).
|
||||
*/
|
||||
#define ZB_ZCL_BASIC_SW_BUILD_ID_DEFAULT_VALUE {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_APPLICATION_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_APPLICATION_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_STACK_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_STACK_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_HW_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_HW_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_DATE_CODE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_DATE_CODE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_LOCATION_DESCRIPTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_LOCATION_DESCRIPTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_PHYSICAL_ENVIRONMENT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_PHYSICAL_ENVIRONMENT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BASIC_SW_BUILD_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BASIC_SW_BUILD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_SCENES
|
||||
/*! Scenes field set length for Basic cluster */
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_SCENE_FIELD_SETS_LENGTH 0
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_SCENES */
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Basic cluster
|
||||
@param attr_list - attribute list name
|
||||
@param zcl_version - pointer to variable to store zcl version attribute value
|
||||
@param power_source - pointer to variable to store power source attribute value
|
||||
|
||||
@snippet lighting/dimmable_light_tl/light_device_zr.c BASIC_CLUSTER_DECLARE
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(attr_list, zcl_version, power_source) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_BASIC) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, (zcl_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, (power_source)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @brief Declare attribute list for Basic cluster
|
||||
@param attr_list - attribute list name
|
||||
@param zcl_version - pointer to variable to store zcl version attribute value
|
||||
@param power_source - pointer to variable to store power source attribute value
|
||||
@param device_enabled - pointer to variable to store device enabled attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BASIC_WITH_DEVICE_ENABLED_ATTRIB_LIST(attr_list, zcl_version, power_source, device_enabled) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, (zcl_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, (power_source)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID, (device_enabled)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Declare attribute list for Basic cluster (extended attribute set).
|
||||
* @param attr_list [IN] - attribute list name.
|
||||
* @param zcl_version [IN] - pointer to variable storing ZCL version attribute value.
|
||||
* @param app_version [IN] - pointer to the variable storing application version.
|
||||
* @param stack_version [IN] - pointer to the variable storing stack version.
|
||||
* @param hardware_version [IN] - pointer to the variable storing hardware version.
|
||||
* @param manufacturer_name [IN] - pointer to the variable storing manufacturer name.
|
||||
* @param model_id [IN] - pointer to the variable storing model identifier.
|
||||
* @param date_code [IN] - pointer to the variable storing date code.
|
||||
* @param power_source [IN] - pointer to variable storing power source attribute value.
|
||||
* @param location_id [IN] - pointer to variable storing location description attribute value.
|
||||
* @param ph_env [IN] - pointer to variable storing physical environment attribute value.
|
||||
* @param sw_build_id [IN] - pointer to the variable storing software version reference.
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST_EXT( \
|
||||
attr_list, \
|
||||
zcl_version, \
|
||||
app_version, \
|
||||
stack_version, \
|
||||
hardware_version, \
|
||||
manufacturer_name, \
|
||||
model_id, \
|
||||
date_code, \
|
||||
power_source, \
|
||||
location_id, \
|
||||
ph_env, \
|
||||
sw_build_id) \
|
||||
zb_bool_t device_enable_##attr_list = ZB_TRUE; \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_BASIC) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, (zcl_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_APPLICATION_VERSION_ID, (app_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_STACK_VERSION_ID, (stack_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_HW_VERSION_ID, (hardware_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, (manufacturer_name))\
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, (model_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_DATE_CODE_ID, (date_code)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, (power_source)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_SW_BUILD_ID, (sw_build_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID, \
|
||||
&(device_enable_##attr_list)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_LOCATION_DESCRIPTION_ID, (location_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_PHYSICAL_ENVIRONMENT_ID, (ph_env)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Declare attribute list for Basic cluster (extended attribute set).
|
||||
* @param attr_list [IN] - attribute list name.
|
||||
* @param zcl_version [IN] - pointer to variable storing ZCL version attribute value.
|
||||
* @param app_version [IN] - pointer to the variable storing application version.
|
||||
* @param stack_version [IN] - pointer to the variable storing stack version.
|
||||
* @param hardware_version [IN] - pointer to the variable storing hardware version.
|
||||
* @param manufacturer_name [IN] - pointer to the variable storing manufacturer name.
|
||||
* @param model_id [IN] - pointer to the variable storing model identifier.
|
||||
* @param date_code [IN] - pointer to the variable storing date code.
|
||||
* @param power_source [IN] - pointer to variable storing power source attribute value.
|
||||
* @param location_id [IN] - pointer to variable storing location description attribute value.
|
||||
* @param ph_env [IN] - pointer to variable storing physical environment attribute value.
|
||||
* @param sw_build_id [IN] - pointer to the variable storing software version reference.
|
||||
* @param device_enabled - pointer to the variable storing device enabled reference.
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BASIC_WITH_DEVICE_ENABLED_ATTRIB_LIST_EXT( \
|
||||
attr_list, \
|
||||
zcl_version, \
|
||||
app_version, \
|
||||
stack_version, \
|
||||
hardware_version, \
|
||||
manufacturer_name, \
|
||||
model_id, \
|
||||
date_code, \
|
||||
power_source, \
|
||||
location_id, \
|
||||
ph_env, \
|
||||
sw_build_id, \
|
||||
device_enabled) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, (zcl_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_APPLICATION_VERSION_ID, (app_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_STACK_VERSION_ID, (stack_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_HW_VERSION_ID, (hardware_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, (manufacturer_name))\
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, (model_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_DATE_CODE_ID, (date_code)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, (power_source)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_SW_BUILD_ID, (sw_build_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID, (device_enabled)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_LOCATION_DESCRIPTION_ID, (location_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BASIC_PHYSICAL_ENVIRONMENT_ID, (ph_env)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! Maximum length of ManufacturerName string field */
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_MANUFACTURER_NAME_MAX_LEN 32
|
||||
|
||||
/*! Maximum length of ModelIdentifier string field */
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_MODEL_IDENTIFIER_MAX_LEN 32
|
||||
|
||||
/**
|
||||
* @brief Basic cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_basic_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID
|
||||
* @see ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID
|
||||
*/
|
||||
zb_uint8_t zcl_version;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID
|
||||
* @see ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID
|
||||
*/
|
||||
zb_uint8_t power_source;
|
||||
} zb_zcl_basic_attrs_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Basic cluster cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_basic_attrs_t type (containing Basic cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BASIC_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(attr_list, &attrs.zcl_version, &attrs.power_source)
|
||||
|
||||
/** @} */ /* Basic cluster attributes */
|
||||
|
||||
/*! @name Alarms cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Basic cluster command identifiers
|
||||
@see ZCL spec, subclause 3.2.2.3
|
||||
*/
|
||||
enum zb_zcl_basic_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_BASIC_RESET_ID = 0x00, /**< "Reset to Factory Defaults" command. */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Basic cluster commands lists : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CMD_BASIC_RESET_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_BASIC_SERVER_ROLE_RECEIVED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
/*! @brief Send Reset to Factory Defaults command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param cb - callback to call to report send status
|
||||
*/
|
||||
#define ZB_ZCL_BASIC_SEND_RESET_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_BASIC_RESET_ID); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_BASIC, cb); \
|
||||
}
|
||||
|
||||
|
||||
/** Call device callback in user application to reset application settings to defaults.
|
||||
* @param[in] buffer - pointer to buffer for callback
|
||||
* @param[in] ep - current endpoint
|
||||
* @param[out] result - callback status
|
||||
*/
|
||||
#define ZB_ZCL_RESET_TO_FACTORY_DEFAULTS_USER_APP(buffer, ep, result) \
|
||||
{ \
|
||||
TRACE_MSG(TRACE_ZCL1, "ZB_ZCL_RESET_TO_FACTORY_DEFAULTS_USER_APP", (FMT__0)); \
|
||||
if (ZCL_CTX().device_cb) \
|
||||
{ \
|
||||
zb_zcl_device_callback_param_t *user_app_data = \
|
||||
ZB_BUF_GET_PARAM(buffer, zb_zcl_device_callback_param_t); \
|
||||
user_app_data->device_cb_id = ZB_ZCL_BASIC_RESET_CB_ID; \
|
||||
user_app_data->endpoint = (ep); \
|
||||
user_app_data->status = RET_OK; \
|
||||
(ZCL_CTX().device_cb)(param); \
|
||||
result = user_app_data->status; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Check Device Enabled attribute value and should the stack process command or not.
|
||||
@see ZCL spec, subclause 3.2.2.2.18 DeviceEnabled Attribute
|
||||
@param ep_id Endpoint ID
|
||||
@param cmd_id Command ID
|
||||
@param cluster_id Cluster ID
|
||||
@param is_common_command Is command common or cluster specific
|
||||
@return ZB_TRUE if command should be processed or sent, ZB_FALSE otherwise
|
||||
*/
|
||||
zb_bool_t zb_zcl_check_is_device_enabled(zb_uint8_t ep_id, zb_uint8_t cmd_id, zb_uint16_t cluster_id, zb_bool_t is_common_command);
|
||||
|
||||
/** @} */ /* Basic cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Basic cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_basic_init_server(void);
|
||||
void zb_zcl_basic_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_SERVER_ROLE_INIT zb_zcl_basic_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_BASIC_CLIENT_ROLE_INIT zb_zcl_basic_init_client
|
||||
|
||||
#endif /* ZB_ZCL_BASIC_H */
|
||||
@@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Binary Input cluster
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_BINARY_INPUT_H
|
||||
#define ZB_ZCL_BINARY_INPUT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_BINARY_INPUT
|
||||
* @{
|
||||
* @details
|
||||
* According to ZCL spec, subclause 3.14.4, Binary Input (Basic) cluster has no cluster-specific
|
||||
* commands. Cluster attributes could be queried with
|
||||
* @ref ZB_ZCL_COMMANDS "general ZCL commands".
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* ZB_ZCL_CLUSTER_ID_BINARY_INPUT = 0x000f defined in zb_zcl_common.h ZCL spec 3.14.4 */
|
||||
|
||||
/*! @name Binary Input cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @brief Binary Input cluster attribute identifiers. */
|
||||
enum zb_zcl_binary_input_attr_e
|
||||
{
|
||||
/** This attribute, of type Character string, MAY be used to hold a human readable
|
||||
* description of the ACTIVE state of a binary PresentValue. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_ACTIVE_TEXT_ID = 0x0004,
|
||||
/** The Description attribute, of type Character string, MAY be used to hold a
|
||||
* description of the usage of the input, output or value, as appropriate
|
||||
* to the cluster. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID = 0x001C,
|
||||
/** This attribute, of type Character string, MAY be used to hold a human readable
|
||||
* description of the INACTIVE state of a binary PresentValue. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_INACTIVE_TEXT_ID = 0x002E,
|
||||
|
||||
/** @brief OutOfService attribute */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID = 0x0051,
|
||||
/** This attribute, of type enumeration, indicates the relationship between
|
||||
* the physical state of the input (or output as appropriate for the cluster)
|
||||
* and the logical state represented by a binary PresentValue attribute,
|
||||
* when OutOfService is FALSE. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_POLARITY_ID = 0x0054,
|
||||
|
||||
/** @brief PresentValue attribute */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID = 0x0055,
|
||||
|
||||
// adding GP specific attributes
|
||||
ZB_ZCL_ATTR_GP_ATTR_BINARY_INPUT_BATTERY_VALUE_ID = 0x0056,
|
||||
ZB_ZCL_ATTR_GP_ATTR_BINARY_INPUT_TEMPERATURE_VALUE_ID = 0x0057,
|
||||
ZB_ZCL_ATTR_GP_ATTR_BINARY_INPUT_TAMPER_VALUE_ID = 0x0058,
|
||||
// end GP specific attributes
|
||||
/** The Reliability attribute, of type 8-bit enumeration, provides an indication
|
||||
* of whether the PresentValue or the operation of the physical input,
|
||||
* output or value in question (as appropriate for the cluster) is reliable
|
||||
* as far as can be determined and, if not, why not. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_RELIABILITY_ID = 0x0067,
|
||||
|
||||
/** @brief StatusFlag attribute */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID = 0x006F,
|
||||
/** The ApplicationType attribute is an unsigned 32-bit integer that indicates
|
||||
* the specific application usage for this cluster. */
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_APPLICATION_TYPE_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief StatusFlag attribute values.
|
||||
* @see ZCL spec 3.14.10.3.
|
||||
*/
|
||||
enum zb_zcl_binary_input_status_flag_value_e
|
||||
{
|
||||
ZB_ZCL_BINARY_INPUT_STATUS_FLAG_NORMAL = 0x00, /**< Normal (default) state. */
|
||||
ZB_ZCL_BINARY_INPUT_STATUS_FLAG_IN_ALARM = 0x01, /**< In alarm bit. */
|
||||
ZB_ZCL_BINARY_INPUT_STATUS_FLAG_FAULT = 0x02, /**< Fault bit. */
|
||||
ZB_ZCL_BINARY_INPUT_STATUS_FLAG_OVERRIDEN = 0x04, /**< Overridden bit. */
|
||||
ZB_ZCL_BINARY_INPUT_STATUS_FLAG_OUT_OF_SERVICE = 0x08, /**< Out of service bit. */
|
||||
};
|
||||
|
||||
/** @brief Default value for Binary Input cluster revision global attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for ActiveText attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_ACTIVE_TEXT_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for Description attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for InactiveText attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_INACTIVE_TEXT_DEFAULT_VALUE {0}
|
||||
|
||||
/*! @brief OutOfService attribute default value */
|
||||
#define ZB_ZCL_BINARY_INPUT_OUT_OF_SERVICE_DEFAULT_VALUE ZB_FALSE
|
||||
|
||||
/** @brief Default value for Polarity attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_POLARITY_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for Reliability attribute */
|
||||
#define ZB_ZCL_BINARY_INPUT_RELIABILITY_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/*! @brief StatusFlag attribute default value */
|
||||
#define ZB_ZCL_BINARY_INPUT_STATUS_FLAG_DEFAULT_VALUE ZB_ZCL_BINARY_INPUT_STATUS_FLAG_NORMAL
|
||||
|
||||
/*! @brief StatusFlag attribute minimum value */
|
||||
#define ZB_ZCL_BINARY_INPUT_STATUS_FLAG_MIN_VALUE 0
|
||||
|
||||
/*! @brief StatusFlag attribute maximum value */
|
||||
#define ZB_ZCL_BINARY_INPUT_STATUS_FLAG_MAX_VALUE 0x0F
|
||||
|
||||
/** @brief Declare attribute list for Binary Input cluster
|
||||
@param attr_list - attribute list name
|
||||
@param out_of_service - pointer to variable to store OutOfService attribute value
|
||||
@param present_value - pointer to variable to store PresentValue attribute value
|
||||
@param status_flag - pointer to variable to store StatusFlag attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_BINARY_INPUT_ATTRIB_LIST( \
|
||||
attr_list, out_of_service, present_value, status_flag) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_BINARY_INPUT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, (out_of_service)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID, (present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, (status_flag)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Binary Input cluster attributes */
|
||||
|
||||
/*! @name Binary input attribute value manipulation API
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @brief Set normal operating mode
|
||||
@param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_BINARY_INPUT_SET_NORMAL_MODE(ep) \
|
||||
{ \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_FALSE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
val = ZB_ZCL_BINARY_INPUT_STATUS_FLAG_NORMAL; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @brief Set Out of service operating mode
|
||||
@param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_BINARY_INPUT_SET_OUT_OF_SERVICE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_TRUE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_BINARY_INPUT_STATUS_FLAG_OUT_OF_SERVICE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set overridden operating mode
|
||||
@param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_BINARY_INPUT_SET_OVERRIDEN_MODE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_BINARY_INPUT_STATUS_FLAG_OVERRIDEN; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_BINARY_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* Binary input cluster commands */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Binary Input cluster internals
|
||||
Internal structures for Binary Input cluster
|
||||
@{
|
||||
*/
|
||||
|
||||
/* Optionally, access to this attribute may be changed to READ_WRITE */
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/* Optionally, access to this attribute may be changed to READ_WRITE */
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! Number of attributes mandatory for reporting in Binary Input cluster */
|
||||
#define ZB_ZCL_BINARY_INPUT_REPORT_ATTR_COUNT 2
|
||||
|
||||
/*! @}
|
||||
* @endcond */ /* Binary Input cluster internals */
|
||||
|
||||
|
||||
/*! @} */ /* ZCL Binary Input cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_binary_input_init_server(void);
|
||||
void zb_zcl_binary_input_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_BINARY_INPUT_SERVER_ROLE_INIT zb_zcl_binary_input_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_BINARY_INPUT_CLIENT_ROLE_INIT zb_zcl_binary_input_init_client
|
||||
|
||||
#endif /* ZB_ZCL_BINARY_INPUT_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Carbon Dioxide Measurement cluster definitions */
|
||||
|
||||
#ifndef ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_H
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_CONCENTRATION_MEASUREMENT
|
||||
* @{
|
||||
* @details
|
||||
* The server cluster provides an interface to concentration measurement
|
||||
* functionality. The measurement is reportable and may be configured for
|
||||
* reporting. Concentration measurements include, but are not limited to,
|
||||
* levels in gases, such as CO, CO2, and ethylene, or in fluids and
|
||||
* solids, such as dissolved oxygen, chemi8721 cals & pesticides.
|
||||
*
|
||||
* Carbon Dioxide (CO2)
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT */
|
||||
|
||||
/** @name Carbon Dioxide Measurement cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Carbon Dioxide Measurement cluster attribute identifiers
|
||||
* @see ZCL spec, Carbon Dioxide Measurement Cluster 4.14.1.4
|
||||
*/
|
||||
enum zb_zcl_carbon_dioxide_measurement_attr_e
|
||||
{
|
||||
/** @brief MeasuredValue attribute, ZCL spec 4.13.2.1.1 */
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID = 0x0000,
|
||||
/** @brief MinMeasuredValue attribute, ZCL spec 4.13.2.1.2 */
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID = 0x0001,
|
||||
/** @brief MaxMeasuredValue attribute, ZCL spec 4.13.2.1.3 */
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID = 0x0002,
|
||||
/** @brief Tolerance attribute, ZCL spec 4.13.2.1.4 */
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID = 0x0003,
|
||||
};
|
||||
|
||||
/** @brief MeasuredValue attribute unknown */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_UNKNOWN (.0/.0)
|
||||
|
||||
/** @brief MinMeasuredValue attribute undefined */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_UNDEFINED (.0/.0)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute undefined */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_UNDEFINED (.0/.0)
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_MIN_VALUE 0.0
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_MAX_VALUE 1.0
|
||||
|
||||
|
||||
/** @brief Default value for Carbon Dioxide Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for MeasuredValue attribute */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
/** @brief Default value for MinMeasuredValue attribute */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
/** @brief Default value for MaxMeasuredValue attribute */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Carbon Dioxide Measurement cluster internals
|
||||
* Internal structures for Carbon Dioxide Measurement cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Carbon Dioxide Measurement cluster */
|
||||
#define ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Carbon Dioxide Measurement cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for Carbon Dioxide Measurement cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param measured_value - pointer to variable storing MeasuredValue attribute value
|
||||
* @param min_measured_value - pointer to variable storing MinMeasuredValue attribute value
|
||||
* @param max_measured_value - pointer to variable storing MaxMeasuredValue attribute value
|
||||
* @param tolerance - pointer to variable storing Tolerance attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_CARBON_DIOXIDE_MEASUREMENT_ATTRIB_LIST( \
|
||||
attr_list, \
|
||||
measured_value, \
|
||||
min_measured_value, \
|
||||
max_measured_value, \
|
||||
tolerance) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID, (measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID, (min_measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID, (max_measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID, (tolerance)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Carbon Dioxide Measurement cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_carbon_dioxide_measurement_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MIN_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t min_measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_MAX_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t max_measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID
|
||||
* @see ZB_ZCL_ATTR_CARBON_DIOXIDE_MEASUREMENT_TOLERANCE_ID
|
||||
*/
|
||||
zb_single_t tolerance;
|
||||
} zb_zcl_carbon_dioxide_measurement_attrs_t;
|
||||
|
||||
/** @brief Declare attribute list for Carbon Dioxide Measurement cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_carbon_dioxide_measurement_attrs_t type
|
||||
* (containing Carbon Dioxide Measurement cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_CARBON_DIOXIDE_MEASUREMENT_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_CARBON_DIOXIDE_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
&attrs.measured_value, \
|
||||
&attrs.min_measured_value, \
|
||||
&attrs.max_measured_value, \
|
||||
&attrs.tolerance)
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_ATTRS_GROUP group */
|
||||
|
||||
/** @} */ /* ZCL Carbon Dioxide Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_carbon_dioxide_measurement_init_server(void);
|
||||
void zb_zcl_carbon_dioxide_measurement_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_carbon_dioxide_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_carbon_dioxide_measurement_init_client
|
||||
|
||||
#endif /* ZB_ZCL_CARBON_DIOXIDE_MEASUREMENT_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Configuration for Zigbee cluster library
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_CONFIG_H
|
||||
#define ZB_ZCL_CONFIG_H 1
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/************ ZCL specific configuration ******************/
|
||||
|
||||
/**
|
||||
ZCL: transactions table size
|
||||
*/
|
||||
#define ZCL_TRAN_TABLE_SIZE 16U
|
||||
|
||||
/* DA: range check error */
|
||||
/* #define ZB_DISABLE_TEMP_MEASUREMENT_TOLERANCE_ID */
|
||||
|
||||
/* #define ZB_ZCL_OTA_INCREMENTAL_QUERY_INTERVAL */
|
||||
|
||||
/* Enable CVC feature */
|
||||
#define ZB_ZCL_ENABLE_CVC
|
||||
|
||||
/* Disable Poll Control Check-Ins during OTA upgrade (to reduce the load) */
|
||||
#define xZB_ZCL_NO_CHECKINS_DURING_OTA
|
||||
|
||||
|
||||
/*********************** Cluster to command configuration **********************/
|
||||
|
||||
/* General commands default processing */
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_REPORT_ATTR_PROCESSING
|
||||
|
||||
/* Control per-cluster default command processing */
|
||||
|
||||
#if defined (ZB_ZCL_SUPPORT_CLUSTER_GROUPS)
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_GROUPS_PROCESSING
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_GROUPS */
|
||||
|
||||
#if defined (ZB_ZCL_SUPPORT_CLUSTER_GROUPS_CLIENT)
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_GROUPS_PROCESSING_CLIENT
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_GROUPS_CLIENT */
|
||||
|
||||
/* Control per-cluster default scene extension processing */
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_SCENES
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_THERMOSTAT
|
||||
#define ZB_ZCL_SUPPORT_THERMOSTAT_SCENE_EXTENSIONS
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_THERMOSTAT */
|
||||
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_SCENES */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL
|
||||
#define ZB_HA_ENABLE_POLL_CONTROL_SERVER
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL */
|
||||
|
||||
/* TODO: Divide Server and Client processing and turn on server part only when it is really needed -
|
||||
* OTA cluster is rather big in terms of ROM size! */
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_OTA_UPGRADE_PROCESSING
|
||||
#define ZB_HA_ENABLE_OTA_UPGRADE_SERVER 1
|
||||
#define ZB_HA_ENABLE_OTA_UPGRADE_CLIENT 1
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_OTA_UPGRADE */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_TUNNEL
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_TUNNEL_PROCESSING
|
||||
#endif /* defined ZB_ENABLE_TUNNEL_CLUSTER */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_IR_BLASTER
|
||||
#define ZB_ZCL_ENABLE_DEFAULT_IR_BLASTER_PROCESSING
|
||||
#endif /* defined ZB_ENABLE_IR_BLASTER_CLUSTER */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS
|
||||
#define ZB_MAC_DIAGNOSTICS
|
||||
#define ZDO_DIAGNOSTICS
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#endif /* ZB_ZCL_CONFIG_H */
|
||||
@@ -0,0 +1,495 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Poll Control cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_CONTROL4_NETWORKING_H
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_CONTROL4
|
||||
* @{
|
||||
* @details
|
||||
* @warning Using this cluster makes an application not conforming to the Zigbee PRO specification
|
||||
*
|
||||
* This cluster provides an application level interface between Zigbee devices and a Control4
|
||||
* Controller.
|
||||
*
|
||||
* This is implemented using Control4 specific profile ZB_AF_CONTROL4_PROFILE_ID.
|
||||
*
|
||||
* Control4 Network cluster also uses Many-To-One routing requests.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @name Control4 Network cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum zb_zcl_control4_networking_attr_e
|
||||
{
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_DEVICE_TYPE_ID = 0x0000,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_ID = 0x0001,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_MTORR_PERIOD_ID = 0x0002,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_FIRMWARE_VERSION_ID = 0x0004,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_REFLASH_VERSION_ID = 0x0005,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_BOOT_COUNT_ID = 0x0006,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_PRODUCT_STRING_ID = 0x0007,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_ID = 0x0008,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_ID = 0x0009,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_COST_ID = 0x000a,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_MESH_CHANNEL_ID = 0x000c,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_RSSI_ID = 0x0013,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_LQI_ID = 0x0014,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_BATTERY_LEVEL_ID = 0x0015,
|
||||
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_RADIO_4_BARS_ID = 0x0016
|
||||
};
|
||||
|
||||
enum zb_zcl_control4_networking_device_type_e
|
||||
{
|
||||
/*! "Non-sleepy end device" value */
|
||||
ZB_ZCL_CONTROL4_NETWORKING_DEVICE_TYPE_END_DEVICE = 0x03,
|
||||
/*! "Sleepy end device" value */
|
||||
ZB_ZCL_CONTROL4_NETWORKING_DEVICE_TYPE_SLEEPY_END_DEVICE = 0x04
|
||||
};
|
||||
|
||||
/** @brief Default value for Control4 networking cluster revision global attribute */
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_REFLASH_VERSION_VENDOR_SPECIFIC 0xff
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_BOOT_COUNT_DEF_VALUE 0
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_MIN_VALUE ((zb_uint16_t)0x000f)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_DEF_VALUE ((zb_uint16_t)0x012c)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_MTORR_PERIOD_MIN_VALUE ((zb_uint16_t)0x000f)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_MTORR_PERIOD_DEF_VALUE ((zb_uint16_t)0x012c)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_DEF_VALUE ((zb_uint16_t)0xffff)
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_DEF_VALUE {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_ACCESS_POINT_COST_DEF_VALUE 0xff
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_MESH_CHANNEL_MIN_VALUE 0x0b
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_MESH_CHANNEL_MAX_VALUE 0x19
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_AVG_RSSI_MIN_VALUE -128
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_AVG_RSSI_MAX_VALUE 0
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_BATTERY_LEVEL_MIN_VALUE 0
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_BATTERY_LEVEL_MAX_VALUE 100
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORKING_RADIO_4_BARS_MAX_VALUE 4
|
||||
|
||||
/* Number of searching ZAP attempts */
|
||||
#define ZB_ZCL_CONTROL4_NETWORK_SEARCHING_ZAP_ATTEMPTS 2
|
||||
|
||||
/** @brief Declare attribute list for C4 Network cluster
|
||||
@param attr_list - attribute list name
|
||||
@param device_type - pointer to variable to store Device Type attribute value
|
||||
@param firmware_version - pointer to variable to store Firmware Version attribute value
|
||||
@param reflash_version - pointer to variable to store Reflash Version attribute value
|
||||
@param boot_count - pointer to variable to store Boot Count attribute value
|
||||
@param product_string - pointer to variable to store Product String attribute value
|
||||
@param access_point_node_ID - pointer to variable to store Access Point Node ID attribute value
|
||||
@param access_point_long_ID - pointer to variable to store Access Point Long ID attribute value
|
||||
@param access_point_cost - pointer to variable to store Access Point Cost ID attribute value
|
||||
@param mesh_channel - pointer to variable to store Mesh Channel attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_CONTROL4_NETWORKING_ATTRIB_LIST_SRV(attr_list, device_type, firmware_version, \
|
||||
reflash_version, boot_count, product_string, access_point_node_ID, access_point_long_ID, \
|
||||
access_point_cost, mesh_channel) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_CONTROL4_NETWORKING) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_DEVICE_TYPE_ID, (device_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_FIRMWARE_VERSION_ID, (firmware_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_REFLASH_VERSION_ID, (reflash_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_BOOT_COUNT_ID, (boot_count)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_PRODUCT_STRING_ID, (product_string)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_ID, (access_point_node_ID)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_ID, (access_point_long_ID)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_COST_ID, (access_point_cost)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_MESH_CHANNEL_ID, (mesh_channel)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @brief Declare extended attribute list for C4 Network cluster
|
||||
@param attr_list - attribute list name
|
||||
@param device_type - pointer to variable to store Device Type attribute value
|
||||
@param firmware_version - pointer to variable to store Firmware Version attribute value
|
||||
@param announce_window - pointer to variable to store Announce Window attribute value
|
||||
@param MTORR_period - pointer to variable to store MTORR Period attribute value
|
||||
@param reflash_version - pointer to variable to store Reflash Version attribute value
|
||||
@param boot_count - pointer to variable to store Boot Count attribute value
|
||||
@param product_string - pointer to variable to store Product String attribute value
|
||||
@param access_point_node_ID - pointer to variable to store Access Point Node ID attribute value
|
||||
@param access_point_long_ID - pointer to variable to store Access Point Long ID attribute value
|
||||
@param access_point_cost - pointer to variable to store Access Point Cost ID attribute value
|
||||
@param mesh_channel - pointer to variable to store Mesh Channel attribute value
|
||||
@param avg_RSSI - pointer to variable to store Avg RSSI attribute value
|
||||
@param avg_LQI - pointer to variable to store Avg LQI attribute value
|
||||
@param battery_level - pointer to variable to store Battery Level attribute value
|
||||
@param radio_4_bars - pointer to variable to store Radio 4-Bar attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_CONTROL4_NETWORKING_ATTRIB_LIST_SRV_EXT(attr_list, device_type, firmware_version, \
|
||||
announce_window, MTORR_period, \
|
||||
reflash_version, boot_count, product_string, access_point_node_ID, access_point_long_ID, \
|
||||
access_point_cost, mesh_channel, \
|
||||
avg_RSSI, avg_LQI, battery_level, radio_4_bars) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_CONTROL4_NETWORKING) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_DEVICE_TYPE_ID, (device_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_ID, (announce_window)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_MTORR_PERIOD_ID, (MTORR_period)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_FIRMWARE_VERSION_ID, (firmware_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_REFLASH_VERSION_ID, (reflash_version)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_BOOT_COUNT_ID, (boot_count)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_PRODUCT_STRING_ID, (product_string)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_ID, (access_point_node_ID)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_ID, (access_point_long_ID)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_COST_ID, (access_point_cost)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_MESH_CHANNEL_ID, (mesh_channel)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_RSSI_ID, (avg_RSSI)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_LQI_ID, (avg_LQI)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_BATTERY_LEVEL_ID, (battery_level)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CONTROL4_NETWORKING_RADIO_4_BARS_ID, (radio_4_bars)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /*Control4 Network cluster attributes */
|
||||
|
||||
/** @name Control4 Network cluster commands
|
||||
* @{
|
||||
*/
|
||||
enum zb_zcl_control4_networking_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_CONTROL4_NETWORKING_IMMEDIATE_ANNOUNCE_ID = 0x00 /**< "Immediate announce command" command. */
|
||||
};
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_CONTROL4_NETWORKING_IMMEDIATE_ANNOUNCE_ID \
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
/** @cond internals_doc */
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_DEVICE_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_DEVICE_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ANNOUNCE_WINDOW_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_MTORR_PERIOD_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_MTORR_PERIOD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_FIRMWARE_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_FIRMWARE_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_REFLASH_VERSION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_REFLASH_VERSION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_BOOT_COUNT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_BOOT_COUNT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_PRODUCT_STRING_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_PRODUCT_STRING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_NODE_ID_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_LONG_ID_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_IEEE_ADDR, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_COST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_ACCESS_POINT_COST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_MESH_CHANNEL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_MESH_CHANNEL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_RSSI_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_RSSI_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_LQI_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_AVG_LQI_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_BATTERY_LEVEL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_BATTERY_LEVEL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CONTROL4_NETWORKING_RADIO_4_BARS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CONTROL4_NETWORKING_RADIO_4_BARS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
/** @endcond */ /*internals_doc*/
|
||||
|
||||
|
||||
/**
|
||||
* Control4 Network Cluster Endpoint.
|
||||
*
|
||||
* @attention This endpoint number is reserved for internal usage in the stack (for Control4 feature).
|
||||
*/
|
||||
#define ZB_CONTROL4_NETWORK_ENDPOINT 0xc4
|
||||
|
||||
#define ZB_ZCL_CONTROL4_NETWORK_DECLARE_CLUSTER_LIST( \
|
||||
cluster_list_name, \
|
||||
c4_network_attr_list) \
|
||||
zb_zcl_cluster_desc_t cluster_list_name[] = \
|
||||
{ \
|
||||
ZB_ZCL_CLUSTER_DESC( \
|
||||
ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING, \
|
||||
ZB_ZCL_ARRAY_SIZE(c4_network_attr_list, zb_zcl_attr_t), \
|
||||
(c4_network_attr_list), \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_MANUF_CODE_INVALID \
|
||||
), \
|
||||
ZB_ZCL_CLUSTER_DESC( \
|
||||
ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING, \
|
||||
0, \
|
||||
NULL, \
|
||||
ZB_ZCL_CLUSTER_CLIENT_ROLE, \
|
||||
ZB_ZCL_MANUF_CODE_INVALID \
|
||||
) \
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Declare simple descriptor for C4 Network Cluster endpoint
|
||||
@param ep_name - endpoint variable name
|
||||
*/
|
||||
#define ZB_ZCL_CONTROL4_NETWORK_DECLARE_SIMPLE_DESC(ep_name) \
|
||||
/* ZB_DECLARE_SIMPLE_DESC(1, 1); it is already defined */ \
|
||||
ZB_AF_SIMPLE_DESC_TYPE(1, 1) simple_desc_##ep_name = \
|
||||
{ \
|
||||
ZB_CONTROL4_NETWORK_ENDPOINT, \
|
||||
ZB_AF_CONTROL4_PROFILE_ID, \
|
||||
0, 1, 0, 1, 1, \
|
||||
{ \
|
||||
ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING, \
|
||||
ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief Declare endpoint for C4 Network Cluster
|
||||
@param ep_name - endpoint variable name
|
||||
@param cluster_list - endpoint cluster list
|
||||
*/
|
||||
#define ZB_ZCL_CONTROL4_NETWORK_DECLARE_EP(ep_name, cluster_list) \
|
||||
ZB_ZCL_CONTROL4_NETWORK_DECLARE_SIMPLE_DESC(ep_name); \
|
||||
ZB_AF_DECLARE_ENDPOINT_DESC(ep_name, \
|
||||
ZB_CONTROL4_NETWORK_ENDPOINT, ZB_AF_CONTROL4_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, \
|
||||
0, NULL, 0, NULL)
|
||||
|
||||
/**
|
||||
Control4 Network Cluster states
|
||||
*/
|
||||
typedef enum zb_zcl_control4_network_state_e
|
||||
{
|
||||
ZB_ZCL_CONTROL4_NETWORK_STATE_IDLE,
|
||||
ZB_ZCL_CONTROL4_NETWORK_STATE_SEARCHING_ZAP,
|
||||
ZB_ZCL_CONTROL4_NETWORK_STATE_RUNNING,
|
||||
ZB_ZCL_CONTROL4_NETWORK_STATE_STOPPED,
|
||||
} zb_zcl_control4_network_state_t;
|
||||
|
||||
/**
|
||||
Control4 Zigbee Access Point (ZAP) discovery events
|
||||
*/
|
||||
typedef enum zb_zcl_control4_zap_discover_event_e
|
||||
{
|
||||
/** Information from ZAP (NODE ID and/or LONG_NODE_ID) received and is different from the
|
||||
* current and default value. Bindings and/or reporting in the user application may require to be updated
|
||||
*/
|
||||
ZB_ZCL_CONTROL4_NETWORK_ZAP_UPDATED,
|
||||
/** ZAP discovered failed after retrying ZB_ZCL_CONTROL4_NETWORK_SEARCHING_ZAP_ATTEMPTS times.
|
||||
* User application may retry restart the Control4 network cluster or leave the network.
|
||||
*/
|
||||
ZB_ZCL_CONTROL4_NETWORK_ZAP_DISCOVER_FAILED,
|
||||
} zb_zcl_control4_zap_discover_event_t;
|
||||
|
||||
/** Control4 ZAP discover user app notification payload */
|
||||
typedef struct zb_zcl_control4_zap_info_notify_s
|
||||
{
|
||||
/** Event for user application to handle*/
|
||||
zb_zcl_control4_zap_discover_event_t event;
|
||||
} zb_zcl_control4_zap_info_notify_t;
|
||||
|
||||
/**
|
||||
Start Control4 Network Cluster
|
||||
*/
|
||||
zb_ret_t zb_zcl_control4_network_cluster_start(void);
|
||||
|
||||
/**
|
||||
Stop Control4 Network Cluster
|
||||
*/
|
||||
void zb_zcl_control4_network_cluster_stop(void);
|
||||
|
||||
/**
|
||||
Get Control4 Network Cluster state
|
||||
*/
|
||||
zb_zcl_control4_network_state_t zb_zcl_control4_network_cluster_get_state(void);
|
||||
|
||||
/**
|
||||
Handle Read Attribute Response from Control4 Network Cluster
|
||||
*/
|
||||
void zb_zcl_control4_network_cluster_read_attr_resp_handler(zb_bufid_t param);
|
||||
/** @} */ /*Control4 Network cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Control4 Network cluster */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/**
|
||||
Control4 Network Cluster Initialization
|
||||
*/
|
||||
void zb_zcl_control4_networking_init_server(void);
|
||||
void zb_zcl_control4_networking_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING_SERVER_ROLE_INIT zb_zcl_control4_networking_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_CONTROL4_NETWORKING_CLIENT_ROLE_INIT zb_zcl_control4_networking_init_client
|
||||
|
||||
#endif /* ZB_ZCL_CONTROL4_NETWORKING_H */
|
||||
@@ -0,0 +1,519 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Time cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_CUSTOM_ATTR_H
|
||||
#define ZB_ZCL_CUSTOM_ATTR_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond (DOXYGEN_HA_SECTION && internals_doc) */
|
||||
|
||||
/** @addtogroup zcl_api
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_CUSTOM 0x1A0A
|
||||
#define ZB_CUSTOM_DEVICE_ID 0x29A
|
||||
#define ZB_CUSTOM_DEVICE_VERSION 6
|
||||
|
||||
/*! @name Custom Attributes cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Custom Attributes attribute identifiers
|
||||
|
||||
*/
|
||||
enum zb_zcl_custom_cluster_attr_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_U8_ID = 0x0001,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_S16_ID = 0x0002,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_24BIT_ID = 0x0003,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_32BITMAP_ID = 0x0004,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_IEEE_ID = 0x0005,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_ID = 0x0006,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_UTC_TIME_ID = 0x0007,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_OCTET_STRING_ID = 0x0008,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_BOOL_ID = 0x0009,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_128_BIT_KEY_ID = 0x000a,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_U16_ID = 0x000b,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_U32_ID = 0x000c,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_LONG_OCTET_STRING_ID = 0x000d
|
||||
};
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_U8_DEFAULT_VALUE 0
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_S16_DEFAULT_VALUE 0
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_24BIT_DEFAULT_VALUE { 0 }
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_32BITMAP_DEFAULT_VALUE 0
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_IEEE_DEFAULT_VALUE { 0 }
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_DEFAULT_VALUE { 0 }
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_UTC_TIME_DEFAULT_VALUE 0
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_BYTE_ARRAY_DEFAULT_VALUE { 0 }
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_BOOL_DEFAULT_VALUE ZB_FALSE
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_128_BIT_KEY_DEFAULT_VALUE { 0 }
|
||||
|
||||
/** @brief Default value for Custom cluster revision global attribute */
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*! @brief Max size of char string attribute (with length byte) */
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_MAX_SIZE 11
|
||||
|
||||
/*! @brief Max size of byte array attribute (with length bytes) */
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_ATTR_BYTE_ARRAY_MAX_SIZE 66
|
||||
|
||||
/*! @} */ /* Custom Attributes cluster attributes */
|
||||
|
||||
/*! @name Custom Attributes commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Custom cluster commands identifiers */
|
||||
enum zb_zcl_custom_cluster_cmd_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD1_ID = 0x21,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_ID = 0x22,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD3_ID = 0x23
|
||||
};
|
||||
|
||||
/*! @brief Custom cluster responses identifiers */
|
||||
enum zb_zcl_custom_cluster_resp_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD1_RESP_ID = 0xF1,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_RESP_ID = 0xF2
|
||||
};
|
||||
|
||||
/******** Custom cluster command 1 ********/
|
||||
|
||||
enum zb_zcl_custom_cluster_cmd1_mode_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD1_MODE1 = 0x01,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD1_MODE2 = 0x02
|
||||
};
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_custom_cluster_cmd1_req_s
|
||||
{
|
||||
zb_uint8_t mode;
|
||||
zb_uint8_t value;
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_custom_cluster_cmd1_req_t;
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_GET_CMD1_REQ(buf, req, parse_status) \
|
||||
{ \
|
||||
zb_zcl_custom_cluster_cmd1_req_t *req_ptr = \
|
||||
zb_buf_len(buf) >= sizeof(zb_zcl_custom_cluster_cmd1_req_t) ? \
|
||||
(zb_zcl_custom_cluster_cmd1_req_t*)zb_buf_begin(buf) : NULL; \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
if (req_ptr) \
|
||||
{ \
|
||||
ZB_MEMCPY(&(req), req_ptr, sizeof(zb_zcl_custom_cluster_cmd1_req_t)); \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Custom cluster command 1
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param mode - mode value (@see zb_zcl_custom_cluster_cmd1_mode_t)
|
||||
@param value - some value
|
||||
*/
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_SEND_CMD1_REQ( \
|
||||
buffer, dst_addr, dst_addr_mode, dst_ep, \
|
||||
src_ep, def_resp, cb, mode, value) \
|
||||
{ \
|
||||
zb_uint8_t *ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CUSTOM_CLUSTER_CMD1_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (mode)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (value)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(buffer), (dst_addr), (dst_addr_mode), (dst_ep), (src_ep), \
|
||||
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_CUSTOM, (cb)); \
|
||||
}
|
||||
|
||||
/******** Custom cluster Response to command 1 ********/
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_custom_cluster_cmd1_resp_s
|
||||
{
|
||||
zb_uint8_t status;
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_custom_cluster_cmd1_resp_t;
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_GET_CMD1_RESP(buf, resp, parse_status) \
|
||||
{ \
|
||||
zb_zcl_custom_cluster_cmd1_resp_t *resp_ptr = \
|
||||
zb_buf_len(buf) >= sizeof(zb_zcl_custom_cluster_cmd1_resp_t) ? \
|
||||
(zb_zcl_custom_cluster_cmd1_resp_t*)zb_buf_begin(buf) : NULL; \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
if (resp_ptr) \
|
||||
{ \
|
||||
ZB_MEMCPY(&(resp), resp_ptr, sizeof(zb_zcl_custom_cluster_cmd1_resp_t)); \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Custom cluster response to command 1
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param status - status value
|
||||
*/
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_SEND_CMD1_RESP( \
|
||||
buffer, seq, dst_addr, dst_addr_mode, \
|
||||
dst_ep, src_ep, cb, status) \
|
||||
{ \
|
||||
zb_uint8_t *cmd_ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(cmd_ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER( \
|
||||
cmd_ptr, (seq), ZB_ZCL_CUSTOM_CLUSTER_CMD1_RESP_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(cmd_ptr, (status)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), cmd_ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(buffer), (dst_addr), (dst_addr_mode), (dst_ep), (src_ep), \
|
||||
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_CUSTOM, (cb)); \
|
||||
}
|
||||
|
||||
/******** Custom cluster command 2 ********/
|
||||
|
||||
enum zb_zcl_custom_cluster_cmd2_param_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_PARAM1 = 0x01,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_PARAM2 = 0x02,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_PARAM3 = 0x03,
|
||||
ZB_ZCL_CUSTOM_CLUSTER_CMD2_PARAM4 = 0x04
|
||||
};
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_custom_cluster_cmd2_req_s
|
||||
{
|
||||
zb_uint8_t param;
|
||||
zb_uint16_t value;
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_custom_cluster_cmd2_req_t;
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_GET_CMD2_REQ(buf, req, parse_status) \
|
||||
{ \
|
||||
zb_zcl_custom_cluster_cmd2_req_t *req_ptr = \
|
||||
zb_buf_len(buf) >= sizeof(zb_zcl_custom_cluster_cmd2_req_t) ? \
|
||||
(zb_zcl_custom_cluster_cmd2_req_t*)zb_buf_begin(buf) : NULL; \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
if (req_ptr) \
|
||||
{ \
|
||||
ZB_MEMCPY(&(req), req_ptr, sizeof(zb_zcl_custom_cluster_cmd2_req_t)); \
|
||||
if (req_ptr->value < 0xFFFF) \
|
||||
{ \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Custom cluster command 2
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param param - some parameter
|
||||
@param value - some value
|
||||
*/
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_SEND_CMD2_REQ( \
|
||||
buffer, dst_addr, dst_addr_mode, dst_ep, \
|
||||
src_ep, def_resp, cb, param, value) \
|
||||
{ \
|
||||
zb_uint8_t *ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CUSTOM_CLUSTER_CMD2_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (param)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (value)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(buffer), (dst_addr), (dst_addr_mode), (dst_ep), (src_ep), \
|
||||
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_CUSTOM, (cb)); \
|
||||
}
|
||||
|
||||
/******** Custom cluster Response to command 2 ********/
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_custom_cluster_cmd2_resp_s
|
||||
{
|
||||
zb_uint8_t status;
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_custom_cluster_cmd2_resp_t;
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_GET_CMD2_RESP(buf, resp, status) \
|
||||
{ \
|
||||
zb_zcl_custom_cluster_cmd2_resp_t *resp_ptr = \
|
||||
zb_buf_len(buf) >= sizeof(zb_zcl_custom_cluster_cmd2_resp_t) ? \
|
||||
(zb_zcl_custom_cluster_cmd2_resp_t*)zb_buf_begin(buf) : NULL; \
|
||||
status = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
if (resp_ptr) \
|
||||
{ \
|
||||
ZB_MEMCPY(&(resp), resp_ptr, sizeof(zb_zcl_custom_cluster_cmd2_resp_t)); \
|
||||
status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Custom cluster response to command 2
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param status - status value
|
||||
*/
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_SEND_CMD2_RESP( \
|
||||
buffer, seq, dst_addr, dst_addr_mode, \
|
||||
dst_ep, src_ep, cb, status) \
|
||||
{ \
|
||||
zb_uint8_t *cmd_ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(cmd_ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER( \
|
||||
cmd_ptr, seq, ZB_ZCL_CUSTOM_CLUSTER_CMD2_RESP_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(cmd_ptr, (status)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), cmd_ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(buffer), (dst_addr), (dst_addr_mode), (dst_ep), (src_ep), \
|
||||
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_CUSTOM, (cb)); \
|
||||
}
|
||||
|
||||
/******** Custom cluster command 3 ********/
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_custom_cluster_cmd3_req_s
|
||||
{
|
||||
zb_char_t zcl_str[ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_MAX_SIZE];
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_custom_cluster_cmd3_req_t;
|
||||
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_GET_CMD3_REQ(buf, req, parse_status) \
|
||||
{ \
|
||||
zb_uint8_t zcl_str_len = *((zb_uint8_t*)zb_buf_begin(buf)); \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
if (((zb_uint_t)(zcl_str_len + 1)) == zb_buf_len(buf)) \
|
||||
{ \
|
||||
ZB_MEMCPY(&(req), zb_buf_begin(buf), zcl_str_len + 1); \
|
||||
parse_status = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Send Custom cluster command 3
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param zcl_str_ptr - pointer to ZCL string
|
||||
*/
|
||||
#define ZB_ZCL_CUSTOM_CLUSTER_SEND_CMD3_REQ( \
|
||||
buffer, dst_addr, dst_addr_mode, dst_ep, \
|
||||
src_ep, def_resp, cb, zcl_str_ptr) \
|
||||
{ \
|
||||
zb_uint8_t *ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CUSTOM_CLUSTER_CMD3_ID); \
|
||||
ZB_ZCL_PACKET_PUT_STRING(ptr, (zcl_str_ptr)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(buffer), (dst_addr), (dst_addr_mode), (dst_ep), (src_ep), \
|
||||
ZB_AF_HA_PROFILE_ID, ZB_ZCL_CLUSTER_ID_CUSTOM, (cb)); \
|
||||
}
|
||||
|
||||
/*! @} */ /* Custom Attributes commands */
|
||||
|
||||
/*! @internal @name Custom Attributes internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_U8_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_U8_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_S16_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_S16_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_WRITE_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_24BIT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_24BIT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_24BIT, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_32BITMAP_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_32BITMAP_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_IEEE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_IEEE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_IEEE_ADDR, \
|
||||
ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL | ZB_ZCL_ATTR_ACCESS_WRITE_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_UTC_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_UTC_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_UTC_TIME, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_OCTET_STRING_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_OCTET_STRING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_OCTET_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_WRITE_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_BOOL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_BOOL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE | ZB_ZCL_ATTR_ACCESS_SCENE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_128_BIT_KEY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_128_BIT_KEY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_128_BIT_KEY, \
|
||||
ZB_ZCL_ATTR_MANUF_SPEC, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_CUSTOM_CLUSTER_ATTR_LONG_OCTET_STRING_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_CUSTOM_CLUSTER_ATTR_LONG_OCTET_STRING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_LONG_OCTET_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @internal @brief Declare attribute list for Custom Attributes cluster
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_DECLARE_CUSTOM_ATTR_CLUSTER_ATTRIB_LIST( \
|
||||
attr_list, u8_attr, s16_attr, _24bit_attr, _32bitmap_attr, ieee_attr, \
|
||||
char_string_attr, utc_time_attr, octet_string_attr, bool_attr, _128_bit_key_attr, long_octet_string_attr) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_CUSTOM) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_U8_ID, (u8_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_S16_ID, (s16_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_24BIT_ID, (_24bit_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_32BITMAP_ID, (_32bitmap_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_IEEE_ID, (ieee_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_CHAR_STRING_ID, (char_string_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_UTC_TIME_ID, (utc_time_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_OCTET_STRING_ID, (octet_string_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_BOOL_ID, (bool_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_128_BIT_KEY_ID, (_128_bit_key_attr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_CUSTOM_CLUSTER_ATTR_LONG_OCTET_STRING_ID, (long_octet_string_attr)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Custom Attributes cluster */
|
||||
#define ZB_ZCL_CUSTOM_ATTR_REPORT_ATTR_COUNT 8
|
||||
|
||||
/*! @} */ /* Custom Attributes cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL Custom Attributes cluster definitions */
|
||||
|
||||
/** @endcond */ /* (DOXYGEN_ZCL_SECTION && internals_doc) */
|
||||
|
||||
void zb_zcl_custom_attr_init_server(void);
|
||||
void zb_zcl_custom_attr_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_CUSTOM_SERVER_ROLE_INIT zb_zcl_custom_attr_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_CUSTOM_CLIENT_ROLE_INIT zb_zcl_custom_attr_init_client
|
||||
|
||||
#endif /* ZB_ZCL_CUSTOM_ATTR_H */
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZCL Continuous Value Change feature commands declarations
|
||||
*/
|
||||
|
||||
#ifndef ZCL_CVC_COMMANDS_H
|
||||
#define ZCL_CVC_COMMANDS_H 1
|
||||
|
||||
#if defined ZB_CVC_FEATURE_SUPPORT
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/* Documentation - doc/HA/continuous_value_change-detailed_design.doc */
|
||||
|
||||
/* Internal variables,
|
||||
see 1.7.4 */
|
||||
|
||||
/** @brief CVC Transition Time As Fast As Able */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_AS_FAST_AS_ABLE 0xffff
|
||||
/** @brief CVC Transition Time minimal */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_MINIMAL 0x0001
|
||||
/** @brief CVC Transition Time error */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_ERROR 20
|
||||
/** @brief CVC Transition Time Unit (in msec) */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_UNIT_MS 100
|
||||
/** @brief CVC Transition Time Unit (in beacon intervals) */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_UNIT_BE ZB_TIME_ONE_SECOND / 10
|
||||
/** @brief CVC Invalid Remaining Time */
|
||||
#define ZB_ZCL_CVC_INVALID_REMAINING_TIME 0xffff
|
||||
/** @brief CVC Invalid Alarm Id */
|
||||
#define ZB_ZCL_CVC_INVALID_ALARM_ID (zb_uint8_t)-1
|
||||
/** @brief CVC Transition Timer Quant (in msec) */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIMER_QUANT_MS 100
|
||||
/** @brief CVC Transition Timer Quant */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIMER_QUANT_BE \
|
||||
ZB_MILLISECONDS_TO_SYS_TIMER_INTERVAL(ZB_ZCL_CVC_TRANSITION_TIMER_QUANT_MS)
|
||||
/** @brief CVC Transition Time Unit */
|
||||
#define ZB_ZCL_CVC_TRANSITION_TIME_UNIT_IN_QUANTS \
|
||||
(ZB_ZCL_CVC_TRANSITION_TIME_UNIT_MS / ZB_ZCL_CVC_TRANSITION_TIMER_QUANT_MS)
|
||||
|
||||
#define ZB_ZCL_UNDEFINED_CVC_SLOT 0xff
|
||||
#define ZB_ZCL_MAX_CVC_SLOTS_BY_EP (ZB_ZCL_UNDEFINED_CVC_SLOT / ZB_ZCL_MAX_EP_NUMBER)
|
||||
|
||||
/** @brief Value set function that will be used for setting value on device */
|
||||
typedef zb_ret_t (ZB_CODE * zb_zcl_cvc_value_set_func_t)(zb_uint8_t endpoint, zb_uint16_t* new_value, zb_uint16_t remaining_time);
|
||||
|
||||
|
||||
/** @internal Structure of Input variables
|
||||
*/
|
||||
typedef struct zb_zcl_cvc_input_variables_s
|
||||
{
|
||||
/** @brief Current Value */
|
||||
zb_uint16_t current_value16;
|
||||
/** @brief End Value */
|
||||
zb_uint16_t end_value16;
|
||||
/** @brief Min Value */
|
||||
zb_uint16_t min_value16;
|
||||
/** @brief Max Value */
|
||||
zb_uint16_t max_value16;
|
||||
/** @brief Overlapping flag */
|
||||
zb_uint8_t overlap;
|
||||
/** @brief Transition Time */
|
||||
zb_uint16_t transition_time;
|
||||
/** @brief Value set function */
|
||||
zb_zcl_cvc_value_set_func_t value_set_func;
|
||||
/** @brief Buffer id for after_processing_cb */
|
||||
zb_uint8_t buf_id;
|
||||
/** @brief After Processing callback */
|
||||
zb_callback_t after_processing_cb;
|
||||
} zb_zcl_cvc_input_variables_t;
|
||||
|
||||
/** @internal Structure of Continuous Value Change variables
|
||||
*/
|
||||
typedef struct zb_zcl_cvc_variables_s
|
||||
{
|
||||
/** @brief Input variables */
|
||||
zb_zcl_cvc_input_variables_t input_var;
|
||||
/** @brief Time to next scheduled operation (delta time) */
|
||||
zb_uint16_t delta_time;
|
||||
/** @brief Transition Time in Transition Timer Quants*/
|
||||
zb_uint32_t transition_time_quant;
|
||||
/** @brief Delta value for one step */
|
||||
zb_int16_t delta_value16;
|
||||
/** @brief Number of remaining steps for transition */
|
||||
zb_uint16_t steps_number;
|
||||
/** @brief Step number for extra increment delta value */
|
||||
zb_uint16_t extra_inc_value_step;
|
||||
/** @brief Step number for extra increment delta time */
|
||||
zb_uint16_t extra_inc_time_step;
|
||||
/** @brief End time of transition */
|
||||
zb_time_t end_time;
|
||||
/** @brief Available time error */
|
||||
zb_uint16_t time_err;
|
||||
} zb_zcl_cvc_variables_t;
|
||||
|
||||
/** @internal Structure of Alarm variables
|
||||
*/
|
||||
typedef struct zb_zcl_cvc_alarm_variables_s
|
||||
{
|
||||
/** @brief Endpoint id */
|
||||
zb_uint8_t endpoint_id;
|
||||
/** @brief Cluster id */
|
||||
zb_uint16_t cluster_id;
|
||||
/** @brief Attribute id */
|
||||
zb_uint16_t attribute_id;
|
||||
/** @brief Alarm buffer id */
|
||||
zb_uint8_t alarm_buf_id;
|
||||
/** @brief Is Used flag */
|
||||
zb_bool_t is_used;
|
||||
} ZB_PACKED_STRUCT
|
||||
zb_zcl_cvc_alarm_variables_t;
|
||||
|
||||
/*!
|
||||
@brief Calculate transition values and put it into buffer.
|
||||
@param input_var - pointer to zb_zcl_cvc_input_variables_s containing input data
|
||||
@return buffer ID with zb_zcl_cvc_variables_s
|
||||
*/
|
||||
zb_uint8_t zb_zcl_cvc_calculate_transition_values(zb_zcl_cvc_input_variables_t* input_var);
|
||||
|
||||
|
||||
/*!
|
||||
@brief Initialize and start transition.
|
||||
@param endpoint_id - ep id
|
||||
@param cluster_id - cluster id
|
||||
@param attribute_id - attribute id (from cluster)
|
||||
@param alarm_buf_id - buffer_id with zb_zcl_cvc_variables_s
|
||||
@return alarm ID
|
||||
*/
|
||||
zb_uint8_t zb_zcl_cvc_start_alarm(zb_uint8_t endpoint_id,
|
||||
zb_uint16_t cluster_id,
|
||||
zb_uint16_t attribute_id,
|
||||
zb_uint8_t alarm_buf_id);
|
||||
|
||||
|
||||
/*!
|
||||
@brief Initialize and start transition.
|
||||
@param alarm_id - alarm id
|
||||
@return old transition's buffer (input_var.buf_id)
|
||||
*/
|
||||
zb_uint8_t zb_zcl_cvc_stop_transition(zb_uint8_t alarm_id);
|
||||
|
||||
|
||||
/*!
|
||||
@brief Check transition running.
|
||||
@param endpoint_id - ep id
|
||||
@param cluster_id - cluster id
|
||||
@param attribute_id - attribute id (from cluster)
|
||||
@return alarm ID (ZB_ZCL_CVC_INVALID_ALARM_ID if it is not running)
|
||||
*/
|
||||
zb_uint8_t zb_zcl_cvc_check_transition_running(
|
||||
zb_uint8_t endpoint_id,
|
||||
zb_uint16_t cluster_id,
|
||||
zb_uint16_t attribute_id);
|
||||
|
||||
|
||||
/*! @brief Initialize alarm list (stored in device context). */
|
||||
void zb_zcl_init_cvc_alarm_info(void);
|
||||
|
||||
|
||||
/*!
|
||||
@brief Get remaining time of transition.
|
||||
@param alarm_id - alarm id
|
||||
@return remaining time
|
||||
*/
|
||||
zb_uint16_t zb_zcl_cvc_get_remaining_time(zb_uint8_t alarm_id);
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#endif /* ZB_CVC_FEATURE_SUPPORT */
|
||||
|
||||
#endif /* ZCL_LEVEL_CVC_COMMANDS_H */
|
||||
@@ -0,0 +1,758 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Daily Schedule cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_DAILY_SCHEDULE_H_
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_H_
|
||||
/******************************************************************************/
|
||||
/******************************************************************************/
|
||||
#include "zboss_api_core.h"
|
||||
#include "zboss_api_aps.h"
|
||||
#include "zb_zcl_common.h"
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_DAILY_SCHEDULE_CLUSTER) */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DAILY_SCHEDULE
|
||||
* @{
|
||||
* @details
|
||||
* The Daily Schedule cluster allows information that can be scheduled for an entire day
|
||||
* to be transferred within the premises. The information is distributed by an ESI
|
||||
* or similar server device.
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE */
|
||||
|
||||
/** @defgroup ZB_ZCL_DAILY_SCHEDULE_ATTRS Daily Schedule cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** The attributes defined in this cluster are arranged into sets of related attributes;
|
||||
* each set can contain up to 256 attributes. Attribute identifiers are encoded
|
||||
* such that the most significant Octet specifies the attribute set and the least
|
||||
* significant Octet specifies the attribute within the set.
|
||||
* @see Zigbee-17-05035-004 Table D-3
|
||||
*/
|
||||
typedef enum zb_zcl_daily_schedule_srv_attr_sets_e
|
||||
{
|
||||
ZB_ZCL_DAILY_SCHEDULE_AUXILIARY_SWITCH_LABEL_SET = 0x00, /**< Auxiliary Switch Label
|
||||
Attribute Set */
|
||||
|
||||
ZB_ZCL_DAILY_SCHEDULE_SCHEDULE_ATTRIBUTES_SET = 0x01, /**< Schedule Attribute Set */
|
||||
|
||||
/* 0x02-0xFF – reserved */
|
||||
} zb_zcl_daily_schedule_srv_attr_sets_t;
|
||||
|
||||
|
||||
/** @see Zigbee-17-05035-004 Table D-4 – Auxiliary Switch Label Attribute Set */
|
||||
typedef enum zb_zcl_daily_schedule_srv_auxiliary_switch_attr_set_e
|
||||
{
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_1_LABEL = 0x0000, /**< The @e AuxSwitchNLabel attributes provide
|
||||
a method for assigning a label to
|
||||
* an Auxiliary Switch.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_2_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_3_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_4_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_5_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_6_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_7_LABEL,
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_AUX_SWITCH_8_LABEL
|
||||
} zb_zcl_daily_schedule_srv_auxiliary_switch_attr_set_t;
|
||||
|
||||
|
||||
/** @see Zigbee-17-05035-004 Table D-5 – Schedule Attribute Set */
|
||||
typedef enum zb_zcl_daily_schedule_srv_schedule_attr_set_e
|
||||
{
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_CURR_AUX_LOAD_SWITCH_STATE = 0x0100, /**< The @e
|
||||
CurrentAuxiliaryLoadSwitchState
|
||||
attribute */
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_CURR_DELIVERED_TIER = 0x0101, /**< The @e CurrentDeliveredTier
|
||||
attribute */
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_CURR_TIER_LABEL = 0x0102, /**< The @e CurrentTierLabel attribute*/
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_LINKY_PEAK_PERIOD_STATUS = 0x0103, /**< The @e LinkyPeakPeriodStatus
|
||||
attribute */
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_PEAK_START_TIME = 0x0104, /**< The @e PeakStartTime attribute */
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_PEAK_END_TIME = 0x0105, /**< The @e PeakEndTime attribute */
|
||||
/* (O) */
|
||||
ZB_ZCL_ATTR_DAILY_SCHEDULE_CURR_TARIFF_LABEL = 0x0106, /**< The @e CurrentTariffLabel attribute */
|
||||
} zb_zcl_daily_schedule_srv_schedule_attr_set_t;
|
||||
|
||||
|
||||
/** The @e LinkyPeakPeriodStatus attribute subfields */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_attr_linky_peak_period_status_s
|
||||
{
|
||||
zb_bitfield_t on_peak:2;
|
||||
zb_bitfield_t peak_period_prior_notice:2;
|
||||
zb_bitfield_t next_day_color:2;
|
||||
zb_bitfield_t current_day_color:2;
|
||||
} zb_zcl_daily_schedule_attr_linky_peak_period_status_t;
|
||||
|
||||
/** @brief Default value for Daily Schedule cluster revision global attribute (not defined anywhere) */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*!
|
||||
@brief Declare attribute list for Daily Schedule cluster (only cluster revision attribute)
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DAILY_SCHEDULE_ATTR_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DAILY_SCHEDULE) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/* Constants for Current Day Color and Next Day Color subfields */
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_COLOR_UNUSED 0b00
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_COLOR_LOW_BLUE 0b01
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_COLOR_MEDIUM_WHITE 0b10
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_COLOR_HIGH_RED 0b11
|
||||
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_PRIOR_NOTICE_NONE 0b00
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_PRIOR_NOTICE_PP1 0b01
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_PRIOR_NOTICE_PP2 0b10
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_PRIOR_NOTICE_PP3 0b11
|
||||
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_ON_PEAK_NONE 0b00
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_ON_PEAK_PERIOD_1 0b01
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_ON_PEAK_PERIOD_2 0b10
|
||||
#define ZB_ZCL_ATTR_LINKY_PEAK_PERIOD_STATUS_ON_PEAK_PERIOD_3 0b11
|
||||
|
||||
/** @} */ /* ZB_ZCL_DAILY_SCHEDULE_ATTRS */
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_DAILY_SCHEDULE_COMMANDS Daily Schedule cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Daily Schedule cluster client command identifiers.
|
||||
* @see Zigbee-17-05035-004 Table D-14 Commands Received by the Daily Schedule Cluster Server
|
||||
*/
|
||||
typedef enum zb_zcl_daily_schedule_cli_cmd_e
|
||||
{
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE = 0x00, /**< This command initiates
|
||||
PublishSchedule command(s) for
|
||||
specified Schedule updates. */
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE = 0x01, /**< This command initiates one or more
|
||||
PublishDayProfile commands for the
|
||||
referenced Schedule. */
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE_CANCELLATION = 0x05, /**< This command initiates
|
||||
the return of the last
|
||||
CancelSchedule command held
|
||||
on the associated server. */
|
||||
} zb_zcl_daily_schedule_cli_cmd_t;
|
||||
|
||||
|
||||
/** @see Zigbee-17-05035-004 Table D-3 Daily Schedule Cluster Attribute Sets */
|
||||
typedef enum zb_zcl_daily_schedule_srv_cmd_e
|
||||
{
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE = 0x00, /**< The PublishSchedule command is
|
||||
published in response to a GetSchedule
|
||||
command or if new schedule information
|
||||
is available. */
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE = 0x01, /**< The PublishDayProfile command is
|
||||
published in response to
|
||||
a GetDayProfile command. */
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE = 0x05, /**< The CancelSchedule command indicates
|
||||
that all data associated with
|
||||
a particular schedule instance
|
||||
should be discarded. */
|
||||
/* (O) */
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_ALL_SCHEDULES = 0x06, /**< The CancelAllSchedules command indicates
|
||||
that all data associated with
|
||||
all schedules should be discarded. */
|
||||
} zb_zcl_daily_schedule_srv_cmd_t;
|
||||
|
||||
/* Daily schedule cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE, \
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE, \
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE, \
|
||||
ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_ALL_SCHEDULES
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE, \
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE, \
|
||||
ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE_CANCELLATION
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
|
||||
/** Schedule type enumeration.
|
||||
* @see Zigbee-17-05035-004 Table D-12 Schedule Type Enumeration
|
||||
*/
|
||||
typedef enum zb_zcl_daily_schedule_type_e
|
||||
{
|
||||
ZB_ZCL_DAILY_SCHEDULE_TYPE_LINKY_SCHEDULE = 0x00, /**< Linky Schedule */
|
||||
/* reserved 0x01 - 0xFF */
|
||||
} zb_zcl_daily_schedule_type_t;
|
||||
|
||||
|
||||
/** Check if schedule type is valid
|
||||
* @param _t - @ref zb_zcl_daily_schedule_get_schedule_payload_t::schedule_type field
|
||||
* @see @ref zb_zcl_daily_schedule_get_schedule_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_TYPE_IS_VALID(_t) \
|
||||
(_t <= ZB_ZCL_DAILY_SCHEDULE_TYPE_LINKY_SCHEDULE)
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE "GetSchedule" command payload
|
||||
* @see Zigbee-17-05035-004, D.9.2.4.1.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_get_schedule_payload_s
|
||||
{
|
||||
/** An unsigned 32-bit field containing a unique identifier for the commodity provider.
|
||||
* This field allows differentiation in deregulated markets where multiple commodity
|
||||
* providers may be available.
|
||||
*/
|
||||
zb_uint32_t provider_id;
|
||||
|
||||
/** UTC Timestamp indicating the earliest start time of schedules to be
|
||||
* returned by the corresponding PublishSchedule command.
|
||||
*/
|
||||
zb_uint32_t earliest_start_time;
|
||||
|
||||
/** A 32-bit integer representing the minimum Issuer Event ID of schedules
|
||||
* to be returned by the corresponding PublishSchedule command
|
||||
*/
|
||||
zb_uint32_t min_issuer_event_id;
|
||||
|
||||
/** An 8-bit integer which represents the maximum number of PublishSchedule commands
|
||||
* that the client is willing to receive in response to this command.
|
||||
*/
|
||||
zb_uint8_t number_of_schedules;
|
||||
|
||||
/** An 8-bit enumeration identifying the type of the requested schedule.
|
||||
* @see zb_zcl_daily_schedule_type_t
|
||||
*/
|
||||
zb_uint8_t schedule_type;
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_get_schedule_payload_t;
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE "GetSchedule" command payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_GET_SCHEDULE_PL_INIT \
|
||||
(zb_zcl_daily_schedule_get_schedule_payload_t) {0}
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE "GetDayProfile" command payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_GET_DAY_PROFILE_PL_INIT \
|
||||
(zb_zcl_daily_schedule_get_day_profile_payload_t) {0}
|
||||
|
||||
|
||||
/** Check if @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE "GetSchedule" command payload size is valid
|
||||
* @param size - size of received data payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_GET_SCHEDULE_PL_SIZE_IS_VALID(size) \
|
||||
((size >= sizeof(zb_zcl_daily_schedule_get_schedule_payload_t) ? ZB_TRUE : ZB_FALSE))
|
||||
|
||||
|
||||
/** Check if @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE "GetDayProfile" command payload size is valid
|
||||
* @param size - size of received data payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_GET_DAY_PROFILE_PL_SIZE_IS_VALID(size) \
|
||||
((size >= sizeof(zb_zcl_daily_schedule_get_day_profile_payload_t) ? ZB_TRUE : ZB_FALSE))
|
||||
|
||||
|
||||
/** This enumeration presents possible values of Schedule Time Reference field
|
||||
* @see Zigbee-17-05035-004, Table D-13 – Schedule Time Reference Enumeration
|
||||
*/
|
||||
typedef enum zb_zcl_daily_schedule_time_reference_e
|
||||
{
|
||||
ZB_ZCL_DAILY_SCHEDULE_TIME_REFERENCE_UTC_TIME = 0x00, /**< UTC time */
|
||||
ZB_ZCL_DAILY_SCHEDULE_TIME_REFERENCE_STANDARD_TIME, /**< Standard time */
|
||||
ZB_ZCL_DAILY_SCHEDULE_TIME_REFERENCE_LOCAL_TIME /**< Local time */
|
||||
/* 0x03 - 0xFF is reserved */
|
||||
} zb_zcl_daily_schedule_time_reference_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE "PublishSchedule" command
|
||||
* @see Zigbee-17-05035-004, subclause D.9.2.3.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_publish_schedule_payload_s
|
||||
{
|
||||
|
||||
/** An unsigned 32-bit field containing a unique identifier for the commodity
|
||||
* provider.
|
||||
*/
|
||||
zb_uint32_t provider_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity provider. When new information
|
||||
* is provided that replaces older information for the same time period, this
|
||||
* field allows devices to determine which information is newer.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity Supplier to identify a particular schedule.
|
||||
*/
|
||||
zb_uint32_t schedule_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity supplier.
|
||||
*/
|
||||
zb_uint16_t day_id; /* (M) */
|
||||
|
||||
/** A UTC Time field to denote the time at which the published schedule becomes
|
||||
* valid. A start date/time of 0x00000000 shall indicate that the command
|
||||
* should be executed immediately.
|
||||
*/
|
||||
zb_uint32_t start_time; /* (M) */
|
||||
|
||||
/** An 8-bit enumeration identifying the type of schedule published in this
|
||||
* command.
|
||||
* @see zb_zcl_daily_schedule_type_t
|
||||
*/
|
||||
zb_uint8_t schedule_type; /* (M) */
|
||||
|
||||
/** This field indicates how the Start Times contained in the schedule are to be interpreted.
|
||||
* @see zb_zcl_daily_schedule_time_reference_t
|
||||
*/
|
||||
zb_uint8_t schedule_time_reference; /* (M) */
|
||||
|
||||
/** The ScheduleName provides a method for utilities to assign a name to a schedule.
|
||||
*/
|
||||
zb_uint8_t schedule_name[1 + 12]; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_publish_schedule_payload_t;
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE "PublishSchedule" command payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PUBLISH_SCHEDULE_PL_INIT \
|
||||
(zb_zcl_daily_schedule_publish_schedule_payload_t) {0}
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE "PublishDayProfile" command payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PUBLISH_DAY_PROFILE_PL_INIT \
|
||||
(zb_zcl_daily_schedule_publish_day_profile_payload_t) {0}
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE "CancelSchedule" command payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_CANCEL_SCHEDULE_PL_INIT \
|
||||
(zb_zcl_daily_schedule_cancel_schedule_payload_t) {0}
|
||||
|
||||
|
||||
/** Compute expected size of received @ref zb_zcl_daily_schedule_publish_schedule_payload_t
|
||||
* data payload
|
||||
* @param pl - pointer to @ref zb_zcl_daily_schedule_publish_schedule_payload_t payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PUBLISH_SCHEDULE_PL_EXPECTED_SIZE(pl) \
|
||||
(sizeof(zb_zcl_daily_schedule_publish_schedule_payload_t)-sizeof((pl)->schedule_name)+1+ZB_ZCL_GET_STRING_LENGTH((pl)->schedule_name))
|
||||
|
||||
|
||||
/** Check if @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE "PublishSchedule" command payload size is valid
|
||||
* @param pl - pointer to @ref zb_zcl_daily_schedule_publish_schedule_payload_t payload (pointer
|
||||
* to buffer beginning that contains @ref zb_zcl_daily_schedule_publish_schedule_payload_t data payload)
|
||||
* @param size - size of received data payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PUBLISH_SCHEDULE_PL_SIZE_IS_VALID(pl, size) \
|
||||
((size >= ZB_ZCL_DAILY_SCHEDULE_PUBLISH_SCHEDULE_PL_EXPECTED_SIZE((zb_zcl_daily_schedule_publish_schedule_payload_t *)pl)) ? ZB_TRUE : ZB_FALSE)
|
||||
|
||||
|
||||
/** Check if @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE "PublishDayProfile" command payload size is valid
|
||||
* @param size - size of received data payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PUBLISH_DAY_PROFILE_PL_SIZE_IS_VALID(size) \
|
||||
((size >= (sizeof(zb_zcl_daily_schedule_publish_day_profile_payload_t)-sizeof(void *)-sizeof(zb_uint8_t)) ? ZB_TRUE : ZB_FALSE))
|
||||
|
||||
|
||||
/** Check if @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE "CancelSchedule" command payload size is valid
|
||||
* @param size - size of received data payload
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_CANCEL_SCHEDULE_PL_SIZE_IS_VALID(size) \
|
||||
((size >= sizeof(zb_zcl_daily_schedule_cancel_schedule_payload_t) ? ZB_TRUE : ZB_FALSE))
|
||||
|
||||
|
||||
/** Linky Schedules Command Sub-Payload structure
|
||||
* See Zigbee-17-05035-004, D.9.2.3.2.3.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_linky_schedule_entry_s
|
||||
{
|
||||
/** The Start Time is represented in minutes from midnight.
|
||||
*/
|
||||
zb_uint16_t start_time; /* (M) */
|
||||
|
||||
/** This is the current price tier that is valid until
|
||||
* the start time of the next Schedule Entry.
|
||||
*/
|
||||
zb_uint8_t price_tier; /* (M) */
|
||||
|
||||
/** The required status of the auxiliary switches is indicated by the state of the bits.
|
||||
* Bit0 correspond to Auxiliary Switch 1 and bit7 corresponds to Auxiliary Switch 8.
|
||||
*/
|
||||
zb_uint8_t auxiliary_load_switch_state; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_linky_schedule_entry_t;
|
||||
|
||||
|
||||
/** The format of schedule entry is dependent on schedule type.
|
||||
*/
|
||||
typedef ZB_PACKED_PRE union zb_zcl_daily_schedule_entry_u
|
||||
{
|
||||
zb_zcl_daily_schedule_linky_schedule_entry_t linky_schedule_entry;
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_entry_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE "PublishDayProfile" command payload.
|
||||
* @see Zigbee-17-05035-004, subclause D.9.2.3.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_publish_day_profile_payload_s
|
||||
{
|
||||
/** An unsigned 32-bit field containing a unique identifier for the commodity
|
||||
* provider.
|
||||
*/
|
||||
zb_uint32_t provider_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity provider. When new information
|
||||
* is provided that replaces older information for the same time period, this
|
||||
* field allows devices to determine which information is newer.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity supplier. The Day ID is used as a reference to assign a Day Profile to a Daily Schedule
|
||||
*/
|
||||
zb_uint16_t day_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity Supplier to identify a particular schedule.
|
||||
*/
|
||||
zb_uint32_t schedule_id; /* (M) */
|
||||
|
||||
/** An 8-bit integer representing the total number of ScheduleEntries in this Day Profile.
|
||||
*/
|
||||
zb_uint8_t total_number_of_schedule_entries; /* (M) */
|
||||
|
||||
/** The CommandIndex is used to count the payload fragments in the case where the entire payload
|
||||
* does not fit into one message. The CommandIndex starts at 0 and is incremented for each fragment
|
||||
* belonging to the same command
|
||||
*/
|
||||
zb_uint8_t command_index; /* (M) */
|
||||
|
||||
/** In the case where the entire payload does not fit into one message, the
|
||||
* Total Number of Commands field indicates the total number of sub-commands
|
||||
* in the message.
|
||||
*/
|
||||
zb_uint8_t total_number_of_commands; /* (M) */
|
||||
|
||||
/** An 8-bit enumeration identifying the type of schedule published in this
|
||||
* command.
|
||||
* @see zb_zcl_daily_schedule_type_t
|
||||
*/
|
||||
zb_uint8_t schedule_type; /* (M) */
|
||||
|
||||
/**
|
||||
* day_schedule_entries pointer is considered as a beginning of array (of day schedule entries),
|
||||
* number_of_entries_in_this_command - as a number of entries. Please also take into account
|
||||
* overall ZCL payload size.
|
||||
* @see zb_zcl_daily_schedule_entry_t
|
||||
*/
|
||||
zb_zcl_daily_schedule_entry_t *day_schedule_entries; /* (M) */
|
||||
|
||||
/** An 8-bit integer representing the number of Day Schedule entries in
|
||||
* this command
|
||||
*/
|
||||
zb_uint8_t number_of_entries_in_this_command; /* (ZBOSS) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_publish_day_profile_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE "CancelSchedule" command payload.
|
||||
* @see Zigbee-17-05035-004, D.9.2.3.3
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_cancel_schedule_payload_s
|
||||
{
|
||||
/** An unsigned 32-bit field containing a unique identifier for the commodity
|
||||
* provider.
|
||||
*/
|
||||
zb_uint32_t provider_id; /* (M) */
|
||||
|
||||
/** Unique identifier generated by the commodity Supplier to identify a particular schedule.
|
||||
*/
|
||||
zb_uint32_t schedule_id; /* (M) */
|
||||
|
||||
/** An 8-bit enumeration identifying the type of schedule published in this
|
||||
* command.
|
||||
* @see zb_zcl_daily_schedule_type_t
|
||||
*/
|
||||
zb_uint8_t schedule_type; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_cancel_schedule_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE "GetDayProfile" command payload
|
||||
* @see Zigbee-17-05035-004, D.9.2.4.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_daily_schedule_get_day_profile_payload_s
|
||||
{
|
||||
/** An unsigned 32-bit field containing a unique identifier for the commodity
|
||||
* provider.
|
||||
*/
|
||||
zb_uint32_t provider_id; /* (M) */
|
||||
|
||||
/**
|
||||
* ScheduleID of the schedule to which the requested Day Profile belongs.
|
||||
*/
|
||||
zb_uint16_t day_id;
|
||||
} ZB_PACKED_STRUCT zb_zcl_daily_schedule_get_day_profile_payload_t;
|
||||
|
||||
|
||||
/** Function for sending @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_SCHEDULE "PublishSchedule" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param pl - Packet payload (ref to @ref zb_zcl_daily_schedule_publish_schedule_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_publish_schedule(zb_uint8_t param, const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
const zb_zcl_daily_schedule_publish_schedule_payload_t *pl,
|
||||
zb_callback_t cb);
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_PUBLISH_DAY_PROFILE "PublishDayProfile" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param pl - Packet payload (ref to @ref zb_zcl_daily_schedule_publish_day_profile_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_publish_day_profile(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
const zb_zcl_daily_schedule_publish_day_profile_payload_t *pl,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
|
||||
/** Function for sending @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE "GetSchedule" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param pl - Packet payload (ref to @ref zb_zcl_daily_schedule_get_schedule_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_get_schedule(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
const zb_zcl_daily_schedule_get_schedule_payload_t *pl,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
|
||||
/** Function for sending @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_DAY_PROFILE "GetDayProfile" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param pl - Packet payload (ref to @ref zb_zcl_daily_schedule_get_day_profile_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_get_day_profile(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
const zb_zcl_daily_schedule_get_day_profile_payload_t *pl,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DAILY_SCHEDULE_CLI_CMD_GET_SCHEDULE_CANCELLATION
|
||||
* "GetScheduleCancellation" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_get_schedule_cancellation(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_SCHEDULE "CancelSchedule" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param pl - Packet payload (ref to @ref zb_zcl_daily_schedule_cancel_schedule_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_cancel_schedule(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
const zb_zcl_daily_schedule_cancel_schedule_payload_t *pl,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DAILY_SCHEDULE_SRV_CMD_CANCEL_ALL_SCHEDULES "CancelAllSchedules" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
*/
|
||||
void zb_zcl_daily_schedule_send_cmd_cancel_all_schedules(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep, zb_uint8_t src_ep,
|
||||
zb_callback_t cb
|
||||
);
|
||||
|
||||
/** Macro for calling @ref zb_zcl_daily_schedule_send_cmd_publish_schedule function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_PUBLISH_SCHEDULE(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_daily_schedule_send_cmd_publish_schedule(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
|
||||
/** Macro for calling @ref zb_zcl_daily_schedule_send_cmd_publish_day_profile function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_PUBLISH_DAY_PROFILE(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_daily_schedule_send_cmd_publish_day_profile(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
|
||||
/** Macro for call @ref zb_zcl_daily_schedule_send_cmd_cancel_schedule function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_CANCEL_SCHEDULE(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_daily_schedule_send_cmd_cancel_schedule(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_zcl_daily_schedule_send_cmd_cancel_all_schedules function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_CANCEL_ALL_SCHEDULES(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep) \
|
||||
zb_zcl_daily_schedule_send_cmd_cancel_all_schedules(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, NULL)
|
||||
|
||||
/** Macro for call @ref zb_zcl_daily_schedule_send_cmd_get_schedule function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_GET_SCHEDULE(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_daily_schedule_send_cmd_get_schedule(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
|
||||
/** Macro for call @ref zb_zcl_daily_schedule_send_cmd_get_day_profile function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_GET_DAY_PROFILE(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_daily_schedule_send_cmd_get_day_profile(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
|
||||
/** Macro for call @ref zb_zcl_daily_schedule_send_cmd_get_schedule_cancellation function
|
||||
*/
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_SEND_CMD_GET_SCHEDULE_CANCELLATION(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep) \
|
||||
zb_zcl_daily_schedule_send_cmd_get_schedule_cancellation(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, NULL)
|
||||
|
||||
/** @} */ /* ZB_ZCL_DAILY_SCHEDULE_COMMANDS */
|
||||
|
||||
/** @brief Default value for CurrentAuxiliaryLoadSwitchState attribute */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_CURRENT_AUXILLARY_LOAD_SWITCH_STATE_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for LinkyPeakPeriodStatus attribute */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_LINKY_PEAK_PERIOD_STATUS_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for PeakStartTime attribute */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PEAK_START_TIME_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for PeakEndTime attribute */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_PEAK_END_TIME_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for CurrentTariffLabel attribute */
|
||||
#define ZB_ZCL_DAILY_SCHEDULE_CURRENT_TARIFF_LABEL_DEFAULT_VALUE {0}
|
||||
/** @} */ /* ZCL Daily Schedule cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Server */
|
||||
/******************************************************************************/
|
||||
/* Client */
|
||||
/******************************************************************************/
|
||||
/* Common */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void zb_zcl_daily_schedule_init_server();
|
||||
void zb_zcl_daily_schedule_init_client();
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_SERVER_ROLE_INIT zb_zcl_daily_schedule_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DAILY_SCHEDULE_CLIENT_ROLE_INIT zb_zcl_daily_schedule_init_client
|
||||
|
||||
/******************************************************************************/
|
||||
#endif /* ZB_ZCL_DAILY_SCHEDULE_H_ */
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Dehumidification Control cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_DEHUMIDIFICATION_CONTROL_H
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DEHUMIDIFICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_DEHUMIDIFICATION_CONTROL */
|
||||
|
||||
/*! @name Dehumidification Control cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Dehumidification Control cluster attribute identifiers
|
||||
@see ZCL spec, subclause 6.4.2.2
|
||||
*/
|
||||
enum zb_zcl_dehumidification_control_attr_e
|
||||
{
|
||||
/** The RelativeHumidity attribute is an 8-bit value that represents the current
|
||||
* relative humidity (in %) measured by a local or remote sensor. */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RELATIVE_HUMIDITY_ID = 0x0000,
|
||||
/** @brief Dehumidification Cooling attribute */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_COOLING_ID = 0x0001,
|
||||
/** @brief RHDehumidification Setpoint attribute */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_ID = 0x0010,
|
||||
/** The RelativeHumidityMode attribute is an 8-bit value that specifies how
|
||||
* the RelativeHumidity value is being updated. */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RELATIVE_HUMIDITY_MODE_ID = 0x0011,
|
||||
/** The DehumidificationLockout attribute is an 8-bit value that specifies
|
||||
* whether dehumidification is allowed or not. */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_LOCKOUT_ID = 0x0012,
|
||||
/** @brief Dehumidification Hysteresis attribute */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_ID = 0x0013,
|
||||
/** @brief Dehumidification Max Cool attribute */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_ID = 0x0014,
|
||||
/** The RelativeHumidityDisplay attribute is an 8-bit value that specifies
|
||||
* whether the RelativeHumidity value is displayed to the user or not. */
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RELATIVE_HUMIDITY_DISPLAY_ID = 0x0015,
|
||||
};
|
||||
|
||||
/** @brief Default value for Dehumidification Control cluster revision global attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Min value for RHDehumidification Setpoint attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_MIN_VALUE 0x1e
|
||||
|
||||
/** @brief Max value for RHDehumidification Setpoint attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_MAX_VALUE 0x64
|
||||
|
||||
/** @brief Default value for RHDehumidification Setpoint attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_DEFAULT_VALUE 0x32
|
||||
|
||||
/** @brief Default value for RelativeHumidityMode attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_RELATIVE_HUMIDITY_MODE_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for DehumidificationLockout attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_LOCKOUT_DEFAULT_VALUE ((zb_uint8_t)0x01)
|
||||
|
||||
/** @brief Min value for Dehumidification Hysteresis attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_MIN_VALUE 0x02
|
||||
|
||||
/** @brief Max value for Dehumidification Hysteresis attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_MAX_VALUE 0x14
|
||||
|
||||
/** @brief Default value for Dehumidification Hysteresis attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_DEFAULT_VALUE 0x02
|
||||
|
||||
/** @brief Min value for Dehumidification Max Cool attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_MIN_VALUE 0x14
|
||||
|
||||
/** @brief Max value for Dehumidification Max Cool attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_MAX_VALUE 0x64
|
||||
|
||||
/** @brief Default value for Dehumidification Max Cool attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_DEFAULT_VALUE 0x14
|
||||
|
||||
/** @brief Default value for RelativeHumidityDisplay attribute */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_RELATIVE_HUMIDITY_DISPLAY_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Declare attribute list for Dehumidification Control cluster
|
||||
@param attr_list - attribute list name
|
||||
@param dehumid_cooling - pointer to variable to store Dehumidification Cooling attribute value
|
||||
@param dehumid_setpoint - pointer to variable to store Dehumidification Setpoint attribute value
|
||||
@param dehumid_hysteresis - pointer to variable to store Dehumidification Hysteresis attribute value
|
||||
@param dehumid_max_cool - pointer to variable to store Dehumidification Max Cool attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DEHUMIDIFICATION_CONTROL_ATTRIB_LIST(attr_list, dehumid_cooling, dehumid_setpoint, \
|
||||
dehumid_hysteresis, dehumid_max_cool) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DEHUMIDIFICATION_CONTROL) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_COOLING_ID, (dehumid_cooling)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_ID, (dehumid_setpoint)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_ID, (dehumid_hysteresis)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_ID, (dehumid_max_cool)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Dehumidification Control cluster attributes */
|
||||
|
||||
/*! @name Dehumidification Control cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Dehumidification Control cluster commands */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Dehumidification Control cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_COOLING_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_COOLING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_RHDEHUMIDIFICATION_SETPOINT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_HYSTERESIS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEHUMIDIFICATION_CONTROL_DEHUMIDIFICATION_MAX_COOL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Dehumidification Control cluster */
|
||||
#define ZB_ZCL_DEHUMIDIFICATION_CONTROL_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @} */ /* Dehumidification Control cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/*! @} */ /* ZCL HA Dehumidification Control cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_dehumidification_control_init_server(void);
|
||||
void zb_zcl_dehumidification_control_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_DEHUMID_CONTROL_SERVER_ROLE_INIT zb_zcl_dehumidification_control_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DEHUMID_CONTROL_CLIENT_ROLE_INIT zb_zcl_dehumidification_control_init_client
|
||||
|
||||
#endif /* ZB_ZCL_DEHUMID_CONTROL_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,371 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Device Temperature Configuration cluster definitions */
|
||||
|
||||
#ifndef ZB_ZCL_DEVICE_TEMP_CONFIG_H
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DEVICE_TEMP_CONFIG
|
||||
* @{
|
||||
* @details
|
||||
* Attributes for determining information about a device’s internal
|
||||
* temperature, and for configuring under/over temperature alarms for
|
||||
* temperatures that are outside the device’s operating range.
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_DEVICE_TEMP_CONFIG */
|
||||
|
||||
/** @name Device Temperature Configuration cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Device Temperature Configuration cluster attribute identifiers
|
||||
* @see ZCL spec, Device Temperature Configuration Cluster 3.4.1.4
|
||||
*/
|
||||
enum zb_zcl_device_temp_config_attr_e
|
||||
{
|
||||
/** @brief CurrentTemp attribute, ZCL spec 3.4.2.2.1 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID = 0x0000,
|
||||
/** @brief MinTempExperienced attribute, ZCL spec 3.4.2.2.1 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID = 0x0001,
|
||||
/** @brief MaxTempExperienced attribute, ZCL spec 3.4.2.2.1 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID = 0x0002,
|
||||
/** @brief OverTempTotalDwell attribute, ZCL spec 3.4.2.2.1 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID = 0x0003,
|
||||
|
||||
/** @brief DeviceTempAlarmMask attribute, ZCL spec 3.4.2.2.2 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID = 0x0010,
|
||||
/** @brief LowTempThreshold attribute, ZCL spec 3.4.2.2.2 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID = 0x0011,
|
||||
/** @brief HighTempThreshold attribute, ZCL spec 3.4.2.2.2 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID = 0x0012,
|
||||
/** @brief LowTempDwellTripPoint attribute, ZCL spec 3.4.2.2.2 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID = 0x0013,
|
||||
/** @brief HighTempDwellTripPoint attribute, ZCL spec 3.4.2.2.2 */
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID = 0x0014,
|
||||
};
|
||||
|
||||
/** @brief Default value for Device Temperature Configuration cluster revision global attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Minimum value for CurrentTemp attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_CURRENT_TEMP_MIN_VALUE (-200)
|
||||
/** @brief Maximum value for CurrentTemp attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_CURRENT_TEMP_MAX_VALUE (+200)
|
||||
|
||||
/** @brief Minimum value for MinTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_MIN_VALUE (-200)
|
||||
/** @brief Maximum value for MinTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_MAX_VALUE (+200)
|
||||
|
||||
/** @brief Minimum value for MaxTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_MIN_VALUE (-200)
|
||||
/** @brief Maximum value for MaxTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_MAX_VALUE (+200)
|
||||
|
||||
/** @brief Minimum value for OverTotalDwell attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_MIN_VALUE (0x0000)
|
||||
/** @brief Maximum value for OverTotalDwell attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_MAX_VALUE (0xffff)
|
||||
|
||||
/** @brief Minimum value for DeviceTempAlarmMask attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_MIN_VALUE (0b00000000)
|
||||
/** @brief Maximum value for DeviceTempAlarmMask attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_MAX_VALUE (0b00000011)
|
||||
|
||||
/** @brief Minimum value for LowTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_MIN_VALUE (-200)
|
||||
/** @brief Maximum value for LowTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_MAX_VALUE (+200)
|
||||
|
||||
/** @brief Minimum value for HighTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_MIN_VALUE (-200)
|
||||
/** @brief Maximum value for HighTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_MAX_VALUE (+200)
|
||||
|
||||
/** @brief Minimum value for LowTempTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_MIN_VALUE (0x000000)
|
||||
/** @brief Maximum value for LowTempTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_MAX_VALUE (0xffffff)
|
||||
|
||||
/** @brief Minimum value for HighTempTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_MIN_VALUE (0x000000)
|
||||
/** @brief Maximum value for HighTempTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_MAX_VALUE (0xffffff)
|
||||
|
||||
/** @brief Default value for CurrentTemp attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_CURRENT_TEMP_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for MinTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for MaxTempExperienced attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for OverTempTotalDwell attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_DEFAULT_VALUE 0
|
||||
|
||||
/** @brief Default value for DeviceTempAlarmMask attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_DEFAULT_VALUE 0
|
||||
|
||||
/** @brief Default value for LowTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for HighTempThreshold attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for LowTempDwellTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_DEFAULT_VALUE ZB_ZCL_NON_VALUE_UINT24
|
||||
|
||||
/** @brief Default value for HighTempDwellTripPoint attribute */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_DEFAULT_VALUE ZB_ZCL_NON_VALUE_UINT24
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Device Temperature Configuration cluster internals
|
||||
* Internal structures for Device Temperature Configuration cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U24, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U24, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Device Temperature Configuration cluster */
|
||||
#define ZB_ZCL_DEVICE_TEMP_CONFIG_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Device Temperature Configuration cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for Device Temperature Configuration cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param current_temp - pointer to variable storing CurrentTemp attribute value
|
||||
* @param min_temp_experienced - pointer to variable storing MinTempExperienced attribute value
|
||||
* @param max_temp_experienced - pointer to variable storing MaxTempExperienced attribute value
|
||||
* @param over_temp_total_dwell - pointer to variable storing OverTempTotalDwell attribute value
|
||||
* @param device_temp_alarm_mask - pointer to variable storing DeviceTempAlarmMask attribute value
|
||||
* @param low_temp_threshold - pointer to variable storing LowTempThreshold attribute value
|
||||
* @param high_temp_threshold - pointer to variable storing HighTempThreshold attribute value
|
||||
* @param low_temp_dwell_trip_point - pointer to variable storing LowTempDwellTripPoint attribute value
|
||||
* @param high_temp_dwell_trip_point - pointer to variable storing HighTempDwellTripPoint attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DEVICE_TEMP_CONFIG_ATTRIB_LIST(attr_list, \
|
||||
current_temp, \
|
||||
min_temp_experienced, \
|
||||
max_temp_experienced, \
|
||||
over_temp_total_dwell, \
|
||||
device_temp_alarm_mask, \
|
||||
low_temp_threshold, \
|
||||
high_temp_threshold, \
|
||||
low_temp_dwell_trip_point, \
|
||||
high_temp_dwell_trip_point) \
|
||||
\
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DEVICE_TEMP_CONFIG) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID, (current_temp)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID, (min_temp_experienced)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID, (max_temp_experienced)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID, (over_temp_total_dwell)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID, (device_temp_alarm_mask)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID, (low_temp_threshold)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID, (high_temp_threshold)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID, (low_temp_dwell_trip_point)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID, (high_temp_dwell_trip_point)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Device Temperature Configuration cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_device_temp_config_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_CURRENT_TEMP_ID
|
||||
*/
|
||||
zb_int16_t current_temp;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MIN_TEMP_EXPERIENCED_ID
|
||||
*/
|
||||
zb_int16_t min_temp_experienced;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_MAX_TEMP_EXPERIENCED_ID
|
||||
*/
|
||||
zb_int16_t max_temp_experienced;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_OVER_TEMP_TOTAL_DWELL_ID
|
||||
*/
|
||||
zb_uint16_t over_temp_total_dwell;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_DEVICE_TEMP_ALARM_MASK_ID
|
||||
*/
|
||||
zb_uint8_t device_temp_alarm_mask;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_THRESHOLD_ID
|
||||
*/
|
||||
zb_int16_t low_temp_threshold;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_THRESHOLD_ID
|
||||
*/
|
||||
zb_int16_t high_temp_threshold;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_LOW_TEMP_DWELL_TRIP_POINT_ID
|
||||
*/
|
||||
zb_uint24_t low_temp_dwell_trip_point;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID
|
||||
* @see ZB_ZCL_ATTR_DEVICE_TEMP_CONFIG_HIGH_TEMP_DWELL_TRIP_POINT_ID
|
||||
*/
|
||||
zb_uint24_t high_temp_dwell_trip_point;
|
||||
} zb_zcl_device_temp_config_attrs_t;
|
||||
|
||||
/** @brief Declare attribute list for Device Temperature Configuration cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_device_temp_config_attrs_t type
|
||||
* (containing Device Temperature Configuration cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DEVICE_TEMP_CONFIG_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_DEVICE_TEMP_CONFIG_ATTRIB_LIST(attr_list, \
|
||||
&attrs.current_temp, \
|
||||
&attrs.min_temp_experienced, \
|
||||
&attrs.max_temp_experienced, \
|
||||
&attrs.over_temp_total_dwell, \
|
||||
&attrs.device_temp_alarm_mask, \
|
||||
&attrs.low_temp_threshold, \
|
||||
&attrs.high_temp_threshold, \
|
||||
&attrs.low_temp_dwell_trip_point, \
|
||||
&attrs.high_temp_dwell_trip_point)
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_DEVICE_TEMP_CONFIG_ATTRS_GROUP group */
|
||||
|
||||
/** @} */ /* ZCL Device Temperature Configuration cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_device_temp_config_init_server(void);
|
||||
void zb_zcl_device_temp_config_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_DEVICE_TEMP_CONFIG_SERVER_ROLE_INIT zb_zcl_device_temp_config_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DEVICE_TEMP_CONFIG_CLIENT_ROLE_INIT zb_zcl_device_temp_config_init_client
|
||||
|
||||
#endif /* ZB_ZCL_DEVICE_TEMP_CONFIG_H */
|
||||
@@ -0,0 +1,696 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Diagnostics cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_DIAGNOSTICS_H
|
||||
#define ZB_ZCL_DIAGNOSTICS_H 1
|
||||
|
||||
|
||||
#if defined(ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS) || defined(DOXYGEN)
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DIAGNOSTICS
|
||||
* @{
|
||||
* @details
|
||||
* ZCL Diagnostics cluster definitions
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_DIAGNOSTICS */
|
||||
|
||||
/*! @name Diagnostics cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_diagnostics_ctx_s
|
||||
{
|
||||
zb_mac_diagnostic_info_t mac_data;
|
||||
zdo_diagnostics_info_t zdo_data;
|
||||
zb_callback_t sync_data_cb;
|
||||
zb_uint8_t cb_param;
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_diagnostics_ctx_t;
|
||||
|
||||
extern zb_zcl_diagnostics_ctx_t diagnostics_ctx_zcl;
|
||||
|
||||
/*! @brief Diagnostics cluster attribute identifiers
|
||||
@see HA spec, Diagnostics Cluster 9.3.2.2.2
|
||||
*/
|
||||
enum zb_zcl_diagnostics_attr_e
|
||||
{
|
||||
/** @brief number_of_resets, Zigbee Diagnostic Cluster spec 1.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NUMBER_OF_RESETS_ID = 0x0000,
|
||||
/** This attribute keeps track of the number of writes to persistent memory.
|
||||
* HA spec 9.2.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PERSISTENT_MEMORY_WRITES_ID = 0x0001,
|
||||
/** @brief MacRxBcast, HA spec 9.2.2.2.2.1 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_BCAST_ID = 0x0100,
|
||||
/** @brief MacTxBcast, HA spec 9.2.2.2.2.2 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_BCAST_ID = 0x0101,
|
||||
/** MacRxUcast Attribute A counter that is incremented each time the MAC
|
||||
* layer receives a unicast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_UCAST_ID = 0x0102,
|
||||
/** @brief MacTxUcast, HA spec 9.2.2.2.2.4 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_ID = 0x0103,
|
||||
/** MacTxUcastRetry Attribute A counter that is incremented each time
|
||||
* the MAC layer retries a unicast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_RETRY_ID = 0x0104,
|
||||
/** MacTxUcastFail Attribute A counter that is incremented each time
|
||||
* the MAC layer fails to send a unicast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_FAIL_ID = 0x0105,
|
||||
/** APSRxBcast Attribute A counter that is incremented each time
|
||||
* the APS layer receives a broadcast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_RX_BCAST_ID = 0x0106,
|
||||
/** @brief aps_tx_bcast, HA spec 9.3.2.2.2 (??) */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_BCAST_ID = 0x0107,
|
||||
/** APSRxUcast Attribute A counter that is incremented each time
|
||||
* the APS layer receives a unicast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_RX_UCAST_ID = 0x0108,
|
||||
/** @brief aps_tx_ucast_success, HA spec 9.3.2.2.2 (??) */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_SUCCESS_ID = 0x0109,
|
||||
/** APSTxUcastRetry Attribute A counter that is incremented each time
|
||||
* the APS layer retries the sending of a unicast. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_RETRY_ID = 0x010A,
|
||||
/** @brief aps_tx_ucast_fail, HA spec 9.3.2.2.2 (??) */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_FAIL_ID = 0x010b,
|
||||
/** RouteDiscInitiated Attribute A counter that is incremented each time
|
||||
* a route request is initiated . */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_ROUTE_DISC_INITIATED_ID = 0x010C,
|
||||
/** NeighborAdded Attribute A counter that is incremented each time
|
||||
* an entry is added to the neighbor table. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_ADDED_ID = 0x010D,
|
||||
/** NeighborRemoved Attribute A counter that is incremented each time
|
||||
* an entry is removed from the neighbor table. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_REMOVED_ID = 0x010E,
|
||||
/** A counter that is incremented each time a neighbor table entry becomes stale
|
||||
* because the neighbor has not been heard from. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_STALE_ID = 0x010F,
|
||||
/** @brief join_indication, HA spec 1.2.2.2.17 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_JOIN_INDICATION_ID = 0x0110,
|
||||
/** A counter that is incremented each time an entry is removed from the child table. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CHILD_MOVED_ID = 0x0111,
|
||||
/** A counter that is incremented each time a message is dropped at the network
|
||||
* layer because the APS frame counter was not higher than the last message seen
|
||||
* from that source. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NWKFC_FAILURE_ID = 0x0112,
|
||||
/** A counter that is incremented each time a message is dropped at the APS layer
|
||||
* because the APS frame counter was not higher than the last message seen from
|
||||
* that source. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APSFC_FAILURE_ID = 0x0113,
|
||||
/** A counter that is incremented each time a message is dropped at the APS layer
|
||||
* because it had APS encryption but the key associated with the sender has
|
||||
* not been authenticated, and thus the key is not authorized for use
|
||||
* in APS data messages. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_UNAUTHORIZED_KEY_ID = 0x0114,
|
||||
/** A counter that is incremented each time a NWK encrypted message was received
|
||||
* but dropped because decryption failed. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NWK_DECRYPT_FAILURES_ID = 0x0115,
|
||||
/** A counter that is incremented each time an APS encrypted message was received
|
||||
* but dropped because decryption failed. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_DECRYPT_FAILURES_ID = 0x0116,
|
||||
/** A counter that is incremented each time the stack failed to allocate a packet
|
||||
* buffers. This doesn't necessarily mean that the packet buffer count was 0 at
|
||||
* the time, but that the number requested was greater than the number free. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_BUFFER_ALLOCATE_FAILURES_ID = 0x0117,
|
||||
/** A counter that is incremented each time a unicast packet is relayed. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_RELAYED_UCAST_ID = 0x0118,
|
||||
/** A counter that is incremented each time a packet is dropped because the PHY to
|
||||
* MAC queue was exhausted */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PHYTOMACQUEUELIMITREACHED_ID = 0x0119,
|
||||
/** A counter that is incremented each time a packet was dropped due to a packet
|
||||
* validation error. This could be due to length or other formatting problems
|
||||
* in the packet. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_VALIDATEDROPCOUNT_ID = 0x011A,
|
||||
/** A counter that is equal to the average number of MAC retries needed to send
|
||||
* an APS message, HA spec 9.2.2.2.2.27 */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_AVERAGE_MAC_RETRY_PER_APS_ID = 0x011b,
|
||||
/** This is the Link Quality Indicator for the last message received. There is no
|
||||
* current agreed upon standard for calculating the LQI. For some implementations
|
||||
* LQI is related directly to RSSI for others it is a function of the number of
|
||||
* errors received over a fixed number of bytes in a given message. The one thing
|
||||
* that has been agreed is that the Link Quality Indicator is a value between 0
|
||||
* and 255 where 0 indicates the worst possible link and 255 indicates the best
|
||||
* possible link. Note that for a device reading the Last Message LQI the returned
|
||||
* value SHALL be the LQI for the read attribute message used to read the attribute
|
||||
* itself. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_LAST_LQI_ID = 0x011c,
|
||||
/** This is the receive signal strength indication for the last message received.
|
||||
* As with Last Message LQI, a device reading the Last Message RSSI, the returned
|
||||
* value SHALL be the RSSI of the read attribute message used to read the attribute
|
||||
* itself. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_LAST_RSSI_ID = 0x011d,
|
||||
/*! @brief A counter that is incremented on the NWK layer
|
||||
* each time tries number of a packet resending are gone.
|
||||
*
|
||||
* @note It's a non-standard counter that depends on ZB_ENABLE_NWK_RETRANSMIT and
|
||||
* will be zero always when the macro isn't set. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_NWK_RETRY_OVERFLOW_ID = 0xff00,
|
||||
/** A non-standard counter that is incremented each time an the PHY layer was unable
|
||||
* to transmit due to a failed CCA */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_PHY_CCA_FAILURES_ID = 0xff01,
|
||||
/** A non-standard counter of the number of times the NWK broadcast was dropped
|
||||
* because the broadcast table was full. */
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_BCAST_TABLE_FULL_ID = 0xff02
|
||||
};
|
||||
|
||||
/** @brief Default value for Diagnostics cluster revision global attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/** @brief Default value for number_of_resets attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NUMBER_OF_RESETS_DEFAULT_VALUE ((zb_uint16_t)0x00000000)
|
||||
|
||||
/** @brief Default value for PersistentMemoryWrites attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_PERSISTENT_MEMORY_WRITES_DEFAULT_VALUE ((zb_uint16_t)0x00000000)
|
||||
|
||||
/** @brief Default value for MacRxBcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_RX_BCAST_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for MacTxBcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_TX_BCAST_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for MacRxUcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_RX_UCAST_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for MacTxUcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_TX_UCAST_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for MacTxUcastRetry attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_TX_UCAST_RETRY_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for MacTxUcastFail attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_MAC_TX_UCAST_FAIL_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for APSRxBcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_RX_BCAST_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for aps_tx_bcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_TX_BCAST_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for APSRxUcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_RX_UCAST_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for aps_tx_ucast_success attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_TX_UCAST_SUCCESS_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for APSTxUcastRetry attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_TX_UCAST_RETRY_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for aps_tx_ucast_fail attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_TX_UCAST_FAIL_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for RouteDiscInitiated attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_ROUTE_DISC_INITIATED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NeighborAdded attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NEIGHBOR_ADDED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NeighborRemoved attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NEIGHBOR_REMOVED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NeighborStale attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NEIGHBOR_STALE_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for join_indication attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_JOIN_INDICATION_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for ChildMoved attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_CHILD_MOVED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for nwk_fc_failure attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NWKFC_FAILURE_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for aps_fc_failure attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APSFC_FAILURE_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for APSUnauthorizedKey attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_UNAUTHORIZED_KEY_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NWKDecryptFailures attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_NWK_DECRYPT_FAILURES_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for APSDecryptFailures attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_APS_DECRYPT_FAILURES_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for packet_buffer_allocate_failures attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_PACKET_BUFFER_ALLOCATE_FAILURES_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for RelayedUcast attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_RELAYED_UCAST_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for PhytoMACqueuelimitreached attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_PHYTO_MA_CQUEUELIMITREACHED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for PacketValidatedropcount attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_PACKET_VALIDATEDROPCOUNT_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for AverageMACRetryPerAPS attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_AVERAGE_MAC_RETRY_PER_APS_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for LastLQI attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_LAST_LQI_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for LastRSSI attribute */
|
||||
#define ZB_ZCL_DIAGNOSTICS_LAST_RSSI_DEFAULT_VALUE ((zb_int8_t)0)
|
||||
|
||||
#define ZB_ZCL_DIAGNOSTICS_CUSTOM_ATTR_NWK_RETRY_OVERFLOW_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
#define ZB_ZCL_DIAGNOSTICS_CUSTOM_ATTR_PHY_CCA_FAILURES_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
#define ZB_ZCL_DIAGNOSTICS_CUSTOM_ATTR_BCAST_TABLE_FULL_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Diagnostics cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NUMBER_OF_RESETS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NUMBER_OF_RESETS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_BUFFER_ALLOCATE_FAILURES_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_BUFFER_ALLOCATE_FAILURES_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_JOIN_INDICATION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_JOIN_INDICATION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_BCAST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_BCAST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_BCAST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_BCAST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_UCAST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_BCAST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_RETRY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_RETRY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_FAIL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_FAIL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_BCAST_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_BCAST_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_SUCCESS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_SUCCESS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_RETRY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_RETRY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_FAIL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_FAIL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_ROUTE_DISC_INITIATED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_ROUTE_DISC_INITIATED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_AVERAGE_MAC_RETRY_PER_APS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_AVERAGE_MAC_RETRY_PER_APS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_LAST_LQI_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_LAST_LQI_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_LAST_RSSI_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_LAST_RSSI_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_CHILD_MOVED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CHILD_MOVED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NWKFC_FAILURE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NWKFC_FAILURE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APSFC_FAILURE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APSFC_FAILURE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_UNAUTHORIZED_KEY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_UNAUTHORIZED_KEY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NWK_DECRYPT_FAILURES_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NWK_DECRYPT_FAILURES_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_APS_DECRYPT_FAILURES_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_APS_DECRYPT_FAILURES_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_PHYTOMACQUEUELIMITREACHED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PHYTOMACQUEUELIMITREACHED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_VALIDATEDROPCOUNT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_VALIDATEDROPCOUNT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_ADDED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_ADDED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_REMOVED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_REMOVED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_STALE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_STALE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_NWK_RETRY_OVERFLOW_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_NWK_RETRY_OVERFLOW_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_PHY_CCA_FAILURES_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_PHY_CCA_FAILURES_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_BCAST_TABLE_FULL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_BCAST_TABLE_FULL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @brief Declare attribute list for Diagnostics cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DIAGNOSTICS_ATTRIB_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DIAGNOSTICS) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_BCAST_ID, &diagnostics_ctx_zcl.mac_data.mac_rx_bcast) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_BCAST_ID, &diagnostics_ctx_zcl.mac_data.mac_tx_bcast) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_RX_UCAST_ID, &diagnostics_ctx_zcl.mac_data.mac_rx_ucast) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_ID, &diagnostics_ctx_zcl.mac_data.mac_tx_ucast_total_zcl) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_RETRY_ID, &diagnostics_ctx_zcl.mac_data.mac_tx_ucast_retries_zcl) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_MAC_TX_UCAST_FAIL_ID, &diagnostics_ctx_zcl.mac_data.mac_tx_ucast_failures_zcl) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_LAST_LQI_ID, &diagnostics_ctx_zcl.mac_data.last_msg_lqi) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_LAST_RSSI_ID, &diagnostics_ctx_zcl.mac_data.last_msg_rssi) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_PHYTOMACQUEUELIMITREACHED_ID, &diagnostics_ctx_zcl.mac_data.phy_to_mac_que_lim_reached) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_VALIDATEDROPCOUNT_ID, &diagnostics_ctx_zcl.mac_data.mac_validate_drop_cnt) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_PHY_CCA_FAILURES_ID, &diagnostics_ctx_zcl.mac_data.phy_cca_fail_count) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NUMBER_OF_RESETS_ID, &diagnostics_ctx_zcl.zdo_data.number_of_resets) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_BCAST_ID, &diagnostics_ctx_zcl.zdo_data.aps_tx_bcast) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_SUCCESS_ID, &diagnostics_ctx_zcl.zdo_data.aps_tx_ucast_success) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_RETRY_ID, &diagnostics_ctx_zcl.zdo_data.aps_tx_ucast_retry) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_TX_UCAST_FAIL_ID, &diagnostics_ctx_zcl.zdo_data.aps_tx_ucast_fail) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_ROUTE_DISC_INITIATED_ID, &diagnostics_ctx_zcl.zdo_data.route_disc_initiated) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_ADDED_ID, &diagnostics_ctx_zcl.zdo_data.nwk_neighbor_added) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_REMOVED_ID, &diagnostics_ctx_zcl.zdo_data.nwk_neighbor_removed) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NEIGHBOR_STALE_ID, &diagnostics_ctx_zcl.zdo_data.nwk_neighbor_stale) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_JOIN_INDICATION_ID, &diagnostics_ctx_zcl.zdo_data.join_indication) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_AVERAGE_MAC_RETRY_PER_APS_ID, &diagnostics_ctx_zcl.zdo_data.average_mac_retry_per_aps_message_sent) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_PACKET_BUFFER_ALLOCATE_FAILURES_ID, &diagnostics_ctx_zcl.zdo_data.packet_buffer_allocate_failures) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_CHILD_MOVED_ID, &diagnostics_ctx_zcl.zdo_data.childs_removed) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NWKFC_FAILURE_ID, &diagnostics_ctx_zcl.zdo_data.nwk_fc_failure) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APSFC_FAILURE_ID, &diagnostics_ctx_zcl.zdo_data.aps_fc_failure) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_UNAUTHORIZED_KEY_ID, &diagnostics_ctx_zcl.zdo_data.aps_unauthorized_key) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_NWK_DECRYPT_FAILURES_ID, &diagnostics_ctx_zcl.zdo_data.nwk_decrypt_failure) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_APS_DECRYPT_FAILURES_ID, &diagnostics_ctx_zcl.zdo_data.aps_decrypt_failure) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_NWK_RETRY_OVERFLOW_ID, &diagnostics_ctx_zcl.zdo_data.nwk_retry_overflow) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DIAGNOSTICS_CUSTOM_ATTR_BCAST_TABLE_FULL_ID, &diagnostics_ctx_zcl.zdo_data.nwk_bcast_table_full) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Diagnostics cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/* ACHTUNG! ATTENTION!
|
||||
* If you need to add a counter, do the following steps:
|
||||
* 1) add a macro to declare an attribute like it's done above:
|
||||
* ZB_SET_ATTR_DESCR_WITH_*attr_id*(data_ptr)
|
||||
* 2) declare the attribute in the attributes list:
|
||||
* ZB_ZCL_DECLARE_DIAGNOSTICS_ATTRIB_LIST
|
||||
* 3) implement your counter at:
|
||||
* 3.1) ZDO
|
||||
* - zb_zdo_globals.h -> zdo_diagnostics_info_t
|
||||
* - zdo_diagnostics.h -> zdo_diagnostics_counter_id_t
|
||||
* - zdo_diagnostics.c -> zdo_diagnostics_inc()
|
||||
* - increment your counter in code using the ZDO_DIAGNOSTICS_INC() macro;
|
||||
* OR
|
||||
* 3.2) MAC
|
||||
* - zb_mac.h -> zb_mac_diagnostic_info_t
|
||||
* - mac_zcl_diagnostic.c -> implement a function to increment the counter;
|
||||
* - mac_internal.h -> add macros to use the incrementing function;
|
||||
* - increment your counter in code using the macro;
|
||||
* 4) add copying the counter value to
|
||||
* zcl_diagnostics_commands.c -> zb_zcl_diagnostics_get_attr_value_by_id()
|
||||
*
|
||||
* Important note:
|
||||
* We have asynchronous reading the Diagnostics attributes:
|
||||
* in the zb_zcl_read_attr_handler() we call zdo_diagnostics_get_stats()
|
||||
* that will copy all counters to the same buffer from the first byte.
|
||||
* What the problem? We have the following buffer structure:
|
||||
* a) buffer begin (from zero byte! not from zb_buf_begin()) - will contain all counters;
|
||||
* b) buffer middle (from zb_buf_begin()) - contains one or more zb_zcl_read_attr_req_t;
|
||||
* c) buffer end (can be get with ZB_BUF_GET_PARAM()) - contains zb_zcl_parsed_hdr_t.
|
||||
* As you see, we can place all counters only from buffer begin (a).
|
||||
* It's possible to get a situation when we don't have enough space,
|
||||
* and you will catch assert in the zdo_diagnostics_get_mac_stats_cb() function.
|
||||
* In this case it's necessary to move data from buffer middle to the right a bit.
|
||||
*/
|
||||
|
||||
/*! @} */ /* Diagnostics cluster attributes */
|
||||
|
||||
/*! @} */ /* ZCL Diagnostics cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_diagnostics_init_server(void);
|
||||
void zb_zcl_diagnostics_init_client(void);
|
||||
|
||||
/**
|
||||
* @brief Synchronize MAC and ZDO counters with ZCL attributes.
|
||||
*
|
||||
* Call this function each time when you want to get an attribute value
|
||||
* and process statistic using @zb_zcl_get_attr_desc_a
|
||||
*
|
||||
* When synchronization will be finished, users callback
|
||||
* with a specified parameter will be called.
|
||||
*
|
||||
* @param cb_param - a parameter of users callback
|
||||
* @param cb - users callback
|
||||
*/
|
||||
zb_ret_t zb_zcl_diagnostics_sync_counters(zb_uint8_t cb_param, zb_callback_t cb);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DIAGNOSTICS_SERVER_ROLE_INIT zb_zcl_diagnostics_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DIAGNOSTICS_CLIENT_ROLE_INIT zb_zcl_diagnostics_init_client
|
||||
|
||||
#else /* defined(ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS) */
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DIAGNOSTICS_SERVER_ROLE_INIT
|
||||
#define ZB_ZCL_CLUSTER_ID_DIAGNOSTICS_CLIENT_ROLE_INIT
|
||||
|
||||
#endif /* defined(ZB_ZCL_SUPPORT_CLUSTER_DIAGNOSTICS) */
|
||||
|
||||
#endif /* ZB_ZCL_DIAGNOSTICS_H */
|
||||
@@ -0,0 +1,799 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: DOOR_LOCK cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_DOOR_LOCK_H
|
||||
#define ZB_ZCL_DOOR_LOCK_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DOOR_LOCK
|
||||
* @{
|
||||
* @details
|
||||
* Door Lock cluster defined in ZCL spec, clause 7.3.
|
||||
*
|
||||
* The cluster contains 2 command sets:
|
||||
* @li Lock Door request and response;
|
||||
* @li Unlock Door request and response.
|
||||
*
|
||||
* Both requests have no payload and could be scheduled for sending with corresponding macros.
|
||||
* Both responses have simple payload, and their sending and parsing with corresponding macros
|
||||
* is almost trivial.
|
||||
*
|
||||
* @par Examples:
|
||||
*
|
||||
* Send Door Lock command:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_door_lock_req
|
||||
*
|
||||
* Send Door Unlock command:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_door_lock_unlock_req
|
||||
*
|
||||
*/
|
||||
|
||||
/*! @name Door Lock cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Door Lock cluster attribute identifiers
|
||||
@see ZCL spec, subclause 7.3.2.2
|
||||
*/
|
||||
enum zb_zcl_door_lock_attr_e
|
||||
{
|
||||
/** @brief LockState attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID = 0x0000,
|
||||
/** @brief LockType attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_ID = 0x0001,
|
||||
/** @brief ActuatorEnabled attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ID = 0x0002,
|
||||
/** @brief DoorState attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_ID = 0x0003,
|
||||
/** @brief DoorOpenEvents attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_OF_DOOR_OPEN_EVENTS_ID = 0x0004,
|
||||
/** @brief DoorClosedEvents attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_OF_DOOR_CLOSED_EVENTS_ID = 0x0005,
|
||||
/** @brief OpenPeriod attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_OPEN_PERIOD_ID = 0x0006,
|
||||
/** The number of available log records. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUMBER_OF_LOG_RECORDS_SUPPORTED_ID = 0x0010,
|
||||
/** @brief NumberOfTotalUsersSupported attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_TOTAL_USERS_ID = 0x0011,
|
||||
/** @brief NumberOfPINUsersSupported attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_PIN_USERS_ID = 0x0012,
|
||||
/** The number of RFID users supported. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUMBER_OF_RFID_USERS_SUPPORTED_ID = 0x0013,
|
||||
/** @brief NumberOfWeekDaySchedulesSupportedPerUser attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_WEEK_DAY_SCHEDULE_PER_USER_ID = 0x0014,
|
||||
/** @brief NumberOfYearDaySchedulesSupportedPerUser attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_YEAR_DAY_SCHEDULE_PER_USER_ID = 0x0015,
|
||||
/** @brief NumberOfHolidaySchedulesSupported attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_NUM_HOLIDAY_SCHEDULE_ID = 0x0016,
|
||||
/** @brief Max PIN code length attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_MAX_PIN_LEN_ID = 0x0017,
|
||||
/** @brief Min PIN code length attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_MIN_PIN_LEN_ID = 0x0018,
|
||||
/** An 8-bit value indicates the maximum length in bytes of a RFID Code
|
||||
* on this device. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_MAX_RFID_CODE_LENGTH_ID = 0x0019,
|
||||
/** An 8-bit value indicates the minimum length in bytes of a RFID Code
|
||||
* on this device. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_MIN_RFID_CODE_LENGTH_ID = 0x001A,
|
||||
/** Enable/disable event logging. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ENABLE_LOGGING_ID = 0x0020,
|
||||
/** Modifies the language for the on-screen or audible user interface using
|
||||
* three bytes from ISO-639-1. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LANGUAGE_ID = 0x0021,
|
||||
/** The settings for the LED support three different modes. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LED_SETTINGS_ID = 0x0022,
|
||||
/** The number of seconds to wait after unlocking a lock before it automatically
|
||||
* locks again. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_AUTO_RELOCK_TIME_ID = 0x0023,
|
||||
/** The sound volume on a door lock has three possible settings: silent, low
|
||||
* and high volumes. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_SOUND_VOLUME_ID = 0x0024,
|
||||
/** @brief OperatingMode attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_OPERATING_MODE_ID = 0x0025,
|
||||
/** @brief SupportedOperatingModes attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_OPERATION_MODES_SUPPORTED_ID = 0x0026,
|
||||
/** This attribute represents the default configurations as they are physically
|
||||
* set on the device (example: hardware dip switch setting, etc) and represents
|
||||
* the default setting for some of the attributes within this Operational Setting
|
||||
* Attribute Set (for example: LED, Auto Lock, Sound Volume, and Operating Mode
|
||||
* attributes). */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DEFAULT_CONFIGURATION_REGISTER_ID = 0x0027,
|
||||
/** @brief EnableLocalProgramming attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ENABLE_LOCAL_PROGRAMMING_ID = 0x0028,
|
||||
/** Enable/disable the ability to lock the door lock with a single touch on
|
||||
* the door lock. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ENABLE_ONE_TOUCH_LOCKING_ID = 0x0029,
|
||||
/** Enable/disable an inside LED that allows the user to see at a glance
|
||||
* if the door is locked. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ENABLE_INSIDE_STATUS_LED_ID = 0x002A,
|
||||
/** Enable/disable a button inside the door that is used to put the lock
|
||||
* into privacy mode. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ENABLE_PRIVACY_MODE_BUTTON_ID = 0x002B,
|
||||
/** The number of incorrect codes or RFID presentment attempts a user
|
||||
* is allowed to enter before the door will enter a lockout state. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_WRONG_CODE_ENTRY_LIMIT_ID = 0x0030,
|
||||
/** The number of seconds that the lock shuts down following wrong code entry. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_USER_CODE_TEMPORARY_DISABLE_TIME_ID = 0x0031,
|
||||
/** Boolean set to True if it is ok for the door lock server to send PINs
|
||||
* over the air. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_SEND_PIN_OVER_THE_AIR_ID = 0x0032,
|
||||
/** @brief Require PIN for RF operation attribute */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_REQUIRE_PIN_RF_ID = 0x0033,
|
||||
/** The Security Level attribute allows the door lock manufacturer to indicate
|
||||
* what level of security the door lock requires. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_SECURITY_LEVEL_ID = 0x0034,
|
||||
/** The alarm mask is used to turn on/off alarms for particular functions */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ALARM_MASK_ID = 0x0040,
|
||||
/** Event mask used to turn on and off the transmission of keypad operation events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_KEYPAD_OPERATION_EVENT_MASK_ID = 0x0041,
|
||||
/** Event mask used to turn on and off the transmission of RF operation events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_RF_OPERATION_EVENT_MASK_ID = 0x0042,
|
||||
/** Event mask used to turn on and off manual operation events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_ID = 0x0043,
|
||||
/** Event mask used to turn on and off RFID operation events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_RFID_OPERATION_EVENT_MASK_ID = 0x0044,
|
||||
/** Event mask used to turn on and off keypad programming events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_KEYPAD_PROGRAMMING_EVENT_MASK_ID = 0x0045,
|
||||
/** Event mask used to turn on and off RF programming events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_RF_PROGRAMMING_EVENT_MASK_ID = 0x0046,
|
||||
/** Event mask used to turn on and off RFID programming events. */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_RFID_PROGRAMMING_EVENT_MASK_ID = 0x0047,
|
||||
};
|
||||
|
||||
|
||||
/** @brief Values for LockState attribute
|
||||
* @see ZCL spec, subclause 7.3.2.2.1
|
||||
*/
|
||||
enum zb_zcl_door_lock_lock_state_e
|
||||
{
|
||||
/*! "Not fully locked" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_NOT_FULLY_LOCKED = 0x00,
|
||||
/*! "Locked" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_LOCKED = 0x01,
|
||||
/*! "Unlocked" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_UNLOCKED = 0x02,
|
||||
/*! "Not Defined" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_UNDEFINED = 0xff
|
||||
};
|
||||
|
||||
/** @brief Default value for Door Lock cluster revision global attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/** @brief Default value for Lock State attribute. */
|
||||
#define ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_DEFAULT_VALUE ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_UNDEFINED
|
||||
|
||||
/** @brief Values for LockType attribute
|
||||
* @see ZCL spec, subclause 7.3.2.2.2
|
||||
*/
|
||||
enum zb_zcl_door_lock_lock_type_e
|
||||
{
|
||||
/*! "Deadbolt" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_DEADBOLT = 0x00,
|
||||
/*! "Magnetic" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_MAGNETIC = 0x01,
|
||||
/*! "Other" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_OTHER = 0x02,
|
||||
/*! "Not Defined" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_UNDEFINED = 0xff
|
||||
};
|
||||
|
||||
/** @brief Default value for Lock Type attribute. */
|
||||
#define ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_DEFAULT_VALUE ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_UNDEFINED
|
||||
|
||||
/** @brief Values for ActuatorEnabled attribute
|
||||
* @see ZCL spec, subclause 7.3.2.2.3
|
||||
*/
|
||||
enum zb_zcl_door_lock_actuator_enabled_e
|
||||
{
|
||||
/*! "Disabled" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_DISABLED = 0x0b0,
|
||||
/*! "Enabled" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ENABLED = 0x0b1
|
||||
};
|
||||
|
||||
/** @brief Default value for Actuator Enabled attribute. */
|
||||
#define ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_DEFAULT_VALUE \
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ENABLED
|
||||
|
||||
/** @brief Values for DoorState attribute
|
||||
* @see ZCL spec, subclause 7.3.2.2.4
|
||||
*/
|
||||
enum zb_zcl_door_lock_door_state_e
|
||||
{
|
||||
/*! "Open" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_OPEN = 0x00,
|
||||
/*! "Closed" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_CLOSED = 0x01,
|
||||
/*! "Error (jammed)" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_ERROR_JAMMED = 0x02,
|
||||
/*! "Error (forced open)" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_ERROR_FORCED_OPEN = 0x03,
|
||||
/*! "Error (unspecified)" value */
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_DOOR_STATE_ERROR_UNSPECIFIED = 0x04
|
||||
};
|
||||
|
||||
/** @brief Declare attribute list for Door Lock cluster
|
||||
@param attr_list - attribute list name
|
||||
@param lock_state
|
||||
@param lock_type
|
||||
@param actuator_enabled
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DOOR_LOCK_ATTRIB_LIST(attr_list, \
|
||||
lock_state, \
|
||||
lock_type, \
|
||||
actuator_enabled) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DOOR_LOCK) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID, (lock_state)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_ID, (lock_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ID, (actuator_enabled)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Door Lock cluster attributes */
|
||||
|
||||
/*! @name Door Lock cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Door Lock cluster commands
|
||||
@see ZCL spec, subclause 7.3.2.3 Commands Received
|
||||
*/
|
||||
enum zb_zcl_door_lock_cmd_e
|
||||
{
|
||||
/** This command causes the lock device to lock the door. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR = 0x00,
|
||||
/** This command causes the lock device to unlock the door. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR = 0x01,
|
||||
/** Request the status of the lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_TOGGLE = 0x02,
|
||||
/** This command causes the lock device to unlock the door with a timeout parameter. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_WITH_TIMEOUT = 0x03,
|
||||
/** Request a log record. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_LOG_RECORD = 0x04,
|
||||
/** Set a PIN into the lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_PIN_CODE = 0x05,
|
||||
/** Retrieve a PIN Code. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_PIN_CODE = 0x06,
|
||||
/** Delete a PIN. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_PIN_CODE = 0x07,
|
||||
/** Clear out all PINs on the lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_ALL_PIN_CODES = 0x08,
|
||||
/** Set the status of a user ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_USER_STATUS = 0x09,
|
||||
/** Get the status of a user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_USER_STATUS = 0x0A,
|
||||
/** Set a weekly repeating schedule for a specified user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_WEEKDAY_SCHEDULE = 0x0B,
|
||||
/** Retrieve the specific weekly schedule for the specific user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_WEEKDAY_SCHEDULE = 0x0C,
|
||||
/** Clear the specific weekly schedule for the specific user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_WEEKDAY_SCHEDULE = 0x0D,
|
||||
/** Set a time-specific schedule ID for a specified user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_YEAR_DAY_SCHEDULE = 0x0E,
|
||||
/** Retrieve the specific year day schedule for the specific user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_YEAR_DAY_SCHEDULE = 0x0F,
|
||||
/** Clears the specific year day schedule for the specific user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_YEAR_DAY_SCHEDULE = 0x10,
|
||||
/** Set the holiday Schedule by specifying local start time and local end time
|
||||
* with respect to any Lock Operating Mode. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_HOLIDAY_SCHEDULE = 0x11,
|
||||
/** Get the holiday Schedule by specifying Holiday ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_HOLIDAY_SCHEDULE = 0x12,
|
||||
/** Clear the holiday Schedule by specifying Holiday ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_HOLIDAY_SCHEDULE = 0x13,
|
||||
/** Set the type byte for a specified user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_USER_TYPE = 0x14,
|
||||
/** Retrieve the type byte for a specific user. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_USER_TYPE = 0x15,
|
||||
/** Set an ID for RFID access into the lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_RFID_CODE = 0x16,
|
||||
/** Retrieve an ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_RFID_CODE = 0x17,
|
||||
/** Delete an ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_RFID_CODE = 0x18,
|
||||
/** Clear out all RFIDs on the lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_ALL_RFID_CODES = 0x19,
|
||||
};
|
||||
|
||||
/*! @brief Door Lock cluster commands response
|
||||
@see ZCL spec, subclause 7.3.2.4 Commands Generated
|
||||
*/
|
||||
enum zb_zcl_door_lock_cmd_resp_e
|
||||
{
|
||||
/** This command is sent in response to a Lock command with one status byte payload. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR_RES = 0x00,
|
||||
/** This command is sent in response to a Unlock command with one status byte payload. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR_RES = 0x01,
|
||||
/** This command is sent in response to a Toggle command with one status byte payload. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_TOGGLE_RESPONSE = 0x02,
|
||||
/** This command is sent in response to an Unlock with Timeout command
|
||||
* with one status byte payload. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_WITH_TIMEOUT_RESPONSE = 0x03,
|
||||
/** Returns the specified log record. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_LOG_RECORD_RESPONSE = 0x04,
|
||||
/** Returns status of the PIN set command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_PIN_CODE_RESPONSE = 0x05,
|
||||
/** Returns the PIN for the specified user ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_PIN_CODE_RESPONSE = 0x06,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_PIN_CODE_RESPONSE = 0x07,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_ALL_PIN_CODES_RESPONSE = 0x08,
|
||||
/** Returns the pass or fail value for the setting of the user status. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_USER_STATUS_RESPONSE = 0x09,
|
||||
/** Returns the user status for the specified user ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_USER_STATUS_RESPONSE = 0x0A,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_WEEKDAY_SCHEDULE_RESPONSE = 0x0B,
|
||||
/** Returns the weekly repeating schedule data for the specified schedule ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_WEEKDAY_SCHEDULE_RESPONSE = 0x0C,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_WEEKDAY_SCHEDULE_RESPONSE = 0x0D,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_YEAR_DAY_SCHEDULE_RESPONSE = 0x0E,
|
||||
/** Returns the weekly repeating schedule data for the specified schedule ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_YEAR_DAY_SCHEDULE_RESPONSE = 0x0F,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_YEAR_DAY_SCHEDULE_RESPONSE = 0x10,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_HOLIDAY_SCHEDULE_RESPONSE = 0x11,
|
||||
/** Returns the Holiday Schedule Entry for the specified Holiday ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_HOLIDAY_SCHEDULE_RESPONSE = 0x12,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_HOLIDAY_SCHEDULE_RESPONSE = 0x13,
|
||||
/** Returns the pass or fail value for the setting of the user type. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_USER_TYPE_RESPONSE = 0x14,
|
||||
/** Returns the user type for the specified user ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_USER_TYPE_RESPONSE = 0x15,
|
||||
/** Returns status of the Set RFID Code command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_SET_RFID_CODE_RESPONSE = 0x16,
|
||||
/** Returns the RFID code for the specified user ID. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_GET_RFID_CODE_RESPONSE = 0x17,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_RFID_CODE_RESPONSE = 0x18,
|
||||
/** Returns pass/fail of the command. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_CLEAR_ALL_RFID_CODES_RESPONSE = 0x19,
|
||||
/** The door lock server sends out operation event notification when the
|
||||
* event is triggered by the various event sources. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_OPERATION_EVENT_NOTIFICATION_ID = 0x20,
|
||||
/** The door lock server sends out a programming event notification
|
||||
* whenever a programming event takes place on the door lock. */
|
||||
ZB_ZCL_CMD_DOOR_LOCK_PROGRAMMING_EVENT_NOTIFICATION = 0x21,
|
||||
};
|
||||
|
||||
enum zb_zcl_door_lock_operation_event_source_e
|
||||
{
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_SOURCE_KEYPAD = 0x00,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_SOURCE_RF = 0x01,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_SOURCE_MANUAL = 0x02,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_SOURCE_RFID = 0x03,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_SOURCE_INDETERMINATE = 0xFF,
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Door lock cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR_RES, \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR_RES
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DOOR_LOCK_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR, \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DOOR_LOCK_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Default value for NumberOfLogRecordsSupported attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUMBER_OF_LOG_RECORDS_SUPPORTED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NumTotalUsers attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUM_TOTAL_USERS_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NumPINUsers attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUM_PIN_USERS_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NumberOfRFIDUsersSupported attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUMBER_OF_RFID_USERS_SUPPORTED_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
|
||||
/** @brief Default value for NumWeekDaySchedulePerUser attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUM_WEEK_DAY_SCHEDULE_PER_USER_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for NumYearDaySchedulePerUser attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUM_YEAR_DAY_SCHEDULE_PER_USER_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for NumHolidaySchedule attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_NUM_HOLIDAY_SCHEDULE_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for MaxPINLen attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_MAX_PIN_LEN_DEFAULT_VALUE ((zb_uint8_t)0x08)
|
||||
|
||||
/** @brief Default value for MinPINLen attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_MIN_PIN_LEN_DEFAULT_VALUE ((zb_uint8_t)0x04)
|
||||
|
||||
/** @brief Default value for MaxRFIDCodeLength attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_MAX_RFID_CODE_LENGTH_DEFAULT_VALUE ((zb_uint8_t)0x14)
|
||||
|
||||
/** @brief Default value for MinRFIDCodeLength attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_MIN_RFID_CODE_LENGTH_DEFAULT_VALUE ((zb_uint8_t)0x08)
|
||||
|
||||
/** @brief Default value for EnableLogging attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ENABLE_LOGGING_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for Language attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_LANGUAGE_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for LEDSettings attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_LED_SETTINGS_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for AutoRelockTime attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_AUTO_RELOCK_TIME_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for SoundVolume attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_SOUND_VOLUME_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for OperatingMode attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_OPERATING_MODE_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for OperationModesSupported attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_OPERATION_MODES_SUPPORTED_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DefaultConfigurationRegister attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_DEFAULT_CONFIGURATION_REGISTER_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for EnableLocalProgramming attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ENABLE_LOCAL_PROGRAMMING_DEFAULT_VALUE ((zb_bool_t)0x01)
|
||||
|
||||
/** @brief Default value for EnableOneTouchLocking attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ENABLE_ONE_TOUCH_LOCKING_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for EnableInsideStatusLED attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ENABLE_INSIDE_STATUS_LED_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for EnablePrivacyModeButton attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ENABLE_PRIVACY_MODE_BUTTON_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for WrongCodeEntryLimit attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_WRONG_CODE_ENTRY_LIMIT_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for UserCodeTemporaryDisableTime attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_USER_CODE_TEMPORARY_DISABLE_TIME_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for SendPINOverTheAir attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_SEND_PIN_OVER_THE_AIR_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for RequirePIN_RF_ID attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_REQUIRE_PIN_RF_ID_DEFAULT_VALUE ((zb_bool_t)0)
|
||||
|
||||
/** @brief Default value for SecurityLevel attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_SECURITY_LEVEL_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for AlarmMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_ALARM_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for KeypadOperationEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_KEYPAD_OPERATION_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RFOperationEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_RF_OPERATION_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for ManualOperationEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RFIDOperationEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_RFID_OPERATION_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for KeypadProgrammingEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_KEYPAD_PROGRAMMING_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RFProgrammingEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_RF_PROGRAMMING_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RFIDProgrammingEventMask attribute */
|
||||
#define ZB_ZCL_DOOR_LOCK_RFID_PROGRAMMING_EVENT_MASK_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
enum zb_zcl_door_lock_operation_event_code_e
|
||||
{
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_UNKNOWN = 0x00,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_LOCK = 0x01,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_UNLOCK = 0x02,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_KEY_LOCK = 0x08,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_KEY_UNLOCK = 0x09,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_MANUAL_LOCK = 0x0D,
|
||||
ZB_ZCL_DOOR_LOCK_OPERATION_EVENT_CODE_MANUAL_UNLOCK = 0x0E,
|
||||
};
|
||||
|
||||
enum zb_zcl_door_lock_keypad_operation_event_mask_e
|
||||
{
|
||||
ZB_ZCL_DOOR_LOCK_KEYPAD_OPERATION_EVENT_MASK_UNKNOWN = (1l << 0),
|
||||
ZB_ZCL_DOOR_LOCK_KEYPAD_OPERATION_EVENT_MASK_LOCK = (1l << 1),
|
||||
ZB_ZCL_DOOR_LOCK_KEYPAD_OPERATION_EVENT_MASK_UNLOCK = (1l << 2),
|
||||
};
|
||||
|
||||
enum zb_zcl_door_lock_rf_operation_event_mask_e
|
||||
{
|
||||
ZB_ZCL_DOOR_LOCK_RF_OPERATION_EVENT_MASK_UNKNOWN = (1l << 0),
|
||||
ZB_ZCL_DOOR_LOCK_RF_OPERATION_EVENT_MASK_LOCK = (1l << 1),
|
||||
ZB_ZCL_DOOR_LOCK_RF_OPERATION_EVENT_MASK_UNLOCK = (1l << 2),
|
||||
};
|
||||
|
||||
enum zb_zcl_door_lock_manual_operation_event_mask_e
|
||||
{
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_UNKNOWN = (1l << 0),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_THUMBTURN_LOCK = (1l << 1),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_THUMBTURN_UNLOCK = (1l << 2),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_KEY_LOCK = (1l << 4),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_KEY_UNLOCK = (1l << 5),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_MANUAL_LOCK = (1l << 9),
|
||||
ZB_ZCL_DOOR_LOCK_MANUAL_OPERATION_EVENT_MASK_MANUAL_UNLOCK = (1l << 10),
|
||||
};
|
||||
|
||||
|
||||
/*! @brief General macro for sending a "Door Lock" cluster command
|
||||
@param buffer to put command payload and headers to
|
||||
@param dst_addr address to send to
|
||||
@param dst_addr_mode destination address mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep source endpoint
|
||||
@param dis_default_resp "Disable default response" flag
|
||||
@param cb command send status callback
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_REQ(buffer, \
|
||||
dst_addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
dis_default_resp, \
|
||||
cb) \
|
||||
ZB_ZCL_SEND_CMD( buffer, \
|
||||
dst_addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
ZB_AF_HA_PROFILE_ID, \
|
||||
dis_default_resp, \
|
||||
ZB_ZCL_CLUSTER_ID_DOOR_LOCK, \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR, \
|
||||
cb)
|
||||
|
||||
/*! @brief General macro for sending a "Door Unlock" cluster command
|
||||
@param buffer to put command payload and headers to
|
||||
@param dst_addr address to send to
|
||||
@param dst_addr_mode destination address mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep source endpoint
|
||||
@param dis_default_resp "Disable default response" flag
|
||||
@param cb command send status callback
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_SEND_UNLOCK_DOOR_REQ(buffer, \
|
||||
dst_addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
dis_default_resp, \
|
||||
cb) \
|
||||
ZB_ZCL_SEND_CMD(buffer, \
|
||||
dst_addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
ZB_AF_HA_PROFILE_ID, \
|
||||
dis_default_resp, \
|
||||
ZB_ZCL_CLUSTER_ID_DOOR_LOCK, \
|
||||
ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR, cb)
|
||||
|
||||
/*! @brief Door Lock command send response macro
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param seq_num - sequence number
|
||||
@param status - result of command execute
|
||||
@param aps_secured - APS security mode
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_RES(buffer, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
seq_num, \
|
||||
status, \
|
||||
aps_secured) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, seq_num, ZB_ZCL_CMD_DOOR_LOCK_LOCK_DOOR_RES); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, status); \
|
||||
ZB_ZCL_FINISH_N_SEND_PACKET_NEW(buffer, \
|
||||
ptr, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_DOOR_LOCK, \
|
||||
NULL, \
|
||||
aps_secured, \
|
||||
ZB_FALSE, \
|
||||
0); \
|
||||
}
|
||||
|
||||
/*! @brief Door Unlock command send response macro
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param seq_num - sequence number
|
||||
@param status - result of command execute
|
||||
@param aps_secured - APS security mode
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_SEND_UNLOCK_DOOR_RES(buffer, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
seq_num, \
|
||||
status, \
|
||||
aps_secured) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, seq_num, ZB_ZCL_CMD_DOOR_LOCK_UNLOCK_DOOR_RES); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, status); \
|
||||
ZB_ZCL_FINISH_N_SEND_PACKET_NEW(buffer, \
|
||||
ptr, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_DOOR_LOCK, \
|
||||
NULL, \
|
||||
aps_secured, \
|
||||
ZB_FALSE, \
|
||||
0); \
|
||||
}
|
||||
|
||||
/*! Door lock commands response payload structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_door_lock_read_lock_door_res_payload_s
|
||||
{
|
||||
zb_uint8_t status; /*!< Command execution status */
|
||||
} ZB_PACKED_STRUCT zb_zcl_door_lock_read_lock_door_res_payload_t;
|
||||
|
||||
/*! @brief Door Lock response structured reading
|
||||
@param buffer - ID of the message buffer (of type zb_bufid_t) containing payload
|
||||
@return pointer to @ref zb_zcl_door_lock_read_lock_door_res_payload_s structure
|
||||
@attention returned pointer will point to the same data in the buffer thus being valid until
|
||||
buffer data will be overwritten.
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_READ_LOCK_DOOR_RES(buffer) \
|
||||
( (zb_buf_len((buffer)) < sizeof(zb_zcl_door_lock_read_lock_door_res_payload_t)) \
|
||||
? NULL \
|
||||
: (zb_zcl_door_lock_read_lock_door_res_payload_t*)zb_buf_begin((buffer)))
|
||||
|
||||
/*! Door unlock commands response payload structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_door_lock_read_unlock_door_res_payload_s
|
||||
{
|
||||
zb_uint8_t status; /*!< Command execution status */
|
||||
} ZB_PACKED_STRUCT zb_zcl_door_lock_read_unlock_door_res_payload_t;
|
||||
|
||||
/*! @brief Door unLock response structured reading
|
||||
@param buffer - ID of the message buffer (of type zb_buf_t)
|
||||
containing payload
|
||||
@return pointer to @ref zb_zcl_door_lock_read_unlock_door_res_payload_s structure
|
||||
@attention returned pointer will point to the same data in the buffer thus
|
||||
being valid until buffer data will be overwritten.
|
||||
*/
|
||||
#define ZB_ZCL_DOOR_LOCK_READ_UNLOCK_DOOR_RES(buffer) \
|
||||
( (zb_buf_len((buffer)) < sizeof(zb_zcl_door_lock_read_unlock_door_res_payload_t)) \
|
||||
? NULL \
|
||||
: (zb_zcl_door_lock_read_unlock_door_res_payload_t*)zb_buf_begin((buffer)))
|
||||
|
||||
/*! @} */ /* Door Lock cluster commands */
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name Door Lock cluster internals
|
||||
Internal structures for Door Lock cluster
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING | ZB_ZCL_ATTR_ACCESS_SCENE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_LOCK_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_ACTUATOR_ENABLED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_LOCK_RF_OPERATION_EVENT_MASK_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_DOOR_LOCK_RF_OPERATION_EVENT_MASK_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_16BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal @brief Number of attributes mandatory for reporting in Door Lock cluster */
|
||||
#define ZB_ZCL_DOOR_LOCK_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Door Lock cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL Door Lock cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_door_lock_init_server(void);
|
||||
void zb_zcl_door_lock_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_SERVER_ROLE_INIT zb_zcl_door_lock_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DOOR_LOCK_CLIENT_ROLE_INIT zb_zcl_door_lock_init_client
|
||||
|
||||
#endif /* ZB_ZCL_DOOR_LOCK_H */
|
||||
@@ -0,0 +1,753 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Demand Response and Load Control cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_DRLC_H_
|
||||
#define ZB_ZCL_DRLC_H_
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_DRLC
|
||||
* @{
|
||||
* @details This cluster provides an interface to the functionality of Smart
|
||||
* Energy Demand Response and Load Control.
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_DRLC */
|
||||
|
||||
/** @defgroup ZB_ZCL_DRLC_ATTRS_AND_ENUMS DRLC attributes and enumerations
|
||||
* @{
|
||||
* @details
|
||||
* This section describes DRLC client attributes and common cluster enumerations.
|
||||
*/
|
||||
|
||||
/** @brief Default value for DRLC cluster revision global attribute */
|
||||
#define ZB_ZCL_DRLC_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Maximal value for implemented DRLC cluster revision global attribute */
|
||||
#define ZB_ZCL_DRLC_CLUSTER_REVISION_MAX ZB_ZCL_DRLC_CLUSTER_REVISION_DEFAULT
|
||||
|
||||
/** DRLC Client attributes. @see SE spec, subclause D.2.3.2 */
|
||||
typedef enum zb_zcl_drlc_cli_attr_e
|
||||
{
|
||||
ZB_ZCL_ATTR_DRLC_UTILITY_ENROLLMENT_GROUP = 0x0000, /**< UtilityEnrollmentGroup attribute.
|
||||
* Provides for utilities to assign devices to groups.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_DRLC_START_RANDOMIZATION_MINUTES = 0x0001, /**< StartRandomizationMinutes attribute.
|
||||
* Represents the maximum number of minutes to be used
|
||||
* when randomizing the start of an event.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_DRLC_DURATION_RANDOMIZATION_MINUTES = 0x0002, /**< DurationRandomizationMinutes attribute.
|
||||
* Represents the maximum number of minutes to be used
|
||||
* when randomizing the duration of an event.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_DRLC_DEVICE_CLASS_VALUE = 0x0003, /**< DeviceClassValue attribute.
|
||||
* Identifies which bits the device will match in the
|
||||
* Device Class fields.
|
||||
*/
|
||||
} zb_zcl_drlc_cli_attr_t;
|
||||
|
||||
|
||||
/** Criticality Level value applied by the device.
|
||||
* @see SE spec, Table D-3
|
||||
*/
|
||||
typedef enum zb_zcl_drlc_criticality_levels_e
|
||||
{
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_0 = 0x00, /**< Reserved */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_1, /**< Green */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_2, /**< Level 1 */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_3, /**< Level 2 */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_4, /**< Level 3 */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_5, /**< Level 4 */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_6, /**< Level 5 */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_7, /**< Emergency */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_8, /**< Planned Outage */
|
||||
ZB_ZCL_DRLC_CRITICALITY_LEVEL_9 /**< Service Disconnect */
|
||||
} zb_zcl_drlc_criticality_levels_t;
|
||||
|
||||
/** DRLC device classes enumeration.
|
||||
* @see SE spec, Table D-2.
|
||||
*/
|
||||
typedef enum zb_zcl_drlc_device_class_e
|
||||
{
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_HVAC = 1 << 0, /**< HVAC Compressor or Furnace */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_STRIP_HEATER = 1 << 1, /**< Strip Heaters/Baseboard Heaters */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_WATER_HEATER = 1 << 2, /**< Water Heater */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_POOL_PUMP = 1 << 3, /**< Pool Pump/Spa/Jacuzzi */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_SMART_APPLIANCE = 1 << 4, /**< Smart Appliances */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_IRRIGATION_PUMP = 1 << 5, /**< Irrigation Pump */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_MCI_LOADS = 1 << 6, /**< Managed Commercial & Industrial (C&I) loads */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_SIMPLE_LOADS = 1 << 7, /**< Simple misc. (Residential On/Off) loads */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_EXTERIOR_LIGHTNING = 1 << 8, /**< Exterior Lighting */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_INTERIOR_LIGHTNING = 1 << 9, /**< Interior Lighting */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_ELECTRIC_VEHICLE = 1 << 10, /**< Electric Vehicle */
|
||||
ZB_ZCL_DRLC_DEVICE_CLASS_GENERATION_SYSTEMS = 1 << 11 /**< Generation Systems */
|
||||
} zb_zcl_drlc_device_class_t;
|
||||
|
||||
/** DRLC Event Status enum
|
||||
* @see SE spec, Table D-9
|
||||
*/
|
||||
typedef enum zb_zcl_drlc_event_status_e
|
||||
{
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_00 = 0x00, /**< Reserved for future use. */
|
||||
ZB_ZCL_DRLC_EVENT_LCE_RECEIVED, /**< Load Control Event command received */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_STARTED, /**< Event started */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_COMPLETED, /**< Event completed */
|
||||
ZB_ZCL_DRLC_EVENT_OPT_OUT, /**< User has chosen to “Opt-Out”, user will not participate in this event */
|
||||
ZB_ZCL_DRLC_EVENT_OPT_IN, /**< User has chosen to “Opt-In”, user will participate in this event */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_CANCELLED, /**< The event has been cancelled */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_SUPERSEDED, /**< The event has been superseded */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_PARTIALLY_OPT_OUT, /**< Event partially completed with User “Opt-Out”. */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_PARTIALLY_OPT_IN, /**< Event partially completed due to User “Opt-In”. */
|
||||
ZB_ZCL_DRLC_EVENT_EVENT_COMPLETED_NO_USER, /**< Event completed, no User participation (Previous “Opt-Out”). */
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_0B, /**< Reserved for future use. */
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_F7 = 0xF7, /**< Reserved for future use. */
|
||||
ZB_ZCL_DRLC_EVENT_REJECTED_INVALID_CANCEL_CMD, /**< Rejected - Invalid Cancel Command (Default) */
|
||||
ZB_ZCL_DRLC_EVENT_REJECTED_INVALID_EFFECTIVE_TIME, /**< Rejected - Invalid Cancel Command (Invalid Effective Time) */
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_FA, /**< Reserved */
|
||||
ZB_ZCL_DRLC_EVENT_REJECTED_EXPIRED, /**< Rejected - Event was received after it had expired@n (Current Time > Start Time + Duration) */
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_FC, /**< Reserved for future use. */
|
||||
ZB_ZCL_DRLC_EVENT_REJECTED_UNDEFINED_EVENT, /**< Rejected - Invalid Cancel Command (Undefined Event) */
|
||||
ZB_ZCL_DRLC_EVENT_REJECTED, /**< Load Control Event command Rejected */
|
||||
ZB_ZCL_DRLC_EVENT_RESERVED_FF /**< Reserved for future use. */
|
||||
} zb_zcl_drlc_event_status_t;
|
||||
|
||||
/** DRLC signature type enum */
|
||||
typedef enum zb_zcl_drlc_signature_type_e
|
||||
{
|
||||
ZB_ZCL_DRLC_LCE_NO_SIGNATURE = 0x00, /**< No Signature */
|
||||
ZB_ZCL_DRLC_LCE_SIGNATURE_ECDSA, /**< ECDSA */
|
||||
ZB_ZCL_DRLC_LCE_SIGNATURE_RESERVED /**< Reserved */
|
||||
} zb_zcl_drlc_signature_type_t;
|
||||
|
||||
/** @} */ /* ZB_ZCL_DRLC_ATTRS_AND_ENUMS */
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_DRLC_COMMANDS_STRUCTURES_AND_DEFINITIONS DRLC commands
|
||||
* @{
|
||||
* @details
|
||||
* This section describes all commands structures and data payloads.
|
||||
*/
|
||||
|
||||
|
||||
/** Commands are generated by DRLC Server.
|
||||
* @see SE spec, Table D-1
|
||||
*/
|
||||
typedef enum zb_zcl_drlc_srv_cmd_e
|
||||
{
|
||||
ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT = 0x00, /**< LoadControlEvent is generated when the ESI wants to control one or more
|
||||
* load control devices usually as the result of an energy curtailment
|
||||
* command from the Smart Energy Network.
|
||||
* @see zb_zcl_drlc_lce_payload_s
|
||||
*/
|
||||
|
||||
ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT = 0x01, /**< CancelLoadControlEvent is generated when the ESI wants to cancel
|
||||
* previously scheduled control of one or more load control devices, usually
|
||||
* as the result of an energy curtailment command from the Smart Energy
|
||||
* Network
|
||||
* @see zb_zcl_drlc_cancel_lce_payload_s
|
||||
*/
|
||||
|
||||
ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS = 0x02, /**< CancellAllLoadControlEvents is generated when the ESI wants to cancel all
|
||||
* events for control device(s)
|
||||
*/
|
||||
} zb_zcl_drlc_srv_cmd_t;
|
||||
|
||||
|
||||
/** Commands are generated by DRLC Client.
|
||||
* @see SE spec, Table D-8
|
||||
*/
|
||||
typedef enum zb_zcl_drlc_cli_cmd_e
|
||||
{
|
||||
ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS = 0x00, /**< ReportEventStatus is generated when the client device detects a change of
|
||||
* state for an active LoadControl event.
|
||||
* @see zb_zcl_drlc_report_event_status_payload_s
|
||||
*/
|
||||
|
||||
ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS = 0x01, /**< GetScheduledEvents is generated when the client device wishes to verify
|
||||
* the available LoadControl events.
|
||||
* @see zb_zcl_drlc_get_scheduled_events_payload_s
|
||||
*/
|
||||
} zb_zcl_drlc_cli_cmd_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* DRLC cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT, \
|
||||
ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT, \
|
||||
ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DRLC_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS, \
|
||||
ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_DRLC_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/* Payload description */
|
||||
|
||||
/** @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent" command payload.
|
||||
* @see SE spec, Figure D-2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_drlc_lce_payload_s {
|
||||
|
||||
/** Unique identifier generated by the Energy provider.
|
||||
* The value of this field allows matching of Event reports
|
||||
* with a specific Demand Response and Load Control event.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** Bit encoded field representing the Device Class to apply the
|
||||
* current Load Control Event. Each bit, if set individually or
|
||||
* in combination, indicates the class device(s) needing to
|
||||
* participate in the event.
|
||||
*/
|
||||
zb_uint16_t device_class; /* (M) */
|
||||
|
||||
/** This field can be used in conjunction with the Device Class bits
|
||||
* for providing a mechanism to direct Load Control Events
|
||||
* to groups of Devices.
|
||||
*/
|
||||
zb_uint8_t utility_enrollment_group; /* (M) */
|
||||
|
||||
/** UTC Timestamp representing when the event is scheduled to start.
|
||||
* A start time of 0x00000000 is a special time denoting “now.”
|
||||
*/
|
||||
zb_uint32_t start_time; /* (M) */
|
||||
|
||||
/** Duration of this event in number of minutes.
|
||||
* Maximum value is 1440 (one day).
|
||||
*/
|
||||
zb_uint16_t duration_in_minutes; /* (M) */
|
||||
|
||||
/** This field defines the level of criticality of event. The
|
||||
* action for an event can be solely based on this value,
|
||||
* or combination with other Load Control Event fields.
|
||||
*/
|
||||
zb_uint8_t criticality_level; /* (M) */
|
||||
|
||||
/** Requested offset to apply to the normal cooling setpoint
|
||||
* at the time of the start of the event in + 0.1 Celsius.
|
||||
*/
|
||||
zb_uint8_t cooling_temperature_offset; /* (O) - use 0xff if optional */
|
||||
|
||||
/** Requested offset to apply to the normal heating setpoint
|
||||
* at the time of the start of the event in + 0.1 Celsius.
|
||||
*/
|
||||
zb_uint8_t heating_temperature_offset; /* (O) - use 0xff if optional */
|
||||
|
||||
/** Requested cooling set point in 0.01 degrees Celsius. */
|
||||
zb_int16_t cooling_temperature_set_point; /* (O) - use 0x8000 if optional */
|
||||
|
||||
/** Requested heating set point in 0.01 degrees Celsius. */
|
||||
zb_int16_t heating_temperature_set_point; /* (O) - use 0x8000 if optional */
|
||||
|
||||
/** Defines a maximum energy usage limit as a percentage of
|
||||
* the client implementations specific average energy usage.
|
||||
*/
|
||||
zb_int8_t average_load_adjustment_percentage; /* (O) */
|
||||
|
||||
/** Defines the maximum on state duty cycle as a percentage of time. */
|
||||
zb_uint8_t duty_cycle; /* (O) */
|
||||
|
||||
/** Identifies additional control options for the event. */
|
||||
zb_uint8_t event_control; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_drlc_lce_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_drlc_lce_payload_t))
|
||||
|
||||
/** @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent" command payload
|
||||
* @see SE spec, Figure D-3
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_drlc_cancel_lce_payload_s {
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** Unique identifier generated by the Energy provider. The value of
|
||||
* this field allows matching of Event reports with a specific Demand Response
|
||||
* and Load Control event.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** Bit encoded field representing the Device Class to apply the
|
||||
* current Load Control Event. Each bit, if set individually or in combination,
|
||||
* indicates the class device(s) needing to participate in the event.
|
||||
*/
|
||||
zb_uint16_t device_class; /* (M) */
|
||||
|
||||
/** This field can be used in conjunction with the Device Class bits
|
||||
* for providing a mechanism to direct Load Control Events
|
||||
* to groups of Devices.
|
||||
*/
|
||||
zb_uint8_t utility_enrollment_group; /* (M) */
|
||||
|
||||
/** This field is used to indicate that the Event is currently in process and
|
||||
* a cancel command is received.*/
|
||||
zb_uint8_t cancel_control; /* (M) */
|
||||
|
||||
/** UTC Timestamp representing when the canceling of the event is
|
||||
* scheduled to start. An effective time of 0x00000000 is a special
|
||||
* time denoting “now.”
|
||||
*/
|
||||
zb_uint32_t effective_time; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_drlc_cancel_lce_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_drlc_cancel_lce_payload_t))
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancelAllLoadControlEvents" command payload
|
||||
* @see SE spec, Figure D-3
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_drlc_cancel_alce_payload_s {
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** Where the Cancel Control field indicates that randomization is to be used, the receiving device should first
|
||||
* check whether Duration Time was to be randomized and, if so, termination of the event should be adjusted
|
||||
* according to the value of the DurationRandomizationMinutes attribute.
|
||||
*/
|
||||
zb_uint8_t cancel_control; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_drlc_cancel_alce_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_drlc_cancel_alce_payload_t))
|
||||
|
||||
/** @ref ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command payload
|
||||
* @see SE spec, Figure D-5
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_drlc_report_event_status_payload_s {
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** Unique identifier generated by the Energy provider. The value of
|
||||
* this field allows matching of Event reports with a specific Demand Response
|
||||
* and Load Control event.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** This field stores value from set of event statuses*/
|
||||
zb_uint8_t event_status; /* (M) */
|
||||
|
||||
/** UTC Timestamp representing when the event status
|
||||
* occurred. This field shall not use the value of 0x00000000.
|
||||
*/
|
||||
zb_uint32_t event_status_time; /* (M) */
|
||||
|
||||
/** Criticality Level value applied by the device */
|
||||
zb_uint8_t criticality_level_applied; /* (M) */
|
||||
|
||||
/** Defines Cooling Temperature Set Point value applied by the device.
|
||||
* The value 0x8000 means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_uint16_t cooling_temperature_set_point_applied; /* (O) */
|
||||
|
||||
/** Defines Heating Temperature Set Point value applied by the device.
|
||||
* The value 0x8000 means that this field has not been used by
|
||||
* the end device.
|
||||
*/
|
||||
zb_uint16_t heating_temperature_set_point_applied; /* (O) */
|
||||
|
||||
/** Defines Average Load Adjustment Percentage value applied by the device.
|
||||
* The value 0x80 means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_int8_t average_load_adjustment_percentage_applied; /* (O) */
|
||||
|
||||
/** Defines the maximum on state duty cycle applied by the device.
|
||||
* The value 0xFF means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_uint8_t duty_cycle_applied; /* (O) */
|
||||
|
||||
/** Identifies additional control options for the event. */
|
||||
zb_uint8_t event_control; /* (M) */
|
||||
|
||||
/** This field is used to enumerate the type of algorithm use to create the signature.*/
|
||||
zb_uint8_t signature_type; /* (M) */
|
||||
|
||||
/** A non-repudiation signature created by using the Matyas-Meyer-Oseas
|
||||
* hash function used in conjunction with ECDSA.
|
||||
*/
|
||||
zb_uint8_t signature[42]; /* (O) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_drlc_report_event_status_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_drlc_report_event_status_payload_t))
|
||||
|
||||
/** @ref ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS "GetScheduledEvents" command payload
|
||||
* @see SE spec, Figure D-6
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_drlc_get_scheduled_events_payload_s {
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** UTC Timestamp representing the minimum Start Time of events that shall be
|
||||
* matched and sent by the Server. A Start Time of 0x00000000 has no special
|
||||
* meaning.
|
||||
*/
|
||||
zb_uint32_t start_time; /* (M) */
|
||||
|
||||
/** Represents the maximum number of events to be sent. A value of 0 indicates
|
||||
* no maximum limit.
|
||||
*/
|
||||
zb_uint8_t number_of_events; /* (M) */
|
||||
|
||||
/** Represents the minimum Issuer Event ID of events to be matched and sent
|
||||
* by the server with the same Start Time as the Get Scheduled Events command.
|
||||
* A value of 0xFFFFFFFF indicates this field will not be used.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (O) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_drlc_get_scheduled_events_payload_t;
|
||||
|
||||
/** Initialize @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent" command @ref zb_zcl_drlc_lce_payload_t payload*/
|
||||
#define ZB_ZCL_DRLC_LCE_PAYLOAD_INIT \
|
||||
(zb_zcl_drlc_lce_payload_t) \
|
||||
{ \
|
||||
.cooling_temperature_offset = 0xFF, \
|
||||
.heating_temperature_offset = 0xFF, \
|
||||
.cooling_temperature_set_point = (zb_int16_t) 0x8000, \
|
||||
.heating_temperature_set_point = (zb_int16_t) 0x8000, \
|
||||
.average_load_adjustment_percentage = (zb_int8_t) 0x80, \
|
||||
.duty_cycle = 0xFF, \
|
||||
}
|
||||
|
||||
/** Initialize @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent" command @ref zb_zcl_drlc_cancel_lce_payload_t payload */
|
||||
#define ZB_ZCL_DRLC_CANCEL_LCE_PAYLOAD_INIT \
|
||||
(zb_zcl_drlc_cancel_lce_payload_t) {0}
|
||||
|
||||
/** Initialize @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancelAllLoadControlEvents" command @ref zb_zcl_drlc_cancel_alce_payload_t payload */
|
||||
#define ZB_ZCL_DRLC_CANCEL_ALCE_PAYLOAD_INIT \
|
||||
(zb_zcl_drlc_cancel_alce_payload_t) {0}
|
||||
|
||||
/** Initialize @ref ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command @ref zb_zcl_drlc_report_event_status_payload_t payload */
|
||||
#define ZB_ZCL_DRLC_REPORT_EVENT_STATUS_PAYLOAD_INIT \
|
||||
(zb_zcl_drlc_report_event_status_payload_t) \
|
||||
{ \
|
||||
.cooling_temperature_set_point_applied = (zb_uint16_t) 0x8000, \
|
||||
.heating_temperature_set_point_applied = (zb_uint16_t) 0x8000, \
|
||||
.average_load_adjustment_percentage_applied = (zb_int8_t) 0x80, \
|
||||
.duty_cycle_applied = (zb_uint8_t) 0xFF, \
|
||||
.signature = \
|
||||
{ \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
|
||||
}, \
|
||||
}
|
||||
|
||||
/** Check if some size in range of variable size of specified payload.
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_GET_SCHEDULED_EVENTS_PAYLOAD_SIZE_IS_VALID(size) \
|
||||
((size) >= ((zb_int16_t)sizeof(zb_zcl_drlc_get_scheduled_events_payload_t) - \
|
||||
(zb_int16_t)ZB_SIZEOF_FIELD(zb_zcl_drlc_get_scheduled_events_payload_t, issuer_event_id)))
|
||||
|
||||
/** Initialize @ref ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS "GetScheduledEvents" command @ref zb_zcl_drlc_get_scheduled_events_payload_t payload */
|
||||
#define ZB_ZCL_DRLC_CMD_GET_SCHEDULED_EVENTS_PAYLOAD_INIT \
|
||||
(zb_zcl_drlc_get_scheduled_events_payload_t) \
|
||||
{ \
|
||||
.issuer_event_id = 0xFFFFFFFF, \
|
||||
}
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent" command.
|
||||
* On sender's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with @ref ZB_ZCL_DRLC_GET_SCHEDULED_EVENTS_CB_ID
|
||||
* callback id on reception of @ref ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS "GetScheduledEvents" command.
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_LOAD_CONTROL_EVENT_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_drlc_lce_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Handle @ref ZB_ZCL_DRLC_GET_SCHEDULED_EVENTS_CB_ID
|
||||
* @snippet se/energy_service_interface/se_esi_zc.c handle_get_scheduled_events
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent" command
|
||||
* @snippet se/energy_service_interface/se_esi_zc.c esi_dev_cmd_send_lce_event1
|
||||
*/
|
||||
void zb_drlc_server_send_load_control_event(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_drlc_lce_payload_t *payload, zb_callback_t cb);
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent" command.
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_CANCEL_LOAD_CONTROL_EVENT_CB_ID
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_drlc_cancel_lce_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent" command
|
||||
* @snippet se/energy_service_interface/se_esi_zc.c esi_dev_cmd_send_lce_event2
|
||||
*/
|
||||
void zb_drlc_server_send_cancel_load_control_event(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_drlc_cancel_lce_payload_t *payload, zb_callback_t cb);
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" command.
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_CANCEL_ALL_LOAD_CONTROL_EVENTS_CB_ID
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload: pointer to zb_uint8_t, where
|
||||
* "Cancel Control" field value is placed (see SE spec, D.2.2.3.3.1).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" command
|
||||
* @snippet se/energy_service_interface/se_esi_zc.c esi_dev_cmd_send_lce_event3
|
||||
*/
|
||||
void zb_drlc_server_send_cancel_all_load_control_events(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_uint8_t *payload, zb_callback_t cb);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command.
|
||||
* On sender's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with one of @ref ZB_ZCL_DRLC_LOAD_CONTROL_EVENT_CB_ID,
|
||||
* @ref ZB_ZCL_DRLC_CANCEL_LOAD_CONTROL_EVENT_CB_ID, @ref ZB_ZCL_DRLC_CANCEL_ALL_LOAD_CONTROL_EVENTS_CB_ID
|
||||
* callback ids on reception of @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent",
|
||||
* @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent",
|
||||
* @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" commands respectively.
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_REPORT_EVENT_STATUS_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_drlc_report_event_status_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Handle @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" command
|
||||
* @snippet se/in_home_display/se_ihd_zr.c ihd_handle_cancel_all_load_control_events
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_CLI_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command
|
||||
* @snippet se/in_home_display/se_ihd_zr.c ihd_send_report_event_status
|
||||
*/
|
||||
void zb_drlc_client_send_report_event_status(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_drlc_report_event_status_payload_t *payload, zb_callback_t cb);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_SEND_CMD_REPORT_EVENT_STATUS_TSN "ReportEventStatus" command.
|
||||
* On sender's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with one of @ref ZB_ZCL_DRLC_LOAD_CONTROL_EVENT_CB_ID,
|
||||
* @ref ZB_ZCL_DRLC_CANCEL_LOAD_CONTROL_EVENT_CB_ID, @ref ZB_ZCL_DRLC_CANCEL_ALL_LOAD_CONTROL_EVENTS_CB_ID
|
||||
* callback ids on reception of @ref ZB_ZCL_DRLC_SRV_CMD_LOAD_CONTROL_EVENT "LoadControlEvent",
|
||||
* @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_LOAD_CONTROL_EVENT "CancelLoadControlEvent",
|
||||
* @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" commands respectively.
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_REPORT_EVENT_STATUS_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_drlc_report_event_status_payload_t).
|
||||
* @param tsn - transaction sequence number of response
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Handle @ref ZB_ZCL_DRLC_SRV_CMD_CANCEL_ALL_LOAD_CONTROL_EVENTS "CancellAllLoadControlEvents" command
|
||||
* @snippet se/in_home_display/se_ihd_zr.c ihd_handle_cancel_all_load_control_events
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_SEND_CMD_REPORT_EVENT_STATUS_TSN "ReportEventStatus" command
|
||||
* @snippet se/in_home_display/se_ihd_zr.c ihd_send_report_event_status
|
||||
*/
|
||||
void zb_drlc_client_send_report_event_status_tsn(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_drlc_report_event_status_payload_t *payload, zb_uint8_t tsn, zb_callback_t cb);
|
||||
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS "GetScheduledEvents" command.
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_DRLC_GET_SCHEDULED_EVENTS_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_drlc_get_scheduled_events_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Example of sending @ref ZB_ZCL_DRLC_CLI_CMD_GET_SCHEDULED_EVENTS "GetScheduledEvents"
|
||||
* @snippet se/in_home_display/se_ihd_zr.c ihd_dev_cmd_get_scheduled_events
|
||||
*/
|
||||
void zb_drlc_client_send_get_scheduled_events(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr, zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_drlc_get_scheduled_events_payload_t *payload, zb_callback_t cb);
|
||||
|
||||
/** Macro for call @ref zb_drlc_server_send_load_control_event function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_LOAD_CONTROL_EVENT(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload ) \
|
||||
zb_drlc_server_send_load_control_event(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_drlc_server_send_cancel_load_control_event function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_CANCEL_LCE(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload ) \
|
||||
zb_drlc_server_send_cancel_load_control_event(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_drlc_server_send_cancel_all_load_control_events function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_CANCEL_ALL_LCE(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload ) \
|
||||
zb_drlc_server_send_cancel_all_load_control_events(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_drlc_client_send_get_scheduled_events function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_GET_SCHEDULED_EVENTS(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload ) \
|
||||
zb_drlc_client_send_get_scheduled_events(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_drlc_client_send_report_event_status function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_REPORT_EVENT_STATUS( _param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload ) \
|
||||
zb_drlc_client_send_report_event_status(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_drlc_client_send_report_event_status_tsn function
|
||||
*/
|
||||
#define ZB_ZCL_DRLC_SEND_CMD_REPORT_EVENT_STATUS_TSN( _param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, _tsn ) \
|
||||
zb_drlc_client_send_report_event_status_tsn(_param, \
|
||||
_dst_addr, _dst_addr_mode, _dst_ep, _src_ep, _payload, _tsn, NULL)
|
||||
|
||||
/** @} */ /* ZB_ZCL_DRLC_COMMANDS_STRUCTURES_AND_DEFINITIONS */
|
||||
|
||||
/** @brief Declare attribute list for DRLC cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] utility_enrollment_group - pointer to variable to store @ref ZB_ZCL_ATTR_DRLC_UTILITY_ENROLLMENT_GROUP value
|
||||
* @param[in] start_randomization_munutes - pointer to variable to store @ref ZB_ZCL_ATTR_DRLC_START_RANDOMIZATION_MINUTES value
|
||||
* @param[in] duration_randomization_minutes - pointer to variable to store @ref ZB_ZCL_ATTR_DRLC_DURATION_RANDOMIZATION_MINUTES value
|
||||
* @param[in] device_class - pointer to variable to store @ref ZB_ZCL_ATTR_DRLC_DEVICE_CLASS_VALUE value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DRLC_ATTRIB_LIST(attr_list, utility_enrollment_group, \
|
||||
start_randomization_munutes, duration_randomization_minutes, device_class) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_DRLC) \
|
||||
ZB_ZCL_SET_ATTR_DESC_M(ZB_ZCL_ATTR_DRLC_UTILITY_ENROLLMENT_GROUP, (utility_enrollment_group), ZB_ZCL_ATTR_TYPE_8BIT, ZB_ZCL_ATTR_ACCESS_READ_WRITE) \
|
||||
ZB_ZCL_SET_ATTR_DESC_M(ZB_ZCL_ATTR_DRLC_START_RANDOMIZATION_MINUTES, (start_randomization_munutes), ZB_ZCL_ATTR_TYPE_8BIT, ZB_ZCL_ATTR_ACCESS_READ_WRITE) \
|
||||
ZB_ZCL_SET_ATTR_DESC_M(ZB_ZCL_ATTR_DRLC_DURATION_RANDOMIZATION_MINUTES, (duration_randomization_minutes), ZB_ZCL_ATTR_TYPE_8BIT, ZB_ZCL_ATTR_ACCESS_READ_WRITE) \
|
||||
ZB_ZCL_SET_ATTR_DESC_M(ZB_ZCL_ATTR_DRLC_DEVICE_CLASS_VALUE, (device_class), ZB_ZCL_ATTR_TYPE_16BIT, ZB_ZCL_ATTR_ACCESS_READ_WRITE) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
|
||||
/** Initialize @ref zb_zcl_drlc_client_attrs_s DRLC cluster's attributes */
|
||||
#define ZB_ZCL_DECLARE_DRLC_ATTR_LIST_INIT \
|
||||
(zb_zcl_drlc_client_attrs_t) \
|
||||
{ .utility_enrollment_group = 0, \
|
||||
.start_randomization_munutes = 0x1e, \
|
||||
.duration_randomization_minutes = 0, }
|
||||
|
||||
|
||||
/**
|
||||
* @brief DRLC client cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_drlc_client_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_DRLC_UTILITY_ENROLLMENT_GROUP
|
||||
* @see ZB_ZCL_ATTR_DRLC_UTILITY_ENROLLMENT_GROUP
|
||||
*/
|
||||
zb_uint8_t utility_enrollment_group;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DRLC_START_RANDOMIZATION_MINUTES
|
||||
* @see ZB_ZCL_ATTR_DRLC_START_RANDOMIZATION_MINUTES
|
||||
*/
|
||||
zb_uint8_t start_randomization_munutes;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DRLC_DURATION_RANDOMIZATION_MINUTES
|
||||
* @see ZB_ZCL_ATTR_DRLC_DURATION_RANDOMIZATION_MINUTES
|
||||
*/
|
||||
zb_uint8_t duration_randomization_minutes;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_DRLC_DEVICE_CLASS_VALUE
|
||||
* @see ZB_ZCL_ATTR_DRLC_DEVICE_CLASS_VALUE
|
||||
*/
|
||||
zb_uint16_t device_class_value;
|
||||
} zb_zcl_drlc_client_attrs_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for DRLC cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_drlc_client_attrs_t type (containing DRLC cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_DRLC_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_DRLC_ATTRIB_LIST(attr_list, &attrs.utility_enrollment_group, \
|
||||
&attrs.start_randomization_munutes, &attrs.duration_randomization_minutes, \
|
||||
&attrs.device_class_value)
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
/** Internal handler for DRLC Cluster commands */
|
||||
|
||||
void zb_zcl_drlc_init_server(void);
|
||||
void zb_zcl_drlc_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_SERVER_ROLE_INIT zb_zcl_drlc_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_DRLC_CLIENT_ROLE_INIT zb_zcl_drlc_init_client
|
||||
|
||||
#endif /* ZB_ZCL_DRLC_H_ */
|
||||
@@ -0,0 +1,973 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Electrical Measurement cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ELECTRICAL_MEASUREMENT_H
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT */
|
||||
|
||||
/*! @addtogroup ZB_ZCL_ELECTRICAL_MEASUREMENT
|
||||
@{
|
||||
@name Electrical Measurement cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @brief Default value for Electrical Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/*! @brief Electrical Measurement cluster attribute identifiers
|
||||
@see HA spec, subclause 9.2.2.2
|
||||
*/
|
||||
enum zb_zcl_electrical_measurement_attr_e
|
||||
{
|
||||
/** This attribute indicates a device s measurement capabilities. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASUREMENT_TYPE_ID = 0x0000,
|
||||
/** The DCVoltage attribute represents the most recent DC voltage reading in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_ID = 0x0100,
|
||||
/** The DCVoltageMin attribute represents the lowest DC voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MIN_ID = 0x0101,
|
||||
/** The DCVoltageMax attribute represents the highest DC voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MAX_ID = 0x0102,
|
||||
/** The DCCurrent attribute represents the most recent DC current reading in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_ID = 0x0103,
|
||||
/** The DCCurrentMin attribute represents the lowest DC current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_MIN_ID = 0x0104,
|
||||
/** The DCCurrentMax attribute represents the highest DC current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_MAX_ID = 0x0105,
|
||||
/** The @e DCPower attribute represents the most recent DC power reading in @e Watts (W) */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DCPOWER_ID = 0x0106,
|
||||
/** The DCPowerMin attribute represents the lowest DC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_POWER_MIN_ID = 0x0107,
|
||||
/** The DCPowerMax attribute represents the highest DC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_POWER_MAX_ID = 0x0108,
|
||||
/** The DCVoltageMultiplier provides a value to be multiplied against the DCVoltage,
|
||||
* DCVoltageMin, and DCVoltageMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MULTIPLIER_ID = 0x0200,
|
||||
/** The DCVoltageDivisor provides a value to be divided against the DCVoltage,
|
||||
* DCVoltageMin, and DCVoltageMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_DIVISOR_ID = 0x0201,
|
||||
/** The DCCurrentMultiplier provides a value to be multiplied against the DCCurrent,
|
||||
* DCCurrentMin, and DCCurrentMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_MULTIPLIER_ID = 0x0202,
|
||||
/** The DCCurrentDivisor provides a value to be divided against the DCCurrent,
|
||||
* DCCurrentMin, and DCCurrentMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_DIVISOR_ID = 0x0203,
|
||||
/** The DCPowerMultiplier provides a value to be multiplied against the DCPower,
|
||||
* DCPowerMin, and DCPowerMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_POWER_MULTIPLIER_ID = 0x0204,
|
||||
/** The DCPowerDivisor provides a value to be divided against the DCPower,
|
||||
* DCPowerMin, and DCPowerMax attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_POWER_DIVISOR_ID = 0x0205,
|
||||
/** The ACFrequency attribute represents the most recent AC Frequency reading in Hertz (Hz). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_ID = 0x0300,
|
||||
/** The ACFrequencyMin attribute represents the lowest AC Frequency value measured in Hertz (Hz). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MIN_ID = 0x0301,
|
||||
/** The ACFrequencyMax attribute represents the highest AC Frequency value measured in Hertz (Hz). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MAX_ID = 0x0302,
|
||||
/** The NeutralCurrent attribute represents the AC neutral (Line-Out) current value
|
||||
* at the moment in time the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_NEUTRAL_CURRENT_ID = 0x0303,
|
||||
/** Active power represents the current demand of active power delivered or
|
||||
* received at the premises, in @e kW */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_TOTAL_ACTIVE_POWER_ID = 0x0304,
|
||||
/** Reactive power represents the current demand of reactive power delivered or
|
||||
* received at the premises, in kVAr. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_TOTAL_REACTIVE_POWER_ID = 0x0305,
|
||||
/** Represents the current demand of apparent power, in @e kVA */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_TOTAL_APPARENT_POWER_ID = 0x0306,
|
||||
/** Attribute represent the most recent 1st harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED1ST_HARMONIC_CURRENT_ID = 0x0307,
|
||||
/** Attribute represent the most recent 3rd harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED3RD_HARMONIC_CURRENT_ID = 0x0308,
|
||||
/** Attribute represent the most recent 5th harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED5TH_HARMONIC_CURRENT_ID = 0x0309,
|
||||
/** Attribute represent the most recent 7th harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED7TH_HARMONIC_CURRENT_ID = 0x030a,
|
||||
/** Attribute represent the most recent 9th harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED9TH_HARMONIC_CURRENT_ID = 0x030b,
|
||||
/** Attribute represent the most recent 11th harmonic current reading in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED11TH_HARMONIC_CURRENT_ID = 0x030c,
|
||||
/** Attribute represent the most recent phase of the 1st harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE1ST_HARMONIC_CURRENT_ID = 0x030d,
|
||||
/** Attribute represent the most recent phase of the 3rd harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE3RD_HARMONIC_CURRENT_ID = 0x030e,
|
||||
/** Attribute represent the most recent phase of the 5th harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE5TH_HARMONIC_CURRENT_ID = 0x030f,
|
||||
/** Attribute represent the most recent phase of the 7th harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE7TH_HARMONIC_CURRENT_ID = 0x0310,
|
||||
/** Attribute represent the most recent phase of the 9th harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE9TH_HARMONIC_CURRENT_ID = 0x0311,
|
||||
/** Attribute represent the most recent phase of the 11th harmonic current reading
|
||||
* in an AC frequency. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASURED_PHASE11TH_HARMONIC_CURRENT_ID = 0x0312,
|
||||
/** Provides a value to be multiplied against the ACFrequency attribute. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MULTIPLIER_ID = 0x0400,
|
||||
/** Provides a value to be divided against the ACFrequency attribute. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_DIVISOR_ID = 0x0401,
|
||||
/** Provides a value to be multiplied against a raw or uncompensated
|
||||
* sensor count of power being measured by the metering device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_MULTIPLIER_ID = 0x0402,
|
||||
/** Provides a value to divide against the results of applying the
|
||||
* @e Multiplier attribute against a raw or uncompensated sensor
|
||||
* count of power being measured by the metering device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_DIVISOR_ID = 0x0403,
|
||||
/** Represents the unit value for the MeasuredNthHarmonicCurrent attribute in the
|
||||
* format MeasuredNthHarmonicCurrent * 10 ^ HarmonicCurrentMultiplier amperes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_HARMONIC_CURRENT_MULTIPLIER_ID = 0x0404,
|
||||
/** Represents the unit value for the MeasuredPhaseNthHarmonicCurrent attribute in
|
||||
* the format MeasuredPhaseNthHarmonicCurrent * 10 ^ PhaseHarmonicCurrentMultiplier
|
||||
* degrees. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_PHASE_HARMONIC_CURRENT_MULTIPLIER_ID = 0x0405,
|
||||
/** Represents the single phase or Phase A, AC line current (Square root of active and
|
||||
* reactive current) value at the moment in time the attribute is read, in @e Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_LINE_CURRENT_ID = 0x0501,
|
||||
/** Represents the single phase or Phase A, AC active/resistive current value at the
|
||||
* moment in time the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_ID = 0x0502,
|
||||
/** Represents the single phase or Phase A, AC reactive current value at the moment
|
||||
* in time the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_ID = 0x0503,
|
||||
/** Represents the most recent RMS voltage reading in @e Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_ID = 0x0505,
|
||||
/** Represents the lowest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_ID = 0x0506,
|
||||
/** Represents the highest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_ID = 0x0507,
|
||||
/** Represents the most recent RMS current reading in @e Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSCURRENT_ID = 0x0508,
|
||||
/** Represents the lowest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_ID = 0x0509,
|
||||
/** Represents the highest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_ID = 0x050a,
|
||||
/** Represents the single phase or Phase A, current demand of active power delivered or
|
||||
* received at the premises, in @e Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_ID = 0x050B,
|
||||
/** Represents the lowest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_ID = 0x050c,
|
||||
/** Represents the highest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_ID = 0x050d,
|
||||
/** Represents the single phase or Phase A, current demand of reactive power delivered
|
||||
* or received at the premises, in VAr. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_ID = 0x050e,
|
||||
/** Represents the single phase or Phase A, current demand of apparent (Square root
|
||||
* of active and reactive power) power, in @e VA. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_APPARENT_POWER_ID = 0x050F,
|
||||
/** Contains the single phase or PhaseA, Power Factor ratio in 1/100th. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_FACTOR_ID = 0x0510,
|
||||
/** The Period in seconds that the RMS voltage is averaged over. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_ID = 0x0511,
|
||||
/** The number of times the average RMS voltage, has been above the AverageRMS
|
||||
* OverVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_ID = 0x0512,
|
||||
/** The number of times the average RMS voltage, has been below the AverageRMS
|
||||
* underVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_ID = 0x0513,
|
||||
/** The duration in seconds used to measure an extreme over voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_ID = 0x0514,
|
||||
/** The duration in seconds used to measure an extreme under voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_ID = 0x0515,
|
||||
/** The duration in seconds used to measure a voltage sag condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_ID = 0x0516,
|
||||
/** The duration in seconds used to measure a voltage swell condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_ID = 0x0517,
|
||||
/** Provides a value to be multiplied against the @e InstantaneousVoltage and @e
|
||||
* RMSVoltage attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACVOLTAGE_MULTIPLIER_ID = 0x0600,
|
||||
/** Provides a value to be divided against the @e InstantaneousVoltage and
|
||||
* @e RMSVoltage attributes. This attribute must be used in conjunction with the @e
|
||||
* ACVoltageMultiplier attribute. 0x0000 is an invalid value for this attribute. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACVOLTAGE_DIVISOR_ID = 0x0601,
|
||||
/** Provides a value to be multiplied against the @e InstantaneousCurrent and @e
|
||||
* RMSCurrent attributes */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACCURRENT_MULTIPLIER_ID = 0x0602,
|
||||
/** Provides a value to be divided against the @e ACCurrent, @e InstantaneousCurrent
|
||||
* and @e RMSCurrent attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACCURRENT_DIVISOR_ID = 0x0603,
|
||||
/** Provides a value to be multiplied against the @e InstantaneousPower and @e
|
||||
* ActivePower attributes */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_MULTIPLIER_ID = 0x0604,
|
||||
/** Provides a value to be divided against the @e InstantaneousPower and @e
|
||||
* ActivePower attributes. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_DIVISOR_ID = 0x0605,
|
||||
/** Specifies which configurable alarms may be generated. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_OVERLOAD_ALARMS_MASK_ID = 0x0700,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* voltage supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_OVERLOAD_ID = 0x0701,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* current supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DC_CURRENT_OVERLOAD_ID = 0x0702,
|
||||
/** Specifies which configurable alarms may be generated. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_ALARMS_MASK_ID = 0x0800,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* voltage supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_VOLTAGE_OVERLOAD_ID = 0x0801,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* current supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_CURRENT_OVERLOAD_ID = 0x0802,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* active power supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_ACTIVE_POWER_OVERLOAD_ID = 0x0803,
|
||||
/** Specifies the alarm threshold, set by the manufacturer, for the maximum output
|
||||
* reactive power supported by device. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AC_REACTIVE_POWER_OVERLOAD_ID = 0x0804,
|
||||
/** The average RMS voltage above which an over voltage condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_ID = 0x0805,
|
||||
/** The average RMS voltage below which an under voltage condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_ID = 0x0806,
|
||||
/** The RMS voltage above which an extreme under voltage condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_ID = 0x0807,
|
||||
/** The RMS voltage below which an extreme under voltage condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_ID = 0x0808,
|
||||
/** The RMS voltage below which a sag condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_ID = 0x0809,
|
||||
/** The RMS voltage above which a swell condition is reported. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_ID = 0x080a,
|
||||
/** Represents the Phase B, AC line current (Square root sum of active and reactive
|
||||
* currents) value at the moment in time the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_LINE_CURRENT_PH_B_ID = 0x0901,
|
||||
/** Represents the Phase B, AC active/resistive current value at the moment in time
|
||||
* the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_PH_B_ID = 0x0902,
|
||||
/** Represents the Phase B, AC reactive current value at the moment in time the
|
||||
* attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_PH_B_ID = 0x0903,
|
||||
/** Represents the most recent RMS voltage reading in @e Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_PHB_ID = 0x0905,
|
||||
/** Represents the lowest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_PH_B_ID = 0x0906,
|
||||
/** Represents the highest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_PH_B_ID = 0x0907,
|
||||
/** Represents the most recent RMS current reading in @e Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSCURRENT_PHB_ID = 0x0908,
|
||||
/** Represents the lowest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_PH_B_ID = 0x0909,
|
||||
/** Represents the highest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_PH_B_ID = 0x090a,
|
||||
/** Represents the Phase B, current demand of active power delivered or received at
|
||||
* the premises, in @e Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_PHB_ID = 0x090B,
|
||||
/** Represents the lowest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_PH_B_ID = 0x090c,
|
||||
/** Represents the highest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_PH_B_ID = 0x090d,
|
||||
/** Represents the Phase B, current demand of reactive power delivered or received
|
||||
* at the premises, in VAr. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_PH_B_ID = 0x090e,
|
||||
/** Represents the Phase B, current demand of apparent (Square root of active and
|
||||
* reactive power) power, in @e VA. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_APPARENT_POWER_PHB_ID = 0x090F,
|
||||
/** Contains the PhaseB, Power Factor ratio in 1/100th. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_FACTOR_PH_B_ID = 0x0910,
|
||||
/** The number of times the average RMS voltage, has been above the
|
||||
* @e AverageRMS @e OverVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_PHB_ID = 0x0911,
|
||||
/** The number of times the average RMS voltage, has been above the AverageRMS
|
||||
* OverVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PH_B_ID = 0x0912,
|
||||
/** The number of times the average RMS voltage, has been below the AverageRMS
|
||||
* underVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PH_B_ID = 0x0913,
|
||||
/** The duration in seconds used to measure an extreme over voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PH_B_ID = 0x0914,
|
||||
/** The duration in seconds used to measure an extreme under voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PH_B_ID = 0x0915,
|
||||
/** The duration in seconds used to measure a voltage sag condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_PH_B_ID = 0x0916,
|
||||
/** The duration in seconds used to measure a voltage swell condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_PH_B_ID = 0x0917,
|
||||
/** Represents the Phase C, AC line current (Square root of active and reactive
|
||||
* current) value at the moment in time the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_LINE_CURRENT_PH_C_ID = 0x0a01,
|
||||
/** Represents the Phase C, AC active/resistive current value at the moment in time
|
||||
* the attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_PH_C_ID = 0x0a02,
|
||||
/** Represents the Phase C, AC reactive current value at the moment in time the
|
||||
* attribute is read, in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_PH_C_ID = 0x0a03,
|
||||
/** Represents the most recent RMS voltage reading in @e Volts (V).*/
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_PHC_ID = 0x0A05,
|
||||
/** Represents the lowest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_PH_C_ID = 0x0a06,
|
||||
/** Represents the highest RMS voltage value measured in Volts (V). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_PH_C_ID = 0x0a07,
|
||||
/** Represents the most recent RMS current reading in @e Amps (A).*/
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSCURRENT_PHC_ID = 0x0A08,
|
||||
/** Represents the lowest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_PH_C_ID = 0x0a09,
|
||||
/** Represents the highest RMS current value measured in Amps (A). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_PH_C_ID = 0x0a0a,
|
||||
/** Represents the Phase C, current demand of active power delivered
|
||||
* or received at the premises, in @e Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_PHC_ID = 0x0A0B,
|
||||
/** Represents the lowest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_PH_C_ID = 0x0a0c,
|
||||
/** Represents the highest AC power value measured in Watts (W). */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_PH_C_ID = 0x0a0d,
|
||||
/** Represents the Phase C, current demand of reactive power delivered or received
|
||||
* at the premises, in VAr. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_PH_C_ID = 0x0a0e,
|
||||
/** Represents the Phase C, current demand of apparent (Square root of active and
|
||||
* reactive power) power, in @e VA. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_APPARENT_POWER_PHC_ID = 0x0A0F,
|
||||
/** Contains the Phase C, Power Factor ratio in 1/100th. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_FACTOR_PH_C_ID = 0x0a10,
|
||||
/** The Period in seconds that the RMS voltage is averaged over*/
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_PHC_ID = 0x0A11,
|
||||
/** The number of times the average RMS voltage, has been above the AverageRMS
|
||||
* OverVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PH_C_ID = 0x0a12,
|
||||
/** The number of times the average RMS voltage, has been below the AverageRMS
|
||||
* underVoltage threshold since last reset. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PH_C_ID = 0x0a13,
|
||||
/** The duration in seconds used to measure an extreme over voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PH_C_ID = 0x0a14,
|
||||
/** The duration in seconds used to measure an extreme under voltage condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PH_C_ID = 0x0a15,
|
||||
/** The duration in seconds used to measure a voltage sag condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_PH_C_ID = 0x0a16,
|
||||
/** The duration in seconds used to measure a voltage swell condition. */
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_PH_C_ID = 0x0a17,
|
||||
};
|
||||
|
||||
/*! @brief Bit mapping for Measurement Type attribute,
|
||||
@see HA spec, subclause 9.2.2.2.1.1 */
|
||||
enum zb_zcl_electrical_measurement_measurement_type_e
|
||||
{
|
||||
/*! Active Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_MEASUREMENT = 0x00000001,
|
||||
/*! Reactive Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_MEASUREMENT = 0x00000002,
|
||||
/*! Apparent Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_APPARENT_MEASUREMENT = 0x00000004,
|
||||
/*! Phase A Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_PHASE_A_MEASUREMENT = 0x00000008,
|
||||
/*! Phase B Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_PHASE_B_MEASUREMENT = 0x00000010,
|
||||
/*! Phase C Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_PHASE_C_MEASUREMENT = 0x00000020,
|
||||
/*! DC Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_MEASUREMENT = 0x00000040,
|
||||
/*! Harmonic Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_HARMONIC_MEASUREMENT = 0x00000080,
|
||||
/*! Power Quality Measurement bit */
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_QUALITY_MEASUREMENT = 0x00000100,
|
||||
|
||||
ZB_ZCL_ELECTRICAL_MEASUREMENT_RESERVED = 0x00000200
|
||||
};
|
||||
|
||||
/** @brief Default value for Measurement Type attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASUREMENT_TYPE_DEFAULT_VALUE 0x00000000
|
||||
|
||||
/** @brief Default value for DCVoltage attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCVoltageMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MIN_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCVoltageMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MAX_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCCurrentMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_MIN_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCCurrentMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_MAX_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCPowerMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_POWER_MIN_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCPowerMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_POWER_MAX_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for DCVoltageMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_MULTIPLIER_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCVoltageDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_DIVISOR_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCCurrentMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_MULTIPLIER_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCCurrentDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_DIVISOR_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCPowerMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_POWER_MULTIPLIER_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCPowerDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_POWER_DIVISOR_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for ACFrequency attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACFrequencyMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MIN_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACFrequencyMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MAX_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for NeutralCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_NEUTRAL_CURRENT_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for DCPower attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DCPOWER_DEFAULT_VALUE 0x8000
|
||||
|
||||
/** @brief Default value for Measured1stHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED1ST_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for Measured3rdHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED3RD_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for Measured5thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED5TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for Measured7thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED7TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for Measured9thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED9TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for Measured11thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED11TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase1stHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE1ST_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase3rdHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE3RD_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase5thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE5TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase7thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE7TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase9thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE9TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MeasuredPhase11thHarmonicCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_MEASURED_PHASE11TH_HARMONIC_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ACFrequencyMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_MULTIPLIER_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for ACFrequencyDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_FREQUENCY_DIVISOR_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for PowerMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_MULTIPLIER_DEFAULT_VALUE ((zb_uint32_t)0x000001)
|
||||
|
||||
/** @brief Default value for PowerDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_DIVISOR_DEFAULT_VALUE ((zb_uint32_t)0x000001)
|
||||
|
||||
/** @brief Default value for HarmonicCurrentMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_HARMONIC_CURRENT_MULTIPLIER_DEFAULT_VALUE ((zb_int8_t)0x00)
|
||||
|
||||
/** @brief Default value for PhaseHarmonicCurrentMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_PHASE_HARMONIC_CURRENT_MULTIPLIER_DEFAULT_VALUE ((zb_int8_t)0x00)
|
||||
|
||||
/** @brief Default value for LineCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_LINE_CURRENT_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActiveCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactiveCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for RMSVoltageMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSVoltageMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActivePowerMin attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ActivePowerMax attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactivePower attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ApparentPower attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_APPARENT_POWER_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for AverageRmsvoltageMeasurementPeriod attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSOverVoltageCounter attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSUnderVoltageCounter attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeOverVoltagePeriod attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeUnderVoltagePeriod attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSagPeriod attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSwellPeriod attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AcvoltageMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACVOLTAGE_MULTIPLIER_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for AcvoltageDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACVOLTAGE_DIVISOR_DEFAULT_VALUE ((zb_uint16_t)0x0001)
|
||||
|
||||
/** @brief Default value for DCOverloadAlarmsMask attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_OVERLOAD_ALARMS_MASK_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for DCVoltageOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_VOLTAGE_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for DCCurrentOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_DC_CURRENT_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACAlarmsMask attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_ALARMS_MASK_DEFAULT_VALUE ((zb_uint16_t)0x00)
|
||||
|
||||
/** @brief Default value for ACVoltageOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_VOLTAGE_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACCurrentOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_CURRENT_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACActivePowerOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_ACTIVE_POWER_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ACReactivePowerOverload attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AC_REACTIVE_POWER_OVERLOAD_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSVoltage attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_DEFAULT_VALUE 0xffff
|
||||
|
||||
/** @brief Default value for RMSCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSCURRENT_DEFAULT_VALUE 0xffff
|
||||
|
||||
/** @brief Default value for ActivePower attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_DEFAULT_VALUE 0xffff
|
||||
|
||||
/** @brief Default value for RMSCurrent attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_FACTOR_DEFAULT_VALUE 0x0
|
||||
|
||||
/** @brief Default value for PowerMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACPOWER_MULTIPLIER_DEFAULT_VALUE 0x0001
|
||||
|
||||
/** @brief Default value for PowerDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACPOWER_DIVISOR_DEFAULT_VALUE 0x0001
|
||||
|
||||
/** @brief Default value for ACCurrentMultiplier attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACCURRENT_MULTIPLIER_DEFAULT_VALUE 0x0001
|
||||
|
||||
/** @brief Default value for ACCurrentDivisor attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACCURRENT_DIVISOR_DEFAULT_VALUE 0x0001
|
||||
|
||||
/** @brief Default value for LineCurrentPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_LINE_CURRENT_PH_B_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActiveCurrentPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_PH_B_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactiveCurrentPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_PH_B_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for RmsvoltagePHB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_PHB_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSVoltageMinPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x8000)
|
||||
|
||||
/** @brief Default value for RMSVoltageMaxPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x8000)
|
||||
|
||||
/** @brief Default value for RmscurrentPHB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSCURRENT_PHB_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMinPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_PH_B_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMaxPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_PH_B_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActivePowerPHB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_PHB_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ActivePowerMinPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_PH_B_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ActivePowerMaxPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_PH_B_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactivePowerPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_PH_B_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ApparentPowerPHB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_APPARENT_POWER_PHB_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for PowerFactorPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_FACTOR_PH_B_DEFAULT_VALUE ((zb_int8_t)0x00)
|
||||
|
||||
/** @brief Default value for AverageRmsvoltageMeasurementPeriodPHB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_PHB_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSOverVoltageCounterPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSUnderVoltageCounterPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeOverVoltagePeriodPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeUnderVoltagePeriodPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSagPeriodPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSwellPeriodPhB attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_PH_B_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for LineCurrentPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_LINE_CURRENT_PH_C_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActiveCurrentPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_CURRENT_PH_C_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactiveCurrentPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_CURRENT_PH_C_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for rmsvoltagePHC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_PHC_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSVoltageMinPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MIN_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x8000)
|
||||
|
||||
/** @brief Default value for RMSVoltageMaxPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_MAX_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x8000)
|
||||
|
||||
/** @brief Default value for rmscurrentPHC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMSCURRENT_PHC_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMinPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MIN_PH_C_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for RMSCurrentMaxPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_CURRENT_MAX_PH_C_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for ActivePowerPHC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_PHC_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ActivePowerMinPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MIN_PH_C_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ActivePowerMaxPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_MAX_PH_C_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ReactivePowerPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REACTIVE_POWER_PH_C_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for ApparentPowerPHC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_APPARENT_POWER_PHC_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for PowerFactorPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_POWER_FACTOR_PH_C_DEFAULT_VALUE ((zb_int8_t)0x00)
|
||||
|
||||
/** @brief Default value for AverageRmsvoltageMeasurementPeriodPHC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMSVOLTAGE_MEASUREMENT_PERIOD_PHC_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSOverVoltageCounterPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for AverageRMSUnderVoltageCounterPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeOverVoltagePeriodPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSExtremeUnderVoltagePeriodPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSagPeriodPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SAG_PERIOD_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for RMSVoltageSwellPeriodPhC attribute */
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_RMS_VOLTAGE_SWELL_PERIOD_PH_C_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
|
||||
/*! @} */ /* Electrical Measurement cluster attributes */
|
||||
|
||||
/*! @brief Electrical Measurement cluster server command identifiers
|
||||
@see ZCL spec, subclause 4.9.2.3.1
|
||||
*/
|
||||
enum zb_zcl_electrical_measurement_srv_cmd_e
|
||||
{
|
||||
/** This command is generated when the Client command GetProfileInfo is received. */
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_PROFILE_INFO_RESPONSE_COMMAND = 0x00,
|
||||
/** This command is generated when the Client command GetMeasurementProfile is received. */
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_MEASUREMENT_PROFILE_RESPONSE_COMMAND = 0x01,
|
||||
};
|
||||
|
||||
/*! @brief Electrical Measurement cluster client command identifiers
|
||||
@see ZCL spec, subclause 4.9.2.4.1
|
||||
*/
|
||||
enum zb_zcl_electrical_measurement_cli_cmd_e
|
||||
{
|
||||
/** Get Profile Info Command */
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_PROFILE_INFO_COMMAND = 0x00,
|
||||
/** Get Measurement Profile Command */
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_MEASUREMENT_PROFILE_COMMAND = 0x01,
|
||||
};
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name Electrical Measurement cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASUREMENT_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASUREMENT_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DCPOWER_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DCPOWER_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSVOLTAGE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSCURRENT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_RMSCURRENT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACTIVE_POWER_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_FACTOR_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_POWER_FACTOR_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_MULTIPLIER_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_MULTIPLIER_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_DIVISOR_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_ACPOWER_DIVISOR_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*!
|
||||
* @}
|
||||
* @endcond
|
||||
*/
|
||||
/** @brief Declare attribute list for Electrical Measurement cluster
|
||||
@param attr_list - attribute list name
|
||||
@param measurement_type - pointer to variable to store Measurement Type attribute value
|
||||
@param dcpower - pointer to variable to store DCPower attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ELECTRICAL_MEASUREMENT_ATTRIB_LIST(attr_list, measurement_type, dcpower) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ELECTRICAL_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_MEASUREMENT_TYPE_ID, (measurement_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ELECTRICAL_MEASUREMENT_DCPOWER_ID, (dcpower)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*!
|
||||
@cond internals_doc
|
||||
@{
|
||||
@internal Number of attributes mandatory for reporting in Electrical Measurement cluster
|
||||
*/
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_REPORT_ATTR_COUNT 2
|
||||
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_SEND_GET_PROFILE_INFO_RESP( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
profile_count, profile_interval_period, max_number_of_intervals, \
|
||||
list_of_attributes, list_of_attributes_size) \
|
||||
{ \
|
||||
zb_uint8_t ind; \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_PROFILE_INFO_RESPONSE_COMMAND); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (profile_count)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (profile_interval_period)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (max_number_of_intervals)); \
|
||||
for (ind=0; ind < list_of_attributes_size; ind++) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (list_of_attributes[ind])); \
|
||||
} \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, \
|
||||
prfl_id, ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT, cb); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This function will be removed in the next Major release
|
||||
* Use @ref ZB_ZCL_ELECTRICAL_MEASUREMENT_SEND_GET_MEASUREMENT_PROFILE_RESP() instead
|
||||
*/
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_SEND_GET_MEASUREMENT_PROFILE_INFO_RESP( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
start_time, status, profile_interval_period, number_of_intervals_delivered, attr_id, \
|
||||
list_of_intervals) \
|
||||
{ \
|
||||
zb_uint8_t ind; \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_MEASUREMENT_PROFILE_RESPONSE_COMMAND); \
|
||||
ZB_ZCL_PACKET_PUT_DATA32_VAL(ptr, (start_time)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (status)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (profile_interval_period)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (number_of_intervals_delivered)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (attr_id)); \
|
||||
for (ind=0; ind < number_of_intervals_delivered; ind++) \
|
||||
{ \
|
||||
\
|
||||
} \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, \
|
||||
prfl_id, ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT, cb); \
|
||||
}
|
||||
|
||||
#define ZB_ZCL_ELECTRICAL_MEASUREMENT_SEND_GET_MEASUREMENT_PROFILE_RESP( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
start_time, status, profile_interval_period, number_of_intervals_delivered, attr_id, \
|
||||
attr_type, list_of_intervals) \
|
||||
{ \
|
||||
zb_uint8_t ind; \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_ELECTRICAL_MEASUREMENT_GET_MEASUREMENT_PROFILE_RESPONSE_COMMAND); \
|
||||
ZB_ZCL_PACKET_PUT_DATA32_VAL(ptr, (start_time)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (status)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (profile_interval_period)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (number_of_intervals_delivered)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (attr_id)); \
|
||||
for (ind=0; ind < number_of_intervals_delivered; ind++) \
|
||||
{ \
|
||||
(ptr) = zb_zcl_put_value_to_packet((ptr), (attr_type), list_of_intervals[ind]); \
|
||||
} \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, \
|
||||
prfl_id, ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT, cb); \
|
||||
}
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Electrical Measurement cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL HA Electrical Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_el_measurement_init_server(void);
|
||||
void zb_zcl_el_measurement_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_el_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_el_measurement_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ELECTRICAL_MEASUREMENT_H */
|
||||
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: EN50523 Appliance events and alerts cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_H
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_H 1
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/*! @addtogroup ZB_ZCL_EN50523_APP_EVENTS_ALERTS
|
||||
@{
|
||||
*/
|
||||
/*! @name EN50523 Appliance events and alerts cluster commands
|
||||
@{
|
||||
*/
|
||||
/*! @brief EN50523 Appliance events and alerts cluster
|
||||
command received identifiers
|
||||
@see ZCL 6.0 spec, subclause 15.4.2.3
|
||||
*/
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_recv_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_ID = 0x00, /**< "Get alerts" command. */
|
||||
};
|
||||
|
||||
/*! @brief EN50523 Appliance events and alerts cluster
|
||||
commands generated identifiers
|
||||
@see ZCL 6.0 spec, subclause 15.4.2.4
|
||||
*/
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_send_cmd_e
|
||||
{
|
||||
/*! "Get alerts response" command. */
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_RESP_ID = 0x00,
|
||||
/*! "Alerts notification" command. */
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_ALERTS_NOTIFICATION_ID = 0x01,
|
||||
/*! "Event notification" command. */
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_EVENT_NOTIFICATION_ID = 0x02,
|
||||
};
|
||||
|
||||
/** @brief Default value for EN50523 Appliance events and alerts cluster revision global attribute */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*!
|
||||
@brief Declare attribute list for EN50523 Appliance events and alerts cluster (only cluster revision attribute)
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_EN50523_APPL_EV_AND_ALERTS_ATTR_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_EN50523_APPL_EV_AND_ALERTS) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* en50523 cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_RESP_ID, \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_ALERTS_NOTIFICATION_ID, \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_EVENT_NOTIFICATION_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_APPL_EV_AND_ALERTS_SERVER_ROLE_RECEIVED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/******************************* Get Alerts Command ******************************/
|
||||
|
||||
/*! @brief Get Alerts command, ZCL spec 15.4.2.2.1
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_ID); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS, cb); \
|
||||
}
|
||||
|
||||
/******************************* Get Alerts Response Command ******************************/
|
||||
|
||||
/*! @brief Maximum number of Alerts */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_MAX_ALERTS_NUM 15
|
||||
|
||||
/*! @brief Type of alert */
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_alerts_type_e
|
||||
{
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_TYPE_UNSTRUCTURED = 0x00,
|
||||
};
|
||||
|
||||
/*! @brief Alert category */
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_alert_category_e
|
||||
{
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_CATEGORY_WARNING = 0x01,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_CATEGORY_DANGER = 0x02,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_CATEGORY_FAILURE = 0x03,
|
||||
};
|
||||
|
||||
/*! @brief Alert presence recovery */
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_alert_presence_e
|
||||
{
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_RECOVERY = 0x00,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_PRESENCE = 0x01,
|
||||
};
|
||||
|
||||
/*! @brief Get Number of Alerts */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_NUM(_alerts_count) ((_alerts_count) & 0x0F)
|
||||
|
||||
/*! @brief Set Number of Alerts */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_SET_NUM(_alerts_count, num) ((_alerts_count) |= (num & 0x0F))
|
||||
|
||||
/*! @brief Get Type of alert */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_TYPE(_alerts_count) (((_alerts_count) & 0xF0) >> 4)
|
||||
|
||||
/*! @brief Set Type of alert */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_SET_TYPE(_alerts_count, type) ((_alerts_count) |= ((type & 0x0F) << 4))
|
||||
|
||||
/*! @brief Get Alert ID */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_GET_ID(_alert_struct) ((_alert_struct).alert[2] & 0xFF)
|
||||
|
||||
/*! @brief Set Alert ID */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_SET_ID(_alert_struct, id) ((_alert_struct).alert[2] = (id & 0xFF))
|
||||
|
||||
/*! @brief Get Alert Category */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_GET_CATEGORY(_alert_struct) ((_alert_struct).alert[1] & 0x0F)
|
||||
|
||||
/*! @brief Set Alert Category */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_SET_CATEGORY(_alert_struct, cat) ((_alert_struct).alert[1] |= (cat & 0x0F))
|
||||
|
||||
/*! @brief Get Alert Presence recovery */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_GET_PRESENCE(_alert_struct) (((_alert_struct).alert[1] & 0xF0) >> 4)
|
||||
|
||||
/*! @brief Set Alert Presence recovery */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_SET_PRESENCE(_alert_struct, pres) ((_alert_struct).alert[1] |= (pres & 0x0F) << 4)
|
||||
|
||||
/*! @brief Get Alert Manufacturer specific bits */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_GET_MANUF_SPEC(_alert_struct) ((_alert_struct).alert[0] & 0xFF)
|
||||
|
||||
/*! @brief Set Alert Manufacturer specific bits */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERT_STRUCT_SET_MANUF_SPEC(_alert_struct, val) ((_alert_struct).alert[0] = (val & 0xFF))
|
||||
|
||||
/*! @brief Alert structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_en50523_appl_ev_and_alerts_alert_struct_s
|
||||
{
|
||||
/** Alert field - Alert ID, Category, Presence recovery, Manufacturer specific bits */
|
||||
zb_uint8_t alert[3];
|
||||
} ZB_PACKED_STRUCT zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t;
|
||||
|
||||
/*! @brief Structure representation of Get Alerts Response command */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_en50523_appl_ev_and_alerts_get_alerts_resp_s
|
||||
{
|
||||
/** Alerts count fields - Number of Alerts, Type of alert */
|
||||
zb_uint8_t alerts_count;
|
||||
/** Alert structure fields, see zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t */
|
||||
zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t alert_struct[ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_MAX_ALERTS_NUM];
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_en50523_appl_ev_and_alerts_get_alerts_resp_t;
|
||||
|
||||
/*! Get Alerts Response command payload size */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_RESP_PAYLOAD_SIZE(ptr) (sizeof(((zb_zcl_en50523_appl_ev_and_alerts_get_alerts_resp_t *)(ptr))->alerts_count) + \
|
||||
(ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_NUM(((zb_zcl_en50523_appl_ev_and_alerts_get_alerts_resp_t *)(ptr))->alerts_count)* \
|
||||
sizeof(zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t)))
|
||||
|
||||
/*! @brief Start Get Alerts Response command, ZCL spec 15.4.2.3.1
|
||||
@param buffer - to put packet to
|
||||
@param seq - sequence
|
||||
@param alerts_count - Alerts count field
|
||||
@param ptr - [out] (zb_uint8_t*) current position for @ref ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_RESP_ADD
|
||||
and @ref ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_RESP_END
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_RESP_START( \
|
||||
buffer, seq, alerts_count, ptr) \
|
||||
{ \
|
||||
(ptr) = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, seq, \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_RESP_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8((ptr), (alerts_count)); \
|
||||
}
|
||||
|
||||
/*! @brief Add Alert Structure to Get Alerts Response command, ZCL spec 15.4.2.3.1
|
||||
@param ptr - [in/out] (zb_uint8_t*) current position
|
||||
@param alert_struct - pointer to the Alert structure to put into packet
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_RESP_ADD(ptr, alert_struct) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA24(ptr, (alert_struct)); \
|
||||
}
|
||||
|
||||
/*! @brief End form Get Alerts Response command and send it, ZCL spec 15.4.2.3.1
|
||||
@param ptr - (zb_uint8_t*) current position
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_GET_ALERTS_RESP_END( \
|
||||
ptr, buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id) \
|
||||
{ \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS, NULL); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Get Alerts Response command, ZCL spec 15.4.2.3.1
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_en50523_appl_ev_and_alerts_get_alerts_resp_t
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_GET_GET_ALERTS_RESP(data_ptr, buffer, status) \
|
||||
{ \
|
||||
zb_uint8_t *data = zb_buf_begin(buffer); \
|
||||
if (zb_buf_len((buffer)) < \
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_RESP_PAYLOAD_SIZE(data)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_GET_DATA8(&(data_ptr)->alerts_count, data); \
|
||||
ZB_ZCL_PACKET_GET_DATA_N((data_ptr)->alert_struct, data, \
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_NUM((data_ptr)->alerts_count)*sizeof(zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Alerts Notification Command ******************************/
|
||||
|
||||
/*! @brief Structure representation of Alerts Notification command */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_en50523_appl_ev_and_alerts_alerts_notif_s
|
||||
{
|
||||
/** Alerts count fields - Number of Alerts, Type of alert */
|
||||
zb_uint8_t alerts_count;
|
||||
/** Alert structure fields, see zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t */
|
||||
zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t alert_struct[ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_MAX_ALERTS_NUM];
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_en50523_appl_ev_and_alerts_alerts_notif_t;
|
||||
|
||||
/*! Alerts Notification command payload size */
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_NOTIF_PAYLOAD_SIZE(ptr) (sizeof(((zb_zcl_en50523_appl_ev_and_alerts_alerts_notif_t *)(ptr))->alerts_count) + \
|
||||
(ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_NUM(((zb_zcl_en50523_appl_ev_and_alerts_alerts_notif_t *)(ptr))->alerts_count)* \
|
||||
sizeof(zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t)))
|
||||
|
||||
/*! @brief Start Alerts Notification command, ZCL spec 15.4.2.3.2
|
||||
@param buffer - to put packet to
|
||||
@param def_resp - enable/disable default response
|
||||
@param alerts_count - Alerts count field
|
||||
@param ptr - [out] (zb_uint8_t*) current position for @ref ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_ALERTS_NOTIF_ADD
|
||||
and @ref ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_ALERTS_NOTIF_END
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_ALERTS_NOTIF_START( \
|
||||
buffer, def_resp, alerts_count, ptr) \
|
||||
{ \
|
||||
(ptr) = zb_zcl_start_command_header(buffer, \
|
||||
ZB_ZCL_CONSTRUCT_FRAME_CONTROL( \
|
||||
ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
|
||||
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_CLI, \
|
||||
(def_resp)), \
|
||||
0, /* No manuf_code */ \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_ALERTS_NOTIFICATION_ID, \
|
||||
NULL); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8((ptr), (alerts_count)); \
|
||||
}
|
||||
|
||||
/*! @brief Add Alert Structure to Alerts Notification command, ZCL spec 15.4.2.3.2
|
||||
@param ptr - [in/out] (zb_uint8_t*) current position
|
||||
@param alert_struct - pointer to Alert structure to put into packet
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_ALERTS_NOTIF_ADD(ptr, alert_struct) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA24(ptr, (alert_struct)); \
|
||||
}
|
||||
|
||||
/*! @brief End form Alerts Notification command and send it, ZCL spec 15.4.2.3.2
|
||||
@param ptr - (zb_uint8_t*) current position
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_ALERTS_NOTIF_END( \
|
||||
ptr, buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb) \
|
||||
{ \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Alerts Notification command, ZCL spec 15.4.2.3.2
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_en50523_appl_ev_and_alerts_alerts_notif_t
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_GET_ALERTS_NOTIF(data_ptr, buffer, status) \
|
||||
{ \
|
||||
zb_uint8_t *data = zb_buf_begin(buffer); \
|
||||
if (zb_buf_len((buffer)) < \
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_NOTIF_PAYLOAD_SIZE(data)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_GET_DATA8(&(data_ptr)->alerts_count, data); \
|
||||
ZB_ZCL_PACKET_GET_DATA_N((data_ptr)->alert_struct, data, \
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_ALERTS_COUNT_GET_NUM((data_ptr)->alerts_count)*sizeof(zb_zcl_en50523_appl_ev_and_alerts_alert_struct_t)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Event Notification Command ******************************/
|
||||
|
||||
/*! @brief Event Identification */
|
||||
enum zb_zcl_en50523_appl_ev_and_alerts_event_identification_e
|
||||
{
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_EVENT_ID_END_OF_CYCLE = 0x01,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_EVENT_ID_TEMP_REACHED = 0x04,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_EVENT_ID_END_OF_COOKING = 0x05,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_EVENT_ID_SWITCHING_OFF = 0x06,
|
||||
ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_EVENT_ID_WRONG_DATA = 0xf7,
|
||||
};
|
||||
|
||||
/*! @brief Structure representation of Event Notification command
|
||||
@param event_header - Event header field
|
||||
@param event_identification - Event Identification field, see zb_zcl_en50523_appl_ev_and_alerts_event_identification_e
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_en50523_appl_ev_and_alerts_event_notif_s
|
||||
{
|
||||
zb_uint8_t event_header;
|
||||
zb_uint8_t event_identification;
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_en50523_appl_ev_and_alerts_event_notif_t;
|
||||
|
||||
/*! @brief Event Notification command, ZCL spec 15.4.2.3.3
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param event_identification - Event ID
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_SEND_EVENT_NOTIF( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
event_identification) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = zb_zcl_start_command_header(buffer, \
|
||||
ZB_ZCL_CONSTRUCT_FRAME_CONTROL( \
|
||||
ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
|
||||
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_CLI, \
|
||||
(def_resp)), \
|
||||
0, /* No manuf_code */ \
|
||||
ZB_ZCL_CMD_EN50523_APPL_EV_AND_ALERTS_EVENT_NOTIFICATION_ID, \
|
||||
NULL); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, 0); \
|
||||
ZB_ZCL1_PACKET_PUT_DATA8(ptr, (event_identification)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Event Notification command, see ZCL spec 15.4.2.3.3
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type zb_zcl_en50523_appl_ev_and_alerts_event_notif_e
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_GET_EVENT_NOTIF(data_ptr, buffer, status) \
|
||||
{ \
|
||||
zb_uint8_t *data = zb_buf_begin(buffer); \
|
||||
if (zb_buf_len((buffer)) < \
|
||||
sizeof(zb_zcl_en50523_appl_ev_and_alerts_event_notif_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_GET_DATA8(&(data_ptr)->event_header, data); \
|
||||
ZB_ZCL_PACKET_GET_DATA8(&(data_ptr)->event_identification, data); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
} \
|
||||
}
|
||||
/*! @} */ /* Appliance events and alerts cluster commands */
|
||||
/*! @} */ /*ZB_ZCL_EN50523_APP_EVENTS_ALERTS */
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_en50523_appliance_events_and_alerts_init_server(void);
|
||||
void zb_zcl_en50523_appliance_events_and_alerts_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS_SERVER_ROLE_INIT zb_zcl_en50523_appliance_events_and_alerts_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_APPLIANCE_EVENTS_AND_ALERTS_CLIENT_ROLE_INIT zb_zcl_en50523_appliance_events_and_alerts_init_client
|
||||
|
||||
#endif /* ZB_ZCL_EN50523_APPL_EV_AND_ALERTS_H */
|
||||
@@ -0,0 +1,582 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Energy Management cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ENERGY_MANAGEMENT_H_
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_H_
|
||||
|
||||
#include "zboss_api_core.h" /* ZBOSS core API types */
|
||||
/* Include this header for zb_zcl_drlc_event_status_t import*/
|
||||
#include "zcl/zb_zcl_drlc.h"
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION) */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ENERGY_MANAGEMENT
|
||||
* @{
|
||||
* @details
|
||||
* The Energy Management cluster provides a way of modifying DRLC events, energy consumption
|
||||
* behavior and querying the status of DRLC events.
|
||||
* @note The ESI is defined as the Client. The DRLC device is a Server
|
||||
* in this case; it holds the attributes and receives commands.
|
||||
*/
|
||||
|
||||
/** @defgroup ZB_ZCL_ENERGY_MANAGEMENT_ATTRS Energy Management cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Energy Management Server Cluster Attributes
|
||||
* @see SE spec, subclause 12.2.2
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_srv_attr_e
|
||||
{
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE = 0x0000, /**< This attribute shall be a BitMap showing the current state of the device.
|
||||
* The attribute shall be read-only.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID, /**< If an event is in progress (current time is between the Effective Start Time
|
||||
* and Effective End Time of an event), this attribute SHALL indicate
|
||||
* the Issuer Event ID of the active event.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS, /**< This attribute represents the value returned in the Event Control field of
|
||||
* the latest Report Event Status command (see D.2.3.3.1). This attribute provides
|
||||
* a mechanism to allow a remote device to query whether this client device is
|
||||
* currently participating in a load control event.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL, /**< This is the minimum criticality level of a DRLC event that the device will observe.
|
||||
* Events with a criticality level lower than the Conformance Level
|
||||
* will be opted out.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME, /**< This attribute is measured in seconds and used to determine the duty
|
||||
* cycling times. It is the shortest times the device should be allowed off.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME, /**< This attribute is measured in seconds and used to determine the duty
|
||||
* cycling times. It is the shortest times the device should be allowed on.
|
||||
*/
|
||||
|
||||
/* (M) */
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD /**< This attribute is measured in seconds and used to determine the duty
|
||||
* cycling times. It is the shortest cycling period allowed for duty cycling
|
||||
*/
|
||||
} zb_zcl_energy_management_srv_attr_t;
|
||||
|
||||
/** @brief Default value for Energy Management cluster revision global attribute (not defined anywhere) */
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @endcond */ /* (DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION) */
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Energy Management cluster
|
||||
@param attr_list - attribute list name
|
||||
@param on_off - pointer to variable to store On/Off attribute value
|
||||
@param load_control_state - pointer to variable to store load control state attribute
|
||||
@param current_event_id - pointer to variable to store current event id
|
||||
@param current_event_status - pointer to variable to store current event status attribute
|
||||
@param conformance_level - pointer to variable to store conformance level attribute
|
||||
@param minimum_off_time - pointer to variable to store minimum off time attribute
|
||||
@param minimum_on_time - pointer to variable to store minimum on time attribute
|
||||
@param minimum_cycle_period - pointer to variable to store minimum cycle period attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ENERGY_MANAGEMENT_ATTRIB_LIST(attr_list, load_control_state, current_event_id, \
|
||||
current_event_status, conformance_level, minimum_off_time, \
|
||||
minimum_on_time, minimum_cycle_period) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ENERGY_MANAGEMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE, (load_control_state)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID, (current_event_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS, (current_event_status)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL, (conformance_level)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME, (minimum_off_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME, (minimum_on_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD, (minimum_cycle_period)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
|
||||
#define ZB_ZCL_DECLARE_ENERGY_MANAGEMENT_ATTR_LIST_INIT \
|
||||
(zb_zcl_energy_management_attr_t) \
|
||||
{ .load_control_state = 0, \
|
||||
.current_event_id = 0xFFFFFFFF, \
|
||||
.current_event_status = 0, \
|
||||
.conformance_level = 0}
|
||||
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION) */
|
||||
/**
|
||||
* @brief Energy Management cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_energy_management_attr_s
|
||||
{
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_LOAD_CONTROL_STATE
|
||||
*/
|
||||
zb_uint8_t load_control_state;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_ID
|
||||
*/
|
||||
zb_uint32_t current_event_id;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CURRENT_EVENT_STATUS
|
||||
*/
|
||||
zb_uint8_t current_event_status;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_CONFORMANCE_LEVEL
|
||||
*/
|
||||
zb_uint8_t conformance_level;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME
|
||||
* @note Default values is TBD
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_OFF_TIME
|
||||
*/
|
||||
zb_uint16_t minimum_off_time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME
|
||||
* @note Default values is TBD
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_ON_TIME
|
||||
*/
|
||||
zb_uint16_t minimum_on_time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD
|
||||
* @note Default values is TBD
|
||||
* @see ZB_ZCL_ATTR_ENERGY_MANAGEMENT_MINIMUM_CYCLE_PERIOD
|
||||
*/
|
||||
zb_uint16_t minimum_cycle_period;
|
||||
} zb_zcl_energy_management_attr_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Energy Management cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_energy_management_attr_t type (containing Energy Management cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ENERGY_MANAGEMENT_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_ENERGY_MANAGEMENT_ATTRIB_LIST(attr_list, &attrs.load_control_state, \
|
||||
&attrs.current_event_id, &attrs.current_event_status, &attrs.conformance_level, \
|
||||
&attrs.minimum_off_time, &attrs.minimum_on_time, &attrs.minimum_cycle_period)
|
||||
|
||||
|
||||
/** Load Control State BitMap/Encoding
|
||||
* @see SE spec, Table D-193
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_load_control_state_encoding_e
|
||||
{
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_RELAY_OPEN = 1 << 0, /**< The device being controlled has been turned off and
|
||||
* prevented from consuming electric power or another commodity,
|
||||
* either by opening a relay or some other means.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_EVENT_IN_PROGRESS = 1 << 1, /**< There is an event in progress. The current time is between the Effective Start
|
||||
* Time and Effective End Time of the event. When this bit is set, the
|
||||
* CurrentEventStatus attribute is valid.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_POWER_STABILIZING = 1 << 2, /**< The device has automatically reduced consumption of the commodity for an
|
||||
* automatic reason, to aid in the stability of the system.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_OTHER_LOAD_REDUCTION = 1 << 3, /**< This bit indicates the device has automatically reduced consumption of
|
||||
* the commodity for some non-consumer-initiated reason.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_CURRENT_FLOW = 1 << 4, /**< This bit indicates that the device is currently consuming the commodity.
|
||||
* The bit not being set means either no commodity being consumption
|
||||
* or the device does not have the ability to detect consumption. Support is optional.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATE_LOAD_CALL = 1 << 5 /**< This bit is set if there is currently no consumption but the device under
|
||||
* control would consume power if able to. Support is optional.
|
||||
* The bit shall be cleared if not supported.
|
||||
*/
|
||||
} zb_zcl_energy_management_load_control_state_encoding_t;
|
||||
|
||||
|
||||
/** Current Event Status BitMap/Encoding
|
||||
* @see SE spec, Table D-194
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_current_event_status_encoding_e
|
||||
{
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_RANDOMIZED_START_TIME = 1 << 0, /**< Set if the current event had a randomized start time. */
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_RANDOMIZED_DURATION = 1 << 1, /**< Set if the duration of the current event is randomized. */
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_EXTENDED_BITS_PRESENT = 1 << 2, /**< This bit will always return 1. This allows the field to be used in DRLC
|
||||
* Event Status messages.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_EVENT_ACTIVE = 1 << 3, /**< Set if the current time lies between the Effective Start Time and
|
||||
* Effective End Time of the event identified by the CurrentEventID attribute
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_DEVICE_PARTICIPATING_IN_EVENT = 1 << 4, /**< Set if the device is (or will be when the event starts) participating in
|
||||
* the event.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_REDUCING_LOAD = 1 << 5, /**< Set if the device is currently shedding load in response to a DR event.
|
||||
* Set if an active load control event is duty cycling and currently off, or if
|
||||
* the new set points or offsets are lowering demand.
|
||||
*/
|
||||
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_STATUS_ON_AT_END_OF_EVENT = 1 << 6 /**< Set if the device will return to using a normal load after the event has
|
||||
* completed. For example, this would be False if the device supported the On/Off
|
||||
* cluster and the On/Off attribute was set to OFF.
|
||||
*/
|
||||
} zb_zcl_energy_management_current_event_status_encoding_t;
|
||||
|
||||
|
||||
/** @} */ /* ZB_ZCL_ENERGY_MANAGEMENT_ATTRS */
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_ENERGY_MANAGEMENT_COMMANDS Energy Management cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Commands are generated by Energy Management Client
|
||||
* @see SE spec, subclause 12.2.4
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_cli_cmd_e
|
||||
{
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT = 0x00, /**< The Manage Event command allows a remote device (such as an IHD or web portal)
|
||||
* to change the behavior of a DRLC cluster client when responding to a
|
||||
* DRLC Load Control Event.
|
||||
* @see zb_zcl_energy_management_manage_event_payload_s
|
||||
*/
|
||||
} zb_zcl_energy_management_cli_cmd_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command Payload
|
||||
* @see SE spec, subclause 12.2.4.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_energy_management_manage_event_payload_s
|
||||
{
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** Unique identifier generated by the Energy provider. The value of this field
|
||||
* allows the command to be matched with a specific Load Control Event.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** Bit encoded field representing the DRLC client Device Class to apply the
|
||||
* current Load Control Event. Each bit, if set individually or in combination,
|
||||
* indicates the class of device(s) the Manage Event command is directed at.
|
||||
*/
|
||||
zb_uint16_t device_class; /* (M) */
|
||||
|
||||
/** The DRLC client Utility Enrollment Group field can be used in conjunction
|
||||
* with the Device Class bits. It provides a mechanism to direct the Manage Event
|
||||
* command to groups of devices.
|
||||
*/
|
||||
zb_uint8_t utility_enrollment_group; /* (M) */
|
||||
|
||||
/* Optional fields */
|
||||
|
||||
/** Bit encoded field indicating the action(s) to be carried out in regard to
|
||||
* the associated event
|
||||
*/
|
||||
zb_uint8_t actions_required; /* (O) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_energy_management_manage_event_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_ENERGY_MANAGEMENT_MANAGE_EVENT_PAYLOAD_SIZE_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_MANAGE_EVENT_PAYLOAD_SIZE_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_energy_management_manage_event_payload_t))
|
||||
|
||||
/** Action(s) Required BitMap/Encoding
|
||||
* @see SE spec, Table D-196
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_actions_required_encoding_e
|
||||
{
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_ACTIONS_EVENT_OPT_OUT = 0, /**< Opt Out of Event */
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_ACTIONS_OPT_INTO_EVENT = 1, /**< Opt Into Event */
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_ACTIONS_DISABLE_DUTY_CYCLING = 2, /**< Disable Duty Cycling */
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_ACTIONS_ENABLE_DUTY_CYCLING = 3 /**< Enable Duty Cycling */
|
||||
} zb_zcl_energy_management_actions_required_encoding_t;
|
||||
|
||||
|
||||
/** Commands are generated by Energy Management Server
|
||||
* @see SE spec, subclause 12.2.5
|
||||
*/
|
||||
typedef enum zb_zcl_energy_management_srv_cmd_e
|
||||
{
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_SRV_CMD_REPORT_EVENT_STATUS = 0x00, /**< This command is reused from the DRLC cluster. This command is generated
|
||||
* in response to the Manage Event command.
|
||||
* @see zb_zcl_energy_management_report_event_status_payload_s
|
||||
*/
|
||||
} zb_zcl_energy_management_srv_cmd_t;
|
||||
|
||||
/* Energy mgmt cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_SRV_CMD_REPORT_EVENT_STATUS
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_ENERGY_MANAGEMENT_SRV_CMD_REPORT_EVENT_STATUS "ReportEventStatusCommandPayload".
|
||||
* @see SE spec, subclause 12.2.5.1 and @ref zb_zcl_drlc_report_event_status_payload_t
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_energy_management_report_event_status_payload_s
|
||||
{
|
||||
/* Mandatory fields. */
|
||||
|
||||
/** Event ID specified in the Manage Event command or, if the command specified
|
||||
* the current event, then the current running DRLC Issuer Event ID.
|
||||
*/
|
||||
zb_uint32_t issuer_event_id; /* (M) */
|
||||
|
||||
/** If the Manage Event command did not change the event, then this field will
|
||||
* contain the last sent Event Status for the event.
|
||||
*/
|
||||
zb_uint8_t event_status; /* (M) */
|
||||
|
||||
/** UTC Timestamp representing when the event status was changed. If the device
|
||||
* does not know the current time but still remembers events, it may return the
|
||||
* value of 0x00000000.
|
||||
*/
|
||||
zb_uint32_t event_status_time; /* (M) */
|
||||
|
||||
/** Criticality Level value applied by the device */
|
||||
zb_uint8_t criticality_level_applied; /* (M) */
|
||||
|
||||
/* Optional fields */
|
||||
|
||||
/** Cooling Temperature Set Point value applied by the device, see the
|
||||
* corresponding field in the Load Control Event command for more information.
|
||||
* The value 0x8000 means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_uint16_t cooling_temperature_set_point_applied; /* (O) */
|
||||
|
||||
/** Heating Temperature Set Point value applied by the device, see the
|
||||
* corresponding field in the Load Control Event command for more information.
|
||||
* The value 0x8000 means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_uint16_t heating_temperature_set_point_applied; /* (O) */
|
||||
|
||||
/** Average Load Adjustment Percentage value applied by the device, see the
|
||||
* corresponding field in the Load Control Event command for more information.
|
||||
* The value 0x80 means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_int8_t average_load_adjustment_percentage_applied; /* (O) */
|
||||
|
||||
/** Defines the maximum On state duty cycle applied by the device. The value
|
||||
* 0xFF means that this field has not been used by the end device.
|
||||
*/
|
||||
zb_uint8_t duty_cycle_applied; /* (O) */
|
||||
|
||||
/* Mandatory field */
|
||||
/** Identifies additional control options for the event. */
|
||||
zb_uint8_t event_control; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_energy_management_report_event_status_payload_t;
|
||||
|
||||
/** @def ZB_ZCL_ENERGY_MANAGEMENT_REPORT_EVENT_STATUS_PAYLOAD_SIZE_IS_VALID
|
||||
*/
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_REPORT_EVENT_STATUS_PAYLOAD_SIZE_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_energy_management_report_event_status_payload_t))
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_ENERGY_MANAGEMENT_SRV_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command payload
|
||||
* @see @ref zb_zcl_energy_management_report_event_status_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_REPORT_EVENT_STATUS_PAYLOAD_INIT \
|
||||
(zb_zcl_energy_management_report_event_status_payload_t) \
|
||||
{ \
|
||||
.cooling_temperature_set_point_applied = (zb_uint16_t) 0x8000, \
|
||||
.heating_temperature_set_point_applied = (zb_uint16_t) 0x8000, \
|
||||
.average_load_adjustment_percentage_applied = (zb_int8_t) 0x80, \
|
||||
.duty_cycle_applied = (zb_uint8_t) 0xFF, \
|
||||
}
|
||||
|
||||
|
||||
/** Macro for initialization @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command payload
|
||||
* @see @ref zb_zcl_energy_management_manage_event_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_MANAGE_EVENT_PAYLOAD_INIT \
|
||||
(zb_zcl_energy_management_manage_event_payload_t) {0} \
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_ENERGY_MANAGEMENT_SRV_CMD_REPORT_EVENT_STATUS "ReportEventStatus" command.
|
||||
* On sender's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with @ref ZB_ZCL_ENERGY_MANAGEMENT_MANAGE_EVENT_CB_ID
|
||||
* callback id on reception of @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command.
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_ENERGY_MANAGEMENT_REPORT_EVENT_STATUS_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (ref to @ref
|
||||
* zb_zcl_drlc_report_event_status_payload_t and @ref zb_zcl_energy_management_report_event_status_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Handle @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command
|
||||
*/
|
||||
void zb_zcl_energy_management_server_send_report_event_status(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
zb_zcl_energy_management_report_event_status_payload_t *payload,
|
||||
zb_callback_t cb);
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command.
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_ENERGY_MANAGEMENT_MANAGE_EVENT_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_energy_management_manage_event_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Example of sending @ref ZB_ZCL_ENERGY_MANAGEMENT_CLI_CMD_MANAGE_EVENT "ManageEvent" command
|
||||
*/
|
||||
void zb_zcl_energy_management_client_send_manage_event(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
zb_zcl_energy_management_manage_event_payload_t *payload,
|
||||
zb_callback_t cb);
|
||||
|
||||
/** Macro for call @ref zb_zcl_energy_management_server_send_report_event_status command */
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_SEND_CMD_REPORT_EVENT_STATUS(_param, _dst_addr, \
|
||||
_dst_addr_mode, _dst_ep, \
|
||||
_src_ep, _payload) \
|
||||
zb_zcl_energy_management_server_send_report_event_status(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_zcl_energy_management_client_send_manage_event command */
|
||||
#define ZB_ZCL_ENERGY_MANAGEMENT_SEND_CMD_MANAGE_EVENT(_param, _dst_addr, \
|
||||
_dst_addr_mode, _dst_ep, \
|
||||
_src_ep, _payload) \
|
||||
zb_zcl_energy_management_client_send_manage_event(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** @} */ /* ZB_ZCL_ENERGY_MANAGEMENT_COMMANDS */
|
||||
|
||||
/** @} */ /* ZCL Energy Management cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION */
|
||||
|
||||
/** Internal handler for Energy Management Cluster commands */
|
||||
|
||||
void zb_zcl_energy_management_init_server(void);
|
||||
void zb_zcl_energy_management_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_SERVER_ROLE_INIT zb_zcl_energy_management_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ENERGY_MANAGEMENT_CLIENT_ROLE_INIT zb_zcl_energy_management_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ENERGY_MANAGEMENT_H_ */
|
||||
@@ -0,0 +1,521 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Events cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_EVENTS_H_
|
||||
#define ZB_ZCL_EVENTS_H_
|
||||
|
||||
#include "zboss_api_core.h" /* ZBOSS core API types */
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_EVENTS
|
||||
* @{
|
||||
* @details
|
||||
* The Events cluster provides an interface for passing event information
|
||||
* between Zigbee devices. Events are generated and logged by a server device
|
||||
* and read by a client device.
|
||||
*/
|
||||
|
||||
/** @defgroup ZB_ZCL_EVENTS_COMMANDS Events cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Commands are generated by Events Server.
|
||||
* @see SE spec, subclause 11.2.4
|
||||
*/
|
||||
typedef enum zb_zcl_events_srv_cmd_e
|
||||
{
|
||||
ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT = 0x00, /**< This command is generated upon an event trigger from within the reporting
|
||||
* device and if enabled by the associated Event Configuration (bitmap)
|
||||
* attribute in the Device Management cluster
|
||||
* @see zb_zcl_events_publish_event_payload_t
|
||||
*/
|
||||
|
||||
ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT_LOG = 0x01, /**< This command is generated on receipt of a Get Event Log command.
|
||||
* The command shall return the most recent event first, up to the number
|
||||
* of events requested.
|
||||
* @see zb_zcl_events_publish_event_log_payload_t
|
||||
*/
|
||||
|
||||
ZB_ZCL_EVENTS_SRV_CMD_CLEAR_EVENT_LOG_RESPONSE = 0x02, /**< This command is generated on receipt of a Clear Event Log Request command.
|
||||
* @see zb_zcl_events_clear_event_log_response_t
|
||||
*/
|
||||
|
||||
} zb_zcl_events_srv_cmd_t;
|
||||
|
||||
|
||||
/** Commands are generated by Events Client.
|
||||
* @see SE spec, subclause 11.2.3
|
||||
*/
|
||||
typedef enum zb_zcl_events_cli_cmd_e
|
||||
{
|
||||
ZB_ZCL_EVENTS_CLI_CMD_GET_EVENT_LOG = 0x00, /**< The GetEventLog command allows a client to request events from a server’s
|
||||
* event logs. One or more PublishEventLog commands are returned on receipt
|
||||
* of this command.
|
||||
* @see zb_zcl_events_get_event_log_payload_t
|
||||
*/
|
||||
|
||||
ZB_ZCL_EVENTS_CLI_CMD_CLEAR_EVENT_LOG_REQUEST = 0x01, /**< This command requests that an Events server device clear the specified
|
||||
* event log(s). The Events server device SHOULD clear the requested events
|
||||
* logs, however it is understood that market specific restrictions may be
|
||||
* applied to prevent this.
|
||||
* @see zb_zcl_events_clear_event_log_request_s
|
||||
*/
|
||||
|
||||
} zb_zcl_events_cli_cmd_t;
|
||||
|
||||
|
||||
/* EVENTS cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT, \
|
||||
ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT_LOG, \
|
||||
ZB_ZCL_EVENTS_SRV_CMD_CLEAR_EVENT_LOG_RESPONSE
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_EVENTS_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_EVENTS_CLI_CMD_GET_EVENT_LOG, \
|
||||
ZB_ZCL_EVENTS_CLI_CMD_CLEAR_EVENT_LOG_REQUEST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_EVENTS_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
|
||||
/** Log ID enumeration
|
||||
* @see SE spec, Table D-186
|
||||
*/
|
||||
typedef enum zb_zcl_events_log_id_e
|
||||
{
|
||||
ZB_ZCL_EVENTS_LOG_ID_ALL_LOGS = 0x00, /**< All logs */
|
||||
ZB_ZCL_EVENTS_LOG_ID_TAMPER_LOG, /**< Tamper Log */
|
||||
ZB_ZCL_EVENTS_LOG_ID_FAULT_LOG, /**< Fault Log */
|
||||
ZB_ZCL_EVENTS_LOG_ID_GENERAL_EVENT_LOG, /**< General Event Log */
|
||||
ZB_ZCL_EVENTS_LOG_ID_SECURITY_EVENT_LOG, /**< Security Event Log */
|
||||
ZB_ZCL_EVENTS_LOG_ID_NETWORK_EVENT_LOG /**< Network Event Log */
|
||||
} zb_zcl_events_log_id_t;
|
||||
|
||||
/** @brief Default value for Events cluster revision global attribute */
|
||||
#define ZB_ZCL_EVENTS_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*!
|
||||
@brief Declare attribute list for Events cluster (only cluster revision attribute)
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_EVENTS_ATTR_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_EVENTS) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** Macro for get log_id value from 8-bit field
|
||||
* @param x - 8-bit field that contains log_id value in
|
||||
* the least significant nibble.
|
||||
* @see @ref zb_zcl_events_publish_event_payload_t, @ref zb_zcl_events_get_event_log_payload_t,
|
||||
* @ref zb_zcl_events_clear_event_log_request_t, @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_GET_LOG_ID_FIELD(x) ((x) & 0xF)
|
||||
|
||||
|
||||
/** Macro for set log_id value to 8-bit field
|
||||
* @param x - 8-bit field to store log_id value in the least
|
||||
* significant nibble
|
||||
* @param val - value to assigning
|
||||
* @see @ref zb_zcl_events_publish_event_payload_t, @ref zb_zcl_events_get_event_log_payload_t,
|
||||
* @ref zb_zcl_events_clear_event_log_request_t, @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_SET_LOG_ID_FIELD(x, val) ((x) &= (0xF0 | ((val) & 0xF)))
|
||||
|
||||
|
||||
/** Macro for get event_control value from 8-bit field
|
||||
* @param x - 8-bit field that contains event_control value
|
||||
* in the most significant nibble.
|
||||
* @see @ref zb_zcl_events_get_event_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_GET_EVENT_CONTROL_FIELD(x) (((x) & 0xF0) >> 4)
|
||||
|
||||
|
||||
/** Macro for set event_control value to 8-bit field
|
||||
* @param x - 8-bit field to store event_control value in the most
|
||||
* significant nibble.
|
||||
* @param val - value to assigning
|
||||
* @see @ref zb_zcl_events_get_event_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_SET_EVENT_CONTROL_FIELD(x, val) ((x) &= (0xF | ((val) & 0xF) << 4)
|
||||
|
||||
|
||||
/** Macro for get log_payload_control value from 8-bit field
|
||||
* @param x - 8-bit field that contains log_payload_control value
|
||||
* in the least significant nibble
|
||||
* @see @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_GET_LOG_PAYLOAD_CONTROL_FIELD(x) ((x) & 0xF)
|
||||
|
||||
|
||||
/** Macro for set log_payload_control value to 8-bit field
|
||||
* @param x - 8-bit field to store log_payload_control value in
|
||||
* the least significant nibble.
|
||||
* @param val - value to assigning
|
||||
* @see @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_SET_LOG_PAYLOAD_CONTROL_FIELD(x, val) ((x) &= (0xF0 | ((val) & 0xF)))
|
||||
|
||||
|
||||
/** Macro for get number_of_events value from 8-bit field
|
||||
* @param x - 8-bit field that contains number_of_events value
|
||||
* in the most significant nibble.
|
||||
* @see @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_GET_NUMBER_OF_EVENTS(x) (((x) & 0xF0) >> 4)
|
||||
|
||||
|
||||
/** Macro for set number_of_events value to 8-bit field
|
||||
* @param x - 8-bit field to store number_of_events value in the
|
||||
* most significant nibble.
|
||||
* @param val - value to assigning
|
||||
* @see @ref zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_SET_NUMBER_OF_EVENTS(x, val) ((x) &= (0xF | ((val) & 0xF) << 4))
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_EVENTS_CLI_CMD_GET_EVENT_LOG "GetEventLog" Command payload.
|
||||
* @see SE spec, subclause 11.2.3.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_get_event_log_payload_s
|
||||
{
|
||||
/** The least significant nibble is an enumeration indicating
|
||||
* the Log ID from particular enumeration.
|
||||
* The most significant nibble is a bitmap indicating
|
||||
* control options. It determines the detailing level of provided log
|
||||
* information.
|
||||
*/
|
||||
zb_uint8_t event_control_log_id; /* (M) */
|
||||
|
||||
|
||||
/** The Event ID specifies a particular event to be queried; a value of
|
||||
* 0x0000 is reserved to indicate all Event IDs.
|
||||
*/
|
||||
zb_uint16_t event_id; /* (M) */
|
||||
|
||||
/**This field specifies the start time (earliest time) of the range of events
|
||||
* to be returned. Events that match the search criteria and have a timestamp
|
||||
* greater than or equal to the start time shall be returned.
|
||||
*/
|
||||
zb_uint32_t start_time; /* (M) */
|
||||
|
||||
/** Specifies the end time (latest time) of the range of events to be reported
|
||||
* in the response. Events that match the search criteria and have a timestamp
|
||||
* less than the specified end time shall be returned. Events with a timestamp
|
||||
* equal to that of the End Time shall not be returned
|
||||
*/
|
||||
zb_uint32_t end_time; /* (M) */
|
||||
|
||||
/** This parameter indicates the maximum number of events requested i.e.
|
||||
* the maximum number of events that the client is willing to receive;
|
||||
* the value 0x00 indicates all events that fall into the defined criteria.
|
||||
*/
|
||||
zb_uint8_t number_of_events; /* (M) */
|
||||
|
||||
/** The Event Offset field provides a mechanism to allow client devices
|
||||
* to page through multiple events which match a given search criteria.
|
||||
*/
|
||||
zb_uint16_t event_offset; /* (M) */
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_get_event_log_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_EVENTS_CLI_CMD_CLEAR_EVENT_LOG_REQUEST "ClearEventLogRequest" command payload
|
||||
* @see SE spec, subclause D.11.2.3.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_clear_event_log_request_s
|
||||
{
|
||||
/** The least significant nibble specifies the Log to be cleared.
|
||||
* The most significant nibble is reserved.
|
||||
*/
|
||||
zb_uint8_t log_id;
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_clear_event_log_request_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT "PublishEvent" Command payload
|
||||
* @see SE spec, subclause 11.2.4.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_publish_event_payload_s {
|
||||
|
||||
/** The least significant nibble is an enumeration indicating the Log ID.
|
||||
* The most significant nibble is reserved.
|
||||
*/
|
||||
zb_uint8_t log_id; /* (M) */
|
||||
|
||||
/** The Event ID specifies a particular event
|
||||
*/
|
||||
zb_uint16_t event_id; /* (M) */
|
||||
|
||||
/** The timestamp of the event occurrence in UTC format.
|
||||
*/
|
||||
zb_uint32_t event_time; /* (M) */
|
||||
|
||||
/** An 8-bit bitmap specifying actions to be taken regarding particular event.
|
||||
*/
|
||||
zb_uint8_t event_control; /* (M) */
|
||||
|
||||
/** A variable length octet string array used to hold additional
|
||||
* information captured when the event occurred. The first element (element 0)
|
||||
* of the array indicates the length of the string, NOT including the first
|
||||
* element.
|
||||
*/
|
||||
zb_uint8_t event_data[44];
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_publish_event_payload_t;
|
||||
|
||||
|
||||
/** Publish Event Log Sub-Payload
|
||||
* @see SE spec, Figure D-175
|
||||
* @see zb_zcl_events_publish_event_log_payload_t::log_payload
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_sub_log_payload_s
|
||||
{
|
||||
/*Log Payload representation*/
|
||||
/******************************************************************************/
|
||||
/** The least significant nibble represents the Log Payload Control.
|
||||
* It determines availability of events to cross payload frame boundary.
|
||||
* The most significant nibble indicates the number of events contained within
|
||||
* the log payload of this command.
|
||||
*/
|
||||
zb_uint8_t number_of_events_log_payload_control;
|
||||
|
||||
/** The least significant nibble is an enumeration indicating the Log ID.
|
||||
* The most significant nibble is reserved.
|
||||
*/
|
||||
zb_uint8_t log_id;
|
||||
|
||||
/*The Event ID specifies a particular event.*/
|
||||
zb_uint16_t event_id;
|
||||
|
||||
/*The timestamp of the event occurrence in UTC format.*/
|
||||
zb_uint32_t event_time;
|
||||
|
||||
/** A variable length octet string array used to hold additional information
|
||||
* captured when the event occurred. The first element (element 0) of the
|
||||
* array indicates the length of the string, NOT including the first element.
|
||||
*/
|
||||
zb_uint8_t event_data[47];
|
||||
/******************************************************************************/
|
||||
/* Log Payload representation */
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_sub_log_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT_LOG "PublishEventLog" Command payload
|
||||
* @see SE spec, subclause 11.2.4.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_publish_event_log_payload_s
|
||||
{
|
||||
/** This field indicates the total number of events found which match the
|
||||
* search criteria received in the associated Get Event Log command.
|
||||
*/
|
||||
zb_uint16_t total_number_of_matching_events; /* (M) */
|
||||
|
||||
/** In the case where the entire number of events being returned does not
|
||||
* fit into a single message, the Command Index is used to count the required
|
||||
* number of Publish Event Log commands.
|
||||
*/
|
||||
zb_uint8_t command_index; /* (M) */
|
||||
|
||||
/** This parameter indicates the total number of Publish Event Log
|
||||
* commands that are required to return the requested event logs.
|
||||
*/
|
||||
zb_uint8_t total_commands; /* (M) */
|
||||
|
||||
/** The Log Payload is a series of events and associated data.
|
||||
* @see zb_zcl_events_sub_log_payload_t
|
||||
*/
|
||||
zb_zcl_events_sub_log_payload_t *log_payload;
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_publish_event_log_payload_t;
|
||||
|
||||
|
||||
/** Macro for initializing GetEventLog Command payload,
|
||||
* see @ref zb_zcl_events_get_event_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_EVENTS_GET_EVENT_LOG_INIT \
|
||||
(zb_zcl_events_get_event_log_payload_t) {0}
|
||||
|
||||
|
||||
/** Cleared Events Logs Bitmap
|
||||
* @note It is understood that certain markets may require that event logs
|
||||
* cannot be cleared; this Bitmask provides a method for the server device
|
||||
* to indicate which logs have been successfully cleared.
|
||||
* @see SE spec, Table D-191 and @ref zb_zcl_events_clear_event_log_response_t::cleared_events_logs
|
||||
*/
|
||||
typedef enum zb_zcl_events_cleared_events_logs_bitmap_e
|
||||
{
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_ALL = 1 << 0, /**< All logs cleared */
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_TAMPER = 1 << 1, /**< Tamper log cleared */
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_FAULT = 1 << 2, /**< Fault log cleared */
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_GENERAL = 1 << 3, /**< General event log cleared */
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_SECURITY = 1 << 4, /**< Security event log cleared */
|
||||
ZB_ZCL_EVENTS_CLEARED_EVENTS_LOGS_NETWORK = 1 << 5, /**< network event log cleared */
|
||||
/* 6-7 bits are reserved */
|
||||
} zb_zcl_events_cleared_events_logs_bitmap_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_EVENTS_SRV_CMD_CLEAR_EVENT_LOG_RESPONSE "ClearEventLogResponse" command payload
|
||||
* @see SE spec, D.11.2.4.3
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_events_clear_event_log_response_s
|
||||
{
|
||||
/** This 8-bit Bitmask indicates which logs have been cleared.
|
||||
* @see SE spec, Table D-191 and @ref zb_zcl_events_cleared_events_logs_bitmap_t
|
||||
*/
|
||||
zb_uint8_t cleared_events_logs;
|
||||
} ZB_PACKED_STRUCT zb_zcl_events_clear_event_log_response_t;
|
||||
|
||||
|
||||
/** Macro for initializing PublishEventLog Command payload
|
||||
* see @ref zb_zcl_events_publish_event_log_payload_t
|
||||
*/
|
||||
#define ZB_ZCL_EVENTS_PUBLISH_EVENT_LOG_PAYLOAD_INIT \
|
||||
(zb_zcl_events_publish_event_log_payload_t) {0}
|
||||
|
||||
|
||||
/** Function for send @ref ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT "PublishEvent" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_events_publish_event_payload_t).
|
||||
*/
|
||||
void zb_events_server_send_publish_event(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_events_publish_event_payload_t *payload);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_EVENTS_SRV_CMD_PUBLISH_EVENT_LOG "PublishEventLog" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_events_publish_event_log_payload_t).
|
||||
*/
|
||||
void zb_events_server_send_publish_event_log(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_events_publish_event_log_payload_t *payload);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_EVENTS_SRV_CMD_CLEAR_EVENT_LOG_RESPONSE "ClearEventLogResponse" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload: pointer to zb_uint8_t.
|
||||
*/
|
||||
void zb_events_server_send_clear_event_log_response(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_uint8_t *payload); /*zb_uint8_t zb_zcl_events_ClearedEventsLogs;*/
|
||||
|
||||
/** Function for send @ref ZB_ZCL_EVENTS_CLI_CMD_GET_EVENT_LOG "GetEventLog" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref
|
||||
* zb_zcl_events_get_event_log_payload_t).
|
||||
*/
|
||||
void zb_events_client_send_get_event_log(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_zcl_events_get_event_log_payload_t *payload);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_EVENTS_CLI_CMD_CLEAR_EVENT_LOG_REQUEST "ClearEventLogRequest" command.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload: pointer to zb_uint8_t.
|
||||
*/
|
||||
void zb_events_client_send_clear_event_log_request(zb_uint8_t param, zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep, zb_uint8_t *payload); /*zb_uint8_t zb_zcl_events_cel_log_id;*/
|
||||
|
||||
/** Macro for call @ref zb_events_server_send_publish_event function */
|
||||
#define ZB_ZCL_EVENTS_SEND_CMD_PUBLISH_EVENT(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload ) \
|
||||
zb_events_server_send_publish_event(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload)
|
||||
|
||||
/** Macro for call @ref zb_events_server_send_publish_event_log function */
|
||||
#define ZB_ZCL_EVENTS_SEND_CMD_PUBLISH_EVENT_LOG(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload ) \
|
||||
zb_events_server_send_publish_event_log(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload)
|
||||
|
||||
/** Macro for call @ref zb_events_server_send_clear_event_log_response function */
|
||||
#define ZB_ZCL_EVENTS_SEND_CMD_CLEAR_EVENT_LOG_RESPONSE(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload ) \
|
||||
zb_events_server_send_clear_event_log_response(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload)
|
||||
|
||||
/** Macro for call @ref zb_events_client_send_get_event_log function */
|
||||
#define ZB_ZCL_EVENTS_SEND_CMD_GET_EVENT_LOG(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload ) \
|
||||
zb_events_client_send_get_event_log(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload)
|
||||
|
||||
/** Macro for call @ref zb_events_client_send_clear_event_log_request function */
|
||||
#define ZB_ZCL_EVENTS_SEND_CMD_CLEAR_EVENT_LOG_REQUEST(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload ) \
|
||||
zb_events_client_send_clear_event_log_request(_param, _dst_addr, _dst_addr_mode, \
|
||||
_dst_ep, _src_ep, _payload)
|
||||
|
||||
/** @} */ /* ZB_ZCL_EVENTS_COMMANDS */
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** Internal handler for Events Cluster commands */
|
||||
zb_bool_t zb_zcl_process_events_specific_commands(zb_uint8_t param);
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @} */ /* ZB_ZCL_EVENTS */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_events_init_server(void);
|
||||
void zb_zcl_events_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_SERVER_ROLE_INIT zb_zcl_events_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_EVENTS_CLIENT_ROLE_INIT zb_zcl_events_init_client
|
||||
|
||||
#endif /* ZB_ZCL_EVENTS_H_ */
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Fan Control cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_FAN_CONTROL_H
|
||||
#define ZB_ZCL_FAN_CONTROL_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_FAN_CONTROL */
|
||||
|
||||
/*! @addtogroup ZB_ZCL_FAN_CONTROL
|
||||
@{
|
||||
@name Fan Control cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Fan Control cluster attribute identifiers
|
||||
@see ZCL spec, subclause 6.4.2.2
|
||||
*/
|
||||
enum zb_zcl_fan_control_attr_e
|
||||
{
|
||||
/*! @brief Fan Mode attribute */
|
||||
ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_ID = 0x0000,
|
||||
/*! @brief Fan Mode Sequence attribute */
|
||||
ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_SEQUENCE_ID = 0x0001
|
||||
};
|
||||
|
||||
/*! @brief Values for Fan Mode attribute,
|
||||
@see ZCL spec, subclause 6.4.2.2.1 */
|
||||
enum zb_zcl_fan_control_fan_mode_e
|
||||
{
|
||||
/*! Off value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_OFF = 0x00,
|
||||
/*! Low value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_LOW = 0x01,
|
||||
/*! Medium value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_MEDIUM = 0x02,
|
||||
/*! High value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_HIGH = 0x03,
|
||||
/*! On value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_ON = 0x04,
|
||||
/*! Auto value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_AUTO = 0x05,
|
||||
/*! Smart value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SMART = 0x06,
|
||||
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_RESERVED = 0x07
|
||||
};
|
||||
|
||||
/*! @brief Values for Fan Mode Sequence attribute,
|
||||
@see ZCL spec, subclause 6.4.2.2.2 */
|
||||
enum zb_zcl_fan_control_fan_mode_sequence_e
|
||||
{
|
||||
/*! Low/Med/High value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_LOW_MED_HIGH = 0x00,
|
||||
/*! Low/High value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_LOW_HIGH = 0x01,
|
||||
/*! Low/Med/High/Auto value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_LOW_MED_HIGH_AUTO = 0x02,
|
||||
/*! Low/High/Auto value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_LOW_HIGH_AUTO = 0x03,
|
||||
/*! On/Auto value */
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_ON_AUTO = 0x04,
|
||||
|
||||
ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_RESERVED = 0x05
|
||||
};
|
||||
|
||||
/** @brief Default value for Fan Control cluster revision global attribute */
|
||||
#define ZB_ZCL_FAN_CONTROL_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Fan Mode attribute */
|
||||
#define ZB_ZCL_FAN_CONTROL_FAN_MODE_DEFAULT_VALUE 0x05
|
||||
|
||||
/** @brief Default value for Fan Mode attribute */
|
||||
#define ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_DEFAULT_VALUE 0x02
|
||||
|
||||
/** @brief Declare attribute list for Fan Control cluster
|
||||
@param attr_list - attribute list name
|
||||
@param fan_mode - pointer to variable to store Fan Mode attribute value
|
||||
@param fan_mode_sequence - pointer to variable to store Fan Mode Sequence attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_FAN_CONTROL_ATTRIB_LIST(attr_list, fan_mode, fan_mode_sequence) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_FAN_CONTROL) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_ID, (fan_mode)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_SEQUENCE_ID, (fan_mode_sequence)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Fan Control cluster attributes */
|
||||
|
||||
/*! @name Fan Control cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Fan Control cluster commands */
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name Fan Control cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_SEQUENCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_SEQUENCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Fan Control cluster */
|
||||
#define ZB_ZCL_FAN_CONTROL_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Fan Control cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL HA Fan Control cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_fan_control_init_server(void);
|
||||
void zb_zcl_fan_control_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_FAN_CONTROL_SERVER_ROLE_INIT zb_zcl_fan_control_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_FAN_CONTROL_CLIENT_ROLE_INIT zb_zcl_fan_control_init_client
|
||||
|
||||
#endif /* ZB_ZCL_FAN_CONTROL_H */
|
||||
@@ -0,0 +1,784 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Groups cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_GROUPS_H
|
||||
#define ZB_ZCL_GROUPS_H 1
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_GROUPS
|
||||
* @{
|
||||
* @details
|
||||
* Groups cluster defined in ZCL spec, clause 3.6. Currently no group name attribute support is
|
||||
* implemented. However, this attribute must be supported for sending and receiving in commands'
|
||||
* payload, so it is being sent as zero string (i. e. single zero byte). On receipt of the
|
||||
* command is able to contain a scene name in the payload, this field will be ignored as a string.
|
||||
*
|
||||
* Cluster requests and responses are documented in submodules.
|
||||
*/
|
||||
|
||||
/** @name Groups cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/* ZB_ZCL_CLUSTER_ID_GROUPS = 0x0004 */
|
||||
|
||||
/** @brief Groups cluster attribute identifiers
|
||||
@see ZCL spec, subclause 3.6.2.2
|
||||
*/
|
||||
enum zb_zcl_groups_attr_e
|
||||
{
|
||||
/** @brief NameSupport attribute */
|
||||
ZB_ZCL_ATTR_GROUPS_NAME_SUPPORT_ID = 0
|
||||
};
|
||||
|
||||
/** @brief Values for NameSupport attribute */
|
||||
enum zb_zcl_groups_name_support_e
|
||||
{
|
||||
/** "Not supported" value */
|
||||
ZB_ZCL_ATTR_GROUPS_NAME_NOT_SUPPORTED = 0,
|
||||
/** "On" value */
|
||||
ZB_ZCL_ATTR_GROUPS_NAME_SUPPORTED = 1 << 7 /* set to 1 the most significant bit */
|
||||
};
|
||||
|
||||
/** @brief Default value for Groups cluster revision global attribute */
|
||||
#define ZB_ZCL_GROUPS_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/**
|
||||
* @brief Declare attribute list for Groups cluster.
|
||||
* @param attr_list - attribute list name.
|
||||
* @param name_support - pointer to variable to store name_support attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(attr_list, name_support) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_GROUPS) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_GROUPS_NAME_SUPPORT_ID, (name_support)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* Groups cluster attributes */
|
||||
|
||||
/** @name Groups cluster command identifiers
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Groups cluster command identifiers.
|
||||
* @see ZCL spec, subclause 3.6.2.2.2.
|
||||
*/
|
||||
enum zb_zcl_groups_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP = 0x00, /**< Add group command identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_VIEW_GROUP = 0x01, /**< View group command identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_GET_GROUP_MEMBERSHIP = 0x02, /**< Get group membership command identifier.
|
||||
*/
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_GROUP = 0x03, /**< Remove group command identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_ALL_GROUPS = 0x04, /**< Remove all groups command identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP_IF_IDENTIFYING = 0x05 /**< Add group if identifying command
|
||||
identifier. */
|
||||
};
|
||||
|
||||
/** @brief Groups cluster response command identifiers
|
||||
@see ZCL spec, subclause 3.6.2.3
|
||||
*/
|
||||
enum zb_zcl_groups_cmd_resp_e
|
||||
{
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP_RES = 0x00, /**< Add group response command identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_VIEW_GROUP_RES = 0x01, /**< View group response command identifier.
|
||||
*/
|
||||
ZB_ZCL_CMD_GROUPS_GET_GROUP_MEMBERSHIP_RES = 0x02, /**< Get group response membership command
|
||||
identifier. */
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_GROUP_RES = 0x03 /**< Remove group response command identifier.
|
||||
*/
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* GROUPS cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP_RES, \
|
||||
ZB_ZCL_CMD_GROUPS_VIEW_GROUP_RES, \
|
||||
ZB_ZCL_CMD_GROUPS_GET_GROUP_MEMBERSHIP_RES, \
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_GROUP_RES
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_GROUPS_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP, \
|
||||
ZB_ZCL_CMD_GROUPS_VIEW_GROUP, \
|
||||
ZB_ZCL_CMD_GROUPS_GET_GROUP_MEMBERSHIP, \
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_GROUP, \
|
||||
ZB_ZCL_CMD_GROUPS_REMOVE_ALL_GROUPS, \
|
||||
ZB_ZCL_CMD_GROUPS_ADD_GROUP_IF_IDENTIFYING
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_GROUPS_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @} */ /* Groups cluster command identifiers */
|
||||
|
||||
/************************** Add group command definitions ****************************/
|
||||
|
||||
/** @defgroup ZB_ZCL_GROUPS_ADD_GROUP Add group command definitions
|
||||
* @{
|
||||
* @details
|
||||
* Add group request and response commands have simple payload. Response command is being filled
|
||||
* and sent by ZCL internals.
|
||||
*
|
||||
* @par Examples
|
||||
*
|
||||
* Filling and sending Add Group request:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_add_group_req
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief Add group command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_add_group_req_s
|
||||
{
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
zb_char_t group_name[1]; /**< Group name, optional */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_add_group_req_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Minimum size of Add group request (group name maybe omitted) */
|
||||
#define ZB_ZCL_ADD_GROUP_REQ_SIZE sizeof(zb_uint16_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Add group command and fills in data request
|
||||
structure. If request contains invalid data, ZB_ZCL_NULL_ID is stored as group_id.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command request data
|
||||
@param add_group_req - variable to save command request
|
||||
@note data_buf buffer should contain command request payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_ADD_GROUP_REQ(data_buf, add_group_req) \
|
||||
{ \
|
||||
zb_zcl_groups_add_group_req_t *add_group_req_ptr; \
|
||||
(add_group_req_ptr) = zb_buf_len(data_buf) >= ZB_ZCL_ADD_GROUP_REQ_SIZE ? \
|
||||
(zb_zcl_groups_add_group_req_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (add_group_req_ptr) \
|
||||
{ \
|
||||
ZB_HTOLE16(&(add_group_req).group_id, &add_group_req_ptr->group_id);\
|
||||
/* group name currently is not supported - do not check it */ \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
add_group_req.group_id = ZB_ZCL_NULL_ID; \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Add group response command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_add_group_res_s
|
||||
{
|
||||
zb_uint8_t status; /**< Operation status */
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_add_group_res_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Add group response size */
|
||||
#define ZB_ZCL_ADD_GROUP_RES_SIZE sizeof(zb_zcl_groups_add_group_res_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Add group response command and returns response data
|
||||
structure or NULL if request contains invalid data.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command response data
|
||||
@param add_group_res - out pointer to zb_zcl_groups_add_group_res_t, containing command
|
||||
response record
|
||||
@note data_buf buffer should contain response command payload without ZCL header
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_ADD_GROUP_RES(data_buf, add_group_res) \
|
||||
{ \
|
||||
(add_group_res) = zb_buf_len(data_buf) >= ZB_ZCL_ADD_GROUP_RES_SIZE ? \
|
||||
(zb_zcl_groups_add_group_res_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (add_group_res) \
|
||||
{ \
|
||||
ZB_ZCL_HTOLE16_INPLACE(&(add_group_res)->group_id); \
|
||||
/* group name currently is not supported - do not check it */ \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Send Add group command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param group_id - group ID to add
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_ADD_GROUP_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, group_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_ADD_GROUP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (group_id)); \
|
||||
/* Group name currently is not supported, put empty string */ \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, ZB_ZCL_NULL_STRING); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* Add group command definitions */
|
||||
|
||||
|
||||
/************************** View group command definitions ****************************/
|
||||
|
||||
/** @defgroup ZB_ZCL_GROUPS_VIEW_GROUP View group command definitions
|
||||
* @{
|
||||
* @details
|
||||
* View Group command and response have simple payload. View group command is being processed,
|
||||
* and View Group response command originates from ZCL internals.
|
||||
*
|
||||
* @par Examples
|
||||
* View Group request command can be formed as:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c view_group_req
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief View group command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_view_group_req_s
|
||||
{
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_view_group_req_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Size of View group request */
|
||||
#define ZB_ZCL_VIEW_GROUP_REQ_SIZE sizeof(zb_zcl_groups_view_group_req_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses View group command and fills in data request
|
||||
structure. If request contains invalid data, ZB_ZCL_NULL_ID is stored as group_id.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command request data
|
||||
@param view_group_req - variable to save command request
|
||||
@note data_buf buffer should contain command request payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_VIEW_GROUP_REQ(data_buf, view_group_req) \
|
||||
{ \
|
||||
zb_zcl_groups_view_group_req_t *view_group_req_ptr; \
|
||||
(view_group_req_ptr) = zb_buf_len(data_buf) >= ZB_ZCL_VIEW_GROUP_REQ_SIZE ? \
|
||||
(zb_zcl_groups_view_group_req_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (view_group_req_ptr) \
|
||||
{ \
|
||||
ZB_HTOLE16(&(view_group_req).group_id, &view_group_req_ptr->group_id); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
view_group_req.group_id = ZB_ZCL_NULL_ID; \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief View group command response structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_view_group_res_s
|
||||
{
|
||||
zb_uint8_t status; /**< Operation status */
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
zb_uint8_t group_name[1]; /**< Group name */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_view_group_res_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal View group response size */
|
||||
#define ZB_ZCL_VIEW_GROUP_RES_SIZE sizeof(zb_zcl_groups_view_group_res_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses View group response command and returns response data
|
||||
structure or NULL if request contains invalid data.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command response data
|
||||
@param view_group_res - out pointer to zb_zcl_groups_add_group_res_t, containing command
|
||||
response record
|
||||
@note data_buf buffer should contain response command payload without ZCL header
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_VIEW_GROUP_RES(data_buf, view_group_res) \
|
||||
{ \
|
||||
(view_group_res) = zb_buf_len(data_buf) >= ZB_ZCL_VIEW_GROUP_RES_SIZE ? \
|
||||
(zb_zcl_groups_view_group_res_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (view_group_res) \
|
||||
{ \
|
||||
ZB_ZCL_HTOLE16_INPLACE(&(view_group_res)->group_id); \
|
||||
/* group name currently is not supported - empty string is returned */ \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Send view group command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param group_id - group ID to add
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_VIEW_GROUP_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, group_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_VIEW_GROUP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (group_id)); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* View group command definitions */
|
||||
|
||||
/************************** Get Group Membership command definitions ****************************/
|
||||
/** @defgroup ZB_ZCL_GROUPS_GET_GRP_MEMB Get Group Membership command definitions
|
||||
* @{
|
||||
* @details
|
||||
* Both Get Group Membership command request and response have a complex array-style payload.
|
||||
*
|
||||
* @par Examples
|
||||
* Get Group Membership request can be filled in as:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_get_group_membership_req
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief Get Group Membership command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_get_group_membership_req_s
|
||||
{
|
||||
zb_uint8_t group_count; /**< Group count */
|
||||
zb_uint16_t group_id[1]; /**< Group id list */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_get_group_membership_req_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Minimum size of Get Group Membership request */
|
||||
#define ZB_ZCL_GET_GROUP_MEMBERSHIP_REQ_SIZE sizeof(zb_uint8_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Get Group Membership command and returns pointer to data request
|
||||
structure. If request contains invalid data, NULL is returned
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command request data
|
||||
@param group_member_req - pointer to command request
|
||||
@note data_buf buffer should contain command request payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_GROUP_MEMBERSHIP_REQ(data_buf, group_member_req) \
|
||||
{ \
|
||||
zb_uint8_t i_tmp; \
|
||||
zb_uint8_t cmd_size = ZB_ZCL_GET_GROUP_MEMBERSHIP_REQ_SIZE; \
|
||||
\
|
||||
(group_member_req) = (zb_buf_len(data_buf) >= cmd_size) ? \
|
||||
(zb_zcl_groups_get_group_membership_req_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (group_member_req) \
|
||||
{ \
|
||||
cmd_size += sizeof(zb_uint16_t) * (group_member_req)->group_count; \
|
||||
if (cmd_size <= zb_buf_len(data_buf)) \
|
||||
{ \
|
||||
for(i_tmp = 0; i_tmp < (group_member_req)->group_count; i_tmp++) \
|
||||
{ \
|
||||
ZB_ZCL_HTOLE16_INPLACE(&(group_member_req)->group_id[i_tmp]); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
group_member_req = NULL; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Get Group Membership command response structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_get_group_membership_res_s
|
||||
{
|
||||
zb_uint8_t capacity; /**< Capacity of group table */
|
||||
zb_uint8_t group_count; /**< Group count */
|
||||
zb_uint16_t group_id[1]; /**< Group id list */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_get_group_membership_res_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Minimum size of Get Group Membership command response */
|
||||
#define ZB_ZCL_GET_GROUP_MEMBERSHIP_RES_SIZE (2*sizeof(zb_uint8_t))
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Get Group Membership command response and returns pointer to data response
|
||||
structure. If response contains invalid data, NULL is returned.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command response data
|
||||
@param group_member_res - pointer to command response
|
||||
@note data_buf buffer should contain command response payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_GROUP_MEMBERSHIP_RES(data_buf, group_member_res) \
|
||||
{ \
|
||||
zb_uint8_t i; \
|
||||
zb_uint8_t cmd_size = ZB_ZCL_GET_GROUP_MEMBERSHIP_RES_SIZE; \
|
||||
\
|
||||
(group_member_res) = (zb_buf_len(data_buf) >= cmd_size) ? \
|
||||
(zb_zcl_groups_get_group_membership_res_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (group_member_res) \
|
||||
{ \
|
||||
cmd_size += sizeof(zb_uint16_t) * (group_member_res)->group_count; \
|
||||
if (cmd_size <= zb_buf_len(data_buf)) \
|
||||
{ \
|
||||
for(i = 0; i < (group_member_res)->group_count; i++) \
|
||||
{ \
|
||||
ZB_ZCL_HTOLE16_INPLACE(&(group_member_res)->group_id[i]); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
group_member_res = NULL; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Initialize Get group membership command
|
||||
@param buffer to put packet to
|
||||
@param ptr - command buffer pointer
|
||||
@param def_resp - enable/disable default response
|
||||
@param group_cnt - group count
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_INIT_GET_GROUP_MEMBERSHIP_REQ(buffer, ptr, def_resp, group_cnt) \
|
||||
{ \
|
||||
ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_GET_GROUP_MEMBERSHIP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (group_cnt)); \
|
||||
}
|
||||
|
||||
/** @brief Add group id to command payload
|
||||
@param ptr - command buffer pointer
|
||||
@param group_id - group ID
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_ADD_ID_GET_GROUP_MEMBERSHIP_REQ(ptr, group_id) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (group_id)); \
|
||||
}
|
||||
|
||||
/** @brief Sends Get group membership command
|
||||
@param buffer to place data to
|
||||
@param ptr - pointer to the memory area after the command data end
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_GET_GROUP_MEMBERSHIP_REQ( \
|
||||
buffer, ptr, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb) \
|
||||
{ \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* Get Group Membership command definitions */
|
||||
|
||||
|
||||
/************************** Remove Group command definitions ****************************/
|
||||
/** @defgroup ZB_ZCL_GROUPS_RM_GRP Remove Group command definitions
|
||||
* @{
|
||||
* @details
|
||||
* Remove Group request and response commands have simple payload. Actual request handling takes
|
||||
* place in ZCL internals.
|
||||
*
|
||||
* @par Examples
|
||||
* Remove Group request sending:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_remove_group_req
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief Remove Group command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_remove_group_req_s
|
||||
{
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_remove_group_req_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Minimum size of Get Group Membership request */
|
||||
#define ZB_ZCL_REMOVE_GROUP_REQ_SIZE sizeof(zb_zcl_groups_remove_group_req_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Remove group command and fills in data request
|
||||
structure. If request contains invalid data, ZB_ZCL_NULL_ID is stored as group_id.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command request data
|
||||
@param rem_group_req - variable to save command request
|
||||
@note data_buf buffer should contain command request payload without ZCL header.
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_REMOVE_GROUP_REQ(data_buf, rem_group_req) \
|
||||
{ \
|
||||
zb_zcl_groups_remove_group_req_t *rem_group_req_ptr; \
|
||||
(rem_group_req_ptr) = zb_buf_len(data_buf) >= ZB_ZCL_REMOVE_GROUP_REQ_SIZE ? \
|
||||
(zb_zcl_groups_remove_group_req_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (rem_group_req_ptr) \
|
||||
{ \
|
||||
ZB_HTOLE16(&(rem_group_req).group_id, &rem_group_req_ptr->group_id); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
rem_group_req.group_id = ZB_ZCL_NULL_ID; \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Remove group response command structure */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_groups_remove_group_res_s
|
||||
{
|
||||
zb_uint8_t status; /**< Operation status */
|
||||
zb_uint16_t group_id; /**< Group id */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_groups_remove_group_res_t;
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @internal Add group response size */
|
||||
#define ZB_ZCL_REMOVE_GROUP_RES_SIZE sizeof(zb_zcl_groups_remove_group_res_t)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Parses Remove group response command and returns response data
|
||||
structure or NULL if request contains invalid data.
|
||||
@param data_buf - pointer to zb_buf_t buffer containing command response data
|
||||
@param rem_group_res - out pointer to zb_zcl_groups_remove_group_res_t, containing command
|
||||
response record
|
||||
@note data_buf buffer should contain response command payload without ZCL header
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_GET_REMOVE_GROUP_RES(data_buf, rem_group_res) \
|
||||
{ \
|
||||
(rem_group_res) = zb_buf_len(data_buf) >= ZB_ZCL_REMOVE_GROUP_RES_SIZE ? \
|
||||
(zb_zcl_groups_remove_group_res_t*)zb_buf_begin(data_buf) : NULL; \
|
||||
\
|
||||
if (rem_group_res) \
|
||||
{ \
|
||||
ZB_ZCL_HTOLE16_INPLACE(&(rem_group_res)->group_id); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Send Remove group command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param group_id - group ID to remove
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_REMOVE_GROUP_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, group_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_REMOVE_GROUP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (group_id)); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* Remove Group command definitions */
|
||||
|
||||
|
||||
/************************** Remove All Groups command definitions ****************************/
|
||||
/** @defgroup ZB_ZCL_GROUPS_RM_ALL_GRPS Remove All Groups command definitions
|
||||
* @{
|
||||
* @details
|
||||
* Remove All Groups command has only request form, and has no payload. Command is being
|
||||
* processed in ZCL internals. If not disabled, command can be responded with Default Response
|
||||
* command.
|
||||
*
|
||||
* @par Example
|
||||
* Remove All Groups command sending:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_remove_all_groups_req
|
||||
* @par
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief Send Remove all groups command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_REMOVE_ALL_GROUPS_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_REMOVE_ALL_GROUPS); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* Remove All Groups command definitions */
|
||||
|
||||
/************************** Add group if identifying command definitions **************************/
|
||||
|
||||
/** @defgroup ZB_ZCL_GROUPS_ADD_IDENT Add group if identifying command definitions
|
||||
* @{
|
||||
* @details
|
||||
* Add Group if Identifying command has simple payload. The command is being processed in ZCL
|
||||
* internals. Since the command has only request form, it can be responded with Default Response
|
||||
* command frame, if not disabled explicitly.
|
||||
*
|
||||
* @b Example:
|
||||
* Add Group if Identifying send:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c add_group_if_ident_req
|
||||
*
|
||||
*/
|
||||
|
||||
/** @brief Send Add group if identifying command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param group_id - group ID to add
|
||||
*/
|
||||
#define ZB_ZCL_GROUPS_SEND_ADD_GROUP_IF_IDENT_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, group_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_GROUPS_ADD_GROUP_IF_IDENTIFYING); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (group_id)); \
|
||||
/* Group name currently is not supported, put empty string */ \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, ZB_ZCL_NULL_STRING); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_GROUPS, cb); \
|
||||
}
|
||||
|
||||
/** @} */ /* Add group if identifying command definitions */
|
||||
|
||||
/**
|
||||
* Handler for incoming group commands directed to server
|
||||
*
|
||||
* @param param - reference to buffer containing command
|
||||
*
|
||||
* @return ZB_TRUE - if command was processed
|
||||
* ZB_FALSE - if command is not for server or is not supported
|
||||
*/
|
||||
zb_bool_t zb_zcl_process_groups_commands_srv(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
* Handler for incoming group commands directed to client
|
||||
*
|
||||
* @param param - reference to buffer containing command
|
||||
*
|
||||
* @return ZB_TRUE - if command was processed
|
||||
* ZB_FALSE - if command is not for client or is not supported
|
||||
*/
|
||||
zb_bool_t zb_zcl_process_groups_commands_cli(zb_uint8_t param);
|
||||
|
||||
/** @cond internals_doc
|
||||
@internal @name Groups cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_GROUPS_NAME_SUPPORT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_GROUPS_NAME_SUPPORT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @internal @brief Number of attributes mandatory for reporting in Groups cluster. */
|
||||
#define ZB_ZCL_GROUPS_REPORT_ATTR_COUNT 0
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_SCENES
|
||||
/** Scenes fieldset length for Groups cluster */
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_SCENE_FIELD_SETS_LENGTH 0
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_SCENES */
|
||||
|
||||
/** @}
|
||||
@endcond */ /* Groups cluster internals */
|
||||
|
||||
/** @} */ /* ZCL Groups cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_groups_init_server(void);
|
||||
void zb_zcl_groups_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_SERVER_ROLE_INIT zb_zcl_groups_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_GROUPS_CLIENT_ROLE_INIT zb_zcl_groups_init_client
|
||||
|
||||
#endif /* ZB_ZCL_GROUPS_H */
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Bed Sensor for GreenPower cluster
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_GRPW_BED_SENSOR_H
|
||||
#define ZB_ZCL_GRPW_BED_SENSOR_H 1
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_BED_SENSOR 0xfd00
|
||||
|
||||
enum zb_zcl_grpw_bed_sensor_attr_e
|
||||
{
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_STATUS_ID = 0x0000,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_CALC_DATA_0_ID = 0x0010,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_CALC_DATA_1_ID = 0x0011,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_SENSITIVITY_SETTING = 0x0020,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_CALC_DATA_SEND_INTERVAL = 0x0021,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_CALC_DATA_SEND_MODE = 0x0022,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_EXIT_DETECT_ADD_DELAY = 0x0023,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_OCCUPANCY_DETECT_ALG_SEL = 0x0024,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_TYPE = 0x0025,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_STATUS_REPORT_INTERVAL = 0x0026,
|
||||
ZB_ZCL_ATTR_GRPW_BED_SENSOR_COMMANDS_FOR_SENSING_MODULE = 0x0030,
|
||||
ZB_ZCL_ATTR_GRPW_BED_PENDING_CONFIGURATION = 0x00F0,
|
||||
};
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_BED_SENSOR_SERVER_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_BED_SENSOR_CLIENT_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
|
||||
#endif /* ZB_ZCL_GRPW_BED_SENSOR_H */
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Frequency agility for GreenPower cluster
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_GRPW_FREQ_AGILITY_H
|
||||
#define ZB_ZCL_GRPW_FREQ_AGILITY_H 1
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_FREQ_AGILITY 0xFCFA
|
||||
|
||||
enum zb_zcl_grpw_freq_agility_attr_e
|
||||
{
|
||||
ZB_ZCL_ATTR_GRPW_FREQ_AGILITY_BRIDGE_ADDR = 0x0000,
|
||||
ZB_ZCL_ATTR_GRPW_FREQ_AGILITY_ACTIVE_CHANNEL_MASK = 0x0001,
|
||||
};
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_FREQ_AGILITY_SERVER_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
#define ZB_ZCL_CLUSTER_ID_GRPW_FREQ_AGILITY_CLIENT_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
|
||||
#endif /* ZB_ZCL_GRPW_FREQ_AGILITY_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,471 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: IAS WD cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_IAS_WD_H
|
||||
#define ZB_ZCL_IAS_WD_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_IAS_WD
|
||||
* @{
|
||||
* @details
|
||||
* IAS WD cluster definitions
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_IAS_WD */
|
||||
|
||||
/*! @name IAS WD cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief IAS WD cluster attribute identifiers
|
||||
@see ZCL spec, IAS WD Cluster 8.4.2.2
|
||||
*/
|
||||
enum zb_zcl_ias_wd_attr_e
|
||||
{
|
||||
/*! @brief Max Duration attribute, ZCL spec 8.4.2.2.1 */
|
||||
ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_ID = 0x0000,
|
||||
|
||||
};
|
||||
|
||||
/** @brief Default value for IAS WD cluster revision global attribute */
|
||||
#define ZB_ZCL_IAS_WD_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Max Duration attribute default value */
|
||||
#define ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_DEF_VALUE 240
|
||||
|
||||
/** @brief Max Duration attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_MIN_VALUE 0
|
||||
|
||||
/** @brief Max Duration attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_MAX_VALUE 0xfffe
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name IAS WD cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in IAS WD cluster */
|
||||
#define ZB_ZCL_IAS_WD_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @} */ /* IAS WD cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for IAS WD cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param max_duration - pointer to variable to store Max Duration attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_IAS_WD_ATTRIB_LIST(attr_list, \
|
||||
max_duration) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_IAS_WD) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_WD_MAX_DURATION_ID, (max_duration)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* IAS WD cluster attributes */
|
||||
|
||||
/*! @name IAS WD cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief IAS WD cluster command identifiers
|
||||
@see ZCL spec, IAS WD Cluster, 8.4.2.3
|
||||
*/
|
||||
enum zb_zcl_ias_wd_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_IAS_WD_START_WARNING_ID = 0x00, /**< Start warning command. ZCL spec 8.4.2.3.1 */
|
||||
ZB_ZCL_CMD_IAS_WD_SQUAWK_ID = 0x01 /**< Squawk command. ZCL spec 8.4.2.3.2 */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* IAS WD cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_IAS_WD_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_IAS_WD_START_WARNING_ID, \
|
||||
ZB_ZCL_CMD_IAS_WD_SQUAWK_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_IAS_WD_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/******************************* Start warning command ******************************/
|
||||
|
||||
/** @brief Warning Mode Field, see ZCL spec 8.4.2.3.1.2 */
|
||||
enum zb_zcl_ias_wd_warning_mode_e
|
||||
{
|
||||
/** Stop */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_STOP = 0x00,
|
||||
/** Burglar */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_BURGLAR = 0x01,
|
||||
/** Fire */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_FIRE = 0x02,
|
||||
/** Emergency */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_EMERGENCY = 0x03,
|
||||
/* Police panic */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_POLICE_PANIC = 0x04,
|
||||
/* Fire panic */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_FIRE_PANIC = 0x05,
|
||||
/* Emergency panic (i.e., medical issue) */
|
||||
ZB_ZCL_IAS_WD_WARNING_MODE_EMERGENCY_PANIC = 0x06,
|
||||
};
|
||||
|
||||
/** @brief Strobe Field, see ZCL spec 8.4.2.3.1.3 */
|
||||
enum zb_zcl_ias_wd_strobe_e
|
||||
{
|
||||
/** No strobe */
|
||||
ZB_ZCL_IAS_WD_STROBE_NO_STROBE = 0x00,
|
||||
/** Use strobe in parallel to warning */
|
||||
ZB_ZCL_IAS_WD_STROBE_USE_STROBE = 0x01,
|
||||
};
|
||||
|
||||
/** @brief Siren Level Field, see ZCL spec 8.4.2.3.1.4 */
|
||||
enum zb_zcl_ias_wd_siren_level_e
|
||||
{
|
||||
/** Low level sound */
|
||||
ZB_ZCL_IAS_WD_SIREN_LEVEL_LOW = 0x00,
|
||||
/** Medium level sound */
|
||||
ZB_ZCL_IAS_WD_SIREN_LEVEL_MEDIUM = 0x01,
|
||||
/** High level sound */
|
||||
ZB_ZCL_IAS_WD_SIREN_LEVEL_HIGH = 0x02,
|
||||
/** Very high level sound */
|
||||
ZB_ZCL_IAS_WD_SIREN_LEVEL_VERY_HIGH = 0x03,
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Strobe Level Field, see ZCL spec 8.4.2.2.1.7
|
||||
*/
|
||||
enum zb_zcl_ias_wd_strobe_level_e
|
||||
{
|
||||
/** Low level strobe */
|
||||
ZB_ZCL_IAS_WD_STROBE_LEVEL_LOW = 0x00,
|
||||
/** Medium level strobe */
|
||||
ZB_ZCL_IAS_WD_STROBE_LEVEL_MEDIUM = 0x01,
|
||||
/** High level strobe */
|
||||
ZB_ZCL_IAS_WD_STROBE_LEVEL_HIGH = 0x02,
|
||||
/** Very high level strobe */
|
||||
ZB_ZCL_IAS_WD_STROBE_LEVEL_VERY_HIGH = 0x03,
|
||||
};
|
||||
|
||||
/*! @brief Structure representsation Start warning command. ZCL spec 8.4.2.3.1 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_wd_start_warning_s
|
||||
{
|
||||
/** Status - enum flags Warning mode, Strobe and Siren Level, see ZCL spec 8.4.2.3.1 */
|
||||
zb_uint8_t status;
|
||||
/** Warning duration*/
|
||||
zb_uint16_t duration;
|
||||
/** Strobe Duty Cycle */
|
||||
zb_uint8_t strobe_duty_cycle;
|
||||
/** Strobe Level (enum zb_zcl_ias_wd_strobe_level_e) */
|
||||
zb_uint8_t strobe_level;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_wd_start_warning_t;
|
||||
|
||||
/*! @brief Get Warning Mode from payload Start warning command */
|
||||
#define ZB_ZCL_IAS_WD_GET_WARNING_MODE(status) (((status) >> 4) & 0x0f)
|
||||
|
||||
/*! @brief Get Strobe from payload Start warning command */
|
||||
#define ZB_ZCL_IAS_WD_GET_STROBE(status) (((status) >> 2) & 0x03)
|
||||
|
||||
/*! @brief Get Siren level from payload Start warning command */
|
||||
#define ZB_ZCL_IAS_WD_GET_SIREN_LEVEL(status) ((status) & 0x03)
|
||||
|
||||
/*! @brief Make Status field Start warning command from Warning Mode, Strobe and Siren Level */
|
||||
#define ZB_ZCL_IAS_WD_MAKE_START_WARNING_STATUS(warning_mode, strobe, siren_level) \
|
||||
(((siren_level) & 0x03) | (((strobe) & 0x03) << 2) | (((warning_mode) & 0x0f) << 4))
|
||||
|
||||
/*! @brief Strobe Duty Cycle default value */
|
||||
#define ZB_ZCL_IAS_WD_STROBE_DUTY_CYCLE_DEFAULT_VALUE 0
|
||||
/*! @brief Strobe Duty Cycle maximum value */
|
||||
#define ZB_ZCL_IAS_WD_STROBE_DUTY_CYCLE_MAX_VALUE 100
|
||||
|
||||
/*! @brief Start warning command. ZCL spec 8.4.2.3.1
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param status - Status - enum flags Warning mode, Strobe and Siren Level
|
||||
@param duration - Warning duration
|
||||
@param strobe_duty_cycle - Strobe Duty Cycle
|
||||
@param strobe_level - Strobe Level, see @ref zb_zcl_ias_wd_strobe_level_e
|
||||
*/
|
||||
#define ZB_ZCL_IAS_WD_SEND_START_WARNING_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
status, duration, strobe_duty_cycle, strobe_level) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_WD_START_WARNING_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (status)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (duration)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (strobe_duty_cycle)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (strobe_level)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_WD, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Start warning command. ZCL spec 8.4.2.3.1
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_wd_start_warning_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_WD_GET_START_WARNING_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_wd_start_warning_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_wd_start_warning_t *src_ptr = \
|
||||
(zb_zcl_ias_wd_start_warning_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->status = src_ptr->status; \
|
||||
ZB_HTOLE16(&((data_ptr)->duration), &(src_ptr->duration)); \
|
||||
(data_ptr)->strobe_duty_cycle = src_ptr->strobe_duty_cycle; \
|
||||
(data_ptr)->strobe_level = src_ptr->strobe_level; \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Squawk command ******************************/
|
||||
|
||||
/** @brief Squawk Mode Field, see ZCL spec 8.4.2.3.2.2 */
|
||||
enum zb_zcl_ias_wd_squawk_mode_e
|
||||
{
|
||||
/** Notification sound for "System is armed" */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_MODE_ARMED = 0x00,
|
||||
/** Notification sound for "System is disarmed" */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_MODE_DISARMED = 0x01,
|
||||
};
|
||||
|
||||
/** @brief Strobe Field, see ZCL spec 8.4.2.3.2.3 */
|
||||
enum zb_zcl_ias_wd_squawk_strobe_e
|
||||
{
|
||||
/** No strobe*/
|
||||
ZB_ZCL_IAS_WD_SQUAWK_STROBE_NO_STROBE = 0x00,
|
||||
/** Use strobe blink in parallel to squawk */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_STROBE_USE_STROBE = 0x01,
|
||||
};
|
||||
|
||||
/** @brief Squawk level Field, see ZCL spec 8.4.2.3.2.4 */
|
||||
enum zb_zcl_ias_wd_squawk_level_e
|
||||
{
|
||||
/** Low level sound */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_LEVEL_LOW = 0x00,
|
||||
/** Medium level sound */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_LEVEL_MEDIUM = 0x01,
|
||||
/** High level sound */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_LEVEL_HIGH = 0x02,
|
||||
/** Very High level sound */
|
||||
ZB_ZCL_IAS_WD_SQUAWK_LEVEL_VERY_HIGH = 0x03,
|
||||
};
|
||||
|
||||
/*! @brief Structure representsation Squawk command. ZCL spec 8.4.2.3.2 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_wd_squawk_s
|
||||
{
|
||||
/** Status - enum flags Squawk mode, Strobe and Squawk level, see ZCL spec 8.4.2.3.2 */
|
||||
zb_uint8_t status;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_wd_squawk_t;
|
||||
|
||||
/*! @brief Get Squawk Mode from payload Squawk command */
|
||||
#define ZB_ZCL_IAS_WD_GET_SQUAWK_MODE(status) (((status) >> 4) & 0x0f)
|
||||
|
||||
/*! @brief Get Squawk Strobe from payload Squawk command */
|
||||
#define ZB_ZCL_IAS_WD_GET_SQUAWK_STROBE(status) (((status) >> 3) & 0x01)
|
||||
|
||||
/*! @brief Get Squawk Level from payload Squawk command */
|
||||
#define ZB_ZCL_IAS_WD_GET_SQUAWK_LEVEL(status) ((status) & 0x03)
|
||||
|
||||
/*! @brief Make Status field Squawk command from Squawk mode, Strobe and Squawk level */
|
||||
#define ZB_ZCL_IAS_WD_MAKE_SQUAWK_STATUS(mode, strobe, level) \
|
||||
(((level) & 0x03) | (((strobe) & 0x01) << 3) | (((mode) & 0x0f) << 4))
|
||||
|
||||
/*! @brief Squawk command. ZCL spec 8.4.2.3.2
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback for getting command send status
|
||||
@param status - Status, see @ref zb_zcl_ias_wd_squawk_s
|
||||
*/
|
||||
#define ZB_ZCL_IAS_WD_SEND_SQUAWK_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
status) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_WD_SQUAWK_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (status)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_WD, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Squawk command. ZCL spec 8.4.2.3.2
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_wd_squawk_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_WD_GET_SQUAWK_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_wd_squawk_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_wd_squawk_t *src_ptr = \
|
||||
(zb_zcl_ias_wd_squawk_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->status = src_ptr->status; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* IAS WD cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL IAS WD cluster definitions */
|
||||
|
||||
|
||||
/** @brief Declare run Start Warning command for User Application
|
||||
*/
|
||||
typedef struct zb_zcl_ias_wd_start_warning_value_param_s
|
||||
{
|
||||
zb_uint8_t warning_mode; /*!< Warning Mode */
|
||||
zb_uint8_t strobe; /*!< Strobe */
|
||||
zb_uint8_t siren_level; /*!< Siren level */
|
||||
zb_uint16_t duration; /*!< Duration */
|
||||
zb_uint8_t strobe_duty_cycle; /*!< Strobe duty cycle */
|
||||
zb_uint8_t strobe_level; /*!< Strobe level */
|
||||
} zb_zcl_ias_wd_start_warning_value_param_t;
|
||||
|
||||
/*! Struct for invoke User App & continue after */
|
||||
typedef struct zb_zcl_ias_wd_start_warning_user_app_schedule_e
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info; /**< Parameters for continue command,
|
||||
see @ref zb_zcl_parsed_hdr_s */
|
||||
zb_zcl_ias_wd_start_warning_value_param_t param; /**< User App command parameters,
|
||||
see @ref zb_zcl_ias_wd_start_warning_value_param_s */
|
||||
} zb_zcl_ias_wd_start_warning_user_app_schedule_t;
|
||||
|
||||
#define ZB_ZCL_IAS_WD_START_WARNING_SCHEDULE_USER_APP(buffer, pcmd_info, \
|
||||
warningMode, strobe_, siren_level_, duration_, strobe_duty_cycle_, strobe_level_) \
|
||||
{ \
|
||||
zb_zcl_ias_wd_start_warning_user_app_schedule_t* user_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_ias_wd_start_warning_user_app_schedule_t); \
|
||||
ZB_MEMMOVE(&(user_data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
|
||||
user_data->param.warning_mode = (warningMode); \
|
||||
user_data->param.strobe = (strobe_); \
|
||||
user_data->param.siren_level = (siren_level_); \
|
||||
user_data->param.duration = (duration_); \
|
||||
user_data->param.strobe_duty_cycle = (strobe_duty_cycle_); \
|
||||
user_data->param.strobe_level = (strobe_level_); \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_ias_wd_start_warning_invoke_user_app, (buffer)); \
|
||||
}
|
||||
|
||||
/** @brief Declare run Squawk command for User Application
|
||||
*/
|
||||
typedef struct zb_zcl_ias_wd_squawk_value_param_s
|
||||
{
|
||||
zb_uint8_t squawk_mode; /*!< Squawk Mode */
|
||||
zb_uint8_t strobe; /*!< Strobe */
|
||||
zb_uint8_t squawk_level; /*!< Squawk level */
|
||||
} zb_zcl_ias_wd_squawk_value_param_t;
|
||||
|
||||
/*! Struct for invoke User App & continue after */
|
||||
typedef struct zb_zcl_ias_wd_squawk_user_app_schedule_e
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info; /**< Parameters for continue command,
|
||||
see @ref zb_zcl_parsed_hdr_s */
|
||||
zb_zcl_ias_wd_squawk_value_param_t param; /**< User App command parameters,
|
||||
see @ref zb_zcl_ias_wd_squawk_value_param_s */
|
||||
} zb_zcl_ias_wd_squawk_user_app_schedule_t;
|
||||
|
||||
#define ZB_ZCL_IAS_WD_SQUAWK_SCHEDULE_USER_APP(buffer, pcmd_info, \
|
||||
squawkMode, strobe_, level) \
|
||||
{ \
|
||||
zb_zcl_ias_wd_squawk_user_app_schedule_t* user_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_ias_wd_squawk_user_app_schedule_t); \
|
||||
ZB_MEMMOVE(&(user_data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
|
||||
user_data->param.squawk_mode = (squawkMode); \
|
||||
user_data->param.strobe = (strobe_); \
|
||||
user_data->param.squawk_level = (level); \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_ias_wd_squawk_invoke_user_app, ((buffer))); \
|
||||
}
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_ias_wd_init_server(void);
|
||||
void zb_zcl_ias_wd_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_SERVER_ROLE_INIT zb_zcl_ias_wd_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_WD_CLIENT_ROLE_INIT zb_zcl_ias_wd_init_client
|
||||
|
||||
#endif /* ZB_ZCL_IAS_WD_H */
|
||||
@@ -0,0 +1,934 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: IAS Zone cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_IAS_ZONE_H
|
||||
#define ZB_ZCL_IAS_ZONE_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_IAS_ZONE
|
||||
* @{
|
||||
* @details
|
||||
* IAS Zone cluster definitions
|
||||
*/
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @brief Hook on Write attribute
|
||||
* send Zone Status Change Notification Command if change ZoneStatus attribute */
|
||||
void zb_zcl_ias_zone_write_attr_hook(zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value);
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_IAS_ZONE */
|
||||
|
||||
/*! @name IAS Zone cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief IAS Zone cluster attribute identifiers
|
||||
@see ZCL spec, IAS Zone Cluster 8.2.2.2
|
||||
*/
|
||||
enum zb_zcl_ias_zone_attr_e
|
||||
{
|
||||
/*! @brief ZoneState attribute, ZCL spec 8.2.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONESTATE_ID = 0x0000,
|
||||
/*! @brief ZoneType attribute, ZCL spec 8.2.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONETYPE_ID = 0x0001,
|
||||
/*! @brief ZoneStatus attribute, ZCL spec 8.2.2.2.1.3 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID = 0x0002,
|
||||
/*! @brief IAS_CIE_Address attribute, ZCL spec 8.2.2.2.2.1. */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID = 0x0010,
|
||||
/*! @brief ZoneID attribute, ZCL spec 8.2.2.1.2.2 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONEID_ID = 0x0011,
|
||||
/*! @brief NumberOfZoneSensitivityLevelsSupported attribute, ZCL spec 8.2.2.1.2.3 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_ID = 0x0012,
|
||||
/*! @brief CurrentZoneSensitivityLevel attribute, ZCL spec 8.2.2.1.2.4 */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_CURRENT_ZONE_SENSITIVITY_LEVEL_ID = 0x0013,
|
||||
/* custom attribute */
|
||||
ZB_ZCL_ATTR_CUSTOM_ZGP_CALIBRATION = 0x8000,
|
||||
ZB_ZCL_ATTR_CUSTOM_ZGP_CLOUD_ACK = 0x8003,
|
||||
/* IAS_CIE_Address can be reassigned via Write attribute only when ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET is equal to ZB_FALSE */
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET = 0xE000,
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_EP = 0xE001,
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_SHORT_ADDR = 0xE002,
|
||||
/* TODO: move this attribute to IAS Zone ZCL implementation */
|
||||
/*! @brief Struct with pointers on User App callbacks */
|
||||
ZB_ZCL_ATTR_IAS_ZONE_INT_CTX_ID = 0xeffe,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IAS Zone ZoneState value
|
||||
*/
|
||||
enum zb_zcl_ias_zone_zonestate_e
|
||||
{
|
||||
/** @brief ZoneState not enrolled value */
|
||||
ZB_ZCL_IAS_ZONE_ZONESTATE_NOT_ENROLLED = 0,
|
||||
|
||||
/** @brief ZoneState enrolled value */
|
||||
ZB_ZCL_IAS_ZONE_ZONESTATE_ENROLLED = 1,
|
||||
};
|
||||
|
||||
/** @brief IAS Zone ZoneState attribute default value */
|
||||
#define ZB_ZCL_IAS_ZONE_ZONESTATE_DEF_VALUE ZB_ZCL_IAS_ZONE_ZONESTATE_NOT_ENROLLED
|
||||
|
||||
/** @brief Default value for IAS Zone cluster revision global attribute */
|
||||
#define ZB_ZCL_IAS_ZONE_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/**
|
||||
* @brief IAS Zone ZoneType value
|
||||
*/
|
||||
enum zb_zcl_ias_zone_zonetype_e
|
||||
{
|
||||
/** @brief ZoneType Standard CIE System Alarm value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_STANDARD_CIE = 0x0000,
|
||||
|
||||
/** @brief ZoneType Motion value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_MOTION = 0x000d,
|
||||
|
||||
/** @brief ZoneType Contact switch value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_CONTACT_SWITCH = 0x0015,
|
||||
|
||||
/** @brief ZoneType Fire sensor value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_FIRE_SENSOR = 0x0028,
|
||||
|
||||
/** @brief ZoneType Water sensor value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_WATER_SENSOR = 0x002a,
|
||||
|
||||
/** @brief ZoneType Gas sensor value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_GAS_SENSOR = 0x002b,
|
||||
|
||||
/** @brief ZoneType Personal emergency value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_PERSONAL_EMERGENCY = 0x002c,
|
||||
|
||||
/** @brief ZoneType Vibration / Movement sensor value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_VIBRATION_MOVEMENT = 0x002d,
|
||||
|
||||
/** @brief ZoneType Remote Control value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_REMOTE_CONTROL = 0x010f,
|
||||
|
||||
/** @brief ZoneType Key fob value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_KEY_FOB = 0x0115,
|
||||
|
||||
/** @brief ZoneType Keypad value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_KEYPAD = 0x021d,
|
||||
|
||||
/** @brief ZoneType Standard Warning Device value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_STANDARD_WARNING = 0x0225,
|
||||
|
||||
/** @brief Manufacturer specific ZoneType value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_MANUF_SPEC = 0x8000,
|
||||
|
||||
/** @brief ZoneType Invalid Zone Type value */
|
||||
ZB_ZCL_IAS_ZONE_ZONETYPE_INVALID = 0xffff,
|
||||
|
||||
};
|
||||
|
||||
/*! @brief IAS Zone ZoneStatus attribute flags
|
||||
@see ZCL spec 8.2.2.2.1.3
|
||||
*/
|
||||
enum zb_zcl_ias_zone_zonestatus_e
|
||||
{
|
||||
/** Alarm 1 */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM1 = 1 << 0,
|
||||
/** Alarm 2 */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM2 = 1 << 1,
|
||||
/** Tamper */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_TAMPER = 1 << 2,
|
||||
/** Battery */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_BATTERY = 1 << 3,
|
||||
/** Supervision reports */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_SUPERVISION = 1 << 4,
|
||||
/** Restore reports */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_RESTORE = 1 << 5,
|
||||
/** Trouble */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_TROUBLE = 1 << 6,
|
||||
/** AC (mains) */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_AC_MAINS = 1 << 7,
|
||||
/** Test */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_TEST = 1 << 8,
|
||||
/** Battery Defect */
|
||||
ZB_ZCL_IAS_ZONE_ZONE_STATUS_BATTERY_DEFECT = 1 << 9,
|
||||
};
|
||||
|
||||
/** @brief IAS Zone ZoneStatus attribute default value */
|
||||
#define ZB_ZCL_IAS_ZONE_ZONE_STATUS_DEF_VALUE 0
|
||||
|
||||
/** @brief Min value for NumberOfZoneSensitivityLevelsSupported attribute */
|
||||
#define ZB_ZCL_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_MIN_VALUE ((zb_uint8_t)0x02)
|
||||
|
||||
/** @brief Default value for NumberOfZoneSensitivityLevelsSupported attribute */
|
||||
#define ZB_ZCL_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_DEFAULT_VALUE \
|
||||
ZB_ZCL_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_MIN_VALUE
|
||||
|
||||
/** @brief Default value for CurrentZoneSensitivityLevel attribute */
|
||||
#define ZB_ZCL_IAS_ZONE_CURRENT_ZONE_SENSITIVITY_LEVEL_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief IAS Zone ZoneID attribute default value */
|
||||
#define ZB_ZCL_IAS_ZONEID_ID_DEF_VALUE 0xff
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** This macros should not be used by the user application directly */
|
||||
/*! @internal @name IAS Zone cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CUSTOM_CIE_EP(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_EP, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_CUSTOM_CIE_SHORT_ADDR(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_CUSTOM_CIE_SHORT_ADDR, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONESTATE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_ZONETYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONETYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_16BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_16BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_IEEE_ADDR, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_ZONEID_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_ZONEID_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_CURRENT_ZONE_SENSITIVITY_LEVEL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_CURRENT_ZONE_SENSITIVITY_LEVEL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IAS_ZONE_INT_CTX_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IAS_ZONE_INT_CTX_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_NULL, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in IAS Zone cluster */
|
||||
#define ZB_ZCL_IAS_ZONE_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for IAS Zone cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param zone_state - pointer to variable to store ZoneState attribute
|
||||
@param zone_type - pointer to variable to store ZoneType attribute
|
||||
@param zone_status - pointer to variable to store ZoneStatus attribute
|
||||
@param ias_cie_address - pointer to variable to store IAS-CIE address attribute
|
||||
@param cie_short_addr - custom attribute to store CIE short address
|
||||
@param cie_ep - custom attribute to store CIE Endpoint number
|
||||
*/
|
||||
/* FIXME: declare custom attributes internally */
|
||||
#define ZB_ZCL_DECLARE_IAS_ZONE_ATTRIB_LIST( \
|
||||
attr_list, zone_state, zone_type, zone_status,ias_cie_address, \
|
||||
cie_short_addr, cie_ep) \
|
||||
zb_uint8_t cie_addr_is_set_##attr_list; \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONESTATE_ID, (zone_state)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONETYPE_ID, (zone_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, (zone_status)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID, (ias_cie_address)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_SHORT_ADDR, (cie_short_addr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_EP, (cie_ep)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET, &(cie_addr_is_set_##attr_list)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @brief Declare attribute list for IAS Zone cluster - server side (extended attribute set)
|
||||
@param attr_list - attribute list name
|
||||
@param zone_state - pointer to variable to store ZoneState attribute
|
||||
@param zone_type - pointer to variable to store ZoneType attribute
|
||||
@param zone_status - pointer to variable to store ZoneStatus attribute
|
||||
@param ias_cie_address - pointer to variable to store IAS-CIE address attribute
|
||||
@param zone_id - pointer to variable to store Zone ID attribute
|
||||
@param number_of_zone_sens_levels_supported - pointer to variable to store
|
||||
NumberOfZoneSensitivityLevelsSupported attribute
|
||||
@param current_zone_sens_level - pointer to variable to store CurrentZoneSensitivityLevel attribute
|
||||
@param cie_short_addr - custom attribute to store CIE short address
|
||||
@param cie_ep - custom attribute to store CIE Endpoint number
|
||||
*/
|
||||
/* FIXME: declare custom attributes internally */
|
||||
#define ZB_ZCL_DECLARE_IAS_ZONE_ATTRIB_LIST_EXT( \
|
||||
attr_list, zone_state, zone_type, zone_status, number_of_zone_sens_levels_supported, current_zone_sens_level, \
|
||||
ias_cie_address, zone_id, cie_short_addr, cie_ep) \
|
||||
zb_uint8_t cie_addr_is_set_##attr_list; \
|
||||
zb_uint16_t last_change_##attr_list; \
|
||||
zb_zcl_ias_zone_int_ctx_t int_ctx_##attr_list; \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_IAS_ZONE) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONESTATE_ID, (zone_state)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONETYPE_ID, (zone_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, (zone_status)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID, (ias_cie_address)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_ZONEID_ID, (zone_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_ID, \
|
||||
(number_of_zone_sens_levels_supported)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_CURRENT_ZONE_SENSITIVITY_LEVEL_ID, \
|
||||
(current_zone_sens_level)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IAS_ZONE_INT_CTX_ID, &(int_ctx_##attr_list)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_SHORT_ADDR, (cie_short_addr)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_EP, (cie_ep)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_CUSTOM_CIE_ADDR_IS_SET, &(cie_addr_is_set_##attr_list)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* IAS Zone cluster attributes */
|
||||
|
||||
/*! @name IAS Zone cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief IAS Zone cluster command identifiers
|
||||
@see ZCL spec, IAS Zone Cluster, 8.2.2.3
|
||||
*/
|
||||
enum zb_zcl_ias_zone_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_RESPONSE_ID = 0x00, /**< "Zone Enroll Response" command,
|
||||
* ZCL spec 8.2.2.3.1 */
|
||||
/**< "Initiate Normal Operation Mode" command, ZCL spec 8.2.2.2.1 */
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_NORMAL_OPERATION_MODE_ID = 0x01,
|
||||
/**< "Initiate Test Mode" command, ZCL spec 8.2.2.2.2.3 */
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_TEST_MODE_ID = 0x02,
|
||||
};
|
||||
|
||||
|
||||
/*! @brief IAS Zone cluster response command identifiers
|
||||
@see ZCL spec, IAS Zone Cluster, 8.2.2.4
|
||||
*/
|
||||
enum zb_zcl_ias_zone_resp_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_STATUS_CHANGE_NOT_ID = 0x00, /**< "Zone Status Change Notification" command.
|
||||
ZCL spec 8.2.2.4.1 */
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_REQUEST_ID = 0x01 /**< "Zone Enroll Request" command.
|
||||
ZCL spec 8.2.2.4.2 */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Ias zone cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_SERVER_ROLE_RECEIVED_CMD_LIST \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_RESPONSE_ID, \
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_NORMAL_OPERATION_MODE_ID, \
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_TEST_MODE_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_CLIENT_ROLE_RECEIVED_CMD_LIST \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_STATUS_CHANGE_NOT_ID, \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_REQUEST_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_IAS_ZONE_CLIENT_ROLE_RECEIVED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_IAS_ZONE_SERVER_ROLE_RECEIVED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/*! @brief Structure representsation of Initiate Test Mode - Errata to 05-3520-29 Spec, 1.1.23.2.2.1 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_zone_init_test_mode_ha_s
|
||||
{
|
||||
/** Test mode duration */
|
||||
zb_uint8_t test_mode_duration;
|
||||
/** Current Zone Sensitivity Level */
|
||||
zb_uint8_t current_zone_sens_level;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_zone_init_test_mode_t;
|
||||
|
||||
/** @brief Macro for getting "Initiate Test Mode" command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_zone_init_test_mode_t.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_GET_INITIATE_TEST_MODE_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_zone_init_test_mode_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_zone_init_test_mode_t *src_ptr = \
|
||||
(zb_zcl_ias_zone_init_test_mode_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->test_mode_duration = src_ptr->test_mode_duration; \
|
||||
(data_ptr)->current_zone_sens_level = src_ptr->current_zone_sens_level; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Initiate Test Mode command
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
@param test_mode_duration - Test Mode duration
|
||||
@param current_zone_sens_level - CurrentZoneSensitivityLevel
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_INITIATE_TEST_MODE_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb, \
|
||||
test_mode_duration, current_zone_sens_level) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, ZB_ZCL_ENABLE_DEFAULT_RESPONSE) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_TEST_MODE_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (test_mode_duration)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (current_zone_sens_level)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Initiate Normal Operation Mode command
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_INITIATE_NORMAL_OPERATION_MODE_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, ZB_ZCL_ENABLE_DEFAULT_RESPONSE) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_INITIATE_NORMAL_OPERATION_MODE_ID); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/******************************* Zone Status Change Notification ******************************/
|
||||
|
||||
/*! @brief Structure representsation of Zone Status Change Notification
|
||||
* see ZCL spec 8.2.2.4.1.1 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_zone_status_change_not_s
|
||||
{
|
||||
/** Zone Status, see @ref zb_zcl_ias_zone_zonestatus_e*/
|
||||
zb_uint16_t zone_status;
|
||||
/** Extended Status */
|
||||
zb_uint8_t extended_status;
|
||||
/** Zone ID*/
|
||||
zb_uint8_t zone_id;
|
||||
/** Delay */
|
||||
zb_uint16_t delay;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_zone_status_change_not_t;
|
||||
|
||||
|
||||
/*! @brief Zone Status Change Notification command
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
@param zone_status - Zone Status, see @ref zb_zcl_ias_zone_zonestatus_e
|
||||
@param extended_status - Extended Status
|
||||
@param zone_id - Zone ID
|
||||
@param delay - Delay
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_STATUS_CHANGE_NOTIFICATION_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb, \
|
||||
zone_status, extended_status, zone_id, delay ) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_STATUS_CHANGE_NOT_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (zone_status)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (extended_status)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (zone_id)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (delay)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Zone Status Change Notification command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_zone_status_change_not_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_GET_STATUS_CHANGE_NOTIFICATION_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_zone_status_change_not_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_zone_status_change_not_t *src_ptr = \
|
||||
(zb_zcl_ias_zone_status_change_not_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE16(&((data_ptr)->zone_status), &(src_ptr->zone_status)); \
|
||||
(data_ptr)->extended_status = src_ptr->extended_status; \
|
||||
(data_ptr)->zone_id = src_ptr->zone_id; \
|
||||
ZB_HTOLE16(&((data_ptr)->delay), &(src_ptr->delay)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Zone Enroll Request command ******************************/
|
||||
|
||||
/*! @brief Structure representsation of "Zone Enroll Request" command
|
||||
* see ZCL spec 8.2.2.4.1.2 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_zone_enroll_request_s
|
||||
{
|
||||
/** Zone Type, see @ref zb_zcl_ias_zone_zonetype_e*/
|
||||
zb_uint16_t zone_type;
|
||||
/** Manufacturer code */
|
||||
zb_uint16_t manufacturer_code;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_zone_enroll_request_t;
|
||||
|
||||
|
||||
/*! @brief Zone "Zone Enroll Request" command, see ZCL spec 8.2.2.4.2
|
||||
@param buffer - to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param cb - callback for getting command send status
|
||||
@param zone_type - Zone Type, see @ref zb_zcl_ias_zone_zonetype_e
|
||||
@param manufacturer_code - Manufacture code
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_ZONE_ENROLL_REQUEST_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, cb, \
|
||||
zone_type, manufacturer_code) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_REQUEST_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (zone_type)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (manufacturer_code)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Zone Status Change Notification command, see ZCL spec 8.2.2.4.1
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_zone_enroll_request_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_GET_ZONE_ENROLL_REQUEST_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_zone_enroll_request_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_zone_enroll_request_t *src_ptr = \
|
||||
(zb_zcl_ias_zone_enroll_request_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE16(&((data_ptr)->zone_type), &(src_ptr->zone_type)); \
|
||||
ZB_HTOLE16(&((data_ptr)->manufacturer_code), &(src_ptr->manufacturer_code)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Zone Enroll response ******************************/
|
||||
|
||||
/** @brief Values of the Enroll Response Code
|
||||
* see ZCL spec 8.2.2.3.1.1 */
|
||||
enum zb_zcl_ias_zone_enroll_responce_code_e
|
||||
{
|
||||
/** Success */
|
||||
ZB_ZCL_IAS_ZONE_ENROLL_RESPONCE_CODE_SUCCESS = 0x00,
|
||||
/** Not supported */
|
||||
ZB_ZCL_IAS_ZONE_ENROLL_RESPONCE_CODE_NOT_SUPPORTED = 0x01,
|
||||
/** No enroll permit */
|
||||
ZB_ZCL_IAS_ZONE_ENROLL_RESPONCE_CODE_NO_ENROLL = 0x02,
|
||||
/** Too many zones */
|
||||
ZB_ZCL_IAS_ZONE_ENROLL_RESPONCE_CODE_TOO_MANY_ZONES = 0x03,
|
||||
};
|
||||
|
||||
/*! @brief Structure representsation of Enroll response command payload
|
||||
* see ZCL spec 8.2.2.3.1.1 */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ias_zone_enroll_res_s
|
||||
{
|
||||
/** Enroll response code */
|
||||
zb_uint8_t code;
|
||||
/** Zone ID */
|
||||
zb_uint8_t zone_id;
|
||||
} ZB_PACKED_STRUCT zb_zcl_ias_zone_enroll_res_t;
|
||||
|
||||
/*! @brief Send "Zone Enroll response" command, see ZCL spec 8.2.2.3.1
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
@param code - Enroll response code, see @ref zb_zcl_ias_zone_enroll_responce_code_e
|
||||
@param zone_id - Zone ID
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_ZONE_ENROLL_RES( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
code, zone_id) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_RESPONSE_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (code)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (zone_id)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Send "Zone Enroll response with add parameters - sequency" command, see ZCL spec 8.2.2.3.1
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
@param code - Enroll response code, see @ref zb_zcl_ias_zone_enroll_responce_code_e
|
||||
@param zone_id - Zone ID
|
||||
@param seq - known sequency
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SEND_ZONE_ENROLL_RES_EXT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
code, zone_id, seq) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, (seq), \
|
||||
ZB_ZCL_CMD_IAS_ZONE_ZONE_ENROLL_RESPONSE_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (code)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (zone_id)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_IAS_ZONE, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting "Zone Enroll response" command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ias_zone_enroll_res_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_GET_ZONE_ENROLL_RES(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_ias_zone_enroll_res_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_ias_zone_enroll_res_t *src_ptr = \
|
||||
(zb_zcl_ias_zone_enroll_res_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->code = src_ptr->code; \
|
||||
(data_ptr)->zone_id = src_ptr->zone_id; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* IAS Zone cluster commands */
|
||||
|
||||
/******************************* Set/Clear Zone Status bits ******************************/
|
||||
|
||||
/* Set or clear Zone Status bits
|
||||
*/
|
||||
void zb_zcl_ias_zone_change_status(zb_uint8_t param);
|
||||
|
||||
/** @brief Declare Set/Clear Zone Status bits
|
||||
*/
|
||||
typedef struct zb_zcl_ias_zone_status_param_s
|
||||
{
|
||||
zb_uint16_t bits; /*!< Bits map, see @ref zb_zcl_ias_zone_zonestatus_e */
|
||||
zb_bool_t is_set; /*!< true - set, false - clean */
|
||||
zb_uint8_t endpoint; /*!< endpoint */
|
||||
|
||||
} zb_zcl_ias_zone_status_param_t;
|
||||
|
||||
/*! @brief Set Zone Status bits custom server command
|
||||
@param buffer - to put packet to
|
||||
@param ep - endpoint
|
||||
@param set_bits - flag set of Zone Status, see @ref zb_zcl_ias_zone_zonestatus_e
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_SET_BITS(buffer, ep, set_bits) \
|
||||
{ \
|
||||
zb_zcl_ias_zone_status_param_t* cmd_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_ias_zone_status_param_t); \
|
||||
cmd_data->endpoint = (ep); \
|
||||
cmd_data->bits = (set_bits); \
|
||||
cmd_data->is_set = ZB_TRUE; \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_ias_zone_change_status, ((buffer))); \
|
||||
}
|
||||
|
||||
/*! @brief Clear Zone Status bits custom server command
|
||||
@param buffer - to put packet to
|
||||
@param ep - sending endpoint
|
||||
@param set_bits - flag set of Zone Status, see @ref zb_zcl_ias_zone_zonestatus_e
|
||||
*/
|
||||
#define ZB_ZCL_IAS_ZONE_CLEAR_BITS(buffer, ep, set_bits) \
|
||||
{ \
|
||||
zb_zcl_ias_zone_status_param_t* cmd_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_ias_zone_status_param_t); \
|
||||
cmd_data->endpoint = (ep); \
|
||||
cmd_data->bits = (set_bits); \
|
||||
cmd_data->is_set = ZB_FALSE; \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_ias_zone_change_status, ((buffer))); \
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Structure is used to pass parameters for ZoneStatus
|
||||
notification command
|
||||
*/
|
||||
typedef struct zb_zcl_ias_zone_notification_param_s
|
||||
{
|
||||
zb_uint8_t ep; /*!< endpoint number */
|
||||
zb_uint16_t status_val; /*!< new value of zone_zone_status, see @ref zb_zcl_ias_zone_zonestatus_e */
|
||||
zb_uint16_t delay; /*!< Delay */
|
||||
}
|
||||
zb_zcl_ias_zone_notification_param_t;
|
||||
|
||||
|
||||
/**
|
||||
@brief Use this function to change IAS Zone status. This function
|
||||
will set new value of ZoneStatus and will send Zone status change
|
||||
notification.
|
||||
@note If another API (ZB_ZCL_SET_ATTRIBUTE()) is used for modifying
|
||||
ZoneStatus, notification will NOT be send. This is limitation of
|
||||
the current implementation.
|
||||
@param ep - local endpoint number
|
||||
@param new_val - new value for ZoneStatus
|
||||
@param delay - delay in quarter seconds (actual only for HA ZCL
|
||||
version, is ignored for pure ZCL implementation)
|
||||
@param buf_param - reference to a buffer that will be used for
|
||||
sending notification. If buffer reference is not specified,
|
||||
notification will NOT be sent
|
||||
@return Returns ZB_TRUE if notification is scheduled for send,
|
||||
ZB_FALSE otherwise
|
||||
@note Notification send result is reported to user App using
|
||||
callback that is registered with zb_zcl_ias_zone_register_cb()
|
||||
*/
|
||||
zb_bool_t zb_zcl_ias_zone_set_status(
|
||||
zb_uint8_t ep,
|
||||
zb_uint16_t new_val,
|
||||
zb_uint16_t delay,
|
||||
zb_uint8_t buf_param);
|
||||
|
||||
enum zb_zcl_general_cb_params_e
|
||||
{
|
||||
ZB_ZCL_VALID_CIE_ADDR_SET = 1,
|
||||
ZB_ZCL_CURR_ZONE_SENSITIVITY_LEVEL_SET = 2,
|
||||
ZB_ZCL_INIT_TEST_MODE = 3,
|
||||
ZB_ZCL_INIT_NORMAL_MODE = 4,
|
||||
};
|
||||
|
||||
typedef zb_ret_t (ZB_CODE * zb_ias_zone_app_callback_t)(zb_uint8_t param, zb_uint16_t general_val);
|
||||
|
||||
typedef struct zb_zcl_ias_zone_int_ctx_s
|
||||
{
|
||||
zb_callback_t process_result_cb;
|
||||
zb_ias_zone_app_callback_t general_cb;
|
||||
zb_uint8_t restore_current_zone_sens_level;
|
||||
zb_uint8_t new_current_zone_sens_level;
|
||||
}
|
||||
zb_zcl_ias_zone_int_ctx_t;
|
||||
|
||||
/** @brief Declare run Enroll Response command for User Application
|
||||
*/
|
||||
typedef struct zb_zcl_ias_zone_enroll_response_value_param_s
|
||||
{
|
||||
zb_uint8_t enroll_response; /*!< Enroll response code */
|
||||
zb_uint8_t zone_id; /*!< Zone ID */
|
||||
} zb_zcl_ias_zone_enroll_response_value_param_t;
|
||||
|
||||
/*! Struct for invoke User App & continue after */
|
||||
typedef struct zb_zcl_ias_zone_enroll_response_user_app_schedule_e
|
||||
{
|
||||
/**< Parameters for continue command, see @ref zb_zcl_parsed_hdr_s */
|
||||
zb_zcl_parsed_hdr_t cmd_info;
|
||||
/**< User App command parameters, see @ref zb_zcl_ias_zone_enroll_response_value_param_s */
|
||||
zb_zcl_ias_zone_enroll_response_value_param_t param;
|
||||
} zb_zcl_ias_zone_enroll_response_user_app_schedule_t;
|
||||
|
||||
#define ZB_ZCL_IAS_ZONE_ENROLL_RESPONSE_SCHEDULE_USER_APP(buffer, pcmd_info, enroll_response_, zone_id_) \
|
||||
{ \
|
||||
zb_zcl_ias_zone_enroll_response_user_app_schedule_t* user_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_ias_zone_enroll_response_user_app_schedule_t); \
|
||||
ZB_MEMMOVE(&(user_data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
|
||||
user_data->param.enroll_response = (enroll_response_); \
|
||||
user_data->param.zone_id = (zone_id_); \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_ias_zone_enroll_response_invoke_user_app, ((buffer))); \
|
||||
}
|
||||
|
||||
/** @brief Registry callbacks to get status of Zone Status Change Notification command
|
||||
@param endpoint - local endpoint number
|
||||
@param process_result_cb - notification sent callback function
|
||||
@param general_cb - general callback function
|
||||
*/
|
||||
void zb_zcl_ias_zone_register_cb(
|
||||
zb_uint8_t endpoint,
|
||||
zb_callback_t process_result_cb,
|
||||
zb_ias_zone_app_callback_t general_cb);
|
||||
|
||||
/**
|
||||
@brief checks, if Zone Status change notification should be sent
|
||||
and schedules command if it is needed
|
||||
@return ZB_TRUE if command is sent
|
||||
*/
|
||||
zb_bool_t zb_zcl_ias_zone_check_attr_notify(
|
||||
zb_uint8_t buf_param);
|
||||
|
||||
/**
|
||||
@brief fills in notification command and sends it
|
||||
*/
|
||||
void zb_zcl_ias_zone_send_status_change_not(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
@brief checks cie address on zcl initialization
|
||||
*/
|
||||
void zb_zcl_ias_zone_check_cie_addr_on_zcl_initialization(zb_uint8_t ep_id);
|
||||
|
||||
/**
|
||||
@brief puts cie command to binding whitelist table
|
||||
*/
|
||||
zb_ret_t zb_zcl_ias_zone_put_cie_address_to_binding_whitelist(zb_uint8_t endpoint);
|
||||
|
||||
/**
|
||||
@brief IAS Zone specific set attribute value postprocessing
|
||||
*/
|
||||
void zb_zcl_ias_set_attr_val_post_process(zb_zcl_parsed_hdr_t *cmd_info, zb_uint16_t attr_id, zb_uint8_t *value);
|
||||
|
||||
/*! @} */ /* ZCL IAS Zone cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_ias_zone_init_server(void);
|
||||
void zb_zcl_ias_zone_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_SERVER_ROLE_INIT zb_zcl_ias_zone_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_IAS_ZONE_CLIENT_ROLE_INIT zb_zcl_ias_zone_init_client
|
||||
|
||||
zb_bool_t zb_zcl_process_ias_zone_specific_commands(zb_uint8_t param);
|
||||
|
||||
#endif /* ZB_ZCL_IAS_ZONE_H */
|
||||
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZCL "Identify cluster" definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_IDENTIFY_H
|
||||
#define ZB_ZCL_IDENTIFY_H 1
|
||||
|
||||
#if defined(ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY) || defined(DOXYGEN)
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_IDENTIFY
|
||||
* @{
|
||||
* @details
|
||||
* Identify cluster implementation supports Identify command and Identify Query request-response
|
||||
* command pair. All these commands have simple payload. Both Identify and Identify Query
|
||||
* request are being processed, and Identify Query response is being generated in ZCL internals.
|
||||
*
|
||||
* @par Example
|
||||
* Identify sending:
|
||||
* @snippet HA_samples/door_lock/sample_zed.c send_identify_req
|
||||
*
|
||||
* Identify Query request sending:
|
||||
* @snippet HA_samples/on_off_switch/sample_zed.c identify_send_identify_query_req
|
||||
*/
|
||||
|
||||
/** @name Identify cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Identify cluster attribute identifier
|
||||
@see ZCL8 spec, subclause 3.5.2.2
|
||||
*/
|
||||
enum zb_zcl_identify_attr_e
|
||||
{
|
||||
/*! Identify time attribute */
|
||||
ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID = 0x0000
|
||||
};
|
||||
|
||||
/** @brief Default value for Identify cluster revision global attribute */
|
||||
#define ZB_ZCL_IDENTIFY_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Default value for Identify attribute */
|
||||
#define ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE 0x0000
|
||||
|
||||
/** @} */ /* Identify cluster attributes */
|
||||
|
||||
/*! @name Identify cluster command structures and definitions
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @brief Command identifiers for "Identify" cluster
|
||||
@see ZCL8 spec, subclauses 3.5.2.3, 3.5.2.4
|
||||
*/
|
||||
enum zb_zcl_identify_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_ID = 0x00, /**< Identify command */
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_ID = 0x01, /**< Identify query command */
|
||||
ZB_ZCL_CMD_IDENTIFY_TRIGGER_EFFECT_ID = 0x40, /**< "Trigger effect" command identifier. */
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_RSP_ID = 0x00 /**< Identify query response */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* Identify cluster commands lists : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_SERVER_ROLE_RECEIVED_CMD_LIST \
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_ID, \
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_ID, \
|
||||
ZB_ZCL_CMD_IDENTIFY_TRIGGER_EFFECT_ID,
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_CLIENT_ROLE_RECEIVED_CMD_LIST \
|
||||
ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_RSP_ID,
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_IDENTIFY_CLIENT_ROLE_RECEIVED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_CLUSTER_ID_IDENTIFY_SERVER_ROLE_RECEIVED_CMD_LIST
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** Effect identifier enum
|
||||
* @see ZCL8 spec 3.5.2.3.3.1 */
|
||||
enum zb_zcl_identify_trigger_effect_e
|
||||
{
|
||||
/**< Effect identifier field value: Light is turned on/off once */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_BLINK = 0x00,
|
||||
/**< Effect identifier field value: Light turned on/off over 1 second and
|
||||
* repeated 15 times */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_BREATHE = 0x01,
|
||||
/**< Effect identifier field value: Colored light turns green for 1 second;
|
||||
* non-colored light flashes twice */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_OKAY = 0x02,
|
||||
/**< Effect identifier field value: Colored light turns orange for 8 seconds; non-colored
|
||||
* light switches to maximum brightness for 0.5s and then minimum brightness for 7.5s */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_CHANNEL_CHANGE = 0x0b,
|
||||
/**< Effect identifier field value: Complete the current effect sequence before terminating.
|
||||
* E.g., if in the middle of a breathe effect (as above), first complete the current 1s
|
||||
* breathe effect and then terminate the effect*/
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_FINISH_EFFECT = 0xfe,
|
||||
/**< Effect identifier field value: Terminate the effect as soon as possible */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_STOP = 0xff,
|
||||
};
|
||||
|
||||
|
||||
/** Effect variant enum
|
||||
* @see ZCL8 spec 3.5.2.3.3.2 */
|
||||
enum zb_zcl_identify_trigger_variant_e
|
||||
{
|
||||
/**< Effect variant field value: Default */
|
||||
ZB_ZCL_IDENTIFY_EFFECT_ID_VARIANT_DEFAULT = 0x00,
|
||||
};
|
||||
|
||||
|
||||
/*! @brief Structured representation of Trigger effect command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_identify_effect_req_s
|
||||
{
|
||||
zb_uint8_t effect_id; /*!< Effect identify, see @ref zb_zcl_identify_trigger_effect_e */
|
||||
zb_uint8_t effect_variant; /*!< Effect variant, see @ref zb_zcl_identify_trigger_variant_e */
|
||||
} ZB_PACKED_STRUCT zb_zcl_identify_effect_req_t;
|
||||
|
||||
|
||||
/*! @brief Send Trigger effect command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param def_resp - flag "Default response required"
|
||||
@param cb - callback for getting command send status
|
||||
@param effect_id - effect identify, see @ref zb_zcl_identify_trigger_effect_e
|
||||
@param effect_var - effect variant, see @ref zb_zcl_identify_trigger_variant_e
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_SEND_TRIGGER_VARIANT_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, def_resp, cb, effect_id, effect_var) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_IDENTIFY_TRIGGER_EFFECT_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (effect_id)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (effect_var)); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_IDENTIFY, cb); \
|
||||
}
|
||||
|
||||
|
||||
/** @brief Parses Trigger effect command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_identify_effect_req_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_GET_TRIGGER_VARIANT_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_identify_effect_req_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_identify_effect_req_t *src_ptr = \
|
||||
(zb_zcl_identify_effect_req_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_MEMCPY((data_ptr), src_ptr, sizeof(zb_zcl_identify_effect_req_t)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Inform User App about ZCL Identify cluster command and change attributes.
|
||||
* Internal structures and define-procedure for inform User App about ZCL Identify
|
||||
* cluster command and change attributes.
|
||||
* @internal
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Declare change Identify attribute for User Application
|
||||
*/
|
||||
typedef struct zb_zcl_identify_effect_value_param_s
|
||||
{
|
||||
zb_uint8_t effect_id; /*!< Effect identify */
|
||||
zb_uint8_t effect_variant; /*!< Effect variant */
|
||||
} zb_zcl_identify_effect_value_param_t;
|
||||
|
||||
|
||||
/*! Struct for invoke User App & continue after */
|
||||
typedef struct zb_zcl_identify_effect_user_app_schedule_e
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info; /**< Parameters for continue command,
|
||||
see @ref zb_zcl_parsed_hdr_s */
|
||||
zb_zcl_identify_effect_value_param_t param; /**< User App command parameters,
|
||||
see @ref zb_zcl_identify_effect_value_param_s */
|
||||
} zb_zcl_identify_effect_user_app_schedule_t;
|
||||
|
||||
#define ZB_ZCL_IDENTIFY_EFFECT_SCHEDULE_USER_APP(buffer, pcmd_info, effectId, effectVar) \
|
||||
{ \
|
||||
zb_zcl_identify_effect_user_app_schedule_t* data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_identify_effect_user_app_schedule_t); \
|
||||
ZB_MEMMOVE(&(data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
|
||||
data->param.effect_id = (effectId); \
|
||||
data->param.effect_variant = (effectVar); \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_identify_effect_invoke_user_app, (buffer)); \
|
||||
}
|
||||
/*! @} */ /* internal */
|
||||
|
||||
/*! @brief Send Identify command
|
||||
@param buffer to put packet to
|
||||
@param time the device will be identifying
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - flag "Default response required"
|
||||
@param cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_SEND_IDENTIFY_REQ( \
|
||||
buffer, time, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_IDENTIFY_IDENTIFY_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, time); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_IDENTIFY, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Send Identify Query command
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - flag "Default response required"
|
||||
@param cb - callback for getting command send status
|
||||
|
||||
@snippet on_off_switch/sample_zed.c identify_send_identify_query_req
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_SEND_IDENTIFY_QUERY_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, def_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ( \
|
||||
ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_ID); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_IDENTIFY, cb); \
|
||||
}
|
||||
|
||||
/*! @brief Send Identify Query Response command
|
||||
@param buffer to put packet to
|
||||
@param time the device will be identifying
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param seq_num - sequence number
|
||||
@param aps_secured - APS security mode
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_SEND_IDENTIFY_QUERY_RES( \
|
||||
buffer, time, addr, dst_addr_mode, dst_ep, ep, prfl_id, seq_num, aps_secured) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET(buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(ptr, seq_num, ZB_ZCL_CMD_IDENTIFY_IDENTIFY_QUERY_RSP_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, time); \
|
||||
ZB_ZCL_FINISH_N_SEND_PACKET_NEW(buffer, ptr, \
|
||||
addr, dst_addr_mode, dst_ep, ep, prfl_id, ZB_ZCL_CLUSTER_ID_IDENTIFY, NULL, aps_secured, \
|
||||
ZB_FALSE, 0); \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start identify process on given endpoint
|
||||
*
|
||||
* @param endpoint - endpoint to start identifying on
|
||||
* @param timeout - time (in seconds) after which identifying will stop
|
||||
*/
|
||||
zb_uint8_t zb_zcl_start_identifying(zb_uint8_t endpoint, zb_uint16_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Stop identify process on given endpoint
|
||||
* Complimentary function to @ref zb_zcl_start_identifying.
|
||||
* Used to force identify termination before timeout provided to
|
||||
* @ref zb_zcl_start_identifying is elapsed
|
||||
*
|
||||
* @param endpoint Endpoint
|
||||
*/
|
||||
void zb_zcl_stop_identifying(zb_uint8_t endpoint);
|
||||
|
||||
/**
|
||||
* @brief Indicates that endpoint supports Identify cluster and is identifying
|
||||
* @param endpoint number to analyze
|
||||
* @return ZB_TRUE if endpoint is in the "identifying" state, ZB_FALSE otherwise.
|
||||
*/
|
||||
zb_uint8_t zb_zcl_is_identifying(zb_uint8_t endpoint);
|
||||
|
||||
/*! @brief Structured representation of Identify command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_identify_req_s
|
||||
{
|
||||
zb_uint16_t timeout; /*!< Time to identify */
|
||||
} ZB_PACKED_STRUCT zb_zcl_identify_req_t;
|
||||
|
||||
/*! @brief Structured representation of Identify Query Response command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_identify_query_res_s
|
||||
{
|
||||
zb_uint16_t timeout; /*!< Reported time to identify */
|
||||
} ZB_PACKED_STRUCT zb_zcl_identify_query_res_t;
|
||||
|
||||
/*! @brief Identify cluster Identify command payload structured read
|
||||
* @param data_ptr - pointer to a variable of type @ref zb_zcl_identify_req_t
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_GET_IDENTIFY_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_identify_req_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_identify_req_t *src_ptr = \
|
||||
(zb_zcl_identify_req_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE16(&((data_ptr)->timeout), &(src_ptr->timeout)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @brief Identify cluster Identify Query Response command payload structured
|
||||
read
|
||||
* @param data_ptr - pointer to a variable of type @ref zb_zcl_identify_query_res_t
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IDENTIFY_GET_IDENTIFY_QUERY_RES(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_identify_query_res_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_identify_query_res_t *src_ptr = \
|
||||
(zb_zcl_identify_query_res_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE16(&((data_ptr)->timeout), &(src_ptr->timeout)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* Identify cluster command structures and definitions */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*!
|
||||
@name Identify cluster internals
|
||||
@internal
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_SCENES
|
||||
/*! Scenes fieldset length for Identify cluster */
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_SCENE_FIELD_SETS_LENGTH 0
|
||||
#endif /* defined ZB_ZCL_SUPPORT_CLUSTER_SCENES */
|
||||
|
||||
/*! @} */ /* Identify cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Identify cluster
|
||||
@param attr_list - attribute list name
|
||||
@param identify_time - pointer to variable to store identify time attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(attr_list, identify_time) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_IDENTIFY) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID, (identify_time)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Identify cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_identify_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_IDENTIFY_IDENTIFY_TIME_ID
|
||||
*/
|
||||
zb_uint16_t identify_time;
|
||||
} zb_zcl_identify_attrs_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Identify cluster cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of zb_zcl_identify_attrs_t type (containing Identify cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_IDENTIFY_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(attr_list, &attrs.identify_time)
|
||||
|
||||
|
||||
|
||||
#if defined ZB_ENABLE_HA
|
||||
|
||||
zb_uint8_t zb_zcl_get_cmd_list_identify(zb_bool_t is_client_generated, zb_uint8_t **cmd_list);
|
||||
|
||||
#endif /* defined ZB_ENABLE_HA */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_identify_init_server(void);
|
||||
void zb_zcl_identify_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_SERVER_ROLE_INIT zb_zcl_identify_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_IDENTIFY_CLIENT_ROLE_INIT zb_zcl_identify_init_client
|
||||
|
||||
#endif /* defined(ZB_ZCL_SUPPORT_CLUSTER_IDENTIFY) */
|
||||
|
||||
#endif /* ZB_ZCL_IDENTIFY_H */
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Illuminance Measurement cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ILLUMINANCE_MEASUREMENT_H
|
||||
#define ZB_ZCL_ILLUMINANCE_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ILLUMINANCE_MEASUREMENT
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT */
|
||||
|
||||
/*! @name Illuminance Measurement cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Illuminance Measurement cluster attribute identifiers
|
||||
@see ZCL spec, Illuminance Measurement Cluster 4.2.2.2.1
|
||||
*/
|
||||
enum zb_zcl_illuminance_measurement_attr_e
|
||||
{
|
||||
/** @brief MeasuredValue, ZCL spec 4.2.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_ID = 0x0000,
|
||||
/** @brief MinMeasuredValue, ZCL spec 4.2.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_ID = 0x0001,
|
||||
/** @brief MaxMeasuredValue, ZCL spec 4.2.2.2.1.3 */
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_ID = 0x0002,
|
||||
/** The Tolerance attribute SHALL indicate the magnitude of the
|
||||
* possible error that is associated with MeasuredValue, using the
|
||||
* same units and resolution. */
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_TOLERANCE_ID = 0x0003,
|
||||
/** The LightSensorType attribute specifies the electronic type of
|
||||
* the light sensor. */
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_LIGHT_SENSOR_TYPE_ID = 0x0004,
|
||||
};
|
||||
|
||||
/** @brief Default value for Illuminance Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_ILLUMINANCE_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief MeasuredValue attribute too-low value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_TOO_LOW 0
|
||||
|
||||
/** @brief MeasuredValue attribute invalid value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_INVALID 0xFFFF
|
||||
|
||||
/** @brief MeasuredValue attribute default value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_DEFAULT \
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_TOO_LOW
|
||||
|
||||
/** @brief Default value for LightSensorType attribute */
|
||||
#define ZB_ZCL_ILLUMINANCE_MEASUREMENT_LIGHT_SENSOR_TYPE_DEFAULT_VALUE ((zb_uint8_t)0xFF)
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_MIN_VALUE 0x0001
|
||||
|
||||
/** @brief MinMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_MAX_VALUE 0xFFFD
|
||||
|
||||
/** @brief MinMeasuredValue attribute not-defined value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_UNDEFINED 0xFFFF
|
||||
|
||||
/** @brief MaxMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_MIN_VALUE 0x0002
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_MAX_VALUE 0xFFFE
|
||||
|
||||
/** @brief MaxMeasuredValue attribute not-defined value */
|
||||
#define ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_UNDEFINED 0xFFFF
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Illuminance Measurement cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_ZCL_ILLUMINANCE_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @} */ /* Illuminance Measurement cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Illuminance Measurement cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param value - pointer to variable to store MeasuredValue attribute
|
||||
@param min_value - pointer to variable to store MinMeasuredValue attribute
|
||||
@param max_value - pointer to variable to store MAxMeasuredValue attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ILLUMINANCE_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
value, min_value, max_value) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ILLUMINANCE_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MEASURED_VALUE_ID, (value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_ID, (min_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_ID, (max_value)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Illuminance Measurement cluster attributes */
|
||||
|
||||
/*! @name Illuminance Measurement cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Illuminance Measurement cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Illuminance Measurement cluster definitions */
|
||||
|
||||
/** @endcond */
|
||||
|
||||
void zb_zcl_illuminance_measurement_init_server(void);
|
||||
void zb_zcl_illuminance_measurement_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_illuminance_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_illuminance_measurement_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ILLUMINANCE_MEASUREMENT_H */
|
||||
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS specific IR Blaster cluster, purpose: send IR Control commands.
|
||||
*/
|
||||
#ifndef ZB_ZCL_IR_BLASTER_H
|
||||
#define ZB_ZCL_IR_BLASTER_H 1
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_IR_BLASTER || defined DOXYGEN
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/** @addtogroup ZB_ZCL_IR_BLASTER
|
||||
* @{
|
||||
* @details
|
||||
* Manufacture specific cluster for transmit IR codes
|
||||
* Model: One (client) to More (servers)
|
||||
*/
|
||||
|
||||
/*! @name Ir_Blaster cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_IR_BLASTER_IR_SIGNATURE_SIZE 22
|
||||
|
||||
/**
|
||||
* @brief Ir_Blaster cluster commands
|
||||
*/
|
||||
enum zb_zcl_ir_blaster_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_IR_BLASTER_TRANSMIT_IR_DATA = 0x00,
|
||||
ZB_ZCL_CMD_IR_BLASTER_TRANSMISSION_STATUS = 0x01,
|
||||
ZB_ZCL_CMD_IR_BLASTER_GET_IR_SIGNATURE = 0x02,
|
||||
ZB_ZCL_CMD_IR_BLASTER_GET_IR_SIGNATURE_RESP = 0x03,
|
||||
};
|
||||
|
||||
/** Ir_Blaster status */
|
||||
typedef enum zb_zcl_ir_blaster_transmission_status_e
|
||||
{
|
||||
ZB_ZCL_IR_BLASTER_TRANSMISSION_STATUS_COMPLETED = 0x30,
|
||||
ZB_ZCL_IR_BLASTER_TRANSMISSION_STATUS_ERROR = 0x40,
|
||||
}
|
||||
zb_zcl_ir_blaster_transmit_status_t;
|
||||
|
||||
/************* Ir_Blaster cluster command structures **************/
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ir_blaster_transmit_ir_data_s
|
||||
{
|
||||
zb_uint8_t ir_code_id[16];
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_ir_blaster_transmit_ir_data_t;
|
||||
|
||||
typedef struct zb_zcl_ir_blaster_transmit_ir_data_value_param_s
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info;
|
||||
zb_zcl_ir_blaster_transmit_ir_data_t payload;
|
||||
} zb_zcl_ir_blaster_transmit_ir_data_value_param_t;
|
||||
|
||||
/*! @brief Send Transfer Data command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
@param _flag - command flag, see @ref zb_zcl_ir_blaster_tx_flags_e
|
||||
@param _byte_num - all transfer length or current offset, see @ref zb_zcl_ir_blaster_transfer_data_header_t
|
||||
@param _data_size - data size
|
||||
@param _image_data - image data
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_SEND_TRANSMIT_IR_DATA( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _def_resp, _cb, \
|
||||
_manufacturer_id, _ir_code_id) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_SRV, ZB_ZCL_MANUFACTURER_SPECIFIC, (_def_resp)); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_MANUFACTURER_SPECIFIC, (_manufacturer_id), \
|
||||
ZB_ZCL_CMD_IR_BLASTER_TRANSMIT_IR_DATA); \
|
||||
ZB_ZCL_PACKET_PUT_DATA_N(__ptr, (_ir_code_id), \
|
||||
(sizeof(zb_zcl_ir_blaster_transmit_ir_data_t))); \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_IR_BLASTER, (_cb)); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Send Transfer Data command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param _data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ir_blaster_transfer_data_internal_t.
|
||||
* @param _buffer containing the packet (by pointer).
|
||||
* @param _status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*
|
||||
* NOTE file data place`s in buffer, payload saves pointer to data only!
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_GET_TRANSMIT_IR_DATA(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_zcl_ir_blaster_transmit_ir_data_t *src_ptr = \
|
||||
(zb_zcl_ir_blaster_transmit_ir_data_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) != sizeof(zb_zcl_ir_blaster_transmit_ir_data_t)) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_MEMCPY((_data_ptr)->ir_code_id, (src_ptr), \
|
||||
sizeof(zb_zcl_ir_blaster_transmit_ir_data_t)); \
|
||||
} \
|
||||
}
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ir_blaster_transmission_status_s
|
||||
{
|
||||
zb_uint8_t status; /**< enum @ref zb_zcl_ir_blaster_status_e */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_ir_blaster_transmission_status_t;
|
||||
|
||||
typedef struct zb_zcl_ir_blaster_transmission_status_value_param_s
|
||||
{
|
||||
/* zb_zcl_parsed_hdr_t cmd_info; */
|
||||
zb_zcl_ir_blaster_transmission_status_t payload;
|
||||
} zb_zcl_ir_blaster_transmission_status_value_param_t;
|
||||
|
||||
|
||||
/*! @brief Send Transfer Data response command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _seq - request sequence
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
@param _tun_status - command status, see @ref zb_zcl_ir_blaster_status_e
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_SEND_TRANSMISSION_STATUS( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _seq, _cb, \
|
||||
_manufacturer_id, _status) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RESP_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_CLI, ZB_ZCL_MANUFACTURER_SPECIFIC); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, (_seq), ZB_ZCL_MANUFACTURER_SPECIFIC, \
|
||||
(_manufacturer_id), ZB_ZCL_CMD_IR_BLASTER_TRANSMISSION_STATUS); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(__ptr, (_status)); \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_IR_BLASTER, (_cb)); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Send Transfer Data response command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param _data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ir_blaster_transfer_data_resp_t.
|
||||
* @param _buffer containing the packet (by pointer).
|
||||
* @param _status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_GET_TRANSMISSION_STATUS(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_zcl_ir_blaster_transmission_status_t *src_ptr = \
|
||||
(zb_zcl_ir_blaster_transmission_status_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) != sizeof(zb_zcl_ir_blaster_transmission_status_t) ) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(_data_ptr)->status = src_ptr->status; \
|
||||
} \
|
||||
}
|
||||
|
||||
typedef struct zb_zcl_ir_blaster_get_ir_signature_value_param_s
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info;
|
||||
} zb_zcl_ir_blaster_get_ir_signature_value_param_t;
|
||||
|
||||
/*! @brief Send Get IR Signature command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_SEND_GET_IR_SIGNATURE( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _def_resp, _cb, \
|
||||
_manufacturer_id) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_SRV, ZB_ZCL_MANUFACTURER_SPECIFIC, (_def_resp)); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_MANUFACTURER_SPECIFIC, (_manufacturer_id), \
|
||||
ZB_ZCL_CMD_IR_BLASTER_GET_IR_SIGNATURE); \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_IR_BLASTER, (_cb)); \
|
||||
}
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_ir_blaster_get_ir_signature_resp_s
|
||||
{
|
||||
zb_uint8_t status;
|
||||
zb_uint8_t ir_signature[ZB_ZCL_IR_BLASTER_IR_SIGNATURE_SIZE];
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_ir_blaster_get_ir_signature_resp_t;
|
||||
|
||||
typedef struct zb_zcl_ir_blaster_get_ir_signature_resp_value_param_s
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info;
|
||||
zb_zcl_ir_blaster_get_ir_signature_resp_t payload;
|
||||
} zb_zcl_ir_blaster_get_ir_signature_resp_value_param_t;
|
||||
|
||||
|
||||
/*! @brief Send Transfer Data response command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _seq - request sequence
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
@param _tun_status - command status, see @ref zb_zcl_ir_blaster_status_e
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_SEND_GET_IR_SIGNATURE_RESP( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _seq, _cb, \
|
||||
_manufacturer_id, _status, _ir_signature) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RESP_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_CLI, ZB_ZCL_MANUFACTURER_SPECIFIC); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, (_seq), ZB_ZCL_MANUFACTURER_SPECIFIC, \
|
||||
(_manufacturer_id), ZB_ZCL_CMD_IR_BLASTER_GET_IR_SIGNATURE_RESP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(__ptr, _status); \
|
||||
if (_status == ZB_ZCL_IR_BLASTER_TRANSMISSION_STATUS_COMPLETED) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA_N(__ptr, (_ir_signature), ZB_ZCL_IR_BLASTER_IR_SIGNATURE_SIZE); \
|
||||
} \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_IR_BLASTER, (_cb)); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Send Transfer Data response command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param _data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_ir_blaster_transfer_data_resp_t.
|
||||
* @param _buffer containing the packet (by pointer).
|
||||
* @param _status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_IR_BLASTER_GET_GET_IR_SIGNATURE_RESP(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_zcl_ir_blaster_get_ir_signature_resp_t *src_ptr = \
|
||||
(zb_zcl_ir_blaster_get_ir_signature_resp_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) == sizeof(zb_zcl_ir_blaster_get_ir_signature_resp_t) || \
|
||||
zb_buf_len((_buffer)) == sizeof(zb_uint8_t)) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(_data_ptr)->status = src_ptr->status; \
|
||||
if (src_ptr->status == ZB_ZCL_IR_BLASTER_TRANSMISSION_STATUS_COMPLETED) \
|
||||
{ \
|
||||
ZB_MEMCPY((_data_ptr)->ir_signature, src_ptr->ir_signature, ZB_ZCL_IR_BLASTER_IR_SIGNATURE_SIZE); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
}
|
||||
|
||||
void zb_zcl_ir_blaster_init_server();
|
||||
void zb_zcl_ir_blaster_init_client();
|
||||
#define ZB_ZCL_CLUSTER_ID_IR_BLASTER_SERVER_ROLE_INIT zb_zcl_ir_blaster_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_IR_BLASTER_CLIENT_ROLE_INIT zb_zcl_ir_blaster_init_client
|
||||
|
||||
/*! @} */ /* Ir_Blaster cluster commands */
|
||||
/*! @} */ /* addtogroup */
|
||||
|
||||
/* @endcond */
|
||||
#endif /*defined ZB_ZCL_SUPPORT_CLUSTER_IR_BLASTER */
|
||||
|
||||
#endif /* ZB_ZCL_IR_BLASTER_H */
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Keep-Alive cluster (ZCL8 spec, 3.18, previously SE spec, Annex A.3)
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_KEEP_ALIVE_H
|
||||
#define ZB_ZCL_KEEP_ALIVE_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_KEEP_ALIVE
|
||||
* @{
|
||||
* @details
|
||||
* This cluster supports the commands and attributes directed to the network Trust Center in
|
||||
* order to determine whether communication with the Trust Center is still available.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_KEEP_ALIVE */
|
||||
|
||||
/*! @name Keep-Alive cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Keep-Alive cluster attribute identifiers
|
||||
@see SE spec, subclause A.3.2
|
||||
*/
|
||||
enum zb_zcl_keep_alive_attr_e
|
||||
{
|
||||
/*! @brief TC Keep-Alive Base attribute */
|
||||
ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID = 0,
|
||||
/*! @brief TC Keep-Alive Jitter attribute */
|
||||
ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID = 1
|
||||
};
|
||||
|
||||
/** @brief Default value for Keep alive cluster revision global attribute */
|
||||
#define ZB_ZCL_KEEP_ALIVE_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for TC Keep-Alive Base attribute */
|
||||
#define ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_DEFAULT_VALUE 0x0a
|
||||
/** @brief Default value for TC Keep-Alive Jitter attribute */
|
||||
#define ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_DEFAULT_VALUE 0x012c
|
||||
|
||||
/*! @} */ /* Keep-Alive cluster attributes */
|
||||
|
||||
/*! @name Keep-Alive cluster commands
|
||||
@{
|
||||
*/
|
||||
/*! @} */ /* Keep-Alive cluster commands */
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name Keep-Alive cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @internal @brief Declare attribute list for Keep-Alive cluster
|
||||
@param attr_list - attribute list name
|
||||
@param base - pointer to variable to store TC Keep-Alive Base attribute value
|
||||
@param jitter - pointer to variable to store TC Keep-Alive Jitter attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_KEEP_ALIVE_ATTR_LIST_FULL(attr_list, base, jitter) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_KEEP_ALIVE) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID, (base)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID, (jitter)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Keep-Alive cluster */
|
||||
#define ZB_ZCL_KEEP_ALIVE_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Keep-Alive cluster internals */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Keep-Alive cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_keep_alive_attrs_s
|
||||
{
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID
|
||||
* @see ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_BASE_ID
|
||||
*/
|
||||
zb_uint8_t base;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID
|
||||
* @see ZB_ZCL_ATTR_KEEP_ALIVE_TC_KEEP_ALIVE_JITTER_ID
|
||||
*/
|
||||
zb_uint16_t jitter;
|
||||
} zb_zcl_keep_alive_attrs_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Keep-Alive cluster cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - pointer to @ref zb_zcl_keep_alive_attrs_s structure
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_KEEP_ALIVE_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_KEEP_ALIVE_ATTR_LIST_FULL(attr_list, &attrs.base, &attrs.jitter )
|
||||
|
||||
|
||||
/*! @} */ /* Keep-Alive cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_KEEP_ALIVE_SERVER_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
#define ZB_ZCL_CLUSTER_ID_KEEP_ALIVE_CLIENT_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
|
||||
#endif /* ZB_ZCL_KEEP_ALIVE_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZCL MDU (Multiple dwelling units) Pairing cluster
|
||||
Allow devices joining the NAN to acquire a list of the devices
|
||||
forming the 'virtual HAN' for the respective household.
|
||||
*/
|
||||
#ifndef ZB_ZCL_MDU_PAIRING_H
|
||||
#define ZB_ZCL_MDU_PAIRING_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION && DOXYGEN_SE_SECTION */
|
||||
|
||||
|
||||
/** @addtogroup ZB_ZCL_MDU_PAIRING
|
||||
* @{
|
||||
* @details
|
||||
* When operating within a multi-dwelling unit (MDU), the commands within
|
||||
* this cluster allow devices joining the NAN to acquire a list of the
|
||||
* devices forming the 'virtual HAN' for the respective household.
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_MDU_PAIRING_ATTRS MDU Pairing cluster attributes
|
||||
* @{
|
||||
* @brief MDU Pairing cluster attribute identifiers
|
||||
* @see SE spec, subclause 13.2.2 - No attributes
|
||||
*
|
||||
*/
|
||||
|
||||
/** @} */ /* ZB_ZCL_MDU_PAIRING_ATTRS */
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_MDU_PAIRING_COMMANDS MDU Pairing cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief MDU Pairing cluster client commands
|
||||
* @see SE spec, subclause 13.3.3
|
||||
*/
|
||||
enum zb_zcl_mdu_pairing_cmd_client_e
|
||||
{
|
||||
/** The @e PairingRequest command allows a device joining a MDU network to
|
||||
* determine the devices that will constitute the 'virtual HAN' for the
|
||||
* household in which it is to operate.
|
||||
*/
|
||||
ZB_ZCL_MDU_PAIRING_CLI_CMD_PAIRING_REQUEST = 0x00, /**< Pairing Request */
|
||||
};
|
||||
|
||||
/** @brief MDU Pairing cluster server commands
|
||||
* @see SE spec, subclause 13.2.3
|
||||
*/
|
||||
enum zb_zcl_mdu_pairing_cmd_server_e
|
||||
{
|
||||
/** The @e PairingResponse command provides a device joining a MDU network with
|
||||
* a list of the devices that will constitute the 'virtual HAN' for the
|
||||
* household in which the joining device is to operate.
|
||||
*/
|
||||
ZB_ZCL_MDU_PAIRING_SRV_CMD_PAIRING_RESPONSE = 0x00, /**< Pairing Request response */
|
||||
};
|
||||
|
||||
|
||||
/* MDU PAIRING cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_MDU_PAIRING_SRV_CMD_PAIRING_RESPONSE
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_MDU_PAIRING_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_MDU_PAIRING_CLI_CMD_PAIRING_REQUEST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_MDU_PAIRING_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
/************* MDU Pairing cluster command structures **************/
|
||||
|
||||
/** @brief Pairing Request command payload
|
||||
* @see SE spec, subclause 13.3.3.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_mdu_pairing_request_s
|
||||
{
|
||||
zb_uint32_t lpi_version; /**< Identifies the version of pairing information currently held on the requesting device. */
|
||||
zb_ieee_addr_t eui64; /**< Identifies the MAC address of the requesting device. */
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_mdu_pairing_request_t;
|
||||
|
||||
/** @brief Pairing Response command payload
|
||||
* @see SE spec, subclause 13.2.3.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_mdu_pairing_response_s
|
||||
{
|
||||
zb_uint32_t lpi_version; /**< Identifies the version of pairing information included in this command. */
|
||||
zb_uint8_t total_number_of_devices; /**< The total number of devices expected to form the 'virtual HAN'
|
||||
* (including the device to which this command is being sent) */
|
||||
zb_uint8_t command_index; /**< The CommandIndex is uses to count the payload fragments in the
|
||||
* case where the entire payload does not fit into one message. */
|
||||
zb_uint8_t total_number_of_commands; /**< In the case where the entire payload does not fit into one
|
||||
* message, the Total Number of Commands field indicates the
|
||||
* total number of sub-commands in the message. */
|
||||
zb_ieee_addr_t *eui64; /**< EUI64 of Device 1 to EUI64 of Device N represent the MAC address
|
||||
* of devices that belong to the 'virtual HAN' of the requesting
|
||||
* device; these include the requesting device itself and all other
|
||||
* devices the requesting device shall perform service discovery
|
||||
* and binding with. */
|
||||
zb_uint8_t num_dev_cmd; /**< Number of devices in current command */
|
||||
}
|
||||
ZB_PACKED_STRUCT zb_zcl_mdu_pairing_response_t;
|
||||
|
||||
|
||||
/** @def ZB_ZCL_MDU_PAIRING_SEND_PAIRING_REQUEST
|
||||
* @brief Send @e PairingRequest command
|
||||
* @param _param - Reference to buffer.
|
||||
* @param _addr - Address of the device to send command to.
|
||||
* @param _dst_addr_mode - Address mode for _dst_addr.
|
||||
* @param _dst_ep - Destination endpoint.
|
||||
* @param _ep - Current endpoint.
|
||||
* @param _prfl_id - profile identifier
|
||||
* @param _def_resp - enable/disable default zcl response
|
||||
* @param _cb - Callback which should be called when the ZCL stack receives
|
||||
* APS ack.
|
||||
* @param _lpi_version - lpi_version field from @ref zb_zcl_mdu_pairing_response_t payload
|
||||
* @param _eui64 - eui64 field from @ref zb_zcl_mdu_pairing_response_t payload
|
||||
* @par Example
|
||||
* @code{C}
|
||||
* // The command is used as is
|
||||
* ZB_ZCL_MDU_PAIRING_SEND_PAIRING_REQUEST(param, remote.addr, ZB_APS_ADDR_MODE_16_ENDP_PRESENT, remote.ep, this.ep, ZB_AF_SE_PROFILE_ID, 0, NULL, lpi, this.addr);
|
||||
* @endcode
|
||||
*/
|
||||
#define ZB_ZCL_MDU_PAIRING_SEND_PAIRING_REQUEST( \
|
||||
_param, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _def_resp, _cb, \
|
||||
_lpi_version, _eui64) \
|
||||
{ \
|
||||
zb_bufid_t buffer = ZB_BUF_FROM_REF(_param); \
|
||||
zb_uint8_t* __ptr = zb_zcl_start_command_header(buffer, \
|
||||
ZB_ZCL_CONSTRUCT_FRAME_CONTROL(ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
|
||||
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_SRV, (_def_resp)), \
|
||||
0, /* No manuf_code */ \
|
||||
ZB_ZCL_MDU_PAIRING_CLI_CMD_PAIRING_REQUEST, NULL); \
|
||||
ZB_ZCL_PACKET_PUT_DATA32(__ptr, (_lpi_version)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA64(__ptr, (_eui64)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_MDU_PAIRING, (_cb)); \
|
||||
}
|
||||
|
||||
|
||||
/** @def ZB_ZCL_MDU_PAIRING_GET_PAIRING_REQUEST
|
||||
* @brief Macro for parsing payload of @e PairingRequest command
|
||||
* @param _data_ptr - pointer to @ref zb_zcl_mdu_pairing_request_t structure
|
||||
* @param _buffer - pointer to buffer where Pairing Request command's payload is stored.
|
||||
* @param _status - status of payload parsing
|
||||
* @par Example
|
||||
* @code{C}
|
||||
* zb_bufid_t buf;
|
||||
* zb_zcl_mdu_pairing_request_t req;
|
||||
* zb_uint8_t status;
|
||||
*
|
||||
* ZB_ZCL_MDU_PAIRING_GET_PAIRING_REQUEST(req, buf, status);
|
||||
*
|
||||
* if (status == ZB_ZCL_PARSE_STATUS_SUCCESS)
|
||||
* {
|
||||
* (void)req.eui64; // use it
|
||||
* (void)req.lpi_version; // use it
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
#define ZB_ZCL_MDU_PAIRING_GET_PAIRING_REQUEST(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_uint8_t *src_ptr = (zb_uint8_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) < sizeof(zb_zcl_mdu_pairing_request_t)) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE32(&(_data_ptr)->lpi_version, src_ptr); \
|
||||
ZB_HTOLE64(&(_data_ptr)->eui64, src_ptr+4); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @} */ /* ZB_ZCL_MDU_PAIRING_COMMANDS */
|
||||
|
||||
/** @} */ /* addtogroup */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
|
||||
/* @brief Send Pairing Response command */
|
||||
/*
|
||||
#define ZB_ZCL_MDU_PAIRING_SEND_PAIRING_RESPONSE( \
|
||||
_param, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _def_resp, _cb, \
|
||||
_lpi_version, _eui64) \
|
||||
{ \
|
||||
zb_bufid_t buffer = ZB_BUF_FROM_REF(_param); \
|
||||
zb_uint8_t* __ptr = zb_zcl_start_command_header(buffer, \
|
||||
ZB_ZCL_CONSTRUCT_FRAME_CONTROL(ZB_ZCL_FRAME_TYPE_CLUSTER_SPECIFIC, \
|
||||
ZB_ZCL_NOT_MANUFACTURER_SPECIFIC, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_SRV, (_def_resp)), \
|
||||
0, / No manuf_code / \
|
||||
ZB_ZCL_MDU_PAIRING_CLI_CMD_PAIRING_REQUEST, NULL); \
|
||||
ZB_ZCL_PACKET_PUT_DATA32(__ptr, (_lpi_version)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA64(__ptr, (_eui64)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_MDU_PAIRING, (_cb)); \
|
||||
}
|
||||
*/
|
||||
|
||||
/* @brief Macro for getting Pairing Response command data */
|
||||
/*
|
||||
#define ZB_ZCL_MDU_PAIRING_GET_PAIRING_RESPONSE(_data_ptr, _buffer, _status)\
|
||||
{ \
|
||||
zb_zcl_mdu_pairing_response_t *src_ptr = (zb_zcl_mdu_pairing_response_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) < sizeof(zb_zcl_mdu_pairing_response_t)) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE32(&(_data_ptr)->lpi_version, src_ptr); \
|
||||
(_data_ptr)->total_number_of_devices = src_ptr->total_number_of_devices; \
|
||||
(_data_ptr)->command_index = src_ptr->command_index; \
|
||||
(_data_ptr)->total_number_of_commands = src_ptr->total_number_of_commands;\
|
||||
ZB_HTOLE64(&(_data_ptr)->eui64,&(src_ptr->eui64)); \
|
||||
} \
|
||||
}
|
||||
*/
|
||||
zb_ret_t zb_zcl_mdu_pairing_send_cmd_pairing_request(
|
||||
zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
const zb_zcl_mdu_pairing_request_t *payload,
|
||||
zb_ieee_addr_t *buf,
|
||||
zb_uint8_t buf_len_in_elements,
|
||||
zb_callback_t cb
|
||||
);
|
||||
/************************* MDU Pairing internal *******************************/
|
||||
zb_uint8_t zb_zcl_process_mdu_pairing_specific_commands(zb_uint8_t param);
|
||||
|
||||
|
||||
void zb_zcl_mdu_pairing_init_server(void);
|
||||
void zb_zcl_mdu_pairing_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_SERVER_ROLE_INIT zb_zcl_mdu_pairing_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_MDU_PAIRING_CLIENT_ROLE_INIT zb_zcl_mdu_pairing_init_client
|
||||
|
||||
#endif /* ZB_ZCL_MDU_PAIRING_H */
|
||||
@@ -0,0 +1,636 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Messaging cluster definitions
|
||||
*/
|
||||
#ifndef ZB_ZCL_MESSAGING_H_
|
||||
#define ZB_ZCL_MESSAGING_H_
|
||||
|
||||
#include "zboss_api_core.h" /* ZBOSS core API types */
|
||||
#include "zboss_api_aps.h"
|
||||
|
||||
#define ZB_ZCL_MESSAGING_DISPLAY_MSG_MAX_NON_FRAG_SIZE 48
|
||||
#define ZB_ZCL_MESSAGING_MSG_CONFIRM_RESP_MSG_MAX_SIZE 21
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_MESSAGING
|
||||
* @{
|
||||
* @details
|
||||
* The Messaging cluster provides an interface for passing text messages
|
||||
* between Zigbee devices.
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_MESSAGING_COMMANDS Messaging cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** Commands generated by Messaging Server
|
||||
* @see SE spec, subclause D.5.2.3
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_srv_cmd_e
|
||||
{
|
||||
|
||||
/** @see SE spec, subclause D.5.2.3.1
|
||||
* @see zb_zcl_messaging_display_message_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_MESSAGE = 0x00,
|
||||
|
||||
/** @e TheCancelMessage command provides the ability
|
||||
* to cancel the sending or acceptance of previously sent messages. When this
|
||||
* message is received the recipient device has the option of clearing any
|
||||
* display or user interfaces it supports, or has the option of logging the
|
||||
* message for future reference.
|
||||
* @see SE spec, subclause D.5.2.3.2
|
||||
* @see zb_zcl_messaging_cancel_message_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_MESSAGE = 0x01,
|
||||
|
||||
/** The Display Protected Message command is for use with messages that are
|
||||
* protected by a password or PIN.
|
||||
* @see zb_zcl_messaging_display_message_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_PROTECTED_MESSAGE = 0x02,
|
||||
|
||||
/** @e TheCancelAllMessages command indicates to a client device that it should
|
||||
* cancel all display messages currently held by it.
|
||||
* @note @e TheCancelAllMessages command in this revision of this specification
|
||||
* is provisional and not certifiable. This feature may change before reaching
|
||||
* certifiable status in a future revision of this specification.
|
||||
* @see zb_zcl_messaging_cancel_all_message_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_ALL_MESSAGES = 0x03
|
||||
} zb_zcl_messaging_srv_cmd_t;
|
||||
|
||||
|
||||
/** Commands generated by Messaging Client
|
||||
* @see SE spec, D.5.3.3
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_cli_cmd_e
|
||||
{
|
||||
|
||||
/** On receipt of this command, the device shall send a @e DisplayMessage or
|
||||
* @e DisplayProtectedMessage command as appropriate. A ZCL Default Response
|
||||
* with status @e NOT_FOUND shall be returned if no message is available.
|
||||
* @see SE spec, subclause D.5.3.3.1
|
||||
* @note This command has no payload.
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE = 0x00,
|
||||
|
||||
/** @e TheMessageConfirmation command provides an indication that a Utility
|
||||
* Customer has acknowledged and/or accepted the contents of a message
|
||||
* previously received from the Messaging cluster server. Enhanced Message
|
||||
* Confirmation commands shall contain an answer of ‘NO’, ‘YES’ and/or a
|
||||
* message confirmation string.
|
||||
* If the optional Message Confirmation Response is required, the Message
|
||||
* Confirmation Control field shall also be present.
|
||||
* @see SE spec, subclause D.5.3.3.2
|
||||
* @see zb_zcl_messaging_message_confirm_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_CLI_CMD_MESSAGE_CONFIRMATION = 0x01,
|
||||
|
||||
/** This command initiates the return of the first (and maybe only) @e
|
||||
* CancelAllMessages command held on the associated server, and which has an
|
||||
* implementation time equal to or later than the value indicated in the payload.
|
||||
* @note The @e GetMessageCancellation command in this revision of this
|
||||
* specification is provisional and not certifiable. This feature may change
|
||||
* before reaching certifiable status in a future revision of this specification.
|
||||
* @see zb_zcl_messaging_get_message_cancellation_payload_s
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_CLI_CMD_GET_MESSAGE_CANCELLATION = 0x02
|
||||
} zb_zcl_messaging_cli_cmd_t;
|
||||
|
||||
/* MESSAGING cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_SERVER_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_MESSAGE, \
|
||||
ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_MESSAGE
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_MESSAGING_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE, \
|
||||
ZB_ZCL_MESSAGING_CLI_CMD_MESSAGE_CONFIRMATION
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_MESSAGING_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
|
||||
/* Payload description */
|
||||
|
||||
/** Extended Message Control Field values
|
||||
* @see SE spec, Table D-118
|
||||
* @see zb_zcl_messaging_display_message_payload_t::extended_message_control
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_extended_message_control_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_MESSAGE_HAS_NOT_BEEN_CONFIRMED = 0, /**< Message has not been confirmed */
|
||||
ZB_ZCL_MESSAGING_MESSAGE_HAS_BEEN_CONFIRMED = 1, /**< Message has been confirmed */
|
||||
} zb_zcl_messaging_extended_message_control_field_t;
|
||||
|
||||
/** Extended Message Control Field Bit Map
|
||||
* @see SE spec, Table D-118
|
||||
*/
|
||||
enum zb_zcl_messaging_extended_message_control_field_bitmap_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_MESSAGE_CONFIRMATION_STATUS = 0, /**< @see zb_zcl_messaging_extended_message_control_field_e*/
|
||||
};
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_MESSAGE "DisplayMessage" command payload
|
||||
* @see SE spec, subclause D.5.2.3.1.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_messaging_display_message_payload_s
|
||||
{
|
||||
/** 32-bit number identifier for the message. */
|
||||
zb_uint32_t message_id; /* (M) */
|
||||
|
||||
/** BitMap field indicating control information related to the message */
|
||||
zb_uint8_t message_control; /* (M) */
|
||||
|
||||
/** The time at which the message becomes valid */
|
||||
zb_uint32_t start_time; /* (M) */
|
||||
|
||||
/** The amount of time in minutes after the Start Time during which
|
||||
* the message is displayed */
|
||||
zb_uint16_t duration_in_minutes; /* (M) */
|
||||
|
||||
/** Message (variable): Character String
|
||||
* WARNING: Variable length of message supported, but remember to pass strings in global memory only!
|
||||
*/
|
||||
zb_uint8_t message_len; /* (M) */
|
||||
zb_uint8_t *message; /* (M) */
|
||||
|
||||
/** BitMap field indicating additional control
|
||||
* and status information for a given message.
|
||||
*/
|
||||
zb_uint8_t extended_message_control; /* (O) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_messaging_display_message_payload_t;
|
||||
|
||||
|
||||
/** @e MessageControl field's transmission mechanism values
|
||||
* @see SE spec, Table D-117
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_TRANSMISSION_MECHANISM
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_TRANSMISSION_MECHANISM
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_TRANSMISSION_MECHANISM
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_message_control_transmission_mechanism_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_NORMAL_TRANSMISSION_ONLY = 0, /**< Send message through normal command
|
||||
* function to client.
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_NORMAL_AND_INTERNAL_PAN_TRANSMISSION = 1, /**< Send message through normal command
|
||||
* function to client and pass message onto the
|
||||
* Inter-PAN transmission mechanism.
|
||||
*/
|
||||
ZB_ZCL_MESSAGING_INTER_PAN_TRANSMISSION_ONLY = 2, /**< Send message through the Inter-PAN
|
||||
* transmission mechanism.
|
||||
*/
|
||||
} zb_zcl_messaging_control_field_transmission_mechanism_t;
|
||||
|
||||
/** @brief Default value for Messaging cluster revision global attribute */
|
||||
#define ZB_ZCL_MESSAGING_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/*!
|
||||
@brief Declare attribute list for Messaging cluster (only cluster revision attribute)
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_MESSAGING_ATTR_LIST(attr_list) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_MESSAGING) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* Set @e MessageControl's transmission mechanism value
|
||||
* @param x - variable to store transmission mechanism value
|
||||
* @param val - @ref zb_zcl_messaging_control_field_transmission_mechanism_t value
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_TRANSMISSION_MECHANISM(x, val) ((x) &= (0xFC | ((val) & 0x03)))
|
||||
|
||||
|
||||
/**
|
||||
* Get @e MessageControl's transmission mechanism value
|
||||
* @param x - variable that stores transmission mechanism value
|
||||
* @see zb_zcl_messaging_control_field_transmission_mechanism_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_TRANSMISSION_MECHANISM(x) ((x) & 0x03)
|
||||
|
||||
|
||||
/**
|
||||
* Clear @e MessageControl's transmission mechanism value
|
||||
* @param x - variable that stores transmission mechanism value
|
||||
* @see zb_zcl_messaging_control_field_transmission_mechanism_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_TRANSMISSION_MECHANISM(x) ((x) &= 0xFC)
|
||||
|
||||
|
||||
/** @e MessageControl field's control importance values
|
||||
* @see SE spec, Table D-117
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_IMPORTANCE_LEVEL
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_IMPORTANCE_LEVEL
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_IMPORTANCE_LEVEL
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_message_control_importance_level_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_IMPORTANCE_LEVEL_LOW = 0, /**< Low importance level */
|
||||
ZB_ZCL_MESSAGING_IMPORTANCE_LEVEL_MEDIUM = 1, /**< Medium importance level */
|
||||
ZB_ZCL_MESSAGING_IMPORTANCE_LEVEL_HIGH = 2, /**< High importance level */
|
||||
ZB_ZCL_MESSAGING_IMPORTANCE_LEVEL_CRITICAL = 3, /**< Critical importance level */
|
||||
} zb_zcl_messaging_message_control_importance_level_t;
|
||||
|
||||
|
||||
/**
|
||||
* Set @e MessageControl's control importance value
|
||||
* @param x - variable to store control importance value
|
||||
* @param val - @ref zb_zcl_messaging_message_control_importance_level_t value
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_IMPORTANCE_LEVEL(x, val) ((x) &= (0xF3 | ((val) & 0x03) << 2)
|
||||
|
||||
|
||||
/**
|
||||
* Get @e MessageControl's control importance value
|
||||
* @param x - variable that stores control importance value
|
||||
* @see zb_zcl_messaging_message_control_importance_level_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_IMPORTANCE_LEVEL(x) (((x) >> 2) & 0x03)
|
||||
|
||||
|
||||
/**
|
||||
* Clear @e MessageControl's control importance value
|
||||
* @param x - variable that stores control importance value
|
||||
* @see zb_zcl_messaging_message_control_importance_level_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_IMPORTANCE_LEVEL(x) ((x) &= 0xF3)
|
||||
|
||||
|
||||
/** @e MessageControl field's enhanced confirmation values
|
||||
* @see SE spec, Table D-117
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_ENHANCED_CONFIRMATION
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_ENHANCED_CONFIRMATION
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_ENHANCED_CONFIRMATION
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_message_control_enhanced_confirmation_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_ENHANCED_CONFIRMATION_NOT_REQUIRED = 0, /**< Enhanced Confirmation not required */
|
||||
ZB_ZCL_MESSAGING_ENHANCED_CONFIRMATION_REQUIRED = 1, /**< Enhanced Confirmation required */
|
||||
} zb_zcl_messaging_message_control_enhanced_confirmation_t;
|
||||
|
||||
|
||||
/**
|
||||
* Set @e MessageControl's enhanced confirmation value
|
||||
* @param x - variable to store enhanced confirmation value
|
||||
* @param val - @ref zb_zcl_messaging_message_control_enhanced_confirmation_t value
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_ENHANCED_CONFIRMATION(x, val) ((x) &= (0xDF | ((val) & 0x01) << 5)
|
||||
|
||||
/**
|
||||
* Get @e MessageControl's enhanced confirmation value
|
||||
* @param x - variable that stores enhanced confirmation value
|
||||
* @see zb_zcl_messaging_message_control_enhanced_confirmation_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_ENHANCED_CONFIRMATION(x) (((x) >> 5) & 0x01)
|
||||
|
||||
/**
|
||||
* Clear @e MessageControl's enhanced confirmation value
|
||||
* @param x - variable that stores enhanced confirmation value
|
||||
* @see zb_zcl_messaging_message_control_enhanced_confirmation_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_ENHANCED_CONFIRMATION(x) ((x) &= 0xDF )
|
||||
|
||||
|
||||
/** @e MessageControl field's message confirmation values
|
||||
* @see SE spec, Table D-117
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_MESSAGE_CONFIRMATION
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_MESSAGE_CONFIRMATION
|
||||
* @see ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_MESSAGE_CONFIRMATION
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_message_control_message_confirmation_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_MESSAGE_CONFIRMATION_NOT_REQUIRED = 0x00, /**< Message Confirmation not required. */
|
||||
ZB_ZCL_MESSAGING_MESSAGE_CONFIRMATION_REQUIRED = 0x01, /**< Message Confirmation required. */
|
||||
} zb_zcl_messaging_message_control_message_confirmation_t;
|
||||
|
||||
|
||||
/**
|
||||
* Set @e MessageControl's message confirmation value
|
||||
* @param x - variable to store message confirmation value
|
||||
* @param val - @ref zb_zcl_messaging_message_control_message_confirmation_t value
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_SET_MESSAGE_CONFIRMATION(x, val) ((x) &= (0x7F | ((val) & 0x01) << 7)
|
||||
|
||||
|
||||
/**
|
||||
* Get @e MessageControl's message confirmation value
|
||||
* @param x - variable that stores message confirmation value
|
||||
* @see zb_zcl_messaging_message_control_message_confirmation_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_GET_MESSAGE_CONFIRMATION(x) (((x) >> 7) & 0x01)
|
||||
|
||||
/**
|
||||
* Clear @e MessageControl's message confirmation value
|
||||
* @param x - variable that stores message confirmation value
|
||||
* @see zb_zcl_messaging_message_control_message_confirmation_t
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_MESSAGE_CONTROL_CLR_MESSAGE_CONFIRMATION(x) ((x) &= 0x7F)
|
||||
|
||||
|
||||
/** Check if some size in range of variable size of specified payload.
|
||||
*/
|
||||
#define ZB_ZCL_MESSAGING_DISPLAY_MSG_PAYLOAD_SIZE_IS_VALID(size) \
|
||||
((size) >= ((zb_int16_t)sizeof(zb_zcl_messaging_display_message_payload_t) - \
|
||||
(zb_int16_t)ZB_SIZEOF_FIELD(zb_zcl_messaging_display_message_payload_t, message) -\
|
||||
(zb_int16_t)ZB_SIZEOF_FIELD(zb_zcl_messaging_display_message_payload_t, extended_message_control)))
|
||||
|
||||
/* 8/16/2017 NK CR:MINOR Do all compilers support such initializing? More common way to initialize
|
||||
* is to provide pointer as parameter and operate with it inside the macro. */
|
||||
/* 8/21/2017 IA: It is C99 features. I hope, they are supported by all "our" compilers. */
|
||||
|
||||
/** @ref zb_zcl_messaging_display_message_payload_t initializer */
|
||||
#define ZB_ZCL_MESSAGING_DISPLAY_MSG_PAYLOAD_INIT \
|
||||
(zb_zcl_messaging_display_message_payload_t)\
|
||||
{ \
|
||||
.extended_message_control = 0x00, \
|
||||
}
|
||||
|
||||
/** @ref ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_MESSAGE "CancelMessage" command payload
|
||||
* @see SE spec, subclause D.5.2.3.2.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_messaging_cancel_message_payload_s
|
||||
{
|
||||
/** 32-bit number identifier for the message. */
|
||||
zb_uint32_t message_id; /* (M) */
|
||||
|
||||
/** This field is deprecated and should be set to 0x00 */
|
||||
zb_uint8_t message_control; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_messaging_cancel_message_payload_t;
|
||||
|
||||
/** @ref zb_zcl_messaging_cancel_message_payload_t initializer */
|
||||
#define ZB_ZCL_MESSAGING_CANCEL_MSG_PAYLOAD_INIT \
|
||||
(zb_zcl_messaging_cancel_message_payload_t) {0}
|
||||
|
||||
/** Check if some size in range of variable size of specified payload. */
|
||||
#define ZB_ZCL_MESSAGING_MSG_CANCEL_MESSAGE_SIZE_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_messaging_cancel_message_payload_t))
|
||||
|
||||
/** Message Confirmation Control
|
||||
* @see SE spec, Table D-120
|
||||
* @see zb_zcl_messaging_message_confirm_payload_t::message_confirmation_control
|
||||
*/
|
||||
typedef enum zb_zcl_messaging_message_confirmation_control_e
|
||||
{
|
||||
ZB_ZCL_MESSAGING_NO_RETURNED = 1 << 0, /**< The answer is ‘NO’ */
|
||||
ZB_ZCL_MESSAGING_YES_RETURNED = 1 << 1, /**< The answer is ‘YES’ */
|
||||
} zb_zcl_messaging_message_confirmation_control_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_MESSAGING_CLI_CMD_MESSAGE_CONFIRMATION "MessageConfirmation" command payload
|
||||
* @see SE spec, subclause D.5.3.3.2.1
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_messaging_message_confirm_payload_s
|
||||
{
|
||||
/** 32-bit number identifier for the message being confirmed. */
|
||||
zb_uint32_t message_id; /* (M) */
|
||||
|
||||
/** UTCTime of user confirmation of message */
|
||||
zb_uint32_t confirmation_time; /* (M) */
|
||||
|
||||
/** BitMap field indicating the simple confirmation that is
|
||||
* contained within the response.
|
||||
*/
|
||||
zb_uint8_t message_confirmation_control; /* (O) */
|
||||
|
||||
/** ZCL Octet String containing the message to be returned.
|
||||
* The first Octet indicates length (21 is max).
|
||||
* The string shall be encoded in the UTF-8 format.
|
||||
* If this optional field is not available, a default value of 0x00 shall be used.
|
||||
*/
|
||||
zb_uint8_t message_confirmation_response[ZB_ZCL_MESSAGING_MSG_CONFIRM_RESP_MSG_MAX_SIZE]; /* (O) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_messaging_message_confirm_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_ALL_MESSAGES "CancelAllMessages" command payload
|
||||
* @see SE spec, subclause D.5.2.3.4.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_messaging_cancel_all_message_payload_s
|
||||
{
|
||||
/** A UTC Time field to indicate the date/time at which all existing display
|
||||
* messages should be cleared.
|
||||
*/
|
||||
zb_uint32_t implementation_date; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_messaging_cancel_all_message_payload_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCL_MESSAGING_CLI_CMD_GET_MESSAGE_CANCELLATION "GetMessageCancellation" command payload
|
||||
* @see SE spec, subclause D.5.3.3.3.2
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_messaging_get_message_cancellation_payload_s
|
||||
{
|
||||
/** UTC Timestamp indicating the earliest implementation time of a @e CancelAllMessages
|
||||
* command to be returned.
|
||||
*/
|
||||
zb_uint32_t earliest_implementation_time; /* (M) */
|
||||
} ZB_PACKED_STRUCT zb_zcl_messaging_get_message_cancellation_payload_t;
|
||||
|
||||
|
||||
/** Check if some size in range of variable size of specified payload. */
|
||||
#define ZB_ZCL_MESSAGING_MSG_CONFIRM_PAYLOAD_SIZE_IS_VALID(size) \
|
||||
((size) >= sizeof(zb_zcl_messaging_message_confirm_payload_t) - \
|
||||
ZB_SIZEOF_FIELD(zb_zcl_messaging_message_confirm_payload_t, message_confirmation_control) -\
|
||||
ZB_SIZEOF_FIELD(zb_zcl_messaging_message_confirm_payload_t, message_confirmation_response))
|
||||
|
||||
typedef enum zb_zcl_messaging_response_type_e {
|
||||
ZB_ZCL_MESSAGING_RESPONSE_TYPE_NORMAL,
|
||||
ZB_ZCL_MESSAGING_RESPONSE_TYPE_PROTECTED,
|
||||
ZB_ZCL_MESSAGING_RESPONSE_TYPE_NOT_FOUND,
|
||||
} zb_zcl_messaging_response_type_t;
|
||||
|
||||
/** According to SE spec, server could send following responses to
|
||||
* @ref ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE "GetLastMessage" command:
|
||||
* <ul>
|
||||
* <li>
|
||||
* \b NOT_FOUND as default response
|
||||
* </li>
|
||||
* <li>
|
||||
* \b DisplayMessage command
|
||||
* </li>
|
||||
* <li>
|
||||
* \b DisplayProtectedMessage command
|
||||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
typedef struct zb_zcl_messaging_get_last_message_response_s {
|
||||
zb_zcl_messaging_response_type_t resp_type;
|
||||
union {
|
||||
zb_zcl_messaging_display_message_payload_t display_message;
|
||||
zb_zcl_messaging_display_message_payload_t display_protected_message;
|
||||
} resp;
|
||||
} zb_zcl_messaging_get_last_message_response_t;
|
||||
|
||||
/** @ref zb_zcl_messaging_get_last_message_response_t initializer */
|
||||
#define ZB_ZCL_MESSAGING_GET_LAST_MESSAGE_RESPONSE_INIT \
|
||||
(zb_zcl_messaging_get_last_message_response_t) \
|
||||
{ \
|
||||
.resp_type = ZB_ZCL_MESSAGING_RESPONSE_TYPE_NOT_FOUND, \
|
||||
.resp.display_message = ZB_ZCL_MESSAGING_DISPLAY_MSG_PAYLOAD_INIT, \
|
||||
}
|
||||
|
||||
/** @ref zb_zcl_messaging_message_confirm_payload_t initializer */
|
||||
#define ZB_ZCL_MESSAGING_MSG_CONFIRM_PAYLOAD_INIT \
|
||||
(zb_zcl_messaging_message_confirm_payload_t) \
|
||||
{\
|
||||
.message_confirmation_response = {0x00} \
|
||||
}
|
||||
|
||||
/** Function for send @ref ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE "GetLastMessage" command
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_MESSAGING_GET_LAST_MSG_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Example of sending ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE "GetLastMessage" command
|
||||
*/
|
||||
void zb_zcl_messaging_send_get_last_msg(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
zb_callback_t cb);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_MESSAGE "DisplayMessage" command.
|
||||
* On sender's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with @ref ZB_ZCL_MESSAGING_GET_LAST_MSG_CB_ID
|
||||
* callback id on reception of @ref ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE "GetLastMessage" command.
|
||||
* @n On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_MESSAGING_DISPLAY_MSG_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_messaging_display_message_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
* @par Usage
|
||||
* @n Handle @ref ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE "GetLastMessage" command
|
||||
*/
|
||||
void zb_zcl_messaging_send_display_msg(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
const zb_zcl_messaging_display_message_payload_t *payload,
|
||||
zb_callback_t cb);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_MESSAGING_CLI_CMD_MESSAGE_CONFIRMATION "MessageConfirmation" command
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_MESSAGING_MSG_CONFIRMATION_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_messaging_message_confirm_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
*/
|
||||
void zb_zcl_messaging_send_msg_confirmation(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
const zb_zcl_messaging_message_confirm_payload_t *payload,
|
||||
zb_callback_t cb);
|
||||
|
||||
/** Function for send @ref ZB_ZCL_MESSAGING_SRV_CMD_CANCEL_MESSAGE "CancelMessage" command
|
||||
* On receiver's side callback ZCL device callback @ref ZB_ZCL_REGISTER_DEVICE_CB will be called with
|
||||
* @ref ZB_ZCL_MESSAGING_CANCEL_MSG_CB_ID callback id.
|
||||
* @param param - Reference to buffer.
|
||||
* @param dst_addr - Address of the device to send command to.
|
||||
* @param dst_addr_mode - Address mode for dst_addr.
|
||||
* @param dst_ep - Destination endpoint.
|
||||
* @param src_ep - Current endpoint.
|
||||
* @param payload - Packet payload (@ref zb_zcl_messaging_cancel_message_payload_t).
|
||||
* @param cb - Callback which should be called when the ZCL stack receives APS ack.
|
||||
*/
|
||||
void zb_zcl_messaging_send_cancel_msg(zb_uint8_t param,
|
||||
const zb_addr_u *dst_addr,
|
||||
zb_aps_addr_mode_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
const zb_zcl_messaging_cancel_message_payload_t *payload,
|
||||
zb_callback_t cb);
|
||||
|
||||
/** Macro for call @ref zb_zcl_messaging_send_get_last_msg function */
|
||||
#define ZB_ZCL_MESSAGING_SEND_GET_LAST_MSG(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep) \
|
||||
zb_zcl_messaging_send_get_last_msg(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, NULL) \
|
||||
|
||||
/** Macro for call @ref zb_zcl_messaging_send_display_msg function */
|
||||
#define ZB_ZCL_MESSAGING_SEND_DISPLAY_MSG(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_messaging_send_display_msg(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_zcl_messaging_send_msg_confirmation function */
|
||||
#define ZB_ZCL_MESSAGING_SEND_MSG_CONFIRMATION(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_messaging_send_msg_confirmation(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** Macro for call @ref zb_zcl_messaging_send_cancel_msg function */
|
||||
#define ZB_ZCL_MESSAGING_SEND_CANCEL_MSG(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload) \
|
||||
zb_zcl_messaging_send_cancel_msg(_param, _dst_addr, _addr_mode, \
|
||||
_dst_ep, _src_ep, _payload, NULL)
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
void zb_zcl_messaging_init_server(void);
|
||||
void zb_zcl_messaging_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_SERVER_ROLE_INIT zb_zcl_messaging_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_MESSAGING_CLIENT_ROLE_INIT zb_zcl_messaging_init_client
|
||||
|
||||
/** @endcond */ /* internal_doc */
|
||||
|
||||
/** @} */ /* ZB_ZCL_MESSAGING_COMMANDS */
|
||||
|
||||
/** @} */ /* ZCL Messaging cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#endif /* ZB_ZCL_MESSAGING_H_ */
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Meter Identification cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_METER_IDENTIFICATION_H
|
||||
#define ZB_ZCL_METER_IDENTIFICATION_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_METER_IDENTIFICATION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_METER_IDENTIFICATION
|
||||
* @{
|
||||
* @name Meter Identification cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Meter Identification server attributes identifiers
|
||||
@see ZCL spec, subclause 3.18.2.1
|
||||
*/
|
||||
enum zb_zcl_meter_identification_attr_e
|
||||
{
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_COMPANY_NAME = 0x0000, /**< @e CompanyName is a ZCL Octet String field capable
|
||||
* of storing up to 16 character string (the first
|
||||
* Octet indicates length) encoded in the UTF-8 format.
|
||||
* Company Name defines the meter manufacturer name,
|
||||
* decided by manufacturer
|
||||
*/
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_METER_TYPE_ID = 0x0001, /**< @e MeterTypeID defines the Meter installation features,
|
||||
* decided by manufacturer.
|
||||
*/
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID = 0x0004, /**< @e DataQualityID defines the Meter Simple Metering
|
||||
* information certification type, decided by manufacturer.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_CUSTOMER_NAME = 0x0005, /**< @e CustomerName is a ZCL Character String field capable
|
||||
* of storing up to 16 character string (the first Octet
|
||||
* indicates length) encoded in the ASCII format.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_MODEL = 0x0006, /**< @e Model is a ZCL Octet String field capable of storing
|
||||
* up to 16 character string (the first Octet indicates length)
|
||||
* encoded in the UTF-8 format. @e Model defines the meter model
|
||||
* name, decided by manufacturer.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_PART_NUMBER = 0x0007, /**< @e PartNumber is a ZCL Octet String field capable of storing
|
||||
* up to 16 character string (the first Octet indicates length)
|
||||
* encoded in the UTF-8 format. @e PartNumber defines the meter part
|
||||
* number, decided by manufacturer.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_PRODUCT_REVISION = 0x0008, /**< @e ProductRevision is a ZCL Octet String field capable
|
||||
* of storing up to 6 character string (the first Octet
|
||||
* indicates length) encoded in the UTF-8 format.
|
||||
* @e ProductRevision defines the meter revision code,
|
||||
* decided by manufacturer.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_SOFTWARE_REVISION = 0x000A, /**< @e SoftwareRevision is a ZCL Octet String field capable
|
||||
* of storing up to 6 character string (the first Octet indicates
|
||||
* length) encoded in the UTF-8 format. SoftwareRevision defines
|
||||
* the meter software revision code, decided by manufacturer.
|
||||
*/
|
||||
/* (O) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_UTILITY_NAME = 0x000B, /**< @e UtilityName is a ZCL Character String field capable of
|
||||
* storing up to 16 character string (the first Octet indicates
|
||||
* length) encoded in the ASCII format.
|
||||
*/
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_POD = 0x000C, /**< @e POD (Point of Delivery) is a ZCL Character String field
|
||||
* capable of storing up to 16 character string (the first Octet
|
||||
* indicates length) encoded in the ASCII format. POD is the unique
|
||||
* identification ID of the premise connection point. It is also a
|
||||
* contractual information known by the clients and indicated in the bill.
|
||||
*/
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_AVAILABLE_POWER = 0x000D, /**< @e AvailablePower represents the @e InstantaneousDemand that
|
||||
* can be distributed to the customer (e.g., @e 3.3KW power)
|
||||
* without any risk of overload. The Available Power SHALL use
|
||||
* the same formatting conventions as the one used in the simple
|
||||
* metering cluster formatting attribute set for the
|
||||
* @e InstantaneousDemand attribute, i.e.,
|
||||
* the @e UnitOfMeasure and @e DemandFormatting.
|
||||
*/
|
||||
/* (M) */
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_POWER_THRESHOLD = 0x000E /**< @e PowerThreshold represents a threshold of @e InstantaneousDemand
|
||||
* distributed to the customer (e.g., 4.191KW) that will lead to an
|
||||
* imminent risk of overload.
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/** @ref ZB_ZCl_ATTR_METER_IDENTIFICATION_METER_TYPE_ID "MeterTypeID" attribute values
|
||||
* @see ZCL spec, subclause 3.18.2.1.2
|
||||
*/
|
||||
typedef enum zb_zcl_meter_identification_meter_type_e
|
||||
{
|
||||
ZB_ZCL_METER_TYPE_UTILITY_PRIMARY = 0x0000, /**< Utility Primary Meter */
|
||||
ZB_ZCL_METER_TYPE_UTILITY_PRODUCTION = 0x0001, /**< Utility Production Meter */
|
||||
ZB_ZCL_METER_TYPE_UTILITY_SECONDARY = 0x0002, /**< Utility Secondary Meter */
|
||||
ZB_ZCL_METER_TYPE_PRIVATE_PRIMARY = 0x0100, /**< Private Primary Meter */
|
||||
ZB_ZCL_METER_TYPE_PRIVATE_PRODUCTION = 0x0101, /**< Private Production Meter */
|
||||
ZB_ZCL_METER_TYPE_PRIVATE_SECONDARY = 0x0102, /**< Private Secondary Meters */
|
||||
ZB_ZCL_METER_TYPE_GENERIC = 0x0110 /**< Generic Meter */
|
||||
} zb_zcl_meter_identification_meter_type_t;
|
||||
|
||||
|
||||
/** @ref ZB_ZCl_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID "DataQualityID" attribute values
|
||||
* @see ZCL spec, subclause 3.18.2.1.3
|
||||
*/
|
||||
typedef enum zb_zcl_meter_identification_data_quality_e
|
||||
{
|
||||
ZB_ZCL_DATA_QUALITY_ALL_DATA_CERTIFIED = 0x0000, /**< All Data Certified */
|
||||
ZB_ZCL_DATA_QUALITY_ONLY_INSTANTANEOUS_POWER_NOT_CERTIFIED = 0x0001, /**< Only Instantaneous Power not Certified */
|
||||
ZB_ZCL_DATA_QUALITY_ONLY_CUMULATED_CONSUMPTION_NOT_CERTIFIED = 0x0002, /**< Only Cumulated Consumption not Certified */
|
||||
ZB_ZCL_DATA_QUALITY_NOT_CERTIFIED_DATA = 0x0003 /**< Not Certified data */
|
||||
} zb_zcl_meter_identification_data_quality_t;
|
||||
|
||||
/** @brief Default value for Meter Identification cluster revision global attribute */
|
||||
#define ZB_ZCL_METER_IDENTIFICATION_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Default value for Company Name attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_COMPANY_NAME_DEFAULT_VALUE { 0 }
|
||||
|
||||
/** @brief Default value for Meter Type ID attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_METER_TYPE_ID_DEFAULT_VALUE 0
|
||||
|
||||
/** @brief Default value for Data Quality ID attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID_DEFAULT_VALUE 0
|
||||
|
||||
/** @brief Default value for POD (Point of Delivery) attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_POD_DEFAULT_VALUE { 0 }
|
||||
|
||||
/** @brief Default value for Available Power attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_AVAILABLE_POWER_DEFAULT_VALUE ZB_INIT_UINT24(0,0)
|
||||
|
||||
/** @brief Default value for Power Threshold attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_POWER_THRESHOLD_DEFAULT_VALUE ZB_INIT_UINT24(0, 0)
|
||||
|
||||
/** @brief Max length of Company Name attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_COMPANY_NAME_MAX_LENGTH 16
|
||||
|
||||
/** @brief Max length of POD (Point of Delivery) attribute */
|
||||
#define ZB_ZCl_ATTR_METER_IDENTIFICATION_POD_MAX_LENGTH 16
|
||||
|
||||
/** @brief Declare attribute list for Thermostat cluster
|
||||
@param attr_list - attribute list name
|
||||
@param company_name - pointer to variable to store Company Name attribute value
|
||||
@param meter_type_id - pointer to variable to store Meter Type ID attribute value
|
||||
@param data_quality_id - pointer to variable to store Data Quality ID attribute value
|
||||
@param pod - pointer to variable to store POD (Point of Delivery) attribute value
|
||||
@param available_power - pointer to variable to store Available Power attribute value
|
||||
@param power_threshold - pointer to variable to store Power Threshold attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_METER_IDENTIFICATION_ATTRIB_LIST(attr_list, \
|
||||
company_name, meter_type_id, data_quality_id, \
|
||||
pod, available_power, power_threshold) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_METER_IDENTIFICATION) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_COMPANY_NAME, (company_name)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_METER_TYPE_ID, (meter_type_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID, (data_quality_id)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_POD, (pod)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_AVAILABLE_POWER, (available_power)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_METER_IDENTIFICATION_POWER_THRESHOLD, (power_threshold)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* Meter Identification cluster attributes */
|
||||
|
||||
|
||||
|
||||
/*! @name Meter Identification cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Meter Identification cluster commands */
|
||||
|
||||
|
||||
/*!
|
||||
@cond internals_doc
|
||||
@internal @name Meter Identification cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_COMPANY_NAME(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_COMPANY_NAME, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_METER_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_METER_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_DATA_QUALITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_POD(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_POD, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_AVAILABLE_POWER(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_AVAILABLE_POWER, \
|
||||
ZB_ZCL_ATTR_TYPE_S24, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_METER_IDENTIFICATION_POWER_THRESHOLD(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCl_ATTR_METER_IDENTIFICATION_POWER_THRESHOLD, \
|
||||
ZB_ZCL_ATTR_TYPE_S24, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Meter Identification cluster */
|
||||
#define ZB_ZCL_METER_IDENTIFICATION_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Thermostat cluster internals */
|
||||
|
||||
/*! @} */ /* ZB_ZCL_METER_IDENTIFICATION */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_meter_identification_init_server(void);
|
||||
void zb_zcl_meter_identification_init_client(void);
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_METER_IDENTIFICATION_SERVER_ROLE_INIT zb_zcl_meter_identification_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_METER_IDENTIFICATION_CLIENT_ROLE_INIT zb_zcl_meter_identification_init_client
|
||||
|
||||
#endif /* ZB_ZCL_METER_IDENTIFICATION_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,435 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Multistate Input cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_MULTISTATE_INPUT_H
|
||||
#define ZB_ZCL_MULTISTATE_INPUT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_MULTISTATE_INPUT
|
||||
* @{
|
||||
* @details
|
||||
* The Multistate Input cluster provides an interface for reading the value
|
||||
* of a multistate measurement and accessing various characteristics of that
|
||||
* measurement. No cluster specific commands are received or generated.
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_MULTI_INPUT */
|
||||
|
||||
/** @defgroup ZB_ZCL_MULTISTATE_INPUT_ATTRS_GROUP Multistate Input cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Multistate Input cluster attribute identifiers
|
||||
* @see ZCL spec, Multistate Input (Basic) Cluster 3.14.8.4.2
|
||||
*/
|
||||
enum zb_zcl_multi_input_attr_e
|
||||
{
|
||||
/** @brief StateText attribute, ZCL spec 3.14.11.18 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATE_TEXT_ID = 0x000e,
|
||||
/** @brief Description attribute, ZCL spec 3.14.11.4 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_DESCRIPTION_ID = 0x001c,
|
||||
/** @brief NumberOfStates attribute, ZCL spec 3.14.11.17 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_NUM_OF_STATES_ID = 0x004a,
|
||||
/** @brief OutOfService attribute, ZCL spec 3.14.11.1 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID = 0x0051,
|
||||
/** @brief PresentValue attribute, ZCL spec 3.14.11.2 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_PRESENT_VALUE_ID = 0x0055,
|
||||
/** @brief Reliability attribute, ZCL spec 3.14.11.9 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_RELIABILITY_ID = 0x0067,
|
||||
/** @brief StatusFlags attribute, ZCL spec 3.14.11.3 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID = 0x006f,
|
||||
/** @brief ApplicationType attribute, ZCL spec 3.14.11.19 */
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_APPLICATION_TYPE_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief StatusFlags attribute values.
|
||||
* @see ZCL spec 3.14.11.3 for details.
|
||||
*/
|
||||
enum zb_zcl_multi_input_status_flags_value_e
|
||||
{
|
||||
ZB_ZCL_MULTI_INPUT_STATUS_FLAG_NORMAL = 0x00, /**< Normal (default) state. */
|
||||
ZB_ZCL_MULTI_INPUT_STATUS_FLAG_IN_ALARM = 0x01, /**< In alarm bit. */
|
||||
ZB_ZCL_MULTI_INPUT_STATUS_FLAG_FAULT = 0x02, /**< Fault bit. */
|
||||
ZB_ZCL_MULTI_INPUT_STATUS_FLAG_OVERRIDDEN = 0x04, /**< Overridden bit. */
|
||||
ZB_ZCL_MULTI_INPUT_STATUS_FLAG_OUT_OF_SERVICE = 0x08, /**< Out of service bit. */
|
||||
};
|
||||
|
||||
/** @brief Reliability attribute values.
|
||||
* @see ZCL spec 3.14.11.9 for details.
|
||||
*/
|
||||
enum zb_zcl_multi_input_reliability_value_e
|
||||
{
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_NO_FAULT_DETECTED = 0x00,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_NO_SENSOR = 0x01,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_OVER_RANGE = 0x02,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_UNDER_RANGE = 0x03,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_OPEN_LOOP = 0x04,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_SHORTED_LOOP = 0x05,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_NO_OUTPUT = 0x06,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_UNRELIABLE_OTHER = 0x07,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_PROCESS_ERROR = 0x08,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_MULTI_STATE_FAULT = 0x09,
|
||||
ZB_ZCL_MULTI_INPUT_RELIABILITY_CONFIGURATION_ERROR = 0x0a,
|
||||
};
|
||||
|
||||
/** @defgroup ZB_ZCL_MULTISTATE_INPUT_APPLICATION_TYPES Multistate Input cluster application types
|
||||
* @{
|
||||
* @details
|
||||
* The ApplicationType attribute indicates the specific application usage
|
||||
* for the cluster. ApplicationType is subdivided into Group, Type and
|
||||
* an Index number, as follows:
|
||||
*
|
||||
* Group = Bits 24 to 31
|
||||
* An indication of the cluster this attribute is part of. Multistate Input
|
||||
* clusters have Group = 0x0d.
|
||||
*
|
||||
* Type = Bits 16 to 23
|
||||
* The physical quantity that the PresentValue attribute of the cluster
|
||||
* represents.
|
||||
*
|
||||
* Index = Bits 0 to 15
|
||||
* The specific application usage of the cluster.
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_MI_GROUP_ID 0x0d
|
||||
/* TODO: Consider adding common macro for all application types */
|
||||
#define ZB_ZCL_MI_SET_APP_TYPE_WITH_ID(_type, _id) ((ZB_ZCL_MI_GROUP_ID << 24) | ((_type & 0xff) << 16) | (_id & 0xffff))
|
||||
|
||||
/** @brief Type values for Multistate Input cluster applications
|
||||
* @see ZCL spec 3.14.11.19.7
|
||||
*/
|
||||
enum zb_zcl_mi_application_types_e
|
||||
{
|
||||
ZB_ZCL_MI_APP_TYPE_APP_DOMAIN_HVAC,
|
||||
/* Types 0x01 to 0xfe are reserved */
|
||||
ZB_ZCL_MI_APP_TYPE_OTHER = 0xff
|
||||
};
|
||||
|
||||
/** @defgroup ZB_ZCL_MI_APP_DOMAIN_HVAC_TYPE Multistate Input cluster representing HVAC domain
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Values for 'Application Domain HVAC' type of Multistate Input cluster
|
||||
* @see ZCL spec 3.14.11.19.7.1
|
||||
* @note
|
||||
* This application domain is specific for Heating, Ventilation, Air
|
||||
* Conditioning (HVAC) type of applications and the enumeration lists possible
|
||||
* application usage states.
|
||||
*/
|
||||
enum zb_zcl_mi_app_domain_hvac_e
|
||||
{
|
||||
/** @brief On, Off, Auto states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_0 = ZB_ZCL_MI_SET_APP_TYPE_WITH_ID(ZB_ZCL_MI_APP_TYPE_APP_DOMAIN_HVAC, 0x0000),
|
||||
/** @brief Off, Low, Medium, High states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_1,
|
||||
/** @brief Auto, Heat, Cool, Off, Emergency Heat, Fan Only, Max Heat states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_2,
|
||||
/** @brief Occupied, Unoccupied, Standby, Bypass states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_3,
|
||||
/** @brief Inactive, Active, Hold states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_4,
|
||||
/** @brief
|
||||
* Auto, Warm-up, Water Flush, Autocalibration, Shutdown Open, Shutdown
|
||||
* Closed, Low Limit, Test and Balance states
|
||||
*/
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_5,
|
||||
/** @brief Off, Auto, Heat Control, Heat Only, Cool Only, Fan Only states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_6,
|
||||
/** @brief High, Normal, Low states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_7,
|
||||
/** @brief Occupied, Unoccupied, Startup, Shutdown states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_8,
|
||||
/** @brief Night, Day, Hold states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_9,
|
||||
/** @brief Off, Cool, Heat, Auto, Emergency Heat states */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_10,
|
||||
/** @brief
|
||||
* Shutdown Closed, Shutdown Open, Satisfied, Mixing, Cooling, Heating,
|
||||
* Supplemental Heat states
|
||||
*/
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_STATES_GROUP_11,
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
ZB_ZCL_MI_APP_DOMAIN_HVAC_OTHER = ZB_ZCL_MI_SET_APP_TYPE_WITH_ID(ZB_ZCL_MI_APP_TYPE_APP_DOMAIN_HVAC, 0xffff)
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MI_APP_DOMAIN_HVAC_TYPE group */
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MULTISTATE_INPUT_APPLICATION_TYPES */
|
||||
|
||||
/** @brief Default value for Multistate Input cluster revision global attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Description attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for NumberOfStates attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_NUM_OF_STATES_DEFAULT_VALUE ((zb_uint16_t)0x0000u)
|
||||
|
||||
/** @brief Default value for OutOfService attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_OUT_OF_SERVICE_DEFAULT_VALUE ZB_FALSE
|
||||
|
||||
/** @brief Default value for Reliability attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_RELIABILITY_DEFAULT_VALUE ZB_ZCL_MULTI_INPUT_RELIABILITY_NO_FAULT_DETECTED
|
||||
|
||||
/** @brief Default value for StatusFlags attribute */
|
||||
#define ZB_ZCL_MULTI_INPUT_STATUS_FLAGS_DEFAULT_VALUE ZB_ZCL_MULTI_INPUT_STATUS_FLAG_NORMAL
|
||||
|
||||
/** @brief StatusFlags attribute minimum value */
|
||||
#define ZB_ZCL_MULTI_INPUT_STATUS_FLAGS_MIN_VALUE 0
|
||||
|
||||
/** @brief StatusFlags attribute maximum value */
|
||||
#define ZB_ZCL_MULTI_INPUT_STATUS_FLAGS_MAX_VALUE 0x0f
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Multistate Input cluster internals
|
||||
* Internal structures for Multistate Input cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_DESCRIPTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_DESCRIPTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_NUM_OF_STATES_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_NUM_OF_STATES_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_RELIABILITY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_RELIABILITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_INPUT_APPLICATION_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_APPLICATION_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Multistate Input cluster */
|
||||
#define ZB_ZCL_MULTI_INPUT_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Multistate Input cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for Multistate Input cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param description - pointer to variable storing Description attribute value
|
||||
* @param num_of_states - pointer to variable storing NumberOfStates attribute value
|
||||
* @param out_of_service - pointer to variable storing OutOfService attribute value
|
||||
* @param present_value - pointer to variable storing PresentValue attribute value
|
||||
* @param reliability - pointer to variable storing Reliability attribute value
|
||||
* @param status_flags - pointer to variable storing StatusFlags attribute value
|
||||
* @param app_type - pointer to variable storing ApplicationType attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_MULTI_INPUT_ATTRIB_LIST( \
|
||||
attr_list, \
|
||||
description, \
|
||||
num_of_states, \
|
||||
out_of_service, \
|
||||
present_value, \
|
||||
reliability, \
|
||||
status_flags, \
|
||||
app_type) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_MULTI_INPUT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_DESCRIPTION_ID, (description)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_NUM_OF_STATES_ID, (num_of_states)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID, (out_of_service)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_PRESENT_VALUE_ID, (present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_RELIABILITY_ID, (reliability)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, (status_flags)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_INPUT_APPLICATION_TYPE_ID, (app_type)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MULTISTATE_INPUT_ATTRS_GROUP group */
|
||||
|
||||
/** @defgroup ZB_ZCL_MULTISTATE_INPUT_ATTR_API Multistate Input cluster attribute value manipulation API
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Set normal operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_INPUT_SET_NORMAL_MODE(ep) \
|
||||
{ \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_FALSE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
val = ZB_ZCL_MULTI_INPUT_STATUS_FLAG_NORMAL; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @brief Set Out of service operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_INPUT_SET_OUT_OF_SERVICE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_TRUE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_INPUT_STATUS_FLAG_OUT_OF_SERVICE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set overridden operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_INPUT_SET_OVERRIDDEN_MODE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_INPUT_STATUS_FLAG_OVERRIDDEN;\
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set fault status flag
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_INPUT_SET_FAULT_STATUS(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_INPUT_STATUS_FLAG_FAULT; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_INPUT, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_INPUT_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MULTISTATE_INPUT_ATTR_API group */
|
||||
|
||||
/** @} */ /* ZCL Multistate Input cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_multi_input_init_server(void);
|
||||
void zb_zcl_multi_input_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_MULTI_INPUT_SERVER_ROLE_INIT zb_zcl_multi_input_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_MULTI_INPUT_CLIENT_ROLE_INIT zb_zcl_multi_input_init_client
|
||||
|
||||
#endif /* ZB_ZCL_MULTISTATE_INPUT_H */
|
||||
@@ -0,0 +1,489 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Multistate Value cluster definitions */
|
||||
|
||||
#ifndef ZB_ZCL_MULTISTATE_VALUE_H
|
||||
#define ZB_ZCL_MULTISTATE_VALUE_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_MULTISTATE_VALUE
|
||||
* @{
|
||||
* @details
|
||||
* The Multistate Value (Basic) cluster provides an interface for setting
|
||||
* a multistate value, typically used as a control system parameter, and
|
||||
* accessing characteristics of that value.
|
||||
*/
|
||||
|
||||
/* ZB_ZCL_CLUSTER_ID_MULTI_VALUE = 0x000e defined in zb_zcl_common.h ZCL spec 3.14.4 */
|
||||
|
||||
/** @name Multistate Value cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Multistate Value cluster attribute identifiers
|
||||
* @see ZCL spec, Multistate Value (Basic) Cluster 3.14.4.4.2
|
||||
*/
|
||||
enum zb_zcl_multi_value_attr_e
|
||||
{
|
||||
// TODO: Support Text/NumberOfs attribute
|
||||
// @brief Text attribute, ZCL spec 3.14.11.18
|
||||
// ZB_ZCL_ATTR_MULTI_VALUE_STATE_TEXT_ID = 0x000e,
|
||||
|
||||
/** @brief Description attribute, ZCL spec 3.14.11.4 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID = 0x001c,
|
||||
|
||||
// TODO: Support Text/NumberOfs attribute
|
||||
// @brief NumberOfs attribute, ZCL spec 3.14.11.17
|
||||
// ZB_ZCL_ATTR_MULTI_VALUE_NUMBER_OF_STATE_ID = 0x0051,
|
||||
|
||||
/** @brief OutOfService attribute, ZCL spec 3.14.11.1 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID = 0x0051,
|
||||
/** @brief PresentValue attribute, ZCL spec 3.14.11.2 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID = 0x0055,
|
||||
|
||||
// TODO: Support PriorityArray attribute
|
||||
// /** @brief PriorityArray attribute, ZCL spec 3.14.11.6 */
|
||||
// ZB_ZCL_ATTR_MULTI_VALUE_PRIORITY_ARRAY_ID = 0x0057,
|
||||
|
||||
/** @brief Reliability attribute, ZCL spec 3.14.11.9 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID = 0x0067,
|
||||
/** @brief Reliability attribute, ZCL spec 3.14.11.7 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID = 0x0068,
|
||||
/** @brief StatusFlags attribute, ZCL spec 3.14.11.3 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID = 0x006f,
|
||||
/** @brief ApplicationType attribute, ZCL spec 3.14.11.19 */
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID = 0x0100,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief StatusFlags attribute values.
|
||||
* @see ZCL spec 3.14.11.3 for details.
|
||||
*/
|
||||
enum zb_zcl_multi_value_status_flags_value_e
|
||||
{
|
||||
ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_NORMAL = 0x00, /**< Normal (default) . */
|
||||
ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_IN_ALARM = 0x01, /**< In alarm bit. */
|
||||
ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_FAULT = 0x02, /**< Fault bit. */
|
||||
ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_OVERRIDDEN = 0x04, /**< Overridden bit. */
|
||||
ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_OUT_OF_SERVICE = 0x08, /**< Out of service bit. */
|
||||
};
|
||||
|
||||
/** @brief Reliability attribute values.
|
||||
* @see ZCL spec 3.14.11.9 for details.
|
||||
*/
|
||||
enum zb_zcl_multi_value_reliability_value_e
|
||||
{
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_NO_FAULT_DETECTED = 0x00, /**< No fault detected */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_NO_SENSOR = 0x01, /**< No sensor */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_OVER_RANGE = 0x02, /**< Over range */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_UNDER_RANGE = 0x03, /**< Under range */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_OPEN_LOOP = 0x04, /**< Open loop */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_SHORTED_LOOP = 0x05, /**< Shorted loop */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_NO_OUTPUT = 0x06, /**< No output */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_UNRELIABLE_OTHER = 0x07, /**< Unreliable other */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_PROCESS_ERROR = 0x08, /**< Process error */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_MULTI_STATE_FAULT = 0x09, /**< Mutlistate fault */
|
||||
ZB_ZCL_MULTI_VALUE_RELIABILITY_CONFIGURATION_ERROR = 0x0a, /**< Configuration error */
|
||||
};
|
||||
|
||||
/** @name Multistate Value cluster application types
|
||||
* @{
|
||||
* @details
|
||||
* The ApplicationType attribute indicates the specific application usage
|
||||
* for the cluster. ApplicationType is subdivided into Group, Type and
|
||||
* an Index number, as follows:
|
||||
*
|
||||
* - Group = Bits 24 to 31
|
||||
* An indication of the cluster this attribute is part of. Multistate Value
|
||||
* clusters have Group = 0x0d.
|
||||
*
|
||||
* - Type = Bits 16 to 23
|
||||
* The physical quantity that the PresentValue attribute of the cluster
|
||||
* represents.
|
||||
*
|
||||
* - Index = Bits 0 to 15
|
||||
* The specific application usage of the cluster.
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_MV_GROUP_ID 0x0d
|
||||
#define ZB_ZCL_MV_SET_APP_TYPE_WITH_ID(_type, _id) ((ZB_ZCL_MV_GROUP_ID << 24) | ((_type & 0xff) << 16) | (_id & 0xffff))
|
||||
|
||||
/** @brief Type values for Multistate Value cluster applications
|
||||
* @see ZCL spec 3.16.11.19.9
|
||||
*/
|
||||
enum zb_zcl_mv_application_types_e
|
||||
{
|
||||
ZB_ZCL_MV_APP_TYPE_APP_DOMAIN_HVAC = 0x0000, /**< Application Domain HVAC */
|
||||
|
||||
/* All other group values are currently reserved. */
|
||||
};
|
||||
|
||||
enum zb_zcl_mv_app_domain_hvac_e
|
||||
{
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_0 /**< On, Off, Auto state */
|
||||
= ZB_ZCL_MV_SET_APP_TYPE_WITH_ID(ZB_ZCL_MV_APP_TYPE_APP_DOMAIN_HVAC, 0x0000),
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_1, /**< Off, Low, Medium, High state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_2, /**< Auto, Heat, Cool, Off, Emergency Heat,
|
||||
Fan Only, Max Heat state */
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_3, /**< Occupied, Unoccupied, Standby, Bypass state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_4, /**< Inactive, Active, Hold state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_5, /**< Auto, Warm-up, Water Flush, Autocalibration,
|
||||
Shutdown Open, Shutdown Closed, Low Limit,
|
||||
Test and Balance state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_6, /**< Off, Auto, Heat Control, Heat Only, Cool Only,
|
||||
Fan Only state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_7, /**< High, Normal, Low state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_8, /**< Occupied, Unoccupied, Startup, Shutdown state */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_9, /**< Night, Day, Hold state */
|
||||
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_10, /**< Off, Cool, Heat, Auto, Emergency Heat state */
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_STATES_GROUP_11, /**< Shutdown Closed, Shutdown Open, Satisfied,
|
||||
Mixing, Cooling, Heating,
|
||||
Supplemental Heat state */
|
||||
|
||||
/* 0x0200 to 0xfffe are Vendor defined */
|
||||
|
||||
ZB_ZCL_MV_APP_DOMAIN_HVAC_OTHER /**< Other */
|
||||
= ZB_ZCL_MV_SET_APP_TYPE_WITH_ID(ZB_ZCL_MV_APP_TYPE_APP_DOMAIN_HVAC, 0xffff),
|
||||
};
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MULTI_VALUE_APP_TYPE */
|
||||
|
||||
/** @brief Default value for Multistate Value cluster revision global attribute */
|
||||
#define ZB_ZCL_MULTI_VALUE_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Description attribute */
|
||||
#define ZB_ZCL_MULTI_VALUE_DESCRIPTION_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief Default value for OutOfService attribute */
|
||||
#define ZB_ZCL_MULTI_VALUE_OUT_OF_SERVICE_DEFAULT_VALUE ZB_FALSE
|
||||
|
||||
/** @brief Default value for Reliability attribute */
|
||||
#define ZB_ZCL_MULTI_VALUE_RELIABILITY_DEFAULT_VALUE ZB_ZCL_MULTI_VALUE_RELIABILITY_NO_FAULT_DETECTED
|
||||
|
||||
/** @brief Default value for StatusFlags attribute */
|
||||
#define ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_DEFAULT_VALUE ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_NORMAL
|
||||
|
||||
/** @brief StatusFlags attribute minimum value */
|
||||
#define ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_MIN_VALUE 0
|
||||
|
||||
/** @brief StatusFlags attribute maximum value */
|
||||
#define ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_MAX_VALUE 0x0f
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Multistate Value cluster internals
|
||||
* Internal structures for Multistate Value cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_CHAR_STRING, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_WRITE_OPTIONAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Multistate Value cluster */
|
||||
#define ZB_ZCL_MULTI_VALUE_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* Multistate Value cluster internalstate */
|
||||
|
||||
/** @brief Declare attribute list for Multistate Value cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param description - pointer to variable storing Description attribute value
|
||||
* @param out_of_service - pointer to variable storing OutOfService attribute value
|
||||
* @param present_value - pointer to variable storing PresentValue attribute value
|
||||
* @param reliability - pointer to variable storing Reliability attribute value
|
||||
* @param relinquish_default - pointer to variable storing RelinquishDefault attribute value
|
||||
* @param status_flags - pointer to variable storing StatusFlags attribute value
|
||||
* @param app_type - pointer to variable storing ApplicationType attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_MULTI_VALUE_ATTRIB_LIST(attr_list, \
|
||||
description, \
|
||||
out_of_service, \
|
||||
present_value, \
|
||||
reliability, \
|
||||
relinquish_default, \
|
||||
status_flags, \
|
||||
app_type) \
|
||||
\
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_MULTI_VALUE) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID, (description)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID, (out_of_service)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID, (present_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID, (reliability)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID, (relinquish_default)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, (status_flags)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID, (app_type)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! Maximum length of Description string field */
|
||||
#define ZB_ZCL_MULTI_VALUE_DESCRIPTION_MAX_LEN 16
|
||||
|
||||
/**
|
||||
* @brief Multistate Value cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_multi_value_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_DESCRIPTION_ID
|
||||
*/
|
||||
zb_char_t description[ZB_ZCL_MULTI_VALUE_DESCRIPTION_MAX_LEN + 1];
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID
|
||||
*/
|
||||
zb_bool_t out_of_service;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_PRESENT_VALUE_ID
|
||||
*/
|
||||
zb_single_t present_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_RELIABILITY_ID
|
||||
*/
|
||||
zb_uint8_t reliability;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_RELINQUISH_DEFAULT_ID
|
||||
*/
|
||||
zb_single_t relinquish_default;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID
|
||||
*/
|
||||
zb_uint8_t status_flags;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID
|
||||
* @see ZB_ZCL_ATTR_MULTI_VALUE_APPLICATION_TYPE_ID
|
||||
*/
|
||||
zb_uint32_t application_type;
|
||||
} zb_zcl_multi_value_attrs_t;
|
||||
|
||||
/** @brief Declare attribute list for Multistate Value cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_multi_value_attrs_t type
|
||||
* (containing Multistate Value cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_MULTI_VALUE_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_MULTI_VALUE_ATTRIB_LIST(attr_list, \
|
||||
&attrs.description, \
|
||||
&attrs.out_of_service, \
|
||||
&attrs.present_value, \
|
||||
&attrs.reliability, \
|
||||
&attrs.relinquish_default, \
|
||||
&attrs.status_flags, \
|
||||
&attrs.application_type)
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_MULTI_VALUE_ATTRSTATE_GROUP group */
|
||||
|
||||
/** @name Multistate Value cluster attribute value manipulation API
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Set normal operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_VALUE_SET_NORMAL_MODE(ep) \
|
||||
{ \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_FALSE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
val = ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_NORMAL; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @brief Set Out of service operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_VALUE_SET_OUT_OF_SERVICE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
val = ZB_TRUE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_OUT_OF_SERVICE_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_OUT_OF_SERVICE; \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set overridden operating mode
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_VALUE_SET_OVERRIDDEN_MODE(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_OVERRIDDEN \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Set fault status flag
|
||||
* @param ep - endpoint number
|
||||
*/
|
||||
#define ZB_ZCL_MULTI_VALUE_SET_FAULT_STATUS(ep) \
|
||||
{ \
|
||||
zb_zcl_attr_t *attr_desc; \
|
||||
zb_uint8_t val; \
|
||||
\
|
||||
attr_desc = zb_zcl_get_attr_desc_a(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID); \
|
||||
if (attr_desc) \
|
||||
{ \
|
||||
val = *(zb_uint8_t*)attr_desc->data_p | ZB_ZCL_MULTI_VALUE_STATUS_FLAGS_FAULT \
|
||||
ZB_ZCL_SET_ATTRIBUTE(ep, ZB_ZCL_CLUSTER_ID_MULTI_VALUE, \
|
||||
ZB_ZCL_CLUSTER_SERVER_ROLE, \
|
||||
ZB_ZCL_ATTR_MULTI_VALUE_STATUS_FLAGS_ID, \
|
||||
&val, ZB_FALSE); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_multi_value_init_server(void);
|
||||
void zb_zcl_multi_value_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_MULTI_VALUE_SERVER_ROLE_INIT zb_zcl_multi_value_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_MULTI_VALUE_CLIENT_ROLE_INIT zb_zcl_multi_value_init_client
|
||||
|
||||
#endif /* ZB_ZCL_MULTISTATE_VALUE_H */
|
||||
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Occupancy Sensing definitoins
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_OCCUPANCY_SENSING_H
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_OCCUPANCY_SENSING
|
||||
* @{
|
||||
* @details
|
||||
* Occupancy Sensing cluster has no cluster-specific command support. Cluster
|
||||
* attributes can be queried with @ref ZB_ZCL_COMMANDS "common commands".
|
||||
*/
|
||||
|
||||
/*! @name Occupancy Sensing cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Occupancy Sensing cluster attribute identifiers
|
||||
@see ZCL spec, subclause 4.8.2.2
|
||||
*/
|
||||
enum zb_zcl_occupancy_sensing_attr_e
|
||||
{
|
||||
/** Occupancy attribute identifier */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_ID = 0x0000,
|
||||
/** Occupancy Sensor Type attribute identifier */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_ID = 0x0001,
|
||||
/** The OccupancySensorTypeBitmap attribute specifies the types of the occupancy
|
||||
* sensor. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_BITMAP_ID = 0x0002,
|
||||
/** PIROccupiedToUnoccupiedDelay identifier */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PIR_OCC_TO_UNOCC_DELAY_ID = 0x0010,
|
||||
/** PIRUnoccupiedToOccupiedDelay identifier */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_DELAY_ID = 0x0011,
|
||||
/** PIRUnoccupiedToOccupiedThreshold identifier */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_THRESHOLD_ID = 0x0012,
|
||||
/** The UltrasonicOccupiedToUnoccupiedDelay attribute is 16 bits in length and
|
||||
* specifies the time delay, in seconds, before the Ultrasonic sensor changes to its
|
||||
* unoccupied state after the last detection of movement in the sensed area. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_ID = 0x0020,
|
||||
/** The UltrasonicUnoccupiedToOccupiedDelay attribute is 16 bits in length and
|
||||
* specifies the time delay, in seconds, before the Ultrasonic sensor changes
|
||||
* to its occupied state after the detection of movement in the sensed area. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_ID = 0x0021,
|
||||
/** The UltrasonicUnoccupiedToOccupiedThreshold attribute is 8 bits in length and
|
||||
* specifies the number of movement detection events that must occur in the period
|
||||
* UltrasonicUnoccupiedToOccupiedDelay, before the Ultrasonic sensor changes to its
|
||||
* occupied state. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ID = 0x0022,
|
||||
/** The PhysicalContactOccupiedToUnoccupiedDelay attribute is 16 bits in length and
|
||||
* specifies the time delay, in seconds, before the physical contact occupancy sensor
|
||||
* changes to its unoccupied state after detecting the unoccupied event. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PHYSICAL_CONTACT_OCCUPIED_TO_UNOCCUPIED_DELAY_ID = 0x0030,
|
||||
/** The PhysicalContactUnoccupiedToOccupiedDelay attribute is 16 bits in length and
|
||||
* specifies the time delay, in seconds, before the physical contact sensor changes
|
||||
* to its occupied state after the detection of the occupied event. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ID = 0x0031,
|
||||
/** The PhysicalContactUnoccupiedToOccupiedThreshold attribute is 8 bits in length and
|
||||
* specifies the number of movement detection events that must occur in the period
|
||||
* PhysicalContactUnoccupiedToOccupiedDelay, before the PIR sensor changes to its
|
||||
* occupied state. */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ID = 0x0032,
|
||||
/* Parking Sensor, Attributes for device Configuration, 2.5.1 */
|
||||
/** @cond internals_doc */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_REPORTING_MODE_ID = 0x8001,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_DEBUG_MODE_ID = 0x8002,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_SENSING_INTERVAL_ID = 0x8003,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_MAX_NBR_CONFIRM_PINGS_ID = 0x8004,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_CONFIRM_PING_DELAY_ID = 0x8005,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_NBR_CONFIRM_PINGS_TO_VALID_ID = 0x8006,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_LOCAL_TEMPERATURE_OVERRIDE_ID = 0x8007,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_REMOTE_TEMPERATURE_VALUE_ID = 0x8008,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_HUMIDITY_COMPENSATION_ID = 0x800A,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_TRANDUCER_SENSITIVITY_CALIBRATION_SOURCE_ID = 0x800B,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_TRANDUCER_SENSITIVITY_CALIBRATION_OVERRIDE_VALUE_ID = 0x800C,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_SENSOR_TIME_VS_GAIN_LUT_ID = 0x800D,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_LEARN_ID = 0x800E,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_RINGDOWN_DISTANCE_ID = 0x800F,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_REFERENCE_FLOOR_DISTANCE_ID = 0x8010,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_DETECTION_ALGORITHM_SELECTOR_ID = 0x8011,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_FLOOR_DEADBAND_ID = 0x8012,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_MAIN_OBJECT_DEADBAND_ID = 0x8013,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_DETECTION_THRESHOLD_ID = 0x8014,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_FORCE_REPORT_ID = 0x801C,
|
||||
|
||||
/* Parking Sensor, Reportable Attributes, 2.5.2 */
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_LOCAL_TEMPERATURE_VALUE_ID = 0x8009,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_CONFIDENCE_ID = 0x8015,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_ECHO_RETURN_ARRAY_ID = 0x8017,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_RX_SAMPLES_ARRAY_1_ID = 0x8018,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_RX_SAMPLES_ARRAY_2_ID = 0x8019,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_RX_SAMPLES_ARRAY_3_ID = 0x801A,
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_CUSTOM_RX_SAMPLES_ARRAY_4_ID = 0x801B
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
};
|
||||
|
||||
/** @brief Default value for Occupancy Sensing cluster revision global attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Minimal value for PIROccToUnoccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_OCC_TO_UNOCC_DELAY_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Maximal value for PIROccToUnoccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_OCC_TO_UNOCC_DELAY_MAX_VALUE ((zb_uint16_t)0xfffe)
|
||||
|
||||
/** @brief Default value for PIROccToUnoccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_OCC_TO_UNOCC_DELAY_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_PIR_OCC_TO_UNOCC_DELAY_MIN_VALUE
|
||||
|
||||
/** @brief Minimal value for PIRUnoccToOccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_DELAY_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Maximal value for PIRUnoccToOccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_DELAY_MAX_VALUE ((zb_uint16_t)0xfffe)
|
||||
|
||||
/** @brief Default value for PIRUnoccToOccDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_DELAY_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_DELAY_MIN_VALUE
|
||||
|
||||
/** @brief Minimal value for PIRUnoccToOccThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_THRESHOLD_MIN_VALUE ((zb_uint8_t)0x01)
|
||||
|
||||
/** @brief Maximal value for PIRUnoccToOccThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_THRESHOLD_MAX_VALUE ((zb_uint8_t)0xfe)
|
||||
|
||||
/** @brief Default value for PIRUnoccToOccThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_THRESHOLD_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_PIR_UNOCC_TO_OCC_THRESHOLD_MIN_VALUE
|
||||
|
||||
/** @brief Minimal value for UltrasonicOccupiedToUnoccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Maximal value for UltrasonicOccupiedToUnoccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_MAX_VALUE ((zb_uint16_t)0xfffe)
|
||||
|
||||
/** @brief Default value for UltrasonicOccupiedToUnoccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_MIN_VALUE
|
||||
|
||||
/** @brief Minimal value for UltrasonicUnoccupiedToOccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Maximal value for UltrasonicUnoccupiedToOccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_MAX_VALUE ((zb_uint16_t)0xfffe)
|
||||
|
||||
/** @brief Default value for UltrasonicUnoccupiedToOccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_MIN_VALUE
|
||||
|
||||
/** @brief Minimal value for UltrasonicUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_MIN_VALUE ((zb_uint8_t)0x01)
|
||||
|
||||
/** @brief Maximal value for UltrasonicUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_MAX_VALUE ((zb_uint8_t)0xfe)
|
||||
|
||||
/** @brief Default value for UltrasonicUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_MIN_VALUE
|
||||
|
||||
/** @brief Default value for PhysicalContactOccupiedToUnoccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_OCCUPIED_TO_UNOCCUPIED_DELAY_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief No-reporting value for PhysicalContactOccupiedToUnoccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_OCCUPIED_TO_UNOCCUPIED_DELAY_NO_REPORTING_VALUE ((zb_uint16_t)0xffff)
|
||||
|
||||
/** @brief Default value for PhysicalContactUnoccupiedToOccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief No-reporting value for PhysicalContactUnoccupiedToOccupiedDelay attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_NO_REPORTING_VALUE ((zb_uint16_t)0xffff)
|
||||
|
||||
/** @brief Minimal value for PhysicalContactUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_MIN_VALUE ((zb_uint8_t)0x01)
|
||||
|
||||
/** @brief Maximal value for PhysicalContactUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_MAX_VALUE ((zb_uint8_t)0xfe)
|
||||
|
||||
/** @brief Default value for PhysicalContactUnoccupiedToOccupiedThreshold attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_DEFAULT_VALUE ZB_ZCL_OCCUPANCY_SENSING_PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_DEFAULT_VALUE
|
||||
|
||||
/*! @brief Permissible values for Occupancy attribute
|
||||
@see ZCL spec, subclause 4.8.2.2.1.1
|
||||
*/
|
||||
enum zb_zcl_occupancy_sensing_occupancy_e
|
||||
{
|
||||
/*! Unoccupied value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_UNOCCUPIED = 0,
|
||||
/*! Occupied value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_OCCUPIED = 1
|
||||
};
|
||||
|
||||
/* Custom Attributes values */
|
||||
|
||||
/*! @brief Maximal value for switch type attribute */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_MAX_VALUE \
|
||||
(ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_UNOCCUPIED)
|
||||
|
||||
|
||||
/* Switch type attribute has no default value */
|
||||
|
||||
/*! @brief Permissible values for Occupancy Sensor Type attribute
|
||||
@see ZCL spec, subclause 4.8.2.2.1.2
|
||||
*/
|
||||
enum zb_zcl_occupancy_sensing_occupancy_sensor_type_e
|
||||
{
|
||||
/*! PIR value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_PIR = 0,
|
||||
/*! Ultrasonic value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_ULTRASONIC = 1,
|
||||
/*! PIR and Ultrasonic value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_PIR_AND_ULTRASONIC = 2,
|
||||
/*! Reserved value */
|
||||
ZB_ZCL_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_RESERVED = 3
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
enum zb_zcl_custom_reporting_mode_type_e
|
||||
{
|
||||
ZB_ZCL_CUSTOM_OCCUPANCY_SENSING_REPORING_MODE_TYPE_REGULAR_REPORTING = 0,
|
||||
ZB_ZCL_CUSTOM_OCCUPANCY_SENSING_REPORING_MODE_TYPE_LOW_POWER_REPORTING = 1
|
||||
};
|
||||
|
||||
|
||||
enum zb_zcl_custom_debug_mode_type_e
|
||||
{
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_DEBUG_MODE_TYPE_SHORT = 0,
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_DEBUG_MODE_TYPE_ENHANCED = 1,
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_DEBUG_MODE_TYPE_DEBUG = 2
|
||||
};
|
||||
|
||||
enum zb_zcl_custom_learn_type_e
|
||||
{
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_LEARN_NOT_YET_PERFORMED = 0,
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_LEARN_IN_PROGRESS = 1,
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_LEARN_FINISHED_WITH_A_FAILURE = 2,
|
||||
ZB_ZCL_OCCUPANCY_SENSING_CUSTOM_LEARN_FINISHED_SUCCSESSFULLY = 3
|
||||
};
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_BITMAP_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_BITMAP_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
/** @internal Number of attributes mandatory for reporting on Occupancy Sensing cluster */
|
||||
#define ZB_ZCL_OCCUPANCY_SENSING_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Occupancy Sensing cluster
|
||||
@param attr_list - attribute list name
|
||||
@param occupancy - pointer to variable to store Occupancy attribute value
|
||||
@param occupancy_sensor_type - pointer to variable to store Occupancy Sensor Type attribute value
|
||||
@param occupancy_sensor_type_bitmap - pointer to variable to store Occupancy Sensor Type Bitmap attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_OCCUPANCY_SENSING_ATTRIB_LIST(attr_list, occupancy, occupancy_sensor_type, occupancy_sensor_type_bitmap) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_OCCUPANCY_SENSING) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_ID, (occupancy)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_ID, (occupancy_sensor_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_OCCUPANCY_SENSING_OCCUPANCY_SENSOR_TYPE_BITMAP_ID, (occupancy_sensor_type_bitmap)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Occupancy Sensing cluster attribute structures */
|
||||
|
||||
/*! @} */ /* ZCL Occupancy Sensing cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_OCCUPANCY_SENSING_SERVER_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
#define ZB_ZCL_CLUSTER_ID_OCCUPANCY_SENSING_CLIENT_ROLE_INIT (zb_zcl_cluster_init_t)NULL
|
||||
|
||||
#endif /* ZB_ZCL_OCCUPANCY_SENSING_H */
|
||||
@@ -0,0 +1,512 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: On/Off cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ON_OFF_H
|
||||
#define ZB_ZCL_ON_OFF_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_ON_OFF
|
||||
* @{
|
||||
* @details
|
||||
* All commands in the cluster have only request form, and carry no payload.
|
||||
*
|
||||
* @par Example
|
||||
* On command sending:
|
||||
* @snippet HA_samples/on_off_output/sample_zed.c onoff_server_send_on_req_param
|
||||
* @snippet HA_samples/on_off_output/sample_zed.c onoff_server_send_on_req_command
|
||||
* @par
|
||||
*
|
||||
* Other two commands can be sent in the same way using appropriate macros.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_ON_OFF */
|
||||
|
||||
/*! @name On/Off cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief On/Off cluster attribute identifiers
|
||||
@see ZCL spec, subclause 3.8.2.2
|
||||
*/
|
||||
enum zb_zcl_on_off_attr_e
|
||||
{
|
||||
/*! @brief OnOff attribute */
|
||||
ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID = 0,
|
||||
/*! Global Scene Control attribute identifier. */
|
||||
ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL = 0x4000,
|
||||
/*! On Time attribute identifier. */
|
||||
ZB_ZCL_ATTR_ON_OFF_ON_TIME = 0x4001,
|
||||
/*! Off Wait Time attribute identifier. */
|
||||
ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME = 0x4002,
|
||||
/*! The StartUpOnOff attribute SHALL define the desired startup behavior of a lamp
|
||||
* device when it is supplied with power and this state SHALL be reflected in the OnOff attribute. */
|
||||
ZB_ZCL_ATTR_ON_OFF_START_UP_ON_OFF = 0x4003,
|
||||
};
|
||||
|
||||
/*! @brief Permissible values for OnOff attribute */
|
||||
enum zb_zcl_on_off_on_off_e
|
||||
{
|
||||
/*! "Off" value */
|
||||
ZB_ZCL_ON_OFF_IS_OFF = 0,
|
||||
/*! "On" value */
|
||||
ZB_ZCL_ON_OFF_IS_ON = 1
|
||||
};
|
||||
|
||||
enum zb_zcl_on_off_start_up_on_off_e
|
||||
{
|
||||
/*! "Off" value */
|
||||
ZB_ZCL_ON_OFF_START_UP_ON_OFF_IS_OFF = 0,
|
||||
/*! "ON" value */
|
||||
ZB_ZCL_ON_OFF_START_UP_ON_OFF_IS_ON = 1,
|
||||
/*! "Toggle" value */
|
||||
ZB_ZCL_ON_OFF_START_UP_ON_OFF_IS_TOGGLE = 2,
|
||||
/*! "Previous" value */
|
||||
ZB_ZCL_ON_OFF_START_UP_ON_OFF_IS_PREVIOUS = 0xFF
|
||||
};
|
||||
|
||||
/** @brief Default value for OnOff cluster revision global attribute */
|
||||
#define ZB_ZCL_ON_OFF_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Default value for OnOff attribute */
|
||||
#define ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE (ZB_ZCL_ON_OFF_IS_OFF)
|
||||
|
||||
/** @brief Default value for GlobalSceneControl attribute */
|
||||
#define ZB_ZCL_ON_OFF_GLOBAL_SCENE_CONTROL_DEFAULT_VALUE ((zb_bool_t)0x01)
|
||||
|
||||
/** @brief Default value for OnTime attribute */
|
||||
#define ZB_ZCL_ON_OFF_ON_TIME_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for OffWaitTime attribute */
|
||||
#define ZB_ZCL_ON_OFF_OFF_WAIT_TIME_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Declare attribute list for On/Off cluster
|
||||
@param attr_list - attribute list name
|
||||
@param on_off - pointer to variable to store On/Off attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(attr_list, on_off) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ON_OFF) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, (on_off)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief Declare attribute list for On/Off cluster (extended attribute set).
|
||||
* @param attr_list [IN] - attribute list name being declared by this macro.
|
||||
* @param on_off [IN] - pointer to a boolean variable storing on/off attribute value.
|
||||
* @param global_scene_ctrl [IN] - pointer to a boolean variable storing global scene control attribute value.
|
||||
* @param on_time [IN] - pointer to a unsigned 16-bit integer variable storing on time attribute value.
|
||||
* @param off_wait_time [IN] - pointer to a unsigned 16-bit integer variable storing off wait time attribute value.
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_EXT( \
|
||||
attr_list, on_off, global_scene_ctrl, on_time, off_wait_time \
|
||||
) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ON_OFF) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, (on_off)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL, (global_scene_ctrl)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_TIME, (on_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME, (off_wait_time)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* On/Off cluster attributes */
|
||||
|
||||
/*! @name On/Off cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief On/Off cluster command identifiers
|
||||
@see ZCL spec, subclause 3.8.2.3
|
||||
*/
|
||||
enum zb_zcl_on_off_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_ID = 0x00, /**< "Turn off" command. */
|
||||
ZB_ZCL_CMD_ON_OFF_ON_ID = 0x01, /**< "Turn on" command. */
|
||||
ZB_ZCL_CMD_ON_OFF_TOGGLE_ID = 0x02, /**< "Toggle state" command. */
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_WITH_EFFECT_ID = 0x40, /**< "Off with effect" command. */
|
||||
ZB_ZCL_CMD_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID = 0x41, /**< "On with recall global scene" command. */
|
||||
ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID = 0x42, /**< "On with timed off" command. */
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/* ON OFF cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_ID, \
|
||||
ZB_ZCL_CMD_ON_OFF_ON_ID, \
|
||||
ZB_ZCL_CMD_ON_OFF_TOGGLE_ID, \
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_WITH_EFFECT_ID, \
|
||||
ZB_ZCL_CMD_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID, \
|
||||
ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/*! @brief General macro for sending On/Off cluster command
|
||||
@param buffer to put data to
|
||||
@param addr - address of the device to send command to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep destination endpoint
|
||||
@param ep - current endpoint
|
||||
@param prof_id - profile identifier
|
||||
@param dis_default_resp - "Disable default response" flag
|
||||
@param command_id - command identifier
|
||||
@param cb - callback to call to report send status
|
||||
*/
|
||||
#define ZB_ZCL_ON_OFF_SEND_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, command_id, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), command_id); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
|
||||
}
|
||||
|
||||
/*! Specific macro for sending Off command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_OFF_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb) \
|
||||
ZB_ZCL_ON_OFF_SEND_REQ( \
|
||||
buffer, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
dis_default_resp, \
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_ID, \
|
||||
cb)
|
||||
|
||||
/*! Specific macro for sending On command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_ON_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb) \
|
||||
ZB_ZCL_ON_OFF_SEND_REQ( \
|
||||
buffer, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
dis_default_resp, \
|
||||
ZB_ZCL_CMD_ON_OFF_ON_ID, \
|
||||
cb)
|
||||
|
||||
/*! Specific macro for sending Toggle command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_TOGGLE_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, dis_default_resp, cb) \
|
||||
ZB_ZCL_ON_OFF_SEND_REQ( \
|
||||
buffer, \
|
||||
addr, \
|
||||
dst_addr_mode, \
|
||||
dst_ep, \
|
||||
ep, \
|
||||
prfl_id, \
|
||||
dis_default_resp, \
|
||||
ZB_ZCL_CMD_ON_OFF_TOGGLE_ID, \
|
||||
cb)
|
||||
|
||||
/*! Specific macro for sending Off with effect command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_OFF_WITH_EFFECT_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, effect_id, effect_var, cb)\
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ON_OFF_OFF_WITH_EFFECT_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, effect_id); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, effect_var); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
|
||||
}
|
||||
|
||||
/*! Specific macro for sending On with recall global scene command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_ON_WITH_RECALL_GLOBAL_SCENE_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, cb) \
|
||||
ZB_ZCL_ON_OFF_SEND_REQ(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, \
|
||||
ZB_ZCL_CMD_ON_OFF_ON_WITH_RECALL_GLOBAL_SCENE_ID, cb)
|
||||
|
||||
/*! Specific macro for sending On with timed off command */
|
||||
#define ZB_ZCL_ON_OFF_SEND_ON_WITH_TIMED_OFF_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp, on_off, on_time, off_wait_time, cb)\
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), ZB_ZCL_CMD_ON_OFF_ON_WITH_TIMED_OFF_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, on_off); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, on_time); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, off_wait_time); \
|
||||
ZB_ZCL_FINISH_PACKET(buffer, ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
|
||||
}
|
||||
|
||||
/** Effect identifier enum
|
||||
* @see ZCL spec 3.8.2.3.4.1 */
|
||||
enum zb_zcl_on_off_effect_e
|
||||
{
|
||||
/**< Effect identifier field value: Delayed all off */
|
||||
ZB_ZCL_ON_OFF_EFFECT_ID_DELAYED_ALL_OFF = 0x00,
|
||||
/**< Effect identifier field value: Dying light */
|
||||
ZB_ZCL_ON_OFF_EFFECT_ID_DYING_LIGHT = 0x01
|
||||
};
|
||||
|
||||
/** Effect variant field for delayed enum
|
||||
* @see ZCL spec 3.8.2.3.4.2 */
|
||||
enum zb_zcl_on_off_effect_variant_delayed_e
|
||||
{
|
||||
/**< Effect variant field value: Fade to off in 0.8 seconds */
|
||||
ZB_ZCL_ON_OFF_EFFECT_VARIANT_FADE = 0x00,
|
||||
/**< Effect variant field value: No fade */
|
||||
ZB_ZCL_ON_OFF_EFFECT_VARIANT_NO_FADE = 0x01,
|
||||
/**< Effect variant field value: 50% dim down in 0.8 seconds then fade to off in 12 seconds */
|
||||
ZB_ZCL_ON_OFF_EFFECT_VARIANT_50PART_FADE = 0x02
|
||||
};
|
||||
|
||||
/** Effect variant field for delayed enum
|
||||
* @see ZCL spec 3.8.2.3.4.2 */
|
||||
enum zb_zcl_on_off_effect_variant_dying_e
|
||||
{
|
||||
/**< Effect variant field value: 20% dim up in 0.5s then fade to off in 1 second */
|
||||
ZB_ZCL_ON_OFF_EFFECT_VARIANT_20PART_FADE = 0x00
|
||||
};
|
||||
|
||||
/** Accept only when on
|
||||
* @see ZCL spec 3.8.2.3.6.1 */
|
||||
#define ZB_ZCL_ON_OFF_ACCEPT_ONLY_WHEN_ON 1
|
||||
|
||||
/*! @brief Structured representation of Off with effect command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_on_off_off_with_effect_req_s
|
||||
{
|
||||
/** Effect identify */
|
||||
zb_uint8_t effect_id;
|
||||
/** Effect variant */
|
||||
zb_uint8_t effect_variant;
|
||||
} ZB_PACKED_STRUCT zb_zcl_on_off_off_with_effect_req_t;
|
||||
|
||||
/*! @brief Structured representation of On with timed off command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_on_off_on_with_timed_off_req_s
|
||||
{
|
||||
/** On/off control */
|
||||
zb_uint8_t on_off;
|
||||
/** On time variable */
|
||||
zb_uint16_t on_time;
|
||||
/** Off wait time variable */
|
||||
zb_uint16_t off_wait_time;
|
||||
} ZB_PACKED_STRUCT zb_zcl_on_off_on_with_timed_off_req_t;
|
||||
|
||||
/** @brief Parses Off with Effect command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_on_off_off_with_effect_req_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_ON_OFF_GET_OFF_WITH_EFFECT_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_on_off_off_with_effect_req_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_on_off_off_with_effect_req_t *src_ptr = \
|
||||
(zb_zcl_on_off_off_with_effect_req_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_MEMCPY((data_ptr), src_ptr, sizeof(zb_zcl_on_off_off_with_effect_req_t)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @brief Parses On with timed off command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_on_off_on_with_timed_off_req_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_ON_OFF_GET_ON_WITH_TIMED_OFF_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_on_off_on_with_timed_off_req_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_on_off_on_with_timed_off_req_t *src_ptr = \
|
||||
(zb_zcl_on_off_on_with_timed_off_req_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->on_off = src_ptr->on_off; \
|
||||
ZB_LETOH16(&((data_ptr)->on_time), &(src_ptr->on_time)); \
|
||||
ZB_LETOH16(&((data_ptr)->off_wait_time), &(src_ptr->off_wait_time)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/** @cond internals_doc */
|
||||
/**
|
||||
* @name Inform User App about On/Off cluster command and change attributes.
|
||||
* Internal structures and define-procedure for inform User App about On/Off
|
||||
* cluster command and change attributes.
|
||||
* @internal
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Declare run Set Effect command for User Application
|
||||
*/
|
||||
typedef struct zb_zcl_on_off_set_effect_value_param_s
|
||||
{
|
||||
zb_uint8_t effect_id; /*!< Effect identify */
|
||||
zb_uint8_t effect_variant; /*!< Effect variant */
|
||||
} zb_zcl_on_off_set_effect_value_param_t;
|
||||
|
||||
/*! Struct for invoke User App & continue after */
|
||||
typedef struct zb_zcl_on_off_effect_user_app_schedule_e
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info; /**< Parameters for continue command,
|
||||
see @ref zb_zcl_parsed_hdr_s */
|
||||
zb_zcl_on_off_set_effect_value_param_t param; /**< User App command parameters,
|
||||
see @ref zb_zcl_on_off_set_effect_value_param_s */
|
||||
} zb_zcl_on_off_effect_user_app_schedule_t;
|
||||
|
||||
#define ZB_ZCL_ON_OFF_EFFECT_SCHEDULE_USER_APP(buffer, pcmd_info, effectId, effectVar) \
|
||||
{ \
|
||||
zb_zcl_on_off_effect_user_app_schedule_t* user_data = \
|
||||
ZB_BUF_GET_PARAM((buffer), zb_zcl_on_off_effect_user_app_schedule_t); \
|
||||
ZB_MEMMOVE(&(user_data->cmd_info), (pcmd_info), sizeof(zb_zcl_parsed_hdr_t)); \
|
||||
user_data->param.effect_id = (effectId); \
|
||||
user_data->param.effect_variant = (effectVar); \
|
||||
ZB_SCHEDULE_CALLBACK(zb_zcl_on_off_effect_invoke_user_app, (buffer)); \
|
||||
}
|
||||
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/*! @} */ /* On/Off cluster commands */
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name On/Off cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING | ZB_ZCL_ATTR_ACCESS_SCENE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL, \
|
||||
ZB_ZCL_ATTR_TYPE_BOOL, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_ON_TIME(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_ON_TIME, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @struct zb_zcl_on_off_attrs_s
|
||||
* @brief On/Off cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_on_off_attrs_s
|
||||
{
|
||||
zb_uint8_t on_off;
|
||||
} zb_zcl_on_off_attrs_t;
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_START_UP_ON_OFF(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_START_UP_ON_OFF, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_ZCL_DECLARE_ON_OFF_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(attr_list, &attrs.on_off)
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in On/Off cluster */
|
||||
#define ZB_ZCL_ON_OFF_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @internal Struct for invoke User App & continue after */
|
||||
typedef struct zb_on_off_user_app_schedule_e
|
||||
{
|
||||
zb_zcl_parsed_hdr_t cmd_info;
|
||||
zb_uint8_t new_value;
|
||||
zb_bool_t is_run_timer;
|
||||
} zb_on_off_user_app_schedule_t;
|
||||
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* On/Off cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL On/Off cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_on_off_init_server(void);
|
||||
void zb_zcl_on_off_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SERVER_ROLE_INIT zb_zcl_on_off_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_CLIENT_ROLE_INIT zb_zcl_on_off_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ON_OFF_H */
|
||||
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: On/Off switch configuration definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_ON_OFF_SWITCH_CONF_H
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONF_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_OOSC
|
||||
* @{
|
||||
* @details
|
||||
* On/Off Switch Configuration cluster has no cluster-specific command support. Cluster
|
||||
* attributes can be queried with @ref ZB_ZCL_COMMANDS "common commands".
|
||||
*
|
||||
* Sample switch config cluster attributes data
|
||||
* @code
|
||||
* zb_uint8_t attr_switch_type = ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_TOGGLE;
|
||||
* zb_uint8_t attr_switch_actions = ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_DEFAULT_VALUE;
|
||||
*
|
||||
* ZB_ZCL_DECLARE_ON_OFF_SWITCH_CONFIGURATION_ATTRIB_LIST(switch_cfg_attr_list, &attr_switch_type, &attr_switch_actions);
|
||||
* @endcode
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*! @name On/off switch configuration cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief On/off switch configuration cluster attribute identifiers
|
||||
@see ZCL spec, subclause 3.9.2.2
|
||||
*/
|
||||
enum zb_zcl_on_off_switch_configuration_attr_e
|
||||
{
|
||||
/*! Switch type attribute identifier (switch information) */
|
||||
ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_ID = 0x0000,
|
||||
/*! Switch actions attribute identifier (switch settings) */
|
||||
ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_ID = 0x0010
|
||||
};
|
||||
|
||||
/*! @brief Permissible values for switch type attribute
|
||||
@see ZCL spec, subclause 3.9.2.2.2
|
||||
*/
|
||||
enum zb_zcl_on_off_switch_configuration_switch_type_e
|
||||
{
|
||||
/*! Toggle switch */
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_TOGGLE = 0,
|
||||
/*! Momentary switch */
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_MOMENTARY = 1,
|
||||
/*! Multifunction switch */
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_MULTIFUNCTION = 2
|
||||
};
|
||||
|
||||
/** @brief Default value for On/off switch configuration cluster revision global attribute */
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/*! @brief Maximal value for switch type attribute */
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_MAX_VALUE \
|
||||
(ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_MULTIFUNCTION)
|
||||
|
||||
/* Switch type attribute has no default value */
|
||||
|
||||
/*! @brief Permissible values for switch actions attribute
|
||||
@see ZCL spec, subclause 3.9.2.2.3.1
|
||||
*/
|
||||
enum zb_zcl_on_off_switch_configuration_switch_actions_e
|
||||
{
|
||||
/*! @brief First type command pattern
|
||||
|
||||
@li Send "On" on arriving to State2 from State1;
|
||||
@li Send "Off" on arriving to State1 from State2.
|
||||
*/
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_TYPE1 = 0,
|
||||
/*! @brief Second type command pattern
|
||||
|
||||
@li Send "On" on arriving to State1 from State2;
|
||||
@li Send "Off" on arriving to State2 from State1.
|
||||
*/
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_TYPE2 = 1,
|
||||
/*! @brief Toggle command pattern
|
||||
|
||||
Send "Toggle" on state change
|
||||
*/
|
||||
ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_TOGGLE = 2
|
||||
};
|
||||
|
||||
/*! @brief Maximal value for switch actions attribute */
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_MAX_VALUE \
|
||||
(ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_TOGGLE)
|
||||
|
||||
/** @brief Default value for Switch actions attribute */
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_DEFAULT_VALUE \
|
||||
(ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_TYPE1)
|
||||
|
||||
/*! @} */ /* On/off switch configuration cluster attributes */
|
||||
|
||||
/** @cond internals_doc
|
||||
@internal @name On/off switch configuration cluster attribute structures
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @internal Number of attributes mandatory for reporting on On/Off switch configuration cluster */
|
||||
#define ZB_ZCL_ON_OFF_SWITCH_CONFIG_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for ON/OFF Switch configuration cluster
|
||||
@param attr_list - attribute list name
|
||||
@param switch_type - pointer to variable to store switch type attribute value
|
||||
@param switch_actions - pointer to variable to store switch action attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_ON_OFF_SWITCH_CONFIGURATION_ATTRIB_LIST(attr_list, switch_type, switch_actions) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_ON_OFF_SWITCH_CONFIGURATION) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_TYPE_ID, (switch_type)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_SWITCH_CONFIGURATION_SWITCH_ACTIONS_ID, (switch_actions)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_on_off_switch_config_init_server(void);
|
||||
void zb_zcl_on_off_switch_config_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG_SERVER_ROLE_INIT zb_zcl_on_off_switch_config_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG_CLIENT_ROLE_INIT zb_zcl_on_off_switch_config_init_client
|
||||
|
||||
#endif /* ZB_ZCL_ON_OFF_SWITCH_CONF_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: PM2.5 Measurement cluster definitions */
|
||||
|
||||
#ifndef ZB_ZCL_PM2_5_MEASUREMENT_H
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_CONCENTRATION_MEASUREMENT
|
||||
* @{
|
||||
* @details
|
||||
* The server cluster provides an interface to concentration measurement
|
||||
* functionality. The measurement is reportable and may be configured for
|
||||
* reporting. Concentration measurements include, but are not limited to,
|
||||
* levels in gases, such as CO, CO2, and ethylene, or in fluids and
|
||||
* solids, such as dissolved oxygen, chemi8721 cals & pesticides.
|
||||
*
|
||||
* PM2.5 (Particulate Matter 2.5 microns or less)
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT */
|
||||
|
||||
/** @name PM2.5 Measurement cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief PM2.5 Measurement cluster attribute identifiers
|
||||
* @see ZCL spec, PM2.5 Measurement Cluster 4.14.1.4
|
||||
*/
|
||||
enum zb_zcl_pm2_5_measurement_attr_e
|
||||
{
|
||||
/** @brief MeasuredValue attribute, ZCL spec 4.13.2.1.1 */
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID = 0x0000,
|
||||
/** @brief MinMeasuredValue attribute, ZCL spec 4.13.2.1.2 */
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID = 0x0001,
|
||||
/** @brief MaxMeasuredValue attribute, ZCL spec 4.13.2.1.3 */
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID = 0x0002,
|
||||
/** @brief Tolerance attribute, ZCL spec 4.13.2.1.4 */
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID = 0x0003,
|
||||
};
|
||||
|
||||
/** @brief Default value for PM2.5 Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for MeasuredValue attribute */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
/** @brief Default value for MinMeasuredValue attribute */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
/** @brief Default value for MaxMeasuredValue attribute */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_DEFAULT_VALUE (.0/.0)
|
||||
|
||||
|
||||
/** @brief MeasuredValue attribute unknown */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MEASURED_VALUE_UNKNOWN (.0/.0)
|
||||
|
||||
/** @brief MinMeasuredValue attribute undefined */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_UNDEFINED (.0/.0)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute undefined */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_UNDEFINED (.0/.0)
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_MIN_VALUE 0.0
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_MAX_VALUE 1.0
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name PM2.5 Measurement cluster internals
|
||||
* Internal structures for PM2.5 Measurement cluster
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_SINGLE, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in PM2.5 Measurement cluster */
|
||||
#define ZB_ZCL_PM2_5_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* PM2.5 Measurement cluster internals */
|
||||
|
||||
/** @brief Declare attribute list for PM2.5 Measurement cluster
|
||||
* @param attr_list - attribute list name
|
||||
* @param measured_value - pointer to variable storing MeasuredValue attribute value
|
||||
* @param min_measured_value - pointer to variable storing MinMeasuredValue attribute value
|
||||
* @param max_measured_value - pointer to variable storing MaxMeasuredValue attribute value
|
||||
* @param tolerance - pointer to variable storing Tolerance attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_PM2_5_MEASUREMENT_ATTRIB_LIST( \
|
||||
attr_list, \
|
||||
measured_value, \
|
||||
min_measured_value, \
|
||||
max_measured_value, \
|
||||
tolerance) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_PM2_5_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID, (measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID, (min_measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID, (max_measured_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID, (tolerance)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/**
|
||||
* @brief PM2.5 Measurement cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_pm2_5_measurement_attrs_s
|
||||
{
|
||||
/** @copydoc ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MIN_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t min_measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID
|
||||
* @see ZB_ZCL_ATTR_PM2_5_MEASUREMENT_MAX_MEASURED_VALUE_ID
|
||||
*/
|
||||
zb_single_t max_measured_value;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID
|
||||
* @see ZB_ZCL_ATTR_PM2_5_MEASUREMENT_TOLERANCE_ID
|
||||
*/
|
||||
zb_single_t tolerance;
|
||||
} zb_zcl_pm2_5_measurement_attrs_t;
|
||||
|
||||
/** @brief Declare attribute list for PM2.5 Measurement cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_pm2_5_measurement_attrs_t type
|
||||
* (containing PM2.5 Measurement cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_PM2_5_MEASUREMENT_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_PM2_5_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
&attrs.measured_value, \
|
||||
&attrs.min_measured_value, \
|
||||
&attrs.max_measured_value, \
|
||||
&attrs.tolerance)
|
||||
|
||||
|
||||
/** @} */ /* end of ZB_ZCL_PM2_5_MEASUREMENT_ATTRS_GROUP group */
|
||||
|
||||
/** @} */ /* ZCL PM2.5 Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_pm2_5_measurement_init_server(void);
|
||||
void zb_zcl_pm2_5_measurement_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_pm2_5_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_pm2_5_measurement_init_client
|
||||
|
||||
#endif /* ZB_ZCL_PM2_5_MEASUREMENT_H */
|
||||
@@ -0,0 +1,698 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Poll Control cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_POLL_CONTROL_H
|
||||
#define ZB_ZCL_POLL_CONTROL_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_POLL_CONTROL
|
||||
* @{
|
||||
* @details
|
||||
* All commands in the cluster have only request form, and carry no payload.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined ZB_HA_ENABLE_POLL_CONTROL_SERVER || defined DOXYGEN
|
||||
|
||||
/*! @brief Schedule poll control process on given endpoint
|
||||
* First check-in will occur after one check-in interval
|
||||
* Poll Control process also starts automatically during ZCL periodic activities
|
||||
* initialization if Poll Control server cluster is declared
|
||||
* @param param - buffer for check-in command
|
||||
* @param endpoint - endpoint to start poll control process on */
|
||||
void zb_zcl_poll_control_start(zb_uint8_t param, zb_uint8_t endpoint);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Stop Poll control processing
|
||||
*
|
||||
* Checking already scheduled will be canceled
|
||||
* @return reference to buffer which was previously reserved for check-in.
|
||||
* It must be reused or explicitly freed.
|
||||
*/
|
||||
zb_uint8_t zb_zcl_poll_control_stop(void);
|
||||
|
||||
|
||||
/*! @brief Start Poll Control process on Server side
|
||||
* @param param - buffer for Poll Process
|
||||
*/
|
||||
void zb_zcl_poll_control_start_check_in(zb_uint8_t param);
|
||||
|
||||
/**
|
||||
@brief Register callback for Poll control cluster.
|
||||
|
||||
This callback will be called when check-in command is sent.
|
||||
|
||||
@param cb - pointer to callback
|
||||
*/
|
||||
void zb_zcl_poll_controll_register_cb(zb_callback_t cb);
|
||||
|
||||
|
||||
#endif /* defined ZB_HA_ENABLE_POLL_CONTROL_SERVER || defined DOXYGEN */
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_POLL_CONTROL */
|
||||
|
||||
/**
|
||||
* @name Poll Control cluster attribute identifiers
|
||||
* @anchor zcl_poll_control_attr
|
||||
* @see HA spec, Poll Control Cluster 9.5.4.1
|
||||
*
|
||||
* Note: These values were members of `enum zb_zcl_poll_control_attr_e` type but were converted to a
|
||||
* set of macros due to MISRA violations.
|
||||
*/
|
||||
/** @{ */
|
||||
/** Check-in Interval attribute, HA spec 9.5.4.1.1 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_CHECKIN_INTERVAL_ID 0x0000U
|
||||
/** Long Poll Interval attribute, HA spec 9.5.4.1.2 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_INTERVAL_ID 0x0001U
|
||||
/** Short Poll Interval attribute, HA spec 9.5.4.1.3 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_SHORT_POLL_INTERVAL_ID 0x0002U
|
||||
/** Fast Poll Timeout attribute, HA spec 9.5.4.1. */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_TIMEOUT_ID 0x0003U
|
||||
/** Check-in Interval Min attribute, HA spec 9.5.4.1.4 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_MIN_CHECKIN_INTERVAL_ID 0x0004U
|
||||
/** Long Poll Interval Min attribute, HA spec 9.5.4.1.5 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_MIN_INTERVAL_ID 0x0005U
|
||||
/** Fast Poll Timeout Max attribute, HA spec 9.5.4.1.6 */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_MAX_TIMEOUT_ID 0x0006U
|
||||
|
||||
/** Status Data - custom non-spec parameters */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_STATUS_DATA_ID 0xefffU
|
||||
/** Status Data - custom non-spec parameters for server side */
|
||||
#define ZB_ZCL_ATTR_POLL_CONTROL_ADDR_DATA_ID 0xeffeU
|
||||
/** @} */
|
||||
|
||||
/** @name Poll Control cluster attributes */
|
||||
/** @{ */
|
||||
|
||||
/** @brief Default value for Poll Control cluster revision global attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/** @brief Value for stop Check-in process for Check-in Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_CHECKIN_INTERVAL_NO_CHECK_IN_VALUE 0x0000
|
||||
|
||||
/** @brief Default value for Check-in Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_CHECKIN_INTERVAL_DEFAULT_VALUE 0x3840
|
||||
|
||||
/** @brief Maximum value for Check-in Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_CHECKIN_INTERVAL_MAX_VALUE 0x6e0000
|
||||
|
||||
/** @brief Minimum value for Long Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_LONG_POLL_INTERVAL_MIN_VALUE ZB_PIM_MINIMUM_LONG_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Default value for Long Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_LONG_POLL_INTERVAL_DEFAULT_VALUE ZB_PIM_DEFAULT_LONG_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Maximum value for Long Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_LONG_POLL_INTERVAL_MAX_VALUE ZB_PIM_MAXIMUM_LONG_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Minimum value for Short Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_SHORT_POLL_INTERVAL_MIN_VALUE ZB_PIM_MINIMUM_SHORT_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Default value for Short Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_SHORT_POLL_INTERVAL_DEFAULT_VALUE ZB_PIM_DEFAULT_SHORT_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Maximum value for Short Poll Interval attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_SHORT_POLL_INTERVAL_MAX_VALUE ZB_PIM_MAXIMUM_SHORT_POLL_INTERVAL_IN_QS
|
||||
|
||||
/** @brief Minimum value for Fast Poll Timeout attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_MIN_VALUE 0x01
|
||||
|
||||
/** @brief Default value for Fast Poll Timeout attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_DEFAULT_VALUE 0x0028
|
||||
|
||||
/** @brief Maximum value for Fast Poll Timeout attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_MAX_VALUE 0xffff
|
||||
|
||||
/** @brief Default value for CheckinIntervalMin attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_CHECKIN_MIN_INTERVAL_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for LongPollIntervalMin attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_LONG_POLL_MIN_INTERVAL_DEFAULT_VALUE ((zb_uint32_t)0)
|
||||
|
||||
/** @brief Default value for FastPollTimeoutMax attribute */
|
||||
#define ZB_ZCL_POLL_CONTROL_FAST_POLL_MAX_TIMEOUT_DEFAULT_VALUE ((zb_uint16_t)0)
|
||||
/** @} */
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/** @name Poll Control cluster internals
|
||||
* Internal structures for attribute representation in cluster definitions. */
|
||||
/** @{ */
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_CHECKIN_INTERVAL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_CHECKIN_INTERVAL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_INTERVAL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_INTERVAL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_SHORT_POLL_INTERVAL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_SHORT_POLL_INTERVAL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_TIMEOUT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_TIMEOUT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_MIN_CHECKIN_INTERVAL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_MIN_CHECKIN_INTERVAL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_MIN_INTERVAL_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_MIN_INTERVAL_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_MAX_TIMEOUT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_MAX_TIMEOUT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_STATUS_DATA_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_STATUS_DATA_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_NULL, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POLL_CONTROL_ADDR_DATA_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POLL_CONTROL_ADDR_DATA_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_NULL, \
|
||||
ZB_ZCL_ATTR_ACCESS_INTERNAL, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
/*! @brief Structure representation of Client Status attributes */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_poll_control_client_status_s
|
||||
{
|
||||
/** Client is In Poll Mode */
|
||||
zb_bool_t is_poll_mode;
|
||||
/** Client Fast Poll timeout*/
|
||||
zb_uint16_t fast_poll_timeout;
|
||||
|
||||
} ZB_PACKED_STRUCT zb_zcl_poll_control_client_status_t;
|
||||
|
||||
|
||||
#define ZB_ZCL_POLL_CTRL_INVALID_ADDR 0xFFFF
|
||||
#define ZB_ZCL_POLL_INVALID_EP 0xFF
|
||||
/*! @brief Address information that is used for sending check-in command */
|
||||
/* Currently not only address info is stored - also status information */
|
||||
typedef struct zb_zcl_poll_control_srv_cfg_data_s
|
||||
{
|
||||
/** Short address of the Poll control client */
|
||||
zb_uint16_t poll_addr;
|
||||
/** Endpoint number of the Poll control client */
|
||||
zb_uint8_t poll_ep;
|
||||
/** Flag to check if check-in command is being sent currently */
|
||||
zb_bitfield_t sending_cmd:4;
|
||||
/** Flag to determine fast poll mode / long poll mode */
|
||||
zb_bitfield_t fast_poll_mode:1;
|
||||
}
|
||||
zb_zcl_poll_control_srv_cfg_data_t;
|
||||
|
||||
/** @brief Default value for Fast Poll Timeout for Client command */
|
||||
#define ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_CLIENT_DEFAULT_VALUE 0x00f0
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Poll Control cluster */
|
||||
#define ZB_ZCL_POLL_CONTROL_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @} */
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */ /* Poll Control cluster internals */
|
||||
|
||||
/** @name Poll Control cluster attributes */
|
||||
/** @{ */
|
||||
|
||||
/** @brief Declare attribute list for Poll Control cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param checkin_interval - pointer to variable to store Check-in Interval attribute
|
||||
@param long_poll_interval - pointer to variable to store Long Poll Interval attribute
|
||||
@param short_poll_interval - pointer to variable to store Short Poll Interval attribute
|
||||
@param fast_poll_timeout - pointer to variable to store Fast Poll Timeout attribute
|
||||
@param checkin_interval_min - pointer to variable to store Check-in Interval Min attribute
|
||||
@param long_poll_interval_min- pointer to variable to store Long Poll Interval Min attribute
|
||||
@param fast_poll_timeout_max - pointer to variable to store Fast Poll Timeout Max attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_POLL_CONTROL_ATTRIB_LIST(attr_list, \
|
||||
checkin_interval, long_poll_interval, short_poll_interval, fast_poll_timeout, \
|
||||
checkin_interval_min, long_poll_interval_min, fast_poll_timeout_max) \
|
||||
zb_zcl_poll_control_srv_cfg_data_t srv_cfg_data_ctx_##attr_list = \
|
||||
{ ZB_ZCL_POLL_CTRL_INVALID_ADDR, ZB_ZCL_POLL_INVALID_EP, 0, 0 }; \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_POLL_CONTROL) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_CHECKIN_INTERVAL_ID, (checkin_interval)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_INTERVAL_ID, (long_poll_interval)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_SHORT_POLL_INTERVAL_ID, (short_poll_interval)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_TIMEOUT_ID, (fast_poll_timeout)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_MIN_CHECKIN_INTERVAL_ID, (checkin_interval_min)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_LONG_POLL_MIN_INTERVAL_ID, (long_poll_interval_min)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_FAST_POLL_MAX_TIMEOUT_ID, (fast_poll_timeout_max)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_ADDR_DATA_ID, &(srv_cfg_data_ctx_##attr_list)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @brief Declare attribute list for Poll Control cluster - client side
|
||||
@param attr_list - attribute list name
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_POLL_CONTROL_ATTRIB_LIST_CLIENT(attr_list) \
|
||||
zb_zcl_poll_control_client_status_t client_status_data_ctx_##attr_list = \
|
||||
{ ZB_FALSE, ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_CLIENT_DEFAULT_VALUE }; \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_POLL_CONTROL) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POLL_CONTROL_STATUS_DATA_ID, \
|
||||
(&(client_status_data_ctx_##attr_list))) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* Poll Control cluster attributes */
|
||||
|
||||
/** @name Poll Control cluster commands */
|
||||
/** @{ */
|
||||
|
||||
/*! @brief Poll Control cluster command identifiers
|
||||
@see HA spec, Poll Control Cluster, 9.5.4.3
|
||||
*/
|
||||
enum zb_zcl_poll_control_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_ID = 0x00 /**< "Check-in" command. HA spec 9.5.4.4 */
|
||||
};
|
||||
|
||||
/*! @brief Poll Control cluster response command identifiers
|
||||
@see HA spec, Poll Control Cluster, 9.5.5.2
|
||||
*/
|
||||
enum zb_zcl_poll_control_resp_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_RESPONSE_ID = 0x00, /**< "Check-in response" command, HA spec 9.5.5.3 */
|
||||
ZB_ZCL_CMD_POLL_CONTROL_FAST_POLL_STOP_ID = 0x01, /**< "Fast Poll Stop" command, HA spec 9.5.5.4 */
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_LONG_POLL_INTERVAL_ID = 0x02, /**< "Set Long Poll Interval" command, HA spec 9.5.5.5 */
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_SHORT_POLL_INTERVAL_ID = 0x03, /**< "Set Short Poll Interval" command, HA spec 9.5.5.6 */
|
||||
};
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
/* Poll control cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_POLL_CONTROL_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_CLIENT_ROLE_GENERATED_CMD_LIST \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_RESPONSE_ID, \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_FAST_POLL_STOP_ID, \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_LONG_POLL_INTERVAL_ID, \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_SHORT_POLL_INTERVAL_ID
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_POLL_CONTROL_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/******************************* Check-in ******************************/
|
||||
|
||||
/*! @brief Send Check-in command, see HA spec 9.5.4.4
|
||||
@param _buffer - to put packet to
|
||||
@param _dst_addr - destination address
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _local_ep - source endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _cb - callback for getting command send status
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_SEND_CHECK_IN_REQ( \
|
||||
_buffer, _dst_addr, _dst_addr_mode, _dst_ep, _local_ep, _prfl_id, _cb) \
|
||||
{ \
|
||||
zb_uint8_t* _ptr = ZB_ZCL_START_PACKET(_buffer); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RES_FRAME_CONTROL(_ptr); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER(_ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_ID); \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), _ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
_buffer, _dst_addr, _dst_addr_mode, _dst_ep, _local_ep, _prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_POLL_CONTROL, _cb); \
|
||||
}
|
||||
|
||||
/*! @brief Parameters to pass to device callback for incoming check in */
|
||||
typedef struct zb_zcl_poll_control_check_in_cli_param_s
|
||||
{
|
||||
zb_uint16_t fast_poll_timeout;
|
||||
zb_uint16_t short_addr;
|
||||
zb_uint8_t ep;
|
||||
}
|
||||
zb_zcl_poll_control_check_in_cli_param_t;
|
||||
|
||||
/** @cond DOXYGEN_INTERNAL_DOC */
|
||||
#define ZB_ZCL_POLL_CONTROL_CLI_CALL_USER_APP( \
|
||||
_buffer, _short_addr, _ep, _fast_poll_timeout, _result) \
|
||||
{ \
|
||||
TRACE_MSG(TRACE_ZCL1, "ZB_ZCL_POLL_CONTROL_CLI_CALL_USER_APP", (FMT__0)); \
|
||||
if (ZCL_CTX().device_cb) \
|
||||
{ \
|
||||
zb_zcl_device_callback_param_t *user_app_data = \
|
||||
ZB_BUF_GET_PARAM((_buffer), zb_zcl_device_callback_param_t); \
|
||||
zb_zcl_poll_control_check_in_cli_param_t *value = \
|
||||
&(user_app_data->cb_param.checkin_cli_param); \
|
||||
value->fast_poll_timeout = (_fast_poll_timeout); \
|
||||
value->short_addr = (_short_addr); \
|
||||
value->ep = (_ep); \
|
||||
user_app_data->device_cb_id = ZB_ZCL_POLL_CONTROL_CHECK_IN_CLI_CB_ID; \
|
||||
user_app_data->endpoint = (_ep); \
|
||||
user_app_data->status = RET_OK; \
|
||||
(ZCL_CTX().device_cb)(param); \
|
||||
_result = user_app_data->status; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
_result = RET_OK; \
|
||||
} \
|
||||
}
|
||||
/** @endcond */ /* DOXYGEN_INTERNAL_DOC */
|
||||
|
||||
/******************************* Check-in response ******************************/
|
||||
|
||||
/*! @brief Structure representation of Check-in response command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_poll_control_check_in_res_s
|
||||
{
|
||||
/** Start Fast Polling */
|
||||
zb_uint8_t is_start;
|
||||
/** Fast Poll Timeout */
|
||||
zb_uint16_t timeout;
|
||||
} ZB_PACKED_STRUCT zb_zcl_poll_control_check_in_res_t;
|
||||
|
||||
/*! @brief Send "Check-in response" command, see HA spec 9.5.5.3
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
@param is_start - Start Fast Polling
|
||||
@param timeout - Fast Poll Timeout
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_SEND_CHECK_IN_RES( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, \
|
||||
is_start, timeout) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_CHECK_IN_RESPONSE_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(ptr, (is_start)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (timeout)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_POLL_CONTROL, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Check-in response command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_poll_control_check_in_res_s.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_GET_CHECK_IN_RES(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_poll_control_check_in_res_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_poll_control_check_in_res_t *src_ptr = \
|
||||
(zb_zcl_poll_control_check_in_res_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(data_ptr)->is_start = src_ptr->is_start; \
|
||||
ZB_HTOLE16(&((data_ptr)->timeout), &(src_ptr->timeout)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Fast Poll Stop ******************************/
|
||||
|
||||
/*! @brief Send "Fast Poll Stop" command, see HA spec 9.5.5.4
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_SEND_FAST_POLL_STOP_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_FAST_POLL_STOP_ID); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_POLL_CONTROL, cb); \
|
||||
}
|
||||
|
||||
/******************************* Set Long Poll Interval ******************************/
|
||||
|
||||
/*! @brief Structure representation of Set Long Poll Interval command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_poll_control_set_long_poll_interval_req_s
|
||||
{
|
||||
/** New Long Poll Interval */
|
||||
zb_uint32_t interval;
|
||||
} ZB_PACKED_STRUCT zb_zcl_poll_control_set_long_poll_interval_t;
|
||||
|
||||
|
||||
/*! @brief Send "Set Long Poll Interval" command, see HA spec 9.5.5.5
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
@param interval - New Long Poll Interval
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_SEND_SET_LONG_POLL_INTERVAL_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, interval) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_LONG_POLL_INTERVAL_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA32_VAL(ptr, (interval)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_POLL_CONTROL, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting "Set Long Poll Interval" command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_poll_control_set_long_poll_interval_t.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_GET_SET_LONG_POLL_INTERVAL_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_poll_control_set_long_poll_interval_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_poll_control_set_long_poll_interval_t *src_ptr = \
|
||||
(zb_zcl_poll_control_set_long_poll_interval_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE32(&((data_ptr)->interval), &(src_ptr->interval)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/******************************* Set Short Poll Interval ******************************/
|
||||
|
||||
/*! @brief Structure representation of Set Short Poll Interval command payload */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_poll_control_set_short_poll_interval_req_s
|
||||
{
|
||||
/** New Short Poll Interval */
|
||||
zb_uint16_t interval;
|
||||
} ZB_PACKED_STRUCT zb_zcl_poll_control_set_short_poll_interval_t;
|
||||
|
||||
|
||||
/*! @brief Send "Set Short Poll Interval" command, see HA spec 9.5.5.6
|
||||
@param buffer to put packet to
|
||||
@param addr - address to send packet to
|
||||
@param dst_addr_mode - addressing mode
|
||||
@param dst_ep - destination endpoint
|
||||
@param ep - sending endpoint
|
||||
@param prfl_id - profile identifier
|
||||
@param def_resp - enable/disable default response
|
||||
@param cb - callback
|
||||
@param interval - New Short Poll Interval
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_SEND_SET_SHORT_POLL_INTERVAL_REQ( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, def_resp, cb, interval) \
|
||||
{ \
|
||||
zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer) \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, (def_resp)) \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_CMD_POLL_CONTROL_SET_SHORT_POLL_INTERVAL_ID); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(ptr, (interval)); \
|
||||
ZB_ZCL_FINISH_PACKET((buffer), ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
buffer, addr, dst_addr_mode, dst_ep, ep, prfl_id, \
|
||||
ZB_ZCL_CLUSTER_ID_POLL_CONTROL, cb); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting "Set Short Poll Interval" command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_poll_control_set_short_poll_interval_t.
|
||||
* @param buffer containing the packet (by pointer).
|
||||
* @param status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_POLL_CONTROL_GET_SET_SHORT_POLL_INTERVAL_REQ(data_ptr, buffer, status) \
|
||||
{ \
|
||||
if (zb_buf_len((buffer)) < sizeof(zb_zcl_poll_control_set_short_poll_interval_t)) \
|
||||
{ \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
zb_zcl_poll_control_set_short_poll_interval_t *src_ptr = \
|
||||
(zb_zcl_poll_control_set_short_poll_interval_t*)zb_buf_begin((buffer)); \
|
||||
(status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
ZB_HTOLE16(&((data_ptr)->interval), &(src_ptr->interval)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined ZB_HA_ENABLE_POLL_CONTROL_SERVER || defined DOXYGEN
|
||||
|
||||
/**
|
||||
* @brief Set client address information. This address is used to
|
||||
* send Check-in command. If address information is NOT sent,
|
||||
* check-in command will be sent assuming binding with client is
|
||||
* created
|
||||
* @param local_ep - local endpoint number, is used to find particular attribute
|
||||
* @param addr - poll control client short address
|
||||
* @param ep - poll control client end point
|
||||
* @return RET_ERROR if addr is not a TC (WWAH requirement).
|
||||
* RET_OK otherwise.
|
||||
*/
|
||||
zb_ret_t zb_zcl_poll_control_set_client_addr(zb_uint8_t local_ep, zb_uint16_t addr, zb_uint8_t ep);
|
||||
#endif
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL || defined DOXYGEN
|
||||
/**
|
||||
@brief Function is used by Poll control client to set Fast poll
|
||||
timeout value. This value is included into Check-in response
|
||||
command
|
||||
@param ep - local endpoint number, running Poll control client
|
||||
@param fast_poll_timeout - Fast poll timeout value (in quarterseconds)
|
||||
*/
|
||||
void zb_zcl_set_fast_poll_timeout(zb_uint8_t ep, zb_uint16_t fast_poll_timeout);
|
||||
|
||||
#if defined ZB_USE_NVRAM || defined DOXYGEN
|
||||
/**
|
||||
@brief Save to NVRAM Poll Control dataset
|
||||
@param param
|
||||
@note ignore param, set it to 0
|
||||
*/
|
||||
void zb_zcl_poll_control_save_nvram(zb_uint8_t param);
|
||||
#endif /* ZB_USE_NVRAM */
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL */
|
||||
|
||||
/*! @} */ /* Poll Control cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Poll Control cluster definitions */
|
||||
|
||||
#if defined ZB_ENABLE_HA
|
||||
|
||||
zb_uint8_t zb_zcl_get_cmd_list_poll_control(zb_bool_t is_client_generated, zb_uint8_t **cmd_list);
|
||||
|
||||
#endif /* defined ZB_ENABLE_HA */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL
|
||||
void zb_zcl_poll_control_init_server(void);
|
||||
void zb_zcl_poll_control_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_SERVER_ROLE_INIT zb_zcl_poll_control_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_POLL_CONTROL_CLIENT_ROLE_INIT zb_zcl_poll_control_init_client
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_POLL_CONTROL */
|
||||
|
||||
#endif /* ZB_ZCL_POLL_CONTROL_H */
|
||||
@@ -0,0 +1,757 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Power Configuration cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_POWER_CONFIG_H
|
||||
#define ZB_ZCL_POWER_CONFIG_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_POWER_CONFIG
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Hook on Write attribute
|
||||
* @param endpoint - endpoint number
|
||||
* @param attr_id - ID of attribute being written
|
||||
* @param new_value - pointer to new value of attribute
|
||||
*/
|
||||
void zb_zcl_power_config_write_attr_hook(zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value);
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_POWER_CONFIG */
|
||||
|
||||
/*! @name Power Configuration cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Power Configuration cluster attribute identifiers
|
||||
@see ZCL spec, Power Configuration Cluster 3.3.2.2
|
||||
*/
|
||||
enum zb_zcl_power_config_attr_e
|
||||
{
|
||||
/** @brief MainsVoltage attribute, ZCL spec 3.3.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_ID = 0x0000,
|
||||
/** @brief MainsFrequency attribute, ZCL spec 3.3.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_FREQUENCY_ID = 0x0001,
|
||||
/** @brief MainsAlarmMask attribute, ZCL spec 3.3.2.2.2.1 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_ALARM_MASK_ID = 0x0010,
|
||||
/** @brief MainsVoltageMinThreshold attribute, ZCL spec 3.3.2.2.2.2 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD = 0x0011,
|
||||
/** @brief MainsVoltageMaxThreshold attribute, ZCL spec 3.3.2.2.2.3 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD = 0x0012,
|
||||
/** @brief MainsVoltageDwellTripPoint attribute, ZCL spec 3.3.2.2.2.4 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_DWELL_TRIP_POINT = 0x0013,
|
||||
|
||||
/** @brief BatteryVoltage attribute, ZCL spec 3.3.2.2.3.1 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID = 0x0020,
|
||||
/*! @brief BatteryPercentageRemaining attribute, ZCL spec 3.3.2.2.3.2 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID = 0x0021,
|
||||
|
||||
/** The BatteryManufacturer attribute is a maximum of 16 bytes in length
|
||||
* and specifies the name of the battery manufacturer as a character string. */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_MANUFACTURER_ID = 0x0030,
|
||||
/** @brief BatterySize attribute, ZCL spec 3.3.2.2.4.2 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_SIZE_ID = 0x0031,
|
||||
/** The BatteryAHrRating attribute is 16 bits in length and specifies
|
||||
* the Ampere-hour rating of the battery, measured in units of 10mAHr. */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_A_HR_RATING_ID = 0x0032,
|
||||
/** @brief BatteryQuantity attribute, ZCL spec 3.3.2.2.4.4 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_QUANTITY_ID = 0x0033,
|
||||
/** @brief BatteryRatedVoltage attribute, ZCL spec 3.3.2.2.4.5 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_RATED_VOLTAGE_ID = 0x0034,
|
||||
/** @brief BatteryAlarmMask attribute, ZCL spec 3.3.2.2.4.6 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_MASK_ID = 0x0035,
|
||||
/** @brief BatteryVoltageMinThreshold attribute, ZCL spec 3.3.2.2.4.7 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_MIN_THRESHOLD_ID = 0x0036,
|
||||
/*! @brief BatteryVoltageThreshold1 attribute, ZCL spec 3.3.2.2.4.8 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD1_ID = 0x0037,
|
||||
/*! @brief BatteryVoltageThreshold2 attribute, ZCL spec 3.3.2.2.4.8 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD2_ID = 0x0038,
|
||||
/*! @brief BatteryVoltageThreshold3 attribute, ZCL spec 3.3.2.2.4.8 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD3_ID = 0x0039,
|
||||
|
||||
/*! @brief BatteryPercentageMinThreshold attribute, ZCL spec 3.3.2.2.4.9 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_MIN_THRESHOLD_ID = 0x003a,
|
||||
|
||||
/*! @brief BatteryPercentageThreshold1 attribute, ZCL spec 3.3.2.2.4.10 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD1_ID = 0x003b,
|
||||
/*! @brief BatteryPercentageThreshold2 attribute, ZCL spec 3.3.2.2.4.10 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD2_ID = 0x003c,
|
||||
/*! @brief BatteryPercentageThreshold3 attribute, ZCL spec 3.3.2.2.4.10 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD3_ID = 0x003d,
|
||||
|
||||
/*! @brief BatteryAlarmState attribute, ZCL spec 3.3.2.2.4.11 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_STATE_ID = 0x003e,
|
||||
|
||||
/*! @brief Battery Information 2 attribute set, ZCL spec 3.3.2.2.5 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_VOLTAGE_ID = 0x0040,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_PERCENTAGE_REMAINING_ID = 0x0041,
|
||||
|
||||
/*! @brief Battery Settings 2 attribute set, ZCL spec 3.3.2.2.6 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_MANUFACTURER_ID = 0x0050,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_SIZE_ID = 0x0051,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_A_HR_RATING_ID = 0x0052,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_QUANTITY_ID = 0x0053,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_RATED_VOLTAGE_ID = 0x0054,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_ALARM_MASK_ID = 0x0055,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_VOLTAGE_MIN_THRESHOLD_ID = 0x0056,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_VOLTAGE_THRESHOLD1_ID = 0x0057,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_VOLTAGE_THRESHOLD2_ID = 0x0058,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_VOLTAGE_THRESHOLD3_ID = 0x0059,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_PERCENTAGE_MIN_THRESHOLD_ID = 0x005a,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_PERCENTAGE_THRESHOLD1_ID = 0x005b,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_PERCENTAGE_THRESHOLD2_ID = 0x005c,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_PERCENTAGE_THRESHOLD3_ID = 0x005d,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY2_ALARM_STATE_ID = 0x005e,
|
||||
|
||||
/*! @brief Battery Information 3 attribute set, ZCL spec 3.3.2.2.7 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_VOLTAGE_ID = 0x0060,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_PERCENTAGE_REMAINING_ID = 0x0061,
|
||||
|
||||
/*! @brief Battery Settings 3 attribute set, ZCL spec 3.3.2.2.8 */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_MANUFACTURER_ID = 0x0070,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_SIZE_ID = 0x0071,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_A_HR_RATING_ID = 0x0072,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_QUANTITY_ID = 0x0073,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_RATED_VOLTAGE_ID = 0x0074,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_ALARM_MASK_ID = 0x0075,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_VOLTAGE_MIN_THRESHOLD_ID = 0x0076,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_VOLTAGE_THRESHOLD1_ID = 0x0077,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_VOLTAGE_THRESHOLD2_ID = 0x0078,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_VOLTAGE_THRESHOLD3_ID = 0x0079,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_PERCENTAGE_MIN_THRESHOLD_ID = 0x007a,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_PERCENTAGE_THRESHOLD1_ID = 0x007b,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_PERCENTAGE_THRESHOLD2_ID = 0x007c,
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_PERCENTAGE_THRESHOLD3_ID = 0x007d,
|
||||
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY3_ALARM_STATE_ID = 0x007e,
|
||||
/** @cond internals_doc */
|
||||
/* Custom attributes */
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_CUSTOM_BATTERY_VOLTAGE_SHARP_ID = 0x8020
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Power Configuration MainsAlarmMask value
|
||||
* see ZCL spec 3.3.2.2.4.7
|
||||
*/
|
||||
enum zb_zcl_power_config_mains_alarm_mask_e
|
||||
{
|
||||
/** @brief MainsAlarmMask - Mains Voltage too low */
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_ALARM_MASK_VOLTAGE_LOW = 0x01,
|
||||
/** @brief MainsAlarmMask - Mains Voltage too high */
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_ALARM_MASK_VOLTAGE_HIGH = 0x02,
|
||||
/** @brief MainsAlarmMask - Mains power supply lost/unavailable */
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_ALARM_MASK_VOLTAGE_UNAVAIL = 0x04,
|
||||
|
||||
};
|
||||
|
||||
/** @brief Default value for Power Configuration cluster revision global attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Default value for MainsAlarmMask attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_ALARM_MASK_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for MainsVoltageMinThreshold attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Default value for MainsVoltageMaxThreshold attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for MainsDwellTripPoint attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_DWELL_TRIP_POINT_DEFAULT_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief BatteryVoltage attribute invalid value */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_VOLTAGE_INVALID 0xff
|
||||
|
||||
/** @brief Power Configuration BatteryPercentageRemaining attribute unknown value */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_REMAINING_UNKNOWN 0xff
|
||||
|
||||
/** @brief Default value for BatteryRemainingHA attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_REMAINING_HA_DEFAULT_VALUE ((zb_uint8_t)0)
|
||||
|
||||
/** @brief Default value for BatteryManufacturer attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_MANUFACTURER_DEFAULT_VALUE {0}
|
||||
|
||||
/** @brief BatterySize attribute default value */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_DEFAULT_VALUE 0xff
|
||||
|
||||
/** @brief BatteryAlarmMask attribute default value */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_MASK_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for BatteryVoltageMinThreshold attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_VOLTAGE_MIN_THRESHOLD_DEFAULT_VALUE ((zb_uint8_t)0x0000)
|
||||
|
||||
/** @brief Default value for BatteryVoltageThreshold1 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD1_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryVoltageThreshold2 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD2_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryVoltageThreshold3 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD3_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryPercentageMinThreshold attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_PERCENTAGE_MIN_THRESHOLD_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryPercentageThreshold1 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD1_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryPercentageThreshold2 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD2_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryPercentageThreshold3 attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD3_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Default value for BatteryAlarmState attribute */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_DEFAULT_VALUE ((zb_uint32_t)0x00000000)
|
||||
|
||||
/** @brief MainsVoltageMinThreshold and MainsVoltageMaxThreshold values when alarm should not be generated*/
|
||||
#define ZB_ZCL_POWER_CONFIG_THRESHOLD_ALARM_OMISSION_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Mains attribute set the least significant nibble*/
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_ATTRIBUTE_SET 0
|
||||
|
||||
/** @brief Battery attribute set the least significant nibble*/
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_ATTRIBUTE_SET 0
|
||||
|
||||
/** @brief Battery Source 2 attribute set the least significant nibble*/
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_SOURCE_2_ATTRIBUTE_SET 0x20
|
||||
|
||||
/** @brief Battery Source 3 attribute set the least significant nibble*/
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_SOURCE_3_ATTRIBUTE_SET 0x40
|
||||
|
||||
/**
|
||||
* @brief Power Configuration BatterySize value
|
||||
* see ZCL spec 3.3.2.2.4.2
|
||||
*/
|
||||
enum zb_zcl_power_config_battery_size_e
|
||||
{
|
||||
/** @brief BatterySize - no battery*/
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_NO_BATTERY = 0,
|
||||
/** @brief BatterySize - built in */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_BUILT_IN = 1,
|
||||
/** @brief BatterySize - other */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_OTHER = 2,
|
||||
/** @brief BatterySize - AA */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_AA = 3,
|
||||
/** @brief BatterySize - AAA */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_AAA = 4,
|
||||
/** @brief BatterySize - C */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_C = 5,
|
||||
/** @brief BatterySize - D */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_D = 6,
|
||||
/** @brief BatterySize - CR2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_CR2 = 7,
|
||||
/** @brief BatterySize - CR123A */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_CR123A = 8,
|
||||
/** @brief BatterySize - unknown */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_SIZE_UNKNOWN = 0xff,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Power Configuration BatteryAlarmMask value
|
||||
* see ZCL spec 3.3.2.2.4.7
|
||||
*/
|
||||
enum zb_zcl_power_config_battery_alarm_mask_e
|
||||
{
|
||||
/** @brief BatteryAlarmMask - Battery voltage too low */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_MASK_VOLTAGE_LOW = 0,
|
||||
/** @brief BatteryAlarmMask - Alarm1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_MASK_ALARM1 = 1,
|
||||
/** @brief BatteryAlarmMask - Alarm2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_MASK_ALARM2 = 2,
|
||||
/** @brief BatteryAlarmMask - Alarm3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_MASK_ALARM3 = 3,
|
||||
};
|
||||
|
||||
/*! @brief Power Configuration Alarm Code for Alarm
|
||||
@see ZCL spec 3.3.2.2.4.7, Table 3-25
|
||||
*/
|
||||
enum zb_zcl_power_config_battery_alarm_code_e
|
||||
{
|
||||
/** @brief MainsVoltageAlarmCode - MainsVoltageMinThreshold reached for Mains Voltage**/
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_ALARM_CODE_MIN_THRESHOLD = 0x00,
|
||||
/** @brief MainsVoltageAlarmCode - MainsVoltageMaxThreshold reached for Mains Voltage**/
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_ALARM_CODE_MAX_THRESHOLD = 0x01,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE1_MIN_THRESHOLD = 0x10,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE1_VOLTAGE1 = 0x11,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE1_VOLTAGE2 = 0x12,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE1_VOLTAGE3 = 0x13,
|
||||
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE2_MIN_THRESHOLD = 0x20,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE2_VOLTAGE1 = 0x21,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE2_VOLTAGE2 = 0x22,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE2_VOLTAGE3 = 0x23,
|
||||
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE3_MIN_THRESHOLD = 0x30,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE3_VOLTAGE1 = 0x31,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE3_VOLTAGE2 = 0x32,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_SOURCE3_VOLTAGE3 = 0x33,
|
||||
/** @brief Mains power supply lost/unavailable (i.e., device is running on battery) */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_CODE_MAINS_POWER_SUPPLY_LOST_UNAVAILABLE = 0x3a,
|
||||
};
|
||||
|
||||
|
||||
/*! @brief Power Configuration BatteryAlarmState
|
||||
@see ZCL spec 3.3.2.2.4.11, Table 3-26
|
||||
*/
|
||||
enum zb_zcl_power_config_battery_alarm_state_e
|
||||
{
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE1_MIN_THRESHOLD = 1 << 0,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE1_VOLTAGE1 = 1 << 1,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE1_VOLTAGE2 = 1 << 2,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 1 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE1_VOLTAGE3 = 1 << 3,
|
||||
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE2_MIN_THRESHOLD = 1 << 10,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE2_VOLTAGE1 = 1 << 11,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE2_VOLTAGE2 = 1 << 12,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 2 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE2_VOLTAGE3 = 1 << 13,
|
||||
|
||||
/* use 1l to exclude overflow at 16-bit CPU: force 32-bit enum */
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold or
|
||||
* BatteryPercentageMinThreshold reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE3_MIN_THRESHOLD = 1l << 20,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold1 or
|
||||
* BatteryPercentageMinThreshold1 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE3_VOLTAGE1 = 1l << 21,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold2 or
|
||||
* BatteryPercentageMinThreshold2 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE3_VOLTAGE2 = 1l << 22,
|
||||
/** @brief BatteryAlarmCode - BatteryVoltageMinThreshold3 or
|
||||
* BatteryPercentageMinThreshold3 reached for Battery Source 3 */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_SOURCE3_VOLTAGE3 = 1l << 23,
|
||||
/** @brief Mains power supply lost/unavailable (i.e., device is running on battery) */
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ALARM_STATE_MAINS_POWER_SUPPLY_LOST_UNAVAILABLE = 1l << 30,
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Power Configuration cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_FREQUENCY_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_FREQUENCY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_ALARM_MASK_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_ALARM_MASK_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_MAINS_DWELL_TRIP_POINT(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_MAINS_DWELL_TRIP_POINT, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_VOLTAGE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_SIZE_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_SIZE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_QUANTITY_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_QUANTITY_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_RATED_VOLTAGE_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_RATED_VOLTAGE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/* DA: HA12 change */
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_MASK_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_ALARM_MASK_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_MIN_THRESHOLD_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_VOLTAGE_MIN_THRESHOLD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_PERCENTAGE_REMAINING_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD1_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_VOLTAGE_THRESHOLD1_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD2_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_VOLTAGE_THRESHOLD2_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD3_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_VOLTAGE_THRESHOLD3_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_MIN_THRESHOLD_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_PERCENTAGE_MIN_THRESHOLD_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD1_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_PERCENTAGE_THRESHOLD1_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD2_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_PERCENTAGE_THRESHOLD2_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD3_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_PERCENTAGE_THRESHOLD3_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_STATE_ID(data_ptr, bat_num) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_POWER_CONFIG_BATTERY##bat_num##_ALARM_STATE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Power
|
||||
* Configuration cluster for 1 battery pack */
|
||||
#undef ZB_ZCL_POWER_CONFIG_REPORT_ATTR_COUNT
|
||||
#define ZB_ZCL_POWER_CONFIG_REPORT_ATTR_COUNT 2 /* Voltage + Alarm State */
|
||||
/*! @internal Number of attributes mandatory for reporting in Power
|
||||
* Configuration cluster for 2 Battery packs included */
|
||||
#define ZB_ZCL_POWER_CONFIG_BAT_PACK_2_REPORT_ATTR_COUNT 4 /* Voltage + Voltage 2 + Alarm State +
|
||||
* Alarm State 2 */
|
||||
/*! @internal Number of attributes mandatory for reporting in Power
|
||||
* Configuration cluster for 3 Battery packs included */
|
||||
#define ZB_ZCL_POWER_CONFIG_BAT_PACK_3_REPORT_ATTR_COUNT 6 /* Voltage + Voltage 2 + Voltage 3 +
|
||||
* Alarm State + Alarm State 2 + Alarm State 3*/
|
||||
|
||||
/*! @internal Alarm Code for Power Configuration cluster */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD_ALARM_CODE 0x00
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD_ALARM_CODE 0x01
|
||||
|
||||
/*! @} */ /* Power Configuration cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Power Configuration cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param voltage - pointer to variable to store BatteryVoltage attribute
|
||||
@param size - pointer to variable to store BatterySize attribute
|
||||
@param quantity - pointer to variable to store BatteryQuantity attribute
|
||||
@param rated_voltage - pointer to variable to store BatteryRatedVoltage attribute
|
||||
@param alarm_mask - pointer to variable to store BatteryAlarmMask attribute
|
||||
@param voltage_min_threshold - pointer to variable to store BatteryVoltageMinThreshold attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_POWER_CONFIG_ATTRIB_LIST(attr_list, \
|
||||
voltage, size, quantity, rated_voltage, \
|
||||
alarm_mask, voltage_min_threshold) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_POWER_CONFIG) \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID(voltage, ), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_SIZE_ID(size, ), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_QUANTITY_ID(quantity, ), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_RATED_VOLTAGE_ID(rated_voltage, ), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_MASK_ID(alarm_mask, ), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_MIN_THRESHOLD_ID(voltage_min_threshold, ), \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @cond internals_doc */
|
||||
#define ZB_ZCL_POWER_CONFIG_MAINS_ATTRIB_LIST(voltage, frequency, alarm_mask, \
|
||||
voltage_min_threshold, voltage_max_threshold, \
|
||||
dwell_trip_point) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_ID, (voltage)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_FREQUENCY_ID, (frequency)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_ALARM_MASK_ID, (alarm_mask)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MIN_THRESHOLD, (voltage_min_threshold)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_VOLTAGE_MAX_THRESHOLD, (voltage_max_threshold)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_POWER_CONFIG_MAINS_DWELL_TRIP_POINT, (dwell_trip_point))
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Power Configuration cluster - server side (Mains
|
||||
attribute set)
|
||||
@param attr_list - attribute list name
|
||||
@param voltage - pointer to variable to store MainsVoltage attribute
|
||||
@param frequency - pointer to variable to store MainsFrequency attribute
|
||||
@param alarm_mask - pointer to variable to store BatteryAlarmMask attribute
|
||||
@param voltage_min_threshold - pointer to variable to store MainsVoltageMinThreshold attribute
|
||||
@param voltage_max_threshold - pointer to variable to store MainsVoltageMaxThreshold attribute
|
||||
@param dwell_trip_point - pointer to variable to store MainsVoltageDwellTripPoint attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_POWER_CONFIG_MAINS_ATTRIB_LIST(attr_list, voltage, frequency, alarm_mask, \
|
||||
voltage_min_threshold, voltage_max_threshold, \
|
||||
dwell_trip_point) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_POWER_CONFIG) \
|
||||
ZB_ZCL_POWER_CONFIG_MAINS_ATTRIB_LIST(voltage, frequency, alarm_mask, \
|
||||
voltage_min_threshold, voltage_max_threshold, \
|
||||
dwell_trip_point) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @cond internals_doc */
|
||||
#define ZB_ZCL_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(bat_num, \
|
||||
voltage, size, quantity, rated_voltage, alarm_mask, voltage_min_threshold, \
|
||||
remaining, threshold1, threshold2, threshold3, min_threshold, percent_threshold1, \
|
||||
percent_threshold2, percent_threshold3, alarm_state) \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID(voltage, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_SIZE_ID(size, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_QUANTITY_ID(quantity, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_RATED_VOLTAGE_ID(rated_voltage, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_MASK_ID(alarm_mask, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_MIN_THRESHOLD_ID(voltage_min_threshold, bat_num), \
|
||||
/* ext attribute */ \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID(remaining, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD1_ID(threshold1, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD2_ID(threshold2, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_THRESHOLD3_ID(threshold3, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_MIN_THRESHOLD_ID(min_threshold, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD1_ID(percent_threshold1, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD2_ID(percent_threshold2, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_THRESHOLD3_ID(percent_threshold3, bat_num), \
|
||||
ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_ALARM_STATE_ID(alarm_state, bat_num),
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Power Configuration cluster - server side (Battery attribute
|
||||
list extended)
|
||||
@param attr_list - attribute list name
|
||||
@param voltage - pointer to variable to store BatteryVoltage attribute
|
||||
@param size - pointer to variable to store BatterySize attribute
|
||||
@param quantity - pointer to variable to store BatteryQuantity attribute
|
||||
@param rated_voltage - pointer to variable to store BatteryRatedVoltage attribute
|
||||
@param alarm_mask - pointer to variable to store BatteryAlarmMask attribute
|
||||
@param voltage_min_threshold - pointer to variable to store BatteryVoltageMinThreshold attribute
|
||||
|
||||
@param remaining - pointer to variable to store BatteryPercentageRemaining attribute
|
||||
@param threshold1 - pointer to variable to store BatteryVoltageThreshold1 attribute
|
||||
@param threshold2 - pointer to variable to store BatteryVoltageThreshold2 attribute
|
||||
@param threshold3 - pointer to variable to store BatteryVoltageThreshold3 attribute
|
||||
@param min_threshold - pointer to variable to store BatteryPercentageMinThreshold attribute
|
||||
@param percent_threshold1 - pointer to variable to store BatteryPercentageThreshold1 attribute
|
||||
@param percent_threshold2 - pointer to variable to store BatteryPercentageThreshold2 attribute
|
||||
@param percent_threshold3 - pointer to variable to store BatteryPercentageThreshold3 attribute
|
||||
@param alarm_state - pointer to variable to store BatteryAlarmState attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(attr_list, \
|
||||
voltage, size, quantity, rated_voltage, alarm_mask, voltage_min_threshold, \
|
||||
remaining, threshold1, threshold2, threshold3, min_threshold, percent_threshold1, \
|
||||
percent_threshold2, percent_threshold3, alarm_state) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_POWER_CONFIG) \
|
||||
ZB_ZCL_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(bat_num, \
|
||||
voltage, size, quantity, rated_voltage, alarm_mask, voltage_min_threshold, \
|
||||
remaining, threshold1, threshold2, threshold3, min_threshold, percent_threshold1, \
|
||||
percent_threshold2, percent_threshold3, alarm_state) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Power Configuration cluster attributes */
|
||||
|
||||
/*! @name Power Configuration cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Power Configuration cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Power Configuration cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_power_config_init_server(void);
|
||||
void zb_zcl_power_config_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_POWER_CONFIG_SERVER_ROLE_INIT zb_zcl_power_config_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_POWER_CONFIG_CLIENT_ROLE_INIT zb_zcl_power_config_init_client
|
||||
|
||||
#endif /* ZB_ZCL_POWER_CONFIG_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,322 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Pressure Measurement cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_PRESSURE_MEASUREMENT_H
|
||||
#define ZB_ZCL_PRESSURE_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_PRESSURE_MEASUREMENT
|
||||
* @{
|
||||
* @details
|
||||
* All commands in the cluster have only request form, and carry no payload.
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT */
|
||||
|
||||
/*! @name Pressure Measurement cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
#if !defined(ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_TOLERANCE_ID) && defined(ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_ID)
|
||||
# error If scale tolerance attribute is enabled, all scale attributes shall be enabled
|
||||
#endif
|
||||
|
||||
/*! @brief Pressure Measurement cluster attribute identifiers
|
||||
@see ZCL spec, Pressure Measurement Cluster 4.5.2.2.1
|
||||
*/
|
||||
enum zb_zcl_pressure_measurement_attr_e
|
||||
{
|
||||
/*! @brief MeasuredValue, ZCL spec 4.5.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID = 0x0000,
|
||||
/*! @brief MinMeasuredValue, ZCL spec 4.5.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_ID = 0x0001,
|
||||
/*! @brief MaxMeasuredValue, ZCL spec 4.5.2.2.1.3 */
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_ID = 0x0002,
|
||||
/*! @brief Tolerance, ZCL spec 4.5.2.2.1.4 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_TOLERANCE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_ID = 0x0003,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_ID = 0xF003,
|
||||
#endif
|
||||
|
||||
/*! @brief ScaledValue, ZCL spec 4.5.2.1.2.1 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_VALUE_ID = 0x0010,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_VALUE_ID = 0xF010,
|
||||
#endif
|
||||
/*! @brief MinScaledValue, ZCL spec 4.5.2.1.2.2 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_ID = 0x0011,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_ID = 0xF011,
|
||||
#endif
|
||||
/*! @brief MaxScaledValue, ZCL spec 4.5.2.1.2.3 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SACLED_VALUE_ID = 0x0012,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SACLED_VALUE_ID = 0xF012,
|
||||
#endif
|
||||
/*! @brief ScaledTolerance, ZCL spec 4.5.2.1.2.4 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_TOLERANCE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_ID = 0x0013,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_ID = 0xF013,
|
||||
#endif
|
||||
/*! @brief Scale, ZCL spec 4.5.2.1.2.5 */
|
||||
#ifndef ZB_DISABLE_PRESSURE_MEASUREMENT_SCALE_ID
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_ID = 0x0014,
|
||||
#else
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_ID = 0xF014,
|
||||
#endif
|
||||
};
|
||||
|
||||
/** @brief Default value for Pressure Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_PRESSURE_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/* (See: Table 4.15 Pressure Measurement Information Attribute Set) */
|
||||
|
||||
/** @brief MeasuredValue attribute unknown value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_UNKNOWN ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_MIN_VALUE ((zb_int16_t)0x8001)
|
||||
|
||||
/** @brief MinMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_MAX_VALUE ((zb_int16_t)0x7ffe)
|
||||
|
||||
/** @brief MinMeasuredValue attribute invalid value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_INVALID ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_MIN_VALUE ((zb_int16_t)0x8002)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_MAX_VALUE ((zb_int16_t)0x7fff)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute invalid value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_INVALID ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Tolerance attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief Tolerance attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_MAX_VALUE ((zb_uint16_t)0x0800)
|
||||
|
||||
/** @brief Default value for Value attribute */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_DEFAULT_VALUE ((zb_int16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for MinValue attribute */
|
||||
#define ZB_ZCL_PATTR_RESSURE_MEASUREMENT_MIN_VALUE_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief Default value for MaxValue attribute */
|
||||
#define ZB_ZCL_PATTR_RESSURE_MEASUREMENT_MAX_VALUE_DEFAULT_VALUE ((zb_int16_t)0x8000)
|
||||
|
||||
|
||||
/* (See: Table 4.16 Extended Pressure Measurement Information Attribute Set) */
|
||||
|
||||
/** @brief MinScaledValue attribute unknown value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_UNKNOWN ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MinScaledValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_MIN_VALUE ((zb_int16_t)0x8001)
|
||||
|
||||
/** @brief MinScaledValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_MAX_VALUE ((zb_int16_t)0x7ffe)
|
||||
|
||||
/** @brief MaxScaledValue attribute unknown value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SCALED_VALUE_UNKNOWN ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MaxScaledValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SCALED_VALUE_MIN_VALUE ((zb_int16_t)0x8002)
|
||||
|
||||
/** @brief MaxScaledValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SCALED_VALUE_MAX_VALUE ((zb_int16_t)0x7fff)
|
||||
|
||||
/** @brief MaxScaledValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_MIN_VALUE ((zb_uint16_t)0x0000)
|
||||
|
||||
/** @brief MaxScaledValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_MAX_VALUE ((zb_uint16_t)0x0800)
|
||||
|
||||
/** @brief MaxScaledValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_MIN_VALUE ((zb_int8_t)0x81)
|
||||
|
||||
/** @brief MaxScaledValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_MAX_VALUE ((zb_int8_t)0x7f)
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Pressure Measurement cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_SCALED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SCALED_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_SCALED_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALED_TOLERANCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_SCALE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S8, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Pressure Measurement cluster */
|
||||
#define ZB_ZCL_PRESSURE_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! Write attribute hook is used to set min/max Pressure values */
|
||||
void zb_zcl_pressure_measurement_write_attr_hook(
|
||||
zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value);
|
||||
|
||||
/*! @} */ /* Pressure Measurement cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Pressure Measurement cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param value - pointer to variable to store MeasuredValue attribute
|
||||
@param min_value - pointer to variable to store MinMeasuredValue attribute
|
||||
@param max_value - pointer to variable to store MAxMeasuredValue attribute
|
||||
@param tolerance - pointer to variable to store Tolerance attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_PRESSURE_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
value, min_value, max_value, tolerance) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_PRESSURE_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_VALUE_ID, (value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MIN_VALUE_ID, (min_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_MAX_VALUE_ID, (max_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_PRESSURE_MEASUREMENT_TOLERANCE_ID, (tolerance)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Pressure Measurement cluster attributes */
|
||||
|
||||
/*! @name Pressure Measurement cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Pressure Measurement cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Pressure Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_pressure_measurement_init_server(void);
|
||||
void zb_zcl_pressure_measurement_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_pressure_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_pressure_measurement_init_client
|
||||
|
||||
|
||||
#endif /* ZB_ZCL_PRESSURE_MEASUREMENT_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Relative Humidity Measurement cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_REL_HUMIDITY_MEASUREMENT_H
|
||||
#define ZB_ZCL_REL_HUMIDITY_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_WATER_CONTENT_MEASUREMENT
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_WATER_CONTENT_MEASUREMENT */
|
||||
|
||||
/*! @name Water Content Measurement cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Water Content Measurement cluster attribute identifiers
|
||||
@see ZCL specification revision 7, Relative Humidity MeasuremenWater Content Measurement Cluster 4.7.2.1
|
||||
*/
|
||||
enum zb_zcl_rel_humidity_measurement_attr_e
|
||||
{
|
||||
/** @brief MeasuredValue, ZCL specification revision 7 subsection 4.7.2.1.1 MeasuredValue Attribute */
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID = 0x0000,
|
||||
/** @brief MinMeasuredValue, ZCL specification revision 7 subsection 4.7.2.1.2 MinMeasuredValue Attribute*/
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_ID = 0x0001,
|
||||
/** @brief MaxMeasuredValue, ZCL specification revision 7 subsection 4.7.2.1.3 MaxMeasuredValue Attribute*/
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_ID = 0x0002,
|
||||
/** The Tolerance attribute SHALL indicate the magnitude of the
|
||||
* possible error that is associated with MeasuredValue, using
|
||||
* the same units and resolution.
|
||||
* @brief Tolerance, ZCL specification revision 7 subsection 4.7.2.1.4 Tolerance Attribute
|
||||
*/
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_TOLERANCE_ID = 0x0003,
|
||||
};
|
||||
|
||||
/** @brief Default value for Water Content Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_WATER_CONTENT_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief MeasuredValue attribute unknown value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_UNKNOWN 0xFFFF
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_MIN_VALUE 0x0000
|
||||
|
||||
/** @brief MinMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_MAX_VALUE 0x270F
|
||||
|
||||
/** @brief MinMeasuredValue attribute undefined value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_UNDEFINED 0xFFFF
|
||||
|
||||
/** @brief MaxMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_MIN_VALUE 0x0001
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_MAX_VALUE 0x2710
|
||||
|
||||
/** @brief MaxMeasuredValue attribute value not defined */
|
||||
#define ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_UNDEFINED 0xFFFF
|
||||
|
||||
/** @brief Default value for MeasurementValue attribute */
|
||||
#define ZB_ZCL_REL_HUMIDITY_MEASUREMENT_VALUE_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for MeasurementMinValue attribute */
|
||||
#define ZB_ZCL_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @brief Default value for MeasurementMaxValue attribute */
|
||||
#define ZB_ZCL_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_DEFAULT_VALUE ((zb_uint16_t)0xFFFF)
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Relative Humidity Measurement cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_ZCL_REL_HUMIDITY_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! @} */ /* Relative Humidity Measurement cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Relative Humidity Measurement cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param value - pointer to variable to store MeasuredValue attribute
|
||||
@param min_value - pointer to variable to store MinMeasuredValue attribute
|
||||
@param max_value - pointer to variable to store MAxMeasuredValue attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_REL_HUMIDITY_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
value, min_value, max_value) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_WATER_CONTENT_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID, (value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MIN_VALUE_ID, (min_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_MAX_VALUE_ID, (max_value)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Relative Humidity Measurement cluster attributes */
|
||||
|
||||
/*! @name Relative Humidity Measurement cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Relative Humidity Measurement cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Relative Humidity Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_rel_humidity_init_server(void);
|
||||
void zb_zcl_rel_humidity_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_rel_humidity_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_rel_humidity_init_client
|
||||
|
||||
#endif /* ZB_ZCL_REL_HUMIDITY_MEASUREMENT_H */
|
||||
@@ -0,0 +1,372 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Zigbee cluster library definitions for reporting functionality
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_REPORTING_H
|
||||
#define ZB_ZCL_REPORTING_H 1
|
||||
|
||||
#if !(defined ZB_ZCL_DISABLE_REPORTING) || defined(DOXYGEN)
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/**
|
||||
* @addtogroup ZB_ZCL_REPORTING
|
||||
* @{
|
||||
* @details
|
||||
* ZCL attribute reporting being described in ZCL spec, subclauses 2.4.7 through 2.4.11, and
|
||||
* subclauses covering clusters with reportable attributes.
|
||||
*
|
||||
* API for attribute reporting configuring and configuration details reading documented in: @ref
|
||||
* cfg_reporting_cmd, and @ref report_attr_cmd respectively.
|
||||
*
|
||||
* Since all events related to attribute reporting are being handled internally, application can
|
||||
* be provided with information on attribute report receipt event, and attribute report not
|
||||
* received within predefined interval event. To handle these events, application may set
|
||||
* "report attribute" and "no reporting" callbacks with @ref ZB_ZCL_SET_REPORT_ATTR_CB() and
|
||||
* @ref ZB_ZCL_SET_NO_REPORTING_CB() macros respectively.
|
||||
*
|
||||
* @par Example
|
||||
* @snippet light_sample/dimmable_light/bulb.c zb_zcl_set_report_attr_cb
|
||||
* @snippet light_sample/dimmable_light/bulb.c zb_zcl_set_report_attr_cb_example
|
||||
* @par
|
||||
*/
|
||||
|
||||
/* Boundary and default values are defined by application profile */
|
||||
|
||||
/*! Default value for minimum reporting interval */
|
||||
#define ZB_ZCL_MIN_REPORTING_INTERVAL_DEFAULT 0x0005
|
||||
|
||||
/*! Default value for maximum reporting interval */
|
||||
#define ZB_ZCL_MAX_REPORTING_INTERVAL_DEFAULT 0x0000
|
||||
|
||||
union zb_zcl_attr_var_u
|
||||
{
|
||||
zb_uint8_t u8;
|
||||
zb_int8_t s8;
|
||||
zb_uint16_t u16;
|
||||
zb_int16_t s16;
|
||||
zb_uint24_t u24;
|
||||
zb_int24_t s24;
|
||||
zb_uint32_t u32;
|
||||
zb_int32_t s32;
|
||||
zb_uint48_t u48;
|
||||
zb_uint8_t data_buf[4];
|
||||
zb_uint32_t data_buf_crc32;
|
||||
zb_single_t f32;
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @brief Structure for storing Reporting information */
|
||||
typedef struct zb_zcl_reporting_info_s
|
||||
{
|
||||
zb_uint8_t direction; /*!< Direction: report is send or received */
|
||||
zb_uint8_t ep; /*!< Endpoint number */
|
||||
zb_uint16_t cluster_id; /*!< Cluster ID for reporting */
|
||||
zb_uint8_t cluster_role;
|
||||
zb_uint16_t attr_id; /*!< Attribute ID for reporting */
|
||||
zb_uint8_t flags; /*!< Flags to inform status of reporting */
|
||||
zb_time_t run_time; /*!< Time to run next reporting activity */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
zb_uint16_t min_interval; /*!< Actual minimum reporting interval */
|
||||
zb_uint16_t max_interval; /*!< Actual maximum reporting interval */
|
||||
union zb_zcl_attr_var_u delta; /*!< Actual reportable change */
|
||||
union zb_zcl_attr_var_u reported_value; /*!< The last reported value */
|
||||
zb_uint16_t def_min_interval; /*!< Default minimum reporting interval */
|
||||
zb_uint16_t def_max_interval; /*!< Default maximum reporting interval */
|
||||
}
|
||||
send_info; /*!< send_info is stored on cluster server side (as usual) and describes how
|
||||
attribute should be reported */
|
||||
struct
|
||||
{
|
||||
zb_uint16_t timeout; /*!< Timeout period */
|
||||
}
|
||||
recv_info; /*!< recv_info is stored on cluster client side (as usual) and describes how
|
||||
attribute report is received */
|
||||
}
|
||||
u;
|
||||
|
||||
struct
|
||||
{
|
||||
zb_uint16_t short_addr; /*!< Destination short address */
|
||||
zb_uint8_t endpoint; /*!< Destination endpoint */
|
||||
zb_uint16_t profile_id; /*!< Profile id */
|
||||
}
|
||||
dst;
|
||||
|
||||
zb_uint16_t manuf_code; /*!< Manufacturer specific code */
|
||||
}
|
||||
zb_zcl_reporting_info_t;
|
||||
|
||||
#if defined ZB_USE_NVRAM
|
||||
|
||||
/* FIXME: Dataset is not aligned (21 bytes)! Fix align and use u48 instead of u32 for delta! */
|
||||
|
||||
/** @brief Structure for storing Reporting information to NVRAM */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_reporting_info_nvram_s
|
||||
{
|
||||
zb_uint8_t direction; /*!< Direction: report is send or received */
|
||||
zb_uint8_t ep; /*!< Endpoint number */
|
||||
zb_uint16_t cluster_id; /*!< Cluster ID for reporting */
|
||||
zb_uint8_t cluster_role; /*!< Cluster role */
|
||||
zb_uint16_t attr_id; /*!< Attribute ID for reporting */
|
||||
zb_uint16_t manuf_code; /*!< Manufacturer specific code */
|
||||
zb_uint8_t flags; /*!< Flags to inform status of reporting */
|
||||
|
||||
zb_uint16_t min_interval; /*!< Minimum reporting interval or timeout for client*/
|
||||
zb_uint16_t max_interval; /*!< Maximum reporting interval */
|
||||
/* FIXME: Should be U48 here! Leave it as is to do not perform migration! U32 delta is enough for
|
||||
* the most cases... */
|
||||
zb_uint32_t delta; /*!< Reportable change */
|
||||
|
||||
zb_uint16_t short_addr_dest; /*!< Destination short address */
|
||||
zb_uint8_t endpoint_dest; /*!< Destination endpoint */
|
||||
zb_uint16_t profile_id_dest; /*!< Profile id */
|
||||
zb_uint8_t align[1];
|
||||
} ZB_PACKED_STRUCT zb_zcl_reporting_info_nvram_t;
|
||||
|
||||
#endif /* defined ZB_USE_NVRAM */
|
||||
|
||||
typedef struct zb_zcl_reporting_ctx_s
|
||||
{
|
||||
zb_uint16_t min_interval;
|
||||
zb_uint16_t max_interval;
|
||||
zb_uint16_t timeout;
|
||||
|
||||
zb_uint8_t buf_ref;
|
||||
}
|
||||
zb_zcl_reporting_ctx_t;
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Informs application that some attribute value was not reported during defined time
|
||||
interval
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param attr_id - attribute ID
|
||||
*/
|
||||
typedef void (*zb_zcl_no_reporting_cb_t)(
|
||||
zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint16_t attr_id);
|
||||
|
||||
/** @brief Informs application about received attribute report
|
||||
@param addr - source address
|
||||
@param src_ep - source endpoint number
|
||||
@param dst_ep - destination endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param attr_id - attribute ID
|
||||
@param attr_type - attribute type
|
||||
@param value - pointer to reported data value
|
||||
*/
|
||||
|
||||
typedef void (*zb_zcl_report_attr_cb_t)(
|
||||
zb_zcl_addr_t *addr, zb_uint8_t src_ep, zb_uint8_t dst_ep, zb_uint16_t cluster_id, zb_uint16_t attr_id, zb_uint8_t attr_type, zb_uint8_t *value);
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** Enumeration of reporting info flag values */
|
||||
typedef enum zb_zcl_reporting_flags_e
|
||||
{
|
||||
ZB_ZCL_REPORTING_SLOT_BUSY = 0x01, /*!< Reporting info slot is busy */
|
||||
ZB_ZCL_REPORT_ATTR = 0x01 << 1, /*!< Current attribute should be reported */
|
||||
ZB_ZCL_REPORT_IS_ALLOWED = 0x01 << 2, /*!< Reporting for attribute is allowed if
|
||||
* min_interval timeout condition is met */
|
||||
ZB_ZCL_REPORTING_STOP = 0x01 << 3, /*!< Stop reporting this attribute */
|
||||
ZB_ZCL_REPORT_TIMER_STARTED = 0x01 << 4,
|
||||
ZB_ZCL_REPORT_IS_SENT = 0x01 << 5,
|
||||
ZB_ZCL_REPORT_IS_FIRST = 0x01 << 6, /*!< First report for this attribute */
|
||||
}
|
||||
zb_zcl_reporting_flags_t;
|
||||
|
||||
#define ZB_ZCL_SET_REPORTING_FLAG(rep_info, f) ((rep_info)->flags |= (zb_uint8_t)(f))
|
||||
|
||||
#define ZB_ZCL_CLR_REPORTING_FLAG(rep_info, f) ((rep_info)->flags &= (zb_uint8_t)(f^0xFF))
|
||||
|
||||
#define ZB_ZCL_GET_REPORTING_FLAG(rep_info, f) ((rep_info)->flags & (zb_uint8_t)(f))
|
||||
|
||||
#define ZB_ZCL_CLR_ALL_REPORTING_FLAGS(rep_info) ((rep_info)->flags = 0)
|
||||
|
||||
|
||||
/*! @internal min_interval zero value */
|
||||
#define ZB_ZCL_MIN_INTERVAL_ZERO 0x0000
|
||||
|
||||
/*! @internal Check, if min_interval should be taken into account */
|
||||
#define ZB_ZCL_MIN_INTERVAL_SPECIFIED \
|
||||
(ZCL_CTX().reporting_ctx.min_interval != ZB_ZCL_MIN_INTERVAL_ZERO)
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief If Maximum reporting interval is set to value 0xFFFF,reporting is not needed for current
|
||||
attribute
|
||||
*/
|
||||
#define ZB_ZCL_REPORTING_NOT_NEEDED 0xFFFF
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
#define ZB_ZCL_TIMEOUT_ZERO 0x0000
|
||||
|
||||
#define ZB_ZCL_INVALID_TIMEOUT 0xFFFF
|
||||
|
||||
#define ZB_ZCL_UNDEFINED_REPORTING_SLOT 0xFF
|
||||
#define ZB_ZCL_MAX_REPORTING_SLOTS_BY_EP (ZB_ZCL_UNDEFINED_REPORTING_SLOT / ZB_ZCL_MAX_EP_NUMBER)
|
||||
|
||||
/************************** Reporting functions declarations **********************************/
|
||||
|
||||
#ifdef ZB_ZCL_ENABLE_DEFAULT_REPORT_ATTR_PROCESSING
|
||||
void zb_zcl_report_attr_cmd_handler(zb_uint8_t param);
|
||||
#endif
|
||||
|
||||
void zb_zcl_report_received(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id);
|
||||
|
||||
void zb_zcl_report_received_manuf(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint16_t manuf_code);
|
||||
|
||||
zb_ret_t zb_zcl_put_reporting_info(zb_zcl_reporting_info_t* rep_info_ptr, zb_bool_t override);
|
||||
|
||||
zb_ret_t zb_zcl_put_reporting_info_from_req(zb_zcl_configure_reporting_req_t *config_rep_req,
|
||||
zb_zcl_attr_addr_info_t* attr_addr_info);
|
||||
|
||||
void zb_zcl_init_reporting_info(void);
|
||||
|
||||
zb_zcl_reporting_info_t* zb_zcl_find_reporting_info( zb_uint8_t ep,
|
||||
zb_uint16_t cluster_id,
|
||||
zb_uint8_t cluster_role,
|
||||
zb_uint16_t attr_id);
|
||||
|
||||
zb_zcl_reporting_info_t* zb_zcl_find_reporting_info_manuf( zb_uint8_t ep,
|
||||
zb_uint16_t cluster_id,
|
||||
zb_uint8_t cluster_role,
|
||||
zb_uint16_t attr_id,
|
||||
zb_uint16_t manuf_code);
|
||||
|
||||
zb_zcl_reporting_info_t* zb_zcl_get_next_reporting_info(
|
||||
zb_zcl_reporting_info_t *rep_info_init, zb_uint8_t is_manuf_spec);
|
||||
|
||||
void zb_zcl_reporting_cb(zb_uint8_t param);
|
||||
|
||||
void zb_zcl_save_reported_value(zb_zcl_reporting_info_t *rep_info, zb_zcl_attr_t* attr_desc);
|
||||
|
||||
void zb_zcl_mark_attr_for_reporting(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id);
|
||||
void zb_zcl_mark_attr_for_reporting_manuf(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint16_t manuf_code);
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Start attribute reporting
|
||||
|
||||
@deprecated This function will be removed in the next Major release after February 2023
|
||||
Use @ref zb_zcl_start_attr_reporting_manuf() instead
|
||||
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@return RET_OK if reporting is successfully started \n
|
||||
RET_DOES_NOT_EXIST if reporting can't be configured with given parameters (i.e cluster not present)
|
||||
*/
|
||||
zb_ret_t zb_zcl_start_attr_reporting(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id);
|
||||
|
||||
/** @brief Start attribute reporting
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@param manuf_code - manufacturer specific code
|
||||
@return RET_OK if reporting is successfully started \n
|
||||
RET_DOES_NOT_EXIST if reporting can't be configured with given parameters (i.e cluster not present)
|
||||
*/
|
||||
zb_ret_t zb_zcl_start_attr_reporting_manuf(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint16_t manuf_code);
|
||||
|
||||
/** @brief Stop attribute reporting
|
||||
|
||||
@deprecated This function will be removed in the next Major release after February 2023
|
||||
Use @ref zb_zcl_stop_attr_reporting_manuf() instead
|
||||
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@return RET_OK if reporting is successfully stopped \n
|
||||
RET_DOES_NOT_EXIST if reporting was not set up with given parameters
|
||||
*/
|
||||
zb_ret_t zb_zcl_stop_attr_reporting(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id);
|
||||
|
||||
/** @brief Stop attribute reporting
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@param manuf_code - manufacturer specific code
|
||||
@return RET_OK if reporting is successfully stopped \n
|
||||
RET_DOES_NOT_EXIST if reporting was not set up with given parameters
|
||||
*/
|
||||
zb_ret_t zb_zcl_stop_attr_reporting_manuf(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint16_t manuf_code);
|
||||
|
||||
/** @brief Check if an attribute is configured for reporting or not
|
||||
|
||||
@deprecated This function will be removed in the next Major release after February 2023
|
||||
Use @ref zcl_is_attr_reported_manuf() instead
|
||||
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@return ZB_TRUE if attribute is reported
|
||||
*/
|
||||
zb_bool_t zcl_is_attr_reported(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id);
|
||||
|
||||
/** @brief Check if an attribute is configured for reporting or not
|
||||
@param ep - endpoint number
|
||||
@param cluster_id - cluster ID
|
||||
@param cluster_role - cluster role
|
||||
@param attr_id - attribute ID
|
||||
@param manuf_code - manufacturer specific code
|
||||
@return ZB_TRUE if attribute is reported
|
||||
*/
|
||||
zb_bool_t zcl_is_attr_reported_manuf(zb_uint8_t ep, zb_uint16_t cluster_id, zb_uint8_t cluster_role, zb_uint16_t attr_id, zb_uint16_t manuf_code);
|
||||
|
||||
/* TODO: Document */
|
||||
zb_ret_t zb_zcl_put_reporting_info(zb_zcl_reporting_info_t* rep_info_ptr, zb_bool_t override);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
#endif /* !(defined ZB_ZCL_DISABLE_REPORTING) || defined(DOXYGEN) */
|
||||
|
||||
#endif /* ZB_ZCL_REPORTING_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Shade Configuration cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_SHADE_CONFIG_H
|
||||
#define ZB_ZCL_SHADE_CONFIG_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/* Logically most opened value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_LOGICALLY_MOST_OPENED 0
|
||||
|
||||
/* Logically most closed value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_LOGICALLY_MOST_CLOSED 0xffff
|
||||
|
||||
/** @defgroup ZB_ZCL_SHADE_CONFIG ZCL Shade Configuration cluster
|
||||
@ingroup ZB_ZCL_CLUSTERS
|
||||
@addtogroup ZB_ZCL_SHADE_CONFIG
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @name Shade Configuration cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/** @brief Shade Configuration cluster information attribute set identifiers
|
||||
@see ZCL spec, subclause 7.2.2.2.1
|
||||
*/
|
||||
enum zb_zcl_shade_config_info_attr_e
|
||||
{
|
||||
/** The PhysicalClosedLimit attribute indicates the most closed (numerically lowest)
|
||||
* position that the shade can physically move to. */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_PHYSICAL_CLOSED_LIMIT_ID = 0x0000,
|
||||
/** The MotorStepSize attribute indicates the angle the shade motor moves for one step,
|
||||
* measured in 1/10th of a degree. */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MOTOR_STEP_SIZE_ID = 0x0001,
|
||||
/** @brief Status attribute */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_ID = 0x0002
|
||||
};
|
||||
|
||||
/** @brief Bit values for Status attribute
|
||||
* @see ZCL spec, subclause 7.2.2.2.1.3
|
||||
*/
|
||||
enum zb_zcl_shade_config_status_type_e
|
||||
{
|
||||
/** Shade operational value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_SHADE_OPERATIONAL = 0x00,
|
||||
/** Shade Adjusting value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_SHADE_ADJUSTING = 0x01,
|
||||
/** Shade Direction value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_SHADE_DIRECTION = 0x02,
|
||||
/** Forward Direction of Motor value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_FORWARD_DIRECTION_OF_MOTOR = 0x03,
|
||||
/** Reserved values */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_RESERVED = 0x04
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @internal Set bits from conf_var variable to type_value */
|
||||
#define ZB_ZCL_SET_BIT(conf_var, type_value) \
|
||||
{ \
|
||||
(conf_var) = (conf_var) | (type_value); \
|
||||
}
|
||||
|
||||
/** @internal Get type_value bits from conf_var variable */
|
||||
#define ZB_ZCL_GET_BIT(conf_var, type_value) ((conf_var) & (type_value))
|
||||
|
||||
/** @internal Clear type_value bits in conf_var variable */
|
||||
#define ZB_ZCL_CLR_BIT(conf_var, type_value) \
|
||||
{ \
|
||||
(conf_var) = (conf_var) & ~(type_value); \
|
||||
}
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Sets bits of Status parameter
|
||||
@param type_value - bit to set
|
||||
@param conf_var - config variable
|
||||
*/
|
||||
#define ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_SET(conf_var, type_value) \
|
||||
ZB_ZCL_SET_BIT(conf_var, type_value)
|
||||
|
||||
/** @brief Gets bit value of Status parameter
|
||||
@param type_value - bit value to check
|
||||
@param conf_var - config variable
|
||||
*/
|
||||
#define ZB_ZCL_ATTR_SHADE_CONFIG_GET_STATUS_BIT_VAL(conf_var, type_value) \
|
||||
ZB_ZCL_GET_BIT(conf_var, type_value)
|
||||
|
||||
|
||||
/** @brief Clear bit of Status parameter
|
||||
@param type_value - bit to clear
|
||||
@param conf_var - config variable
|
||||
*/
|
||||
#define ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_CLEAR(conf_var, type_value) \
|
||||
ZB_ZCL_CLR_BIT(conf_var, type_value)
|
||||
|
||||
|
||||
/** @brief Shade cluster settings attribute set identifiers
|
||||
@see ZCL spec, subclause 7.2.2.2.2
|
||||
*/
|
||||
enum zb_zcl_shade_config_settings_attr_e
|
||||
{
|
||||
/** @brief ClosedLimit attribute */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_CLOSED_LIMIT_ID = 0x0010,
|
||||
/** @brief Mode attribute */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_ID = 0x0011
|
||||
};
|
||||
|
||||
/** @brief Permissible values for Mode attribute
|
||||
@see ZCL spec, subclause 7.2.2.2.2.2 */
|
||||
enum zb_zcl_shade_config_mode_e
|
||||
{
|
||||
/** Normal value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_NORMAL = 0x00,
|
||||
/** Configure value */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_CONFIGURE = 0x01,
|
||||
/** Reserved values */
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_RESERVED = 0x02
|
||||
};
|
||||
|
||||
/** @cond internals_doc */
|
||||
typedef struct zb_zcl_shade_set_value_param_s
|
||||
{
|
||||
zb_uint16_t new_value;
|
||||
zb_bool_t is_config;
|
||||
} zb_zcl_shade_set_value_param_t;
|
||||
|
||||
typedef struct zb_zcl_shade_get_value_param_s
|
||||
{
|
||||
zb_uint16_t ret_value;
|
||||
} zb_zcl_shade_get_value_param_t;
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Default value for Shade Configuration cluster revision global attribute */
|
||||
#define ZB_ZCL_SHADE_CONFIG_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Shade Configuration Status attribute default value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_STATUS_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief ClosedLimit attribute default value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_CLOSED_LIMIT_DEFAULT_VALUE 0x0001
|
||||
|
||||
/** @brief Zero Point attribute default value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_ZERO_POINT_DEFAULT_VALUE 0x0000
|
||||
|
||||
/** @brief Mode attribute default value */
|
||||
#define ZB_ZCL_SHADE_CONFIG_MODE_DEFAULT_VALUE ZB_ZCL_ATTR_SHADE_CONFIG_MODE_NORMAL
|
||||
|
||||
/** @brief Declare attribute list for Shade Configuration cluster
|
||||
@param attr_list - attribute list name
|
||||
@param status - pointer to variable to store Status attribute value
|
||||
@param closed_limit - pointer to variable to store ClosedLimit attribute value
|
||||
@param mode - pointer to variable to store Mode attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_SHADE_CONFIG_ATTRIB_LIST(attr_list, status, closed_limit, mode) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_SHADE_CONFIG) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_ID, (status)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SHADE_CONFIG_CLOSED_LIMIT_ID, (closed_limit)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SHADE_CONFIG_MODE_ID, (mode)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* Shade Configuration cluster attributes */
|
||||
|
||||
/* Descriptors for server side */
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** @name Shade Configuration cluster internals
|
||||
Internal structures for Shade Configuration cluster
|
||||
@internal
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_STATUS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SHADE_CONFIG_CLOSED_LIMIT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_CLOSED_LIMIT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SHADE_CONFIG_MODE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Number of attributes mandatory for reporting in Shade Configuration cluster */
|
||||
#define ZB_ZCL_SHADE_CONFIG_REPORT_ATTR_COUNT 0
|
||||
|
||||
|
||||
/** Macro for setting Mode attribute
|
||||
@param ep - endpoint id
|
||||
@param mode_val - mode value
|
||||
*/
|
||||
|
||||
/** @brief Shade Configuration cluster command identifiers
|
||||
@see ZCL spec, subclause ?
|
||||
*/
|
||||
/*enum zb_zcl_shade_config_cmd_e
|
||||
{
|
||||
|
||||
};*/
|
||||
|
||||
/** Mandatory commands defines */
|
||||
|
||||
/*! @internal Setting Shade Mode value macro:
|
||||
@param ep - endpoint where setting
|
||||
@param mode_val - Shade Mode value
|
||||
*/
|
||||
|
||||
#define ZB_ZCL_SHADE_SET_MODE(ep, mode_val) \
|
||||
{ \
|
||||
zb_uint8_t mode = (mode_val); \
|
||||
ZB_ZCL_SET_ATTRIBUTE((ep), \
|
||||
ZB_ZCL_CLUSTER_ID_SHADE_CONFIG, \
|
||||
ZB_ZCL_ATTR_SHADE_CONFIG_MODE_ID, \
|
||||
&mode, \
|
||||
ZB_FALSE); \
|
||||
}
|
||||
|
||||
/** @} */ /* Shade Configuration cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @name Shade Configuration cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
/** @} */ /* Shade Configuration cluster commands */
|
||||
|
||||
/** @} */ /* ZCL Shade Configuration cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_shade_config_init_server(void);
|
||||
void zb_zcl_shade_config_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_SHADE_CONFIG_SERVER_ROLE_INIT zb_zcl_shade_config_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_SHADE_CONFIG_CLIENT_ROLE_INIT zb_zcl_shade_config_init_client
|
||||
|
||||
#endif /* ZB_ZCL_SHADE_CONFIG_H */
|
||||
@@ -0,0 +1,405 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Sub-GHz cluster definitions
|
||||
*/
|
||||
#ifndef ZB_ZCL_SUBGHZ_H
|
||||
#define ZB_ZCL_SUBGHZ_H 1
|
||||
|
||||
#if defined ZB_ZCL_SUPPORT_CLUSTER_SUBGHZ || defined DOXYGEN
|
||||
|
||||
#include "zboss_api_core.h" /* ZBOSS core API types */
|
||||
#include "zb_zcl_common.h"
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_SUBGHZ_FEATURE) */
|
||||
|
||||
/** @addtogroup ZB_ZCL_SUBGHZ
|
||||
* @{
|
||||
* @details This cluster provides attributes and commands specific to the use of Sub-GHz frequencies
|
||||
* for a Smart Energy network.
|
||||
*/
|
||||
|
||||
/** @defgroup ZB_ZCL_SUBGHZ_ATTRS Sub-GHz cluster attributes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Sub-GHz cluster's server-side attributes
|
||||
* @see SE spec, subclause 14.2.2
|
||||
*/
|
||||
typedef enum zb_zcl_subghz_srv_attr_e
|
||||
{
|
||||
ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE = 0x0000, /**< This is a 32-bit channel mask that defines
|
||||
* the sub-GHz channel that the Coordinator’s
|
||||
* Network Manager intends to move to.
|
||||
* @par Value format
|
||||
* bits 0..26 - channel number
|
||||
* bits 27..31 - channel page number
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE28_CHANNEL_MASK = 0x0001, /**< This is a 32-bit channel mask that defines
|
||||
* the channels that are to be scanned when
|
||||
* forming, joining or re-joining a network.
|
||||
* Page 28 defines the first 27 channels within
|
||||
* the 863-876MHz frequency band.
|
||||
* @par Value format
|
||||
* bits 0..26 - channel numbers bitmask
|
||||
* bits 27..31 - page number (28 == 0b11100)
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE29_CHANNEL_MASK = 0x0002, /**< This is a 32-bit channel mask that defines
|
||||
* the channels that are to be scanned when
|
||||
* forming, joining or re-joining a network.
|
||||
* Page 29 defines channels 27 to 34 and channel
|
||||
* 62 of the 863-876MHz frequency band.
|
||||
* @par Value format
|
||||
* bits 0..8 - channel numbers bitmask
|
||||
* bits 9..26 - unused (set to 0)
|
||||
* bits 27..31 - page number (29 == 0b11101)
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE30_CHANNEL_MASK = 0x0003, /**< This is a 32-bit channel mask that defines
|
||||
* the channels that are to be scanned when
|
||||
* forming, joining or re-joining a network.
|
||||
* Page 30 defines channels 35 to 61 of the
|
||||
* 863-876MHz frequency band.
|
||||
* @par Value format
|
||||
* bits 0..26 - channel numbers bitmask
|
||||
* bits 27..31 - page number (30 == 0b11110)
|
||||
*/
|
||||
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE31_CHANNEL_MASK = 0x0004 /**< This is a 32-bit channel mask that defines
|
||||
* the channels that are to be scanned when
|
||||
* forming, joining or re-joining a network.
|
||||
* Page 31 defines the 27 channels within the
|
||||
* 915-921MHz frequency band.
|
||||
* @par Value format
|
||||
* bits 0..26 - channel numbers bitmask
|
||||
* bits 27..31 - page numbers (31 == 0b11111)
|
||||
*/
|
||||
} zb_zcl_subghz_svr_attr_t;
|
||||
|
||||
/** @brief Default value for Sub-GHz cluster revision global attribute (not defined anywhere) */
|
||||
#define ZB_ZCL_SUBGHZ_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
#ifndef ZB_ED_ROLE
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SUBGHZ_PAGE28_CHANNEL_MASK(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE28_CHANNEL_MASK, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SUBGHZ_PAGE29_CHANNEL_MASK(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE29_CHANNEL_MASK, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SUBGHZ_PAGE30_CHANNEL_MASK(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE30_CHANNEL_MASK, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_SUBGHZ_PAGE31_CHANNEL_MASK(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_SUBGHZ_PAGE31_CHANNEL_MASK, \
|
||||
ZB_ZCL_ATTR_TYPE_32BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** @def ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST(attr_list, channel_change)
|
||||
* @brief Declares mandatory attributes list for Sub-GHz cluster server
|
||||
* @param[in] attr_list - attribute list name
|
||||
* @param[in] channel_change - pointer to variable which will store ChannelChange attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST_PARTIAL(attr_list, channel_change) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_SUBGHZ) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE, (channel_change)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
|
||||
/** @def ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST_FULL(attr_list, channel_change, page28_channel_mask, page29_channel_mask, page30_channel_mask, page31_channel_mask)
|
||||
* @brief Declares mandatory and all optional attributes list for Sub-GHz cluster server
|
||||
* @param[in] attr_list - attribute list name
|
||||
* @param[in] channel_change - pointer to variable which will store ChannelChange attribute value
|
||||
* @param[in] page28_channel_mask - pointer to variable which will store Page28ChannelMask attribute value
|
||||
* @param[in] page29_channel_mask - pointer to variable which will store Page29ChannelMask attribute value
|
||||
* @param[in] page30_channel_mask - pointer to variable which will store Page30ChannelMask attribute value
|
||||
* @param[in] page31_channel_mask - pointer to variable which will store Page31ChannelMask attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST_FULL(attr_list, channel_change, page28_channel_mask, page29_channel_mask, page30_channel_mask, page31_channel_mask) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_SUBGHZ) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE, (channel_change)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_PAGE28_CHANNEL_MASK, (page28_channel_mask)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_PAGE29_CHANNEL_MASK, (page29_channel_mask)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_PAGE30_CHANNEL_MASK, (page30_channel_mask)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_SUBGHZ_PAGE31_CHANNEL_MASK, (page31_channel_mask)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sub GHz cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_sub_ghz_attrs_s
|
||||
{
|
||||
|
||||
/** @see ZB_ZCL_ATTR_SUBGHZ_CHANNEL_CHANGE
|
||||
*/
|
||||
zb_uint32_t channel_change;
|
||||
|
||||
/** @see ZB_ZCL_ATTR_SUBGHZ_PAGE28_CHANNEL_MASK
|
||||
*/
|
||||
zb_uint32_t page28_channel_mask;
|
||||
|
||||
/** @see ZB_ZCL_ATTR_SUBGHZ_PAGE29_CHANNEL_MASK
|
||||
*/
|
||||
zb_uint32_t page29_channel_mask;
|
||||
|
||||
/** @see ZB_ZCL_ATTR_SUBGHZ_PAGE30_CHANNEL_MASK
|
||||
*/
|
||||
zb_uint32_t page30_channel_mask;
|
||||
|
||||
/** @see ZB_ZCL_ATTR_SUBGHZ_PAGE31_CHANNEL_MASK
|
||||
*/
|
||||
zb_uint32_t page31_channel_mask;
|
||||
}
|
||||
zb_zcl_sub_ghz_attrs_t;
|
||||
|
||||
|
||||
/** Declare attribute list for Sub-GHz cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - pointer to @ref zb_zcl_sub_ghz_attrs_s structure
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_SUBGHZ_SRV_ATTR_LIST_FULL(attr_list, &attrs.channel_change, &attrs.page28_channel_mask, &attrs.page29_channel_mask, &attrs.page30_channel_mask, &attrs.page31_channel_mask)
|
||||
|
||||
#endif /* !ZB_ED_ROLE */
|
||||
|
||||
/** @} */ /* ZB_ZCL_SUBGHZ_ATTRS */
|
||||
|
||||
/** @defgroup ZB_ZCL_SUBGHZ_COMMANDS Sub-GHz cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Sub-GHz cluster's server-side commands IDs
|
||||
* @see SE spec, subclause 14.2.3
|
||||
*/
|
||||
typedef enum zb_zcl_subghz_srv_cmd_e
|
||||
{
|
||||
ZB_ZCL_SUBGHZ_SRV_CMD_SUSPEND_ZCL_MESSAGES = 0x00 /**< The @b SuspendZCLMessages command is sent to
|
||||
* client device(s) by the server device when the
|
||||
* server device has determined that the client
|
||||
* device(s) shall suspend their ZCL communications
|
||||
* to the server device for the period stated in
|
||||
* the command. The command is also sent in response
|
||||
* to a @b GetSuspendZCLMessagesStatus command.
|
||||
* @note This command is sent automatically by SubGHz
|
||||
* cluster and is not available in the application.
|
||||
*/
|
||||
} zb_zcl_subghz_srv_cmd_t;
|
||||
|
||||
|
||||
/** @brief @ref ZB_ZCL_SUBGHZ_SRV_CMD_SUSPEND_ZCL_MESSAGES "SuspendZCLMessages" command payload
|
||||
* @details An unsigned 8-bit integer indicating the period, in minutes, during which ZCL
|
||||
* communications from the device shall be suspended. A value of zero shall indicate that ZCL
|
||||
* communications are not currently suspended.
|
||||
* @see SE spec, subclause 14.2.3.1
|
||||
*/
|
||||
typedef zb_uint8_t zb_zcl_subghz_suspend_zcl_msg_payload_t;
|
||||
|
||||
|
||||
/** @brief Sub-GHz cluster's cliend-side commands IDs
|
||||
* @see SE spec, subclause 14.3.3
|
||||
*/
|
||||
typedef enum zb_zcl_subghz_cli_cmd_e
|
||||
{
|
||||
ZB_ZCL_SUBGHZ_CLI_CMD_GET_SUSPEND_ZCL_MESSAGES_STATUS = 0x00 /**< The @b GetSuspendZCLMessagesStatus
|
||||
* command allows a client device to
|
||||
* request the current status of its
|
||||
* ZCL communications with the server.
|
||||
* @note This command is Mandatory for BOMDs.
|
||||
*/
|
||||
} zb_zcl_subghz_cli_cmd_t;
|
||||
|
||||
/* SUBGHZ cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_SUBGHZ_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_SUBGHZ_SRV_CMD_SUSPEND_ZCL_MESSAGES
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_SUBGHZ_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_SUBGHZ_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_SUBGHZ_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_SUBGHZ_CLI_CMD_GET_SUSPEND_ZCL_MESSAGES_STATUS
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_SUBGHZ_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_SUBGHZ_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/** @brief Server-side Sub-GHz cluster context
|
||||
*/
|
||||
typedef struct zb_zcl_subghz_srv_ctx_s
|
||||
{
|
||||
/* FIXME: rewrite to exclude additional memory usage. */
|
||||
zb_address_ieee_ref_t dev_list[ZB_NEIGHBOR_TABLE_SIZE]; /**< ref list to Sub-GHz devices in neighbor table */
|
||||
zb_uint8_t mode; /**< MAC Duty Cycle Mode */
|
||||
} zb_zcl_subghz_srv_ctx_t;
|
||||
|
||||
/** @brief Client-side Sub-GHz cluster context
|
||||
*/
|
||||
typedef struct zb_zcl_subghz_cli_ctx_s
|
||||
{
|
||||
zb_uint8_t zc_ep; /**< endpoint with Sub-GHz cluster on Coordinator */
|
||||
zb_bool_t suspend_zcl_messages; /**< if TRUE, device is suspended by Coordinator */
|
||||
} zb_zcl_subghz_cli_ctx_t;
|
||||
|
||||
/** @brief Sub-GHz cluster context
|
||||
*/
|
||||
typedef struct zb_zcl_subghz_ctx_s
|
||||
{
|
||||
#ifndef ZB_ED_ROLE
|
||||
zb_zcl_subghz_srv_ctx_t srv; /**< server context */
|
||||
#endif
|
||||
zb_zcl_subghz_cli_ctx_t cli; /**< client context */
|
||||
|
||||
/* common fields */
|
||||
zb_uint8_t ep; /**< endpoint of Sub-GHz cluster on this device */
|
||||
} zb_zcl_subghz_ctx_t;
|
||||
|
||||
/** @fn void zb_subghz_cli_get_suspend_zcl_messages_status(zb_uint8_t param, zb_addr_u *dst_addr, zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep, zb_uint8_t src_ep)
|
||||
* @brief Sends @b GetSuspendZCLMessagesStatus client command
|
||||
* @param[in] param - reference to the buffer to be used for outgoing packet
|
||||
* @param[in] dst_addr - Coordinator's address (either short or long)
|
||||
* @param[in] dst_addr_mode - address mode (see @ref aps_addr_mode)
|
||||
* @param[in] dst_ep - endpoint address of Sub-GHz cluster on Coordinator
|
||||
* @param[in] src_ep - endpoint address of Sub-GHz cluster on this device
|
||||
*/
|
||||
void zb_subghz_cli_get_suspend_zcl_messages_status(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep);
|
||||
|
||||
/** @fn void zb_subghz_srv_suspend_zcl_messages(zb_uint8_t param, zb_addr_u *dst_addr, zb_uint8_t dst_addr_mode, zb_uint8_t dst_ep, zb_uint8_t src_ep, zb_zcl_subghz_suspend_zcl_msg_payload_t *payload)
|
||||
* @brief Sends @b SuspendZCLMessages server command
|
||||
*/
|
||||
void zb_subghz_srv_suspend_zcl_messages(zb_uint8_t param,
|
||||
zb_addr_u *dst_addr,
|
||||
zb_uint8_t dst_addr_mode,
|
||||
zb_uint8_t dst_ep,
|
||||
zb_uint8_t src_ep,
|
||||
zb_zcl_subghz_suspend_zcl_msg_payload_t *payload);
|
||||
|
||||
|
||||
zb_bool_t zb_subghz_srv_device_suspended(zb_uint16_t addr);
|
||||
|
||||
/* TODO: Not implemented yet, disabling it for now to avoid MISRA violations */
|
||||
#if 0
|
||||
/** @fn zb_bool_t zb_zcl_process_subghz_specific_commands(zb_uint8_t param)
|
||||
* @brief Internal handler for Sub-GHz specific commands
|
||||
* @param[in] param - reference to the buffer containing incoming command
|
||||
* @returns ZB_TRUE, if command was processed by Sub-GHz cluster, ZB_FALSE otherwise
|
||||
*/
|
||||
zb_bool_t zb_zcl_process_subghz_specific_commands(zb_uint8_t param);
|
||||
#endif
|
||||
|
||||
/**
|
||||
Start (or continue) polling ZC by Get Suspend ZCL Message Status
|
||||
*/
|
||||
void zb_subghz_start_suspend_status_poll(zb_uint8_t param);
|
||||
|
||||
zb_bool_t zb_subghz_catch_ota_image_block_req(zb_uint8_t *paramp);
|
||||
|
||||
#ifdef ZB_SUSPEND_APSDE_DATAREQ_BY_SUBGHZ_CLUSTER
|
||||
/* Internal function for cancelling all APS outgoing transactions,
|
||||
* called from zb_subghz_cli_suspend_zcl_messages when it receives a suspend command
|
||||
*/
|
||||
void zb_aps_cancel_outgoing_trans(zb_uint8_t param);
|
||||
#endif /* ZB_SUSPEND_APSDE_DATAREQ_BY_SUBGHZ_CLUSTER */
|
||||
|
||||
#endif /* if defined ZB_ZCL_SUPPORT_CLUSTER_SUBGHZ || defined DOXYGEN */
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/** @} */ /* ZB_ZCL_SUBGHZ_COMMANDS */
|
||||
|
||||
/** @} */ /* ZB_ZCL_SUBGHZ */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION && DOXYGEN_SUBGHZ_FEATURE */
|
||||
|
||||
#ifdef ZB_ZCL_SUPPORT_CLUSTER_SUBGHZ
|
||||
void zb_zcl_subghz_init_server(void);
|
||||
void zb_zcl_subghz_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_SUB_GHZ_SERVER_ROLE_INIT zb_zcl_subghz_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_SUB_GHZ_CLIENT_ROLE_INIT zb_zcl_subghz_init_client
|
||||
#endif /* ZB_ZCL_SUPPORT_CLUSTER_SUBGHZ */
|
||||
|
||||
#ifdef ZB_ENABLE_SE
|
||||
#define ZB_ZCL_SUBGHZ_CLUSTER_PROFILE_ID() (ZB_SE_MODE() ?\
|
||||
ZB_AF_SE_PROFILE_ID : \
|
||||
ZB_AF_HA_PROFILE_ID)
|
||||
#else
|
||||
#define ZB_ZCL_SUBGHZ_CLUSTER_PROFILE_ID() (ZB_AF_HA_PROFILE_ID)
|
||||
#endif /* ZB_ENABLE_SE */
|
||||
|
||||
|
||||
#endif /* ZB_ZCL_SUBGHZ_H */
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Temperature Measurement cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_TEMP_MEASUREMENT_H
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_TEMP_MEASUREMENT
|
||||
* @{
|
||||
* @details
|
||||
* All commands in the cluster have only request form, and carry no payload.
|
||||
*/
|
||||
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT */
|
||||
|
||||
/*! @name Temperature Measurement cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Temperature Measurement cluster attribute identifiers
|
||||
@see ZCL spec, Temperature Measurement Cluster 4.4.2.2.1
|
||||
*/
|
||||
enum zb_zcl_temp_measurement_attr_e
|
||||
{
|
||||
/*! @brief MeasuredValue, ZCL spec 4.4.2.2.1.1 */
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID = 0x0000,
|
||||
/*! @brief MinMeasuredValue, ZCL spec 4.4.2.2.1.2 */
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_ID = 0x0001,
|
||||
/*! @brief MaxMeasuredValue, ZCL spec 4.4.2.2.1.3 */
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_ID = 0x0002,
|
||||
/*! @brief Tolerance, ZCL spec 4.4.2.2.1.4 */
|
||||
#ifndef ZB_DISABLE_TEMP_MEASUREMENT_TOLERANCE_ID
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID = 0x0003,
|
||||
#else
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID = 0xF003,
|
||||
#endif
|
||||
};
|
||||
|
||||
/** @brief Default value for Temperature Measurement cluster revision global attribute */
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0003u)
|
||||
|
||||
/** @brief MeasuredValue attribute unknown value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_UNKNOWN ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MinMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_MIN_VALUE ((zb_int16_t)0x954d)
|
||||
|
||||
/** @brief MinMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_MAX_VALUE 0x7ffe
|
||||
|
||||
/** @brief MinMeasuredValue attribute invalid value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_INVALID ((zb_int16_t)0x8000)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_MIN_VALUE ((zb_int16_t)0x954e)
|
||||
|
||||
/** @brief MaxMeasuredValue attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_MAX_VALUE 0x7fff
|
||||
|
||||
/** @brief MaxMeasuredValue attribute invalid value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_INVALID ((zb_int16_t)0x8000)
|
||||
|
||||
|
||||
/* (See: Table 4-13 Temperature Measurement Information Attribute Set) */
|
||||
|
||||
/** @brief Tolerance attribute minimum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_MIN_VALUE 0x0000
|
||||
|
||||
/** @brief Tolerance attribute maximum value */
|
||||
#define ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_MAX_VALUE 0x0800
|
||||
|
||||
/** @brief Default value for Value attribute */
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_VALUE_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for MinValue attribute */
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_MIN_VALUE_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @brief Default value for MaxValue attribute */
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_MAX_VALUE_DEFAULT_VALUE ZB_ZCL_NON_VALUE_INT16
|
||||
|
||||
/** @cond internals_doc */
|
||||
/*! @internal @name Temperature Measurement cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U16, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Temperature Measurement cluster */
|
||||
#define ZB_ZCL_TEMP_MEASUREMENT_REPORT_ATTR_COUNT 1
|
||||
|
||||
/*! Write attribute hook is used to set min/max temperature values */
|
||||
void zb_zcl_temp_measurement_write_attr_hook(
|
||||
zb_uint8_t endpoint, zb_uint16_t attr_id, zb_uint8_t *new_value);
|
||||
|
||||
/*! @} */ /* Temperature Measurement cluster internals */
|
||||
/*! @}
|
||||
* @endcond */ /* internals_doc */
|
||||
|
||||
/** @brief Declare attribute list for Temperature Measurement cluster - server side
|
||||
@param attr_list - attribute list name
|
||||
@param value - pointer to variable to store MeasuredValue attribute
|
||||
@param min_value - pointer to variable to store MinMeasuredValue attribute
|
||||
@param max_value - pointer to variable to store MAxMeasuredValue attribute
|
||||
@param tolerance - pointer to variable to store Tolerance attribute
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_TEMP_MEASUREMENT_ATTRIB_LIST(attr_list, \
|
||||
value, min_value, max_value, tolerance) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_TEMP_MEASUREMENT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID, (value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_ID, (min_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_ID, (max_value)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID, (tolerance)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Temperature Measurement cluster attributes */
|
||||
|
||||
/*! @name Temperature Measurement cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Temperature Measurement cluster commands */
|
||||
|
||||
/*! @} */ /* ZCL Temperature Measurement cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_temp_measurement_init_server(void);
|
||||
void zb_zcl_temp_measurement_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT_SERVER_ROLE_INIT zb_zcl_temp_measurement_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT_CLIENT_ROLE_INIT zb_zcl_temp_measurement_init_client
|
||||
|
||||
|
||||
#endif /* ZB_ZCL_TEMP_MEASUREMENT_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Thermostat UI Configuration cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_THERMOSTAT_UI_CONFIG_H
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_THERMOSTAT_UI_CONFIG */
|
||||
|
||||
/*! @addtogroup ZB_ZCL_THERMOSTAT_UI_CONFIG
|
||||
@{
|
||||
@name Thermostat UI Configuration cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Thermostat UI Configuration cluster attribute identifiers
|
||||
@see ZCL spec, subclause 6.6.2.2
|
||||
*/
|
||||
enum zb_zcl_thermostat_ui_config_attr_e
|
||||
{
|
||||
/** @brief Temperature Display Mode attribute */
|
||||
ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_ID = 0x0000,
|
||||
/** @brief Keypad Lockout attribute */
|
||||
ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_ID = 0x0001,
|
||||
/** The ScheduleProgrammingVisibility attribute is used to hide the weekly
|
||||
* schedule programming functionality or menu on a thermostat from a user
|
||||
* to prevent local user programming of the weekly schedule. */
|
||||
ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_SCHEDULE_PROGRAMMING_VISIBILITY_ID = 0x0002,
|
||||
};
|
||||
|
||||
/*! @brief Values for Temperature Display Mode attribute,
|
||||
@see ZCL spec, subclause 6.6.2.2.1 */
|
||||
enum zb_zcl_thermostat_ui_config_temperature_display_mode_e
|
||||
{
|
||||
/*! Temperature in C value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_IN_C = 0x00,
|
||||
/*! Temperature in F value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_IN_F = 0x01,
|
||||
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_RESERVED = 0x02
|
||||
};
|
||||
|
||||
/*! @brief Values for Keypad Lockout attribute,
|
||||
@see ZCL spec, subclause 6.6.2.2.2 */
|
||||
enum zb_zcl_thermostat_ui_config_keypad_lockout_e
|
||||
{
|
||||
/*! No Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_NO_LOCKOUT = 0x00,
|
||||
/*! Level 1 Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_LEVEL_1 = 0x01,
|
||||
/*! Level 2 Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_LEVEL_2 = 0x02,
|
||||
/*! Level 3 Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_LEVEL_3 = 0x03,
|
||||
/*! Level 4 Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_LEVEL_4 = 0x04,
|
||||
/*! Level 5 Lockout value */
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_LEVEL_5 = 0x05,
|
||||
|
||||
ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_RESERVED = 0x06
|
||||
};
|
||||
|
||||
/** @brief Default value for Thermostat UI Configuration cluster revision global attribute */
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0001u)
|
||||
|
||||
/** @brief Default value for Temperature Display Mode attribute */
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for Keypad Lockout attribute */
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for ScheduleProgrammingVisibility attribute */
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_SCHEDULE_PROGRAMMING_VISIBILITY_DEFAULT_VALUE ((zb_uint8_t)0x00)
|
||||
|
||||
/** @brief Declare attribute list for Thermostat UI Configuration cluster
|
||||
@param attr_list - attribute list name
|
||||
@param temperature_display_mode - pointer to variable to store Temperature Display Mode attribute value
|
||||
@param keypad_lockout - pointer to variable to store Keypad Lockout attribute value
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_THERMOSTAT_UI_CONFIG_ATTRIB_LIST(attr_list, temperature_display_mode, keypad_lockout) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_THERMOSTAT) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_ID, (temperature_display_mode)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_ID, (keypad_lockout)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/*! @} */ /* Thermostat UI Configuration cluster attributes */
|
||||
|
||||
/*! @name Thermostat UI Configuration cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @} */ /* Thermostat UI Configuration cluster commands */
|
||||
|
||||
/*! @cond internals_doc
|
||||
@internal @name Thermostat UI Configuration cluster internals
|
||||
Internal structures for attribute representation in cluster definitions.
|
||||
@{
|
||||
*/
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_TEMPERATURE_DISPLAY_MODE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_THERMOSTAT_UI_CONFIG_KEYPAD_LOCKOUT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BIT_ENUM, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Thermostat UI Configuration cluster */
|
||||
#define ZB_ZCL_THERMOSTAT_UI_CONFIG_REPORT_ATTR_COUNT 0
|
||||
|
||||
/*! @}
|
||||
@endcond */ /* Thermostat UI Configuration cluster internals */
|
||||
|
||||
/*! @} */ /* ZCL HA Thermostat UI Configuration cluster definitions */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_thermostat_ui_config_init_server(void);
|
||||
void zb_zcl_thermostat_ui_config_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_THERMOSTAT_UI_CONFIG_SERVER_ROLE_INIT zb_zcl_thermostat_ui_config_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_THERMOSTAT_UI_CONFIG_CLIENT_ROLE_INIT zb_zcl_thermostat_ui_config_init_client
|
||||
|
||||
#endif /* ZB_ZCL_THERMOSTAT_UI_CONFIG_H */
|
||||
@@ -0,0 +1,491 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: Time cluster definitions
|
||||
*/
|
||||
|
||||
#ifndef ZB_ZCL_TIME_H
|
||||
#define ZB_ZCL_TIME_H 1
|
||||
|
||||
#include "zcl/zb_zcl_common.h"
|
||||
#include "zcl/zb_zcl_commands.h"
|
||||
|
||||
|
||||
/** @cond DOXYGEN_ZCL_SECTION */
|
||||
|
||||
/** @addtogroup ZB_ZCL_TIME ZCL Time cluster
|
||||
* @{
|
||||
* @details
|
||||
*/
|
||||
|
||||
/* Cluster ZB_ZCL_CLUSTER_ID_TIME */
|
||||
|
||||
/**
|
||||
* @brief Set real time clock callback
|
||||
* @param[in] time - UTC time at which real time clock will be set
|
||||
* @return ZB_TRUE if real time clock was set to new value and ZB_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
typedef zb_bool_t (*zb_zcl_time_set_real_time_clock_t)(zb_uint32_t time);
|
||||
|
||||
/** @cond internals_doc */
|
||||
|
||||
/**
|
||||
* @brief Set user's callback that will be initialize real time clock on device by
|
||||
* specified value.
|
||||
* @param[in] cb - Callback function
|
||||
* @see zb_zcl_time_set_real_time_clock_t
|
||||
*
|
||||
*/
|
||||
void zb_zcl_set_real_time_clock_callback(zb_zcl_time_set_real_time_clock_t cb);
|
||||
|
||||
/* typedef struct */
|
||||
|
||||
/** This enum defines possible authoritative levels of time server */
|
||||
enum time_server_authoritative_level_e
|
||||
{
|
||||
ZB_ZCL_TIME_SERVER_NOT_CHOSEN = 0,
|
||||
ZB_ZCL_TIME_HAS_SYNCHRONIZED_BIT,
|
||||
ZB_ZCL_TIME_HAS_MASTER_BIT,
|
||||
ZB_ZCL_TIME_HAS_MASTER_AND_SUPERSEDING_BITS,
|
||||
ZB_ZCL_TIME_COORDINATOR_WITH_MASTER_AND_SUPERSEDING_BITS
|
||||
};
|
||||
|
||||
/** Time synchronization payload */
|
||||
typedef struct zb_zcl_time_sync_payload_s
|
||||
{
|
||||
/** Network time received from the most authoritative Time server */
|
||||
zb_uint32_t time;
|
||||
/** Source address of the most authoritative Time server */
|
||||
zb_uint16_t addr;
|
||||
/** Source endpoint of the most authoritative Time server */
|
||||
zb_uint8_t endpoint;
|
||||
/** Authoritative level of Time source server.
|
||||
* @see @ref time_server_authoritative_level_e
|
||||
*/
|
||||
zb_uint8_t level;
|
||||
} zb_zcl_time_sync_payload_t;
|
||||
|
||||
/** @endcond */ /* internals_doc */
|
||||
|
||||
/**
|
||||
* @brief 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 ZCL spec, subclause 3.12.2.2.1
|
||||
*
|
||||
*/
|
||||
#define ZB_ZCL_TIME_SET_REAL_TIME_CLOCK_CB(func_ptr) (zb_zcl_set_real_time_clock_callback((func_ptr)))
|
||||
|
||||
|
||||
#define ZB_TIME_COMPARE_AUTH_LEVEL(new_level, new_short_addr, old_level, old_short_addr) \
|
||||
(((new_level) > (old_level)) || \
|
||||
(((old_level) > ZB_ZCL_TIME_SERVER_NOT_CHOSEN) && \
|
||||
((new_level) == (old_level)) && \
|
||||
((new_short_addr) < (old_short_addr))))
|
||||
|
||||
|
||||
/**
|
||||
* @brief Callback to call when new time server found during synchronization.
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Start time synchronization.
|
||||
* @param endpoint endpoint for each time server synchronization shall be started.
|
||||
* @param cb callback that will be called on each successful time server discovery.
|
||||
* @details 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.
|
||||
*/
|
||||
void zb_zcl_time_server_synchronize(zb_uint8_t endpoint, zb_zcl_time_sync_time_server_found_cb_t cb);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle read attribute response for time cluster.
|
||||
* @details Handles read attribute response while time synchronization process running.
|
||||
* If time synchronization process is not started or finished there will be no processing.
|
||||
*/
|
||||
zb_bool_t zb_zcl_time_server_read_attr_handle(zb_uint8_t param);
|
||||
|
||||
|
||||
/** @defgroup ZB_ZCL_TIME_ATTRS Time cluster attributes
|
||||
@{
|
||||
*/
|
||||
|
||||
/*! @brief Time cluster attribute identifiers
|
||||
@see ZCL spec, subclause 3.12.2.2
|
||||
*/
|
||||
enum zb_zcl_time_attr_e
|
||||
{
|
||||
/*! @brief Time attribute */
|
||||
ZB_ZCL_ATTR_TIME_TIME_ID = 0x0000,
|
||||
/*! @brief Time Status attribute */
|
||||
ZB_ZCL_ATTR_TIME_TIME_STATUS_ID = 0x0001,
|
||||
/*! @brief Time Zone attribute */
|
||||
ZB_ZCL_ATTR_TIME_TIME_ZONE_ID = 0x0002,
|
||||
/*! @brief Dst Start attribute */
|
||||
ZB_ZCL_ATTR_TIME_DST_START_ID = 0x0003,
|
||||
/*! @brief Dst End attribute */
|
||||
ZB_ZCL_ATTR_TIME_DST_END_ID = 0x0004,
|
||||
/*! @brief Dst Shift attribute */
|
||||
ZB_ZCL_ATTR_TIME_DST_SHIFT_ID = 0x0005,
|
||||
/*! @brief Standard Time attribute */
|
||||
ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID = 0x0006,
|
||||
/*! @brief Local Time attribute */
|
||||
ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID = 0x0007,
|
||||
/*! @brief Last Set Time attribute */
|
||||
ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID = 0x0008,
|
||||
/*! @brief Valid Until Time attribute */
|
||||
ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID = 0x0009
|
||||
};
|
||||
|
||||
/*! @brief Permissible values for Time Status attribute,
|
||||
@see ZCL spec, subclause 3.12.2.2.2 */
|
||||
enum zb_zcl_time_time_status_e
|
||||
{
|
||||
/*! Master value */
|
||||
ZB_ZCL_TIME_MASTER = 0,
|
||||
/*! Synchronized value */
|
||||
ZB_ZCL_TIME_SYNCHRONIZED = 1,
|
||||
/*! Master Zone Dst value */
|
||||
ZB_ZCL_TIME_MASTER_ZONE_DST = 2,
|
||||
/*! Superseding value */
|
||||
ZB_ZCL_TIME_SUPERSEDING = 3
|
||||
};
|
||||
|
||||
|
||||
/** Check if @e Master bit of @ref zb_zcl_time_attr_e::ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute is set.
|
||||
* @param val - 8-bit that contains value of @e TimeStatus attribute
|
||||
* @return zb_uint8_t value greater then 0 if @e Master bit is set, and return 0 otherwise.
|
||||
* @see @ref zb_zcl_time_time_status_e
|
||||
*/
|
||||
#define ZB_ZCL_TIME_TIME_STATUS_MASTER_BIT_IS_SET(val) ((val) & (1 << ZB_ZCL_TIME_MASTER))
|
||||
/** Check if @e Synchronized bit of @ref zb_zcl_time_attr_e::ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute is set.
|
||||
* @param val - 8-bit that contains value of @e TimeStatus attribute
|
||||
* @return zb_uint8_t value greater then 0 if @e Synchronized bit is set, and return 0 otherwise.
|
||||
* @see @ref zb_zcl_time_time_status_e
|
||||
*/
|
||||
#define ZB_ZCL_TIME_TIME_STATUS_SYNCHRONIZED_BIT_IS_SET(val) ((val) & (1 << ZB_ZCL_TIME_SYNCHRONIZED))
|
||||
/** Check if MasterZoneDST bit of @ref zb_zcl_time_attr_e::ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute is set.
|
||||
* @param val - 8-bit that contains value of @e TimeStatus attribute
|
||||
* @return zb_uint8_t value greater then 0 if @e MasterZoneDST bit is set, and return 0 otherwise.
|
||||
* @see @ref zb_zcl_time_time_status_e
|
||||
*/
|
||||
#define ZB_ZCL_TIME_TIME_STATUS_MASTER_ZONE_DST_BIT_IS_SET(val) ((val) & (1 << ZB_ZCL_TIME_MASTER_ZONE_DST))
|
||||
/** Check if Superseding bit of @ref zb_zcl_time_attr_e::ZB_ZCL_ATTR_TIME_TIME_STATUS_ID "TimeStatus" attribute is set.
|
||||
* @param val - 8-bit that contains value of @e TimeStatus attribute
|
||||
* @return zb_uint8_t value greater then 0 if @e Superseding bit is set, and return 0 otherwise.
|
||||
* @see @ref zb_zcl_time_time_status_e
|
||||
*/
|
||||
#define ZB_ZCL_TIME_TIME_STATUS_SUPERSEDING_BIT_IS_SET(val) ((val) & (1 << ZB_ZCL_TIME_SUPERSEDING))
|
||||
|
||||
/** @brief Default value for Time cluster revision global attribute */
|
||||
#define ZB_ZCL_TIME_CLUSTER_REVISION_DEFAULT ((zb_uint16_t)0x0002u)
|
||||
|
||||
/** @brief Invalid value of Time attribute */
|
||||
#define ZB_ZCL_TIME_TIME_INVALID_VALUE ((zb_time_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for Time attribute */
|
||||
#define ZB_ZCL_TIME_TIME_DEFAULT_VALUE ZB_ZCL_TIME_TIME_INVALID_VALUE
|
||||
|
||||
/** @brief Minimum value for Time attribute */
|
||||
#define ZB_ZCL_TIME_TIME_MIN_VALUE ((zb_time_t)0x0)
|
||||
|
||||
/** @brief Maximum value for Time attribute */
|
||||
#define ZB_ZCL_TIME_TIME_MAX_VALUE ((zb_time_t)0xFFFFFFFE)
|
||||
|
||||
/** @brief Default value for Time Status attribute */
|
||||
#define ZB_ZCL_TIME_TIME_STATUS_DEFAULT_VALUE 0x00
|
||||
|
||||
/** @brief Default value for Time Zone attribute */
|
||||
#define ZB_ZCL_TIME_TIME_ZONE_DEFAULT_VALUE 0x00000000
|
||||
|
||||
/** @brief Default value for DstStart attribute */
|
||||
#define ZB_ZCL_TIME_DST_START_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for DstEnd attribute */
|
||||
#define ZB_ZCL_TIME_DST_END_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for Dst Shift attribute */
|
||||
#define ZB_ZCL_TIME_DST_SHIFT_DEFAULT_VALUE 0x00000000
|
||||
|
||||
/** @brief Default value for StandardTime attribute */
|
||||
#define ZB_ZCL_TIME_STANDARD_TIME_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for LocalTime attribute */
|
||||
#define ZB_ZCL_TIME_LOCAL_TIME_DEFAULT_VALUE ((zb_uint32_t)0xFFFFFFFF)
|
||||
|
||||
/** @brief Default value for Last Set Time attribute */
|
||||
#define ZB_ZCL_TIME_LAST_SET_TIME_DEFAULT_VALUE 0xffffffff
|
||||
|
||||
/** @brief Default value for Valid Until Time attribute */
|
||||
#define ZB_ZCL_TIME_VALID_UNTIL_TIME_DEFAULT_VALUE 0xffffffff
|
||||
|
||||
/** @brief Declare attribute list for Time cluster
|
||||
@param attr_list - attribute list name
|
||||
@param time - pointer to variable to store Time attribute value; write-optional acc.to ZCL8, be careful when redefining its handling
|
||||
@param time_status - pointer to variable to store Time Status attribute value; write-optional acc.to ZCL8, be careful when redefining its handling
|
||||
@param time_zone - pointer to variable to store Time Zone attribute value
|
||||
@param dst_start - pointer to variable to store Dst Start attribute value
|
||||
@param dst_end - pointer to variable to store Dst End attribute value
|
||||
@param dst_shift - pointer to variable to store Dst Shift attribute value
|
||||
@param standard_time - pointer to variable to store Standard Time attribute value
|
||||
@param local_time - pointer to variable to store Local Time attribute value
|
||||
@param last_set_time - pointer to variable to store Last Set Time attribute value
|
||||
@param valid_until_time - pointer to variable to store Valid Until Time attribute value
|
||||
|
||||
Time and TimeStatus attributes are Read & Write-Optional acc. to ZCL8 spec.
|
||||
Due to internal implementation specifics Read-Write access mode is used for
|
||||
declaring the attributes, while optional writability is blocked by the stack
|
||||
in runtime automatically according to conditions from ZCL8 spec sections 3.12.2.2.1-3.12.2.2.2.
|
||||
*/
|
||||
#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) \
|
||||
ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_TIME) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_TIME_ID, (time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, (time_status)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_TIME_ZONE_ID, (time_zone)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_DST_START_ID, (dst_start)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_DST_END_ID, (dst_end)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_DST_SHIFT_ID, (dst_shift)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID, (standard_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID, (local_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID, (last_set_time)) \
|
||||
ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID, (valid_until_time)) \
|
||||
ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
|
||||
|
||||
/** @} */ /* ZB_ZCL_TIME_ATTRS */
|
||||
|
||||
/** @defgroup ZB_ZCL_TIME_COMMANDS Time cluster commands
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */ /* ZB_ZCL_TIME_COMMANDS */
|
||||
|
||||
|
||||
/** @cond internals_doc */
|
||||
/** Acc. to ZCL8 Table 3-69 and section 3.12.2.2.1 "Time Attribute" Time attribute is write-optional.
|
||||
* The corresponding conditions are checked in the stack, but be careful when redefining
|
||||
* processing of the attribute in applications.
|
||||
*/
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_UTC_TIME, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/** Acc. to ZCL8 Table 3-69 and section 3.12.2.2.2 "TimeStatus Attribute" TimeStatus attribute is write-optional.
|
||||
* The corresponding conditions are checked in the stack, but be careful when redefining
|
||||
* processing of the attribute in applications.
|
||||
*/
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_TIME_STATUS_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_TIME_STATUS_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_8BITMAP, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_TIME_ZONE_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_TIME_ZONE_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_DST_START_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_DST_START_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_DST_END_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_DST_END_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_DST_SHIFT_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_DST_SHIFT_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_S32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_U32, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_UTC_TIME, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID(data_ptr) \
|
||||
{ \
|
||||
ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID, \
|
||||
ZB_ZCL_ATTR_TYPE_UTC_TIME, \
|
||||
ZB_ZCL_ATTR_ACCESS_READ_WRITE, \
|
||||
(ZB_ZCL_NON_MANUFACTURER_SPECIFIC), \
|
||||
(void*) data_ptr \
|
||||
}
|
||||
|
||||
/*! @internal Number of attributes mandatory for reporting in Time cluster */
|
||||
#define ZB_ZCL_TIME_REPORT_ATTR_COUNT 0
|
||||
|
||||
/** @endcond */ /* Time cluster internals */
|
||||
|
||||
|
||||
/** @struct zb_zcl_time_attrs_s
|
||||
* @brief Time cluster attributes
|
||||
*/
|
||||
typedef struct zb_zcl_time_attrs_s
|
||||
{
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_TIME_ID
|
||||
*/
|
||||
zb_uint32_t time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_TIME_STATUS_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_TIME_STATUS_ID
|
||||
*/
|
||||
zb_uint8_t time_status;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_TIME_ZONE_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_TIME_ZONE_ID
|
||||
*/
|
||||
zb_int32_t time_zone;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_DST_START_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_DST_START_ID
|
||||
*/
|
||||
zb_uint32_t dst_start;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_DST_END_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_DST_END_ID
|
||||
*/
|
||||
zb_uint32_t dst_end;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_DST_SHIFT_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_DST_SHIFT_ID
|
||||
*/
|
||||
zb_uint32_t dst_shift;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_STANDARD_TIME_ID
|
||||
*/
|
||||
zb_uint32_t standard_time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID
|
||||
*/
|
||||
zb_uint32_t local_time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_LAST_SET_TIME_ID
|
||||
*/
|
||||
zb_uint32_t last_set_time;
|
||||
|
||||
/** @copydoc ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID
|
||||
* @see ZB_ZCL_ATTR_TIME_VALID_UNTIL_TIME_ID
|
||||
*/
|
||||
zb_uint32_t valid_until_time;
|
||||
} zb_zcl_time_attrs_t;
|
||||
|
||||
|
||||
/** @brief Declare attribute list for Time cluster
|
||||
* @param[in] attr_list - attribute list variable name
|
||||
* @param[in] attrs - variable of @ref zb_zcl_time_attrs_s type (containing Time cluster attributes)
|
||||
*/
|
||||
#define ZB_ZCL_DECLARE_TIME_ATTR_LIST(attr_list, attrs) \
|
||||
ZB_ZCL_DECLARE_TIME_ATTRIB_LIST(attr_list, \
|
||||
&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 )
|
||||
|
||||
/** @} */ /** ZB_ZCL_TIME */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_time_update_current_time(zb_uint8_t endpoint);
|
||||
|
||||
void zb_zcl_time_init_server(void);
|
||||
void zb_zcl_time_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_TIME_SERVER_ROLE_INIT zb_zcl_time_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_TIME_CLIENT_ROLE_INIT zb_zcl_time_init_client
|
||||
|
||||
#endif /* ZB_ZCL_TIME_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,380 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2022 DSR Corporation, Denver CO, USA
|
||||
* Copyright (c) 2021-2022 Espressif Systems (Shanghai) PTE LTD
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
||||
* integrated circuit in a product or a software update for such product,
|
||||
* must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* 4. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* PURPOSE: ZBOSS specific Tunnel cluster, purpose: general data tunneling.
|
||||
*/
|
||||
#ifndef ZB_ZCL_TUNNEL_H
|
||||
#define ZB_ZCL_TUNNEL_H 1
|
||||
|
||||
/** @cond (DOXYGEN_ZCL_SECTION && DOXYGEN_CUSTOM_TUNNEL_CLUSTER) */
|
||||
|
||||
/** @addtogroup ZB_ZCL_TUNNEL
|
||||
* @{
|
||||
* @details
|
||||
* Manufacture specific cluster for transmit custom data between peers
|
||||
* Model: One (client) to More (servers)
|
||||
* Usually a device has MIXED role
|
||||
*/
|
||||
|
||||
/*! @name Tunnel cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Tunnel cluster commands
|
||||
*/
|
||||
enum zb_zcl_tunnel_cmd_e
|
||||
{
|
||||
ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_REQ = 0x00, /**< Request to transfer data. */
|
||||
ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_RESP = 0x01, /**< Response on received data */
|
||||
};
|
||||
|
||||
|
||||
/* Tunnel manufacturer specific cluster commands list : only for information - do not modify */
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_SERVER_ROLE_GENERATED_CMD_LIST ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_RESP
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_CLIENT_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_SERVER_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_CLIENT_ROLE_GENERATED_CMD_LIST ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_REQ
|
||||
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_SERVER_ROLE_RECEIVED_CMD_LIST ZB_ZCL_CLUSTER_ID_TUNNEL_FC00_CLIENT_ROLE_GENERATED_CMD_LIST
|
||||
|
||||
|
||||
/** Tunnel status; range: 0x00 - 0x3F (6-bit value) */
|
||||
typedef enum zb_zcl_tunnel_status_e
|
||||
{
|
||||
ZB_ZCL_TUNNEL_STATUS_OK = 0, /**< Data is sent or received. Use for inform User App about success current command */
|
||||
ZB_ZCL_TUNNEL_STATUS_ERROR = 1, /**< General Error. Current operation has error: unexpected message etc. */
|
||||
ZB_ZCL_TUNNEL_STATUS_ERROR_NO_MEMORY = 2, /**< No memory */
|
||||
ZB_ZCL_TUNNEL_STATUS_ERROR_TIMEOUT = 3, /**< Timeout. Use for inform User App about when wait answer */
|
||||
}
|
||||
zb_zcl_tunnel_status_t;
|
||||
|
||||
/** Tunnel i/o operation type, range: 0x00 - 0x03 (2-bit value) */
|
||||
enum zb_zcl_tunnel_operation_code_e
|
||||
{
|
||||
ZB_ZCL_TUNNEL_OPERATION_TX = 1 << 0, /**< Current command - send data */
|
||||
ZB_ZCL_TUNNEL_OPERATION_RX = 1 << 1 /**< Current command - receive data */
|
||||
};
|
||||
|
||||
/************* Tunnel cluster command structures **************/
|
||||
|
||||
/**
|
||||
* @brief Tunnel Transfer Data Request command payload
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_transfer_data_req_s
|
||||
{
|
||||
zb_uint8_t tx_flag; /**< see @ref zb_zcl_tunnel_tx_flags_e */
|
||||
/**< byte_num value:
|
||||
- if ZB_ZCL_TUNNEL_TX_START is on => total data size to be sent is specified
|
||||
- if ZB_ZCL_TUNNEL_TX_CONTINUE is on => current data offset is specified
|
||||
*/
|
||||
zb_uint16_t byte_num;
|
||||
/**< length data - size of data */
|
||||
zb_uint8_t data_size;
|
||||
/**< data - part of transfer data */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_transfer_data_req_t;
|
||||
|
||||
/**
|
||||
* @brief Tunnel Transfer Data Request command internal payload
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_transfer_data_req_internal_s
|
||||
{
|
||||
zb_zcl_tunnel_transfer_data_req_t req_header;
|
||||
zb_uint8_t *tun_data;
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_transfer_data_req_data_internal_t;
|
||||
|
||||
/**
|
||||
* @brief Tunnel Transfer Data Request flags
|
||||
*/
|
||||
enum zb_zcl_tunnel_tx_flags_e
|
||||
{
|
||||
ZB_ZCL_TUNNEL_TX_START = 1 << 0, /**< first block - if set then contains total length of transferring data
|
||||
else - contains current offset of transferring data */
|
||||
};
|
||||
|
||||
/*! @brief Send Transfer Data command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _def_resp - enable or disable default response
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
@param _flag - command flag, see @ref zb_zcl_tunnel_tx_flags_e
|
||||
@param _byte_num - all transfer length or current offset, see @ref zb_zcl_tunnel_transfer_data_req_t
|
||||
@param _data_size - data size
|
||||
@param _image_data - image data
|
||||
*/
|
||||
#define ZB_ZCL_TUNNEL_SEND_TRANSFER_REQ( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _def_resp, _cb, \
|
||||
_manufacturer_id, _flag, _byte_num, _data_size, _image_data) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_SRV, ZB_ZCL_MANUFACTURER_SPECIFIC, (_def_resp));\
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, ZB_ZCL_GET_SEQ_NUM(), \
|
||||
ZB_ZCL_MANUFACTURER_SPECIFIC, (_manufacturer_id), \
|
||||
ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_REQ); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(__ptr, (_flag)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA16_VAL(__ptr, (_byte_num)); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(__ptr, (_data_size)); \
|
||||
if((_data_size)>0) \
|
||||
{ \
|
||||
ZB_ZCL_PACKET_PUT_DATA_N(__ptr, (_image_data), (_data_size)); \
|
||||
} \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_TUNNEL, (_cb)); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Send Transfer Data command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param _data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_tunnel_transfer_data_req_data_internal_t.
|
||||
* @param _buffer containing the packet (by pointer).
|
||||
* @param _status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*
|
||||
* @note File data place is placed in buffer, payload saves pointer to data only!
|
||||
*/
|
||||
#define ZB_ZCL_TUNNEL_GET_TRANSFER_REQ(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_zcl_tunnel_transfer_data_req_t *src_ptr = \
|
||||
(zb_zcl_tunnel_transfer_data_req_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) != sizeof(zb_zcl_tunnel_transfer_data_req_t) \
|
||||
+ src_ptr->data_size * sizeof(zb_uint8_t) ) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(_data_ptr)->req_header.tx_flag = src_ptr->tx_flag; \
|
||||
ZB_HTOLE16(&((_data_ptr)->req_header.byte_num), &(src_ptr->byte_num)); \
|
||||
(_data_ptr)->req_header.data_size = src_ptr->data_size; \
|
||||
(_data_ptr)->tun_data = (zb_uint8_t*)(src_ptr+1); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tunnel Transfer Data Response command payload
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_transfer_data_resp_s
|
||||
{
|
||||
zb_uint8_t tun_status; /**< enum @ref zb_zcl_tunnel_status_e */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_transfer_data_resp_t;
|
||||
|
||||
/*! @brief Send Transfer Data response command
|
||||
@param _buffer - to put packet to
|
||||
@param _addr - address to send packet to
|
||||
@param _dst_addr_mode - addressing mode
|
||||
@param _dst_ep - destination endpoint
|
||||
@param _ep - sending endpoint
|
||||
@param _prfl_id - profile identifier
|
||||
@param _seq - request sequence
|
||||
@param _cb - callback for getting command send status
|
||||
@param _manufacturer_id - Manufacturer code
|
||||
@param _tun_status - command status, see @ref zb_zcl_tunnel_status_e
|
||||
*/
|
||||
#define ZB_ZCL_TUNNEL_SEND_TRANSFER_RESP( \
|
||||
_buffer, _addr, _dst_addr_mode, _dst_ep, _ep, _prfl_id, _seq, _cb, \
|
||||
_manufacturer_id, _tun_status) \
|
||||
{ \
|
||||
zb_uint8_t* __ptr = ZB_ZCL_START_PACKET((_buffer)); \
|
||||
ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_RESP_FRAME_CONTROL_A(__ptr, \
|
||||
ZB_ZCL_FRAME_DIRECTION_TO_CLI, ZB_ZCL_MANUFACTURER_SPECIFIC); \
|
||||
ZB_ZCL_CONSTRUCT_COMMAND_HEADER_EXT(__ptr, (_seq), ZB_ZCL_MANUFACTURER_SPECIFIC,\
|
||||
(_manufacturer_id), ZB_ZCL_CMD_TUNNEL_TRANSFER_DATA_RESP); \
|
||||
ZB_ZCL_PACKET_PUT_DATA8(__ptr, (_tun_status)); \
|
||||
ZB_ZCL_FINISH_PACKET((_buffer), __ptr) \
|
||||
ZB_ZCL_SEND_COMMAND_SHORT( \
|
||||
(_buffer), (_addr), (_dst_addr_mode), (_dst_ep), (_ep), (_prfl_id), \
|
||||
ZB_ZCL_CLUSTER_ID_TUNNEL, (_cb)); \
|
||||
}
|
||||
|
||||
/** @brief Macro for getting Send Transfer Data response command
|
||||
* @attention Assumes that ZCL header already cut.
|
||||
* @param _data_ptr - pointer to a variable of type @ref
|
||||
* zb_zcl_tunnel_transfer_data_resp_t.
|
||||
* @param _buffer containing the packet (by pointer).
|
||||
* @param _status - variable to put parse status to (see @ref zb_zcl_parse_status_t).
|
||||
*/
|
||||
#define ZB_ZCL_TUNNEL_GET_TRANSFER_RESP(_data_ptr, _buffer, _status) \
|
||||
{ \
|
||||
zb_zcl_tunnel_transfer_data_resp_t *src_ptr = \
|
||||
(zb_zcl_tunnel_transfer_data_resp_t*)zb_buf_begin((_buffer)); \
|
||||
\
|
||||
if (zb_buf_len((_buffer)) != sizeof(zb_zcl_tunnel_transfer_data_resp_t) ) \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_FAILURE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(_status) = ZB_ZCL_PARSE_STATUS_SUCCESS; \
|
||||
(_data_ptr)->tun_status = src_ptr->tun_status; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*! @} */ /* Tunnel cluster commands */
|
||||
|
||||
|
||||
/*********************** Tunnel API **************************/
|
||||
|
||||
/*! @name Tunnel cluster commands
|
||||
@{
|
||||
*/
|
||||
|
||||
/** Callback to inform user about tx operation status or rx data;
|
||||
* @param param - param is reference to a buffer;
|
||||
* zb_zcl_tunnel_io_param_t is stored as buffer parameter */
|
||||
typedef void (ZB_CODE * zb_zcl_tunnel_cb_t)(zb_uint8_t param);
|
||||
|
||||
/** Tunnel operation status
|
||||
*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_op_status_s
|
||||
{
|
||||
zb_bitfield_t status :6; /**< zb_zcl_tunnel_status_e value */
|
||||
zb_bitfield_t op_code :2; /**< zb_zcl_tunnel_operation_code_e value */
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_op_status_t;
|
||||
|
||||
/** structure to pass parameters for data i/o
|
||||
* Save in first of each buffer
|
||||
* */
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_io_param_s
|
||||
{
|
||||
zb_uint16_t length; /* total data size*/
|
||||
zb_uint16_t peer_addr;
|
||||
zb_uint8_t peer_ep;
|
||||
zb_uint8_t src_ep;
|
||||
zb_uint8_t next_buf; /* pointer to the next buf for fragmented data */
|
||||
zb_zcl_tunnel_op_status_t op_status;
|
||||
zb_uint8_t seq;
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_io_param_t;
|
||||
|
||||
/** Init CTX data table
|
||||
* @param manuf_id - manufacturer ID */
|
||||
void zb_zcl_tunnel_init(zb_uint16_t manuf_id);
|
||||
|
||||
/** Register user callback */
|
||||
void zb_zcl_tunnel_register_cb(zb_zcl_tunnel_cb_t tunnel_cb);
|
||||
|
||||
/** Start user data transmit. buf_param is a reference to a buffer;
|
||||
* zb_zcl_tunnel_io_param_t is stored as a buffer parameter;
|
||||
* data to be transmitted is stored as buffer data */
|
||||
zb_ret_t zb_zcl_tunnel_transmit_data(zb_uint8_t buf_param);
|
||||
|
||||
/** Default user application
|
||||
* Contain default handle (usually free buffer) for different Tunnel Status command */
|
||||
void zb_zcl_tunnel_default_user_app(zb_uint8_t param);
|
||||
|
||||
/*! @} */ /* Tunnel cluster commands */
|
||||
|
||||
/**************************** Tunnel internal **********************************/
|
||||
|
||||
#define ZB_ZCL_TUNNEL_TIMEOUT (10*ZB_TIME_ONE_SECOND)
|
||||
|
||||
/** @brief Maximum slots for send/receive data */
|
||||
#define ZB_ZCL_TUNNEL_MAX_IO_SLOT_NUMBER 16
|
||||
|
||||
/** @brief Not slots index*/
|
||||
#define ZB_ZCL_TUNNEL_IO_SLOT_UNKNOWN 0xff
|
||||
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_io_slot_s
|
||||
{
|
||||
zb_zcl_tunnel_io_param_t io_param;
|
||||
zb_uint16_t offset; /* length of current sent/received data */
|
||||
zb_uint8_t seq;
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_io_slot_t;
|
||||
|
||||
/** struct for next buffer in multi-buffer chain*/
|
||||
typedef ZB_PACKED_PRE struct zb_zcl_tunnel_io_slot_continue_s
|
||||
{
|
||||
zb_uint8_t next_buf;
|
||||
}
|
||||
ZB_PACKED_STRUCT
|
||||
zb_zcl_tunnel_io_slot_continue_t;
|
||||
|
||||
|
||||
/* internal cluster data - context info */
|
||||
typedef struct zb_zcl_tunnel_context_s
|
||||
{
|
||||
zb_uint16_t manufacturer_id; /* manufacturer ID - should be initialized */
|
||||
zb_zcl_tunnel_cb_t tunnel_cb; /* user callback - should be registered */
|
||||
/* store reference to i/o buffer: tx or rx;
|
||||
* zb_zcl_tunnel_io_param_t is stored as buffer parameter to keep status info */
|
||||
zb_uint8_t tunnel_io_slot[ZB_ZCL_TUNNEL_MAX_IO_SLOT_NUMBER];
|
||||
}
|
||||
zb_zcl_tunnel_context_t;
|
||||
|
||||
zb_ret_t zb_zcl_tunnel_transfer_data_req_handler(zb_uint8_t buf_param);
|
||||
zb_ret_t zb_zcl_tunnel_transfer_data_resp_handler(zb_uint8_t buf_param);
|
||||
void zb_zcl_tunnel_transfer_data_resp_send(zb_uint8_t param, zb_uint16_t endpoint16);
|
||||
|
||||
void zb_zcl_tunnel_send_fist_block(zb_uint8_t param, zb_uint16_t index16);
|
||||
void zb_zcl_tunnel_timeout(zb_uint8_t index);
|
||||
void zb_zcl_tunnel_invoke_user_app(zb_uint8_t param);
|
||||
|
||||
zb_ret_t zb_zcl_process_tunnel_default_response_commands(zb_uint8_t param);
|
||||
|
||||
zb_bool_t zb_zcl_process_tunnel_specific_commands(zb_uint8_t param);
|
||||
|
||||
/*! @} */ /* addtogroup */
|
||||
|
||||
/** @endcond */ /* DOXYGEN_ZCL_SECTION */
|
||||
|
||||
void zb_zcl_tunnel_init_server(void);
|
||||
void zb_zcl_tunnel_init_client(void);
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_SERVER_ROLE_INIT zb_zcl_tunnel_init_server
|
||||
#define ZB_ZCL_CLUSTER_ID_TUNNEL_CLIENT_ROLE_INIT zb_zcl_tunnel_init_client
|
||||
|
||||
#endif /* ZB_ZCL_TUNNEL_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user