blob: 6f6655522ca737cb4ee31b241f749527efbff7de [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
Amith Yamasani461111b2017-04-13 17:46:53 -070019import android.app.PendingIntent;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080020import android.bluetooth.BluetoothDevice;
Jakub Pawlowskid75f5122016-04-01 07:51:45 -070021import android.bluetooth.BluetoothGattService;
Wei Wang6d811182014-05-22 12:10:25 -070022import android.bluetooth.le.AdvertiseSettings;
Wei Wangaf74e662014-07-09 14:03:42 -070023import android.bluetooth.le.AdvertiseData;
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080024import android.bluetooth.le.AdvertisingSetParameters;
25import android.bluetooth.le.PeriodicAdvertisingParameters;
Wei Wang6d811182014-05-22 12:10:25 -070026import android.bluetooth.le.ScanFilter;
Jakub Pawlowskiac7fcfa2017-01-16 07:21:01 -080027import android.bluetooth.le.ScanResult;
Wei Wang6d811182014-05-22 12:10:25 -070028import android.bluetooth.le.ScanSettings;
Wei Wang0d0df3c2014-07-30 15:19:08 -070029import android.bluetooth.le.ResultStorageDescriptor;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080030import android.os.ParcelUuid;
Adam Lesinski6771d622016-01-15 18:14:47 -080031import android.os.WorkSource;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080032
Jakub Pawlowskid7116be2017-03-27 12:14:40 -070033import android.bluetooth.IBluetoothGattCallback;
34import android.bluetooth.IBluetoothGattServerCallback;
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070035import android.bluetooth.le.IAdvertiserCallback;
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080036import android.bluetooth.le.IAdvertisingSetCallback;
Jakub Pawlowskiac7fcfa2017-01-16 07:21:01 -080037import android.bluetooth.le.IPeriodicAdvertisingCallback;
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070038import android.bluetooth.le.IScannerCallback;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080039
40/**
41 * API for interacting with BLE / GATT
42 * @hide
43 */
44interface IBluetoothGatt {
45 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
46
Jakub Pawlowski1b49e6e2016-10-26 13:05:30 -070047 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 Yamasani461111b2017-04-13 17:46:53 -070051 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 Pawlowski1b49e6e2016-10-26 13:05:30 -070054 void stopScan(in int scannerId);
55 void flushPendingBatchResults(in int scannerId);
Jakub Pawlowskia480f7f2016-08-05 06:40:31 -070056
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080057 void startAdvertisingSet(in AdvertisingSetParameters parameters, in AdvertiseData advertiseData,
58 in AdvertiseData scanResponse, in PeriodicAdvertisingParameters periodicParameters,
Jakub Pawlowski260846b2017-03-30 19:10:08 -070059 in AdvertiseData periodicData, in int duration, in int maxExtAdvEvents,
60 in IAdvertisingSetCallback callback);
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080061 void stopAdvertisingSet(in IAdvertisingSetCallback callback);
62
Jakub Pawlowski4bc4a442017-04-19 06:52:08 -070063 void getOwnAddress(in int advertiserId);
Jakub Pawlowski260846b2017-03-30 19:10:08 -070064 void enableAdvertisingSet(in int advertiserId, in boolean enable, in int duration, in int maxExtAdvEvents);
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080065 void setAdvertisingData(in int advertiserId, in AdvertiseData data);
66 void setScanResponseData(in int advertiserId, in AdvertiseData data);
67 void setAdvertisingParameters(in int advertiserId, in AdvertisingSetParameters parameters);
68 void setPeriodicAdvertisingParameters(in int advertiserId, in PeriodicAdvertisingParameters parameters);
69 void setPeriodicAdvertisingData(in int advertiserId, in AdvertiseData data);
Jakub Pawlowski6a55da92017-03-17 15:33:27 -070070 void setPeriodicAdvertisingEnable(in int advertiserId, in boolean enable);
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080071
Jakub Pawlowskiac7fcfa2017-01-16 07:21:01 -080072 void registerSync(in ScanResult scanResult, in int skip, in int timeout, in IPeriodicAdvertisingCallback callback);
73 void unregisterSync(in IPeriodicAdvertisingCallback callback);
74
Jakub Pawlowskid7116be2017-03-27 12:14:40 -070075 void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback);
Jakub Pawlowskia9d1a322017-01-10 06:15:54 -080076
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080077 void unregisterClient(in int clientIf);
Jakub Pawlowski409cee62017-02-02 08:07:12 -080078 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 -080079 void clientDisconnect(in int clientIf, in String address);
Jakub Pawlowski409cee62017-02-02 08:07:12 -080080 void clientSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions);
81 void clientReadPhy(in int clientIf, in String address);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080082 void refreshDevice(in int clientIf, in String address);
83 void discoverServices(in int clientIf, in String address);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070084 void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq);
Jakub Pawlowskide748912017-04-14 07:21:20 -070085 void readUsingCharacteristicUuid(in int clientIf, in String address, in ParcelUuid uuid,
86 in int startHandle, in int endHandle, in int authReq);
Jakub Pawlowskia9e27ec2016-03-17 16:00:16 -070087 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 Pawlowskid7116be2017-03-27 12:14:40 -070099 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback 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 Pawlowski409cee62017-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}