l2c_api.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  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. /*******************************************************************************
  268. **
  269. ** Function L2CA_Register
  270. **
  271. ** Description Other layers call this function to register for L2CAP
  272. ** services.
  273. **
  274. ** Returns PSM to use or zero if error. Typically, the PSM returned
  275. ** is the same as was passed in, but for an outgoing-only
  276. ** connection to a dynamic PSM, a "virtual" PSM is returned
  277. ** and should be used in the calls to L2CA_ConnectReq() and
  278. ** BTM_SetSecurityLevel().
  279. **
  280. *******************************************************************************/
  281. extern UINT16 L2CA_Register (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
  282. /*******************************************************************************
  283. **
  284. ** Function L2CA_Deregister
  285. **
  286. ** Description Other layers call this function to deregister for L2CAP
  287. ** services.
  288. **
  289. ** Returns void
  290. **
  291. *******************************************************************************/
  292. extern void L2CA_Deregister (UINT16 psm);
  293. /*******************************************************************************
  294. **
  295. ** Function L2CA_AllocatePSM
  296. **
  297. ** Description Other layers call this function to find an unused PSM for L2CAP
  298. ** services.
  299. **
  300. ** Returns PSM to use.
  301. **
  302. *******************************************************************************/
  303. extern UINT16 L2CA_AllocatePSM(void);
  304. /*******************************************************************************
  305. **
  306. ** Function L2CA_ConnectReq
  307. **
  308. ** Description Higher layers call this function to create an L2CAP connection.
  309. ** Note that the connection is not established at this time, but
  310. ** connection establishment gets started. The callback function
  311. ** will be invoked when connection establishes or fails.
  312. **
  313. ** Returns the CID of the connection, or 0 if it failed to start
  314. **
  315. *******************************************************************************/
  316. extern UINT16 L2CA_ConnectReq (UINT16 psm, BD_ADDR p_bd_addr);
  317. /*******************************************************************************
  318. **
  319. ** Function L2CA_ConnectRsp
  320. **
  321. ** Description Higher layers call this function to accept an incoming
  322. ** L2CAP connection, for which they had gotten an connect
  323. ** indication callback.
  324. **
  325. ** Returns TRUE for success, FALSE for failure
  326. **
  327. *******************************************************************************/
  328. extern BOOLEAN L2CA_ConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
  329. UINT16 result, UINT16 status);
  330. /*******************************************************************************
  331. **
  332. ** Function L2CA_ErtmConnectReq
  333. **
  334. ** Description Higher layers call this function to create an L2CAP connection
  335. ** that needs to use Enhanced Retransmission Mode.
  336. ** Note that the connection is not established at this time, but
  337. ** connection establishment gets started. The callback function
  338. ** will be invoked when connection establishes or fails.
  339. **
  340. ** Returns the CID of the connection, or 0 if it failed to start
  341. **
  342. *******************************************************************************/
  343. extern UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr,
  344. tL2CAP_ERTM_INFO *p_ertm_info);
  345. // This function sets the callback routines for the L2CAP connection referred to by
  346. // |local_cid|. The callback routines can only be modified for outgoing connections
  347. // established by |L2CA_ConnectReq| or accepted incoming connections. |callbacks|
  348. // must not be NULL. This function returns true if the callbacks could be updated,
  349. // false if not (e.g. |local_cid| was not found).
  350. bool L2CA_SetConnectionCallbacks(uint16_t local_cid, const tL2CAP_APPL_INFO *callbacks);
  351. /*******************************************************************************
  352. **
  353. ** Function L2CA_ErtmConnectRsp
  354. **
  355. ** Description Higher layers call this function to accept an incoming
  356. ** L2CAP connection, for which they had gotten an connect
  357. ** indication callback, and for which the higher layer wants
  358. ** to use Enhanced Retransmission Mode.
  359. **
  360. ** Returns TRUE for success, FALSE for failure
  361. **
  362. *******************************************************************************/
  363. extern BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
  364. UINT16 result, UINT16 status,
  365. tL2CAP_ERTM_INFO *p_ertm_info);
  366. /*******************************************************************************
  367. **
  368. ** Function L2CA_ConfigReq
  369. **
  370. ** Description Higher layers call this function to send configuration.
  371. **
  372. ** Returns TRUE if configuration sent, else FALSE
  373. **
  374. *******************************************************************************/
  375. extern BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
  376. /*******************************************************************************
  377. **
  378. ** Function L2CA_ConfigRsp
  379. **
  380. ** Description Higher layers call this function to send a configuration
  381. ** response.
  382. **
  383. ** Returns TRUE if configuration response sent, else FALSE
  384. **
  385. *******************************************************************************/
  386. extern BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
  387. /*******************************************************************************
  388. **
  389. ** Function L2CA_DisconnectReq
  390. **
  391. ** Description Higher layers call this function to disconnect a channel.
  392. **
  393. ** Returns TRUE if disconnect sent, else FALSE
  394. **
  395. *******************************************************************************/
  396. extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
  397. /*******************************************************************************
  398. **
  399. ** Function L2CA_DisconnectRsp
  400. **
  401. ** Description Higher layers call this function to acknowledge the
  402. ** disconnection of a channel.
  403. **
  404. ** Returns void
  405. **
  406. *******************************************************************************/
  407. extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
  408. /*******************************************************************************
  409. **
  410. ** Function L2CA_DataWrite
  411. **
  412. ** Description Higher layers call this function to write data.
  413. **
  414. ** Returns L2CAP_DW_SUCCESS, if data accepted, else FALSE
  415. ** L2CAP_DW_CONGESTED, if data accepted and the channel is congested
  416. ** L2CAP_DW_FAILED, if error
  417. **
  418. *******************************************************************************/
  419. extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
  420. /*******************************************************************************
  421. **
  422. ** Function L2CA_Ping
  423. **
  424. ** Description Higher layers call this function to send an echo request.
  425. **
  426. ** Returns TRUE if echo request sent, else FALSE.
  427. **
  428. *******************************************************************************/
  429. extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
  430. /*******************************************************************************
  431. **
  432. ** Function L2CA_Echo
  433. **
  434. ** Description Higher layers call this function to send an echo request
  435. ** with application-specific data.
  436. **
  437. ** Returns TRUE if echo request sent, else FALSE.
  438. **
  439. *******************************************************************************/
  440. extern BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
  441. // Given a local channel identifier, |lcid|, this function returns the bound remote
  442. // channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
  443. // known or is invalid, this function returns false and does not modify the values
  444. // pointed at by |rcid| and |handle|. |rcid| and |handle| may be NULL.
  445. bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle);
  446. /*******************************************************************************
  447. **
  448. ** Function L2CA_SetIdleTimeout
  449. **
  450. ** Description Higher layers call this function to set the idle timeout for
  451. ** a connection, or for all future connections. The "idle timeout"
  452. ** is the amount of time that a connection can remain up with
  453. ** no L2CAP channels on it. A timeout of zero means that the
  454. ** connection will be torn down immediately when the last channel
  455. ** is removed. A timeout of 0xFFFF means no timeout. Values are
  456. ** in seconds.
  457. **
  458. ** Returns TRUE if command succeeded, FALSE if failed
  459. **
  460. *******************************************************************************/
  461. extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
  462. BOOLEAN is_global);
  463. /*******************************************************************************
  464. **
  465. ** Function L2CA_SetIdleTimeoutByBdAddr
  466. **
  467. ** Description Higher layers call this function to set the idle timeout for
  468. ** a connection. The "idle timeout" is the amount of time that
  469. ** a connection can remain up with no L2CAP channels on it.
  470. ** A timeout of zero means that the connection will be torn
  471. ** down immediately when the last channel is removed.
  472. ** A timeout of 0xFFFF means no timeout. Values are in seconds.
  473. ** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
  474. ** then the idle timeouts for all active l2cap links will be
  475. ** changed.
  476. **
  477. ** Returns TRUE if command succeeded, FALSE if failed
  478. **
  479. ** NOTE This timeout applies to all logical channels active on the
  480. ** ACL link.
  481. *******************************************************************************/
  482. extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
  483. tBT_TRANSPORT transport);
  484. /*******************************************************************************
  485. **
  486. ** Function L2CA_SetTraceLevel
  487. **
  488. ** Description This function sets the trace level for L2CAP. If called with
  489. ** a value of 0xFF, it simply reads the current trace level.
  490. **
  491. ** Returns the new (current) trace level
  492. **
  493. *******************************************************************************/
  494. extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
  495. /*******************************************************************************
  496. **
  497. ** Function L2CA_SetDesireRole
  498. **
  499. ** Description This function sets the desire role for L2CAP.
  500. ** If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
  501. ** HciCreateConnection.
  502. ** If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
  503. ** HciCreateConnection.
  504. **
  505. ** If the new role is a valid role (HCI_ROLE_MASTER or HCI_ROLE_SLAVE),
  506. ** the desire role is set to the new value. Otherwise, it is not changed.
  507. **
  508. ** Returns the new (current) role
  509. **
  510. *******************************************************************************/
  511. extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
  512. /*******************************************************************************
  513. **
  514. ** Function L2CA_LocalLoopbackReq
  515. **
  516. ** Description This function sets up a CID for local loopback
  517. **
  518. ** Returns CID of 0 if none.
  519. **
  520. *******************************************************************************/
  521. extern UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr);
  522. /*******************************************************************************
  523. **
  524. ** Function L2CA_FlushChannel
  525. **
  526. ** Description This function flushes none, some or all buffers queued up
  527. ** for xmission for a particular CID. If called with
  528. ** L2CAP_FLUSH_CHANS_GET (0), it simply returns the number
  529. ** of buffers queued for that CID L2CAP_FLUSH_CHANS_ALL (0xffff)
  530. ** flushes all buffers. All other values specifies the maximum
  531. ** buffers to flush.
  532. **
  533. ** Returns Number of buffers left queued for that CID
  534. **
  535. *******************************************************************************/
  536. extern UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush);
  537. /*******************************************************************************
  538. **
  539. ** Function L2CA_SetAclPriority
  540. **
  541. ** Description Sets the transmission priority for an ACL channel.
  542. ** (For initial implementation only two values are valid.
  543. ** L2CAP_PRIORITY_NORMAL and L2CAP_PRIORITY_HIGH).
  544. **
  545. ** Returns TRUE if a valid channel, else FALSE
  546. **
  547. *******************************************************************************/
  548. extern BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority);
  549. /*******************************************************************************
  550. **
  551. ** Function L2CA_FlowControl
  552. **
  553. ** Description Higher layers call this function to flow control a channel.
  554. **
  555. ** data_enabled - TRUE data flows, FALSE data is stopped
  556. **
  557. ** Returns TRUE if valid channel, else FALSE
  558. **
  559. *******************************************************************************/
  560. extern BOOLEAN L2CA_FlowControl (UINT16 cid, BOOLEAN data_enabled);
  561. /*******************************************************************************
  562. **
  563. ** Function L2CA_SendTestSFrame
  564. **
  565. ** Description Higher layers call this function to send a test S-frame.
  566. **
  567. ** Returns TRUE if valid Channel, else FALSE
  568. **
  569. *******************************************************************************/
  570. extern BOOLEAN L2CA_SendTestSFrame (UINT16 cid, UINT8 sup_type,
  571. UINT8 back_track);
  572. /*******************************************************************************
  573. **
  574. ** Function L2CA_SetTxPriority
  575. **
  576. ** Description Sets the transmission priority for a channel. (FCR Mode)
  577. **
  578. ** Returns TRUE if a valid channel, else FALSE
  579. **
  580. *******************************************************************************/
  581. extern BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority);
  582. /*******************************************************************************
  583. **
  584. ** Function L2CA_RegForNoCPEvt
  585. **
  586. ** Description Register callback for Number of Completed Packets event.
  587. **
  588. ** Input Param p_cb - callback for Number of completed packets event
  589. ** p_bda - BT address of remote device
  590. **
  591. ** Returns
  592. **
  593. *******************************************************************************/
  594. extern BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda);
  595. /*******************************************************************************
  596. **
  597. ** Function L2CA_SetChnlDataRate
  598. **
  599. ** Description Sets the tx/rx data rate for a channel.
  600. **
  601. ** Returns TRUE if a valid channel, else FALSE
  602. **
  603. *******************************************************************************/
  604. extern BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx);
  605. typedef void (tL2CA_RESERVE_CMPL_CBACK) (void);
  606. /*******************************************************************************
  607. **
  608. ** Function L2CA_SetFlushTimeout
  609. **
  610. ** Description This function set the automatic flush time out in Baseband
  611. ** for ACL-U packets.
  612. ** BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY
  613. ** then the flush time out will be applied to all ACL link.
  614. ** FlushTimeout: flush time out in ms
  615. ** 0x0000 : No automatic flush
  616. ** L2CAP_NO_RETRANSMISSION : No retransmission
  617. ** 0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
  618. ** <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
  619. ** Otherwise, return FALSE.
  620. ** L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
  621. **
  622. ** Returns TRUE if command succeeded, FALSE if failed
  623. **
  624. ** NOTE This flush timeout applies to all logical channels active on the
  625. ** ACL link.
  626. *******************************************************************************/
  627. extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
  628. /*******************************************************************************
  629. **
  630. ** Function L2CA_DataWriteEx
  631. **
  632. ** Description Higher layers call this function to write data with extended
  633. ** flags.
  634. ** flags : L2CAP_FLUSHABLE_CH_BASED
  635. ** L2CAP_FLUSHABLE_PKT
  636. ** L2CAP_NON_FLUSHABLE_PKT
  637. **
  638. ** Returns L2CAP_DW_SUCCESS, if data accepted, else FALSE
  639. ** L2CAP_DW_CONGESTED, if data accepted and the channel is congested
  640. ** L2CAP_DW_FAILED, if error
  641. **
  642. *******************************************************************************/
  643. extern UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags);
  644. /*******************************************************************************
  645. **
  646. ** Function L2CA_SetChnlFlushability
  647. **
  648. ** Description Higher layers call this function to set a channels
  649. ** flushability flags
  650. **
  651. ** Returns TRUE if CID found, else FALSE
  652. **
  653. *******************************************************************************/
  654. extern BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable);
  655. /*******************************************************************************
  656. **
  657. ** Function L2CA_GetPeerFeatures
  658. **
  659. ** Description Get a peers features and fixed channel map
  660. **
  661. ** Parameters: BD address of the peer
  662. ** Pointers to features and channel mask storage area
  663. **
  664. ** Return value: TRUE if peer is connected
  665. **
  666. *******************************************************************************/
  667. extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl_mask);
  668. /*******************************************************************************
  669. **
  670. ** Function L2CA_GetBDAddrbyHandle
  671. **
  672. ** Description Get BD address for the given HCI handle
  673. **
  674. ** Parameters: HCI handle
  675. ** BD address of the peer
  676. **
  677. ** Return value: TRUE if found lcb for the given handle, FALSE otherwise
  678. **
  679. *******************************************************************************/
  680. extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
  681. /*******************************************************************************
  682. **
  683. ** Function L2CA_GetChnlFcrMode
  684. **
  685. ** Description Get the channel FCR mode
  686. **
  687. ** Parameters: Local CID
  688. **
  689. ** Return value: Channel mode
  690. **
  691. *******************************************************************************/
  692. extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
  693. /*******************************************************************************
  694. **
  695. ** UCD callback prototypes
  696. **
  697. *******************************************************************************/
  698. /* UCD discovery. Parameters are
  699. ** BD Address of remote
  700. ** Data Type
  701. ** Data
  702. */
  703. #define L2CAP_UCD_INFO_TYPE_RECEPTION 0x01
  704. #define L2CAP_UCD_INFO_TYPE_MTU 0x02
  705. typedef void (tL2CA_UCD_DISCOVER_CB) (BD_ADDR, UINT8, UINT32);
  706. /* UCD data received. Parameters are
  707. ** BD Address of remote
  708. ** Pointer to buffer with data
  709. */
  710. typedef void (tL2CA_UCD_DATA_CB) (BD_ADDR, BT_HDR *);
  711. /* Congestion status callback protype. This callback is optional. If
  712. ** an application tries to send data when the transmit queue is full,
  713. ** the data will anyways be dropped. The parameter is:
  714. ** remote BD_ADDR
  715. ** TRUE if congested, FALSE if uncongested
  716. */
  717. typedef void (tL2CA_UCD_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
  718. /* UCD registration info (the callback addresses and PSM)
  719. */
  720. typedef struct {
  721. tL2CA_UCD_DISCOVER_CB *pL2CA_UCD_Discover_Cb;
  722. tL2CA_UCD_DATA_CB *pL2CA_UCD_Data_Cb;
  723. tL2CA_UCD_CONGESTION_STATUS_CB *pL2CA_UCD_Congestion_Status_Cb;
  724. } tL2CAP_UCD_CB_INFO;
  725. /*******************************************************************************
  726. **
  727. ** Function L2CA_UcdRegister
  728. **
  729. ** Description Register PSM on UCD.
  730. **
  731. ** Parameters: tL2CAP_UCD_CB_INFO
  732. **
  733. ** Return value: TRUE if successs
  734. **
  735. *******************************************************************************/
  736. extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
  737. /*******************************************************************************
  738. **
  739. ** Function L2CA_UcdDeregister
  740. **
  741. ** Description Deregister PSM on UCD.
  742. **
  743. ** Parameters: PSM
  744. **
  745. ** Return value: TRUE if successs
  746. **
  747. *******************************************************************************/
  748. extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
  749. /*******************************************************************************
  750. **
  751. ** Function L2CA_UcdDiscover
  752. **
  753. ** Description Discover UCD of remote device.
  754. **
  755. ** Parameters: PSM
  756. ** BD_ADDR of remote device
  757. ** info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
  758. ** L2CAP_UCD_INFO_TYPE_MTU
  759. **
  760. **
  761. ** Return value: TRUE if successs
  762. **
  763. *******************************************************************************/
  764. extern BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type );
  765. /*******************************************************************************
  766. **
  767. ** Function L2CA_UcdDataWrite
  768. **
  769. ** Description Send UCD to remote device
  770. **
  771. ** Parameters: PSM
  772. ** BD Address of remote
  773. ** Pointer to buffer of type BT_HDR
  774. ** flags : L2CAP_FLUSHABLE_CH_BASED
  775. ** L2CAP_FLUSHABLE_PKT
  776. ** L2CAP_NON_FLUSHABLE_PKT
  777. **
  778. ** Return value L2CAP_DW_SUCCESS, if data accepted
  779. ** L2CAP_DW_FAILED, if error
  780. **
  781. *******************************************************************************/
  782. extern UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags);
  783. /*******************************************************************************
  784. **
  785. ** Function L2CA_UcdSetIdleTimeout
  786. **
  787. ** Description Set UCD Idle timeout.
  788. **
  789. ** Parameters: BD Addr
  790. ** Timeout in second
  791. **
  792. ** Return value: TRUE if successs
  793. **
  794. *******************************************************************************/
  795. extern BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout );
  796. /*******************************************************************************
  797. **
  798. ** Function L2CA_UCDSetTxPriority
  799. **
  800. ** Description Sets the transmission priority for a connectionless channel.
  801. **
  802. ** Returns TRUE if a valid channel, else FALSE
  803. **
  804. *******************************************************************************/
  805. extern BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority );
  806. /*******************************************************************************
  807. **
  808. ** Fixed Channel callback prototypes
  809. **
  810. *******************************************************************************/
  811. /* Fixed channel connected and disconnected. Parameters are
  812. ** channel
  813. ** BD Address of remote
  814. ** TRUE if channel is connected, FALSE if disconnected
  815. ** Reason for connection failure
  816. ** transport : physical transport, BR/EDR or LE
  817. */
  818. typedef void (tL2CA_FIXED_CHNL_CB) (UINT16, BD_ADDR, BOOLEAN, UINT16, tBT_TRANSPORT);
  819. /* Signalling data received. Parameters are
  820. ** channel
  821. ** BD Address of remote
  822. ** Pointer to buffer with data
  823. */
  824. typedef void (tL2CA_FIXED_DATA_CB) (UINT16, BD_ADDR, BT_HDR *);
  825. /* Congestion status callback protype. This callback is optional. If
  826. ** an application tries to send data when the transmit queue is full,
  827. ** the data will anyways be dropped. The parameter is:
  828. ** remote BD_ADDR
  829. ** TRUE if congested, FALSE if uncongested
  830. */
  831. typedef void (tL2CA_FIXED_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
  832. /* Fixed channel registration info (the callback addresses and channel config)
  833. */
  834. typedef struct {
  835. tL2CA_FIXED_CHNL_CB *pL2CA_FixedConn_Cb;
  836. tL2CA_FIXED_DATA_CB *pL2CA_FixedData_Cb;
  837. tL2CA_FIXED_CONGESTION_STATUS_CB *pL2CA_FixedCong_Cb;
  838. tL2CAP_FCR_OPTS fixed_chnl_opts;
  839. UINT16 default_idle_tout;
  840. tL2CA_TX_COMPLETE_CB *pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
  841. } tL2CAP_FIXED_CHNL_REG;
  842. #if (L2CAP_NUM_FIXED_CHNLS > 0)
  843. /*******************************************************************************
  844. **
  845. ** Function L2CA_RegisterFixedChannel
  846. **
  847. ** Description Register a fixed channel.
  848. **
  849. ** Parameters: Fixed Channel #
  850. ** Channel Callbacks and config
  851. **
  852. ** Return value: TRUE if registered OK
  853. **
  854. *******************************************************************************/
  855. extern BOOLEAN L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg);
  856. /*******************************************************************************
  857. **
  858. ** Function L2CA_ConnectFixedChnl
  859. **
  860. ** Description Connect an fixed signalling channel to a remote device.
  861. **
  862. ** Parameters: Fixed CID
  863. ** BD Address of remote
  864. **
  865. ** Return value: TRUE if connection started
  866. **
  867. *******************************************************************************/
  868. extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr);
  869. /*******************************************************************************
  870. **
  871. ** Function L2CA_SendFixedChnlData
  872. **
  873. ** Description Write data on a fixed signalling channel.
  874. **
  875. ** Parameters: Fixed CID
  876. ** BD Address of remote
  877. ** Pointer to buffer of type BT_HDR
  878. **
  879. ** Return value L2CAP_DW_SUCCESS, if data accepted
  880. ** L2CAP_DW_FAILED, if error
  881. **
  882. *******************************************************************************/
  883. extern UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf);
  884. /*******************************************************************************
  885. **
  886. ** Function L2CA_RemoveFixedChnl
  887. **
  888. ** Description Remove a fixed channel to a remote device.
  889. **
  890. ** Parameters: Fixed CID
  891. ** BD Address of remote
  892. ** Idle timeout to use (or 0xFFFF if don't care)
  893. **
  894. ** Return value: TRUE if channel removed
  895. **
  896. *******************************************************************************/
  897. extern BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda);
  898. /*******************************************************************************
  899. **
  900. ** Function L2CA_SetFixedChannelTout
  901. **
  902. ** Description Higher layers call this function to set the idle timeout for
  903. ** a fixed channel. The "idle timeout" is the amount of time that
  904. ** a connection can remain up with no L2CAP channels on it.
  905. ** A timeout of zero means that the connection will be torn
  906. ** down immediately when the last channel is removed.
  907. ** A timeout of 0xFFFF means no timeout. Values are in seconds.
  908. ** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
  909. ** then the idle timeouts for all active l2cap links will be
  910. ** changed.
  911. **
  912. ** Returns TRUE if command succeeded, FALSE if failed
  913. **
  914. *******************************************************************************/
  915. extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle_tout);
  916. #endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
  917. /*******************************************************************************
  918. **
  919. ** Function L2CA_GetCurrentConfig
  920. **
  921. ** Description This function returns configurations of L2CAP channel
  922. ** pp_our_cfg : pointer of our saved configuration options
  923. ** p_our_cfg_bits : valid config in bitmap
  924. ** pp_peer_cfg: pointer of peer's saved configuration options
  925. ** p_peer_cfg_bits : valid config in bitmap
  926. **
  927. ** Returns TRUE if successful
  928. **
  929. *******************************************************************************/
  930. extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
  931. tL2CAP_CFG_INFO **pp_our_cfg, tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
  932. tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits);
  933. #if (BLE_INCLUDED == TRUE)
  934. /*******************************************************************************
  935. **
  936. ** Function L2CA_CancelBleConnectReq
  937. **
  938. ** Description Cancel a pending connection attempt to a BLE device.
  939. **
  940. ** Parameters: BD Address of remote
  941. **
  942. ** Return value: TRUE if connection was cancelled
  943. **
  944. *******************************************************************************/
  945. extern BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda);
  946. /*******************************************************************************
  947. **
  948. ** Function L2CA_UpdateBleConnParams
  949. **
  950. ** Description Update BLE connection parameters.
  951. **
  952. ** Parameters: BD Address of remote
  953. **
  954. ** Return value: TRUE if update started
  955. **
  956. *******************************************************************************/
  957. extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int,
  958. UINT16 max_int, UINT16 latency, UINT16 timeout);
  959. /*******************************************************************************
  960. **
  961. ** Function L2CA_EnableUpdateBleConnParams
  962. **
  963. ** Description Update BLE connection parameters.
  964. **
  965. ** Parameters: BD Address of remote
  966. ** enable flag
  967. **
  968. ** Return value: TRUE if update started
  969. **
  970. *******************************************************************************/
  971. extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
  972. /*******************************************************************************
  973. **
  974. ** Function L2CA_GetBleConnRole
  975. **
  976. ** Description This function returns the connection role.
  977. **
  978. ** Returns link role.
  979. **
  980. *******************************************************************************/
  981. extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
  982. /*******************************************************************************
  983. **
  984. ** Function L2CA_GetDisconnectReason
  985. **
  986. ** Description This function returns the disconnect reason code.
  987. **
  988. ** Parameters: BD Address of remote
  989. ** Physical transport for the L2CAP connection (BR/EDR or LE)
  990. **
  991. ** Returns disconnect reason
  992. **
  993. *******************************************************************************/
  994. extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport);
  995. #endif /* (BLE_INCLUDED == TRUE) */
  996. #ifdef __cplusplus
  997. }
  998. #endif
  999. #endif /* L2C_API_H */