blob: adb07df2977028b54ed83b946c92adce46ba88bf [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;
Wei Wang6d811182014-05-22 12:10:25 -070020import android.bluetooth.le.AdvertiseSettings;
Wei Wangaf74e662014-07-09 14:03:42 -070021import android.bluetooth.le.AdvertiseData;
Wei Wang6d811182014-05-22 12:10:25 -070022import android.bluetooth.le.ScanFilter;
23import android.bluetooth.le.ScanSettings;
Wei Wang0d0df3c2014-07-30 15:19:08 -070024import android.bluetooth.le.ResultStorageDescriptor;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080025import android.os.ParcelUuid;
Adam Lesinski6771d622016-01-15 18:14:47 -080026import android.os.WorkSource;
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080027
28import android.bluetooth.IBluetoothGattCallback;
29import android.bluetooth.IBluetoothGattServerCallback;
30
31/**
32 * API for interacting with BLE / GATT
33 * @hide
34 */
35interface IBluetoothGatt {
36 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
37
Wei Wangc3059cc2014-07-23 23:34:00 -070038 void startScan(in int appIf, in boolean isServer, in ScanSettings settings,
Adam Lesinski6771d622016-01-15 18:14:47 -080039 in List<ScanFilter> filters, in WorkSource workSource, in List scanStorages,
40 in String callingPackage);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080041 void stopScan(in int appIf, in boolean isServer);
Wei Wang9fb17912014-07-01 15:10:06 -070042 void flushPendingBatchResults(in int appIf, in boolean isServer);
Wei Wangab39cb72014-05-20 17:59:36 -070043 void startMultiAdvertising(in int appIf,
Wei Wangaf74e662014-07-09 14:03:42 -070044 in AdvertiseData advertiseData,
45 in AdvertiseData scanResponse,
Wei Wang6d811182014-05-22 12:10:25 -070046 in AdvertiseSettings settings);
Wei Wangadf6aff2014-05-20 06:30:20 +000047 void stopMultiAdvertising(in int appIf);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080048 void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback);
49 void unregisterClient(in int clientIf);
Ganesh Ganapathi Battab88fa822014-04-18 10:00:40 -070050 void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080051 void clientDisconnect(in int clientIf, in String address);
52 void refreshDevice(in int clientIf, in String address);
53 void discoverServices(in int clientIf, in String address);
Jakub Pawlowskic9d13c32016-03-17 16:00:16 -070054 void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq);
55 void writeCharacteristic(in int clientIf, in String address, in int handle,
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080056 in int writeType, in int authReq, in byte[] value);
Jakub Pawlowskic9d13c32016-03-17 16:00:16 -070057 void readDescriptor(in int clientIf, in String address, in int handle, in int authReq);
58 void writeDescriptor(in int clientIf, in String address, in int handle,
Andre Eisenbach25b9cf92013-07-08 23:58:16 -070059 in int writeType, in int authReq, in byte[] value);
Jakub Pawlowskic9d13c32016-03-17 16:00:16 -070060 void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080061 void beginReliableWrite(in int clientIf, in String address);
62 void endReliableWrite(in int clientIf, in String address, in boolean execute);
63 void readRemoteRssi(in int clientIf, in String address);
Andre Eisenbach580b0a12014-03-25 06:31:50 -070064 void configureMTU(in int clientIf, in String address, in int mtu);
Andre Eisenbach6ce4db02014-07-16 23:02:42 -070065 void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080066
67 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback);
68 void unregisterServer(in int serverIf);
Ganesh Ganapathi Battab88fa822014-04-18 10:00:40 -070069 void serverConnect(in int servertIf, in String address, in boolean isDirect, in int transport);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080070 void serverDisconnect(in int serverIf, in String address);
71 void beginServiceDeclaration(in int serverIf, in int srvcType,
72 in int srvcInstanceId, in int minHandles,
Wei Wang86b3fa62013-10-29 21:05:37 -070073 in ParcelUuid srvcId, boolean advertisePreferred);
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080074 void addIncludedService(in int serverIf, in int srvcType,
75 in int srvcInstanceId, in ParcelUuid srvcId);
76 void addCharacteristic(in int serverIf, in ParcelUuid charId,
77 in int properties, in int permissions);
78 void addDescriptor(in int serverIf, in ParcelUuid descId,
79 in int permissions);
80 void endServiceDeclaration(in int serverIf);
81 void removeService(in int serverIf, in int srvcType,
82 in int srvcInstanceId, in ParcelUuid srvcId);
83 void clearServices(in int serverIf);
84 void sendResponse(in int serverIf, in String address, in int requestId,
85 in int status, in int offset, in byte[] value);
86 void sendNotification(in int serverIf, in String address, in int srvcType,
87 in int srvcInstanceId, in ParcelUuid srvcId,
88 in int charInstanceId, in ParcelUuid charId,
89 in boolean confirm, in byte[] value);
Nitin Arora6ddbb5e2015-03-02 15:03:51 -080090 void disconnectAll();
91 void unregAll();
Prerepa Viswanadhamdb1dbb82015-04-09 17:14:50 -070092 int numHwTrackFiltersAvailable();
Ganesh Ganapathi Batta99081122013-02-05 15:28:33 -080093}