zigbee zcl specification and its protocol stack 1
http://www.cnblogs.com/-song/archive/2013/03/16/3331818.html
refer to ZigBee_Cluster_Library_Public_download_version
1.zcl divided into several different functional areas,each area occupying a portion clusterid
example has the following general areas clusterid
........
has a protocol stack in the zcl.h clusterid these definitions, corresponding to the above documents, but incomplete
- // General Clusters
- #define ZCL_CLUSTER_ID_GEN_BASIC 0x0000
- #define ZCL_CLUSTER_ID_GEN_POWER_CFG 0x0001
- #define ZCL_CLUSTER_ID_GEN_DEVICE_TEMP_CONFIG 0x0002
- #define ZCL_CLUSTER_ID_GEN_IDENTIFY 0x0003
- #define ZCL_CLUSTER_ID_GEN_GROUPS 0x0004
- #define ZCL_CLUSTER_ID_GEN_SCENES 0x0005
- #define ZCL_CLUSTER_ID_GEN_ON_OFF 0x0006
- #define ZCL_CLUSTER_ID_GEN_ON_OFF_SWITCH_CONFIG 0x0007
- #define ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL 0x0008
- #define ZCL_CLUSTER_ID_GEN_ALARMS 0x0009
- #define ZCL_CLUSTER_ID_GEN_TIME 0x000A
- #define ZCL_CLUSTER_ID_GEN_LOCATION 0x000B
- #define ZCL_CLUSTER_ID_GEN_KEY_ESTABLISHMENT 0x0800
- // Closures Clusters
- #define ZCL_CLUSTER_ID_CLOSURES_SHADE_CONFIG 0x0100
- // HVAC Clusters
- #define ZCL_CLUSTER_ID_HVAC_PUMP_CONFIG_CONTROL 0x0200
- #define ZCL_CLUSTER_ID_HAVC_THERMOSTAT 0x0201
- #define ZCL_CLUSTER_ID_HAVC_FAN_CONTROL 0x0202
- #define ZCL_CLUSTER_ID_HAVC_DIHUMIDIFICATION_CONTROL 0x0203
- #define ZCL_CLUSTER_ID_HAVC_USER_INTERFACE_CONFIG 0x0204
- // Lighting Clusters
- #define ZCL_CLUSTER_ID_LIGHTING_COLOR_CONTROL 0x0300
- #define ZCL_CLUSTER_ID_LIGHTING_BALLAST_CONFIG 0x0301
- // Measurement and Sensing Clusters
- #define ZCL_CLUSTER_ID_MS_ILLUMINANCE_MEASUREMENT 0x0400
- #define ZCL_CLUSTER_ID_MS_ILLUMINANCE_LEVEL_SENSING_CONFIG 0x0401
- #define ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT 0x0402
- #define ZCL_CLUSTER_ID_MS_PRESSURE_MEASUREMENT 0x0403
- #define ZCL_CLUSTER_ID_MS_FLOW_MEASUREMENT 0x0404
- #define ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY 0x0405
- #define ZCL_CLUSTER_ID_MS_OCCUPANCY_SENSING 0x0406
- // Security and Safety (SS) Clusters
- #define ZCL_CLUSTER_ID_SS_IAS_ZONE 0x0500
- #define ZCL_CLUSTER_ID_SS_IAS_ACE 0x0501
- #define ZCL_CLUSTER_ID_SS_IAS_WD 0x0502
- // Protocol Interfaces
- #define ZCL_CLUSTER_ID_PI_GENERIC_TUNNEL 0x0600
- #define ZCL_CLUSTER_ID_PI_BACNET_PROTOCOL_TUNNEL 0x0601
- #define ZCL_CLUSTER_ID_PI_11073_PROTOCOL_TUNNEL 0x0614
- // Advanced Metering Initiative (SE) Clusters
- #define ZCL_CLUSTER_ID_SE_PRICING 0x0700
- #define ZCL_CLUSTER_ID_SE_LOAD_CONTROL 0x0701
- #define ZCL_CLUSTER_ID_SE_SIMPLE_METERING 0x0702
- #define ZCL_CLUSTER_ID_SE_MESSAGE 0x0703
- #define ZCL_CLUSTER_ID_SE_REGISTRATION 0x0704
- #define ZCL_CLUSTER_ID_SE_SE_TUNNELING 0x0705
- #define ZCL_CLUSTER_ID_SE_PRE_PAYMENT 0x0706
2. Each clusterid set of attributes and commands by a number of collection of
such
basic clusterid general art, there are so many of the following properties (divided into two parts, the basic device information and device configuration information)
basic clusterid general there is a command field clusterid attributes and commands implemented in the protocol stack, such as basic clusterid general field located zcl_general.h
- /********************************/
- /*** Basic Cluster Attributes ***/
- /********************************/
- // Basic Device Information
- #define ATTRID_BASIC_ZCL_VERSION 0x0000
- #define ATTRID_BASIC_APPL_VERSION 0x0001
- #define ATTRID_BASIC_STACK_VERSION 0x0002
- #define ATTRID_BASIC_HW_VERSION 0x0003
- #define ATTRID_BASIC_MANUFACTURER_NAME 0x0004
- #define ATTRID_BASIC_MODEL_ID 0x0005
- #define ATTRID_BASIC_DATE_CODE 0x0006
- #define ATTRID_BASIC_POWER_SOURCE 0x0007
- // Basic Device Settings
- #define ATTRID_BASIC_LOCATION_DESC 0x0010
- #define ATTRID_BASIC_PHYSICAL_ENV 0x0011
- #define ATTRID_BASIC_DEVICE_ENABLED 0x0012
- #define ATTRID_BASIC_ALARM_MASK 0x0013
- ...
- /******************************/
- /*** Basic Cluster Commands ***/
- /******************************/
- #define COMMAND_BASIC_RESET_FACT_DEFAULT 0x00
- <span style="font-family:SimSun;">
- </span>
zcl_general.h- generic
or access? Zcl_closures.h- indoor
zcl_hvac.h- air conditioning
zcl_lighting.h- lighting
zcl_ms.h-Measurements and Sensing
zcl_ss.h
zcl_pi.h
have clusterid property macro definition, the need for configuration attributes (assignment)
arranged such, zcl_samplelight.c in each attribute clusterid ZCL_CLUSTER_ID_GEN_BASIC performed:
- CONST zclAttrRec_t zclSampleLight_Attrs[SAMPLELIGHT_MAX_ATTRIBUTES] =
- {
- // *** General Basic Cluster Attributes ***
- {
- ZCL_CLUSTER_ID_GEN_BASIC, // Cluster IDs - defined in the foundation (ie. zcl.h)
- { // Attribute record
- ATTRID_BASIC_HW_VERSION, // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
- ZCL_DATATYPE_UINT8, // Data Type - found in zcl.h
- ACCESS_CONTROL_READ, // Variable access control - found in zcl.h
- (void *)&zclSampleLight_HWRevision // Pointer to attribute variable
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_ZCL_VERSION,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleLight_ZCLVersion
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_MANUFACTURER_NAME,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleLight_ManufacturerName
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_MODEL_ID,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleLight_ModelId
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_DATE_CODE,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleLight_DateCode
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_POWER_SOURCE,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleLight_PowerSource
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_LOCATION_DESC,
- ZCL_DATATYPE_CHAR_STR,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)zclSampleLight_LocationDescription
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_PHYSICAL_ENV,
- ZCL_DATATYPE_UINT8,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleLight_PhysicalEnvironment
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_DEVICE_ENABLED,
- ZCL_DATATYPE_BOOLEAN,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleLight_DeviceEnable
- }
- },
- // *** Identify Cluster Attribute ***
- {
- ZCL_CLUSTER_ID_GEN_IDENTIFY,
- { // Attribute record
- ATTRID_IDENTIFY_TIME,
- ZCL_DATATYPE_UINT16,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleLight_IdentifyTime
- }
- },
- // *** On/Off Cluster Attributes ***
- {
- ZCL_CLUSTER_ID_GEN_ON_OFF,
- { // Attribute record
- ATTRID_ON_OFF,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleLight_OnOff
- }
- },
- }
3. In addition to the unique command clusterid, there are some common commands, such as reading of an attribute clusterid,
implemented in a protocol stack, located zcl.h
- /*** Foundation Command IDs ***/
- #define ZCL_CMD_READ 0x00
- #define ZCL_CMD_READ_RSP 0x01
- #define ZCL_CMD_WRITE 0x02
- #define ZCL_CMD_WRITE_UNDIVIDED 0x03
- #define ZCL_CMD_WRITE_RSP 0x04
- #define ZCL_CMD_WRITE_NO_RSP 0x05
- #define ZCL_CMD_CONFIG_REPORT 0x06
- #define ZCL_CMD_CONFIG_REPORT_RSP 0x07
- #define ZCL_CMD_READ_REPORT_CFG 0x08
- #define ZCL_CMD_READ_REPORT_CFG_RSP 0x09
- #define ZCL_CMD_REPORT 0x0a
- #define ZCL_CMD_DEFAULT_RSP 0x0b
- #define ZCL_CMD_DISCOVER 0x0c
- #define ZCL_CMD_DISCOVER_RSP 0x0d
- #define ZCL_CMD_MAX ZCL_CMD_DISCOVER_RSP