Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | #ifndef ANDROID_INCLUDE_BT_GATT_CLIENT_H |
| 19 | #define ANDROID_INCLUDE_BT_GATT_CLIENT_H |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | #include "bt_gatt_types.h" |
| 23 | |
| 24 | __BEGIN_DECLS |
| 25 | |
| 26 | /** |
| 27 | * Buffer sizes for maximum attribute length and maximum read/write |
| 28 | * operation buffer size. |
| 29 | */ |
| 30 | #define BTGATT_MAX_ATTR_LEN 600 |
| 31 | |
| 32 | /** Buffer type for unformatted reads/writes */ |
| 33 | typedef struct |
| 34 | { |
| 35 | uint8_t value[BTGATT_MAX_ATTR_LEN]; |
| 36 | uint16_t len; |
| 37 | } btgatt_unformatted_value_t; |
| 38 | |
| 39 | /** Parameters for GATT read operations */ |
| 40 | typedef struct |
| 41 | { |
| 42 | btgatt_srvc_id_t srvc_id; |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 43 | btgatt_gatt_id_t char_id; |
| 44 | btgatt_gatt_id_t descr_id; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 45 | btgatt_unformatted_value_t value; |
| 46 | uint16_t value_type; |
| 47 | uint8_t status; |
| 48 | } btgatt_read_params_t; |
| 49 | |
| 50 | /** Parameters for GATT write operations */ |
| 51 | typedef struct |
| 52 | { |
| 53 | btgatt_srvc_id_t srvc_id; |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 54 | btgatt_gatt_id_t char_id; |
| 55 | btgatt_gatt_id_t descr_id; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 56 | uint8_t status; |
| 57 | } btgatt_write_params_t; |
| 58 | |
| 59 | /** Attribute change notification parameters */ |
| 60 | typedef struct |
| 61 | { |
| 62 | uint8_t value[BTGATT_MAX_ATTR_LEN]; |
| 63 | bt_bdaddr_t bda; |
| 64 | btgatt_srvc_id_t srvc_id; |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 65 | btgatt_gatt_id_t char_id; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 66 | uint16_t len; |
| 67 | uint8_t is_notify; |
| 68 | } btgatt_notify_params_t; |
| 69 | |
| 70 | typedef struct |
| 71 | { |
| 72 | bt_bdaddr_t *bda1; |
| 73 | bt_uuid_t *uuid1; |
| 74 | uint16_t u1; |
| 75 | uint16_t u2; |
| 76 | uint16_t u3; |
| 77 | uint16_t u4; |
| 78 | uint16_t u5; |
| 79 | } btgatt_test_params_t; |
| 80 | |
| 81 | /** BT-GATT Client callback structure. */ |
| 82 | |
| 83 | /** Callback invoked in response to register_client */ |
| 84 | typedef void (*register_client_callback)(int status, int client_if, |
| 85 | bt_uuid_t *app_uuid); |
| 86 | |
| 87 | /** Callback for scan results */ |
| 88 | typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, uint8_t* adv_data); |
| 89 | |
| 90 | /** GATT open callback invoked in response to open */ |
| 91 | typedef void (*connect_callback)(int conn_id, int status, int client_if, bt_bdaddr_t* bda); |
| 92 | |
| 93 | /** Callback invoked in response to close */ |
| 94 | typedef void (*disconnect_callback)(int conn_id, int status, |
| 95 | int client_if, bt_bdaddr_t* bda); |
| 96 | |
| 97 | /** |
| 98 | * Invoked in response to search_service when the GATT service search |
| 99 | * has been completed. |
| 100 | */ |
| 101 | typedef void (*search_complete_callback)(int conn_id, int status); |
| 102 | |
| 103 | /** Reports GATT services on a remote device */ |
| 104 | typedef void (*search_result_callback)( int conn_id, btgatt_srvc_id_t *srvc_id); |
| 105 | |
| 106 | /** GATT characteristic enumeration result callback */ |
| 107 | typedef void (*get_characteristic_callback)(int conn_id, int status, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 108 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 109 | int char_prop); |
| 110 | |
| 111 | /** GATT descriptor enumeration result callback */ |
| 112 | typedef void (*get_descriptor_callback)(int conn_id, int status, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 113 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
| 114 | btgatt_gatt_id_t *descr_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 115 | |
| 116 | /** GATT included service enumeration result callback */ |
| 117 | typedef void (*get_included_service_callback)(int conn_id, int status, |
| 118 | btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id); |
| 119 | |
| 120 | /** Callback invoked in response to [de]register_for_notification */ |
| 121 | typedef void (*register_for_notification_callback)(int conn_id, |
| 122 | int registered, int status, btgatt_srvc_id_t *srvc_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 123 | btgatt_gatt_id_t *char_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Remote device notification callback, invoked when a remote device sends |
| 127 | * a notification or indication that a client has registered for. |
| 128 | */ |
| 129 | typedef void (*notify_callback)(int conn_id, btgatt_notify_params_t *p_data); |
| 130 | |
| 131 | /** Reports result of a GATT read operation */ |
| 132 | typedef void (*read_characteristic_callback)(int conn_id, int status, |
| 133 | btgatt_read_params_t *p_data); |
| 134 | |
| 135 | /** GATT write characteristic operation callback */ |
| 136 | typedef void (*write_characteristic_callback)(int conn_id, int status, |
| 137 | btgatt_write_params_t *p_data); |
| 138 | |
| 139 | /** GATT execute prepared write callback */ |
| 140 | typedef void (*execute_write_callback)(int conn_id, int status); |
| 141 | |
| 142 | /** Callback invoked in response to read_descriptor */ |
| 143 | typedef void (*read_descriptor_callback)(int conn_id, int status, |
| 144 | btgatt_read_params_t *p_data); |
| 145 | |
| 146 | /** Callback invoked in response to write_descriptor */ |
| 147 | typedef void (*write_descriptor_callback)(int conn_id, int status, |
| 148 | btgatt_write_params_t *p_data); |
| 149 | |
| 150 | /** Callback triggered in response to read_remote_rssi */ |
| 151 | typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda, |
| 152 | int rssi, int status); |
| 153 | |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 154 | /** |
Satya Calloji | 20a1a05 | 2014-05-10 23:37:11 -0700 | [diff] [blame] | 155 | * Callback indicating the status of a listen() operation |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 156 | */ |
| 157 | typedef void (*listen_callback)(int status, int server_if); |
| 158 | |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 159 | /** Callback invoked when the MTU for a given connection changes */ |
| 160 | typedef void (*configure_mtu_callback)(int conn_id, int status, int mtu); |
| 161 | |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 162 | /** Callback invoked when a scan filter configuration command has completed */ |
Satya Calloji | a28f92a | 2014-06-11 22:53:12 -0700 | [diff] [blame] | 163 | typedef void (*scan_filter_cfg_callback)(int action, int client_if, int status, int filt_type, |
| 164 | int avbl_space); |
| 165 | |
| 166 | /** Callback invoked when scan param has been added, cleared, or deleted */ |
| 167 | typedef void (*scan_filter_param_callback)(int action, int client_if, int status, |
| 168 | int avbl_space); |
| 169 | |
| 170 | /** Callback invoked when a scan filter configuration command has completed */ |
| 171 | typedef void (*scan_filter_status_callback)(int enable, int client_if, int status); |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 172 | |
Satya Calloji | 3154bab | 2014-06-15 11:51:38 -0700 | [diff] [blame] | 173 | /** Track ADV VSE callback invoked when tracked device is found or lost */ |
| 174 | typedef void (*track_adv_event_callback)(int client_if, int filt_index, int addr_type, |
| 175 | bt_bdaddr_t* bda, int adv_state); |
| 176 | |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 177 | /** Callback invoked when multi-adv enable operation has completed */ |
| 178 | typedef void (*multi_adv_enable_callback)(int client_if, int status); |
| 179 | |
| 180 | /** Callback invoked when multi-adv param update operation has completed */ |
| 181 | typedef void (*multi_adv_update_callback)(int client_if, int status); |
| 182 | |
| 183 | /** Callback invoked when multi-adv instance data set operation has completed */ |
| 184 | typedef void (*multi_adv_data_callback)(int client_if, int status); |
| 185 | |
| 186 | /** Callback invoked when multi-adv disable operation has completed */ |
| 187 | typedef void (*multi_adv_disable_callback)(int client_if, int status); |
| 188 | |
Andre Eisenbach | 9ef3c72 | 2014-03-28 14:53:33 -0700 | [diff] [blame] | 189 | /** |
| 190 | * Callback notifying an application that a remote device connection is currently congested |
| 191 | * and cannot receive any more data. An application should avoid sending more data until |
| 192 | * a further callback is received indicating the congestion status has been cleared. |
| 193 | */ |
| 194 | typedef void (*congestion_callback)(int conn_id, bool congested); |
Satya Calloji | 20a1a05 | 2014-05-10 23:37:11 -0700 | [diff] [blame] | 195 | /** Callback invoked when batchscan storage config operation has completed */ |
| 196 | typedef void (*batchscan_cfg_storage_callback)(int client_if, int status); |
| 197 | |
| 198 | /** Callback invoked when batchscan enable / disable operation has completed */ |
| 199 | typedef void (*batchscan_enable_disable_callback)(int action, int client_if, int status); |
| 200 | |
| 201 | /** Callback invoked when batchscan reports are obtained */ |
| 202 | typedef void (*batchscan_reports_callback)(int client_if, int status, int report_format, |
| 203 | int num_records, int data_len, uint8_t* rep_data); |
| 204 | |
| 205 | /** Callback invoked when batchscan storage threshold limit is crossed */ |
| 206 | typedef void (*batchscan_threshold_callback)(int client_if); |
| 207 | |
Andre Eisenbach | 9ef3c72 | 2014-03-28 14:53:33 -0700 | [diff] [blame] | 208 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 209 | typedef struct { |
| 210 | register_client_callback register_client_cb; |
| 211 | scan_result_callback scan_result_cb; |
| 212 | connect_callback open_cb; |
| 213 | disconnect_callback close_cb; |
| 214 | search_complete_callback search_complete_cb; |
| 215 | search_result_callback search_result_cb; |
| 216 | get_characteristic_callback get_characteristic_cb; |
| 217 | get_descriptor_callback get_descriptor_cb; |
| 218 | get_included_service_callback get_included_service_cb; |
| 219 | register_for_notification_callback register_for_notification_cb; |
| 220 | notify_callback notify_cb; |
| 221 | read_characteristic_callback read_characteristic_cb; |
| 222 | write_characteristic_callback write_characteristic_cb; |
| 223 | read_descriptor_callback read_descriptor_cb; |
| 224 | write_descriptor_callback write_descriptor_cb; |
| 225 | execute_write_callback execute_write_cb; |
| 226 | read_remote_rssi_callback read_remote_rssi_cb; |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 227 | listen_callback listen_cb; |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 228 | configure_mtu_callback configure_mtu_cb; |
Satya Calloji | a28f92a | 2014-06-11 22:53:12 -0700 | [diff] [blame] | 229 | scan_filter_cfg_callback scan_filter_cfg_cb; |
| 230 | scan_filter_param_callback scan_filter_param_cb; |
| 231 | scan_filter_status_callback scan_filter_status_cb; |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 232 | multi_adv_enable_callback multi_adv_enable_cb; |
| 233 | multi_adv_update_callback multi_adv_update_cb; |
| 234 | multi_adv_data_callback multi_adv_data_cb; |
| 235 | multi_adv_disable_callback multi_adv_disable_cb; |
Andre Eisenbach | 9ef3c72 | 2014-03-28 14:53:33 -0700 | [diff] [blame] | 236 | congestion_callback congestion_cb; |
Satya Calloji | 20a1a05 | 2014-05-10 23:37:11 -0700 | [diff] [blame] | 237 | batchscan_cfg_storage_callback batchscan_cfg_storage_cb; |
| 238 | batchscan_enable_disable_callback batchscan_enb_disable_cb; |
| 239 | batchscan_reports_callback batchscan_reports_cb; |
| 240 | batchscan_threshold_callback batchscan_threshold_cb; |
Satya Calloji | 3154bab | 2014-06-15 11:51:38 -0700 | [diff] [blame] | 241 | track_adv_event_callback track_adv_event_cb; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 242 | } btgatt_client_callbacks_t; |
| 243 | |
| 244 | /** Represents the standard BT-GATT client interface. */ |
| 245 | |
| 246 | typedef struct { |
| 247 | /** Registers a GATT client application with the stack */ |
| 248 | bt_status_t (*register_client)( bt_uuid_t *uuid ); |
| 249 | |
| 250 | /** Unregister a client application from the stack */ |
| 251 | bt_status_t (*unregister_client)(int client_if ); |
| 252 | |
| 253 | /** Start or stop LE device scanning */ |
Prerepa Viswanadham | 45edab9 | 2014-05-09 16:09:52 -0700 | [diff] [blame] | 254 | bt_status_t (*scan)( bool start ); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 255 | |
| 256 | /** Create a connection to a remote LE or dual-mode device */ |
| 257 | bt_status_t (*connect)( int client_if, const bt_bdaddr_t *bd_addr, |
Ganesh Ganapathi Batta | f9f4d10 | 2014-04-18 10:02:49 -0700 | [diff] [blame] | 258 | bool is_direct, int transport ); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 259 | |
| 260 | /** Disconnect a remote device or cancel a pending connection */ |
| 261 | bt_status_t (*disconnect)( int client_if, const bt_bdaddr_t *bd_addr, |
| 262 | int conn_id); |
| 263 | |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 264 | /** Start or stop advertisements to listen for incoming connections */ |
| 265 | bt_status_t (*listen)(int client_if, bool start); |
| 266 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 267 | /** Clear the attribute cache for a given device */ |
| 268 | bt_status_t (*refresh)( int client_if, const bt_bdaddr_t *bd_addr ); |
| 269 | |
| 270 | /** |
| 271 | * Enumerate all GATT services on a connected device. |
| 272 | * Optionally, the results can be filtered for a given UUID. |
| 273 | */ |
| 274 | bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid ); |
| 275 | |
| 276 | /** |
| 277 | * Enumerate included services for a given service. |
| 278 | * Set start_incl_srvc_id to NULL to get the first included service. |
| 279 | */ |
| 280 | bt_status_t (*get_included_service)( int conn_id, btgatt_srvc_id_t *srvc_id, |
| 281 | btgatt_srvc_id_t *start_incl_srvc_id); |
| 282 | |
| 283 | /** |
| 284 | * Enumerate characteristics for a given service. |
| 285 | * Set start_char_id to NULL to get the first characteristic. |
| 286 | */ |
| 287 | bt_status_t (*get_characteristic)( int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 288 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 289 | |
| 290 | /** |
| 291 | * Enumerate descriptors for a given characteristic. |
| 292 | * Set start_descr_id to NULL to get the first descriptor. |
| 293 | */ |
| 294 | bt_status_t (*get_descriptor)( int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 295 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
| 296 | btgatt_gatt_id_t *start_descr_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 297 | |
| 298 | /** Read a characteristic on a remote device */ |
| 299 | bt_status_t (*read_characteristic)( int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 300 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 301 | int auth_req ); |
| 302 | |
| 303 | /** Write a remote characteristic */ |
| 304 | bt_status_t (*write_characteristic)(int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 305 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 306 | int write_type, int len, int auth_req, |
| 307 | char* p_value); |
| 308 | |
| 309 | /** Read the descriptor for a given characteristic */ |
| 310 | bt_status_t (*read_descriptor)(int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 311 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
| 312 | btgatt_gatt_id_t *descr_id, int auth_req); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 313 | |
| 314 | /** Write a remote descriptor for a given characteristic */ |
| 315 | bt_status_t (*write_descriptor)( int conn_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 316 | btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, |
| 317 | btgatt_gatt_id_t *descr_id, int write_type, int len, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 318 | int auth_req, char* p_value); |
| 319 | |
| 320 | /** Execute a prepared write operation */ |
| 321 | bt_status_t (*execute_write)(int conn_id, int execute); |
| 322 | |
| 323 | /** |
| 324 | * Register to receive notifications or indications for a given |
| 325 | * characteristic |
| 326 | */ |
| 327 | bt_status_t (*register_for_notification)( int client_if, |
| 328 | const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 329 | btgatt_gatt_id_t *char_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 330 | |
| 331 | /** Deregister a previous request for notifications/indications */ |
| 332 | bt_status_t (*deregister_for_notification)( int client_if, |
| 333 | const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 334 | btgatt_gatt_id_t *char_id); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 335 | |
| 336 | /** Request RSSI for a given remote device */ |
| 337 | bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr); |
| 338 | |
Satya Calloji | a28f92a | 2014-06-11 22:53:12 -0700 | [diff] [blame] | 339 | /** Setup scan filter params */ |
| 340 | bt_status_t (*scan_filter_param_setup)(int client_if, int action, int filt_index, int feat_seln, |
| 341 | int list_logic_type, int filt_logic_type, int rssi_high_thres, |
| 342 | int rssi_low_thres, int dely_mode, int found_timeout, |
| 343 | int lost_timeout, int found_timeout_cnt); |
| 344 | |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 345 | |
| 346 | /** Configure a scan filter condition */ |
Satya Calloji | a28f92a | 2014-06-11 22:53:12 -0700 | [diff] [blame] | 347 | bt_status_t (*scan_filter_add_remove)(int client_if, int action, int filt_type, |
| 348 | int filt_index, int company_id, |
| 349 | int company_id_mask, const bt_uuid_t *p_uuid, |
| 350 | const bt_uuid_t *p_uuid_mask, const bt_bdaddr_t *bd_addr, |
| 351 | char addr_type, int data_len, char* p_data, int mask_len, |
| 352 | char* p_mask); |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 353 | |
Satya Calloji | a28f92a | 2014-06-11 22:53:12 -0700 | [diff] [blame] | 354 | /** Clear all scan filter conditions for specific filter index*/ |
| 355 | bt_status_t (*scan_filter_clear)(int client_if, int filt_index); |
| 356 | |
| 357 | /** Enable / disable scan filter feature*/ |
| 358 | bt_status_t (*scan_filter_enable)(int client_if, bool enable); |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 359 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 360 | /** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */ |
| 361 | int (*get_device_type)( const bt_bdaddr_t *bd_addr ); |
| 362 | |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 363 | /** Set the advertising data or scan response data */ |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 364 | bt_status_t (*set_adv_data)(int client_if, bool set_scan_rsp, bool include_name, |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 365 | bool include_txpower, int min_interval, int max_interval, int appearance, |
Wei Wang | a16d11d | 2013-11-05 16:09:51 -0800 | [diff] [blame] | 366 | uint16_t manufacturer_len, char* manufacturer_data, |
| 367 | uint16_t service_data_len, char* service_data, |
| 368 | uint16_t service_uuid_len, char* service_uuid); |
Andre Eisenbach | 299e43c | 2013-08-06 19:54:25 -0700 | [diff] [blame] | 369 | |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 370 | /** Configure the MTU for a given connection */ |
| 371 | bt_status_t (*configure_mtu)(int conn_id, int mtu); |
| 372 | |
Andre Eisenbach | da4eaca | 2014-07-16 22:58:36 -0700 | [diff] [blame] | 373 | /** Request a connection parameter update */ |
| 374 | bt_status_t (*conn_parameter_update)(const bt_bdaddr_t *bd_addr, int min_interval, |
| 375 | int max_interval, int latency, int timeout); |
| 376 | |
Prerepa Viswanadham | 45edab9 | 2014-05-09 16:09:52 -0700 | [diff] [blame] | 377 | /** Sets the LE scan interval and window in units of N*0.625 msec */ |
| 378 | bt_status_t (*set_scan_parameters)(int scan_interval, int scan_window); |
| 379 | |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 380 | /* Setup the parameters as per spec, user manual specified values and enable multi ADV */ |
| 381 | bt_status_t (*multi_adv_enable)(int client_if, int min_interval,int max_interval,int adv_type, |
Andre Eisenbach | 4789ed5 | 2014-08-07 15:18:34 -0700 | [diff] [blame^] | 382 | int chnl_map, int tx_power, int timeout_s); |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 383 | |
| 384 | /* Update the parameters as per spec, user manual specified values and restart multi ADV */ |
| 385 | bt_status_t (*multi_adv_update)(int client_if, int min_interval,int max_interval,int adv_type, |
Andre Eisenbach | 4789ed5 | 2014-08-07 15:18:34 -0700 | [diff] [blame^] | 386 | int chnl_map, int tx_power, int timeout_s); |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 387 | |
| 388 | /* Setup the data for the specified instance */ |
| 389 | bt_status_t (*multi_adv_set_inst_data)(int client_if, bool set_scan_rsp, bool include_name, |
Andre Eisenbach | 4789ed5 | 2014-08-07 15:18:34 -0700 | [diff] [blame^] | 390 | bool incl_txpower, int appearance, int manufacturer_len, |
| 391 | char* manufacturer_data, int service_data_len, |
| 392 | char* service_data, int service_uuid_len, char* service_uuid); |
Wei Wang | 6c2e2d3 | 2014-05-20 06:30:05 +0000 | [diff] [blame] | 393 | |
| 394 | /* Disable the multi adv instance */ |
| 395 | bt_status_t (*multi_adv_disable)(int client_if); |
| 396 | |
Satya Calloji | 20a1a05 | 2014-05-10 23:37:11 -0700 | [diff] [blame] | 397 | /* Configure the batchscan storage */ |
| 398 | bt_status_t (*batchscan_cfg_storage)(int client_if, int batch_scan_full_max, |
| 399 | int batch_scan_trunc_max, int batch_scan_notify_threshold); |
| 400 | |
| 401 | /* Enable batchscan */ |
| 402 | bt_status_t (*batchscan_enb_batch_scan)(int client_if, int scan_mode, |
| 403 | int scan_interval, int scan_window, int addr_type, int discard_rule); |
| 404 | |
| 405 | /* Disable batchscan */ |
| 406 | bt_status_t (*batchscan_dis_batch_scan)(int client_if); |
| 407 | |
| 408 | /* Read out batchscan reports */ |
| 409 | bt_status_t (*batchscan_read_reports)(int client_if, int scan_mode); |
| 410 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 411 | /** Test mode interface */ |
| 412 | bt_status_t (*test_command)( int command, btgatt_test_params_t* params); |
Ganesh Ganapathi Batta | f9f4d10 | 2014-04-18 10:02:49 -0700 | [diff] [blame] | 413 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 414 | } btgatt_client_interface_t; |
| 415 | |
| 416 | __END_DECLS |
| 417 | |
| 418 | #endif /* ANDROID_INCLUDE_BT_GATT_CLIENT_H */ |