MT_SAPI.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /**************************************************************************************************
  2. Filename: MT_SAPI.c
  3. Revised: $Date: 2008-03-04 17:33:23 -0800 (Tue, 04 Mar 2008) $
  4. Revision: $Revision: 16539 $
  5. Description: MonitorTest functions for the Simple API.
  6. Copyright 2007 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 "OSAL_Nv.h"
  39. #include "OnBoard.h"
  40. #include "MT.h"
  41. #include "MT_SAPI.h"
  42. #include "MT_UART.h"
  43. /***************************************************************************************************
  44. * GLOBAL VARIABLES
  45. ***************************************************************************************************/
  46. #if defined ( MT_SAPI_CB_FUNC )
  47. uint16 _sapiCallbackSub;
  48. #endif
  49. /***************************************************************************************************
  50. * LOCAL FUNCTIONS
  51. ***************************************************************************************************/
  52. void MT_SapiSystemReset(uint8 *pBuf);
  53. void MT_SapiStart(uint8* pBuf);
  54. void MT_SapiBindDevice(uint8 *pBuf);
  55. void MT_SapiAllowBind(uint8 *pBuf);
  56. void MT_SapiSendData(uint8 *pBuf);
  57. void MT_SapiReadCfg(uint8 *pBuf);
  58. void MT_SapiWriteCfg(uint8 *pBuf);
  59. void MT_SapiGetDevInfo(uint8 *pBuf);
  60. void MT_SapiFindDev(uint8 *pBuf);
  61. void MT_SapiPermitJoin(uint8 *pBuf);
  62. void MT_SapiAppRegister(uint8 *pBuf);
  63. #if defined ( MT_SAPI_FUNC )
  64. /***************************************************************************************************
  65. * @fn MT_sapiCommandProcessing
  66. *
  67. * @brief
  68. *
  69. * Process all the SAPI commands that are issued by test tool
  70. *
  71. * @param pBuf - pointer to received buffer
  72. *
  73. * @return none
  74. ***************************************************************************************************/
  75. uint8 MT_SapiCommandProcessing(uint8 *pBuf)
  76. {
  77. uint8 status = MT_RPC_SUCCESS;
  78. switch (pBuf[MT_RPC_POS_CMD1])
  79. {
  80. case MT_SAPI_START_REQ:
  81. MT_SapiStart(pBuf);
  82. break;
  83. case MT_SAPI_BIND_DEVICE_REQ:
  84. MT_SapiBindDevice(pBuf);
  85. break;
  86. case MT_SAPI_ALLOW_BIND_REQ:
  87. MT_SapiAllowBind(pBuf);
  88. break;
  89. case MT_SAPI_SEND_DATA_REQ:
  90. MT_SapiSendData(pBuf);
  91. break;
  92. case MT_SAPI_READ_CFG_REQ:
  93. MT_SapiReadCfg(pBuf);
  94. break;
  95. case MT_SAPI_WRITE_CFG_REQ:
  96. MT_SapiWriteCfg(pBuf);
  97. break;
  98. case MT_SAPI_GET_DEV_INFO_REQ:
  99. MT_SapiGetDevInfo(pBuf);
  100. break;
  101. case MT_SAPI_FIND_DEV_REQ:
  102. MT_SapiFindDev(pBuf);
  103. break;
  104. case MT_SAPI_PMT_JOIN_REQ:
  105. MT_SapiPermitJoin(pBuf);
  106. break;
  107. case MT_SAPI_SYS_RESET:
  108. MT_SapiSystemReset(pBuf);
  109. break;
  110. case MT_SAPI_APP_REGISTER_REQ:
  111. MT_SapiAppRegister(pBuf);
  112. break;
  113. default:
  114. status = MT_RPC_ERR_COMMAND_ID;
  115. break;
  116. }
  117. return status;
  118. }
  119. /***************************************************************************************************
  120. * @fn MT_SapiSystemReset
  121. *
  122. * @brief Process SAPI System Reset
  123. *
  124. * @param pBuf - pointer to received buffer
  125. *
  126. * @return none
  127. ***************************************************************************************************/
  128. void MT_SapiSystemReset(uint8 *pBuf)
  129. {
  130. zb_SystemReset();
  131. }
  132. /***************************************************************************************************
  133. * @fn MT_SapiStart
  134. *
  135. * @brief Process SAPI Start
  136. *
  137. * @param
  138. *
  139. * @return none
  140. ***************************************************************************************************/
  141. void MT_SapiStart(uint8 *pBuf)
  142. {
  143. zb_StartRequest();
  144. /* Build and send back the response */
  145. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_START_REQ, 0, NULL);
  146. }
  147. /***************************************************************************************************
  148. * @fn MT_SapiAppRegister
  149. *
  150. * @brief Process SAPI App Register
  151. *
  152. * @param
  153. *
  154. * @return none
  155. ***************************************************************************************************/
  156. void MT_SapiAppRegister(uint8 *pBuf)
  157. {
  158. uint8 ret = ZApsIllegalRequest;
  159. /* check if sapi is alredy registered with an endpoint */
  160. if ( (sapi_epDesc.endPoint == 0) && (*pBuf != 0) )
  161. {
  162. ret = MT_BuildEndpointDesc( pBuf+MT_RPC_FRAME_HDR_SZ, &sapi_epDesc );
  163. if ( ret == ZSuccess )
  164. {
  165. ret = afRegister( &sapi_epDesc );
  166. // Turn off match descriptor response by default
  167. afSetMatch(sapi_epDesc.simpleDesc->EndPoint, FALSE);
  168. }
  169. if ( ret != ZSuccess )
  170. {
  171. sapi_epDesc.endPoint = 0;
  172. }
  173. }
  174. /* Build and send back the response */
  175. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI),
  176. MT_SAPI_APP_REGISTER_REQ, 1, &ret);
  177. }
  178. /***************************************************************************************************
  179. * @fn MT_SapiBindDevice
  180. *
  181. * @brief Process SAPI Bind Device Command
  182. *
  183. * @param pBuf - pointer to received buffer
  184. *
  185. * @return none
  186. ***************************************************************************************************/
  187. void MT_SapiBindDevice(uint8 *pBuf)
  188. {
  189. uint8 i, cmdId;
  190. /* parse header */
  191. cmdId = pBuf[MT_RPC_POS_CMD1];
  192. pBuf += MT_RPC_FRAME_HDR_SZ;
  193. for ( i = 0; i < Z_EXTADDR_LEN ; i++ )
  194. {
  195. if ( pBuf[3+i] != 0x00 )
  196. {
  197. /* Not a null destination address */
  198. break;
  199. }
  200. }
  201. if ( i == Z_EXTADDR_LEN )
  202. {
  203. zb_BindDevice(pBuf[0], BUILD_UINT16(pBuf[1], pBuf[2]), (uint8 *)NULL);
  204. }
  205. else
  206. {
  207. zb_BindDevice(pBuf[0], BUILD_UINT16(pBuf[1], pBuf[2]), &pBuf[3]);
  208. }
  209. /* Build and send back the response */
  210. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 0, NULL);
  211. }
  212. /***************************************************************************************************
  213. * @fn MT_SapiAllowBind
  214. *
  215. * @brief Process SAPI Allow Bind
  216. *
  217. * @param
  218. *
  219. * @return none
  220. ***************************************************************************************************/
  221. void MT_SapiAllowBind(uint8 *pBuf)
  222. {
  223. uint8 cmdId;
  224. /* parse header */
  225. cmdId = pBuf[MT_RPC_POS_CMD1];
  226. pBuf += MT_RPC_FRAME_HDR_SZ;
  227. zb_AllowBind(pBuf[0]);
  228. /* Build and send back the response */
  229. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 0, NULL);
  230. }
  231. /***************************************************************************************************
  232. * @fn MT_SapiSendData
  233. *
  234. * @brief Process SAPI Send Data Command
  235. *
  236. * @param pBuf - pointer to received buffer
  237. *
  238. * @return none
  239. ***************************************************************************************************/
  240. void MT_SapiSendData(uint8 *pBuf)
  241. {
  242. uint8 cmdId;
  243. uint16 destination, command;
  244. uint8 len, handle, txOption, radius;
  245. /* parse header */
  246. cmdId = pBuf[MT_RPC_POS_CMD1];
  247. pBuf += MT_RPC_FRAME_HDR_SZ;
  248. /* Destination */
  249. destination = BUILD_UINT16(pBuf[0], pBuf[1]);
  250. /* Command */
  251. command = BUILD_UINT16(pBuf[2], pBuf[3]);
  252. /* Handle */
  253. handle = pBuf[4];
  254. /* txOption */
  255. txOption = pBuf[5];
  256. /* Radius */
  257. radius = pBuf[6];
  258. /* Length */
  259. len = pBuf[7];
  260. zb_SendDataRequest(destination, command, len, &pBuf[8], handle, txOption, radius);
  261. /* Build and send back the response */
  262. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 0, NULL);
  263. }
  264. /***************************************************************************************************
  265. * @fn MT_SapiReadCfg
  266. *
  267. * @brief Process SAPI Read Config Commands
  268. *
  269. * @param pBuf - pointer to received buffer
  270. *
  271. * @return none
  272. ***************************************************************************************************/
  273. void MT_SapiReadCfg(uint8 *pBuf)
  274. {
  275. uint8 i, retStatus, cmdId;
  276. uint8 *pRetBuf;
  277. /* parse header */
  278. cmdId = pBuf[MT_RPC_POS_CMD1];
  279. pBuf += MT_RPC_FRAME_HDR_SZ;
  280. i = (uint8)osal_nv_item_len(pBuf[0]);
  281. pRetBuf = osal_mem_alloc(i+3);
  282. if (pBuf)
  283. {
  284. /* Config ID */
  285. pRetBuf[1] = pBuf[0];
  286. /* Len */
  287. pRetBuf[2] = i;
  288. if (i && ((i != ZCD_NV_NIB) && (i != ZCD_NV_DEVICE_LIST) &&
  289. (i != ZCD_NV_ADDRMGR) && (i != ZCD_NV_NWKKEY)))
  290. {
  291. if ((zb_ReadConfiguration(pBuf[0], i, pRetBuf+3)) == ZSUCCESS)
  292. retStatus = ZSuccess;
  293. else
  294. retStatus = ZFailure;
  295. }
  296. else
  297. {
  298. retStatus = ZInvalidParameter;
  299. }
  300. /* status */
  301. pRetBuf[0] = retStatus;
  302. /* Build and send back the response */
  303. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, i+3, pRetBuf );
  304. osal_mem_free(pRetBuf);
  305. }
  306. }
  307. /***************************************************************************************************
  308. * @fn MT_SpiWriteCfg
  309. *
  310. * @brief Process Write Configuration Command
  311. *
  312. * @param pBuf - pointer to received buffer
  313. *
  314. * @return none
  315. ***************************************************************************************************/
  316. void MT_SapiWriteCfg(uint8 *pBuf)
  317. {
  318. uint8 retValue, cmdId;
  319. /* parse header */
  320. cmdId = pBuf[MT_RPC_POS_CMD1];
  321. pBuf += MT_RPC_FRAME_HDR_SZ;
  322. if ((pBuf[0] != ZCD_NV_NIB) && (pBuf[0] != ZCD_NV_DEVICE_LIST) &&
  323. (pBuf[0] != ZCD_NV_ADDRMGR) && (pBuf[0] != ZCD_NV_NWKKEY))
  324. {
  325. if ((zb_WriteConfiguration(pBuf[0], pBuf[1], &pBuf[2])) == ZSUCCESS)
  326. retValue = ZSuccess;
  327. else
  328. retValue = ZFailure;
  329. }
  330. else
  331. {
  332. retValue = ZInvalidParameter;
  333. }
  334. /* Build and send back the response */
  335. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 1, &retValue );
  336. }
  337. /***************************************************************************************************
  338. * @fn MT_SapiGetDevInfo
  339. *
  340. * @brief Process Get Device Info command
  341. *
  342. * @param pBuf - pointer to received buffer
  343. *
  344. * @return none
  345. ***************************************************************************************************/
  346. void MT_SapiGetDevInfo(uint8 *pBuf)
  347. {
  348. uint8 *pRetBuf;
  349. uint8 cmdId;
  350. /* parse header */
  351. cmdId = pBuf[MT_RPC_POS_CMD1];
  352. pBuf += MT_RPC_FRAME_HDR_SZ;
  353. pRetBuf = osal_mem_alloc(Z_EXTADDR_LEN+1);
  354. if (pRetBuf)
  355. {
  356. zb_GetDeviceInfo(pBuf[0], pRetBuf+1);
  357. pRetBuf[0] = pBuf[0];
  358. /* Build and send back the response */
  359. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, Z_EXTADDR_LEN+1, pRetBuf );
  360. osal_mem_free(pRetBuf);
  361. }
  362. }
  363. /***************************************************************************************************
  364. * @fn MT_SapiFindDev
  365. *
  366. * @brief Process Find Device Command
  367. *
  368. * @param pBuf - pointer to received buffer
  369. *
  370. * @return none
  371. ***************************************************************************************************/
  372. void MT_SapiFindDev(uint8 *pBuf)
  373. {
  374. uint8 cmdId;
  375. /* parse header */
  376. cmdId = pBuf[MT_RPC_POS_CMD1];
  377. pBuf += MT_RPC_FRAME_HDR_SZ;
  378. /* Currently only supports IEEE search */
  379. zb_FindDeviceRequest(ZB_IEEE_SEARCH, pBuf);
  380. /* Build and send back the response */
  381. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 0, NULL );
  382. }
  383. /***************************************************************************************************
  384. * @fn MT_SapiPermitJoin
  385. *
  386. * @brief Process Permit Join Command
  387. *
  388. * @param pBuf - pointer to received buffer
  389. *
  390. * @return none
  391. ***************************************************************************************************/
  392. void MT_SapiPermitJoin(uint8 *pBuf)
  393. {
  394. uint8 retValue, cmdId;
  395. /* parse header */
  396. cmdId = pBuf[MT_RPC_POS_CMD1];
  397. pBuf += MT_RPC_FRAME_HDR_SZ;
  398. retValue = (zb_PermitJoiningRequest(BUILD_UINT16(pBuf[0], pBuf[1]), pBuf[2]));
  399. /* Build and send back the response */
  400. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SAPI), cmdId, 1, &retValue );
  401. }
  402. #endif /* MT_SAPI_FUNC */
  403. #if defined ( MT_SAPI_CB_FUNC )
  404. /***************************************************************************************************
  405. * @fn zb_MTCallbackStartConfirm
  406. *
  407. * @brief Process the callback subscription for zb_StartConfirm
  408. *
  409. * @param Status - status
  410. *
  411. * @return none
  412. ***************************************************************************************************/
  413. void zb_MTCallbackStartConfirm( uint8 status )
  414. {
  415. /* Build and send back the response */
  416. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_START_CNF, 1, &status);
  417. }
  418. /***************************************************************************************************
  419. * @fn zb_MTCallbackSendDataConfirm
  420. *
  421. * @brief Process the callback subscription for zb_SendDataConfirm
  422. *
  423. * @param
  424. *
  425. * @return none
  426. ***************************************************************************************************/
  427. void zb_MTCallbackSendDataConfirm(uint8 handle, uint8 status)
  428. {
  429. uint8 retArray[2];
  430. retArray[0] = handle;
  431. retArray[1] = status;
  432. /* Build and send back the response */
  433. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_SEND_DATA_CNF, 2, retArray);
  434. }
  435. /***************************************************************************************************
  436. * @fn zb_MTCallbackBindConfirm
  437. *
  438. * @brief Process the callback subscription for zb_BindConfirm
  439. *
  440. * @param
  441. *
  442. * @return none
  443. ***************************************************************************************************/
  444. void zb_MTCallbackBindConfirm( uint16 commandId, uint8 status )
  445. {
  446. uint8 retArray[3];
  447. retArray[0] = LO_UINT16(commandId);
  448. retArray[1] = HI_UINT16(commandId);
  449. retArray[2] = status;
  450. /* Build and send back the response */
  451. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_BIND_CNF, 3, retArray);
  452. }
  453. /***************************************************************************************************
  454. * @fn zb_MTCallbackAllowBindConfirm
  455. *
  456. * @brief Indicates when another device attempted to bind to this device
  457. *
  458. * @param
  459. *
  460. * @return none
  461. ***************************************************************************************************/
  462. void zb_MTCallbackAllowBindConfirm( uint16 source )
  463. {
  464. uint8 retArray[2];
  465. retArray[0] = LO_UINT16(source);
  466. retArray[1] = HI_UINT16(source);
  467. /* Build and send back the response */
  468. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_ALLOW_BIND_CNF, 3, retArray);
  469. }
  470. /***************************************************************************************************
  471. * @fn zb_MTCallbackFindDeviceConfirm
  472. *
  473. * @brief Process the callback subscription for zb_FindDeviceConfirm
  474. *
  475. * @param
  476. *
  477. * @return none
  478. ***************************************************************************************************/
  479. void zb_MTCallbackFindDeviceConfirm( uint8 searchType, uint8 *searchKey, uint8 *result )
  480. {
  481. uint8 retArray[SPI_CB_SAPI_FIND_DEV_CNF_LEN];
  482. uint16 addr = *((uint16*)searchKey);
  483. // Currently only supports IEEE Addr Search
  484. retArray[0] = ZB_IEEE_SEARCH;
  485. retArray[1] = LO_UINT16(addr);
  486. retArray[2] = HI_UINT16(addr);
  487. osal_memcpy(&retArray[3], result, Z_EXTADDR_LEN);
  488. /* Build and send back the response */
  489. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_FIND_DEV_CNF, 11, retArray);
  490. }
  491. /***************************************************************************************************
  492. * @fn zb_MTCallbackReceiveDataIndication
  493. *
  494. * @brief Process the callback subscription for zb_ReceiveDataIndication
  495. *
  496. * @param
  497. *
  498. * @return none
  499. ***************************************************************************************************/
  500. void zb_MTCallbackReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData )
  501. {
  502. uint8 *memPtr;
  503. int8 i;
  504. uint8 msgLen = 6 + len;
  505. memPtr = osal_mem_alloc(msgLen);
  506. if (memPtr)
  507. {
  508. memPtr[0] = LO_UINT16(source);
  509. memPtr[1] = HI_UINT16(source);
  510. memPtr[2] = LO_UINT16(command);
  511. memPtr[3] = HI_UINT16(command);
  512. memPtr[4] = LO_UINT16(len);
  513. memPtr[5] = HI_UINT16(len);
  514. for (i=0; i<len; i++)
  515. {
  516. memPtr[6+i] = pData[i];
  517. }
  518. /* Build and send back the response */
  519. MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_AREQ | (uint8)MT_RPC_SYS_SAPI), MT_SAPI_RCV_DATA_IND, msgLen, memPtr);
  520. osal_mem_free( memPtr );
  521. }
  522. }
  523. #endif /* MT_SAPI_CB_FUNC */
  524. /***************************************************************************************************
  525. ***************************************************************************************************/