ZDProfile.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. /**************************************************************************************************
  2. Filename: ZDProfile.h
  3. Revised: $Date: 2010-11-01 13:26:00 -0700 (Mon, 01 Nov 2010) $
  4. Revision: $Revision: 24298 $
  5. Description: This file contains the interface to the Zigbee Device Object.
  6. Copyright 2004-2010 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 ZDPROFILE_H
  34. #define ZDPROFILE_H
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. /*********************************************************************
  40. * INCLUDES
  41. */
  42. #include "ZComDef.h"
  43. #include "NLMEDE.h"
  44. #include "AF.h"
  45. #include "ZDConfig.h"
  46. /*********************************************************************
  47. * CONSTANTS
  48. */
  49. #define ZDO_EP 0 // Endpoint of ZDO
  50. #define ZDO_PROFILE_ID 0
  51. // IEEE_addr_req request types
  52. #define ZDP_ADDR_REQTYPE_SINGLE 0
  53. #define ZDP_ADDR_REQTYPE_EXTENDED 1
  54. // ZDO Status Values
  55. #define ZDP_SUCCESS 0x00 // Operation completed successfully
  56. #define ZDP_INVALID_REQTYPE 0x80 // The supplied request type was invalid
  57. #define ZDP_DEVICE_NOT_FOUND 0x81 // Reserved
  58. #define ZDP_INVALID_EP 0x82 // Invalid endpoint value
  59. #define ZDP_NOT_ACTIVE 0x83 // Endpoint not described by a simple desc.
  60. #define ZDP_NOT_SUPPORTED 0x84 // Optional feature not supported
  61. #define ZDP_TIMEOUT 0x85 // Operation has timed out
  62. #define ZDP_NO_MATCH 0x86 // No match for end device bind
  63. #define ZDP_NO_ENTRY 0x88 // Unbind request failed, no entry
  64. #define ZDP_NO_DESCRIPTOR 0x89 // Child descriptor not available
  65. #define ZDP_INSUFFICIENT_SPACE 0x8a // Insufficient space to support operation
  66. #define ZDP_NOT_PERMITTED 0x8b // Not in proper state to support operation
  67. #define ZDP_TABLE_FULL 0x8c // No table space to support operation
  68. #define ZDP_NOT_AUTHORIZED 0x8d // Permissions indicate request not authorized
  69. #define ZDP_BINDING_TABLE_FULL 0x8e // No binding table space to support operation
  70. #define ZDP_NETWORK_DISCRIPTOR_SIZE 8
  71. #define ZDP_NETWORK_EXTENDED_DISCRIPTOR_SIZE 14
  72. #define ZDP_RTG_DISCRIPTOR_SIZE 5
  73. #define ZDP_BIND_DISCRIPTOR_SIZE 19
  74. // Mgmt_Permit_Join_req fields
  75. #define ZDP_MGMT_PERMIT_JOIN_REQ_DURATION 0
  76. #define ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG 1
  77. #define ZDP_MGMT_PERMIT_JOIN_REQ_SIZE 2
  78. // Mgmt_Leave_req fields
  79. #define ZDP_MGMT_LEAVE_REQ_REJOIN 1 << 7
  80. #define ZDP_MGMT_LEAVE_REQ_RC 1 << 6 // Remove Children
  81. // Mgmt_Lqi_rsp - (neighbor table) device type
  82. #define ZDP_MGMT_DT_COORD 0x0
  83. #define ZDP_MGMT_DT_ROUTER 0x1
  84. #define ZDP_MGMT_DT_ENDDEV 0x2
  85. // Mgmt_Lqi_rsp - (neighbor table) relationship
  86. #define ZDP_MGMT_REL_PARENT 0x0
  87. #define ZDP_MGMT_REL_CHILD 0x1
  88. #define ZDP_MGMT_REL_SIBLING 0x2
  89. #define ZDP_MGMT_REL_UNKNOWN 0x3
  90. // Mgmt_Lqi_rsp - (neighbor table) unknown boolean value
  91. #define ZDP_MGMT_BOOL_UNKNOWN 0x02
  92. /*********************************************************************
  93. * Message/Cluster IDS
  94. */
  95. // ZDO Cluster IDs
  96. #define ZDO_RESPONSE_BIT_V1_0 ((uint8)0x80)
  97. #define ZDO_RESPONSE_BIT ((uint16)0x8000)
  98. #define NWK_addr_req ((uint16)0x0000)
  99. #define IEEE_addr_req ((uint16)0x0001)
  100. #define Node_Desc_req ((uint16)0x0002)
  101. #define Power_Desc_req ((uint16)0x0003)
  102. #define Simple_Desc_req ((uint16)0x0004)
  103. #define Active_EP_req ((uint16)0x0005)
  104. #define Match_Desc_req ((uint16)0x0006)
  105. #define NWK_addr_rsp (NWK_addr_req | ZDO_RESPONSE_BIT)
  106. #define IEEE_addr_rsp (IEEE_addr_req | ZDO_RESPONSE_BIT)
  107. #define Node_Desc_rsp (Node_Desc_req | ZDO_RESPONSE_BIT)
  108. #define Power_Desc_rsp (Power_Desc_req | ZDO_RESPONSE_BIT)
  109. #define Simple_Desc_rsp (Simple_Desc_req | ZDO_RESPONSE_BIT)
  110. #define Active_EP_rsp (Active_EP_req | ZDO_RESPONSE_BIT)
  111. #define Match_Desc_rsp (Match_Desc_req | ZDO_RESPONSE_BIT)
  112. #define Complex_Desc_req ((uint16)0x0010)
  113. #define User_Desc_req ((uint16)0x0011)
  114. #define Discovery_Cache_req ((uint16)0x0012)
  115. #define Device_annce ((uint16)0x0013)
  116. #define User_Desc_set ((uint16)0x0014)
  117. #define Server_Discovery_req ((uint16)0x0015)
  118. #define Complex_Desc_rsp (Complex_Desc_req | ZDO_RESPONSE_BIT)
  119. #define User_Desc_rsp (User_Desc_req | ZDO_RESPONSE_BIT)
  120. #define Discovery_Cache_rsp (Discovery_Cache_req | ZDO_RESPONSE_BIT)
  121. #define User_Desc_conf (User_Desc_set | ZDO_RESPONSE_BIT)
  122. #define Server_Discovery_rsp (Server_Discovery_req | ZDO_RESPONSE_BIT)
  123. #define End_Device_Bind_req ((uint16)0x0020)
  124. #define Bind_req ((uint16)0x0021)
  125. #define Unbind_req ((uint16)0x0022)
  126. #define Bind_rsp (Bind_req | ZDO_RESPONSE_BIT)
  127. #define End_Device_Bind_rsp (End_Device_Bind_req | ZDO_RESPONSE_BIT)
  128. #define Unbind_rsp (Unbind_req | ZDO_RESPONSE_BIT)
  129. #define Mgmt_NWK_Disc_req ((uint16)0x0030)
  130. #define Mgmt_Lqi_req ((uint16)0x0031)
  131. #define Mgmt_Rtg_req ((uint16)0x0032)
  132. #define Mgmt_Bind_req ((uint16)0x0033)
  133. #define Mgmt_Leave_req ((uint16)0x0034)
  134. #define Mgmt_Direct_Join_req ((uint16)0x0035)
  135. #define Mgmt_Permit_Join_req ((uint16)0x0036)
  136. #define Mgmt_NWK_Update_req ((uint16)0x0038)
  137. #define Mgmt_NWK_Disc_rsp (Mgmt_NWK_Disc_req | ZDO_RESPONSE_BIT)
  138. #define Mgmt_Lqi_rsp (Mgmt_Lqi_req | ZDO_RESPONSE_BIT)
  139. #define Mgmt_Rtg_rsp (Mgmt_Rtg_req | ZDO_RESPONSE_BIT)
  140. #define Mgmt_Bind_rsp (Mgmt_Bind_req | ZDO_RESPONSE_BIT)
  141. #define Mgmt_Leave_rsp (Mgmt_Leave_req | ZDO_RESPONSE_BIT)
  142. #define Mgmt_Direct_Join_rsp (Mgmt_Direct_Join_req | ZDO_RESPONSE_BIT)
  143. #define Mgmt_Permit_Join_rsp (Mgmt_Permit_Join_req | ZDO_RESPONSE_BIT)
  144. #define Mgmt_NWK_Update_notify (Mgmt_NWK_Update_req | ZDO_RESPONSE_BIT)
  145. /*********************************************************************
  146. * TYPEDEFS
  147. */
  148. #define ZDP_BINDINGENTRY_SIZE 19
  149. typedef struct
  150. {
  151. osal_event_hdr_t hdr;
  152. zAddrType_t srcAddr;
  153. uint8 wasBroadcast;
  154. cId_t clusterID;
  155. uint8 SecurityUse;
  156. uint8 TransSeq;
  157. uint8 asduLen;
  158. uint16 macDestAddr;
  159. uint8 *asdu;
  160. } zdoIncomingMsg_t;
  161. // This structure is used to build the Mgmt Network Discover Response
  162. typedef struct
  163. {
  164. uint8 extendedPANID[Z_EXTADDR_LEN]; // The extended PAN ID
  165. uint16 PANId; // The network PAN ID
  166. uint8 logicalChannel; // Network's channel
  167. uint8 stackProfile; // Network's profile
  168. uint8 version; // Network's Zigbee version
  169. uint8 beaconOrder; // Beacon Order
  170. uint8 superFrameOrder;
  171. uint8 permitJoining; // PermitJoining. 1 or 0
  172. } mgmtNwkDiscItem_t;
  173. // This structure is used to build the Mgmt LQI Response
  174. typedef struct
  175. {
  176. uint16 nwkAddr; // device's short address
  177. uint16 PANId; // The neighbor device's PAN ID
  178. uint8 extPANId[Z_EXTADDR_LEN]; // The neighbor device's Extended PanID
  179. uint8 txQuality; // Transmit quality
  180. uint8 rxLqi; // Receive LQI
  181. } neighborLqiItem_t;
  182. #define ZDP_NEIGHBORLQI_SIZE 12
  183. // This structure is used to build the Mgmt_Lqi_rsp
  184. typedef struct
  185. {
  186. uint16 panID; // PAN Id
  187. uint8 extPanID[Z_EXTADDR_LEN];// Extended Pan ID
  188. uint8 extAddr[Z_EXTADDR_LEN]; // Extended address
  189. uint16 nwkAddr; // Network address
  190. uint8 devType; // Device type
  191. uint8 rxOnIdle; // RxOnWhenIdle
  192. uint8 relation; // Relationship
  193. uint8 permit; // Permit joining
  194. uint8 depth; // Depth
  195. uint8 lqi; // LQI
  196. } ZDP_MgmtLqiItem_t;
  197. // devType, rxOnIdle, relation, are all packed into 1 byte: 18-2=16.
  198. #define ZDP_MGMTLQI_SIZE 15
  199. #define ZDP_MGMTLQI_EXTENDED_SIZE 22 // One extra byte for permitJointing, also with extended PanID instead of PanID 15+8-2+1 = 22
  200. // This structure is used to build the Mgmt Routing Response
  201. // NOTICE: this structure must match "rtgEntry_t" in rtg.h
  202. typedef struct
  203. {
  204. uint16 dstAddress; // Destination short address
  205. uint16 nextHopAddress; // next hop short address
  206. uint8 expiryTime; // expiration time - not used for response
  207. uint8 status; // route entry status
  208. uint8 options;
  209. } rtgItem_t;
  210. // expiryTime is not packed & sent OTA.
  211. #define ZDP_ROUTINGENTRY_SIZE 5
  212. typedef struct
  213. {
  214. uint8 TransSeq;
  215. byte SecurityUse;
  216. uint16 srcAddr;
  217. uint16 localCoordinator;
  218. uint8 ieeeAddr[Z_EXTADDR_LEN];
  219. uint8 endpoint;
  220. uint16 profileID;
  221. uint8 numInClusters;
  222. uint16 *inClusters;
  223. uint8 numOutClusters;
  224. uint16 *outClusters;
  225. } ZDEndDeviceBind_t;
  226. /*********************************************************************
  227. * GLOBAL VARIABLES
  228. */
  229. extern byte ZDP_TransID;
  230. extern byte ZDP_TxOptions;
  231. /*********************************************************************
  232. * MACROS
  233. */
  234. /*
  235. * Generic data send function
  236. */
  237. extern afStatus_t ZDP_SendData( uint8 *transSeq, zAddrType_t *dstAddr, uint16 cmd, byte len,
  238. uint8 *buf, byte SecurityEnable );
  239. /*
  240. * ZDP_NodeDescReq - Request a Node Description
  241. *
  242. * @MT SPI_CMD_ZDO_NODE_DESC_REQ
  243. * (UInt16 DstAddr,
  244. * UInt16 NWKAddrOfInterest,
  245. * byte SecuritySuite)
  246. *
  247. */
  248. #define ZDP_NodeDescReq( dstAddr, NWKAddrOfInterest, SecurityEnable ) \
  249. ZDP_NWKAddrOfInterestReq( dstAddr, \
  250. NWKAddrOfInterest, Node_Desc_req, SecurityEnable )
  251. /*
  252. * ZDP_PowerDescReq - Request a Power Description
  253. *
  254. * @MT SPI_CMD_ZDO_POWER_DESC_REQ
  255. * (UInt16 DstAddr,
  256. * UInt16 NWKAddrOfInterest,
  257. * byte SecuritySuit)
  258. *
  259. */
  260. #define ZDP_PowerDescReq( dstAddr, NWKAddrOfInterest, SecurityEnable ) \
  261. ZDP_NWKAddrOfInterestReq( dstAddr, \
  262. NWKAddrOfInterest, Power_Desc_req, SecurityEnable )
  263. /*
  264. * ZDP_ActiveEPReq - Request a device's endpoint list
  265. *
  266. * @MT SPI_CMD_ZDO_ACTIVE_EPINT_REQ
  267. * (UInt16 DstAddr,
  268. * UInt16 NWKAddrOfInterest,
  269. * byte SecuritySuite)
  270. *
  271. */
  272. #define ZDP_ActiveEPReq( dstAddr, NWKAddrOfInterest, SecurityEnable ) \
  273. ZDP_NWKAddrOfInterestReq( dstAddr, \
  274. NWKAddrOfInterest, Active_EP_req, SecurityEnable )
  275. /*
  276. * ZDP_ComplexDescReq - Request a device's complex description
  277. *
  278. * @MT SPI_CMD_ZDO_COMPLEX_DESC_REQ
  279. * (UInt16 DstAddr,
  280. * UInt16 NWKAddrOfInterest,
  281. * byte SecuritySuite)
  282. *
  283. */
  284. #define ZDP_ComplexDescReq( dstAddr, NWKAddrOfInterest, SecurityEnable ) \
  285. ZDP_NWKAddrOfInterestReq( dstAddr, \
  286. NWKAddrOfInterest, Complex_Desc_req, SecurityEnable )
  287. /*
  288. * ZDP_UserDescReq - Request a device's user description
  289. *
  290. * @MT SPI_CMD_ZDO_USER_DESC_REQ
  291. * (UInt16 DstAddr,
  292. * UInt16 NWKAddrOfInterest,
  293. * byte SecuritySuite)
  294. *
  295. */
  296. #define ZDP_UserDescReq( dstAddr, NWKAddrOfInterest, SecurityEnable ) \
  297. ZDP_NWKAddrOfInterestReq( dstAddr, \
  298. NWKAddrOfInterest, User_Desc_req, SecurityEnable )
  299. /*
  300. * ZDP_BindReq - bind request
  301. *
  302. * @MT SPI_CMD_ZDO_BIND_REQ
  303. * (UInt16 DstAddr,
  304. * UInt64 SrcAddress,
  305. * byte SrcEndpoint,
  306. * uint16 ClusterID,
  307. * zAddrType_t *DstAddress,
  308. * byte DstEndpoint,
  309. * byte SecuritySuite)
  310. *
  311. */
  312. #define ZDP_BindReq( dstAddr, SourceAddr, SrcEP, \
  313. ClusterID, DestinationAddr, DstEP, SecurityEnable ) \
  314. ZDP_BindUnbindReq( Bind_req, dstAddr, \
  315. SourceAddr, SrcEP, ClusterID, \
  316. DestinationAddr, DstEP, SecurityEnable )
  317. /*
  318. * ZDP_UnbindReq - Unbind request
  319. *
  320. * @MT SPI_CMD_ZDO_UNBIND_REQ
  321. * (UInt16 DstAddr,
  322. * UInt64 SrcAddress,
  323. * byte SrcEndpoint,
  324. * uint16 ClusterID,
  325. * zAddrType_t DestinationAddr,
  326. * byte DstEndpoint,
  327. * byte SecuritySuite)
  328. *
  329. */
  330. #define ZDP_UnbindReq( dstAddr, SourceAddr, SrcEP, \
  331. ClusterID, DestinationAddr, DstEP, SecurityEnable ) \
  332. ZDP_BindUnbindReq( Unbind_req, dstAddr, \
  333. SourceAddr, SrcEP, ClusterID, \
  334. DestinationAddr, DstEP, SecurityEnable )
  335. /*
  336. * ZDP_MgmtLqiReq - Send a Management LQI Request
  337. *
  338. * @MT SPI_CMD_ZDO_MGMT_LQI_REQ
  339. * (UInt16 DstAddr,
  340. * byte StartIndex)
  341. *
  342. */
  343. #define ZDP_MgmtLqiReq( dstAddr, StartIndex, SecurityEnable ) \
  344. ZDP_SendData( &ZDP_TransID, dstAddr, Mgmt_Lqi_req, 1, &StartIndex, SecurityEnable )
  345. /*
  346. * ZDP_MgmtRtgReq - Send a Management Routing Table Request
  347. *
  348. * @MT SPI_CMD_ZDO_MGMT_RTG_REQ
  349. * (UInt16 DstAddr,
  350. * byte StartIndex)
  351. *
  352. */
  353. #define ZDP_MgmtRtgReq( dstAddr, StartIndex, SecurityEnable ) \
  354. ZDP_SendData( &ZDP_TransID, dstAddr, Mgmt_Rtg_req, 1, &StartIndex, SecurityEnable )
  355. /*
  356. * ZDP_MgmtBindReq - Send a Management Binding Table Request
  357. *
  358. * @MT SPI_CMD_ZDO_MGMT_BIND_REQ
  359. * (UInt16 DstAddr,
  360. * byte StartIndex)
  361. *
  362. */
  363. #define ZDP_MgmtBindReq( dstAddr, StartIndex, SecurityEnable ) \
  364. ZDP_SendData( &ZDP_TransID, dstAddr, Mgmt_Bind_req, 1, &StartIndex, SecurityEnable )
  365. #ifdef REMOVE_BY_LAF
  366. /*
  367. * ZDP_NWKAddrRsp - Send a Network Address Response
  368. */
  369. #define ZDP_NWKAddrRsp( TransSeq, dstAddr, Status, IEEEAddrRemoteDev, ReqType, nwkAddr, NumAssocDev, \
  370. StartIndex, NWKAddrAssocDevList, SecurityEnable ) \
  371. ZDP_AddrRsp( NWK_addr_rsp, TransSeq, dstAddr, Status, \
  372. IEEEAddrRemoteDev, ReqType, nwkAddr, NumAssocDev, StartIndex, \
  373. NWKAddrAssocDevList, SecurityEnable )
  374. /*
  375. * ZDP_IEEEAddrRsp - Send an IEEE Address Response
  376. */
  377. #define ZDP_IEEEAddrRsp( TransSeq, dstAddr, Status, IEEEAddrRemoteDev, ReqType, nwkAddr, NumAssocDev, \
  378. StartIndex, NWKAddrAssocDevList, SecurityEnable ) \
  379. ZDP_AddrRsp( IEEE_addr_rsp, TransSeq, dstAddr, Status, \
  380. IEEEAddrRemoteDev, ReqType, nwkAddr, NumAssocDev, StartIndex, \
  381. NWKAddrAssocDevList, SecurityEnable )
  382. #endif
  383. /*
  384. * ZDP_ActiveEPRsp - Send an list of active endpoint
  385. */
  386. #define ZDP_ActiveEPRsp( TransSeq, dstAddr, Status, nwkAddr, Count, \
  387. pEPList, SecurityEnable ) \
  388. ZDP_EPRsp( Active_EP_rsp, TransSeq, dstAddr, Status, \
  389. nwkAddr, Count, pEPList, SecurityEnable )
  390. /*
  391. * ZDP_MatchDescRsp - Send an list of endpoint that match
  392. */
  393. #define ZDP_MatchDescRsp( TransSeq, dstAddr, Status, nwkAddr, Count, \
  394. pEPList, SecurityEnable ) \
  395. ZDP_EPRsp( Match_Desc_rsp, TransSeq, dstAddr, Status, \
  396. nwkAddr, Count, pEPList, SecurityEnable )
  397. /*
  398. * ZDP_ComplexDescRsp - This message isn't supported until we fix it.
  399. */
  400. #define ZDP_ComplexDescRsp( dstAddr, SecurityEnable ) \
  401. ZDP_GenericRsp( dstAddr, Complex_Desc_rsp, SecurityEnable )
  402. /*
  403. * ZDP_UserDescConf - Send a User Descriptor Set Response
  404. */
  405. #define ZDP_UserDescConf( TransSeq, dstAddr, Status, SecurityEnable ) \
  406. ZDP_SendData( &TransSeq, dstAddr, User_Desc_conf, 1, &Status, SecurityEnable )
  407. /*
  408. * ZDP_EndDeviceBindRsp - Send a End Device Bind Response
  409. */
  410. #define ZDP_EndDeviceBindRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  411. ZDP_SendData( &TransSeq, dstAddr, End_Device_Bind_rsp, 1, &Status, SecurityEnable )
  412. /*
  413. * ZDP_BindRsp - Send a Bind Response
  414. */
  415. #define ZDP_BindRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  416. ZDP_SendData( &TransSeq, dstAddr, Bind_rsp, 1, &Status, SecurityEnable )
  417. /*
  418. * ZDP_UnbindRsp - Send an Unbind Response
  419. */
  420. #define ZDP_UnbindRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  421. ZDP_SendData( &TransSeq, dstAddr, Unbind_rsp, 1, &Status, SecurityEnable )
  422. /*
  423. * ZDP_MgmtLeaveRsp - Send a Management Leave Response
  424. */
  425. #define ZDP_MgmtLeaveRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  426. ZDP_SendData( &TransSeq, dstAddr, Mgmt_Leave_rsp, 1, &Status, SecurityEnable )
  427. /*
  428. * ZDP_MgmtPermitJoinRsp - Send a Management Permit Join Response
  429. */
  430. #define ZDP_MgmtPermitJoinRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  431. ZDP_SendData( &TransSeq, dstAddr, Mgmt_Permit_Join_rsp, 1, &Status, SecurityEnable )
  432. /*
  433. * ZDP_MgmtDirectJoinRsp - Send a Mgmt_DirectJoining_Rsp Response
  434. */
  435. #define ZDP_MgmtDirectJoinRsp( TransSeq, dstAddr, Status, SecurityEnable ) \
  436. ZDP_SendData( &TransSeq, dstAddr, Mgmt_Direct_Join_rsp, 1, &Status, SecurityEnable )
  437. /*********************************************************************
  438. * FUNCTIONS - API
  439. */
  440. /*
  441. * ZDP_NWKAddrOfInterestReq - Send request with NWKAddrOfInterest as parameter
  442. */
  443. extern afStatus_t ZDP_NWKAddrOfInterestReq( zAddrType_t *dstAddr,
  444. uint16 nwkAddr, byte cmd, byte SecurityEnable );
  445. /*
  446. * ZDP_NwkAddrReq - Request a Network address
  447. *
  448. * @MT SPI_CMD_ZDO_NWK_ADDR_REQ
  449. * (UInt64 IEEEAddress,
  450. * byte ReqType,
  451. * byte StarIndex,
  452. * byte SecurityEnable)
  453. *
  454. */
  455. extern afStatus_t ZDP_NwkAddrReq( uint8 *IEEEAddress, byte ReqType,
  456. byte StartIndex, byte SecurityEnable );
  457. /*
  458. * ZDP_IEEEAddrReq - Request an IEEE address
  459. *
  460. * @MT SPI_CMD_ZDO_IEEE_ADDR_REQ
  461. * (UInt16 shortAddr,
  462. * byte ReqType,
  463. * byte StartIndex,
  464. * byte SecurityEnable)
  465. *
  466. */
  467. extern afStatus_t ZDP_IEEEAddrReq( uint16 shortAddr, byte ReqType,
  468. byte StartIndex, byte SecurityEnable );
  469. /*
  470. * ZDP_MatchDescReq - Request matching device's endpoint list
  471. *
  472. * @MT SPI_CMD_ZDO_MATCH_DESC_REQ
  473. * (UInt16 DstAddr,
  474. * UInt16 NWKAddrOfInterest,
  475. * UInt16 ProfileID,
  476. * byte NumInClusters,
  477. * uint16 InClusterList[15],
  478. * byte NumOutClusters,
  479. * uint16 OutClusterList[15],
  480. * byte SecuritySuite)
  481. *
  482. */
  483. extern afStatus_t ZDP_MatchDescReq( zAddrType_t *dstAddr, uint16 nwkAddr,
  484. uint16 ProfileID,
  485. byte NumInClusters, uint16 *InClusterList,
  486. byte NumOutClusters, uint16 *OutClusterList,
  487. byte SecurityEnable );
  488. /*
  489. * ZDP_SimpleDescReq - Request Simple Descriptor
  490. *
  491. * @MT SPI_CMD_ZDO_SIMPLE_DESC_REQ
  492. * (UInt16 DstAddr,
  493. * UInt16 NWKAddrOfInterest,
  494. * byte Endpoint,
  495. * byte Security)
  496. *
  497. */
  498. extern afStatus_t ZDP_SimpleDescReq( zAddrType_t *dstAddr, uint16 nwkAddr,
  499. byte ep, byte SecurityEnable );
  500. /*
  501. * ZDP_UserDescSet - Set the User Descriptor
  502. *
  503. * @MT SPI_CMD_ZDO_USER_DESC_SET
  504. * (UInt16 DstAddr,
  505. * UInt16 NWKAddrOfInterest,
  506. * byte DescLen,
  507. * byte Descriptor[15],
  508. * byte SecuritySuite)
  509. *
  510. */
  511. extern afStatus_t ZDP_UserDescSet( zAddrType_t *dstAddr, uint16 nwkAddr,
  512. UserDescriptorFormat_t *UserDescriptor,
  513. byte SecurityEnable );
  514. /*
  515. * ZDP_ServerDiscReq - Build and send a Server_Discovery_req request message.
  516. */
  517. afStatus_t ZDP_ServerDiscReq( uint16 serverMask, byte SecurityEnable );
  518. /*
  519. * ZDP_DeviceAnnce - Device Announce
  520. *
  521. * @MT SPI_CMD_ZDO_DEV_ANNCE
  522. * (UInt16 DevAddr,
  523. * byte DeviceAddress,
  524. * byte SecuritySuite)
  525. *
  526. */
  527. extern afStatus_t ZDP_DeviceAnnce( uint16 nwkAddr, uint8 *IEEEAddr,
  528. byte capabilities, byte SecurityEnable );
  529. /*
  530. * ZDP_EndDeviceBindReq - End Device (hand) bind request
  531. *
  532. * @MT SPI_CMD_ZDO_END_DEV_BIND_REQ
  533. * (UInt16 DstAddr,
  534. * UInt16 LocalCoordinator,
  535. * byte Endpoint,
  536. * UInt16 Profile,
  537. * byte NumInClusters,
  538. * uint16 InClusterList[15],
  539. * byte NumOutClusters,
  540. * uint16 OutClusterList[15],
  541. * byte SecuritySuite)
  542. *
  543. */
  544. extern afStatus_t ZDP_EndDeviceBindReq( zAddrType_t *dstAddr,
  545. uint16 LocalCoordinator,
  546. byte ep,
  547. uint16 ProfileID,
  548. byte NumInClusters, uint16 *InClusterList,
  549. byte NumOutClusters, uint16 *OutClusterList,
  550. byte SecurityEnable );
  551. /*
  552. * ZDP_BindUnbindReq - bind request
  553. */
  554. extern afStatus_t ZDP_BindUnbindReq( uint16 BindOrUnbind, zAddrType_t *dstAddr,
  555. uint8 *SourceAddr, byte SrcEP,
  556. cId_t ClusterID,
  557. zAddrType_t *DestinationAddr, byte DstEP,
  558. byte SecurityEnable );
  559. /*
  560. * ZDP_MgmtNwkDiscReq - Send a Management Network Discovery Request
  561. *
  562. * @MT SPI_CMD_ZDO_MGMT_NWKDISC_REQ
  563. * (UInt16 DstAddr,
  564. * UInt32 ScanChannels,
  565. * byte StartIndex)
  566. *
  567. */
  568. extern afStatus_t ZDP_MgmtNwkDiscReq( zAddrType_t *dstAddr,
  569. uint32 ScanChannels,
  570. byte ScanDuration,
  571. byte StartIndex,
  572. byte SecurityEnable );
  573. /*
  574. * ZDP_MgmtDirectJoinReq - Send a Management Direct Join Request
  575. *
  576. * @MT SPI_CMD_ZDO_MGMT_DIRECT_JOIN_REQ
  577. * (UInt16 DstAddr,
  578. * UInt64 DeviceAddress,
  579. * byte CapInfo)
  580. *
  581. */
  582. extern afStatus_t ZDP_MgmtDirectJoinReq( zAddrType_t *dstAddr,
  583. uint8 *deviceAddr,
  584. byte capInfo,
  585. byte SecurityEnable );
  586. /*
  587. * ZDP_MgmtLeaveReq - Send a Management Leave Request
  588. *
  589. * @MT SPI_CMD_ZDO_MGMT_LEAVE_REQ
  590. * (UInt16 DstAddr,
  591. * UInt64 DeviceAddress
  592. * uint8 RemoveChildren
  593. * uint8 Rejoin
  594. * uint8 SecurityEnable)
  595. */
  596. extern afStatus_t ZDP_MgmtLeaveReq( zAddrType_t *dstAddr,
  597. uint8 *IEEEAddr,
  598. uint8 RemoveChildren,
  599. uint8 Rejoin,
  600. uint8 SecurityEnable );
  601. /*
  602. * ZDP_MgmtPermitJoinReq - Send a Management Permit Join Request
  603. *
  604. * @MT SPI_CMD_ZDO_MGMT_PERMIT_JOIN_REQ
  605. * (UInt16 DstAddr,
  606. * byte duration,
  607. * byte TcSignificance)
  608. *
  609. */
  610. extern afStatus_t ZDP_MgmtPermitJoinReq( zAddrType_t *dstAddr,
  611. byte duration,
  612. byte TcSignificance,
  613. byte SecurityEnable );
  614. /*
  615. * ZDP_MgmtNwkUpdateReq - Send a Management NWK Update Request
  616. *
  617. * @MT SPI_CMD_ZDO_MGMT_NWK_UPDATE_REQ
  618. * (uint16 dstAddr,
  619. * uint32 ChannelMask,
  620. * uint8 ScanDuration,
  621. * uint8 ScanCount,
  622. * uint16 NwkManagerAddr )
  623. *
  624. */
  625. extern afStatus_t ZDP_MgmtNwkUpdateReq( zAddrType_t *dstAddr,
  626. uint32 ChannelMask,
  627. uint8 ScanDuration,
  628. uint8 ScanCount,
  629. uint8 NwkUpdateId,
  630. uint16 NwkManagerAddr );
  631. /*********************************************************************
  632. * @fn ZDP_AddrRsp
  633. *
  634. * @brief Build and send a NWK_addr_rsp or IEEE_addr_rsp message.
  635. *
  636. * @param cId - ClusterID of the rsp, either NWK_addr_rsp or IEEE_addr_rsp.
  637. * @param seq - Message sequence number of the corresponding request.
  638. * @param dst - Destination address for the response.
  639. * @param stat - Response status: ZDP_SUCCESS or other value from ZDProfile.h
  640. * @param ieee - 64-bit IEEE address of the response.
  641. * @param reqType - Type of response requested (single, extended, etc.)
  642. * @param nwkAddr - 16-bit network address of the response.
  643. * @param devCnt - Number of associated devices in the device address list.
  644. * @param strtIdx - Starting index into the dev addr array if extended rsp.
  645. * @param devAddr - Array of 16-bit network addresses of the associated devs.
  646. * @param secOpt - Security Enable Options.
  647. *
  648. * @return afStatus_t
  649. */
  650. afStatus_t ZDP_AddrRsp( byte cId, byte seq, zAddrType_t *dst, byte stat,
  651. uint8 *ieee, byte reqType, uint16 nwkAddr, byte devCnt, byte strtIdx,
  652. uint16 *devAddr, byte secOpt );
  653. /*
  654. * ZDP_NodeDescMsg - Send a Node Descriptor message.
  655. */
  656. extern afStatus_t ZDP_NodeDescMsg( zdoIncomingMsg_t *inMsg,
  657. uint16 nwkAddr, NodeDescriptorFormat_t *pNodeDesc );
  658. /*
  659. * ZDP_PowerDescMsg - Send a Node Power Descriptor message.
  660. */
  661. extern afStatus_t ZDP_PowerDescMsg( zdoIncomingMsg_t *inMsg,
  662. uint16 nwkAddr, NodePowerDescriptorFormat_t *pPowerDesc );
  663. /*
  664. * ZDP_SimpleDescMsg - Send a Simple Descriptor message.
  665. */
  666. extern afStatus_t ZDP_SimpleDescMsg( zdoIncomingMsg_t *inMsg,
  667. byte Status, SimpleDescriptionFormat_t *pSimpleDesc );
  668. /*
  669. * ZDP_EPRsp - Send a list of endpoint
  670. */
  671. extern afStatus_t ZDP_EPRsp( uint16 MsgType, byte TransSeq, zAddrType_t *dstAddr, byte Status,
  672. uint16 nwkAddr, byte Count, uint8 *pEPList,
  673. byte SecurityEnable );
  674. /*
  675. * ZDP_GenericRsp - Sends a response message with only the parameter response
  676. * byte and the addr of interest for data.
  677. */
  678. extern afStatus_t ZDP_GenericRsp( byte TransSeq, zAddrType_t *dstAddr,
  679. byte status, uint16 aoi, uint16 rspID, byte SecurityEnable );
  680. /*
  681. * ZDP_MgmtNwkDiscRsp - Sends the Management Network Discovery Response.
  682. */
  683. extern afStatus_t ZDP_MgmtNwkDiscRsp( byte TransSeq, zAddrType_t *dstAddr,
  684. byte Status,
  685. byte NetworkCount,
  686. byte StartIndex,
  687. byte NetworkCountList,
  688. networkDesc_t *NetworkList,
  689. byte SecurityEnable );
  690. /*
  691. * ZDP_MgmtLqiRsp - Sends the Management LQI Response.
  692. */
  693. extern ZStatus_t ZDP_MgmtLqiRsp( byte TransSeq, zAddrType_t *dstAddr,
  694. byte Status,
  695. byte NeighborLqiEntries,
  696. byte StartIndex,
  697. byte NeighborLqiCount,
  698. ZDP_MgmtLqiItem_t* NeighborList,
  699. byte SecurityEnable );
  700. /*
  701. * ZDP_MgmtRtgRsp - Sends the Management Routing Response.
  702. */
  703. extern ZStatus_t ZDP_MgmtRtgRsp( byte TransSeq, zAddrType_t *dstAddr,
  704. byte Status,
  705. byte RoutingTableEntries,
  706. byte StartIndex,
  707. byte RoutingListCount,
  708. rtgItem_t *RoutingTableList,
  709. byte SecurityEnable );
  710. /*
  711. * ZDP_MgmtBindRsp - Sends the Management Binding Response.
  712. */
  713. extern ZStatus_t ZDP_MgmtBindRsp( byte TransSeq, zAddrType_t *dstAddr,
  714. byte Status,
  715. byte BindingTableEntries,
  716. byte StartIndex,
  717. byte BindingTableListCount,
  718. apsBindingItem_t *BindingTableList,
  719. byte SecurityEnable );
  720. /*
  721. * ZDP_MgmtNwkUpdateNotify - Sends the Management Netwotk Update Notify.
  722. */
  723. extern afStatus_t ZDP_MgmtNwkUpdateNotify( uint8 TransSeq, zAddrType_t *dstAddr,
  724. uint8 status, uint32 scannedChannels,
  725. uint16 totalTransmissions, uint16 transmissionFailures,
  726. uint8 listCount, uint8 *energyValues, uint8 txOptions,
  727. uint8 securityEnable );
  728. /*
  729. * ZDP_UserDescRsp - Sends the user descriptor response message.
  730. */
  731. extern ZStatus_t ZDP_UserDescRsp( byte TransSeq, zAddrType_t *dstAddr,
  732. uint16 nwkAddrOfInterest, UserDescriptorFormat_t *userDesc,
  733. byte SecurityEnable );
  734. /*
  735. * ZDP_ServerDiscRsp - Build and send the User Decriptor Response.
  736. */
  737. ZStatus_t ZDP_ServerDiscRsp( byte transID, zAddrType_t *dstAddr, byte status,
  738. uint16 aoi, uint16 serverMask, byte SecurityEnable );
  739. /*
  740. * ZDP_IncomingData - Incoming data callback from AF layer
  741. */
  742. extern void ZDP_IncomingData( afIncomingMSGPacket_t *pData );
  743. extern ZStatus_t ZDO_RegisterForZDOMsg( uint8 taskID, uint16 clusterID );
  744. extern ZStatus_t ZDO_RemoveRegisteredCB( uint8 taskID, uint16 clusterID );
  745. /*********************************************************************
  746. *********************************************************************/
  747. #ifdef __cplusplus
  748. }
  749. #endif
  750. #endif /* ZDPROFILE_H */