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> |
Jakub Pawlowski | 620fd71 | 2016-05-27 16:36:24 -0700 | [diff] [blame] | 22 | #include <vector> |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 23 | #include "bt_gatt_types.h" |
Satya Calloji | a8b49d3 | 2015-02-10 09:20:07 -0800 | [diff] [blame] | 24 | #include "bt_common_types.h" |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 25 | |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 26 | #include <bluetooth/uuid.h> |
| 27 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 28 | __BEGIN_DECLS |
| 29 | |
| 30 | /** |
| 31 | * Buffer sizes for maximum attribute length and maximum read/write |
| 32 | * operation buffer size. |
| 33 | */ |
| 34 | #define BTGATT_MAX_ATTR_LEN 600 |
| 35 | |
| 36 | /** Buffer type for unformatted reads/writes */ |
| 37 | typedef struct |
| 38 | { |
| 39 | uint8_t value[BTGATT_MAX_ATTR_LEN]; |
| 40 | uint16_t len; |
| 41 | } btgatt_unformatted_value_t; |
| 42 | |
| 43 | /** Parameters for GATT read operations */ |
| 44 | typedef struct |
| 45 | { |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 46 | uint16_t handle; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 47 | btgatt_unformatted_value_t value; |
| 48 | uint16_t value_type; |
| 49 | uint8_t status; |
| 50 | } btgatt_read_params_t; |
| 51 | |
| 52 | /** Parameters for GATT write operations */ |
| 53 | typedef struct |
| 54 | { |
| 55 | btgatt_srvc_id_t srvc_id; |
Andre Eisenbach | 02223d1 | 2013-07-09 00:02:48 -0700 | [diff] [blame] | 56 | btgatt_gatt_id_t char_id; |
| 57 | btgatt_gatt_id_t descr_id; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 58 | uint8_t status; |
| 59 | } btgatt_write_params_t; |
| 60 | |
| 61 | /** Attribute change notification parameters */ |
| 62 | typedef struct |
| 63 | { |
| 64 | uint8_t value[BTGATT_MAX_ATTR_LEN]; |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 65 | RawAddress bda; |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 66 | uint16_t handle; |
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 | { |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 73 | RawAddress *bda1; |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 74 | bluetooth::Uuid *uuid1; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 75 | uint16_t u1; |
| 76 | uint16_t u2; |
| 77 | uint16_t u3; |
| 78 | uint16_t u4; |
| 79 | uint16_t u5; |
| 80 | } btgatt_test_params_t; |
| 81 | |
Satya Calloji | 5122502 | 2015-03-31 13:58:21 -0700 | [diff] [blame] | 82 | /* BT GATT client error codes */ |
| 83 | typedef enum |
| 84 | { |
| 85 | BT_GATTC_COMMAND_SUCCESS = 0, /* 0 Command succeeded */ |
| 86 | BT_GATTC_COMMAND_STARTED, /* 1 Command started OK. */ |
| 87 | BT_GATTC_COMMAND_BUSY, /* 2 Device busy with another command */ |
| 88 | BT_GATTC_COMMAND_STORED, /* 3 request is stored in control block */ |
| 89 | BT_GATTC_NO_RESOURCES, /* 4 No resources to issue command */ |
| 90 | BT_GATTC_MODE_UNSUPPORTED, /* 5 Request for 1 or more unsupported modes */ |
| 91 | BT_GATTC_ILLEGAL_VALUE, /* 6 Illegal command /parameter value */ |
| 92 | BT_GATTC_INCORRECT_STATE, /* 7 Device in wrong state for request */ |
| 93 | BT_GATTC_UNKNOWN_ADDR, /* 8 Unknown remote BD address */ |
| 94 | BT_GATTC_DEVICE_TIMEOUT, /* 9 Device timeout */ |
| 95 | BT_GATTC_INVALID_CONTROLLER_OUTPUT,/* 10 An incorrect value was received from HCI */ |
| 96 | BT_GATTC_SECURITY_ERROR, /* 11 Authorization or security failure or not authorized */ |
| 97 | BT_GATTC_DELAYED_ENCRYPTION_CHECK, /*12 Delayed encryption check */ |
| 98 | BT_GATTC_ERR_PROCESSING /* 12 Generic error */ |
| 99 | } btgattc_error_t; |
| 100 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 101 | /** BT-GATT Client callback structure. */ |
| 102 | |
| 103 | /** Callback invoked in response to register_client */ |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 104 | typedef void (*register_client_callback)(int status, int client_if, const bluetooth::Uuid& app_uuid); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 105 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 106 | /** GATT open callback invoked in response to open */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 107 | typedef void (*connect_callback)(int conn_id, int status, int client_if, const RawAddress& bda); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 108 | |
| 109 | /** Callback invoked in response to close */ |
| 110 | typedef void (*disconnect_callback)(int conn_id, int status, |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 111 | int client_if, const RawAddress& bda); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 112 | |
| 113 | /** |
| 114 | * Invoked in response to search_service when the GATT service search |
| 115 | * has been completed. |
| 116 | */ |
| 117 | typedef void (*search_complete_callback)(int conn_id, int status); |
| 118 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 119 | /** Callback invoked in response to [de]register_for_notification */ |
| 120 | typedef void (*register_for_notification_callback)(int conn_id, |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 121 | int registered, int status, uint16_t handle); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Remote device notification callback, invoked when a remote device sends |
| 125 | * a notification or indication that a client has registered for. |
| 126 | */ |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 127 | typedef void (*notify_callback)(int conn_id, const btgatt_notify_params_t& p_data); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 128 | |
| 129 | /** Reports result of a GATT read operation */ |
| 130 | typedef void (*read_characteristic_callback)(int conn_id, int status, |
| 131 | btgatt_read_params_t *p_data); |
| 132 | |
| 133 | /** GATT write characteristic operation callback */ |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 134 | 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] | 135 | |
| 136 | /** GATT execute prepared write callback */ |
| 137 | typedef void (*execute_write_callback)(int conn_id, int status); |
| 138 | |
| 139 | /** Callback invoked in response to read_descriptor */ |
| 140 | typedef void (*read_descriptor_callback)(int conn_id, int status, |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 141 | const btgatt_read_params_t& p_data); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 142 | |
| 143 | /** Callback invoked in response to write_descriptor */ |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 144 | 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] | 145 | |
| 146 | /** Callback triggered in response to read_remote_rssi */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 147 | typedef void (*read_remote_rssi_callback)(int client_if, const RawAddress& bda, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 148 | int rssi, int status); |
| 149 | |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 150 | /** Callback invoked when the MTU for a given connection changes */ |
| 151 | typedef void (*configure_mtu_callback)(int conn_id, int status, int mtu); |
| 152 | |
Andre Eisenbach | 709f239 | 2013-12-16 16:16:54 -0800 | [diff] [blame] | 153 | |
Andre Eisenbach | 9ef3c72 | 2014-03-28 14:53:33 -0700 | [diff] [blame] | 154 | /** |
| 155 | * Callback notifying an application that a remote device connection is currently congested |
| 156 | * and cannot receive any more data. An application should avoid sending more data until |
| 157 | * a further callback is received indicating the congestion status has been cleared. |
| 158 | */ |
| 159 | typedef void (*congestion_callback)(int conn_id, bool congested); |
Satya Calloji | 5122502 | 2015-03-31 13:58:21 -0700 | [diff] [blame] | 160 | |
Jakub Pawlowski | f2e1352 | 2016-01-21 23:40:51 -0800 | [diff] [blame] | 161 | /** GATT get database callback */ |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 162 | typedef void (*get_gatt_db_callback)(int conn_id, const btgatt_db_element_t* db, int count); |
Jakub Pawlowski | f2e1352 | 2016-01-21 23:40:51 -0800 | [diff] [blame] | 163 | |
Jakub Pawlowski | 83e598f | 2016-02-10 15:31:14 -0800 | [diff] [blame] | 164 | /** GATT services between start_handle and end_handle were removed */ |
| 165 | typedef void (*services_removed_callback)(int conn_id, uint16_t start_handle, uint16_t end_handle); |
| 166 | |
| 167 | /** GATT services were added */ |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 168 | typedef void (*services_added_callback)(int conn_id, const btgatt_db_element_t& added, int added_count); |
Jakub Pawlowski | 83e598f | 2016-02-10 15:31:14 -0800 | [diff] [blame] | 169 | |
Jakub Pawlowski | f3eb558 | 2017-03-22 19:09:19 -0700 | [diff] [blame] | 170 | /** Callback invoked when the PHY for a given connection changes */ |
| 171 | typedef void (*phy_updated_callback)(int conn_id, uint8_t tx_phy, |
| 172 | uint8_t rx_phy, uint8_t status); |
| 173 | |
Jakub Pawlowski | 6f0c6f1 | 2017-03-23 18:13:12 -0700 | [diff] [blame] | 174 | /** Callback invoked when the connection parameters for a given connection changes */ |
| 175 | typedef void (*conn_updated_callback)(int conn_id, uint16_t interval, |
| 176 | uint16_t latency, uint16_t timeout, |
| 177 | uint8_t status); |
| 178 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 179 | typedef struct { |
| 180 | register_client_callback register_client_cb; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 181 | connect_callback open_cb; |
| 182 | disconnect_callback close_cb; |
| 183 | search_complete_callback search_complete_cb; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 184 | register_for_notification_callback register_for_notification_cb; |
| 185 | notify_callback notify_cb; |
| 186 | read_characteristic_callback read_characteristic_cb; |
| 187 | write_characteristic_callback write_characteristic_cb; |
| 188 | read_descriptor_callback read_descriptor_cb; |
| 189 | write_descriptor_callback write_descriptor_cb; |
| 190 | execute_write_callback execute_write_cb; |
| 191 | read_remote_rssi_callback read_remote_rssi_cb; |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 192 | configure_mtu_callback configure_mtu_cb; |
Andre Eisenbach | 9ef3c72 | 2014-03-28 14:53:33 -0700 | [diff] [blame] | 193 | congestion_callback congestion_cb; |
Jakub Pawlowski | f2e1352 | 2016-01-21 23:40:51 -0800 | [diff] [blame] | 194 | get_gatt_db_callback get_gatt_db_cb; |
Jakub Pawlowski | 83e598f | 2016-02-10 15:31:14 -0800 | [diff] [blame] | 195 | services_removed_callback services_removed_cb; |
| 196 | services_added_callback services_added_cb; |
Jakub Pawlowski | f3eb558 | 2017-03-22 19:09:19 -0700 | [diff] [blame] | 197 | phy_updated_callback phy_updated_cb; |
Jakub Pawlowski | 6f0c6f1 | 2017-03-23 18:13:12 -0700 | [diff] [blame] | 198 | conn_updated_callback conn_updated_cb; |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 199 | } btgatt_client_callbacks_t; |
| 200 | |
| 201 | /** Represents the standard BT-GATT client interface. */ |
| 202 | |
| 203 | typedef struct { |
| 204 | /** Registers a GATT client application with the stack */ |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 205 | bt_status_t (*register_client)(const bluetooth::Uuid& uuid); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 206 | |
| 207 | /** Unregister a client application from the stack */ |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 208 | bt_status_t (*unregister_client)(int client_if); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 209 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 210 | /** Create a connection to a remote LE or dual-mode device */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 211 | bt_status_t (*connect)(int client_if, const RawAddress& bd_addr, |
Jack He | 56f19a1 | 2017-06-29 14:02:52 -0700 | [diff] [blame] | 212 | bool is_direct, int transport, bool opportunistic, |
| 213 | int initiating_phys); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 214 | |
| 215 | /** Disconnect a remote device or cancel a pending connection */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 216 | bt_status_t (*disconnect)( int client_if, const RawAddress& bd_addr, |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 217 | int conn_id); |
| 218 | |
| 219 | /** Clear the attribute cache for a given device */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 220 | bt_status_t (*refresh)( int client_if, const RawAddress& bd_addr); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 221 | |
| 222 | /** |
| 223 | * Enumerate all GATT services on a connected device. |
| 224 | * Optionally, the results can be filtered for a given UUID. |
| 225 | */ |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 226 | bt_status_t (*search_service)(int conn_id, const bluetooth::Uuid *filter_uuid); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 227 | |
Jakub Pawlowski | 560f2d9 | 2017-05-16 10:53:09 -0700 | [diff] [blame] | 228 | /** |
| 229 | * Sead "Find service by UUID" request. Used only for PTS tests. |
| 230 | */ |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 231 | void (*btif_gattc_discover_service_by_uuid)(int conn_id, const bluetooth::Uuid& uuid); |
Jakub Pawlowski | 560f2d9 | 2017-05-16 10:53:09 -0700 | [diff] [blame] | 232 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 233 | /** Read a characteristic on a remote device */ |
Jakub Pawlowski | f6833f4 | 2017-04-14 07:27:20 -0700 | [diff] [blame] | 234 | bt_status_t (*read_characteristic)(int conn_id, uint16_t handle, |
| 235 | int auth_req); |
| 236 | |
| 237 | /** Read a characteristic on a remote device */ |
| 238 | bt_status_t (*read_using_characteristic_uuid)( |
Jakub Pawlowski | eab6b6e | 2017-07-11 09:25:44 -0700 | [diff] [blame] | 239 | int conn_id, const bluetooth::Uuid& uuid, uint16_t s_handle, |
Jakub Pawlowski | f6833f4 | 2017-04-14 07:27:20 -0700 | [diff] [blame] | 240 | uint16_t e_handle, int auth_req); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 241 | |
| 242 | /** Write a remote characteristic */ |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 243 | bt_status_t (*write_characteristic)(int conn_id, uint16_t handle, |
Jakub Pawlowski | 620fd71 | 2016-05-27 16:36:24 -0700 | [diff] [blame] | 244 | int write_type, int auth_req, |
Pavlin Radoslavov | 44d57d4 | 2016-12-09 17:55:30 -0800 | [diff] [blame] | 245 | std::vector<uint8_t> value); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 246 | |
| 247 | /** Read the descriptor for a given characteristic */ |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 248 | 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] | 249 | |
| 250 | /** Write a remote descriptor for a given characteristic */ |
Jakub Pawlowski | 1d02bde | 2016-03-17 15:57:03 -0700 | [diff] [blame] | 251 | bt_status_t (*write_descriptor)( int conn_id, uint16_t handle, |
Pavlin Radoslavov | 44d57d4 | 2016-12-09 17:55:30 -0800 | [diff] [blame] | 252 | int auth_req, std::vector<uint8_t> value); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 253 | |
| 254 | /** Execute a prepared write operation */ |
| 255 | bt_status_t (*execute_write)(int conn_id, int execute); |
| 256 | |
| 257 | /** |
| 258 | * Register to receive notifications or indications for a given |
| 259 | * characteristic |
| 260 | */ |
| 261 | bt_status_t (*register_for_notification)( int client_if, |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 262 | const RawAddress& bd_addr, uint16_t handle); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 263 | |
| 264 | /** Deregister a previous request for notifications/indications */ |
| 265 | bt_status_t (*deregister_for_notification)( int client_if, |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 266 | const RawAddress& bd_addr, uint16_t handle); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 267 | |
| 268 | /** Request RSSI for a given remote device */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 269 | bt_status_t (*read_remote_rssi)(int client_if, const RawAddress& bd_addr); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 270 | |
| 271 | /** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 272 | int (*get_device_type)(const RawAddress &bd_addr); |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 273 | |
Andre Eisenbach | 8a4b61a | 2014-03-25 06:30:05 -0700 | [diff] [blame] | 274 | /** Configure the MTU for a given connection */ |
| 275 | bt_status_t (*configure_mtu)(int conn_id, int mtu); |
| 276 | |
Andre Eisenbach | da4eaca | 2014-07-16 22:58:36 -0700 | [diff] [blame] | 277 | /** Request a connection parameter update */ |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 278 | bt_status_t (*conn_parameter_update)(const RawAddress& bd_addr, int min_interval, |
Andre Eisenbach | da4eaca | 2014-07-16 22:58:36 -0700 | [diff] [blame] | 279 | int max_interval, int latency, int timeout); |
| 280 | |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 281 | bt_status_t (*set_preferred_phy)(const RawAddress& bd_addr, uint8_t tx_phy, |
Jakub Pawlowski | f3eb558 | 2017-03-22 19:09:19 -0700 | [diff] [blame] | 282 | uint8_t rx_phy, uint16_t phy_options); |
| 283 | |
| 284 | bt_status_t (*read_phy)( |
Jakub Pawlowski | 5a85200 | 2017-06-24 17:33:20 -0700 | [diff] [blame] | 285 | const RawAddress& bd_addr, |
Jakub Pawlowski | f3eb558 | 2017-03-22 19:09:19 -0700 | [diff] [blame] | 286 | base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> |
| 287 | cb); |
| 288 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 289 | /** Test mode interface */ |
Jakub Pawlowski | 37cb8d7 | 2017-06-21 09:55:03 -0700 | [diff] [blame] | 290 | bt_status_t (*test_command)( int command, const btgatt_test_params_t& params); |
Ganesh Ganapathi Batta | f9f4d10 | 2014-04-18 10:02:49 -0700 | [diff] [blame] | 291 | |
Jakub Pawlowski | f2e1352 | 2016-01-21 23:40:51 -0800 | [diff] [blame] | 292 | /** Get gatt db content */ |
| 293 | bt_status_t (*get_gatt_db)( int conn_id); |
| 294 | |
Ganesh Ganapathi Batta | fefb334 | 2013-02-05 15:23:45 -0800 | [diff] [blame] | 295 | } btgatt_client_interface_t; |
| 296 | |
| 297 | __END_DECLS |
| 298 | |
| 299 | #endif /* ANDROID_INCLUDE_BT_GATT_CLIENT_H */ |