gatt_api.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. /******************************************************************************
  2. *
  3. * Copyright 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. #ifndef GATT_API_H
  19. #define GATT_API_H
  20. #include "bt_target.h"
  21. #include "btm_ble_api.h"
  22. #include "gattdefs.h"
  23. /*****************************************************************************
  24. * Constants
  25. ****************************************************************************/
  26. /* Success code and error codes */
  27. #define GATT_SUCCESS 0x00
  28. #define GATT_INVALID_HANDLE 0x01
  29. #define GATT_READ_NOT_PERMIT 0x02
  30. #define GATT_WRITE_NOT_PERMIT 0x03
  31. #define GATT_INVALID_PDU 0x04
  32. #define GATT_INSUF_AUTHENTICATION 0x05
  33. #define GATT_REQ_NOT_SUPPORTED 0x06
  34. #define GATT_INVALID_OFFSET 0x07
  35. #define GATT_INSUF_AUTHORIZATION 0x08
  36. #define GATT_PREPARE_Q_FULL 0x09
  37. #define GATT_NOT_FOUND 0x0a
  38. #define GATT_NOT_LONG 0x0b
  39. #define GATT_INSUF_KEY_SIZE 0x0c
  40. #define GATT_INVALID_ATTR_LEN 0x0d
  41. #define GATT_ERR_UNLIKELY 0x0e
  42. #define GATT_INSUF_ENCRYPTION 0x0f
  43. #define GATT_UNSUPPORT_GRP_TYPE 0x10
  44. #define GATT_INSUF_RESOURCE 0x11
  45. #define GATT_ILLEGAL_PARAMETER 0x87
  46. #define GATT_NO_RESOURCES 0x80
  47. #define GATT_INTERNAL_ERROR 0x81
  48. #define GATT_WRONG_STATE 0x82
  49. #define GATT_DB_FULL 0x83
  50. #define GATT_BUSY 0x84
  51. #define GATT_ERROR 0x85
  52. #define GATT_CMD_STARTED 0x86
  53. #define GATT_PENDING 0x88
  54. #define GATT_AUTH_FAIL 0x89
  55. #define GATT_MORE 0x8a
  56. #define GATT_INVALID_CFG 0x8b
  57. #define GATT_SERVICE_STARTED 0x8c
  58. #define GATT_ENCRYPED_MITM GATT_SUCCESS
  59. #define GATT_ENCRYPED_NO_MITM 0x8d
  60. #define GATT_NOT_ENCRYPTED 0x8e
  61. #define GATT_CONGESTED 0x8f
  62. #define GATT_DUP_REG 0x90 /* 0x90 */
  63. #define GATT_ALREADY_OPEN 0x91 /* 0x91 */
  64. #define GATT_CANCEL 0x92 /* 0x92 */
  65. /* 0xE0 ~ 0xFC reserved for future use */
  66. /* Client Characteristic Configuration Descriptor Improperly Configured */
  67. #define GATT_CCC_CFG_ERR 0xFD
  68. /* Procedure Already in progress */
  69. #define GATT_PRC_IN_PROGRESS 0xFE
  70. /* Attribute value out of range */
  71. #define GATT_OUT_OF_RANGE 0xFF
  72. typedef uint8_t tGATT_STATUS;
  73. #define GATT_RSP_ERROR 0x01
  74. #define GATT_REQ_MTU 0x02
  75. #define GATT_RSP_MTU 0x03
  76. #define GATT_REQ_FIND_INFO 0x04
  77. #define GATT_RSP_FIND_INFO 0x05
  78. #define GATT_REQ_FIND_TYPE_VALUE 0x06
  79. #define GATT_RSP_FIND_TYPE_VALUE 0x07
  80. #define GATT_REQ_READ_BY_TYPE 0x08
  81. #define GATT_RSP_READ_BY_TYPE 0x09
  82. #define GATT_REQ_READ 0x0A
  83. #define GATT_RSP_READ 0x0B
  84. #define GATT_REQ_READ_BLOB 0x0C
  85. #define GATT_RSP_READ_BLOB 0x0D
  86. #define GATT_REQ_READ_MULTI 0x0E
  87. #define GATT_RSP_READ_MULTI 0x0F
  88. #define GATT_REQ_READ_BY_GRP_TYPE 0x10
  89. #define GATT_RSP_READ_BY_GRP_TYPE 0x11
  90. /* 0001-0010 (write)*/
  91. #define GATT_REQ_WRITE 0x12
  92. #define GATT_RSP_WRITE 0x13
  93. /* changed in V4.0 01001-0010(write cmd)*/
  94. #define GATT_CMD_WRITE 0x52
  95. #define GATT_REQ_PREPARE_WRITE 0x16
  96. #define GATT_RSP_PREPARE_WRITE 0x17
  97. #define GATT_REQ_EXEC_WRITE 0x18
  98. #define GATT_RSP_EXEC_WRITE 0x19
  99. #define GATT_HANDLE_VALUE_NOTIF 0x1B
  100. #define GATT_HANDLE_VALUE_IND 0x1D
  101. #define GATT_HANDLE_VALUE_CONF 0x1E
  102. /* changed in V4.0 1101-0010 (signed write) see write cmd above*/
  103. #define GATT_SIGN_CMD_WRITE 0xD2
  104. /* 0x1E = 30 + 1 = 31*/
  105. #define GATT_OP_CODE_MAX (GATT_HANDLE_VALUE_CONF + 1)
  106. #define GATT_HANDLE_IS_VALID(x) ((x) != 0)
  107. #define GATT_CONN_UNKNOWN 0
  108. /* general L2cap failure */
  109. #define GATT_CONN_L2C_FAILURE 1
  110. /* 0x08 connection timeout */
  111. #define GATT_CONN_TIMEOUT HCI_ERR_CONNECTION_TOUT
  112. /* 0x13 connection terminate by peer user */
  113. #define GATT_CONN_TERMINATE_PEER_USER HCI_ERR_PEER_USER
  114. /* 0x16 connectionterminated by local host */
  115. #define GATT_CONN_TERMINATE_LOCAL_HOST HCI_ERR_CONN_CAUSE_LOCAL_HOST
  116. /* 0x03E connection fail to establish */
  117. #define GATT_CONN_FAIL_ESTABLISH HCI_ERR_CONN_FAILED_ESTABLISHMENT
  118. /* 0x22 connection fail for LMP response tout */
  119. #define GATT_CONN_LMP_TIMEOUT HCI_ERR_LMP_RESPONSE_TIMEOUT
  120. /* 0x0100 L2CAP connection cancelled */
  121. #define GATT_CONN_CANCEL L2CAP_CONN_CANCEL
  122. typedef uint16_t tGATT_DISCONN_REASON;
  123. /* MAX GATT MTU size
  124. */
  125. #ifndef GATT_MAX_MTU_SIZE
  126. #define GATT_MAX_MTU_SIZE 517
  127. #endif
  128. /* max legth of an attribute value
  129. */
  130. #ifndef GATT_MAX_ATTR_LEN
  131. #define GATT_MAX_ATTR_LEN 600
  132. #endif
  133. /* default GATT MTU size over LE link
  134. */
  135. #define GATT_DEF_BLE_MTU_SIZE 23
  136. /* invalid connection ID
  137. */
  138. #define GATT_INVALID_CONN_ID 0xFFFF
  139. #ifndef GATT_CL_MAX_LCB
  140. #define GATT_CL_MAX_LCB 22
  141. #endif
  142. /* GATT notification caching timer, default to be three seconds
  143. */
  144. #ifndef GATTC_NOTIF_TIMEOUT
  145. #define GATTC_NOTIF_TIMEOUT 3
  146. #endif
  147. /*****************************************************************************
  148. * GATT Structure Definition
  149. ****************************************************************************/
  150. /* Attribute permissions
  151. */
  152. #define GATT_PERM_READ (1 << 0) /* bit 0 */
  153. #define GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 */
  154. #define GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 */
  155. #define GATT_PERM_WRITE (1 << 4) /* bit 4 */
  156. #define GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 */
  157. #define GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 */
  158. #define GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 */
  159. #define GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 */
  160. typedef uint16_t tGATT_PERM;
  161. /* the MS nibble of tGATT_PERM; key size 7=0; size 16=9 */
  162. #define GATT_ENCRYPT_KEY_SIZE_MASK (0xF000)
  163. #define GATT_READ_ALLOWED \
  164. (GATT_PERM_READ | GATT_PERM_READ_ENCRYPTED | GATT_PERM_READ_ENC_MITM)
  165. #define GATT_READ_AUTH_REQUIRED (GATT_PERM_READ_ENCRYPTED)
  166. #define GATT_READ_MITM_REQUIRED (GATT_PERM_READ_ENC_MITM)
  167. #define GATT_READ_ENCRYPTED_REQUIRED \
  168. (GATT_PERM_READ_ENCRYPTED | GATT_PERM_READ_ENC_MITM)
  169. #define GATT_WRITE_ALLOWED \
  170. (GATT_PERM_WRITE | GATT_PERM_WRITE_ENCRYPTED | GATT_PERM_WRITE_ENC_MITM | \
  171. GATT_PERM_WRITE_SIGNED | GATT_PERM_WRITE_SIGNED_MITM)
  172. #define GATT_WRITE_AUTH_REQUIRED \
  173. (GATT_PERM_WRITE_ENCRYPTED | GATT_PERM_WRITE_SIGNED)
  174. #define GATT_WRITE_MITM_REQUIRED \
  175. (GATT_PERM_WRITE_ENC_MITM | GATT_PERM_WRITE_SIGNED_MITM)
  176. #define GATT_WRITE_ENCRYPTED_PERM \
  177. (GATT_PERM_WRITE_ENCRYPTED | GATT_PERM_WRITE_ENC_MITM)
  178. #define GATT_WRITE_SIGNED_PERM \
  179. (GATT_PERM_WRITE_SIGNED | GATT_PERM_WRITE_SIGNED_MITM)
  180. /* Characteristic properties
  181. */
  182. #define GATT_CHAR_PROP_BIT_BROADCAST (1 << 0)
  183. #define GATT_CHAR_PROP_BIT_READ (1 << 1)
  184. #define GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2)
  185. #define GATT_CHAR_PROP_BIT_WRITE (1 << 3)
  186. #define GATT_CHAR_PROP_BIT_NOTIFY (1 << 4)
  187. #define GATT_CHAR_PROP_BIT_INDICATE (1 << 5)
  188. #define GATT_CHAR_PROP_BIT_AUTH (1 << 6)
  189. #define GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7)
  190. typedef uint8_t tGATT_CHAR_PROP;
  191. /* Format of the value of a characteristic. enumeration type
  192. */
  193. enum {
  194. GATT_FORMAT_RES, /* rfu */
  195. GATT_FORMAT_BOOL, /* 0x01 boolean */
  196. GATT_FORMAT_2BITS, /* 0x02 2 bit */
  197. GATT_FORMAT_NIBBLE, /* 0x03 nibble */
  198. GATT_FORMAT_UINT8, /* 0x04 uint8 */
  199. GATT_FORMAT_UINT12, /* 0x05 uint12 */
  200. GATT_FORMAT_UINT16, /* 0x06 uint16 */
  201. GATT_FORMAT_UINT24, /* 0x07 uint24 */
  202. GATT_FORMAT_UINT32, /* 0x08 uint32 */
  203. GATT_FORMAT_UINT48, /* 0x09 uint48 */
  204. GATT_FORMAT_UINT64, /* 0x0a uint64 */
  205. GATT_FORMAT_UINT128, /* 0x0B uint128 */
  206. GATT_FORMAT_SINT8, /* 0x0C signed 8 bit integer */
  207. GATT_FORMAT_SINT12, /* 0x0D signed 12 bit integer */
  208. GATT_FORMAT_SINT16, /* 0x0E signed 16 bit integer */
  209. GATT_FORMAT_SINT24, /* 0x0F signed 24 bit integer */
  210. GATT_FORMAT_SINT32, /* 0x10 signed 32 bit integer */
  211. GATT_FORMAT_SINT48, /* 0x11 signed 48 bit integer */
  212. GATT_FORMAT_SINT64, /* 0x12 signed 64 bit integer */
  213. GATT_FORMAT_SINT128, /* 0x13 signed 128 bit integer */
  214. GATT_FORMAT_FLOAT32, /* 0x14 float 32 */
  215. GATT_FORMAT_FLOAT64, /* 0x15 float 64*/
  216. GATT_FORMAT_SFLOAT, /* 0x16 IEEE-11073 16 bit SFLOAT */
  217. GATT_FORMAT_FLOAT, /* 0x17 IEEE-11073 32 bit SFLOAT */
  218. GATT_FORMAT_DUINT16, /* 0x18 IEEE-20601 format */
  219. GATT_FORMAT_UTF8S, /* 0x19 UTF-8 string */
  220. GATT_FORMAT_UTF16S, /* 0x1a UTF-16 string */
  221. GATT_FORMAT_STRUCT, /* 0x1b Opaque structure*/
  222. GATT_FORMAT_MAX /* 0x1c or above reserved */
  223. };
  224. typedef uint8_t tGATT_FORMAT;
  225. /* Characteristic Presentation Format Descriptor value
  226. */
  227. typedef struct {
  228. uint16_t unit; /* as UUIUD defined by SIG */
  229. uint16_t descr; /* as UUID as defined by SIG */
  230. tGATT_FORMAT format;
  231. int8_t exp;
  232. uint8_t name_spc; /* The name space of the description */
  233. } tGATT_CHAR_PRES;
  234. /* Characteristic Report reference Descriptor format
  235. */
  236. typedef struct {
  237. uint8_t rpt_id; /* report ID */
  238. uint8_t rpt_type; /* report type */
  239. } tGATT_CHAR_RPT_REF;
  240. #define GATT_VALID_RANGE_MAX_SIZE 16
  241. typedef struct {
  242. uint8_t format;
  243. uint16_t len;
  244. uint8_t lower_range[GATT_VALID_RANGE_MAX_SIZE]; /* in little endian format */
  245. uint8_t upper_range[GATT_VALID_RANGE_MAX_SIZE];
  246. } tGATT_VALID_RANGE;
  247. /* Characteristic Aggregate Format attribute value
  248. */
  249. #define GATT_AGGR_HANDLE_NUM_MAX 10
  250. typedef struct {
  251. uint8_t num_handle;
  252. uint16_t handle_list[GATT_AGGR_HANDLE_NUM_MAX];
  253. } tGATT_CHAR_AGGRE;
  254. /* Characteristic descriptor: Extended Properties value
  255. */
  256. /* permits reliable writes of the Characteristic Value */
  257. #define GATT_CHAR_BIT_REL_WRITE 0x0001
  258. /* permits writes to the characteristic descriptor */
  259. #define GATT_CHAR_BIT_WRITE_AUX 0x0002
  260. /* characteristic descriptor: client configuration value
  261. */
  262. #define GATT_CLT_CONFIG_NONE 0x0000
  263. #define GATT_CLT_CONFIG_NOTIFICATION 0x0001
  264. #define GATT_CLT_CONFIG_INDICATION 0x0002
  265. /* characteristic descriptor: server configuration value
  266. */
  267. #define GATT_SVR_CONFIG_NONE 0x0000
  268. #define GATT_SVR_CONFIG_BROADCAST 0x0001
  269. typedef uint16_t tGATT_SVR_CHAR_CONFIG;
  270. /* Characteristic descriptor: Extended Properties value
  271. */
  272. /* permits reliable writes of the Characteristic Value */
  273. #define GATT_CHAR_BIT_REL_WRITE 0x0001
  274. /* permits writes to the characteristic descriptor */
  275. #define GATT_CHAR_BIT_WRITE_AUX 0x0002
  276. /* authentication requirement
  277. */
  278. #define GATT_AUTH_REQ_NONE 0
  279. #define GATT_AUTH_REQ_NO_MITM 1 /* unauthenticated encryption */
  280. #define GATT_AUTH_REQ_MITM 2 /* authenticated encryption */
  281. #define GATT_AUTH_REQ_SIGNED_NO_MITM 3
  282. #define GATT_AUTH_REQ_SIGNED_MITM 4
  283. typedef uint8_t tGATT_AUTH_REQ;
  284. /* Attribute Value structure
  285. */
  286. typedef struct {
  287. uint16_t conn_id;
  288. uint16_t handle; /* attribute handle */
  289. uint16_t offset; /* attribute value offset, if no offfset is needed for the
  290. command, ignore it */
  291. uint16_t len; /* length of attribute value */
  292. tGATT_AUTH_REQ auth_req; /* authentication request */
  293. uint8_t value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
  294. } tGATT_VALUE;
  295. /* Union of the event data which is used in the server respond API to carry the
  296. * server response information
  297. */
  298. typedef union {
  299. /* data type member event */
  300. tGATT_VALUE attr_value; /* READ, HANDLE_VALUE_IND, PREPARE_WRITE */
  301. /* READ_BLOB, READ_BY_TYPE */
  302. uint16_t handle; /* WRITE, WRITE_BLOB */
  303. } tGATTS_RSP;
  304. /* Transports for the primary service */
  305. #define GATT_TRANSPORT_LE BT_TRANSPORT_LE
  306. #define GATT_TRANSPORT_BR_EDR BT_TRANSPORT_BR_EDR
  307. #define GATT_TRANSPORT_LE_BR_EDR (BT_TRANSPORT_LE | BT_TRANSPORT_BR_EDR)
  308. typedef uint8_t tGATT_TRANSPORT;
  309. #define GATT_PREP_WRITE_CANCEL 0x00
  310. #define GATT_PREP_WRITE_EXEC 0x01
  311. typedef uint8_t tGATT_EXEC_FLAG;
  312. /* read request always based on UUID */
  313. typedef struct {
  314. uint16_t handle;
  315. uint16_t offset;
  316. bool is_long;
  317. bt_gatt_db_attribute_type_t
  318. gatt_type; /* are we writing characteristic or descriptor */
  319. } tGATT_READ_REQ;
  320. /* write request data */
  321. typedef struct {
  322. uint16_t handle; /* attribute handle */
  323. uint16_t offset; /* attribute value offset, if no offfset is needed for the
  324. command, ignore it */
  325. uint16_t len; /* length of attribute value */
  326. uint8_t value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
  327. bool need_rsp; /* need write response */
  328. bool is_prep; /* is prepare write */
  329. bt_gatt_db_attribute_type_t
  330. gatt_type; /* are we writing characteristic or descriptor */
  331. } tGATT_WRITE_REQ;
  332. /* callback data for server access request from client */
  333. typedef union {
  334. tGATT_READ_REQ read_req; /* read request, read by Type, read blob */
  335. tGATT_WRITE_REQ write_req; /* write */
  336. /* prepare write */
  337. /* write blob */
  338. uint16_t handle; /* handle value confirmation */
  339. uint16_t mtu; /* MTU exchange request */
  340. tGATT_EXEC_FLAG exec_write; /* execute write */
  341. } tGATTS_DATA;
  342. typedef uint8_t tGATT_SERV_IF; /* GATT Service Interface */
  343. enum {
  344. GATTS_REQ_TYPE_READ_CHARACTERISTIC = 1, /* Char read request */
  345. GATTS_REQ_TYPE_READ_DESCRIPTOR, /* Desc read request */
  346. GATTS_REQ_TYPE_WRITE_CHARACTERISTIC, /* Char write request */
  347. GATTS_REQ_TYPE_WRITE_DESCRIPTOR, /* Desc write request */
  348. GATTS_REQ_TYPE_WRITE_EXEC, /* Execute write */
  349. GATTS_REQ_TYPE_MTU, /* MTU exchange information */
  350. GATTS_REQ_TYPE_CONF /* handle value confirmation */
  351. };
  352. typedef uint8_t tGATTS_REQ_TYPE;
  353. /* Client Used Data Structure
  354. */
  355. /* definition of different discovery types */
  356. enum {
  357. GATT_DISC_SRVC_ALL = 1, /* discover all services */
  358. GATT_DISC_SRVC_BY_UUID, /* discover service of a special type */
  359. GATT_DISC_INC_SRVC, /* discover the included service within a service */
  360. GATT_DISC_CHAR, /* discover characteristics of a service with/without type
  361. requirement */
  362. GATT_DISC_CHAR_DSCPT, /* discover characteristic descriptors of a character */
  363. GATT_DISC_MAX /* maximnun discover type */
  364. };
  365. typedef uint8_t tGATT_DISC_TYPE;
  366. /* GATT read type enumeration
  367. */
  368. enum {
  369. GATT_READ_BY_TYPE = 1,
  370. GATT_READ_BY_HANDLE,
  371. GATT_READ_MULTIPLE,
  372. GATT_READ_CHAR_VALUE,
  373. GATT_READ_PARTIAL,
  374. GATT_READ_MAX
  375. };
  376. typedef uint8_t tGATT_READ_TYPE;
  377. /* Read By Type Request (GATT_READ_BY_TYPE) Data
  378. */
  379. typedef struct {
  380. tGATT_AUTH_REQ auth_req;
  381. uint16_t s_handle;
  382. uint16_t e_handle;
  383. bluetooth::Uuid uuid;
  384. } tGATT_READ_BY_TYPE;
  385. /* GATT_READ_MULTIPLE request data
  386. */
  387. #define GATT_MAX_READ_MULTI_HANDLES \
  388. 10 /* Max attributes to read in one request */
  389. typedef struct {
  390. tGATT_AUTH_REQ auth_req;
  391. uint16_t num_handles; /* number of handles to read */
  392. uint16_t handles[GATT_MAX_READ_MULTI_HANDLES]; /* handles list to be read */
  393. } tGATT_READ_MULTI;
  394. /* Read By Handle Request (GATT_READ_BY_HANDLE) data */
  395. typedef struct {
  396. tGATT_AUTH_REQ auth_req;
  397. uint16_t handle;
  398. } tGATT_READ_BY_HANDLE;
  399. /* READ_BT_HANDLE_Request data */
  400. typedef struct {
  401. tGATT_AUTH_REQ auth_req;
  402. uint16_t handle;
  403. uint16_t offset;
  404. } tGATT_READ_PARTIAL;
  405. /* Read Request Data
  406. */
  407. typedef union {
  408. tGATT_READ_BY_TYPE service;
  409. tGATT_READ_BY_TYPE char_type; /* characterisitc type */
  410. tGATT_READ_MULTI read_multiple;
  411. tGATT_READ_BY_HANDLE by_handle;
  412. tGATT_READ_PARTIAL partial;
  413. } tGATT_READ_PARAM;
  414. /* GATT write type enumeration */
  415. enum { GATT_WRITE_NO_RSP = 1, GATT_WRITE, GATT_WRITE_PREPARE };
  416. typedef uint8_t tGATT_WRITE_TYPE;
  417. /* Client Operation Complete Callback Data
  418. */
  419. typedef union {
  420. tGATT_VALUE att_value;
  421. uint16_t mtu;
  422. uint16_t handle;
  423. } tGATT_CL_COMPLETE;
  424. /* GATT client operation type, used in client callback function
  425. */
  426. #define GATTC_OPTYPE_NONE 0
  427. #define GATTC_OPTYPE_DISCOVERY 1
  428. #define GATTC_OPTYPE_READ 2
  429. #define GATTC_OPTYPE_WRITE 3
  430. #define GATTC_OPTYPE_EXE_WRITE 4
  431. #define GATTC_OPTYPE_CONFIG 5
  432. #define GATTC_OPTYPE_NOTIFICATION 6
  433. #define GATTC_OPTYPE_INDICATION 7
  434. typedef uint8_t tGATTC_OPTYPE;
  435. /* characteristic declaration
  436. */
  437. typedef struct {
  438. tGATT_CHAR_PROP char_prop; /* characterisitc properties */
  439. uint16_t val_handle; /* characteristic value attribute handle */
  440. bluetooth::Uuid char_uuid; /* characteristic UUID type */
  441. } tGATT_CHAR_DCLR_VAL;
  442. /* primary service group data
  443. */
  444. typedef struct {
  445. uint16_t e_handle; /* ending handle of the group */
  446. bluetooth::Uuid service_type; /* group type */
  447. } tGATT_GROUP_VALUE;
  448. /* included service attribute value
  449. */
  450. typedef struct {
  451. bluetooth::Uuid service_type; /* included service UUID */
  452. uint16_t s_handle; /* starting handle */
  453. uint16_t e_handle; /* ending handle */
  454. } tGATT_INCL_SRVC;
  455. typedef union {
  456. tGATT_INCL_SRVC incl_service; /* include service value */
  457. tGATT_GROUP_VALUE group_value; /* Service UUID type.
  458. This field is used with GATT_DISC_SRVC_ALL
  459. or GATT_DISC_SRVC_BY_UUID
  460. type of discovery result callback. */
  461. uint16_t handle; /* When used with GATT_DISC_INC_SRVC type discovery result,
  462. it is the included service starting handle.*/
  463. tGATT_CHAR_DCLR_VAL
  464. dclr_value; /* Characteristic declaration value.
  465. This field is used with GATT_DISC_CHAR type discovery.*/
  466. } tGATT_DISC_VALUE;
  467. /* discover result record
  468. */
  469. typedef struct {
  470. bluetooth::Uuid type;
  471. uint16_t handle;
  472. tGATT_DISC_VALUE value;
  473. } tGATT_DISC_RES;
  474. #define GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP \
  475. 1 /* start a idle timer for this duration \
  476. when no application need to use the link */
  477. #define GATT_LINK_NO_IDLE_TIMEOUT 0xFFFF
  478. #define GATT_INVALID_ACL_HANDLE 0xFFFF
  479. /* discover result callback function */
  480. typedef void(tGATT_DISC_RES_CB)(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  481. tGATT_DISC_RES* p_data);
  482. /* discover complete callback function */
  483. typedef void(tGATT_DISC_CMPL_CB)(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  484. tGATT_STATUS status);
  485. /* Define a callback function for when read/write/disc/config operation is
  486. * completed. */
  487. typedef void(tGATT_CMPL_CBACK)(uint16_t conn_id, tGATTC_OPTYPE op,
  488. tGATT_STATUS status, tGATT_CL_COMPLETE* p_data);
  489. /* Define a callback function when an initialized connection is established. */
  490. typedef void(tGATT_CONN_CBACK)(tGATT_IF gatt_if, const RawAddress& bda,
  491. uint16_t conn_id, bool connected,
  492. tGATT_DISCONN_REASON reason,
  493. tBT_TRANSPORT transport);
  494. /* attribute request callback for ATT server */
  495. typedef void(tGATT_REQ_CBACK)(uint16_t conn_id, uint32_t trans_id,
  496. tGATTS_REQ_TYPE type, tGATTS_DATA* p_data);
  497. /* channel congestion/uncongestion callback */
  498. typedef void(tGATT_CONGESTION_CBACK)(uint16_t conn_id, bool congested);
  499. /* Define a callback function when encryption is established. */
  500. typedef void(tGATT_ENC_CMPL_CB)(tGATT_IF gatt_if, const RawAddress& bda);
  501. /* Define a callback function when phy is updated. */
  502. typedef void(tGATT_PHY_UPDATE_CB)(tGATT_IF gatt_if, uint16_t conn_id,
  503. uint8_t tx_phy, uint8_t rx_phy,
  504. uint8_t status);
  505. /* Define a callback function when connection parameters are updated */
  506. typedef void(tGATT_CONN_UPDATE_CB)(tGATT_IF gatt_if, uint16_t conn_id,
  507. uint16_t interval, uint16_t latency,
  508. uint16_t timeout, uint8_t status);
  509. /* Define the structure that applications use to register with
  510. * GATT. This structure includes callback functions. All functions
  511. * MUST be provided.
  512. */
  513. typedef struct {
  514. tGATT_CONN_CBACK* p_conn_cb;
  515. tGATT_CMPL_CBACK* p_cmpl_cb;
  516. tGATT_DISC_RES_CB* p_disc_res_cb;
  517. tGATT_DISC_CMPL_CB* p_disc_cmpl_cb;
  518. tGATT_REQ_CBACK* p_req_cb;
  519. tGATT_ENC_CMPL_CB* p_enc_cmpl_cb;
  520. tGATT_CONGESTION_CBACK* p_congestion_cb;
  521. tGATT_PHY_UPDATE_CB* p_phy_update_cb;
  522. tGATT_CONN_UPDATE_CB* p_conn_update_cb;
  523. } tGATT_CBACK;
  524. /***************** Start Handle Management Definitions *********************/
  525. typedef struct {
  526. bluetooth::Uuid app_uuid128;
  527. bluetooth::Uuid svc_uuid;
  528. uint16_t s_handle;
  529. uint16_t e_handle;
  530. bool is_primary; /* primary service or secondary */
  531. } tGATTS_HNDL_RANGE;
  532. #define GATTS_SRV_CHG_CMD_ADD_CLIENT 1
  533. #define GATTS_SRV_CHG_CMD_UPDATE_CLIENT 2
  534. #define GATTS_SRV_CHG_CMD_REMOVE_CLIENT 3
  535. #define GATTS_SRV_CHG_CMD_READ_NUM_CLENTS 4
  536. #define GATTS_SRV_CHG_CMD_READ_CLENT 5
  537. typedef uint8_t tGATTS_SRV_CHG_CMD;
  538. typedef struct {
  539. RawAddress bda;
  540. bool srv_changed;
  541. } tGATTS_SRV_CHG;
  542. typedef union {
  543. tGATTS_SRV_CHG srv_chg;
  544. uint8_t client_read_index; /* only used for sequential reading client srv chg
  545. info */
  546. } tGATTS_SRV_CHG_REQ;
  547. typedef union {
  548. tGATTS_SRV_CHG srv_chg;
  549. uint8_t num_clients;
  550. } tGATTS_SRV_CHG_RSP;
  551. /* Attibute server handle ranges NV storage callback functions
  552. */
  553. typedef void(tGATTS_NV_SAVE_CBACK)(bool is_saved,
  554. tGATTS_HNDL_RANGE* p_hndl_range);
  555. typedef bool(tGATTS_NV_SRV_CHG_CBACK)(tGATTS_SRV_CHG_CMD cmd,
  556. tGATTS_SRV_CHG_REQ* p_req,
  557. tGATTS_SRV_CHG_RSP* p_rsp);
  558. typedef struct {
  559. tGATTS_NV_SAVE_CBACK* p_nv_save_callback;
  560. tGATTS_NV_SRV_CHG_CBACK* p_srv_chg_callback;
  561. } tGATT_APPL_INFO;
  562. /******************** End Handle Management Definitions ********************/
  563. /*******************************************************************************
  564. * External Function Declarations
  565. ******************************************************************************/
  566. /******************************************************************************/
  567. /* GATT Profile API Functions */
  568. /******************************************************************************/
  569. /* GATT Profile Server Functions */
  570. /******************************************************************************/
  571. /*******************************************************************************
  572. *
  573. * Function GATTS_AddHandleRange
  574. *
  575. * Description This function add the allocated handles range for the
  576. * specified application UUID, service UUID and service
  577. * instance
  578. *
  579. * Parameter p_hndl_range: pointer to allocated handles information
  580. ******************************************************************************/
  581. extern void GATTS_AddHandleRange(tGATTS_HNDL_RANGE* p_hndl_range);
  582. /*******************************************************************************
  583. *
  584. * Function GATTS_NVRegister
  585. *
  586. * Description Application manager calls this function to register for
  587. * NV save callback function. There can be one and only one
  588. * NV save callback function.
  589. *
  590. * Parameter p_cb_info : callback informaiton
  591. *
  592. * Returns true if registered OK, else false
  593. *
  594. ******************************************************************************/
  595. extern bool GATTS_NVRegister(tGATT_APPL_INFO* p_cb_info);
  596. /*******************************************************************************
  597. *
  598. * Function BTA_GATTS_AddService
  599. *
  600. * Description Add a service. When service is ready, a callback
  601. * event BTA_GATTS_ADD_SRVC_EVT is called to report status
  602. * and handles to the profile.
  603. *
  604. * Parameters server_if: server interface.
  605. * service: pointer array describing service.
  606. * count: number of elements in service array.
  607. *
  608. * Returns on success GATT_SERVICE_STARTED is returned, and
  609. * attribute_handle field inside service elements are filled.
  610. * on error error status is returned.
  611. *
  612. ******************************************************************************/
  613. extern uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service,
  614. int count);
  615. /*******************************************************************************
  616. *
  617. * Function GATTS_DeleteService
  618. *
  619. * Description This function is called to delete a service.
  620. *
  621. * Parameter gatt_if : application interface
  622. * p_svc_uuid : service UUID
  623. * svc_inst : instance of the service inside the
  624. * application
  625. *
  626. * Returns true if operation succeed, else false
  627. *
  628. ******************************************************************************/
  629. extern bool GATTS_DeleteService(tGATT_IF gatt_if, bluetooth::Uuid* p_svc_uuid,
  630. uint16_t svc_inst);
  631. /*******************************************************************************
  632. *
  633. * Function GATTS_StopService
  634. *
  635. * Description This function is called to stop a service
  636. *
  637. * Parameter service_handle : this is the start handle of a service
  638. *
  639. * Returns None.
  640. *
  641. ******************************************************************************/
  642. extern void GATTS_StopService(uint16_t service_handle);
  643. /*******************************************************************************
  644. *
  645. * Function GATTs_HandleValueIndication
  646. *
  647. * Description This function sends a handle value indication to a client.
  648. *
  649. * Parameter conn_id: connection identifier.
  650. * attr_handle: Attribute handle of this handle value
  651. * indication.
  652. * val_len: Length of the indicated attribute value.
  653. * p_val: Pointer to the indicated attribute value data.
  654. *
  655. * Returns GATT_SUCCESS if sucessfully sent or queued; otherwise error
  656. * code.
  657. *
  658. ******************************************************************************/
  659. extern tGATT_STATUS GATTS_HandleValueIndication(uint16_t conn_id,
  660. uint16_t attr_handle,
  661. uint16_t val_len,
  662. uint8_t* p_val);
  663. /*******************************************************************************
  664. *
  665. * Function GATTS_HandleValueNotification
  666. *
  667. * Description This function sends a handle value notification to a client.
  668. *
  669. * Parameter conn_id: connection identifier.
  670. * attr_handle: Attribute handle of this handle value
  671. * indication.
  672. * val_len: Length of the indicated attribute value.
  673. * p_val: Pointer to the indicated attribute value data.
  674. *
  675. * Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
  676. *
  677. ******************************************************************************/
  678. extern tGATT_STATUS GATTS_HandleValueNotification(uint16_t conn_id,
  679. uint16_t attr_handle,
  680. uint16_t val_len,
  681. uint8_t* p_val);
  682. /*******************************************************************************
  683. *
  684. * Function GATTS_SendRsp
  685. *
  686. * Description This function sends the server response to client.
  687. *
  688. * Parameter conn_id: connection identifier.
  689. * trans_id: transaction id
  690. * status: response status
  691. * p_msg: pointer to message parameters structure.
  692. *
  693. * Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
  694. *
  695. ******************************************************************************/
  696. extern tGATT_STATUS GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id,
  697. tGATT_STATUS status, tGATTS_RSP* p_msg);
  698. /******************************************************************************/
  699. /* GATT Profile Client Functions */
  700. /******************************************************************************/
  701. /*******************************************************************************
  702. *
  703. * Function GATTC_ConfigureMTU
  704. *
  705. * Description This function is called to configure the ATT MTU size for
  706. * a connection on an LE transport.
  707. *
  708. * Parameters conn_id: connection identifier.
  709. * mtu - attribute MTU size..
  710. *
  711. * Returns GATT_SUCCESS if command started successfully.
  712. *
  713. ******************************************************************************/
  714. extern tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu);
  715. /*******************************************************************************
  716. *
  717. * Function GATTC_Discover
  718. *
  719. * Description This function is called to do a discovery procedure on ATT
  720. * server.
  721. *
  722. * Parameters conn_id: connection identifier.
  723. * disc_type:discovery type.
  724. * start_handle and end_handle: range of handles for discovery
  725. * uuid: uuid to discovery. set to Uuid::kEmpty for requests
  726. * that don't need it
  727. *
  728. * Returns GATT_SUCCESS if command received/sent successfully.
  729. *
  730. ******************************************************************************/
  731. extern tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  732. uint16_t start_handle, uint16_t end_handle,
  733. const bluetooth::Uuid& uuid);
  734. extern tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
  735. uint16_t start_handle, uint16_t end_handle);
  736. /*******************************************************************************
  737. *
  738. * Function GATTC_Read
  739. *
  740. * Description This function is called to read the value of an attribute
  741. * from the server.
  742. *
  743. * Parameters conn_id: connection identifier.
  744. * type - attribute read type.
  745. * p_read - read operation parameters.
  746. *
  747. * Returns GATT_SUCCESS if command started successfully.
  748. *
  749. ******************************************************************************/
  750. extern tGATT_STATUS GATTC_Read(uint16_t conn_id, tGATT_READ_TYPE type,
  751. tGATT_READ_PARAM* p_read);
  752. /*******************************************************************************
  753. *
  754. * Function GATTC_Write
  755. *
  756. * Description This function is called to read the value of an attribute
  757. * from the server.
  758. *
  759. * Parameters conn_id: connection identifier.
  760. * type - attribute write type.
  761. * p_write - write operation parameters.
  762. *
  763. * Returns GATT_SUCCESS if command started successfully.
  764. *
  765. ******************************************************************************/
  766. extern tGATT_STATUS GATTC_Write(uint16_t conn_id, tGATT_WRITE_TYPE type,
  767. tGATT_VALUE* p_write);
  768. /*******************************************************************************
  769. *
  770. * Function GATTC_ExecuteWrite
  771. *
  772. * Description This function is called to send an Execute write request to
  773. * the server.
  774. *
  775. * Parameters conn_id: connection identifier.
  776. * is_execute - to execute or cancel the prepare write
  777. * request(s)
  778. *
  779. * Returns GATT_SUCCESS if command started successfully.
  780. *
  781. ******************************************************************************/
  782. extern tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute);
  783. /*******************************************************************************
  784. *
  785. * Function GATTC_SendHandleValueConfirm
  786. *
  787. * Description This function is called to send a handle value confirmation
  788. * as response to a handle value notification from server.
  789. *
  790. * Parameters conn_id: connection identifier.
  791. * handle: the handle of the attribute confirmation.
  792. *
  793. * Returns GATT_SUCCESS if command started successfully.
  794. *
  795. ******************************************************************************/
  796. extern tGATT_STATUS GATTC_SendHandleValueConfirm(uint16_t conn_id,
  797. uint16_t handle);
  798. /*******************************************************************************
  799. *
  800. * Function GATT_SetIdleTimeout
  801. *
  802. * Description This function (common to both client and server) sets the
  803. * idle timeout for a tansport connection
  804. *
  805. * Parameter bd_addr: target device bd address.
  806. * idle_tout: timeout value in seconds.
  807. * transport: trasnport option.
  808. *
  809. * Returns void
  810. *
  811. ******************************************************************************/
  812. extern void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout,
  813. tGATT_TRANSPORT transport);
  814. /*******************************************************************************
  815. *
  816. * Function GATT_Register
  817. *
  818. * Description This function is called to register an application
  819. * with GATT
  820. *
  821. * Parameter p_app_uuid128: Application UUID
  822. * p_cb_info: callback functions.
  823. *
  824. * Returns 0 for error, otherwise the index of the client registered
  825. * with GATT
  826. *
  827. ******************************************************************************/
  828. extern tGATT_IF GATT_Register(const bluetooth::Uuid& p_app_uuid128,
  829. tGATT_CBACK* p_cb_info);
  830. /*******************************************************************************
  831. *
  832. * Function GATT_Deregister
  833. *
  834. * Description This function deregistered the application from GATT.
  835. *
  836. * Parameters gatt_if: applicaiton interface.
  837. *
  838. * Returns None.
  839. *
  840. ******************************************************************************/
  841. extern void GATT_Deregister(tGATT_IF gatt_if);
  842. /*******************************************************************************
  843. *
  844. * Function GATT_StartIf
  845. *
  846. * Description This function is called after registration to start
  847. * receiving callbacks for registered interface. Function may
  848. * call back with connection status and queued notifications
  849. *
  850. * Parameter gatt_if: applicaiton interface.
  851. *
  852. * Returns None
  853. *
  854. ******************************************************************************/
  855. extern void GATT_StartIf(tGATT_IF gatt_if);
  856. /*******************************************************************************
  857. *
  858. * Function GATT_Connect
  859. *
  860. * Description This function initiate a connecttion to a remote device on
  861. * GATT channel.
  862. *
  863. * Parameters gatt_if: applicaiton interface
  864. * bd_addr: peer device address.
  865. * is_direct: is a direct connection or a background auto
  866. * connection
  867. * transport : Physical transport for GATT connection
  868. * (BR/EDR or LE)
  869. * opportunistic: will not keep device connected if other apps
  870. * disconnect, will not update connected apps counter, when
  871. * disconnected won't cause physical disconnection.
  872. *
  873. * Returns true if connection started; else false
  874. *
  875. ******************************************************************************/
  876. extern bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr,
  877. bool is_direct, tBT_TRANSPORT transport,
  878. bool opportunistic);
  879. extern bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr,
  880. bool is_direct, tBT_TRANSPORT transport,
  881. bool opportunistic, uint8_t initiating_phys);
  882. /*******************************************************************************
  883. *
  884. * Function GATT_CancelConnect
  885. *
  886. * Description Terminate the connection initiation to a remote device on a
  887. * GATT channel.
  888. *
  889. * Parameters gatt_if: client interface. If 0 used as unconditionally
  890. * disconnect, typically used for direct connection
  891. * cancellation.
  892. * bd_addr: peer device address.
  893. * is_direct: is a direct conenection or a background auto
  894. * connection
  895. *
  896. * Returns true if connection started; else false
  897. *
  898. ******************************************************************************/
  899. extern bool GATT_CancelConnect(tGATT_IF gatt_if, const RawAddress& bd_addr,
  900. bool is_direct);
  901. /*******************************************************************************
  902. *
  903. * Function GATT_Disconnect
  904. *
  905. * Description Disconnect the GATT channel for this registered application.
  906. *
  907. * Parameters conn_id: connection identifier.
  908. *
  909. * Returns GATT_SUCCESS if disconnected.
  910. *
  911. ******************************************************************************/
  912. extern tGATT_STATUS GATT_Disconnect(uint16_t conn_id);
  913. /*******************************************************************************
  914. *
  915. * Function GATT_GetConnectionInfor
  916. *
  917. * Description Use conn_id to find its associated BD address and
  918. * application interface
  919. *
  920. * Parameters conn_id: connection id (input)
  921. * p_gatt_if: applicaiton interface (output)
  922. * bd_addr: peer device address. (output)
  923. * transport : physical transport of the GATT connection
  924. * (BR/EDR or LE)
  925. *
  926. * Returns true the ligical link information is found for conn_id
  927. *
  928. ******************************************************************************/
  929. extern bool GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF* p_gatt_if,
  930. RawAddress& bd_addr,
  931. tBT_TRANSPORT* p_transport);
  932. /*******************************************************************************
  933. *
  934. * Function GATT_GetConnIdIfConnected
  935. *
  936. * Description Find the conn_id if the logical link for a BD address
  937. * and application interface is connected
  938. *
  939. * Parameters gatt_if: applicaiton interface (input)
  940. * bd_addr: peer device address. (input)
  941. * p_conn_id: connection id (output)
  942. * transport : physical transport of the GATT connection
  943. * (BR/EDR or LE)
  944. *
  945. * Returns true the ligical link is connected
  946. *
  947. ******************************************************************************/
  948. extern bool GATT_GetConnIdIfConnected(tGATT_IF gatt_if,
  949. const RawAddress& bd_addr,
  950. uint16_t* p_conn_id,
  951. tBT_TRANSPORT transport);
  952. /*******************************************************************************
  953. *
  954. * Function GATT_ConfigServiceChangeCCC
  955. *
  956. * Description Configure service change indication on remote device
  957. *
  958. * Returns None.
  959. *
  960. ******************************************************************************/
  961. extern void GATT_ConfigServiceChangeCCC(const RawAddress& remote_bda,
  962. bool enable, tBT_TRANSPORT transport);
  963. // Enables the GATT profile on the device.
  964. // It clears out the control blocks, and registers with L2CAP.
  965. extern void gatt_init(void);
  966. // Frees resources used by the GATT profile.
  967. extern void gatt_free(void);
  968. // Link encryption complete notification for all encryption process
  969. // initiated outside GATT.
  970. extern void gatt_notify_enc_cmpl(const RawAddress& bd_addr);
  971. /** Reset bg device list. If called after controller reset, set |after_reset| to
  972. * true, as there is no need to wipe controller white list in this case. */
  973. extern void gatt_reset_bgdev_list(bool after_reset);
  974. #endif /* GATT_API_H */