OTA_Dongle_data.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /**************************************************************************************************
  2. Filename: OTA_Dongle_data.c
  3. Revised: $Date: 2011-07-15 18:32:43 -0700 (Fri, 15 Jul 2011) $
  4. Revision: $Revision: 26809 $
  5. Description: Zigbee Cluster Library - sample device application.
  6. Copyright 2010-2011 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. /*********************************************************************
  34. * INCLUDES
  35. */
  36. #include "ZComDef.h"
  37. #include "OSAL.h"
  38. #include "AF.h"
  39. #include "ZDConfig.h"
  40. #include "zcl.h"
  41. #include "zcl_ota.h"
  42. #include "zcl_general.h"
  43. #include "OTA_Dongle.h"
  44. /*********************************************************************
  45. * CONSTANTS
  46. */
  47. #define OTA_DONGLE_DEVICE_VERSION 0
  48. #define OTA_DONGLE_FLAGS 0
  49. #define OTA_DONGLE_HWVERSION 1
  50. #define OTA_DONGLE_ZCLVERSION 1
  51. /*********************************************************************
  52. * TYPEDEFS
  53. */
  54. /*********************************************************************
  55. * MACROS
  56. */
  57. /*********************************************************************
  58. * GLOBAL VARIABLES
  59. */
  60. // Basic Cluster
  61. const uint8 OTA_Dongle_HWRevision = OTA_DONGLE_HWVERSION;
  62. const uint8 OTA_Dongle_ZCLVersion = OTA_DONGLE_ZCLVERSION;
  63. const uint8 OTA_Dongle_ManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
  64. const uint8 OTA_Dongle_ModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
  65. const uint8 OTA_Dongle_DateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
  66. const uint8 OTA_Dongle_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
  67. uint8 OTA_Dongle_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
  68. uint8 OTA_Dongle_PhysicalEnvironment = 0;
  69. uint8 OTA_Dongle_DeviceEnable = DEVICE_ENABLED;
  70. // Identify Cluster
  71. uint16 OTA_Dongle_IdentifyTime = 0;
  72. /*********************************************************************
  73. * ATTRIBUTE DEFINITIONS - Uses REAL cluster IDs
  74. */
  75. CONST zclAttrRec_t OTA_Dongle_Attrs[OTA_DONGLE_MAX_ATTRIBUTES] =
  76. {
  77. // *** General Basic Cluster Attributes ***
  78. {
  79. ZCL_CLUSTER_ID_GEN_BASIC, // Cluster IDs - defined in the foundation (ie. zcl.h)
  80. { // Attribute record
  81. ATTRID_BASIC_HW_VERSION, // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
  82. ZCL_DATATYPE_UINT8, // Data Type - found in zcl.h
  83. ACCESS_CONTROL_READ, // Variable access control - found in zcl.h
  84. (void *)&OTA_Dongle_HWRevision // Pointer to attribute variable
  85. }
  86. },
  87. {
  88. ZCL_CLUSTER_ID_GEN_BASIC,
  89. { // Attribute record
  90. ATTRID_BASIC_ZCL_VERSION,
  91. ZCL_DATATYPE_UINT8,
  92. ACCESS_CONTROL_READ,
  93. (void *)&OTA_Dongle_ZCLVersion
  94. }
  95. },
  96. {
  97. ZCL_CLUSTER_ID_GEN_BASIC,
  98. { // Attribute record
  99. ATTRID_BASIC_MANUFACTURER_NAME,
  100. ZCL_DATATYPE_CHAR_STR,
  101. ACCESS_CONTROL_READ,
  102. (void *)OTA_Dongle_ManufacturerName
  103. }
  104. },
  105. {
  106. ZCL_CLUSTER_ID_GEN_BASIC,
  107. { // Attribute record
  108. ATTRID_BASIC_MODEL_ID,
  109. ZCL_DATATYPE_CHAR_STR,
  110. ACCESS_CONTROL_READ,
  111. (void *)OTA_Dongle_ModelId
  112. }
  113. },
  114. {
  115. ZCL_CLUSTER_ID_GEN_BASIC,
  116. { // Attribute record
  117. ATTRID_BASIC_DATE_CODE,
  118. ZCL_DATATYPE_CHAR_STR,
  119. ACCESS_CONTROL_READ,
  120. (void *)OTA_Dongle_DateCode
  121. }
  122. },
  123. {
  124. ZCL_CLUSTER_ID_GEN_BASIC,
  125. { // Attribute record
  126. ATTRID_BASIC_POWER_SOURCE,
  127. ZCL_DATATYPE_UINT8,
  128. ACCESS_CONTROL_READ,
  129. (void *)&OTA_Dongle_PowerSource
  130. }
  131. },
  132. {
  133. ZCL_CLUSTER_ID_GEN_BASIC,
  134. { // Attribute record
  135. ATTRID_BASIC_LOCATION_DESC,
  136. ZCL_DATATYPE_CHAR_STR,
  137. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  138. (void *)OTA_Dongle_LocationDescription
  139. }
  140. },
  141. {
  142. ZCL_CLUSTER_ID_GEN_BASIC,
  143. { // Attribute record
  144. ATTRID_BASIC_PHYSICAL_ENV,
  145. ZCL_DATATYPE_UINT8,
  146. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  147. (void *)&OTA_Dongle_PhysicalEnvironment
  148. }
  149. },
  150. {
  151. ZCL_CLUSTER_ID_GEN_BASIC,
  152. { // Attribute record
  153. ATTRID_BASIC_DEVICE_ENABLED,
  154. ZCL_DATATYPE_BOOLEAN,
  155. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  156. (void *)&OTA_Dongle_DeviceEnable
  157. }
  158. },
  159. // *** Identify Cluster Attribute ***
  160. {
  161. ZCL_CLUSTER_ID_GEN_IDENTIFY,
  162. { // Attribute record
  163. ATTRID_IDENTIFY_TIME,
  164. ZCL_DATATYPE_UINT16,
  165. (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
  166. (void *)&OTA_Dongle_IdentifyTime
  167. }
  168. },
  169. };
  170. /*********************************************************************
  171. * CLUSTER OPTION DEFINITIONS
  172. */
  173. zclOptionRec_t OTA_Dongle_Options[OTA_DONGLE_MAX_OPTIONS] =
  174. {
  175. {
  176. ZCL_CLUSTER_ID_OTA,
  177. #ifndef OTA_HA
  178. ( AF_EN_SECURITY ),
  179. #endif
  180. },
  181. };
  182. /*********************************************************************
  183. * SIMPLE DESCRIPTOR
  184. */
  185. // This is the Cluster ID List and should be filled with Application
  186. // specific cluster IDs.
  187. #define OTA_DONGLE_MAX_INCLUSTERS 3
  188. const cId_t OTA_Dongle_InClusterList[OTA_DONGLE_MAX_INCLUSTERS] =
  189. {
  190. ZCL_CLUSTER_ID_GEN_BASIC,
  191. ZCL_CLUSTER_ID_GEN_SCENES,
  192. ZCL_CLUSTER_ID_GEN_GROUPS,
  193. };
  194. #define OTA_DONGLE_MAX_OUTCLUSTERS 1
  195. const cId_t OTA_Dongle_OutClusterList[OTA_DONGLE_MAX_OUTCLUSTERS] =
  196. {
  197. ZCL_CLUSTER_ID_GEN_BASIC
  198. };
  199. SimpleDescriptionFormat_t OTA_Dongle_SimpleDesc =
  200. {
  201. OTA_DONGLE_ENDPOINT, // int Endpoint;
  202. OTA_SAMPLE_PROFILE_ID, // uint16 AppProfId[2];
  203. OTA_SAMPLE_DEVICEID, // uint16 AppDeviceId[2];
  204. OTA_DONGLE_DEVICE_VERSION, // int AppDevVer:4;
  205. OTA_DONGLE_FLAGS, // int AppFlags:4;
  206. OTA_DONGLE_MAX_INCLUSTERS, // byte AppNumInClusters;
  207. (cId_t *)OTA_Dongle_InClusterList, // byte *pAppInClusterList;
  208. OTA_DONGLE_MAX_OUTCLUSTERS, // byte AppNumInClusters;
  209. (cId_t *)OTA_Dongle_OutClusterList // byte *pAppInClusterList;
  210. };
  211. /*********************************************************************
  212. * GLOBAL FUNCTIONS
  213. */
  214. /*********************************************************************
  215. * LOCAL FUNCTIONS
  216. */
  217. /****************************************************************************
  218. ****************************************************************************/