l2c_api.h 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 1999-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * this file contains the L2CAP API definitions
  21. *
  22. ******************************************************************************/
  23. #ifndef L2C_API_H
  24. #define L2C_API_H
  25. #include <stdbool.h>
  26. #include "bt_target.h"
  27. #include "l2cdefs.h"
  28. #include "hcidefs.h"
  29. /*****************************************************************************
  30. ** Constants
  31. *****************************************************************************/
  32. /* Define the minimum offset that L2CAP needs in a buffer. This is made up of
  33. ** HCI type(1), len(2), handle(2), L2CAP len(2) and CID(2) => 9
  34. */
  35. #define L2CAP_MIN_OFFSET 13 /* plus control(2), SDU length(2) */
  36. /* Minimum offset for broadcast needs another two bytes for the PSM */
  37. #define L2CAP_BCST_MIN_OFFSET 11
  38. /* ping result codes */
  39. #define L2CAP_PING_RESULT_OK 0 /* Ping reply received OK */
  40. #define L2CAP_PING_RESULT_NO_LINK 1 /* Link could not be setup */
  41. #define L2CAP_PING_RESULT_NO_RESP 2 /* Remote L2CAP did not reply */
  42. /* result code for L2CA_DataWrite() */
  43. #define L2CAP_DW_FAILED FALSE
  44. #define L2CAP_DW_SUCCESS TRUE
  45. #define L2CAP_DW_CONGESTED 2
  46. /* Values for priority parameter to L2CA_SetAclPriority */
  47. #define L2CAP_PRIORITY_NORMAL 0
  48. #define L2CAP_PRIORITY_HIGH 1
  49. /* Values for priority parameter to L2CA_SetTxPriority */
  50. #define L2CAP_CHNL_PRIORITY_HIGH 0
  51. #define L2CAP_CHNL_PRIORITY_MEDIUM 1
  52. #define L2CAP_CHNL_PRIORITY_LOW 2
  53. typedef UINT8 tL2CAP_CHNL_PRIORITY;
  54. /* Values for Tx/Rx data rate parameter to L2CA_SetChnlDataRate */
  55. #define L2CAP_CHNL_DATA_RATE_HIGH 3
  56. #define L2CAP_CHNL_DATA_RATE_MEDIUM 2
  57. #define L2CAP_CHNL_DATA_RATE_LOW 1
  58. #define L2CAP_CHNL_DATA_RATE_NO_TRAFFIC 0
  59. typedef UINT8 tL2CAP_CHNL_DATA_RATE;
  60. /* Data Packet Flags (bits 2-15 are reserved) */
  61. /* layer specific 14-15 bits are used for FCR SAR */
  62. #define L2CAP_FLUSHABLE_MASK 0x0003
  63. #define L2CAP_FLUSHABLE_CH_BASED 0x0000
  64. #define L2CAP_FLUSHABLE_PKT 0x0001
  65. #define L2CAP_NON_FLUSHABLE_PKT 0x0002
  66. /* L2CA_FlushChannel num_to_flush definitions */
  67. #define L2CAP_FLUSH_CHANS_ALL 0xffff
  68. #define L2CAP_FLUSH_CHANS_GET 0x0000
  69. /* special CID for Multi-AV for reporting congestion */
  70. #define L2CAP_MULTI_AV_CID 0
  71. /* length of the HCI header block */
  72. /* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) */
  73. #define L2CAP_MULTI_AV_HCI_HDR_LEN 8
  74. /* length of padding for 4 bytes align */
  75. #define L2CAP_MULTI_AV_PADDING_LEN 2
  76. /* length of the HCI header block with padding for FCR */
  77. /* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) + padding(2) */
  78. #define L2CAP_MULTI_AV_HCI_HDR_LEN_WITH_PADDING 10
  79. /* length of the L2CAP header block */
  80. /* HCI header(4) + L2CAP header(4) + padding(4) or control word(2) + FCS(2) */
  81. #define L2CAP_MULTI_AV_L2C_HDR_LEN 12
  82. /* definition used for L2CA_SetDesireRole */
  83. #define L2CAP_ROLE_SLAVE HCI_ROLE_SLAVE
  84. #define L2CAP_ROLE_MASTER HCI_ROLE_MASTER
  85. #define L2CAP_ROLE_ALLOW_SWITCH 0x80 /* set this bit to allow switch at create conn */
  86. #define L2CAP_ROLE_DISALLOW_SWITCH 0x40 /* set this bit to disallow switch at create conn */
  87. #define L2CAP_ROLE_CHECK_SWITCH 0xC0
  88. /* Values for 'allowed_modes' field passed in structure tL2CAP_ERTM_INFO
  89. */
  90. #define L2CAP_FCR_CHAN_OPT_BASIC (1 << L2CAP_FCR_BASIC_MODE)
  91. #define L2CAP_FCR_CHAN_OPT_ERTM (1 << L2CAP_FCR_ERTM_MODE)
  92. #define L2CAP_FCR_CHAN_OPT_STREAM (1 << L2CAP_FCR_STREAM_MODE)
  93. #define L2CAP_FCR_CHAN_OPT_ALL_MASK (L2CAP_FCR_CHAN_OPT_BASIC | L2CAP_FCR_CHAN_OPT_ERTM | L2CAP_FCR_CHAN_OPT_STREAM)
  94. /* Validity check for PSM. PSM values must be odd. Also, all PSM values must
  95. ** be assigned such that the least significant bit of the most sigificant
  96. ** octet equals zero.
  97. */
  98. #define L2C_INVALID_PSM(psm) (((psm) & 0x0101) != 0x0001)
  99. #define L2C_IS_VALID_PSM(psm) (((psm) & 0x0101) == 0x0001)
  100. /*****************************************************************************
  101. ** Type Definitions
  102. *****************************************************************************/
  103. typedef struct {
  104. #define L2CAP_FCR_BASIC_MODE 0x00
  105. #define L2CAP_FCR_ERTM_MODE 0x03
  106. #define L2CAP_FCR_STREAM_MODE 0x04
  107. UINT8 mode;
  108. UINT8 tx_win_sz;
  109. UINT8 max_transmit;
  110. UINT16 rtrans_tout;
  111. UINT16 mon_tout;
  112. UINT16 mps;
  113. } tL2CAP_FCR_OPTS;
  114. /* Define a structure to hold the configuration parameters. Since the
  115. ** parameters are optional, for each parameter there is a boolean to
  116. ** use to signify its presence or absence.
  117. */
  118. typedef struct {
  119. UINT16 result; /* Only used in confirm messages */
  120. BOOLEAN mtu_present;
  121. UINT16 mtu;
  122. BOOLEAN qos_present;
  123. FLOW_SPEC qos;
  124. BOOLEAN flush_to_present;
  125. UINT16 flush_to;
  126. BOOLEAN fcr_present;
  127. tL2CAP_FCR_OPTS fcr;
  128. BOOLEAN fcs_present; /* Optionally bypasses FCS checks */
  129. UINT8 fcs; /* '0' if desire is to bypass FCS, otherwise '1' */
  130. BOOLEAN ext_flow_spec_present;
  131. tHCI_EXT_FLOW_SPEC ext_flow_spec;
  132. UINT16 flags; /* bit 0: 0-no continuation, 1-continuation */
  133. } tL2CAP_CFG_INFO;
  134. /* L2CAP channel configured field bitmap */
  135. #define L2CAP_CH_CFG_MASK_MTU 0x0001
  136. #define L2CAP_CH_CFG_MASK_QOS 0x0002
  137. #define L2CAP_CH_CFG_MASK_FLUSH_TO 0x0004
  138. #define L2CAP_CH_CFG_MASK_FCR 0x0008
  139. #define L2CAP_CH_CFG_MASK_FCS 0x0010
  140. #define L2CAP_CH_CFG_MASK_EXT_FLOW_SPEC 0x0020
  141. typedef UINT16 tL2CAP_CH_CFG_BITS;
  142. /*********************************
  143. ** Callback Functions Prototypes
  144. **********************************/
  145. /* Connection indication callback prototype. Parameters are
  146. ** BD Address of remote
  147. ** Local CID assigned to the connection
  148. ** PSM that the remote wants to connect to
  149. ** Identifier that the remote sent
  150. */
  151. typedef void (tL2CA_CONNECT_IND_CB) (BD_ADDR, UINT16, UINT16, UINT8);
  152. /* Connection confirmation callback prototype. Parameters are
  153. ** Local CID
  154. ** Result - 0 = connected, non-zero means failure reason
  155. */
  156. typedef void (tL2CA_CONNECT_CFM_CB) (UINT16, UINT16);
  157. /* Connection pending callback prototype. Parameters are
  158. ** Local CID
  159. */
  160. typedef void (tL2CA_CONNECT_PND_CB) (UINT16);
  161. /* Configuration indication callback prototype. Parameters are
  162. ** Local CID assigned to the connection
  163. ** Pointer to configuration info
  164. */
  165. typedef void (tL2CA_CONFIG_IND_CB) (UINT16, tL2CAP_CFG_INFO *);
  166. /* Configuration confirm callback prototype. Parameters are
  167. ** Local CID assigned to the connection
  168. ** Pointer to configuration info
  169. */
  170. typedef void (tL2CA_CONFIG_CFM_CB) (UINT16, tL2CAP_CFG_INFO *);
  171. /* Disconnect indication callback prototype. Parameters are
  172. ** Local CID
  173. ** Boolean whether upper layer should ack this
  174. */
  175. typedef void (tL2CA_DISCONNECT_IND_CB) (UINT16, BOOLEAN);
  176. /* Disconnect confirm callback prototype. Parameters are
  177. ** Local CID
  178. ** Result
  179. */
  180. typedef void (tL2CA_DISCONNECT_CFM_CB) (UINT16, UINT16);
  181. /* QOS Violation indication callback prototype. Parameters are
  182. ** BD Address of violating device
  183. */
  184. typedef void (tL2CA_QOS_VIOLATION_IND_CB) (BD_ADDR);
  185. /* Data received indication callback prototype. Parameters are
  186. ** Local CID
  187. ** Address of buffer
  188. */
  189. typedef void (tL2CA_DATA_IND_CB) (UINT16, BT_HDR *);
  190. /* Echo response callback prototype. Note that this is not included in the
  191. ** registration information, but is passed to L2CAP as part of the API to
  192. ** actually send an echo request. Parameters are
  193. ** Result
  194. */
  195. typedef void (tL2CA_ECHO_RSP_CB) (UINT16);
  196. /* Callback function prototype to pass broadcom specific echo response */
  197. /* to the upper layer */
  198. typedef void (tL2CA_ECHO_DATA_CB) (BD_ADDR, UINT16, UINT8 *);
  199. /* Congestion status callback protype. This callback is optional. If
  200. ** an application tries to send data when the transmit queue is full,
  201. ** the data will anyways be dropped. The parameter is:
  202. ** Local CID
  203. ** TRUE if congested, FALSE if uncongested
  204. */
  205. typedef void (tL2CA_CONGESTION_STATUS_CB) (UINT16, BOOLEAN);
  206. /* Callback prototype for number of packets completed events.
  207. ** This callback notifies the application when Number of Completed Packets
  208. ** event has been received.
  209. ** This callback is originally designed for 3DG devices.
  210. ** The parameter is:
  211. ** peer BD_ADDR
  212. */
  213. typedef void (tL2CA_NOCP_CB) (BD_ADDR);
  214. /* Transmit complete callback protype. This callback is optional. If
  215. ** set, L2CAP will call it when packets are sent or flushed. If the
  216. ** count is 0xFFFF, it means all packets are sent for that CID (eRTM
  217. ** mode only). The parameters are:
  218. ** Local CID
  219. ** Number of SDUs sent or dropped
  220. */
  221. typedef void (tL2CA_TX_COMPLETE_CB) (UINT16, UINT16);
  222. /* Define the structure that applications use to register with
  223. ** L2CAP. This structure includes callback functions. All functions
  224. ** MUST be provided, with the exception of the "connect pending"
  225. ** callback and "congestion status" callback.
  226. */
  227. typedef struct {
  228. tL2CA_CONNECT_IND_CB *pL2CA_ConnectInd_Cb;
  229. tL2CA_CONNECT_CFM_CB *pL2CA_ConnectCfm_Cb;
  230. tL2CA_CONNECT_PND_CB *pL2CA_ConnectPnd_Cb;
  231. tL2CA_CONFIG_IND_CB *pL2CA_ConfigInd_Cb;
  232. tL2CA_CONFIG_CFM_CB *pL2CA_ConfigCfm_Cb;
  233. tL2CA_DISCONNECT_IND_CB *pL2CA_DisconnectInd_Cb;
  234. tL2CA_DISCONNECT_CFM_CB *pL2CA_DisconnectCfm_Cb;
  235. tL2CA_QOS_VIOLATION_IND_CB *pL2CA_QoSViolationInd_Cb;
  236. tL2CA_DATA_IND_CB *pL2CA_DataInd_Cb;
  237. tL2CA_CONGESTION_STATUS_CB *pL2CA_CongestionStatus_Cb;
  238. tL2CA_TX_COMPLETE_CB *pL2CA_TxComplete_Cb;
  239. } tL2CAP_APPL_INFO;
  240. /* Define the structure that applications use to create or accept
  241. ** connections with enhanced retransmission mode.
  242. */
  243. typedef struct {
  244. UINT8 preferred_mode;
  245. UINT8 allowed_modes;
  246. UINT8 user_rx_pool_id;
  247. UINT8 user_tx_pool_id;
  248. UINT8 fcr_rx_pool_id;
  249. UINT8 fcr_tx_pool_id;
  250. } tL2CAP_ERTM_INFO;
  251. #define L2CA_REGISTER(a,b,c) L2CA_Register(a,(tL2CAP_APPL_INFO *)b)
  252. #define L2CA_DEREGISTER(a) L2CA_Deregister(a)
  253. #define L2CA_CONNECT_REQ(a,b,c,d) L2CA_ErtmConnectReq(a,b,c)
  254. #define L2CA_CONNECT_RSP(a,b,c,d,e,f,g) L2CA_ErtmConnectRsp(a,b,c,d,e,f)
  255. #define L2CA_CONFIG_REQ(a,b) L2CA_ConfigReq(a,b)
  256. #define L2CA_CONFIG_RSP(a,b) L2CA_ConfigRsp(a,b)
  257. #define L2CA_DISCONNECT_REQ(a) L2CA_DisconnectReq(a)
  258. #define L2CA_DISCONNECT_RSP(a) L2CA_DisconnectRsp(a)
  259. #define L2CA_DATA_WRITE(a, b) L2CA_DataWrite(a, b)
  260. /*****************************************************************************
  261. ** External Function Declarations
  262. *****************************************************************************/
  263. #ifdef __cplusplus
  264. extern "C"
  265. {
  266. #endif
  267. #if (CLASSIC_BT_INCLUDED == TRUE)
  268. /*******************************************************************************
  269. **
  270. ** Function L2CA_Register
  271. **
  272. ** Description Other layers call this function to register for L2CAP
  273. ** services.
  274. **
  275. ** Returns PSM to use or zero if error. Typically, the PSM returned
  276. ** is the same as was passed in, but for an outgoing-only
  277. ** connection to a dynamic PSM, a "virtual" PSM is returned
  278. ** and should be used in the calls to L2CA_ConnectReq() and
  279. ** BTM_SetSecurityLevel().
  280. **
  281. *******************************************************************************/
  282. extern UINT16 L2CA_Register (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
  283. /*******************************************************************************
  284. **
  285. ** Function L2CA_Deregister
  286. **
  287. ** Description Other layers call this function to deregister for L2CAP
  288. ** services.
  289. **
  290. ** Returns void
  291. **
  292. *******************************************************************************/
  293. extern void L2CA_Deregister (UINT16 psm);
  294. /*******************************************************************************
  295. **
  296. ** Function L2CA_AllocatePSM
  297. **
  298. ** Description Other layers call this function to find an unused PSM for L2CAP
  299. ** services.
  300. **
  301. ** Returns PSM to use.
  302. **
  303. *******************************************************************************/
  304. extern UINT16 L2CA_AllocatePSM(void);
  305. /*******************************************************************************
  306. **
  307. ** Function L2CA_ConnectReq
  308. **
  309. ** Description Higher layers call this function to create an L2CAP connection.
  310. ** Note that the connection is not established at this time, but
  311. ** connection establishment gets started. The callback function
  312. ** will be invoked when connection establishes or fails.
  313. **
  314. ** Returns the CID of the connection, or 0 if it failed to start
  315. **
  316. *******************************************************************************/
  317. extern UINT16 L2CA_ConnectReq (UINT16 psm, BD_ADDR p_bd_addr);
  318. /*******************************************************************************
  319. **
  320. ** Function L2CA_ConnectRsp
  321. **
  322. ** Description Higher layers call this function to accept an incoming
  323. ** L2CAP connection, for which they had gotten an connect
  324. ** indication callback.
  325. **
  326. ** Returns TRUE for success, FALSE for failure
  327. **
  328. *******************************************************************************/
  329. extern BOOLEAN L2CA_ConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
  330. UINT16 result, UINT16 status);
  331. /*******************************************************************************
  332. **
  333. ** Function L2CA_ErtmConnectReq
  334. **
  335. ** Description Higher layers call this function to create an L2CAP connection
  336. ** that needs to use Enhanced Retransmission Mode.
  337. ** Note that the connection is not established at this time, but
  338. ** connection establishment gets started. The callback function
  339. ** will be invoked when connection establishes or fails.
  340. **
  341. ** Returns the CID of the connection, or 0 if it failed to start
  342. **
  343. *******************************************************************************/
  344. extern UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr,
  345. tL2CAP_ERTM_INFO *p_ertm_info);
  346. // This function sets the callback routines for the L2CAP connection referred to by
  347. // |local_cid|. The callback routines can only be modified for outgoing connections
  348. // established by |L2CA_ConnectReq| or accepted incoming connections. |callbacks|
  349. // must not be NULL. This function returns true if the callbacks could be updated,
  350. // false if not (e.g. |local_cid| was not found).
  351. bool L2CA_SetConnectionCallbacks(uint16_t local_cid, const tL2CAP_APPL_INFO *callbacks);
  352. /*******************************************************************************
  353. **
  354. ** Function L2CA_ErtmConnectRsp
  355. **
  356. ** Description Higher layers call this function to accept an incoming
  357. ** L2CAP connection, for which they had gotten an connect
  358. ** indication callback, and for which the higher layer wants
  359. ** to use Enhanced Retransmission Mode.
  360. **
  361. ** Returns TRUE for success, FALSE for failure
  362. **
  363. *******************************************************************************/
  364. extern BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
  365. UINT16 result, UINT16 status,
  366. tL2CAP_ERTM_INFO *p_ertm_info);
  367. /*******************************************************************************
  368. **
  369. ** Function L2CA_ConfigReq
  370. **
  371. ** Description Higher layers call this function to send configuration.
  372. **
  373. ** Returns TRUE if configuration sent, else FALSE
  374. **
  375. *******************************************************************************/
  376. extern BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
  377. /*******************************************************************************
  378. **
  379. ** Function L2CA_ConfigRsp
  380. **
  381. ** Description Higher layers call this function to send a configuration
  382. ** response.
  383. **
  384. ** Returns TRUE if configuration response sent, else FALSE
  385. **
  386. *******************************************************************************/
  387. extern BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
  388. /*******************************************************************************
  389. **
  390. ** Function L2CA_DisconnectReq
  391. **
  392. ** Description Higher layers call this function to disconnect a channel.
  393. **
  394. ** Returns TRUE if disconnect sent, else FALSE
  395. **
  396. *******************************************************************************/
  397. extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
  398. /*******************************************************************************
  399. **
  400. ** Function L2CA_DisconnectRsp
  401. **
  402. ** Description Higher layers call this function to acknowledge the
  403. ** disconnection of a channel.
  404. **
  405. ** Returns void
  406. **
  407. *******************************************************************************/
  408. extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
  409. #endif ///CLASSIC_BT_INCLUDED == TRUE
  410. /*******************************************************************************
  411. **
  412. ** Function L2CA_DataWrite
  413. **
  414. ** Description Higher layers call this function to write data.
  415. **
  416. ** Returns L2CAP_DW_SUCCESS, if data accepted, else FALSE
  417. ** L2CAP_DW_CONGESTED, if data accepted and the channel is congested
  418. ** L2CAP_DW_FAILED, if error
  419. **
  420. *******************************************************************************/
  421. extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
  422. #if (CLASSIC_BT_INCLUDED == TRUE)
  423. /*******************************************************************************
  424. **
  425. ** Function L2CA_Ping
  426. **
  427. ** Description Higher layers call this function to send an echo request.
  428. **
  429. ** Returns TRUE if echo request sent, else FALSE.
  430. **
  431. *******************************************************************************/
  432. extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
  433. /*******************************************************************************
  434. **
  435. ** Function L2CA_Echo
  436. **
  437. ** Description Higher layers call this function to send an echo request
  438. ** with application-specific data.
  439. **
  440. ** Returns TRUE if echo request sent, else FALSE.
  441. **
  442. *******************************************************************************/
  443. extern BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
  444. #endif ///CLASSIC_BT_INCLUDED == TRUE
  445. // Given a local channel identifier, |lcid|, this function returns the bound remote
  446. // channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
  447. // known or is invalid, this function returns false and does not modify the values
  448. // pointed at by |rcid| and |handle|. |rcid| and |handle| may be NULL.
  449. bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle);
  450. /*******************************************************************************
  451. **
  452. ** Function L2CA_SetIdleTimeout
  453. **
  454. ** Description Higher layers call this function to set the idle timeout for
  455. ** a connection, or for all future connections. The "idle timeout"
  456. ** is the amount of time that a connection can remain up with
  457. ** no L2CAP channels on it. A timeout of zero means that the
  458. ** connection will be torn down immediately when the last channel
  459. ** is removed. A timeout of 0xFFFF means no timeout. Values are
  460. ** in seconds.
  461. **
  462. ** Returns TRUE if command succeeded, FALSE if failed
  463. **
  464. *******************************************************************************/
  465. extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
  466. BOOLEAN is_global);
  467. /*******************************************************************************
  468. **
  469. ** Function L2CA_SetIdleTimeoutByBdAddr
  470. **
  471. ** Description Higher layers call this function to set the idle timeout for
  472. ** a connection. The "idle timeout" is the amount of time that
  473. ** a connection can remain up with no L2CAP channels on it.
  474. ** A timeout of zero means that the connection will be torn
  475. ** down immediately when the last channel is removed.
  476. ** A timeout of 0xFFFF means no timeout. Values are in seconds.
  477. ** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
  478. ** then the idle timeouts for all active l2cap links will be
  479. ** changed.
  480. **
  481. ** Returns TRUE if command succeeded, FALSE if failed
  482. **
  483. ** NOTE This timeout applies to all logical channels active on the
  484. ** ACL link.
  485. *******************************************************************************/
  486. extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
  487. tBT_TRANSPORT transport);
  488. /*******************************************************************************
  489. **
  490. ** Function L2CA_SetTraceLevel
  491. **
  492. ** Description This function sets the trace level for L2CAP. If called with
  493. ** a value of 0xFF, it simply reads the current trace level.
  494. **
  495. ** Returns the new (current) trace level
  496. **
  497. *******************************************************************************/
  498. extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
  499. /*******************************************************************************
  500. **
  501. ** Function L2CA_SetDesireRole
  502. **
  503. ** Description This function sets the desire role for L2CAP.
  504. ** If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
  505. ** HciCreateConnection.
  506. ** If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
  507. ** HciCreateConnection.
  508. **
  509. ** If the new role is a valid role (HCI_ROLE_MASTER or HCI_ROLE_SLAVE),
  510. ** the desire role is set to the new value. Otherwise, it is not changed.
  511. **
  512. ** Returns the new (current) role
  513. **
  514. *******************************************************************************/
  515. extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
  516. #if (CLASSIC_BT_INCLUDED == TRUE)
  517. /*******************************************************************************
  518. **
  519. ** Function L2CA_LocalLoopbackReq
  520. **
  521. ** Description This function sets up a CID for local loopback
  522. **
  523. ** Returns CID of 0 if none.
  524. **
  525. *******************************************************************************/
  526. extern UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr);
  527. /*******************************************************************************
  528. **
  529. ** Function L2CA_FlushChannel
  530. **
  531. ** Description This function flushes none, some or all buffers queued up
  532. ** for xmission for a particular CID. If called with
  533. ** L2CAP_FLUSH_CHANS_GET (0), it simply returns the number
  534. ** of buffers queued for that CID L2CAP_FLUSH_CHANS_ALL (0xffff)
  535. ** flushes all buffers. All other values specifies the maximum
  536. ** buffers to flush.
  537. **
  538. ** Returns Number of buffers left queued for that CID
  539. **
  540. *******************************************************************************/
  541. extern UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush);
  542. /*******************************************************************************
  543. **
  544. ** Function L2CA_SetAclPriority
  545. **
  546. ** Description Sets the transmission priority for an ACL channel.
  547. ** (For initial implementation only two values are valid.
  548. ** L2CAP_PRIORITY_NORMAL and L2CAP_PRIORITY_HIGH).
  549. **
  550. ** Returns TRUE if a valid channel, else FALSE
  551. **
  552. *******************************************************************************/
  553. extern BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority);
  554. /*******************************************************************************
  555. **
  556. ** Function L2CA_FlowControl
  557. **
  558. ** Description Higher layers call this function to flow control a channel.
  559. **
  560. ** data_enabled - TRUE data flows, FALSE data is stopped
  561. **
  562. ** Returns TRUE if valid channel, else FALSE
  563. **
  564. *******************************************************************************/
  565. extern BOOLEAN L2CA_FlowControl (UINT16 cid, BOOLEAN data_enabled);
  566. /*******************************************************************************
  567. **
  568. ** Function L2CA_SendTestSFrame
  569. **
  570. ** Description Higher layers call this function to send a test S-frame.
  571. **
  572. ** Returns TRUE if valid Channel, else FALSE
  573. **
  574. *******************************************************************************/
  575. extern BOOLEAN L2CA_SendTestSFrame (UINT16 cid, UINT8 sup_type,
  576. UINT8 back_track);
  577. /*******************************************************************************
  578. **
  579. ** Function L2CA_SetTxPriority
  580. **
  581. ** Description Sets the transmission priority for a channel. (FCR Mode)
  582. **
  583. ** Returns TRUE if a valid channel, else FALSE
  584. **
  585. *******************************************************************************/
  586. extern BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority);
  587. /*******************************************************************************
  588. **
  589. ** Function L2CA_RegForNoCPEvt
  590. **
  591. ** Description Register callback for Number of Completed Packets event.
  592. **
  593. ** Input Param p_cb - callback for Number of completed packets event
  594. ** p_bda - BT address of remote device
  595. **
  596. ** Returns
  597. **
  598. *******************************************************************************/
  599. extern BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda);
  600. /*******************************************************************************
  601. **
  602. ** Function L2CA_SetChnlDataRate
  603. **
  604. ** Description Sets the tx/rx data rate for a channel.
  605. **
  606. ** Returns TRUE if a valid channel, else FALSE
  607. **
  608. *******************************************************************************/
  609. extern BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx);
  610. typedef void (tL2CA_RESERVE_CMPL_CBACK) (void);
  611. /*******************************************************************************
  612. **
  613. ** Function L2CA_SetFlushTimeout
  614. **
  615. ** Description This function set the automatic flush time out in Baseband
  616. ** for ACL-U packets.
  617. ** BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY
  618. ** then the flush time out will be applied to all ACL link.
  619. ** FlushTimeout: flush time out in ms
  620. ** 0x0000 : No automatic flush
  621. ** L2CAP_NO_RETRANSMISSION : No retransmission
  622. ** 0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
  623. ** <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
  624. ** Otherwise, return FALSE.
  625. ** L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
  626. **
  627. ** Returns TRUE if command succeeded, FALSE if failed
  628. **
  629. ** NOTE This flush timeout applies to all logical channels active on the
  630. ** ACL link.
  631. *******************************************************************************/
  632. extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
  633. #endif ///CLASSIC_BT_INCLUDED == TRUE
  634. /*******************************************************************************
  635. **
  636. ** Function L2CA_DataWriteEx
  637. **
  638. ** Description Higher layers call this function to write data with extended
  639. ** flags.
  640. ** flags : L2CAP_FLUSHABLE_CH_BASED
  641. ** L2CAP_FLUSHABLE_PKT
  642. ** L2CAP_NON_FLUSHABLE_PKT
  643. **
  644. ** Returns L2CAP_DW_SUCCESS, if data accepted, else FALSE
  645. ** L2CAP_DW_CONGESTED, if data accepted and the channel is congested
  646. ** L2CAP_DW_FAILED, if error
  647. **
  648. *******************************************************************************/
  649. extern UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags);
  650. /*******************************************************************************
  651. **
  652. ** Function L2CA_SetChnlFlushability
  653. **
  654. ** Description Higher layers call this function to set a channels
  655. ** flushability flags
  656. **
  657. ** Returns TRUE if CID found, else FALSE
  658. **
  659. *******************************************************************************/
  660. extern BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable);
  661. /*******************************************************************************
  662. **
  663. ** Function L2CA_GetPeerFeatures
  664. **
  665. ** Description Get a peers features and fixed channel map
  666. **
  667. ** Parameters: BD address of the peer
  668. ** Pointers to features and channel mask storage area
  669. **
  670. ** Return value: TRUE if peer is connected
  671. **
  672. *******************************************************************************/
  673. extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl_mask);
  674. /*******************************************************************************
  675. **
  676. ** Function L2CA_GetBDAddrbyHandle
  677. **
  678. ** Description Get BD address for the given HCI handle
  679. **
  680. ** Parameters: HCI handle
  681. ** BD address of the peer
  682. **
  683. ** Return value: TRUE if found lcb for the given handle, FALSE otherwise
  684. **
  685. *******************************************************************************/
  686. extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
  687. #if (CLASSIC_BT_INCLUDED == TRUE)
  688. /*******************************************************************************
  689. **
  690. ** Function L2CA_GetChnlFcrMode
  691. **
  692. ** Description Get the channel FCR mode
  693. **
  694. ** Parameters: Local CID
  695. **
  696. ** Return value: Channel mode
  697. **
  698. *******************************************************************************/
  699. extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
  700. #endif ///CLASSIC_BT_INCLUDED == TRUE
  701. /*******************************************************************************
  702. **
  703. ** UCD callback prototypes
  704. **
  705. *******************************************************************************/
  706. /* UCD discovery. Parameters are
  707. ** BD Address of remote
  708. ** Data Type
  709. ** Data
  710. */
  711. #define L2CAP_UCD_INFO_TYPE_RECEPTION 0x01
  712. #define L2CAP_UCD_INFO_TYPE_MTU 0x02
  713. typedef void (tL2CA_UCD_DISCOVER_CB) (BD_ADDR, UINT8, UINT32);
  714. /* UCD data received. Parameters are
  715. ** BD Address of remote
  716. ** Pointer to buffer with data
  717. */
  718. typedef void (tL2CA_UCD_DATA_CB) (BD_ADDR, BT_HDR *);
  719. /* Congestion status callback protype. This callback is optional. If
  720. ** an application tries to send data when the transmit queue is full,
  721. ** the data will anyways be dropped. The parameter is:
  722. ** remote BD_ADDR
  723. ** TRUE if congested, FALSE if uncongested
  724. */
  725. typedef void (tL2CA_UCD_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
  726. /* UCD registration info (the callback addresses and PSM)
  727. */
  728. typedef struct {
  729. tL2CA_UCD_DISCOVER_CB *pL2CA_UCD_Discover_Cb;
  730. tL2CA_UCD_DATA_CB *pL2CA_UCD_Data_Cb;
  731. tL2CA_UCD_CONGESTION_STATUS_CB *pL2CA_UCD_Congestion_Status_Cb;
  732. } tL2CAP_UCD_CB_INFO;
  733. /*******************************************************************************
  734. **
  735. ** Function L2CA_UcdRegister
  736. **
  737. ** Description Register PSM on UCD.
  738. **
  739. ** Parameters: tL2CAP_UCD_CB_INFO
  740. **
  741. ** Return value: TRUE if successs
  742. **
  743. *******************************************************************************/
  744. extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
  745. /*******************************************************************************
  746. **
  747. ** Function L2CA_UcdDeregister
  748. **
  749. ** Description Deregister PSM on UCD.
  750. **
  751. ** Parameters: PSM
  752. **
  753. ** Return value: TRUE if successs
  754. **
  755. *******************************************************************************/
  756. extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
  757. /*******************************************************************************
  758. **
  759. ** Function L2CA_UcdDiscover
  760. **
  761. ** Description Discover UCD of remote device.
  762. **
  763. ** Parameters: PSM
  764. ** BD_ADDR of remote device
  765. ** info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
  766. ** L2CAP_UCD_INFO_TYPE_MTU
  767. **
  768. **
  769. ** Return value: TRUE if successs
  770. **
  771. *******************************************************************************/
  772. extern BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type );
  773. /*******************************************************************************
  774. **
  775. ** Function L2CA_UcdDataWrite
  776. **
  777. ** Description Send UCD to remote device
  778. **
  779. ** Parameters: PSM
  780. ** BD Address of remote
  781. ** Pointer to buffer of type BT_HDR
  782. ** flags : L2CAP_FLUSHABLE_CH_BASED
  783. ** L2CAP_FLUSHABLE_PKT
  784. ** L2CAP_NON_FLUSHABLE_PKT
  785. **
  786. ** Return value L2CAP_DW_SUCCESS, if data accepted
  787. ** L2CAP_DW_FAILED, if error
  788. **
  789. *******************************************************************************/
  790. extern UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags);
  791. /*******************************************************************************
  792. **
  793. ** Function L2CA_UcdSetIdleTimeout
  794. **
  795. ** Description Set UCD Idle timeout.
  796. **
  797. ** Parameters: BD Addr
  798. ** Timeout in second
  799. **
  800. ** Return value: TRUE if successs
  801. **
  802. *******************************************************************************/
  803. extern BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout );
  804. /*******************************************************************************
  805. **
  806. ** Function L2CA_UCDSetTxPriority
  807. **
  808. ** Description Sets the transmission priority for a connectionless channel.
  809. **
  810. ** Returns TRUE if a valid channel, else FALSE
  811. **
  812. *******************************************************************************/
  813. extern BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority );
  814. /*******************************************************************************
  815. **
  816. ** Fixed Channel callback prototypes
  817. **
  818. *******************************************************************************/
  819. /* Fixed channel connected and disconnected. Parameters are
  820. ** channel
  821. ** BD Address of remote
  822. ** TRUE if channel is connected, FALSE if disconnected
  823. ** Reason for connection failure
  824. ** transport : physical transport, BR/EDR or LE
  825. */
  826. typedef void (tL2CA_FIXED_CHNL_CB) (UINT16, BD_ADDR, BOOLEAN, UINT16, tBT_TRANSPORT);
  827. /* Signalling data received. Parameters are
  828. ** channel
  829. ** BD Address of remote
  830. ** Pointer to buffer with data
  831. */
  832. typedef void (tL2CA_FIXED_DATA_CB) (UINT16, BD_ADDR, BT_HDR *);
  833. /* Congestion status callback protype. This callback is optional. If
  834. ** an application tries to send data when the transmit queue is full,
  835. ** the data will anyways be dropped. The parameter is:
  836. ** remote BD_ADDR
  837. ** TRUE if congested, FALSE if uncongested
  838. */
  839. typedef void (tL2CA_FIXED_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
  840. /* Fixed channel registration info (the callback addresses and channel config)
  841. */
  842. typedef struct {
  843. tL2CA_FIXED_CHNL_CB *pL2CA_FixedConn_Cb;
  844. tL2CA_FIXED_DATA_CB *pL2CA_FixedData_Cb;
  845. tL2CA_FIXED_CONGESTION_STATUS_CB *pL2CA_FixedCong_Cb;
  846. tL2CAP_FCR_OPTS fixed_chnl_opts;
  847. UINT16 default_idle_tout;
  848. tL2CA_TX_COMPLETE_CB *pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
  849. } tL2CAP_FIXED_CHNL_REG;
  850. #if (L2CAP_NUM_FIXED_CHNLS > 0)
  851. /*******************************************************************************
  852. **
  853. ** Function L2CA_RegisterFixedChannel
  854. **
  855. ** Description Register a fixed channel.
  856. **
  857. ** Parameters: Fixed Channel #
  858. ** Channel Callbacks and config
  859. **
  860. ** Return value: TRUE if registered OK
  861. **
  862. *******************************************************************************/
  863. extern BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg);
  864. /*******************************************************************************
  865. **
  866. ** Function L2CA_ConnectFixedChnl
  867. **
  868. ** Description Connect an fixed signalling channel to a remote device.
  869. **
  870. ** Parameters: Fixed CID
  871. ** BD Address of remote
  872. **
  873. ** Return value: TRUE if connection started
  874. **
  875. *******************************************************************************/
  876. extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr);
  877. /*******************************************************************************
  878. **
  879. ** Function L2CA_SendFixedChnlData
  880. **
  881. ** Description Write data on a fixed signalling channel.
  882. **
  883. ** Parameters: Fixed CID
  884. ** BD Address of remote
  885. ** Pointer to buffer of type BT_HDR
  886. **
  887. ** Return value L2CAP_DW_SUCCESS, if data accepted
  888. ** L2CAP_DW_FAILED, if error
  889. **
  890. *******************************************************************************/
  891. extern UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf);
  892. /*******************************************************************************
  893. **
  894. ** Function L2CA_RemoveFixedChnl
  895. **
  896. ** Description Remove a fixed channel to a remote device.
  897. **
  898. ** Parameters: Fixed CID
  899. ** BD Address of remote
  900. ** Idle timeout to use (or 0xFFFF if don't care)
  901. **
  902. ** Return value: TRUE if channel removed
  903. **
  904. *******************************************************************************/
  905. extern BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda);
  906. /*******************************************************************************
  907. **
  908. ** Function L2CA_SetFixedChannelTout
  909. **
  910. ** Description Higher layers call this function to set the idle timeout for
  911. ** a fixed channel. The "idle timeout" is the amount of time that
  912. ** a connection can remain up with no L2CAP channels on it.
  913. ** A timeout of zero means that the connection will be torn
  914. ** down immediately when the last channel is removed.
  915. ** A timeout of 0xFFFF means no timeout. Values are in seconds.
  916. ** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
  917. ** then the idle timeouts for all active l2cap links will be
  918. ** changed.
  919. **
  920. ** Returns TRUE if command succeeded, FALSE if failed
  921. **
  922. *******************************************************************************/
  923. extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle_tout);
  924. #endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
  925. #if (CLASSIC_BT_INCLUDED == TRUE)
  926. /*******************************************************************************
  927. **
  928. ** Function L2CA_GetCurrentConfig
  929. **
  930. ** Description This function returns configurations of L2CAP channel
  931. ** pp_our_cfg : pointer of our saved configuration options
  932. ** p_our_cfg_bits : valid config in bitmap
  933. ** pp_peer_cfg: pointer of peer's saved configuration options
  934. ** p_peer_cfg_bits : valid config in bitmap
  935. **
  936. ** Returns TRUE if successful
  937. **
  938. *******************************************************************************/
  939. extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
  940. tL2CAP_CFG_INFO **pp_our_cfg, tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
  941. tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits);
  942. #endif ///CLASSIC_BT_INCLUDED == TRUE
  943. #if (BLE_INCLUDED == TRUE)
  944. /*******************************************************************************
  945. **
  946. ** Function L2CA_CancelBleConnectReq
  947. **
  948. ** Description Cancel a pending connection attempt to a BLE device.
  949. **
  950. ** Parameters: BD Address of remote
  951. **
  952. ** Return value: TRUE if connection was cancelled
  953. **
  954. *******************************************************************************/
  955. extern BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda);
  956. /*******************************************************************************
  957. **
  958. ** Function L2CA_UpdateBleConnParams
  959. **
  960. ** Description Update BLE connection parameters.
  961. **
  962. ** Parameters: BD Address of remote
  963. **
  964. ** Return value: TRUE if update started
  965. **
  966. *******************************************************************************/
  967. extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int,
  968. UINT16 max_int, UINT16 latency, UINT16 timeout);
  969. /*******************************************************************************
  970. **
  971. ** Function L2CA_EnableUpdateBleConnParams
  972. **
  973. ** Description Update BLE connection parameters.
  974. **
  975. ** Parameters: BD Address of remote
  976. ** enable flag
  977. **
  978. ** Return value: TRUE if update started
  979. **
  980. *******************************************************************************/
  981. extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
  982. /*******************************************************************************
  983. **
  984. ** Function L2CA_GetBleConnRole
  985. **
  986. ** Description This function returns the connection role.
  987. **
  988. ** Returns link role.
  989. **
  990. *******************************************************************************/
  991. extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
  992. /*******************************************************************************
  993. **
  994. ** Function L2CA_GetDisconnectReason
  995. **
  996. ** Description This function returns the disconnect reason code.
  997. **
  998. ** Parameters: BD Address of remote
  999. ** Physical transport for the L2CAP connection (BR/EDR or LE)
  1000. **
  1001. ** Returns disconnect reason
  1002. **
  1003. *******************************************************************************/
  1004. extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport);
  1005. #endif /* (BLE_INCLUDED == TRUE) */
  1006. #ifdef __cplusplus
  1007. }
  1008. #endif
  1009. #endif /* L2C_API_H */