blob: 33fedc718980b8b9acbbab9b03783876c0dafc1e [file] [log] [blame]
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -08001/*
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
17package android.bluetooth;
18
19import android.bluetooth.BluetoothDevice;
Jakub Pawlowskid75f5122016-04-01 07:51:45 -070020import android.bluetooth.BluetoothGattService;
Wei Wang6d811182014-05-22 12:10:25 -070021import android.bluetooth.le.AdvertiseSettings;
Wei Wangaf74e662014-07-09 14:03:42 -070022import android.bluetooth.le.AdvertiseData;
Jakub Pawlowski5324a142017-01-10 06:15:54 -080023import android.bluetooth.le.AdvertisingSetParameters;
24import android.bluetooth.le.PeriodicAdvertisingParameters;
Wei Wang6d811182014-05-22 12:10:25 -070025import android.bluetooth.le.ScanFilter;
Jakub Pawlowskia48e0372017-01-16 07:21:01 -080026import android.bluetooth.le.ScanResult;
Wei Wang6d811182014-05-22 12:10:25 -070027import android.bluetooth.le.ScanSettings;
Wei Wang0d0df3c2014-07-30 15:19:08 -070028import android.bluetooth.le.ResultStorageDescriptor;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080029import android.os.ParcelUuid;
Adam Lesinski6771d622016-01-15 18:14:47 -080030import android.os.WorkSource;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080031
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -080032import android.bluetooth.IBluetoothGattCallbackExt;
33import android.bluetooth.IBluetoothGattServerCallbackExt;
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070034import android.bluetooth.le.IAdvertiserCallback;
Jakub Pawlowski5324a142017-01-10 06:15:54 -080035import android.bluetooth.le.IAdvertisingSetCallback;
Jakub Pawlowskia48e0372017-01-16 07:21:01 -080036import android.bluetooth.le.IPeriodicAdvertisingCallback;
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070037import android.bluetooth.le.IScannerCallback;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080038
39/**
40 * API for interacting with BLE / GATT
41 * @hide
42 */
43interface IBluetoothGatt {
44 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
45
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070046 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 Pawlowskia480f7f2016-08-05 06:40:31 -070052
53 void registerAdvertiser(in IAdvertiserCallback callback);
54 void unregisterAdvertiser(in int advertiserId);
55 void startMultiAdvertising(in int advertiserId,
Wei Wangaf74e662014-07-09 14:03:42 -070056 in AdvertiseData advertiseData,
57 in AdvertiseData scanResponse,
Wei Wang6d811182014-05-22 12:10:25 -070058 in AdvertiseSettings settings);
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070059 void stopMultiAdvertising(in int advertiserId);
60
Jakub Pawlowski5324a142017-01-10 06:15:54 -080061 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 Pawlowskia48e0372017-01-16 07:21:01 -080074 void registerSync(in ScanResult scanResult, in int skip, in int timeout, in IPeriodicAdvertisingCallback callback);
75 void unregisterSync(in IPeriodicAdvertisingCallback callback);
76
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -080077 void registerClient(in ParcelUuid appId, in IBluetoothGattCallbackExt callback);
Jakub Pawlowski5324a142017-01-10 06:15:54 -080078
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080079 void unregisterClient(in int clientIf);
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -080080 void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport, in int phy);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080081 void clientDisconnect(in int clientIf, in String address);
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -080082 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 Batta99081122013-02-05 15:28:33 -080084 void refreshDevice(in int clientIf, in String address);
85 void discoverServices(in int clientIf, in String address);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070086 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 Batta99081122013-02-05 15:28:33 -080088 in int writeType, in int authReq, in byte[] value);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070089 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 Pawlowski8e970d62016-03-30 22:58:17 -070091 in int authReq, in byte[] value);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070092 void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080093 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 Eisenbach580b0a12014-03-25 06:31:50 -070096 void configureMTU(in int clientIf, in String address, in int mtu);
Andre Eisenbach6ce4db02014-07-16 23:02:42 -070097 void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080098
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -080099 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallbackExt callback);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -0800100 void unregisterServer(in int serverIf);
Jakub Pawlowskid75f5122016-04-01 07:51:45 -0700101 void serverConnect(in int serverIf, in String address, in boolean isDirect, in int transport);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -0800102 void serverDisconnect(in int serverIf, in String address);
Jakub Pawlowskidb5a87d2017-02-02 08:07:12 -0800103 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 Pawlowskid75f5122016-04-01 07:51:45 -0700105 void addService(in int serverIf, in BluetoothGattService service);
106 void removeService(in int serverIf, in int handle);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -0800107 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 Pawlowskid75f5122016-04-01 07:51:45 -0700110 void sendNotification(in int serverIf, in String address, in int handle,
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -0800111 in boolean confirm, in byte[] value);
Nitin Arora6ddbb5e2015-03-02 15:03:51 -0800112 void disconnectAll();
113 void unregAll();
Prerepa Viswanadhamdb1dbb82015-04-09 17:14:50 -0700114 int numHwTrackFiltersAvailable();
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -0800115}