Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -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 | package android.bluetooth; |
| 18 | |
| 19 | import android.bluetooth.BluetoothDevice; |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 20 | import android.bluetooth.BluetoothGattService; |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 21 | import android.bluetooth.le.AdvertiseSettings; |
Wei Wang | af74e66 | 2014-07-09 14:03:42 -0700 | [diff] [blame] | 22 | import android.bluetooth.le.AdvertiseData; |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 23 | import android.bluetooth.le.ScanFilter; |
| 24 | import android.bluetooth.le.ScanSettings; |
Wei Wang | 0d0df3c | 2014-07-30 15:19:08 -0700 | [diff] [blame] | 25 | import android.bluetooth.le.ResultStorageDescriptor; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 26 | import android.os.ParcelUuid; |
Adam Lesinski | 6771d62 | 2016-01-15 18:14:47 -0800 | [diff] [blame] | 27 | import android.os.WorkSource; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 28 | |
| 29 | import android.bluetooth.IBluetoothGattCallback; |
| 30 | import android.bluetooth.IBluetoothGattServerCallback; |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 31 | import android.bluetooth.le.IAdvertiserCallback; |
Jakub Pawlowski | 1b49e6e | 2016-10-26 13:05:30 -0700 | [diff] [blame] | 32 | import android.bluetooth.le.IScannerCallback; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * API for interacting with BLE / GATT |
| 36 | * @hide |
| 37 | */ |
| 38 | interface IBluetoothGatt { |
| 39 | List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states); |
| 40 | |
Jakub Pawlowski | 1b49e6e | 2016-10-26 13:05:30 -0700 | [diff] [blame] | 41 | void registerScanner(in IScannerCallback callback); |
| 42 | void unregisterScanner(in int scannerId); |
| 43 | void startScan(in int scannerId, in ScanSettings settings, in List<ScanFilter> filters, |
| 44 | in WorkSource workSource, in List scanStorages, in String callingPackage); |
| 45 | void stopScan(in int scannerId); |
| 46 | void flushPendingBatchResults(in int scannerId); |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 47 | |
| 48 | void registerAdvertiser(in IAdvertiserCallback callback); |
| 49 | void unregisterAdvertiser(in int advertiserId); |
| 50 | void startMultiAdvertising(in int advertiserId, |
Wei Wang | af74e66 | 2014-07-09 14:03:42 -0700 | [diff] [blame] | 51 | in AdvertiseData advertiseData, |
| 52 | in AdvertiseData scanResponse, |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 53 | in AdvertiseSettings settings); |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 54 | void stopMultiAdvertising(in int advertiserId); |
| 55 | |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 56 | void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback); |
| 57 | void unregisterClient(in int clientIf); |
Ganesh Ganapathi Batta | b88fa82 | 2014-04-18 10:00:40 -0700 | [diff] [blame] | 58 | void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 59 | void clientDisconnect(in int clientIf, in String address); |
| 60 | void refreshDevice(in int clientIf, in String address); |
| 61 | void discoverServices(in int clientIf, in String address); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 62 | void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq); |
| 63 | void writeCharacteristic(in int clientIf, in String address, in int handle, |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 64 | in int writeType, in int authReq, in byte[] value); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 65 | void readDescriptor(in int clientIf, in String address, in int handle, in int authReq); |
| 66 | void writeDescriptor(in int clientIf, in String address, in int handle, |
Jakub Pawlowski | 8e970d6 | 2016-03-30 22:58:17 -0700 | [diff] [blame] | 67 | in int authReq, in byte[] value); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 68 | void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 69 | void beginReliableWrite(in int clientIf, in String address); |
| 70 | void endReliableWrite(in int clientIf, in String address, in boolean execute); |
| 71 | void readRemoteRssi(in int clientIf, in String address); |
Andre Eisenbach | 580b0a1 | 2014-03-25 06:31:50 -0700 | [diff] [blame] | 72 | void configureMTU(in int clientIf, in String address, in int mtu); |
Andre Eisenbach | 6ce4db0 | 2014-07-16 23:02:42 -0700 | [diff] [blame] | 73 | void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 74 | |
| 75 | void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback); |
| 76 | void unregisterServer(in int serverIf); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 77 | void serverConnect(in int serverIf, in String address, in boolean isDirect, in int transport); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 78 | void serverDisconnect(in int serverIf, in String address); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 79 | void addService(in int serverIf, in BluetoothGattService service); |
| 80 | void removeService(in int serverIf, in int handle); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 81 | void clearServices(in int serverIf); |
| 82 | void sendResponse(in int serverIf, in String address, in int requestId, |
| 83 | in int status, in int offset, in byte[] value); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 84 | void sendNotification(in int serverIf, in String address, in int handle, |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 85 | in boolean confirm, in byte[] value); |
Nitin Arora | 6ddbb5e | 2015-03-02 15:03:51 -0800 | [diff] [blame] | 86 | void disconnectAll(); |
| 87 | void unregAll(); |
Prerepa Viswanadham | db1dbb8 | 2015-04-09 17:14:50 -0700 | [diff] [blame] | 88 | int numHwTrackFiltersAvailable(); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 89 | } |