(Reprint) ZigBee zcl specification and its protocol stack 1

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

  1. // General Clusters  
  2. #define ZCL_CLUSTER_ID_GEN_BASIC                             0x0000  
  3. #define ZCL_CLUSTER_ID_GEN_POWER_CFG                         0x0001  
  4. #define ZCL_CLUSTER_ID_GEN_DEVICE_TEMP_CONFIG                0x0002  
  5. #define ZCL_CLUSTER_ID_GEN_IDENTIFY                          0x0003  
  6. #define ZCL_CLUSTER_ID_GEN_GROUPS                            0x0004  
  7. #define ZCL_CLUSTER_ID_GEN_SCENES                            0x0005  
  8. #define ZCL_CLUSTER_ID_GEN_ON_OFF                            0x0006  
  9. #define ZCL_CLUSTER_ID_GEN_ON_OFF_SWITCH_CONFIG              0x0007  
  10. #define ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL                     0x0008  
  11. #define ZCL_CLUSTER_ID_GEN_ALARMS                            0x0009  
  12. #define ZCL_CLUSTER_ID_GEN_TIME                              0x000A  
  13. #define ZCL_CLUSTER_ID_GEN_LOCATION                          0x000B  
  14. #define ZCL_CLUSTER_ID_GEN_KEY_ESTABLISHMENT                 0x0800  
  15.   
  16. // Closures Clusters  
  17. #define ZCL_CLUSTER_ID_CLOSURES_SHADE_CONFIG                 0x0100  
  18.   
  19. // HVAC Clusters  
  20. #define ZCL_CLUSTER_ID_HVAC_PUMP_CONFIG_CONTROL              0x0200  
  21. #define ZCL_CLUSTER_ID_HAVC_THERMOSTAT                       0x0201  
  22. #define ZCL_CLUSTER_ID_HAVC_FAN_CONTROL                      0x0202  
  23. #define ZCL_CLUSTER_ID_HAVC_DIHUMIDIFICATION_CONTROL         0x0203  
  24. #define ZCL_CLUSTER_ID_HAVC_USER_INTERFACE_CONFIG            0x0204  
  25.   
  26. // Lighting Clusters  
  27. #define ZCL_CLUSTER_ID_LIGHTING_COLOR_CONTROL                0x0300  
  28. #define ZCL_CLUSTER_ID_LIGHTING_BALLAST_CONFIG               0x0301  
  29.     
  30. // Measurement and Sensing Clusters  
  31. #define ZCL_CLUSTER_ID_MS_ILLUMINANCE_MEASUREMENT            0x0400  
  32. #define ZCL_CLUSTER_ID_MS_ILLUMINANCE_LEVEL_SENSING_CONFIG   0x0401  
  33. #define ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT            0x0402  
  34. #define ZCL_CLUSTER_ID_MS_PRESSURE_MEASUREMENT               0x0403  
  35. #define ZCL_CLUSTER_ID_MS_FLOW_MEASUREMENT                   0x0404  
  36. #define ZCL_CLUSTER_ID_MS_RELATIVE_HUMIDITY                  0x0405  
  37. #define ZCL_CLUSTER_ID_MS_OCCUPANCY_SENSING                  0x0406  
  38.   
  39. // Security and Safety (SS) Clusters  
  40. #define ZCL_CLUSTER_ID_SS_IAS_ZONE                           0x0500  
  41. #define ZCL_CLUSTER_ID_SS_IAS_ACE                            0x0501  
  42. #define ZCL_CLUSTER_ID_SS_IAS_WD                             0x0502  
  43.       
  44. // Protocol Interfaces  
  45. #define ZCL_CLUSTER_ID_PI_GENERIC_TUNNEL                     0x0600  
  46. #define ZCL_CLUSTER_ID_PI_BACNET_PROTOCOL_TUNNEL             0x0601  
  47. #define ZCL_CLUSTER_ID_PI_11073_PROTOCOL_TUNNEL              0x0614  
  48.   
  49. // Advanced Metering Initiative (SE) Clusters   
  50. #define ZCL_CLUSTER_ID_SE_PRICING                            0x0700  
  51. #define ZCL_CLUSTER_ID_SE_LOAD_CONTROL                       0x0701  
  52. #define ZCL_CLUSTER_ID_SE_SIMPLE_METERING                    0x0702  
  53. #define ZCL_CLUSTER_ID_SE_MESSAGE                            0x0703  
  54. #define ZCL_CLUSTER_ID_SE_REGISTRATION                       0x0704  
  55. #define ZCL_CLUSTER_ID_SE_SE_TUNNELING                       0x0705  
  56. #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





  1. /********************************/  
  2. /*** Basic Cluster Attributes ***/  
  3. /********************************/  
  4.   // Basic Device Information  
  5. #define ATTRID_BASIC_ZCL_VERSION                          0x0000  
  6. #define ATTRID_BASIC_APPL_VERSION                         0x0001  
  7. #define ATTRID_BASIC_STACK_VERSION                        0x0002  
  8. #define ATTRID_BASIC_HW_VERSION                           0x0003  
  9. #define ATTRID_BASIC_MANUFACTURER_NAME                    0x0004  
  10. #define ATTRID_BASIC_MODEL_ID                             0x0005  
  11. #define ATTRID_BASIC_DATE_CODE                            0x0006  
  12. #define ATTRID_BASIC_POWER_SOURCE                         0x0007  
  13.   // Basic Device Settings  
  14. #define ATTRID_BASIC_LOCATION_DESC                        0x0010  
  15. #define ATTRID_BASIC_PHYSICAL_ENV                         0x0011  
  16. #define ATTRID_BASIC_DEVICE_ENABLED                       0x0012  
  17. #define ATTRID_BASIC_ALARM_MASK                           0x0013  
  18. ...  
  19. /******************************/  
  20. /*** Basic Cluster Commands ***/  
  21. /******************************/  
  22. #define COMMAND_BASIC_RESET_FACT_DEFAULT                  0x00  
  23. <span style="font-family:SimSun;">  
  24. </span>  
Clusterid and attribute fields are located
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:

  1. CONST zclAttrRec_t zclSampleLight_Attrs[SAMPLELIGHT_MAX_ATTRIBUTES] =  
  2. {  
  3.   // *** General Basic Cluster Attributes ***  
  4.   {  
  5.     ZCL_CLUSTER_ID_GEN_BASIC,             // Cluster IDs - defined in the foundation (ie. zcl.h)  
  6.     {  // Attribute record  
  7.       ATTRID_BASIC_HW_VERSION,            // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)  
  8.       ZCL_DATATYPE_UINT8,                 // Data Type - found in zcl.h  
  9.       ACCESS_CONTROL_READ,                // Variable access control - found in zcl.h  
  10.       (void *)&zclSampleLight_HWRevision  // Pointer to attribute variable  
  11.     }  
  12.   },  
  13.   {  
  14.     ZCL_CLUSTER_ID_GEN_BASIC,  
  15.     { // Attribute record  
  16.       ATTRID_BASIC_ZCL_VERSION,  
  17.       ZCL_DATATYPE_UINT8,  
  18.       ACCESS_CONTROL_READ,  
  19.       (void *)&zclSampleLight_ZCLVersion  
  20.     }  
  21.   },  
  22.   {  
  23.     ZCL_CLUSTER_ID_GEN_BASIC,  
  24.     { // Attribute record  
  25.       ATTRID_BASIC_MANUFACTURER_NAME,  
  26.       ZCL_DATATYPE_CHAR_STR,  
  27.       ACCESS_CONTROL_READ,  
  28.       (void *)zclSampleLight_ManufacturerName  
  29.     }  
  30.   },  
  31.   {  
  32.     ZCL_CLUSTER_ID_GEN_BASIC,  
  33.     { // Attribute record  
  34.       ATTRID_BASIC_MODEL_ID,  
  35.       ZCL_DATATYPE_CHAR_STR,  
  36.       ACCESS_CONTROL_READ,  
  37.       (void *)zclSampleLight_ModelId  
  38.     }  
  39.   },  
  40.   {  
  41.     ZCL_CLUSTER_ID_GEN_BASIC,  
  42.     { // Attribute record  
  43.       ATTRID_BASIC_DATE_CODE,  
  44.       ZCL_DATATYPE_CHAR_STR,  
  45.       ACCESS_CONTROL_READ,  
  46.       (void *)zclSampleLight_DateCode  
  47.     }  
  48.   },  
  49.   {  
  50.     ZCL_CLUSTER_ID_GEN_BASIC,  
  51.     { // Attribute record  
  52.       ATTRID_BASIC_POWER_SOURCE,  
  53.       ZCL_DATATYPE_UINT8,  
  54.       ACCESS_CONTROL_READ,  
  55.       (void *)&zclSampleLight_PowerSource  
  56.     }  
  57.   },  
  58.   {  
  59.     ZCL_CLUSTER_ID_GEN_BASIC,  
  60.     { // Attribute record  
  61.       ATTRID_BASIC_LOCATION_DESC,  
  62.       ZCL_DATATYPE_CHAR_STR,  
  63.       (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),  
  64.       (void *)zclSampleLight_LocationDescription  
  65.     }  
  66.   },  
  67.   {  
  68.     ZCL_CLUSTER_ID_GEN_BASIC,  
  69.     { // Attribute record  
  70.       ATTRID_BASIC_PHYSICAL_ENV,  
  71.       ZCL_DATATYPE_UINT8,  
  72.       (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),  
  73.       (void *)&zclSampleLight_PhysicalEnvironment  
  74.     }  
  75.   },  
  76.   {  
  77.     ZCL_CLUSTER_ID_GEN_BASIC,  
  78.     { // Attribute record  
  79.       ATTRID_BASIC_DEVICE_ENABLED,  
  80.       ZCL_DATATYPE_BOOLEAN,  
  81.       (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),  
  82.       (void *)&zclSampleLight_DeviceEnable  
  83.     }  
  84.   },  
  85.   
  86.   // *** Identify Cluster Attribute ***  
  87.   {  
  88.     ZCL_CLUSTER_ID_GEN_IDENTIFY,  
  89.     { // Attribute record  
  90.       ATTRID_IDENTIFY_TIME,  
  91.       ZCL_DATATYPE_UINT16,  
  92.       (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),  
  93.       (void *)&zclSampleLight_IdentifyTime  
  94.     }  
  95.   },  
  96.   
  97.   // *** On/Off Cluster Attributes ***  
  98.   {  
  99.     ZCL_CLUSTER_ID_GEN_ON_OFF,  
  100.     { // Attribute record  
  101.       ATTRID_ON_OFF,  
  102.       ZCL_DATATYPE_UINT8,  
  103.       ACCESS_CONTROL_READ,  
  104.       (void *)&zclSampleLight_OnOff  
  105.     }  
  106.   },  
  107. }  

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
  1. /*** Foundation Command IDs ***/  
  2. #define ZCL_CMD_READ                                    0x00  
  3. #define ZCL_CMD_READ_RSP                                0x01  
  4. #define ZCL_CMD_WRITE                                   0x02  
  5. #define ZCL_CMD_WRITE_UNDIVIDED                         0x03  
  6. #define ZCL_CMD_WRITE_RSP                               0x04  
  7. #define ZCL_CMD_WRITE_NO_RSP                            0x05  
  8. #define ZCL_CMD_CONFIG_REPORT                           0x06  
  9. #define ZCL_CMD_CONFIG_REPORT_RSP                       0x07  
  10. #define ZCL_CMD_READ_REPORT_CFG                         0x08  
  11. #define ZCL_CMD_READ_REPORT_CFG_RSP                     0x09  
  12. #define ZCL_CMD_REPORT                                  0x0a  
  13. #define ZCL_CMD_DEFAULT_RSP                             0x0b  
  14. #define ZCL_CMD_DISCOVER                                0x0c  
  15. #define ZCL_CMD_DISCOVER_RSP                            0x0d  
  16.   
  17. #define ZCL_CMD_MAX                                     ZCL_CMD_DISCOVER_RSP 
Released five original articles · won praise 0 · Views 250

Guess you like

Origin blog.csdn.net/DIANZI520SUA/article/details/103560931