CC254x/CC2540/CC2541库函数速查(转)

简介: hci.h  转自:http://blog.csdn.net/xiaoleiacmer/article/details/44036607#t1 [cpp] view plaincopy   //分配内存,应用程序不应该调用这个函数.

hci.h

 转自:http://blog.csdn.net/xiaoleiacmer/article/details/44036607#t1

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. //分配内存,应用程序不应该调用这个函数.  
  2. void *HCI_bm_alloc( uint16 size );  
  3.   
  4. //检查连接时间参数和连接时间参数的组合是否有效  
  5. uint8 HCI_ValidConnTimeParams( uint16 connIntervalMin,  
  6.                                       uint16 connIntervalMax,  
  7.                                       uint16 connLatency,  
  8.                                       uint16 connTimeout );  
  9.   
  10. //HCI vendor specific registration for HCI Test Application  
  11. void HCI_TestAppTaskRegister( uint8 taskID );  
  12.   
  13. // HCI vendor specific registration for Host GAP.  
  14. void HCI_GAPTaskRegister( uint8 taskID );  
  15.   
  16. //HCI vendor specific registration for Host L2CAP.  
  17. void HCI_L2CAPTaskRegister( uint8 taskID );  
  18.   
  19. //HCI vendor specific registration for Host SMP.  
  20. void HCI_SMPTaskRegister( uint8 taskID );  
  21.   
  22. // HCI vendor specific registration for Host extended commands.  
  23. void HCI_ExtTaskRegister( uint8 taskID );  
  24.   
  25. //发送一个ACL数据包  
  26. hciStatus_t HCI_SendDataPkt( uint16 connHandle,  
  27.                                     uint8  pbFlag,  
  28.                                     uint16 pktLen,  
  29.                                     uint8  *pData );  
  30.   
  31. //中断连接  
  32. hciStatus_t HCI_DisconnectCmd( uint16 connHandle,  
  33.                                       uint8  reason );  
  34. //请求得到版本信息  
  35. hciStatus_t HCI_ReadRemoteVersionInfoCmd( uint16 connHandle );  
  36.   
  37. //设置消息蒙版,确定支持哪些消息  
  38. hciStatus_t HCI_SetEventMaskCmd( uint8 *pMask );  
  39.   
  40. //重置连接层  
  41. hciStatus_t HCI_ResetCmd( void );  
  42.   
  43. //读取发射功率  
  44. hciStatus_t HCI_ReadTransmitPowerLevelCmd( uint16 connHandle,  
  45.                                                   uint8  txPwrType );  
  46.   
  47. //主机用来开关流量控制(控制器法向主机的)  
  48. hciStatus_t HCI_SetControllerToHostFlowCtrlCmd( uint8 flowControlEnable );  
  49.   
  50. //This BT API is used by the Host to notify the Controller of the maximum size ACL buffer size the Controller can send to the Host.  
  51. hciStatus_t HCI_HostBufferSizeCmd( uint16 hostAclPktLen,  
  52.                                           uint8  hostSyncPktLen,  
  53.                                           uint16 hostTotalNumAclPkts,  
  54.                                           uint16 hostTotalNumSyncPkts );  
  55.   
  56. //This BT API is used by the Host to notify the Controller of the number of HCI data packets that have been completed for each connection handle since this command was previously sent to the controller.  
  57. hciStatus_t HCI_HostNumCompletedPktCmd( uint8  numHandles,  
  58.                                                uint16 *connHandles,  
  59.                                                uint16 *numCompletedPkts );  
  60.   
  61. //读取本地版本信息  
  62. hciStatus_t HCI_ReadLocalVersionInfoCmd( void );  
  63.   
  64. //读取本地支持的命令  
  65. hciStatus_t HCI_ReadLocalSupportedCommandsCmd( void );  
  66.   
  67. //读取本地支持的特性  
  68. hciStatus_t HCI_ReadLocalSupportedFeaturesCmd( void );  
  69.   
  70. //读取设备的BLE地址  
  71. hciStatus_t HCI_ReadBDADDRCmd( void );  
  72.   
  73. //读取最后一个包的RSSI  
  74. hciStatus_t HCI_ReadRssiCmd( uint16 connHandle );  
  75.   
  76. //设置HCI LE时间蒙版,确定支持哪些事件  
  77. hciStatus_t HCI_LE_SetEventMaskCmd( uint8 *pEventMask );  
  78.   
  79. //取得最大ACL数据包大小  
  80. hciStatus_t HCI_LE_ReadBufSizeCmd( void );  
  81.   
  82. //取得本地支持的特性  
  83. hciStatus_t HCI_LE_ReadLocalSupportedFeaturesCmd( void );  
  84.   
  85. //设置设别随机地址  
  86. hciStatus_t HCI_LE_SetRandomAddressCmd( uint8 *pRandAddr );  
  87.   
  88. //设置广播参数  
  89. hciStatus_t HCI_LE_SetAdvParamCmd( uint16 advIntervalMin,  
  90.                                           uint16 advIntervalMax,  
  91.                                           uint8  advType,  
  92.                                           uint8  ownAddrType,  
  93.                                           uint8  directAddrType,  
  94.                                           uint8  *directAddr,  
  95.                                           uint8  advChannelMap,  
  96.                                           uint8  advFilterPolicy );  
  97.   
  98. //设置广播数据  
  99. hciStatus_t HCI_LE_SetAdvDataCmd( uint8 dataLen,  
  100.                                          uint8 *pData );  
  101.   
  102. //设置广播搜索响应数据  
  103. hciStatus_t HCI_LE_SetScanRspDataCmd( uint8 dataLen,  
  104.                                              uint8 *pData );  
  105.   
  106. //开关广播  
  107. hciStatus_t HCI_LE_SetAdvEnableCmd( uint8 advEnable );  
  108.   
  109. //读取广播时的发射功率  
  110. hciStatus_t HCI_LE_ReadAdvChanTxPowerCmd( void );  
  111.   
  112. //设置搜索参数  
  113. hciStatus_t HCI_LE_SetScanParamCmd( uint8  scanType,  
  114.                                            uint16 scanInterval,  
  115.                                            uint16 scanWindow,  
  116.                                            uint8  ownAddrType,  
  117.                                            uint8  filterPolicy );  
  118.   
  119. //开关搜索  
  120. hciStatus_t HCI_LE_SetScanEnableCmd( uint8 scanEnable,  
  121.                                             uint8 filterDuplicates );  
  122.   
  123. //建立连接  
  124. hciStatus_t HCI_LE_CreateConnCmd( uint16 scanInterval,  
  125.                                          uint16 scanWindow,  
  126.                                          uint8  initFilterPolicy,  
  127.                                          uint8  addrTypePeer,  
  128.                                          uint8  *peerAddr,  
  129.                                          uint8  ownAddrType,  
  130.                                          uint16 connIntervalMin,  
  131.                                          uint16 connIntervalMax,  
  132.                                          uint16 connLatency,  
  133.                                          uint16 connTimeout,  
  134.                                          uint16 minLen,  
  135.                                          uint16 maxLen );  
  136.   
  137. //取消创建连接  
  138. hciStatus_t HCI_LE_CreateConnCancelCmd( void );  
  139.   
  140. //读取白名单  
  141. hciStatus_t HCI_LE_ReadWhiteListSizeCmd( void );  
  142.   
  143. //清除白名单  
  144. hciStatus_t HCI_LE_ClearWhiteListCmd( void );  
  145.   
  146. //添加一条白名单  
  147. hciStatus_t HCI_LE_AddWhiteListCmd( uint8 addrType,  
  148.                                            uint8 *devAddr );  
  149.   
  150. //移除一条白名单  
  151. hciStatus_t HCI_LE_RemoveWhiteListCmd( uint8 addrType,  
  152.                                               uint8 *devAddr );  
  153.   
  154. //更新连接参数  
  155. hciStatus_t HCI_LE_ConnUpdateCmd( uint16 connHandle,  
  156.                                          uint16 connIntervalMin,  
  157.                                          uint16 connIntervalMax,  
  158.                                          uint16 connLatency,  
  159.                                          uint16 connTimeout,  
  160.                                          uint16 minLen,  
  161.                                          uint16 maxLen );  
  162.   
  163. //更新当前数据通道MAP  
  164. hciStatus_t HCI_LE_SetHostChanClassificationCmd( uint8 *chanMap );  
  165.   
  166. //读取连接数据通道MAP  
  167. hciStatus_t HCI_LE_ReadChannelMapCmd( uint16 connHandle );  
  168.   
  169. //读取远程设备用户特性  
  170. hciStatus_t HCI_LE_ReadRemoteUsedFeaturesCmd( uint16 connHandle );  
  171.   
  172. //执行AES128加密  
  173. hciStatus_t HCI_LE_EncryptCmd( uint8 *key,  
  174.                                       uint8 *plainText );  
  175.   
  176. //产生随机数  
  177. hciStatus_t HCI_LE_RandCmd( void );  
  178.   
  179. //连接中开始加密  
  180. hciStatus_t HCI_LE_StartEncyptCmd( uint16 connHandle,  
  181.                                           uint8  *random,  
  182.                                           uint8  *encDiv,  
  183.                                           uint8  *ltk );  
  184.   
  185. //主机向控制器发送一个LTK回应  
  186. hciStatus_t HCI_LE_LtkReqReplyCmd( uint16 connHandle,  
  187.                                           uint8  *ltk );  
  188.   
  189. //This LE API is used by the Host to send to the Controller a negative LTK reply.  
  190. hciStatus_t HCI_LE_LtkReqNegReplyCmd( uint16 connHandle );  
  191.   
  192. //读取控制器支持的状态  
  193. hciStatus_t HCI_LE_ReadSupportedStatesCmd( void );  
  194.   
  195. // This LE API is used to start the receiver Direct Test Mode test.  
  196. hciStatus_t HCI_LE_ReceiverTestCmd( uint8 rxFreq );  
  197.   
  198. //This LE API is used to start the transmit Direct Test Mode test.  
  199. hciStatus_t HCI_LE_TransmitterTestCmd( uint8 txFreq,  
  200.                                               uint8 dataLen,  
  201.                                               uint8 pktPayload );  
  202.   
  203. //This LE API is used to end the Direct Test Mode test.  
  204. hciStatus_t HCI_LE_TestEndCmd( void );  
  205.   
  206. //This HCI Extension API is used to set the receiver gain.  
  207. hciStatus_t HCI_EXT_SetRxGainCmd( uint8 rxGain );  
  208.   
  209. //设置发射功率  
  210. hciStatus_t HCI_EXT_SetTxPowerCmd( uint8 txPower );  
  211.   
  212. //设置是否连接中一个消息只能包含一个包  
  213. hciStatus_t HCI_EXT_OnePktPerEvtCmd( uint8 control );  
  214.   
  215. //This HCI Extension API is used to set whether the system clock will be divided when the MCU is halted.  
  216. hciStatus_t HCI_EXT_ClkDivOnHaltCmd( uint8 control );  
  217.   
  218. //This HCI Extension API is used to indicate to the Controller whether or not the Host will be using the NV memory during BLE operations.  
  219. hciStatus_t HCI_EXT_DeclareNvUsageCmd( uint8 mode );  
  220.   
  221. //使用AES128解密  
  222. hciStatus_t HCI_EXT_DecryptCmd( uint8 *key,  
  223.                                        uint8 *encText );  
  224.   
  225. //设置支持的特性  
  226. hciStatus_t HCI_EXT_SetLocalSupportedFeaturesCmd( uint8 *localFeatures );  
  227.   
  228. //设置尽快发送数据  
  229. hciStatus_t HCI_EXT_SetFastTxResponseTimeCmd( uint8 control );  
  230.   
  231. //This HCI Extension API is used to to enable or disable suspending slave latency.  
  232. hciStatus_t HCI_EXT_SetSlaveLatencyOverrideCmd( uint8 control );  
  233.   
  234. //This API is used start a continuous transmitter modem test, using either a modulated or unmodulated carrier wave tone, at the frequency that corresponds to the specified RF channel. Use HCI_EXT_EndModemTest command to end the test.  
  235. hciStatus_t HCI_EXT_ModemTestTxCmd( uint8 cwMode,  
  236.                                            uint8 txFreq );  
  237.   
  238. //This API is used to start a continuous transmitter direct test mode test using a modulated carrier wave and transmitting a 37 byte packet of Pseudo-Random 9-bit data. A packet is transmitted on a different frequency (linearly stepping through all RF channels 0..39) every 625us. Use HCI_EXT_EndModemTest command to end the test.  
  239. hciStatus_t HCI_EXT_ModemHopTestTxCmd( void );  
  240.   
  241. //This API is used to start a continuous receiver modem test using a modulated carrier wave tone, at the frequency that corresponds to the specific RF channel. Any received data is discarded. Receiver gain may be adjusted using the HCI_EXT_SetRxGain command. RSSI may be read during this test by using the HCI_ReadRssi command. Use HCI_EXT_EndModemTest command to end the test.  
  242. hciStatus_t HCI_EXT_ModemTestRxCmd( uint8 rxFreq );  
  243.   
  244. //This API is used to shutdown a modem test. A complete Controller reset will take place.  
  245. hciStatus_t HCI_EXT_EndModemTestCmd( void );  
  246.   
  247. //设置设备的BLE地址  
  248. hciStatus_t HCI_EXT_SetBDADDRCmd( uint8 *bdAddr );  
  249.   
  250. //设置设备的睡眠时钟精度  
  251. hciStatus_t HCI_EXT_SetSCACmd( uint16 scaInPPM );  
  252.   
  253. //This HCI Extension API is used to enable Production Test Mode.  
  254. hciStatus_t HCI_EXT_EnablePTMCmd( void );  
  255.   
  256. //This HCI Extension API is used to set the frequency tuning up or down. Setting the mode up/down decreases/increases the amount of capacitance on the external crystal oscillator.  
  257. hciStatus_t HCI_EXT_SetFreqTuneCmd( uint8 step );  
  258.   
  259. //保存频率调谐值到Flash  
  260. hciStatus_t HCI_EXT_SaveFreqTuneCmd( void );  
  261.   
  262. //This HCI Extension API is used to set the maximum transmit output power for Direct Test Mode.  
  263. hciStatus_t HCI_EXT_SetMaxDtmTxPowerCmd( uint8 txPower );  
  264.   
  265. llStatus_t HCI_EXT_MapPmIoPortCmd( uint8 ioPort, uint8 ioPin );  
  266.   
  267. //立即断开连接  
  268. hciStatus_t HCI_EXT_DisconnectImmedCmd( uint16 connHandle );  
  269.   
  270. //读取或复位包错误率计数器  
  271. hciStatus_t HCI_EXT_PacketErrorRateCmd( uint16 connHandle, uint8 command );  
  272.   
  273. //开始或结束包错误率计数  
  274. hciStatus_t HCI_EXT_PERbyChanCmd( uint16 connHandle, perByChan_t *perByChan );  
  275.   
  276. //This HCI Extension API is used to Extend Rf Range using the TI CC2590 2.4 GHz RF Front End device  
  277. hciStatus_t HCI_EXT_ExtendRfRangeCmd( void );  
  278.   
  279. //This HCI Extension API is used to enable or disable halting the CPU during RF. The system defaults to enabled.  
  280. hciStatus_t HCI_EXT_HaltDuringRfCmd( uint8 mode );  
  281.   
  282. //This HCI Extension API is used to enable or disable a notification to the specified task using the specified task event whenever a Adv event ends. A non-zero taskEvent value is taken to be "enable", while a zero valued taskEvent is taken to be "disable".  
  283. hciStatus_t HCI_EXT_AdvEventNoticeCmd( uint8 taskID, uint16 taskEvent );  
  284.   
  285. //This HCI Extension API is used to enable or disable a notification to the specified task using the specified task event whenever a Connection event ends. A non-zero taskEvent value is taken to be "enable", while a zero valued taskEvent taken to be "disable".  
  286. hciStatus_t HCI_EXT_ConnEventNoticeCmd( uint8 taskID, uint16 taskEvent );  
  287.   
  288. //设置用户版本号  
  289. hciStatus_t HCI_EXT_BuildRevisionCmd( uint8 mode, uint16 userRevNum );  

 

 

L2CAP.h

 

 

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. //初始化L2CAP层  
  2. void L2CAP_Init( uint8 taskId );  
  3.   
  4. //L2CAP任务时间处理函数  
  5. uint16 L2CAP_ProcessEvent( uint8 taskId, uint16 events );  
  6.   
  7. //为协议或程序注册一个L2CAP通道  
  8. bStatus_t L2CAP_RegisterApp( uint8 taskId, uint16 CID );  
  9.   
  10. //发送L2CAP数据包  
  11. bStatus_t L2CAP_SendData( uint16 connHandle, l2capPacket_t *pPkt );  
  12.   
  13. //发送拒绝命令  
  14. bStatus_t L2CAP_CmdReject( uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject );  
  15.   
  16. //建立拒绝命令  
  17. uint16 L2CAP_BuildCmdReject( uint8 *pBuf, uint8 *pCmd );  
  18.   
  19. //发送L2CAP Echo请求  
  20. bStatus_t L2CAP_EchoReq( uint16 connHandle, l2capEchoReq_t *pEchoReq, uint8 taskId );  
  21.   
  22. //发送L2CAP信息请求  
  23. bStatus_t L2CAP_InfoReq( uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId );  
  24.   
  25. //建立信息响应  
  26. uint16 L2CAP_BuildInfoRsp( uint8 *pBuf, uint8 *pCmd );  
  27.   
  28. //解析信息请求  
  29. bStatus_t L2CAP_ParseInfoReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );  
  30.   
  31. //发送L2CAP连接参数更新请求  
  32. bStatus_t L2CAP_ConnParamUpdateReq( uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId );  
  33.   
  34. //解析连接参数更新请求  
  35. bStatus_t L2CAP_ParseParamUpdateReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );  
  36.   
  37. //发送连接参数更新响应  
  38. bStatus_t L2CAP_ConnParamUpdateRsp( uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp );  
  39.   
  40. //建立连接参数更新响应  
  41. uint16 L2CAP_BuildParamUpdateRsp( uint8 *pBuf, uint8 *pData );  
  42.   
  43. //在L2CAP层分配内存  
  44. void *L2CAP_bm_alloc( uint16 size );  


GATT.h

 

 

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. //初始化GATT客户端  
  2. bStatus_t GATT_InitClient(void);  
  3.   
  4. //注册接收ATT的Indications或Notifications属性值  
  5. void GATT_RegisterForInd(uint8 taskId);  
  6.   
  7. //准备写请求用于请求服务器准备写一个属性的值  
  8. bStatus_t GATT_PrepareWriteReq(uint16 connHandle, attPrepareWriteReq_t *pReq, uint8 taskId);  
  9.   
  10. //执行写请求  
  11. bStatus_t GATT_ExecuteWriteReq(uint16 connHandle, attExecuteWriteReq_t *pReq, uint8 taskId);  
  12.   
  13. //初始化GATT服务器  
  14. bStatus_t GATT_InitServer(void);  
  15.   
  16. //为GATT服务器注册服务属性列表  
  17. bStatus_t GATT_RegisterService(gattService_t *pService);  
  18.   
  19. //为GATT服务器注销一个属性列表  
  20. bStatus_t GATT_DeregisterService(uint16 handle, gattService_t *pService);  
  21.   
  22. //注册接收ATT请求  
  23. void GATT_RegisterForReq(uint8 taskId);  
  24.   
  25. //验证属性的读取权限  
  26. bStatus_t GATT_VerifyReadPermissions(uint16 connHandle, uint8 permissions);  
  27.   
  28. //验证属性的写权限  
  29. bStatus_t GATT_VerifyWritePermissions(uint16 connHandle, uint8 permissions, attWriteReq_t *pReq);  
  30.   
  31. //发送服务改变Indication  
  32. uint8 GATT_ServiceChangedInd(uint16 connHandle, uint8 taskId);  
  33.   
  34. //通过UUID找到属性记录  
  35. gattAttribute_t *GATT_FindHandleUUID(uint16 startHandle, uint16 endHandle, const uint8 *pUUID, uint16 len, uint16 *pHandle);  
  36.   
  37. //通过句柄找属性记录  
  38. gattAttribute_t *GATT_FindHandle(uint16 handle, uint16 *pHandle);  
  39.   
  40. //找给定的属性相同类型的下一个属性  
  41. gattAttribute_t *GATT_FindNextAttr(gattAttribute_t *pAttr, uint16 endHandle, uint16 service, uint16 *pLastHandle);  
  42.   
  43. //取得服务的属性数  
  44. uint16 GATT_ServiceNumAttrs(uint16 handle);  
  45.   
  46. //发送Indication  
  47. bStatus_t GATT_Indication(uint16 connHandle, attHandleValueInd_t *pInd, uint8 authenticated, uint8 taskId);  
  48.   
  49. //发送Notification  
  50. bStatus_t GATT_Notification(uint16 connHandle, attHandleValueNoti_t *pNoti, uint8 authenticated);  
  51.   
  52. //客户端设置ATT_MTU最大值  
  53. bStatus_t GATT_ExchangeMTU(uint16 connHandle, attExchangeMTUReq_t *pReq, uint8 taskId);  
  54.   
  55. //客户端用来发现服务器的所有主要服务  
  56. bStatus_t GATT_DiscAllPrimaryServices(uint16 connHandle, uint8 taskId);  
  57.   
  58. //客户端通过UUID发现服务器的特定服务  
  59. bStatus_t GATT_DiscPrimaryServiceByUUID(uint16 connHandle, uint8 *pValue, uint8 len, uint8 taskId);  
  60.   
  61. //This sub-procedure is used by a client to find include service declarations within a service definition on a server. The service specified is identified by the service handle range.  
  62. bStatus_t GATT_FindIncludedServices(uint16 connHandle, uint16 startHandle, uint16 endHandle, uint8 taskId);  
  63.   
  64. //找到所有特性  
  65. bStatus_t GATT_DiscAllChars(uint16 connHandle, uint16 startHandle, uint16 endHandle, uint8 taskId);  
  66.   
  67. //通过UUID找到特性  
  68. bStatus_t GATT_DiscCharsByUUID(uint16 connHandle, attReadByTypeReq_t *pReq, uint8 taskId);  
  69.   
  70. //找到所有特性描述  
  71. bStatus_t GATT_DiscAllCharDescs(uint16 connHandle, uint16 startHandle, uint16 endHandle, uint8 taskId);  
  72.   
  73. //读取特性值  
  74. bStatus_t GATT_ReadCharValue(uint16 connHandle, attReadReq_t *pReq, uint8 taskId);  
  75.         bleTimeout: Previous transaction timed out.<BR>  
  76.   
  77. //通过UUID读取特性值  
  78. bStatus_t GATT_ReadUsingCharUUID(uint16 connHandle, attReadByTypeReq_t *pReq, uint8 taskId);  
  79.   
  80. //读取长特性值  
  81. bStatus_t GATT_ReadLongCharValue(uint16 connHandle, attReadBlobReq_t *pReq, uint8 taskId);  
  82.   
  83. //读取多个特性值  
  84. bStatus_t GATT_ReadMultiCharValues(uint16 connHandle, attReadMultiReq_t *pReq, uint8 taskId);  
  85.   
  86. //写特性值,不需要回应  
  87. bStatus_t GATT_WriteNoRsp(uint16 connHandle, attWriteReq_t *pReq);  
  88.   
  89. bStatus_t GATT_SignedWriteNoRsp(uint16 connHandle, attWriteReq_t *pReq);  
  90.   
  91. //写特性值  
  92. bStatus_t GATT_WriteCharValue(uint16 connHandle, attWriteReq_t *pReq, uint8 taskId);  
  93.   
  94. //写长特性值  
  95. bStatus_t GATT_WriteLongCharValue(uint16 connHandle, gattPrepareWriteReq_t *pReq, uint8 taskId);  
  96.   
  97. bStatus_t GATT_ReliableWrites(uint16 connHandle, attPrepareWriteReq_t *pReqs, uint8 numReqs, uint8 flags, uint8 taskId);  
  98.   
  99. //读取特性描述  
  100. bStatus_t GATT_ReadCharDesc(uint16 connHandle, attReadReq_t *pReq, uint8 taskId);  
  101.   
  102. //读取长特性描述  
  103. bStatus_t GATT_ReadLongCharDesc(uint16 connHandle, attReadBlobReq_t *pReq, uint8 taskId);  
  104.   
  105. //写特性描述  
  106. bStatus_t GATT_WriteCharDesc(uint16 connHandle, attWriteReq_t *pReq, uint8 taskId);  
  107.   
  108. //写长特性描述  
  109. bStatus_t GATT_WriteLongCharDesc(uint16 connHandle, gattPrepareWriteReq_t *pReq, uint8 taskId);  


GAP.h

 

 

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
  1. //设备初始化  
  2. bStatus_t GAP_DeviceInit(  uint8 taskID,  
  3.                            uint8 profileRole,  
  4.                            uint8 maxScanResponses,  
  5.                            uint8 *pIRK,  
  6.                            uint8 *pSRK,  
  7.                            uint32 *pSignCounter );  
  8.   
  9. //设置GAP广播搜索响应数据  
  10. bStatus_t GAP_SetAdvToken( gapAdvDataToken_t *pToken );  
  11.   
  12. //读取GAP广播响应数据  
  13. gapAdvDataToken_t *GAP_GetAdvToken( uint8 adType );  
  14.   
  15. //移除GAP广播响应数据  
  16. gapAdvDataToken_t *GAP_RemoveAdvToken( uint8 adType );  
  17.   
  18. //重建加载广播响应数据  
  19. bStatus_t GAP_UpdateAdvTokens( void );  
  20.   
  21. //设置GAP参数  
  22. bStatus_t GAP_SetParamValue( gapParamIDs_t paramID, uint16 paramValue );  
  23.   
  24. //取得GAP参数  
  25. uint16 GAP_GetParamValue( gapParamIDs_t paramID );  
  26.   
  27. //设置设备地址类型  
  28. bStatus_t GAP_ConfigDeviceAddr( uint8 addrType, uint8 *pStaticAddr );  
  29.   
  30. //注册任务ID  
  31. void GAP_RegisterForHCIMsgs( uint8 taskID );  
  32.   
  33. //开始搜索  
  34. bStatus_t GAP_DeviceDiscoveryRequest( gapDevDiscReq_t *pParams );  
  35.   
  36. //取得发现任务  
  37. bStatus_t GAP_DeviceDiscoveryCancel( uint8 taskID );  
  38.   
  39. //设置改变开始广播  
  40. bStatus_t GAP_MakeDiscoverable( uint8 taskID, gapAdvertisingParams_t *pParams );  
  41.   
  42. //设置改变搜索响应数据  
  43. bStatus_t GAP_UpdateAdvertisingData( uint8 taskID, uint8 adType,  
  44.       uint8 dataLen, uint8 *pAdvertData );  
  45.   
  46. //停止广播  
  47. bStatus_t GAP_EndDiscoverable( uint8 taskID );  
  48.   
  49. //Resolves a private address against an IRK.  
  50. bStatus_t GAP_ResolvePrivateAddr( uint8 *pIRK, uint8 *pAddr );  
  51.   
  52. //建立一个连接到从设备  
  53. bStatus_t GAP_EstablishLinkReq( gapEstLinkReq_t *pParams );  
  54.   
  55. //中断连接  
  56. bStatus_t GAP_TerminateLinkReq( uint8 taskID, uint16 connectionHandle );  
  57.   
  58. //更新连接参数到从设备  
  59. bStatus_t GAP_UpdateLinkParamReq( gapUpdateLinkParamReq_t *pParams );  
  60.   
  61. //返回活跃连接数  
  62. uint8 GAP_NumActiveConnections( void );  
  63.   
  64. //启动认证流程  
  65. bStatus_t GAP_Authenticate( gapAuthParams_t *pParams, gapPairingReq_t *pPairReq );  
  66.   
  67. //发送配对失败消息  
  68. bStatus_t GAP_TerminateAuth( uint16 connectionHandle, uint8 reason );  
  69.   
  70. //字符串格式的密钥更新  
  71. bStatus_t GAP_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );  
  72.   
  73. //数字形式的密钥更新  
  74. bStatus_t GAP_PasscodeUpdate( uint32 passcode, uint16 connectionHandle );  
  75.   
  76. //产生一个从机请求的安全消息到主机  
  77. bStatus_t GAP_SendSlaveSecurityRequest( uint16 connectionHandle, uint8 authReq );  
  78.   
  79. //Set up the connection to accept signed data.  
  80. bStatus_t GAP_Signable( uint16 connectionHandle, uint8 authenticated, smSigningInfo_t *pParams );  
  81.   
  82. //设置连接的绑定参数  
  83. bStatus_t GAP_Bond( uint16 connectionHandle, uint8 authenticated,  
  84.       smSecurityInfo_t *pParams, uint8 startEncryption );  

 

 

ATT.h

 

 

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
 
    1. //解析ATT包  
    2. uint8 ATT_ParsePacket(l2capDataEvent_t *pL2capMsg, attPacket_t *pPkt);  
    3.   
    4. //比较UUID  
    5. uint8 ATT_CompareUUID(const uint8 *pUUID1, uint16 len1, const uint8 *pUUID2, uint16 len2);  
    6.   
    7. //转换16bit的UUID到128bit  
    8. uint8 ATT_ConvertUUIDto128(const uint8 *pUUID16, uint8 *pUUID128);  
    9.   
    10. //转换128bit的UUID到16bit  
    11. uint8 ATT_ConvertUUIDto16(const uint8 *pUUID128, uint8 *pUUID16);  
    12.   
    13. //构建错误响应  
    14. uint16 ATT_BuildErrorRsp(uint8 *pBuf, uint8 *pMsg);  
    15.   
    16. //解析错误响应  
    17. bStatus_t ATT_ParseErrorRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    18.   
    19. //构建交换MTU请求  
    20. uint16 ATT_BuildExchangeMTUReq(uint8 *pBuf, uint8 *pMsg);  
    21.   
    22. //构建交换MTU响应  
    23. uint16 ATT_BuildExchangeMTURsp(uint8 *pBuf, uint8 *pMsg);  
    24.   
    25. //解析MTU响应  
    26. bStatus_t ATT_ParseExchangeMTURsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    27.   
    28. //构建找信息请求  
    29. uint16 ATT_BuildFindInfoReq(uint8 *pBuf, uint8 *pMsg);  
    30.   
    31. //解析找信息响应  
    32. bStatus_t ATT_ParseFindInfoRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    33.   
    34. //构建找信息响应  
    35. uint16 ATT_BuildFindInfoRsp(uint8 *pBuf, uint8 *pMsg);  
    36.   
    37. //构建通过类型值找请求  
    38. uint16 ATT_BuildFindByTypeValueReq(uint8 *pBuf, uint8 *pMsg);  
    39.   
    40. //构建通过类型值找响应  
    41. uint16 ATT_BuildFindByTypeValueRsp(uint8 *pBuf, uint8 *pMsg);  
    42.   
    43. //解析通过类型值找响应  
    44. bStatus_t ATT_ParseFindByTypeValueRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    45.   
    46. //构建通过类型值读请求  
    47. uint16 ATT_BuildReadByTypeReq(uint8 *pBuf, uint8 *pMsg);  
    48.   
    49. //构建通过类型值读响应  
    50. uint16 ATT_BuildReadByTypeRsp(uint8 *pBuf, uint8 *pMsg);  
    51.   
    52. //解析通过类型值读响应  
    53. bStatus_t ATT_ParseReadByTypeRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    54.   
    55. //构建读请求  
    56. uint16 ATT_BuildReadReq(uint8 *pBuf, uint8 *pMsg);  
    57.   
    58. //构建读响应  
    59. uint16 ATT_BuildReadRsp(uint8 *pBuf, uint8 *pMsg);  
    60.   
    61. //解析读响应  
    62. bStatus_t ATT_ParseReadRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    63.   
    64. //构建场数据读取请求  
    65. uint16 ATT_BuildReadBlobReq(uint8 *pBuf, uint8 *pMsg);  
    66.   
    67. //构建长数据读取响应  
    68. uint16 ATT_BuildReadBlobRsp(uint8 *pBuf, uint8 *pMsg);  
    69.   
    70. //解析大数据读取响应  
    71. bStatus_t ATT_ParseReadBlobRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    72.   
    73. //构建多数据读取请求  
    74. uint16 ATT_BuildReadMultiReq(uint8 *pBuf, uint8 *pMsg);  
    75.   
    76. //构建多数据读取响应  
    77. uint16 ATT_BuildReadMultiRsp(uint8 *pBuf, uint8 *pMsg);  
    78.   
    79. //解析多数据读取响应  
    80. bStatus_t ATT_ParseReadMultiRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    81.   
    82. //Build Read By Group Type Response.  
    83. uint16 ATT_BuildReadByGrpTypeRsp(uint8 *pBuf, uint8 *pMsg);  
    84.   
    85. // Parse Read By Group Type Response.  
    86. bStatus_t ATT_ParseReadByGrpTypeRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    87.   
    88. // Build Write Request.  
    89. uint16 ATT_BuildWriteReq(uint8 *pBuf, uint8 *pMsg);  
    90.   
    91. //Parse Write Response.  
    92. bStatus_t ATT_ParseWriteRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    93.   
    94. // Build Prepare Write Request.  
    95. uint16 ATT_BuildPrepareWriteReq(uint8 *pBuf, uint8 *pMsg);  
    96.   
    97. //Build Prepare Write Response.  
    98. uint16 ATT_BuildPrepareWriteRsp(uint8 *pBuf, uint8 *pMsg);  
    99.   
    100. //Parse Prepare Write Response.  
    101. bStatus_t ATT_ParsePrepareWriteRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    102.   
    103. // Build Execute Write Request.  
    104. uint16 ATT_BuildExecuteWriteReq(uint8 *pBuf, uint8 *pMsg);  
    105.   
    106. // Parse Execute Write Response.  
    107. bStatus_t ATT_ParseExecuteWriteRsp(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    108.   
    109. //Build Handle Value Indication.  
    110. uint16 ATT_BuildHandleValueInd(uint8 *pBuf, uint8 *pMsg);  
    111.   
    112. //Parse Handle Value Indication.  
    113. bStatus_t ATT_ParseHandleValueInd(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    114.   
    115. // Parse Exchange MTU Request.  
    116. bStatus_t ATT_ParseExchangeMTUReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    117.   
    118. //Parse Find Information Request.  
    119. bStatus_t ATT_ParseFindInfoReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    120.   
    121. // Parse Find By Type Value Request.  
    122. bStatus_t ATT_ParseFindByTypeValueReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    123.   
    124. // Parse Read By Type Request.  
    125. bStatus_t ATT_ParseReadByTypeReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    126.   
    127. //Parse Read Request.  
    128. bStatus_t ATT_ParseReadReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    129.   
    130. //Parse Write Blob Request.  
    131. bStatus_t ATT_ParseReadBlobReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    132.   
    133. //Parse Read Multiple Request.  
    134. bStatus_t ATT_ParseReadMultiReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    135.   
    136. //Parse Write Request.  
    137. bStatus_t ATT_ParseWriteReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    138.   
    139. //Parse Execute Write Request.  
    140. bStatus_t ATT_ParseExecuteWriteReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    141.   
    142. //Parse Prepare Write Request.  
    143. bStatus_t ATT_ParsePrepareWriteReq(uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    144.   
    145. // Parse Handle Value Confirmation.  
    146. bStatus_t ATT_ParseHandleValueCfm(uint8 *pParams, uint16 len, attMsg_t *pMsg);  
    147.   
    148. //发送交换MTU请求  
    149. bStatus_t ATT_ExchangeMTUReq(uint16 connHandle, attExchangeMTUReq_t *pReq);  
    150.   
    151. //Send Find Information Request.  
    152. bStatus_t ATT_FindInfoReq(uint16 connHandle, attFindInfoReq_t *pReq);  
    153.   
    154. // Send Find By Type Value Request.  
    155. bStatus_t ATT_FindByTypeValueReq(uint16 connHandle, attFindByTypeValueReq_t *pReq);  
    156.   
    157. //Send Read By Type Request.  
    158. bStatus_t ATT_ReadByTypeReq(uint16 connHandle, attReadByTypeReq_t *pReq);  
    159.   
    160. // Send Read Request.  
    161. bStatus_t ATT_ReadReq(uint16 connHandle, attReadReq_t *pReq);  
    162.   
    163. // Send Read Blob Request.  
    164. bStatus_t ATT_ReadBlobReq(uint16 connHandle, attReadBlobReq_t *pReq);  
    165.   
    166. // Send Read Multiple Request.  
    167. bStatus_t ATT_ReadMultiReq(uint16 connHandle, attReadMultiReq_t *pReq);  
    168.   
    169. // Send Read By Group Type Request.  
    170. bStatus_t ATT_ReadByGrpTypeReq(uint16 connHandle, attReadByGrpTypeReq_t *pReq);  
    171.   
    172. // Send Write Request.  
    173. bStatus_t ATT_WriteReq(uint16 connHandle, attWriteReq_t *pReq);  
    174.   
    175. // Send Prepare Write Request.  
    176. bStatus_t ATT_PrepareWriteReq(uint16 connHandle, attPrepareWriteReq_t *pReq);  
    177.   
    178. // Send Execute Write Request.  
    179. bStatus_t ATT_ExecuteWriteReq(uint16 connHandle, attExecuteWriteReq_t *pReq);  
    180.   
    181. // Send Handle Value Confirmation.  
    182. bStatus_t ATT_HandleValueCfm(uint16 connHandle);  
    183.   
    184. // Send Error Response.  
    185. bStatus_t ATT_ErrorRsp(uint16 connHandle, attErrorRsp_t *pRsp);  
    186.   
    187. //Send Exchange MTU Response.  
    188. bStatus_t ATT_ExchangeMTURsp(uint16 connHandle, attExchangeMTURsp_t *pRsp);  
    189.   
    190. // Send Find Information Response.  
    191. bStatus_t ATT_FindInfoRsp(uint16 connHandle, attFindInfoRsp_t *pRsp);  
    192.   
    193. //Send Find By Tyep Value Response.  
    194. bStatus_t ATT_FindByTypeValueRsp(uint16 connHandle, attFindByTypeValueRsp_t *pRsp);  
    195.   
    196. //Send Read By Type Respond.  
    197. bStatus_t ATT_ReadByTypeRsp(uint16 connHandle, attReadByTypeRsp_t *pRsp);  
    198.   
    199. //Send Read Response.  
    200. bStatus_t ATT_ReadRsp(uint16 connHandle, attReadRsp_t *pRsp);  
    201.   
    202. // Send Read Blob Response.  
    203. bStatus_t ATT_ReadBlobRsp(uint16 connHandle, attReadBlobRsp_t *pRsp);  
    204.   
    205. //Send Read Multiple Response.  
    206. bStatus_t ATT_ReadMultiRsp(uint16 connHandle, attReadMultiRsp_t *pRsp);  
    207.   
    208. // Send Read By Group Type Respond.  
    209. bStatus_t ATT_ReadByGrpTypeRsp(uint16 connHandle, attReadByGrpTypeRsp_t *pRsp);  
    210.   
    211. //Send Write Response.  
    212. bStatus_t ATT_WriteRsp(uint16 connHandle);  
    213.   
    214. // Send Prepare Write Response.  
    215. bStatus_t ATT_PrepareWriteRsp(uint16 connHandle, attPrepareWriteRsp_t *pRsp);  
    216.   
    217. // Send Execute Write Response.  
    218. bStatus_t ATT_ExecuteWriteRsp(uint16 connHandle);  
    219.   
    220. // Send Handle Value Notification.  
    221. bStatus_t ATT_HandleValueNoti(uint16 connHandle, attHandleValueNoti_t *pNoti);  
    222.   
    223. // Send Handle Value Indication.  
    224. bStatus_t ATT_HandleValueInd(uint16 connHandle, attHandleValueInd_t *pInd);  
    225.   
    226. //设置ATT参数  
    227. void ATT_SetParamValue(uint16 value);  
    228.   
    229. //取得ATT参数  
    230. uint16 ATT_GetParamValue(void);  

OSAL 学习笔记

 

1-OSAL.C

 * @fn      osal_strlen          计算字符串的长度。字符串必须空结尾。

 * @fn      osal_memcpy         一般内存复制

 * @fn      osal_revmemcpy

   //一般的颠倒内存复制。从资源缓存的最后开始,通过使用资源地址的指针移动len字节的,然后指针自减。

 * @fn      osal_memdup

  //分配一个缓存(和osal_mem_alloc()),并复制这个资源缓存到刚分配好的控件.

 * @fn      osal_memcmp          一般内存比较

 * @fn      osal_memset          设置内存缓存值

 * @fn      osal_rand            产生随机数

 * @fn      osal_msg_allocate    动态分配一个OSAL消息缓存

 * @fn      osal_msg_deallocate  释放一个OSAL消息缓存(接收任务调用)

 * @fn      osal_msg_send        为某个任务发送一个OSAL消息

 * @fn      osal_msg_receive     检索接收命令消息。

 * @fn      osal_msg_find        发现 在一个OSAL消息匹配任务ID和事件参数。

 * @fn      osal_msg_extract

 *  //从OSAL队列中间 提取和移除 一个OSAL消息

 * @fn      osal_set_event        为一个任务设置一个 OSAL 事件

 * @fn      osal_clear_event      清除一个任务的事件标志。

 * @fn      osal_init_system      OSAL 初始化,必须在主函数中被调用 

 * @fn      osal_start_system     开始运行OSAL 主循环

 * @fn      osal_run_system       现至少一个等待事件的第一个任务。

 

 

2-OSAL_bufmgr.c

 * @fn      osal_bm_alloc         分配器函数的实现

 * @fn      osal_bm_free          取消分配器函数 的实现

 * @fn      osal_bm_adjust_header 调整header

 * @fn      osal_bm_adjust_tail   调整tail

 

 

3-OSAL_cbtimer.c

 * @fn          osal_CbTimerInit  初始化函数

 * @fn          osal_CbTimerProcessEvent//回调 定时器 任务事件处理函数

 * @fn      osal_CbTimerStart//当定时器到期,注册调用函数将被调用。

 * @fn      osal_CbTimerUpdate更新一个已经启动的 消息定时器

 * @fn      osal_CbTimerStop//停止一个已经启动的定时器。

 

 

4-OSAL_ClockBLE.c

 * @fn      osalTimeUpdate    更新 OSAL时间和定时器,

 * @fn      osalClockUpdate //用 运行ms  更新OSAL时间表,

 * @fn      osal_setClock//设置新时间。

 * @fn      osal_getClock //得到当前时间。

 * @fn      osal_ConvertUTCTime 转换时间格式

 * @fn      osal_ConvertUTCSecs转换时间格式

 

 

5-OSAL_Memory.c

 * @fn          osal_mem_init内存管理初始化

 * @fn          osal_mem_kick //任务初始化

 * @fn          osal_mem_alloc执行 OSAL 动态内存分配函数

 * @fn       osal_mem_free //执行OSAL动态内存 释放函数

 

 

6-OSAL_PwrMgr.c

 * @fn      osal_pwrmgr_init //初始化 电源管理系统

 * @fn      osal_pwrmgr_task_state//每一个任务调用函数,来陈述是否这个任务要保存电源

 * @fn      osal_pwrmgr_powerconserve //当没有活动安排 这个函数从主循环被调用,不应该从别的地方被调用。

 

 

7-OSAL_snv.c

 

 

8-OSAL_timers.c

 * @fn      osalTimerInit  初始化OSAL定时器系统

 * @fn      osalAddTimer增加一个定时器到定时器列表

 * @fn      osalFindTimer 在定时器列表中发现一个定时器

 * @fn      osalDeleteTimer 从一个列表中删除一个定时器

 * @fn      osal_start_timerEx //调用开始一个定时器在n ms内

 * @fn      osal_stop_timerEx  //停止一个已经启动的定时器。

 * @fn      osalTimerUpdate更新 定时器结构

 * @fn      osal_adjust_timers 更新已经过去的定时器结构

 * @fn      osal_GetSystemClock 读取本地系统时钟

 

==================================================================

以上是一个BLE应用里的OSAL所用到的函数名字,及其功能,方便以后查询。

==================================================================

 

【作者】 张昺华
【新浪微博】 张昺华--sky
【twitter】 @sky2030_
【facebook】 张昺华 zhangbinghua
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
目录
相关文章
|
前端开发 rax Shell
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)(上)
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)
677 0
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)(上)
|
计算机视觉
编译opencv错误解决:libavcodec.a(hevc_cabac.o): `ff_h264_cabac_tables' can not be used
编译opencv错误解决:libavcodec.a(hevc_cabac.o): `ff_h264_cabac_tables' can not be used
115 0
|
网络安全 开发者
CC 自定义功能使用介绍|学习笔记
快速学习 CC 自定义功能使用介绍
71 0
CC 自定义功能使用介绍|学习笔记
|
NoSQL Shell
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)(下)
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)
207 0
[PWN][高级篇]ROP-ret2libc-32/64位实例 (共四个)(下)
[PWN][高级篇]ROP-ret2libc基础知识
[PWN][高级篇]ROP-ret2libc基础知识
399 0
[PWN][高级篇]ROP-ret2libc基础知识
|
网络协议 调度 CDN
CC 排查集锦
访问资源出现 5xx PC 端排查过程 一、访问 https://cdn.dns-detect.alicdn.com/https/doc.html 目的:获取到客户端的 IP 、DNS 提供阿里云排查使用,方便后端快速的缩小日志排查范围,以及客户端 DNS 、IP 调度是否正常排查; 二、判断出现 5xx 范围 2.
1478 0
CC 排查集锦

热门文章

最新文章