blob: aa2291e072dd4ecfc0315462959787104054be4a [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;
Wei Wang6d811182014-05-22 12:10:25 -070023import android.bluetooth.le.ScanFilter;
24import android.bluetooth.le.ScanSettings;
Wei Wang0d0df3c2014-07-30 15:19:08 -070025import android.bluetooth.le.ResultStorageDescriptor;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080026import android.os.ParcelUuid;
Adam Lesinski6771d622016-01-15 18:14:47 -080027import android.os.WorkSource;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080028
29import android.bluetooth.IBluetoothGattCallback;
30import android.bluetooth.IBluetoothGattServerCallback;
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070031import android.bluetooth.le.IAdvertiserCallback;
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070032import android.bluetooth.le.IScannerCallback;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080033
34/**
35 * API for interacting with BLE / GATT
36 * @hide
37 */
38interface IBluetoothGatt {
39 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
40
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070041 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 Pawlowskia480f7f2016-08-05 06:40:31 -070047
48 void registerAdvertiser(in IAdvertiserCallback callback);
49 void unregisterAdvertiser(in int advertiserId);
50 void startMultiAdvertising(in int advertiserId,
Wei Wangaf74e662014-07-09 14:03:42 -070051 in AdvertiseData advertiseData,
52 in AdvertiseData scanResponse,
Wei Wang6d811182014-05-22 12:10:25 -070053 in AdvertiseSettings settings);
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070054 void stopMultiAdvertising(in int advertiserId);
55
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080056 void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback);
57 void unregisterClient(in int clientIf);
Ganesh Ganapathi Battab88fa822014-04-18 10:00:40 -070058 void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080059 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 Pawlowskia9e27ec2016-03-17 16:00:16 -070062 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 Batta99081122013-02-05 15:28:33 -080064 in int writeType, in int authReq, in byte[] value);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070065 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 Pawlowski8e970d62016-03-30 22:58:17 -070067 in int authReq, in byte[] value);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070068 void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080069 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 Eisenbach580b0a12014-03-25 06:31:50 -070072 void configureMTU(in int clientIf, in String address, in int mtu);
Andre Eisenbach6ce4db02014-07-16 23:02:42 -070073 void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080074
75 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback);
76 void unregisterServer(in int serverIf);
Jakub Pawlowskid75f5122016-04-01 07:51:45 -070077 void serverConnect(in int serverIf, in String address, in boolean isDirect, in int transport);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080078 void serverDisconnect(in int serverIf, in String address);
Jakub Pawlowskid75f5122016-04-01 07:51:45 -070079 void addService(in int serverIf, in BluetoothGattService service);
80 void removeService(in int serverIf, in int handle);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080081 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 Pawlowskid75f5122016-04-01 07:51:45 -070084 void sendNotification(in int serverIf, in String address, in int handle,
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080085 in boolean confirm, in byte[] value);
Nitin Arora6ddbb5e2015-03-02 15:03:51 -080086 void disconnectAll();
87 void unregAll();
Prerepa Viswanadhamdb1dbb82015-04-09 17:14:50 -070088 int numHwTrackFiltersAvailable();
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080089}