rangeext_data.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /**************************************************************************************************
  2. Filename: rangeext_data.c
  3. Revised: $Date: 2009-12-16 11:25:27 -0800 (Wed, 16 Dec 2009) $
  4. Revision: $Revision: 21342 $
  5. Description: File that contains attribute and simple descriptor
  6. definitions for the Range Extender
  7. Copyright 2009-2010 Texas Instruments Incorporated. All rights reserved.
  8. IMPORTANT: Your use of this Software is limited to those specific rights
  9. granted under the terms of a software license agreement between the user
  10. who downloaded the software, his/her employer (which must be your employer)
  11. and Texas Instruments Incorporated (the "License"). You may not use this
  12. Software unless you agree to abide by the terms of the License. The License
  13. limits your use, and you acknowledge, that the Software may not be modified,
  14. copied or distributed unless embedded on a Texas Instruments microcontroller
  15. or used solely and exclusively in conjunction with a Texas Instruments radio
  16. frequency transceiver, which is integrated into your product. Other than for
  17. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  18. works of, modify, distribute, perform, display or sell this Software and/or
  19. its documentation for any purpose.
  20. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  21. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  22. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  23. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  24. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  25. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  26. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  27. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  28. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  29. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  30. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  31. Should you have any questions regarding your right to use this Software,
  32. contact Texas Instruments Incorporated at www.TI.com.
  33. **************************************************************************************************/
  34. /*********************************************************************
  35. * INCLUDES
  36. */
  37. #include "ZDConfig.h"
  38. #include "se.h"
  39. #include "rangeext.h"
  40. #include "zcl_general.h"
  41. #include "zcl_key_establish.h"
  42. /*********************************************************************
  43. * CONSTANTS
  44. */
  45. #define RANGEEXT_DEVICE_VERSION 0
  46. #define RANGEEXT_FLAGS 0
  47. #define RANGEEXT_HWVERSION 1
  48. #define RANGEEXT_ZCLVERSION 1
  49. /*********************************************************************
  50. * TYPEDEFS
  51. */
  52. /*********************************************************************
  53. * MACROS
  54. */
  55. /*********************************************************************
  56. * GLOBAL VARIABLES
  57. */
  58. // Basic Cluster
  59. const uint8 rangeExtZCLVersion = RANGEEXT_ZCLVERSION;
  60. const uint8 rangeExtHWVersion = RANGEEXT_HWVERSION;
  61. const uint8 rangeExtManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
  62. const uint8 rangeExtModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
  63. const uint8 rangeExtDateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
  64. const uint8 rangeExtPowerSource = POWER_SOURCE_MAINS_1_PHASE;
  65. uint8 rangeExtLocationDescription[] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
  66. uint8 rangeExtPhysicalEnvironment = PHY_UNSPECIFIED_ENV;
  67. uint8 rangeExtDeviceEnabled = DEVICE_ENABLED;
  68. // Identify Cluster Attributes
  69. uint16 rangeExtIdentifyTime = 0;
  70. uint32 rangeExtTime = 0;
  71. uint8 rangeExtTimeStatus = 0x01;
  72. // Key Establishment
  73. uint8 zclRangeExt_KeyEstablishmentSuite = CERTIFICATE_BASED_KEY_ESTABLISHMENT;
  74. /*********************************************************************
  75. * ATTRIBUTE DEFINITIONS - Uses Cluster IDs
  76. */
  77. CONST zclAttrRec_t rangeExtAttrs[RANGEEXT_MAX_ATTRIBUTES] =
  78. {
  79. // *** General Basic Cluster Attributes ***
  80. {
  81. ZCL_CLUSTER_ID_GEN_BASIC, // Cluster IDs - defined in the foundation (ie. zcl.h)
  82. { // Attribute record
  83. ATTRID_BASIC_ZCL_VERSION, // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
  84. ZCL_DATATYPE_UINT8, // Data Type - found in zcl.h
  85. ACCESS_CONTROL_READ, // Variable access control - found in zcl.h
  86. (void *)&rangeExtZCLVersion // Pointer to attribute variable
  87. }
  88. },
  89. {
  90. ZCL_CLUSTER_ID_GEN_BASIC,
  91. { // Attribute record
  92. ATTRID_BASIC_HW_VERSION,
  93. ZCL_DATATYPE_UINT8,
  94. ACCESS_CONTROL_READ,
  95. (void *)&rangeExtHWVersion
  96. }
  97. },
  98. {
  99. ZCL_CLUSTER_ID_GEN_BASIC,
  100. { // Attribute record
  101. ATTRID_BASIC_MANUFACTURER_NAME,
  102. ZCL_DATATYPE_CHAR_STR,
  103. ACCESS_CONTROL_READ,
  104. (void *)rangeExtManufacturerName
  105. }
  106. },
  107. {
  108. ZCL_CLUSTER_ID_GEN_BASIC,
  109. { // Attribute record
  110. ATTRID_BASIC_MODEL_ID,
  111. ZCL_DATATYPE_CHAR_STR,
  112. ACCESS_CONTROL_READ,
  113. (void *)rangeExtModelId
  114. }
  115. },
  116. {
  117. ZCL_CLUSTER_ID_GEN_BASIC,
  118. { // Attribute record
  119. ATTRID_BASIC_DATE_CODE,
  120. ZCL_DATATYPE_CHAR_STR,
  121. ACCESS_CONTROL_READ,
  122. (void *)rangeExtDateCode
  123. }
  124. },
  125. {
  126. ZCL_CLUSTER_ID_GEN_BASIC,
  127. { // Attribute record
  128. ATTRID_BASIC_POWER_SOURCE,
  129. ZCL_DATATYPE_ENUM8,
  130. ACCESS_CONTROL_READ,
  131. (void *)&rangeExtPowerSource
  132. }
  133. },
  134. {
  135. ZCL_CLUSTER_ID_GEN_BASIC,
  136. { // Attribute record
  137. ATTRID_BASIC_LOCATION_DESC,
  138. ZCL_DATATYPE_CHAR_STR,
  139. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  140. (void *)rangeExtLocationDescription
  141. }
  142. },
  143. {
  144. ZCL_CLUSTER_ID_GEN_BASIC,
  145. { // Attribute record
  146. ATTRID_BASIC_PHYSICAL_ENV,
  147. ZCL_DATATYPE_ENUM8,
  148. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  149. (void *)&rangeExtPhysicalEnvironment
  150. }
  151. },
  152. {
  153. ZCL_CLUSTER_ID_GEN_BASIC,
  154. { // Attribute record
  155. ATTRID_BASIC_DEVICE_ENABLED,
  156. ZCL_DATATYPE_BOOLEAN,
  157. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  158. (void *)&rangeExtDeviceEnabled
  159. }
  160. },
  161. // *** Identify Cluster Attribute ***
  162. {
  163. ZCL_CLUSTER_ID_GEN_IDENTIFY,
  164. { // Attribute record
  165. ATTRID_IDENTIFY_TIME,
  166. ZCL_DATATYPE_UINT16,
  167. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  168. (void *)&rangeExtIdentifyTime
  169. }
  170. },
  171. // *** Time Cluster Attribute ***
  172. // In SE domain, only master clock will be used. Therefore
  173. // mark the access control to only readable.
  174. {
  175. ZCL_CLUSTER_ID_GEN_TIME,
  176. { // Attribute record
  177. ATTRID_TIME_TIME,
  178. ZCL_DATATYPE_UTC,
  179. ACCESS_CONTROL_READ,
  180. (void *)&rangeExtTime
  181. }
  182. },
  183. // In SE domain, only master clock will be used. Therefore
  184. // mark the access control to only readable.
  185. {
  186. ZCL_CLUSTER_ID_GEN_TIME,
  187. { // Attribute record
  188. ATTRID_TIME_STATUS,
  189. ZCL_DATATYPE_BITMAP8,
  190. ACCESS_CONTROL_READ,
  191. (void *)&rangeExtTimeStatus
  192. }
  193. },
  194. // SE Attributes
  195. {
  196. ZCL_CLUSTER_ID_GEN_KEY_ESTABLISHMENT,
  197. { // Attribute record
  198. ATTRID_KEY_ESTABLISH_SUITE,
  199. ZCL_DATATYPE_BITMAP16,
  200. ACCESS_CONTROL_READ,
  201. (void *)&zclRangeExt_KeyEstablishmentSuite
  202. }
  203. },
  204. };
  205. /*********************************************************************
  206. * CLUSTER OPTION DEFINITIONS
  207. */
  208. zclOptionRec_t rangeExtOptions[RANGEEXT_MAX_OPTIONS] =
  209. {
  210. // *** General Cluster Options ***
  211. {
  212. ZCL_CLUSTER_ID_GEN_TIME, // Cluster IDs - defined in the foundation (ie. zcl.h)
  213. ( AF_EN_SECURITY /*| AF_ACK_REQUEST*/ ), // Options - Found in AF header (ie. AF.h)
  214. },
  215. };
  216. /*********************************************************************
  217. * SIMPLE DESCRIPTOR
  218. */
  219. // This is the Cluster ID List and should be filled with Application
  220. // specific cluster IDs.
  221. #define RANGEEXT_MAX_INCLUSTERS 3
  222. const cId_t rangeExtInClusterList[RANGEEXT_MAX_INCLUSTERS] =
  223. {
  224. ZCL_CLUSTER_ID_GEN_BASIC,
  225. ZCL_CLUSTER_ID_GEN_IDENTIFY,
  226. ZCL_CLUSTER_ID_GEN_TIME
  227. };
  228. #define RANGEEXT_MAX_OUTCLUSTERS 3
  229. const cId_t rangeExtOutClusterList[RANGEEXT_MAX_OUTCLUSTERS] =
  230. {
  231. ZCL_CLUSTER_ID_GEN_BASIC,
  232. ZCL_CLUSTER_ID_GEN_IDENTIFY,
  233. ZCL_CLUSTER_ID_GEN_TIME
  234. };
  235. SimpleDescriptionFormat_t rangeExtSimpleDesc =
  236. {
  237. RANGEEXT_ENDPOINT, // uint8 Endpoint;
  238. ZCL_SE_PROFILE_ID, // uint16 AppProfId[2];
  239. ZCL_SE_DEVICEID_RANGE_EXTENDER, // uint16 AppDeviceId[2];
  240. RANGEEXT_DEVICE_VERSION, // int AppDevVer:4;
  241. RANGEEXT_FLAGS, // int AppFlags:4;
  242. RANGEEXT_MAX_INCLUSTERS, // uint8 AppNumInClusters;
  243. (cId_t *)rangeExtInClusterList, // cId_t *pAppInClusterList;
  244. RANGEEXT_MAX_OUTCLUSTERS, // uint8 AppNumInClusters;
  245. (cId_t *)rangeExtOutClusterList // cId_t *pAppInClusterList;
  246. };
  247. /*********************************************************************
  248. * GLOBAL FUNCTIONS
  249. */
  250. /*********************************************************************
  251. * LOCAL FUNCTIONS
  252. */
  253. /****************************************************************************
  254. ****************************************************************************/