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