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