zcl_gp.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. /**************************************************************************************************
  2. Filename: zcl_gp.h
  3. Revised: $Date: 2011-05-19 16:43:00 -0700 (Thu, 19 May 2011) $
  4. Revision: $Revision: 26037 $
  5. Description: This file contains the ZCL Green Power definitions.
  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. #ifndef ZCL_GP_H
  34. #define ZCL_GP_H
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. /*********************************************************************
  40. * INCLUDES
  41. */
  42. #include "zcl.h"
  43. /*********************************************************************
  44. * CONSTANTS
  45. */
  46. // Fixed Zigbee Green Power Endpoint for Proxy and Target
  47. #define ZGP_ENDPOINT_ID 0x00F2
  48. // ZGP Infrastructure Device IDs
  49. #define ZGP_DEVICE_ID_PROXY 0x0500
  50. #define ZGP_DEVICE_ID_TARGET 0x0501
  51. #define ZGP_DEVICE_ID_COMBO 0x0502
  52. #define ZGP_DEVICE_ID_TARGET_PLUS 0x0503
  53. #define ZGP_DEVICE_ID_COMMISSIONING_TOOL 0x0504
  54. #define ZGP_DEVICE_ID_PROXY_MINIMUN 0x0505
  55. #define ZGP_DEVICE_ID_COMBO_MINIMUM 0x0506
  56. #define ZGP_STUB_SECURITY_NONE 0
  57. #define ZGP_STUB_SECURITY_ALL 1
  58. /**********************************************/
  59. /*** Green Power Features ***/
  60. /**********************************************
  61. *
  62. * Use one of the following compilation flags
  63. * to determine the device type to be created:
  64. * ZGP_DEVICE_PROXY
  65. * ZGP_DEVICE_TARGET
  66. * ZGP_DEVICE_TARGETPLUS
  67. * ZGP_DEVICE_COMBO
  68. * ZGP_DEVICE_PROXY_MIN
  69. * ZGP_DEVICE_COMBO_MIN
  70. *
  71. * Comment (or uncomment) the supported features
  72. * and supported commands bitmasks added to each
  73. * device in order to control its capabilities.
  74. *
  75. **********************************************/
  76. #define SUPP_ZGP_FEATURE_COMMON 0x0001
  77. #define SUPP_ZGP_FEATURE_DIRECT 0x0002
  78. #define SUPP_ZGP_FEATURE_DERIVED_GROUPCAST 0x0004
  79. #define SUPP_ZGP_FEATURE_PRECOMMISSIONED 0x0008
  80. #define SUPP_ZGP_FEATURE_UNICAST 0x0010
  81. #define SUPP_ZGP_FEATURE_LIGHTWEIGHT_UNICAST 0x0020
  82. #define SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_OPER 0x0040
  83. #define SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER 0x0080
  84. #define SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT 0x0100
  85. #define SUPP_ZGP_FEATURE_SINGLE_HOP_COMMISS 0x0200
  86. #define SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_COMMISS 0x0400
  87. #define SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS 0x0800
  88. #define SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_COMMISS 0x1000
  89. #define SUPP_ZGP_FEATURE_CT_BASED_COMMISS 0x2000
  90. #define SUPP_ZGP_FEATURE_MAINT_ZGPD 0x4000
  91. #define SUPP_ZGP_CMD_NOTIFICAITON 0x0001
  92. #define SUPP_ZGP_CMD_TUNNELING_STOP 0x0002
  93. #define SUPP_ZGP_CMD_PAIRING_SEARCH 0x0004
  94. #define SUPP_ZGP_CMD_NOTIFICATION_RESP 0x0008
  95. #define SUPP_ZGP_CMD_PAIRING 0x0010
  96. #define SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE 0x0020
  97. #define SUPP_ZGP_CMD_COMMISSIONING_NOTIF 0x0040
  98. #define SUPP_ZGP_CMD_RESPONSE 0x0080
  99. #define SUPP_ZGP_CMD_TT_UPDATE 0x0100
  100. #define SUPP_ZGP_CMD_TT_REQ 0x0200
  101. #define SUPP_ZGP_CMD_TT_RESP 0x0400
  102. #define SUPP_ZGP_CMD_CONFIGURE_PAIRING 0x0800
  103. #if defined ( ZGP_DEVICE_PROXY ) || ( ZGP_DEVICE_COMBO )
  104. #define ZGP_DEVICE_SUPPORTED_CLIENT_FEATURE ( \
  105. SUPP_ZGP_FEATURE_COMMON \
  106. + SUPP_ZGP_FEATURE_DIRECT \
  107. + SUPP_ZGP_FEATURE_DERIVED_GROUPCAST \
  108. + SUPP_ZGP_FEATURE_PRECOMMISSIONED \
  109. + SUPP_ZGP_FEATURE_UNICAST \
  110. + SUPP_ZGP_FEATURE_LIGHTWEIGHT_UNICAST \
  111. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER \
  112. + SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT \
  113. + SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS \
  114. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_COMMISS \
  115. + SUPP_ZGP_FEATURE_CT_BASED_COMMISS \
  116. + SUPP_ZGP_FEATURE_MAINT_ZGPD )
  117. #endif
  118. #if defined ( ZGP_DEVICE_PROXY_MIN ) || defined ( ZGP_DEVICE_COMBO_MIN )
  119. #define ZGP_DEVICE_SUPPORTED_CLIENT_FEATURE \
  120. ( SUPP_ZGP_FEATURE_COMMON \
  121. + SUPP_ZGP_FEATURE_DIRECT \
  122. + SUPP_ZGP_FEATURE_DERIVED_GROUPCAST \
  123. + SUPP_ZGP_FEATURE_PRECOMMISSIONED \
  124. /* + SUPP_ZGP_FEATURE_UNICAST \
  125. + SUPP_ZGP_FEATURE_LIGHTWEIGHT_UNICAST \
  126. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER \
  127. + SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT \
  128. + SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS \
  129. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_COMMISS \
  130. + SUPP_ZGP_FEATURE_CT_BASED_COMMISS \
  131. + SUPP_ZGP_FEATURE_MAINT_ZGPD */ )
  132. #endif
  133. #if defined ( ZGP_DEVICE_TARGET )
  134. #define ZGP_DEVICE_SUPPORTED_SERVER_FEATURE ( \
  135. SUPP_ZGP_FEATURE_COMMON \
  136. + SUPP_ZGP_FEATURE_DERIVED_GROUPCAST \
  137. + SUPP_ZGP_FEATURE_PRECOMMISSIONED \
  138. + SUPP_ZGP_FEATURE_UNICAST \
  139. + SUPP_ZGP_FEATURE_LIGHTWEIGHT_UNICAST \
  140. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER \
  141. + SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT \
  142. + SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS \
  143. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_COMMISS \
  144. + SUPP_ZGP_FEATURE_CT_BASED_COMMISS \
  145. + SUPP_ZGP_FEATURE_MAINT_ZGPD )
  146. #endif
  147. #if defined ( ZGP_DEVICE_TARGETPLUS ) || ( ZGP_DEVICE_COMBO )
  148. #define ZGP_DEVICE_SUPPORTED_SERVER_FEATURE ( \
  149. SUPP_ZGP_FEATURE_COMMON \
  150. + SUPP_ZGP_FEATURE_DIRECT \
  151. + SUPP_ZGP_FEATURE_DERIVED_GROUPCAST \
  152. + SUPP_ZGP_FEATURE_PRECOMMISSIONED \
  153. + SUPP_ZGP_FEATURE_UNICAST \
  154. + SUPP_ZGP_FEATURE_LIGHTWEIGHT_UNICAST \
  155. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_OPER \
  156. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER \
  157. + SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT \
  158. + SUPP_ZGP_FEATURE_SINGLE_HOP_COMMISS \
  159. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_COMMISS \
  160. + SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS \
  161. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_COMMISS \
  162. + SUPP_ZGP_FEATURE_CT_BASED_COMMISS \
  163. + SUPP_ZGP_FEATURE_MAINT_ZGPD )
  164. #endif
  165. #if defined ( ZGP_DEVICE_COMBO_MIN )
  166. #define ZGP_DEVICE_SUPPORTED_SERVER_FEATURE ( \
  167. SUPP_ZGP_FEATURE_COMMON \
  168. + SUPP_ZGP_FEATURE_DIRECT \
  169. + SUPP_ZGP_FEATURE_DERIVED_GROUPCAST \
  170. + SUPP_ZGP_FEATURE_PRECOMMISSIONED \
  171. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_OPER \
  172. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_OPER \
  173. + SUPP_ZGP_FEATURE_PROXY_TABLE_MAINT \
  174. + SUPP_ZGP_FEATURE_SINGLE_HOP_COMMISS \
  175. + SUPP_ZGP_FEATURE_SINGLE_HOP_BIDIR_COMMISS \
  176. + SUPP_ZGP_FEATURE_MULTI_HOP_COMMISS \
  177. + SUPP_ZGP_FEATURE_MULTI_HOP_BIDIR_COMMISS \
  178. + SUPP_ZGP_FEATURE_CT_BASED_COMMISS \
  179. + SUPP_ZGP_FEATURE_MAINT_ZGPD )
  180. #endif
  181. #if defined ( ZGP_DEVICE_PROXY ) || ( ZGP_DEVICE_COMBO )
  182. #define ZGP_DEVICE_SUPPORTED_CLIENT_TX_CMD ( \
  183. SUPP_ZGP_CMD_NOTIFICAITON \
  184. + SUPP_ZGP_CMD_TUNNELING_STOP \
  185. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  186. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF )
  187. #define ZGP_DEVICE_SUPPORTED_CLIENT_RX_CMD ( \
  188. SUPP_ZGP_CMD_NOTIFICAITON \
  189. + SUPP_ZGP_CMD_TUNNELING_STOP \
  190. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  191. + SUPP_ZGP_CMD_NOTIFICATION_RESP \
  192. + SUPP_ZGP_CMD_PAIRING \
  193. + SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE \
  194. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF \
  195. + SUPP_ZGP_CMD_RESPONSE )
  196. #endif
  197. #if defined ( ZGP_DEVICE_PROXY_MIN ) || defined ( ZGP_DEVICE_COMBO_MIN )
  198. #define ZGP_DEVICE_SUPPORTED_CLIENT_TX_CMD ( \
  199. SUPP_ZGP_CMD_NOTIFICAITON \
  200. /* + SUPP_ZGP_CMD_TUNNELING_STOP \
  201. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  202. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF */ )
  203. #define ZGP_DEVICE_SUPPORTED_CLIENT_RX_CMD ( \
  204. SUPP_ZGP_CMD_PAIRING \
  205. /* + SUPP_ZGP_CMD_NOTIFICAITON \
  206. + SUPP_ZGP_CMD_TUNNELING_STOP \
  207. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  208. + SUPP_ZGP_CMD_NOTIFICATION_RESP \
  209. + SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE \
  210. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF \
  211. + SUPP_ZGP_CMD_RESPONSE */ )
  212. #endif
  213. #if defined ( ZGP_DEVICE_TARGET ) || defined ( ZGP_DEVICE_TARGETPLUS ) || ( ZGP_DEVICE_COMBO )
  214. #define ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD ( \
  215. SUPP_ZGP_CMD_NOTIFICATION_RESP \
  216. + SUPP_ZGP_CMD_PAIRING \
  217. + SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE \
  218. + SUPP_ZGP_CMD_RESPONSE \
  219. + SUPP_ZGP_CMD_TT_RESP \
  220. + SUPP_ZGP_CMD_CONFIGURE_PAIRING )
  221. #define ZGP_DEVICE_SUPPORTED_SERVER_RX_CMD ( \
  222. + SUPP_ZGP_CMD_NOTIFICAITON \
  223. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  224. + SUPP_ZGP_CMD_PAIRING \
  225. + SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE \
  226. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF \
  227. + SUPP_ZGP_CMD_TT_UPDATE \
  228. + SUPP_ZGP_CMD_TT_REQ \
  229. + SUPP_ZGP_CMD_CONFIGURE_PAIRING )
  230. #endif
  231. #if defined ( ZGP_DEVICE_COMBO_MIN )
  232. #define ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD ( \
  233. + SUPP_ZGP_CMD_NOTIFICAITON \
  234. + SUPP_ZGP_CMD_PAIRING_SEARCH \
  235. + SUPP_ZGP_CMD_PAIRING \
  236. + SUPP_ZGP_CMD_PROXY_COMMISSIONING_MODE \
  237. + SUPP_ZGP_CMD_COMMISSIONING_NOTIF \
  238. + SUPP_ZGP_CMD_RESPONSE \
  239. + SUPP_ZGP_CMD_TT_UPDATE \
  240. + SUPP_ZGP_CMD_TT_REQ \
  241. + SUPP_ZGP_CMD_TT_RESP \
  242. + SUPP_ZGP_CMD_CONFIGURE_PAIRING )
  243. #define ZGP_DEVICE_SUPPORTED_SERVER_RX_CMD ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD
  244. #endif
  245. #ifndef ZGP_DEVICE_SUPPORTED_CLIENT_TX_CMD
  246. #define ZGP_DEVICE_SUPPORTED_CLIENT_TX_CMD 0x0000
  247. #endif
  248. #ifndef ZGP_DEVICE_SUPPORTED_CLIENT_RX_CMD
  249. #define ZGP_DEVICE_SUPPORTED_CLIENT_RX_CMD 0x0000
  250. #endif
  251. #ifndef ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD
  252. #define ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD 0x0000
  253. #endif
  254. #ifndef ZGP_DEVICE_SUPPORTED_SERVER_RX_CMD
  255. #define ZGP_DEVICE_SUPPORTED_SERVER_RX_CMD 0x0000
  256. #endif
  257. #ifndef ZGP_DEVICE_SUPPORTED_CLIENT_FEATURE
  258. #define ZGP_DEVICE_SUPPORTED_CLIENT_FEATURE 0x0000
  259. #endif
  260. #ifndef ZGP_DEVICE_SUPPORTED_SERVER_FEATURE
  261. #define ZGP_DEVICE_SUPPORTED_SERVER_FEATURE 0x0000
  262. #endif
  263. #define SUPPORTED_C_FEATURE(x) ( ZGP_DEVICE_SUPPORTED_CLIENT_FEATURE & (x) )
  264. #define SUPPORTED_S_FEATURE(x) ( ZGP_DEVICE_SUPPORTED_SERVER_FEATURE & (x) )
  265. #define SUPPORTED_FEATURE(x) ( SUPPORTED_C_FEATURE(x) || SUPPORTED_S_FEATURE(x) )
  266. #define SUPPORTED_C_RX_CMD(x) ( ZGP_DEVICE_SUPPORTED_CLIENT_RX_CMD & (x) )
  267. #define SUPPORTED_C_TX_CMD(x) ( ZGP_DEVICE_SUPPORTED_CLIENT_TX_CMD & (x) )
  268. #define SUPPORTED_S_RX_CMD(x) ( ZGP_DEVICE_SUPPORTED_SERVER_RX_CMD & (x) )
  269. #define SUPPORTED_S_TX_CMD(x) ( ZGP_DEVICE_SUPPORTED_SERVER_TX_CMD & (x) )
  270. #define SUPPORTED_RX_CMD(x) ( SUPPORTED_C_RX_CMD(x) || SUPPORTED_S_RX_CMD(x) )
  271. #define SUPPORTED_TX_CMD(x) ( SUPPORTED_C_TX_CMD(x) || SUPPORTED_S_TX_CMD(x) )
  272. #define ZGP_FEATURE_STUB_SECURITY
  273. #if !defined ( ZGP_STUB_SECURITY )
  274. #if defined ( ZGP_FEATURE_STUB_SECURITY )
  275. #define ZGP_STUB_SECURITY (ZGP_STUB_SECURITY_ALL)
  276. #else
  277. #define ZGP_STUB_SECURITY (ZGP_STUB_SECURITY_NONE)
  278. #endif
  279. #endif
  280. #define ZGP_DEVICE_COMISSIONING_TOOL
  281. /**********************************************/
  282. /*** Green Power Attributes ***/
  283. /**********************************************/
  284. // Server Attributes
  285. #define ATTRID_GP_MAX_GPTT_ENTRIES 0x0000
  286. #define ATTRID_GP_SINK_TABLE 0x0001
  287. #define ATTRID_GP_COMM_MODE 0x0002
  288. #define ATTRID_GP_COMM_EXIT_MODE 0x0003
  289. #define ATTRID_GP_COMM_WINDOW 0x0004
  290. #define ATTRID_GP_SECURITY_LEVEL 0x0005
  291. #define ATTRID_GP_SHARED_SECURITY_KEYTYPE 0x0020
  292. #define ATTRID_GP_SHARED_SECURITY_KEY 0x0021
  293. #define ATTRID_GP_LINK_KEY 0x0022
  294. // Client Attributes
  295. #define ATTRID_GP_MAX_PROXY_ENTRIES 0x0010
  296. #define ATTRID_GP_PROXY_TABLE 0x0011
  297. #define ATTRID_GP_NOTIFICATION_RETRY_NUMBER 0x0012
  298. #define ATTRID_GP_NOTIFICATION_RETRY_TIMER 0x0013
  299. #define ATTRID_GP_MAX_SEARCH_COUNTER 0x0014
  300. #define ATTRID_GP_BLOCKED_SRC_ID 0x0015
  301. // Server Commands
  302. #define COMMAND_ZGP_NOTIFICATION 0x00
  303. #define COMMAND_ZGP_PAIRING_SEARCH 0x01
  304. #define COMMAND_ZGP_TUNNELING_STOP 0x03
  305. #define COMMAND_ZGP_COMMISSIONING_NOTIFICATION 0x04
  306. #define COMMAND_ZGP_COMMISSIONING_SUCCESS 0x05
  307. #define COMMAND_ZGP_TRANSLATION_TABLE_UPDATE 0x07
  308. #define COMMAND_ZGP_TRANSLATION_TABLE_REQUEST 0x08
  309. #define COMMAND_ZGP_CONFIGURE_PAIRING 0x09
  310. // Client Commands
  311. #define COMMAND_ZGP_NOTIFICATION_RESPONSE 0x00
  312. #define COMMAND_ZGP_PAIRING 0x01
  313. #define COMMAND_ZGP_PROXY_COMMISSIONING_MODE 0x02
  314. #define COMMAND_ZGP_RESPONSE 0x06
  315. #define COMMAND_ZGP_TRANSLATION_TABLE_RESPONSE 0x08
  316. // Command Header Lengths
  317. #define ZGP_CMDHDRLEN_NOTIFICATION 11
  318. #define ZGP_CMDHDRLEN_NOTIFICATION_EXTENDED 3
  319. #define ZGP_CMDHDRLEN_COMMISSIONING_NOTIFICATION 10
  320. #define ZGP_CMDHDRLEN_TRANSLATION_TABLE_UPDATE 6
  321. #define ZGP_CMD_TRANSLATION_TABLE_ENTRY_LEN 7
  322. #define ZGP_CMD_TRANSLATION_TABLE_RSP_ENTRY_LEN 12
  323. #define ZGP_CMDHDRLEN_CONFIGURE_PAIRING 8
  324. #define ZGP_CMDHDRLEN_PAIRING 6
  325. #define ZGP_CMDHDRLEN_RESPONSE 8
  326. #define ZGP_CMDHDRLEN_TRANSLATION_TABLE_RESPONSE 4
  327. // Tunneling/Communication Modes
  328. #define ZGP_TUNNEL_MODE_UNICAST 0x00
  329. #define ZGP_TUNNEL_MODE_GROUP_DGROUPID 0x01
  330. #define ZGP_TUNNEL_MODE_GROUP_COMM_GROUPID 0x02
  331. #define ZGP_TUNNEL_MODE_UNICAST_MINIMAL 0x03
  332. // Security Key Types
  333. #define ZGP_KEYTYPE_NONE 0
  334. #define ZGP_KEYTYPE_NWK 1
  335. #define ZGP_KEYTYPE_GROUP 2
  336. #define ZGP_KEYTYPE_NWK_DERIVED_GROUP 3
  337. #define ZGP_KEYTYPE_OOBKEY 4
  338. #define ZGP_KEYTYPE_DERIVED_INDIVIDUAL 7
  339. // Security Level Mode
  340. #define ZGP_SECURITY_LEVEL_NONE 0
  341. #define ZGP_SECURITY_LEVEL_SMALL 1
  342. #define ZGP_SECURITY_LEVEL_LONG 2
  343. #define ZGP_SECURITY_LEVEL_FULL 3
  344. #define ZGP_SECURITY_LEVEL_SMALL_MIC_SIZE 2
  345. #define ZGP_SECURITY_LEVEL_STD_MIC_SIZE 4
  346. // Exit Mode Attribute definitions (bitmap)
  347. #define ZGP_EXIT_MODE_ON_COMMISSIONING_WINDOW_EXPIRATION 0x01
  348. #define ZGP_EXIT_MODE_ON_FIRST_PAIRING_SUCCESS 0x02
  349. #define ZGP_EXIT_MODE_ON_PROXY_COMMISSIONING_MODE 0x04
  350. // ATTRID_GP_SHARED_SECURITY_KEYTYPE
  351. #define ZGP_SHARED_KEYTYPE_NONE 0x00
  352. #define ZGP_SHARED_KEYTYPE_NWK 0x01
  353. #define ZGP_SHARED_KEYTYPE_GROUP 0x02
  354. #define ZGP_SHARED_KEYTYPE_NWK_DERIVED_GROUP 0x03
  355. #define ZGP_TEMP_MASTER_CHANNEL_MASK 0x0F
  356. // Radius field for groupcast communication
  357. #define ZGP_GROUPCAST_RADIUS_DEFAULT 0xFF
  358. // Translation Table NV definitions
  359. #define ZGP_TRANSLATIONTABLE_ENTRY_MAX_ENDPOINTS 5
  360. #define ZGP_TRANSLATIONTABLE_ENTRY_MAX_PAYLOAD_LEN 4
  361. /*********************************************************************
  362. * TYPEDEFS
  363. */
  364. // Sink Table Entry Options field
  365. typedef struct
  366. {
  367. unsigned int commMode:2; // accepted tunneling mode for this SrcID. ie. ZGP_TUNNEL_MODE_UNICAST
  368. unsigned int seqNumCap:1; //
  369. unsigned int rxOnCap:1; // reception capability on this ZGPD.
  370. unsigned int fixedLoc:1; // set if the location of this ZGPD is expected to change.
  371. unsigned int assignAlias:1; // indicates that the assigned alias as stored in the ZGPD AssignedAlias field shall be used instead of the alias derived from SrcID.
  372. unsigned int secUse:1; // Security related fields of the Sink Table entry are present
  373. unsigned int commissioned:1; // Reserved for future use
  374. } gpSinkTableOptionsBits_t;
  375. // ZGP Sink Table Options field bitmap
  376. typedef union
  377. {
  378. gpSinkTableOptionsBits_t optBits;
  379. uint8 optByte;
  380. } gpSinkTableOptions_t;
  381. // ZGP Sink Table Security Options field
  382. typedef struct
  383. {
  384. unsigned int level:2; // security Level
  385. unsigned int keyType:3; // Key Type
  386. unsigned int reserved:3; // Reserved for future use
  387. } gpSinkTableSecOptionsBits_t;
  388. typedef union
  389. {
  390. gpSinkTableSecOptionsBits_t optBits;
  391. uint8 optByte;
  392. } gpSinkTableSecOptions_t;
  393. //typedef struct
  394. //{
  395. // uint8 endpoint;
  396. // uint16 clusterID;
  397. //} zgpPairedEndpoint_t;
  398. // ZGP Sink Table Entry
  399. typedef struct
  400. {
  401. uint32 srcID; // srcID of the paired ZGPD
  402. uint8 deviceID; // The paired device's ID.
  403. gpSinkTableOptions_t bitmap; // Options field
  404. gpSinkTableSecOptions_t secOptions; // The security options
  405. uint16 tempMaster; // Temp Master
  406. uint8 seqNum; // The last received sequence number from this ZGPD
  407. uint16 preCommGroupID; // Pre-Commissioned Group ID
  408. uint16 assignedAlias; // The commissioned 16 bit ID to be used as alias for this ZGPD
  409. uint8 groupcastRadius; // The range limit of groupcast
  410. uint32 secFrameCounter; // The incoming security frame counter for the srcID
  411. uint8 secKey[SEC_KEY_LEN]; // The security key for the srcID. It me be skipped, if common/derived key is used (as indicated by securityUse)
  412. // uint8 numEndpoints; // number of elements in the following array
  413. // zgpPairedEndpoint_t endpoints[]; // array of endpoints
  414. // shorthand "Options" access
  415. #define ST_commissioned bitmap.optBits.commissioned
  416. #define ST_securityUse bitmap.optBits.secUse
  417. #define assignedAliasFlag bitmap.optBits.assignAlias
  418. #define fixedLocation bitmap.optBits.fixedLoc
  419. #define rxOnCapability bitmap.optBits.rxOnCap
  420. #define seqNumCapability bitmap.optBits.seqNumCap
  421. #define tunnelCommMode bitmap.optBits.commMode
  422. } zclGP_SinkTableEntry_t;
  423. // Proxy Table Entry Options field
  424. typedef struct
  425. {
  426. unsigned int entryActive:1; // indicates that the current Proxy Table entry is active. A Proxy Table entry with the EntryActive flag equal to 0b0 can contain the SearchCounter field
  427. unsigned int entryValid:1; // indicates that the current Proxy Table entry contains complete sink information
  428. unsigned int seqNumCap:1; //
  429. unsigned int unicastZGPS:1; // indicates that there is at least one ZGPS paired to this SrcID, that require unicast communication mode. Then, Sink address list field is present.
  430. unsigned int derivedGroupZGPS:1; // indicates that there is at least one ZGPS paired to this SrcID, that requires groupcast communication mode with automatically-derived DGroupID
  431. unsigned int commGroupZGPS:1; // indicates that there is at least one ZGPS paired to this SrcID, that require groupcast communication mode with the commissioned GroupID
  432. unsigned int firstToFwd:1; // flag used for zgppTunnelingDelay calculation
  433. unsigned int inRange:1; // indicates that this ZGPD is in range if this ZGPP. The default value is FALSE
  434. unsigned int ZGPDFixed:1; // indicates portability capabilities of this ZGPD. The default value is FALSE
  435. unsigned int allUnicastRoutes:1; // if set to 0b1, indicates that the ZGPP has active routes to all unicast sinks for this SrcID; if set to 0b0, it indicates that at least one unicast route is missing.
  436. unsigned int assignedAlias:1; // indicates that the ZGPD has an assigned alias
  437. unsigned int securityUse:1; // indicates that security-related fields of the Sink Table entry are present
  438. unsigned int reserved:4; // Reserved for future use
  439. } gpProxyTableOptionsBits_t;
  440. // ZGP Proxy Table Options field bitmap
  441. typedef union
  442. {
  443. gpProxyTableOptionsBits_t optBits;
  444. uint8 optWord;
  445. } gpProxyTableOptions_t;
  446. // ZGP Sink Table Security Options field
  447. typedef struct
  448. {
  449. unsigned int level:2; // security Level
  450. unsigned int keyType:3; // Key Type
  451. unsigned int reserved:3; // Reserved for future use
  452. } gpProxyTableSecOptionsBits_t;
  453. typedef union
  454. {
  455. gpProxyTableSecOptionsBits_t optBits;
  456. uint8 optByte;
  457. } gpProxyTableSecOptions_t;
  458. typedef struct
  459. {
  460. uint8 ieeeAddr[Z_EXTADDR_LEN];
  461. uint16 nwkAddr;
  462. } zgpAddressList_t;
  463. // ZGP Proxy Table Entry
  464. typedef struct
  465. {
  466. uint32 srcID; // srcID of the paired ZGPD
  467. gpProxyTableOptions_t bitmap; // Options field
  468. gpProxyTableSecOptions_t secOptions; // The security options
  469. uint8 seqNum; // The last received sequence number from this ZGPD
  470. uint16 assignedAlias; // The commissioned 16 bit ID to be used as alias for this ZGPD
  471. uint32 secFrameCounter; // The incoming security frame counter for the srcID
  472. uint8 secKey[SEC_KEY_LEN]; // The security key for the srcID. It me be skipped, if common/derived key is used (as indicated by securityUse)
  473. uint8 numSinkAddrs; // The number of items in the Sink Address List
  474. uint8 numSinkGroups; // The number of items in the Sink Group List
  475. uint8 groupcastRadius; // The range limit of groupcast
  476. uint8 searchCounter;
  477. // shorthand "Options" access
  478. #define PT_securityUse bitmap.optBits.securityUse
  479. #define PT_assignedAlias bitmap.optBits.assignedAlias
  480. #define PT_allUnicastRoutes bitmap.optBits.allUnicastRoutes
  481. #define PT_ZGPDFixed bitmap.optBits.ZGPDFixed
  482. #define PT_inRange bitmap.optBits.inRange
  483. #define PT_firstToFwd bitmap.optBits.firstToFwd
  484. #define PT_commGroupZGPS bitmap.optBits.commGroupZGPS
  485. #define PT_derivedGroupZGPS bitmap.optBits.derivedGroupZGPS
  486. #define PT_unicastZGPS bitmap.optBits.unicastZGPS
  487. #define PT_seqNumCap bitmap.optBits.seqNumCap
  488. #define PT_entryValid bitmap.optBits.entryValid
  489. #define PT_entryActive bitmap.optBits.entryActive
  490. } zclGP_ProxyTableEntry_t;
  491. typedef struct
  492. {
  493. zclGP_ProxyTableEntry_t *pHdr; // Proxy Table Entry fields
  494. zgpAddressList_t *pAddrList; // Proxy Table Sink Address List
  495. uint16 *pGroupList; // Proxy Table Sink Group List
  496. } zclGP_ProxyTable_t;
  497. // ZGP Notification Options field bitmap
  498. typedef struct
  499. {
  500. unsigned int alsoUcast:1; // Indicates presence of ZGPSs paired to the same srcID with a different communications mode, as stored in this ZGPP's Green Power Device Table
  501. unsigned int alsoDerivedGrp:1; // Indicates presence of ZGPSs paired to the same srcID with a different communications mode, as stored in this ZGPP's Green Power Device Table
  502. unsigned int alsoCommGrp:1; // Indicates presence of ZGPSs paired to the same srcID with a different communications mode, as stored in this ZGPP's Green Power Device Table
  503. unsigned int secLevel:2; // GPDF security level field
  504. unsigned int secKeyType:3; // GPDF security key type field
  505. unsigned int appointTempMst:1; // When set, indiates that the fields ZGPP short address and ZGPP Distance are present
  506. unsigned int zgppGPDFTxQFull:1; // indicates whether the ZGPP can still receive and store a GPDF Response for this SGPD srcID
  507. unsigned int reserved:6; // Reserved for future use
  508. } notificationOptionsbits_t;
  509. // ZGP Notification Options field bitmap
  510. typedef union
  511. {
  512. notificationOptionsbits_t optBits;
  513. uint16 optWord;
  514. } notificationOptions_t;
  515. // ZGP Notification
  516. typedef struct
  517. {
  518. notificationOptions_t bitmap;
  519. uint32 ZGPDSrcID;
  520. uint32 ZGPDSecFrameCounter;
  521. uint8 ZGPDCmdID;
  522. uint16 ZGPPShortAddr;
  523. uint8 ZGPPDistance;
  524. uint8 payloadLen;
  525. uint8 *pZGPDCmdPayload;
  526. // shorthand "Options" access
  527. #define zgppGPDFTxQueueFull bitmap.optBits.zgppGPDFTxQFull
  528. #define ZGPPpresent bitmap.optBits.appointTempMst
  529. #define notificationSecKeyType bitmap.optBits.secKeyType
  530. #define notificationSecLevel bitmap.optBits.secLevel
  531. #define alsoCommissionedGroup bitmap.optBits.alsoCommGrp
  532. #define alsoDerivedGroup bitmap.optBits.alsoDerivedGrp
  533. #define alsoUnicast bitmap.optBits.alsoUcast
  534. } zclGPNotification_t;
  535. // ZGP Pairing Search "Options" field
  536. typedef struct
  537. {
  538. unsigned int reqUCastSinks:1; // the proxy requests pairing information on uinicast sinks for the specified ZGPD
  539. unsigned int reqDerivedGCSinks:1; // the proxy requests pairing information on sinks accepting derived groupcast communication mode for the specified ZGPD
  540. unsigned int reqCommGCSinks:1; // the proxy requests pairing information on sinks accepting commissioned GroupID communication mode for the specified ZGPD
  541. unsigned int reqZGPDFC:1; // the proxy requests the security frame counter for the specified ZGPD
  542. unsigned int reqZGPDKey:1; // the proxy requests the security key for the specified ZGPD
  543. unsigned int reserved:3; // Reserved for future use
  544. } pairingSearchOptionsbits_t;
  545. // ZGP Pairing Search Options field bitmap
  546. typedef union
  547. {
  548. pairingSearchOptionsbits_t optBits;
  549. uint8 optByte;
  550. } pairingSearchOptions_t;
  551. // ZGP Pairing Search
  552. typedef struct
  553. {
  554. pairingSearchOptions_t bitmap;
  555. uint32 ZGPDSrcID;
  556. // shorthand "Options" access
  557. #define requestZGPDKey bitmap.optBits.reqZGPDKey
  558. #define requestZGPDFrameCounter bitmap.optBits.reqZGPDFC
  559. #define requestCommGroupcastSinks bitmap.optBits.reqCommGCSinks
  560. #define requestDerivedGroupcastSinks bitmap.optBits.reqDerivedGCSinks
  561. #define requestUnicastSinks bitmap.optBits.reqUCastSinks
  562. } zclGPPairingSearch_t;
  563. // ZGP Tunneling Stop "Options" field
  564. typedef struct
  565. {
  566. unsigned int alsoDerivedGp:1; // indicates the presence of derived Groupcast sink for the specified ZGPD
  567. unsigned int alsoCommGp:1; // indicates the presence of commissioned Groupcast sink for the specified ZGPD
  568. unsigned int reserved:6; // Reserved for future use
  569. } tunnelingStopOptionsbits_t;
  570. // ZGP Tunneling Stop Options field bitmap
  571. typedef union
  572. {
  573. tunnelingStopOptionsbits_t optBits;
  574. uint8 optByte;
  575. } tunnelingStopOptions_t;
  576. // ZGP Tunneling Stop
  577. typedef struct
  578. {
  579. tunnelingStopOptions_t bitmap;
  580. uint32 ZGPDSrcID;
  581. uint32 ZGPDFrameCounter;
  582. uint16 ZGPPShortAddr;
  583. uint8 ZGPPDistance;
  584. // These fields aren't sent over the air
  585. // They are used when queueing the message
  586. uint8 ZGPDCmdID;
  587. uint8 payloadLen;
  588. uint8 *pPayload;
  589. // shorthand "Options" access
  590. #define tsAlsoCommGrp bitmap.optBits.alsoCommGp
  591. #define tsAlsoDerivedGrp bitmap.optBits.alsoDerivedGp
  592. } zclGPTunnelingStop_t;
  593. // ZGP Commissioning Notification Options field bitmap
  594. typedef struct
  595. {
  596. unsigned int appTempMaster:1; // allows the ZGPP to request ZGPS to select a ZGPP to foward commisioning reply to GPDF to this ZGPD
  597. unsigned int secLevel:2; // GPDF security level field
  598. unsigned int secKeyType:3; // GPDF security key type field
  599. unsigned int secProcFailed:1; // the commissioning GPDF was protected but the security check failed
  600. unsigned int reserved:1; // Reserved for future use
  601. } notCommOptionsbits_t;
  602. // ZGP Commissioning Notification Options field bitmap
  603. typedef union
  604. {
  605. notCommOptionsbits_t optBits;
  606. uint8 optByte;
  607. } notCommOptions_t;
  608. // ZGP Commissioning Notification
  609. typedef struct
  610. {
  611. notCommOptions_t bitmap;
  612. uint32 ZGPDSrcID;
  613. uint32 ZGPDFrameCounter;
  614. uint16 ZGPPShortAddr;
  615. uint8 ZGPPDistance;
  616. uint8 ZGPDCmdID;
  617. uint32 MIC;
  618. uint8 payloadLen;
  619. uint8 *pPayload;
  620. // shorthand "Options" access
  621. #define secProcessingFailed bitmap.optBits.secProcFailed
  622. #define commSecKeyType bitmap.optBits.secKeyType
  623. #define commSecLevel bitmap.optBits.secLevel
  624. #define appointTempMaster bitmap.optBits.appTempMaster
  625. } zclGPCommNotification_t;
  626. // ZGP Translation Table
  627. typedef struct
  628. {
  629. uint8 ZGPDCmdID; // ZGPD Command ID
  630. uint16 profileID; // destination profile ID
  631. uint16 clusterID; // destination cluster ID
  632. uint8 cmdID; // destination command ID
  633. uint8 cmdPayloadLen;
  634. uint8 cmdPayload[ZGP_TRANSLATIONTABLE_ENTRY_MAX_PAYLOAD_LEN];
  635. } zgpTranslationTableUpdateRec_t;
  636. // ZGP Translation Table Response
  637. typedef struct
  638. {
  639. uint32 ZGPDSrcID; // ZGPD ID
  640. uint8 ZGPDCmdID; // ZGPD Command ID
  641. uint8 endPoint; // destination endpoint
  642. uint16 profileID; // destination profile ID
  643. uint16 clusterID; // destination cluster ID
  644. uint8 cmdID; // destination command ID
  645. uint8 cmdPayloadLen;
  646. uint8 cmdPayload[ZGP_TRANSLATIONTABLE_ENTRY_MAX_PAYLOAD_LEN];
  647. } zgpTranslationTableListEntry_t;
  648. typedef struct
  649. {
  650. unsigned int addTranslation:1;
  651. unsigned int translationsNum:3;
  652. unsigned int reserved:4;
  653. } zgpTranslationTableUpdateOptionsBits_t;
  654. typedef union
  655. {
  656. zgpTranslationTableUpdateOptionsBits_t optBits;
  657. uint8 optByte;
  658. } zgpTranslationTableUpdateOptions_t;
  659. // ZGP Translation Table Update Options field bitmap
  660. typedef struct
  661. {
  662. zgpTranslationTableUpdateOptions_t bitmap;
  663. uint32 ZGPDSrcID;
  664. uint8 endPoint;
  665. zgpTranslationTableUpdateRec_t translationsSet[];
  666. // shorthand "Options" access
  667. #define TT_UpdateAddTrans bitmap.optBits.addTranslation
  668. #define TT_UpdateTransNum bitmap.optBits.translationsNum
  669. } zclGPTranslationTableUpdate_t;
  670. // ZGP Translation Table Response Command
  671. typedef struct
  672. {
  673. uint8 status; // SUCCESS or NOT_SUPPORTED
  674. uint8 totalNumEntries; // number of entries in the ZGPD Command Translation Table of this ZGPS
  675. uint8 startIndex; // this value equals the value in the request command
  676. uint8 count; // number of translation table entries in this response command
  677. zgpTranslationTableListEntry_t transTable[]; // translation table entries
  678. } zclGPTranslationTableResponse_t;
  679. // ZGP Translation Table Request Command
  680. typedef struct
  681. {
  682. uint8 startIndex; // The starting index into the ZGPD command translation table from which to get device information.
  683. } zclGPTranslationRequest_t;
  684. // ZGP Notification Response Options field bitmap
  685. typedef struct
  686. {
  687. unsigned int firstToFwd:1; // The notification reached the ZGPS first
  688. unsigned int noPairingFlag:1; // Indicates the sink has no pairing with the srcID
  689. unsigned int reserved:6; // Reserved for future use
  690. } notRspOptionsbits_t;
  691. // ZGP Notification Response Options field bitmap
  692. typedef union
  693. {
  694. notRspOptionsbits_t optBits;
  695. uint8 optByte;
  696. } notRspOptions_t;
  697. // ZGP Notification Response
  698. typedef struct
  699. {
  700. notRspOptions_t bitmap;
  701. uint32 ZGPDSrcID;
  702. uint32 ZGPDFrameCounter;
  703. // shorthand "Options" access
  704. #define noPairing bitmap.optBits.noPairingFlag
  705. #define firstToForward bitmap.optBits.firstToFwd
  706. } zclGPNotificationRsp_t;
  707. // ZGP Pairing Options field bitmap
  708. typedef struct
  709. {
  710. unsigned int addSink:1; // whether the ZGP Sink wishes to add or remove Proxy Table pairing to the ZGPD
  711. unsigned int removeZGPD:1; // indicates (1) that the ZGPD is being removed from the network.
  712. unsigned int commMode:2; // communication mode requested by the ZGPS. ie ZGP_TUNNEL_MODE_UNICAST
  713. unsigned int zgpdFixed:1; // if set, copy the FixedLocation field of the Sink Table
  714. unsigned int macSeqNoCap:1; // if set, copy the MAC sequence number capabilities from the Sink Table
  715. unsigned int secLevel:2; // carry the values from the Sink Table
  716. unsigned int secKeyType:3; // carry the values from the Sink Table
  717. unsigned int fcPresent:1; // indicates whether the Security Frame Counter is present
  718. unsigned int keyPresent:1; // indicates whether the Security key is present
  719. unsigned int aliasPresent:1; // indicates whether the Assigned Alias is present in this message
  720. unsigned int fwdRadiusPresent:1; // indicates whether the Forward Radius is present in this message
  721. unsigned int reserved:1; // Reserved for future use
  722. } pairingOptionsbits_t;
  723. // ZGP Pairing Options field bitmap
  724. typedef union
  725. {
  726. pairingOptionsbits_t optBits;
  727. uint16 optWord;
  728. } pairingOptions_t;
  729. // ZGP Pairing Command
  730. typedef struct
  731. {
  732. pairingOptions_t bitmap;
  733. uint32 ZGPDSrcID;
  734. uint8 sinkIEEEAddr[Z_EXTADDR_LEN];
  735. uint16 sinkNwkAddr;
  736. uint16 sinkGroupID;
  737. uint8 deviceID;
  738. uint32 ZGPDFrameCounter;
  739. uint8 ZGPDKey[SEC_KEY_LEN];
  740. uint16 assignedAlias;
  741. uint8 forwardingRadius;
  742. // shorthand "Options" access
  743. #define pairingFwdRadiusPresent bitmap.optBits.fwdRadiusPresent
  744. #define pairingAliasPresent bitmap.optBits.aliasPresent
  745. #define pairingsecKeyPresent bitmap.optBits.keyPresent
  746. #define pairingsecFCPresent bitmap.optBits.fcPresent
  747. #define pairingtempMasterPresent bitmap.optBits.tempMasterPresent
  748. #define pairingSecKeyType bitmap.optBits.secKeyType
  749. #define pairingSecLevel bitmap.optBits.secLevel
  750. #define pairingMacSeqNoCap bitmap.optBits.macSeqNoCap
  751. #define pairingFixedLocation bitmap.optBits.zgpdFixed
  752. #define pairingCommMode bitmap.optBits.commMode
  753. #define pairingRemoveZGPD bitmap.optBits.removeZGPD
  754. #define pairingAddSink bitmap.optBits.addSink
  755. } zclGPPairing_t;
  756. // ZGP Proxy Commissioning Mode Options field bitmap
  757. typedef struct
  758. {
  759. unsigned int action:1; // indicates a request to enter commissioning mode, if 0 indicates a request to exist commissioning mode
  760. unsigned int exitMode:2; // zgpsCommissioningExitMode attribute bitmap. ie. ZGP_EXIT_MODE_ON_COMMISSIONING_WINDOW_EXPIRATION
  761. unsigned int channelPresent:1; // indicates whether the channel field is present
  762. unsigned int feedback:1; // if set, it requests proxies to report commissioning success on successfully sending GPDF Commissioning Response frame, if 0, it request to report receiving Commissioning GPDF with the correct parameter values.
  763. unsigned int reserved:2; // Reserved for future use
  764. } proxyCommOptionsbits_t;
  765. // ZGP Proxy Commissioning Mode Options field bitmap
  766. typedef union
  767. {
  768. proxyCommOptionsbits_t optBits;
  769. uint8 optByte;
  770. } proxyCommOptions_t;
  771. // ZGP Proxy Commissioning Mode Command
  772. typedef struct
  773. {
  774. proxyCommOptions_t bitmap;
  775. uint16 commissioningWindow;
  776. uint8 channel;
  777. // shorthand "Options" access
  778. #define proxyCommFeedback bitmap.optBits.feedback
  779. #define proxyCommChannelPresent bitmap.optBits.channelPresent
  780. #define proxyCommExitMode bitmap.optBits.exitMode
  781. #define proxyCommAction bitmap.optBits.action
  782. } zclGPProxyCommMode_t;
  783. // ZGP Response Command
  784. typedef struct
  785. {
  786. uint16 ZGPPShortAddr; // address of the ZGPP which will transmit the GPDF Response frame to the ZGPD
  787. uint8 ZGPPTxChan; // indicates the channel the Response GPDF will be sent on.
  788. uint32 ZGPDSrcID; // intended ZGPD
  789. uint8 ZGPDCmdID; // ZGPD command ID
  790. uint8 payloadLen; // Length of the payload field
  791. uint8 payload[]; // GPDF command payload field
  792. } zclGPDResponse_t;
  793. // ZGP Configure Pairing Command
  794. typedef struct
  795. {
  796. zclGP_SinkTableEntry_t sinkTableParams;
  797. uint8 pairedEPsNum;
  798. uint8 *pPairedEPsSet;
  799. } zclGPConfigurePairingCmd_t;
  800. // This callback is called to process a Notification command
  801. typedef ZStatus_t (*zclGP_NotificationCB_t)( uint8 transSeqNum, zclGPNotification_t *pCmd );
  802. // This callback is called to process a Pairing Search command
  803. typedef ZStatus_t (*zclGP_PairingSearchCB_t)( uint8 transSeqNum, zclGPPairingSearch_t *pCmd );
  804. // This callback is called to process a Tunnel Stop command
  805. typedef ZStatus_t (*zclGP_TunnelStopCB_t)( uint8 transSeqNum, zclGPTunnelingStop_t *pCmd );
  806. // This callback is called to process a Commissioning Notification command
  807. typedef ZStatus_t (*zclGP_CommissioningNotificationCB_t)( uint8 transSeqNum, zclGPCommNotification_t *pCmd );
  808. // This callback is called to process a Translation Table Update command
  809. typedef ZStatus_t (*zclGP_TranslationTableUpdateCB_t)( uint8 transSeqNum, zclGPTranslationTableUpdate_t *pCmd );
  810. // This callback is called to process a Translation Table Request command
  811. typedef ZStatus_t (*zclGP_TranslationTableRequestCB_t)( uint8 transSeqNum, zclGPTranslationRequest_t *pCmd );
  812. // This callback is called to process a Configure Pairing command
  813. typedef ZStatus_t (*zclGP_ConfigurePairingCB_t)( uint8 transSeqNum, zclGPConfigurePairingCmd_t *pCmd);
  814. // This callback is called to process a Notification Response command
  815. typedef ZStatus_t (*zclGP_NotificationResponseCB_t)( uint8 transSeqNum, zclGPNotificationRsp_t *pCmd );
  816. // This callback is called to process a Pairing command
  817. typedef ZStatus_t (*zclGP_PairingCB_t)( uint8 transSeqNum, zclGPPairing_t *pCmd );
  818. // This callback is called to process a Proxy Commissioning Mode command
  819. typedef ZStatus_t (*zclGP_ProxyCommissioningModeCB_t)( uint8 transSeqNum, zclGPProxyCommMode_t *pCmd );
  820. // This callback is called to process a Response command
  821. typedef ZStatus_t (*zclGP_ResponseCB_t)( uint8 transSeqNum, zclGPDResponse_t *pCmd );
  822. // This callback is called to process a Translation Table Response command
  823. typedef ZStatus_t (*zclGP_TranslationTableResponseCB_t)( uint8 transSeqNum, zclGPTranslationTableResponse_t *pCmd );
  824. // Register Callbacks table entry - enter function pointers for callbacks that
  825. // the application would like to receive
  826. typedef struct
  827. {
  828. // Received Server Commands
  829. zclGP_NotificationCB_t pfnNotification; // Notification Command
  830. zclGP_PairingSearchCB_t pfnPairingSearch; // Pairing Search Command
  831. zclGP_TunnelStopCB_t pfnTunnelStop; // Tunnel Stop Command
  832. zclGP_CommissioningNotificationCB_t pfnCommissioningNotification; // Commissioning Notification Command
  833. zclGP_TranslationTableUpdateCB_t pfnTranslationTableUpdate; // Translation Table Update Command
  834. zclGP_TranslationTableRequestCB_t pfnTranslationTableRequest; // Translation Table Request Command
  835. zclGP_ConfigurePairingCB_t pfnConfigurePairing; // Configure Pairing Command
  836. // Received Client Commands
  837. zclGP_NotificationResponseCB_t pfnNotificationResponse; // Notification Response Command
  838. zclGP_PairingCB_t pfnPairing; // Pairing Command
  839. zclGP_ProxyCommissioningModeCB_t pfnProxyCommissioningMode; // Proxy Commissioning Mode Command
  840. zclGP_ResponseCB_t pfnResponse; // Response Command
  841. zclGP_TranslationTableResponseCB_t pfnTranslationTableResponse; // Translation Table Response Command
  842. } zclGP_AppCallbacks_t;
  843. /*********************************************************************
  844. * VARIABLES
  845. */
  846. /*********************************************************************
  847. * FUNCTIONS
  848. */
  849. /*
  850. * Register for callbacks from this cluster library
  851. */
  852. extern ZStatus_t zclGP_RegisterCmdCallbacks( uint8 endpoint, zclGP_AppCallbacks_t *callbacks );
  853. /*
  854. * Call to send out a Notification Command
  855. * pNotification - all of the command's parameters
  856. */
  857. extern ZStatus_t zclGP_Send_Notification( uint8 srcEP, afAddrType_t *dstAddr,
  858. zclGPNotification_t *pNotification,
  859. uint8 disableDefaultRsp, uint8 seqNum );
  860. /*
  861. * Call to send out a Pairing Search Command
  862. * pPairingSearch - all of the command's parameters
  863. */
  864. extern ZStatus_t zclGP_Send_PairingSearch( uint8 srcEP, afAddrType_t *dstAddr,
  865. zclGPPairingSearch_t *pPairingSearch,
  866. uint8 disableDefaultRsp, uint8 seqNum );
  867. /*
  868. * Call to send out a Tunneling Stop Command
  869. * pTunnelingStop - all of the command's parameters
  870. */
  871. extern ZStatus_t zclGP_Send_TunnelingStop( uint8 srcEP, afAddrType_t *dstAddr,
  872. zclGPTunnelingStop_t *pTunnelingStop,
  873. uint8 disableDefaultRsp, uint8 seqNum );
  874. /*
  875. * Call to send out a Commissioning Notification Command
  876. * pCommNotif - all of the command's parameters
  877. */
  878. extern ZStatus_t zclGP_Send_CommissioningNotification( uint8 srcEP, afAddrType_t *dstAddr,
  879. zclGPCommNotification_t *pCommNotif,
  880. uint8 disableDefaultRsp, uint8 seqNum );
  881. /*
  882. * Call to send out a Translation Table Update Command
  883. * pTransTableUpdate - all of the command's parameters
  884. */
  885. extern ZStatus_t zclGP_Send_TranslationTableUpdate( uint8 srcEP, afAddrType_t *dstAddr,
  886. zclGPTranslationTableUpdate_t *pTransTableUpdate,
  887. uint8 disableDefaultRsp, uint8 seqNum );
  888. /*
  889. * Call to send out a Translation Table Request Command
  890. * pTransTableReq - all of the command's parameters
  891. */
  892. extern ZStatus_t zclGP_Send_TranslationTableRequest( uint8 srcEP, afAddrType_t *dstAddr,
  893. zclGPTranslationRequest_t *pTransTableReq,
  894. uint8 disableDefaultRsp, uint8 seqNum );
  895. /*
  896. * Call to send out a Configure Pairing Command
  897. * pConfigPairing - all of the command's parameters
  898. */
  899. extern ZStatus_t zclGP_Send_ConfigurePairing( uint8 srcEP, afAddrType_t *dstAddr,
  900. zclGPConfigurePairingCmd_t *pConfigPairing,
  901. uint8 disableDefaultRsp, uint8 seqNum );
  902. /*
  903. * Call to send out a Notification Response Command
  904. * pNotRsp - all of the command's parameters
  905. */
  906. extern ZStatus_t zclGP_Send_NotificationResponse( uint8 srcEP, afAddrType_t *dstAddr,
  907. zclGPNotificationRsp_t *pNotRsp,
  908. uint8 disableDefaultRsp, uint8 seqNum );
  909. /*
  910. * Call to send out a Pairing Command
  911. * pPairing - all of the command's parameters
  912. */
  913. extern ZStatus_t zclGP_Send_Pairing( uint8 srcEP, afAddrType_t *dstAddr,
  914. zclGPPairing_t *pPairing,
  915. uint8 disableDefaultRsp, uint8 seqNum );
  916. /*
  917. * Call to send out a Proxy Commissioning Mode Command
  918. * pProxyCommMode - all of the command's parameters
  919. */
  920. extern ZStatus_t zclGP_Send_ProxyCommissioningMode( uint8 srcEP, afAddrType_t *dstAddr,
  921. zclGPProxyCommMode_t *pProxyCommMode,
  922. uint8 disableDefaultRsp, uint8 seqNum );
  923. /*
  924. * Call to send out a Response Command
  925. * pRsp - all of the command's parameters
  926. */
  927. extern ZStatus_t zclGP_Send_Response( uint8 srcEP, afAddrType_t *dstAddr,
  928. zclGPDResponse_t *pRsp,
  929. uint8 disableDefaultRsp, uint8 seqNum );
  930. /*
  931. * Call to send out a Translation Table Response Command
  932. * pTransTblRsp - all of the command's parameters
  933. */
  934. extern ZStatus_t zclGP_Send_TranslationTableResponse( uint8 srcEP, afAddrType_t *dstAddr,
  935. zclGPTranslationTableResponse_t *pTransTblRsp,
  936. uint8 disableDefaultRsp, uint8 seqNum );
  937. /*
  938. * Call to send out a ZCL command according to a Translation Table's entry
  939. * pTransTblEntry - the Translation Table's entry with the command's parameters
  940. */
  941. extern ZStatus_t zclGP_Send_TranslatedCommand( afAddrType_t *dstAddr,
  942. zgpTranslationTableListEntry_t *pTransTblEntry,
  943. uint8 disableDefaultRsp, uint8 seqNum );
  944. #ifdef __cplusplus
  945. }
  946. #endif
  947. #endif /* ZCL_GP_H */