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; |
Jakub Pawlowski | 5324a14 | 2017-01-10 06:15:54 -0800 | [diff] [blame^] | 23 | import android.bluetooth.le.AdvertisingSetParameters; |
| 24 | import android.bluetooth.le.PeriodicAdvertisingParameters; |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 25 | import android.bluetooth.le.ScanFilter; |
Jakub Pawlowski | a48e037 | 2017-01-16 07:21:01 -0800 | [diff] [blame] | 26 | import android.bluetooth.le.ScanResult; |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 27 | import android.bluetooth.le.ScanSettings; |
Wei Wang | 0d0df3c | 2014-07-30 15:19:08 -0700 | [diff] [blame] | 28 | import android.bluetooth.le.ResultStorageDescriptor; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 29 | import android.os.ParcelUuid; |
Adam Lesinski | 6771d62 | 2016-01-15 18:14:47 -0800 | [diff] [blame] | 30 | import android.os.WorkSource; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 31 | |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 32 | import android.bluetooth.IBluetoothGattCallbackExt; |
| 33 | import android.bluetooth.IBluetoothGattServerCallbackExt; |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 34 | import android.bluetooth.le.IAdvertiserCallback; |
Jakub Pawlowski | 5324a14 | 2017-01-10 06:15:54 -0800 | [diff] [blame^] | 35 | import android.bluetooth.le.IAdvertisingSetCallback; |
Jakub Pawlowski | a48e037 | 2017-01-16 07:21:01 -0800 | [diff] [blame] | 36 | import android.bluetooth.le.IPeriodicAdvertisingCallback; |
Jakub Pawlowski | 1b49e6e | 2016-10-26 13:05:30 -0700 | [diff] [blame] | 37 | import android.bluetooth.le.IScannerCallback; |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * API for interacting with BLE / GATT |
| 41 | * @hide |
| 42 | */ |
| 43 | interface IBluetoothGatt { |
| 44 | List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states); |
| 45 | |
Jakub Pawlowski | 1b49e6e | 2016-10-26 13:05:30 -0700 | [diff] [blame] | 46 | void registerScanner(in IScannerCallback callback); |
| 47 | void unregisterScanner(in int scannerId); |
| 48 | void startScan(in int scannerId, in ScanSettings settings, in List<ScanFilter> filters, |
| 49 | in WorkSource workSource, in List scanStorages, in String callingPackage); |
| 50 | void stopScan(in int scannerId); |
| 51 | void flushPendingBatchResults(in int scannerId); |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 52 | |
| 53 | void registerAdvertiser(in IAdvertiserCallback callback); |
| 54 | void unregisterAdvertiser(in int advertiserId); |
| 55 | void startMultiAdvertising(in int advertiserId, |
Wei Wang | af74e66 | 2014-07-09 14:03:42 -0700 | [diff] [blame] | 56 | in AdvertiseData advertiseData, |
| 57 | in AdvertiseData scanResponse, |
Wei Wang | 6d81118 | 2014-05-22 12:10:25 -0700 | [diff] [blame] | 58 | in AdvertiseSettings settings); |
Jakub Pawlowski | a480f7f | 2016-08-05 06:40:31 -0700 | [diff] [blame] | 59 | void stopMultiAdvertising(in int advertiserId); |
| 60 | |
Jakub Pawlowski | 5324a14 | 2017-01-10 06:15:54 -0800 | [diff] [blame^] | 61 | void startAdvertisingSet(in AdvertisingSetParameters parameters, in AdvertiseData advertiseData, |
| 62 | in AdvertiseData scanResponse, in PeriodicAdvertisingParameters periodicParameters, |
| 63 | in AdvertiseData periodicData, in IAdvertisingSetCallback callback); |
| 64 | void stopAdvertisingSet(in IAdvertisingSetCallback callback); |
| 65 | |
| 66 | void enableAdverisingSet(in int advertiserId, in boolean enable); |
| 67 | void setAdvertisingData(in int advertiserId, in AdvertiseData data); |
| 68 | void setScanResponseData(in int advertiserId, in AdvertiseData data); |
| 69 | void setAdvertisingParameters(in int advertiserId, in AdvertisingSetParameters parameters); |
| 70 | void setPeriodicAdvertisingParameters(in int advertiserId, in PeriodicAdvertisingParameters parameters); |
| 71 | void setPeriodicAdvertisingData(in int advertiserId, in AdvertiseData data); |
| 72 | void periodicAdvertisingEnable(in int advertiserId, in boolean enable); |
| 73 | |
Jakub Pawlowski | a48e037 | 2017-01-16 07:21:01 -0800 | [diff] [blame] | 74 | void registerSync(in ScanResult scanResult, in int skip, in int timeout, in IPeriodicAdvertisingCallback callback); |
| 75 | void unregisterSync(in IPeriodicAdvertisingCallback callback); |
| 76 | |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 77 | void registerClient(in ParcelUuid appId, in IBluetoothGattCallbackExt callback); |
Jakub Pawlowski | 5324a14 | 2017-01-10 06:15:54 -0800 | [diff] [blame^] | 78 | |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 79 | void unregisterClient(in int clientIf); |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 80 | void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport, in int phy); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 81 | void clientDisconnect(in int clientIf, in String address); |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 82 | void clientSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions); |
| 83 | void clientReadPhy(in int clientIf, in String address); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 84 | void refreshDevice(in int clientIf, in String address); |
| 85 | void discoverServices(in int clientIf, in String address); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 86 | void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq); |
| 87 | void writeCharacteristic(in int clientIf, in String address, in int handle, |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 88 | in int writeType, in int authReq, in byte[] value); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 89 | void readDescriptor(in int clientIf, in String address, in int handle, in int authReq); |
| 90 | void writeDescriptor(in int clientIf, in String address, in int handle, |
Jakub Pawlowski | 8e970d6 | 2016-03-30 22:58:17 -0700 | [diff] [blame] | 91 | in int authReq, in byte[] value); |
Jakub Pawlowski | a9e27ec | 2016-03-17 16:00:16 -0700 | [diff] [blame] | 92 | 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] | 93 | void beginReliableWrite(in int clientIf, in String address); |
| 94 | void endReliableWrite(in int clientIf, in String address, in boolean execute); |
| 95 | void readRemoteRssi(in int clientIf, in String address); |
Andre Eisenbach | 580b0a1 | 2014-03-25 06:31:50 -0700 | [diff] [blame] | 96 | void configureMTU(in int clientIf, in String address, in int mtu); |
Andre Eisenbach | 6ce4db0 | 2014-07-16 23:02:42 -0700 | [diff] [blame] | 97 | void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 98 | |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 99 | void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallbackExt callback); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 100 | void unregisterServer(in int serverIf); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 101 | 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] | 102 | void serverDisconnect(in int serverIf, in String address); |
Jakub Pawlowski | db5a87d | 2017-02-02 08:07:12 -0800 | [diff] [blame] | 103 | void serverSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions); |
| 104 | void serverReadPhy(in int clientIf, in String address); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 105 | void addService(in int serverIf, in BluetoothGattService service); |
| 106 | void removeService(in int serverIf, in int handle); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 107 | void clearServices(in int serverIf); |
| 108 | void sendResponse(in int serverIf, in String address, in int requestId, |
| 109 | in int status, in int offset, in byte[] value); |
Jakub Pawlowski | d75f512 | 2016-04-01 07:51:45 -0700 | [diff] [blame] | 110 | void sendNotification(in int serverIf, in String address, in int handle, |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 111 | in boolean confirm, in byte[] value); |
Nitin Arora | 6ddbb5e | 2015-03-02 15:03:51 -0800 | [diff] [blame] | 112 | void disconnectAll(); |
| 113 | void unregAll(); |
Prerepa Viswanadham | db1dbb8 | 2015-04-09 17:14:50 -0700 | [diff] [blame] | 114 | int numHwTrackFiltersAvailable(); |
Ganesh Ganapathi Batta | 9908112 | 2013-02-05 15:28:33 -0800 | [diff] [blame] | 115 | } |