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