• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19 import android.app.PendingIntent;
20 import android.bluetooth.BluetoothDevice;
21 import android.bluetooth.BluetoothGattService;
22 import android.bluetooth.le.AdvertiseSettings;
23 import android.bluetooth.le.AdvertiseData;
24 import android.bluetooth.le.AdvertisingSetParameters;
25 import android.bluetooth.le.PeriodicAdvertisingParameters;
26 import android.bluetooth.le.ScanFilter;
27 import android.bluetooth.le.ScanResult;
28 import android.bluetooth.le.ScanSettings;
29 import android.bluetooth.le.ResultStorageDescriptor;
30 import android.os.ParcelUuid;
31 import android.os.WorkSource;
32 
33 import android.bluetooth.IBluetoothGattCallback;
34 import android.bluetooth.IBluetoothGattServerCallback;
35 import android.bluetooth.le.IAdvertisingSetCallback;
36 import android.bluetooth.le.IPeriodicAdvertisingCallback;
37 import android.bluetooth.le.IScannerCallback;
38 
39 /**
40  * API for interacting with BLE / GATT
41  * @hide
42  */
43 interface IBluetoothGatt {
getDevicesMatchingConnectionStates(in int[] states)44     List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
45 
registerScanner(in IScannerCallback callback, in WorkSource workSource)46     void registerScanner(in IScannerCallback callback, in WorkSource workSource);
unregisterScanner(in int scannerId)47     void unregisterScanner(in int scannerId);
startScan(in int scannerId, in ScanSettings settings, in List<ScanFilter> filters, in List scanStorages, in String callingPackage)48     void startScan(in int scannerId, in ScanSettings settings, in List<ScanFilter> filters,
49                    in List scanStorages, in String callingPackage);
startScanForIntent(in PendingIntent intent, in ScanSettings settings, in List<ScanFilter> filters, in String callingPackage)50     void startScanForIntent(in PendingIntent intent, in ScanSettings settings, in List<ScanFilter> filters,
51                             in String callingPackage);
stopScanForIntent(in PendingIntent intent, in String callingPackage)52     void stopScanForIntent(in PendingIntent intent, in String callingPackage);
stopScan(in int scannerId)53     void stopScan(in int scannerId);
flushPendingBatchResults(in int scannerId)54     void flushPendingBatchResults(in int scannerId);
55 
startAdvertisingSet(in AdvertisingSetParameters parameters, in AdvertiseData advertiseData, in AdvertiseData scanResponse, in PeriodicAdvertisingParameters periodicParameters, in AdvertiseData periodicData, in int duration, in int maxExtAdvEvents, in IAdvertisingSetCallback callback)56     void startAdvertisingSet(in AdvertisingSetParameters parameters, in AdvertiseData advertiseData,
57                                 in AdvertiseData scanResponse, in PeriodicAdvertisingParameters periodicParameters,
58                                 in AdvertiseData periodicData, in int duration, in int maxExtAdvEvents,
59                                 in IAdvertisingSetCallback callback);
stopAdvertisingSet(in IAdvertisingSetCallback callback)60     void stopAdvertisingSet(in IAdvertisingSetCallback callback);
61 
getOwnAddress(in int advertiserId)62     void getOwnAddress(in int advertiserId);
enableAdvertisingSet(in int advertiserId, in boolean enable, in int duration, in int maxExtAdvEvents)63     void enableAdvertisingSet(in int advertiserId, in boolean enable, in int duration, in int maxExtAdvEvents);
setAdvertisingData(in int advertiserId, in AdvertiseData data)64     void setAdvertisingData(in int advertiserId, in AdvertiseData data);
setScanResponseData(in int advertiserId, in AdvertiseData data)65     void setScanResponseData(in int advertiserId, in AdvertiseData data);
setAdvertisingParameters(in int advertiserId, in AdvertisingSetParameters parameters)66     void setAdvertisingParameters(in int advertiserId, in AdvertisingSetParameters parameters);
setPeriodicAdvertisingParameters(in int advertiserId, in PeriodicAdvertisingParameters parameters)67     void setPeriodicAdvertisingParameters(in int advertiserId, in PeriodicAdvertisingParameters parameters);
setPeriodicAdvertisingData(in int advertiserId, in AdvertiseData data)68     void setPeriodicAdvertisingData(in int advertiserId, in AdvertiseData data);
setPeriodicAdvertisingEnable(in int advertiserId, in boolean enable)69     void setPeriodicAdvertisingEnable(in int advertiserId, in boolean enable);
70 
registerSync(in ScanResult scanResult, in int skip, in int timeout, in IPeriodicAdvertisingCallback callback)71     void registerSync(in ScanResult scanResult, in int skip, in int timeout, in IPeriodicAdvertisingCallback callback);
unregisterSync(in IPeriodicAdvertisingCallback callback)72     void unregisterSync(in IPeriodicAdvertisingCallback callback);
73 
registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback)74     void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback);
75 
unregisterClient(in int clientIf)76     void unregisterClient(in int clientIf);
clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport, in boolean opportunistic, in int phy)77     void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport, in boolean opportunistic, in int phy);
clientDisconnect(in int clientIf, in String address)78     void clientDisconnect(in int clientIf, in String address);
clientSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions)79     void clientSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions);
clientReadPhy(in int clientIf, in String address)80     void clientReadPhy(in int clientIf, in String address);
refreshDevice(in int clientIf, in String address)81     void refreshDevice(in int clientIf, in String address);
discoverServices(in int clientIf, in String address)82     void discoverServices(in int clientIf, in String address);
discoverServiceByUuid(in int clientIf, in String address, in ParcelUuid uuid)83     void discoverServiceByUuid(in int clientIf, in String address, in ParcelUuid uuid);
readCharacteristic(in int clientIf, in String address, in int handle, in int authReq)84     void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq);
readUsingCharacteristicUuid(in int clientIf, in String address, in ParcelUuid uuid, in int startHandle, in int endHandle, in int authReq)85     void readUsingCharacteristicUuid(in int clientIf, in String address, in ParcelUuid uuid,
86                            in int startHandle, in int endHandle, in int authReq);
writeCharacteristic(in int clientIf, in String address, in int handle, in int writeType, in int authReq, in byte[] value)87     void writeCharacteristic(in int clientIf, in String address, in int handle,
88                             in int writeType, in int authReq, in byte[] value);
readDescriptor(in int clientIf, in String address, in int handle, in int authReq)89     void readDescriptor(in int clientIf, in String address, in int handle, in int authReq);
writeDescriptor(in int clientIf, in String address, in int handle, in int authReq, in byte[] value)90     void writeDescriptor(in int clientIf, in String address, in int handle,
91                             in int authReq, in byte[] value);
registerForNotification(in int clientIf, in String address, in int handle, in boolean enable)92     void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable);
beginReliableWrite(in int clientIf, in String address)93     void beginReliableWrite(in int clientIf, in String address);
endReliableWrite(in int clientIf, in String address, in boolean execute)94     void endReliableWrite(in int clientIf, in String address, in boolean execute);
readRemoteRssi(in int clientIf, in String address)95     void readRemoteRssi(in int clientIf, in String address);
configureMTU(in int clientIf, in String address, in int mtu)96     void configureMTU(in int clientIf, in String address, in int mtu);
connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority)97     void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority);
98 
registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback)99     void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback);
unregisterServer(in int serverIf)100     void unregisterServer(in int serverIf);
serverConnect(in int serverIf, in String address, in boolean isDirect, in int transport)101     void serverConnect(in int serverIf, in String address, in boolean isDirect, in int transport);
serverDisconnect(in int serverIf, in String address)102     void serverDisconnect(in int serverIf, in String address);
serverSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions)103     void serverSetPreferredPhy(in int clientIf, in String address, in int txPhy, in int rxPhy, in int phyOptions);
serverReadPhy(in int clientIf, in String address)104     void serverReadPhy(in int clientIf, in String address);
addService(in int serverIf, in BluetoothGattService service)105     void addService(in int serverIf, in BluetoothGattService service);
removeService(in int serverIf, in int handle)106     void removeService(in int serverIf, in int handle);
clearServices(in int serverIf)107     void clearServices(in int serverIf);
sendResponse(in int serverIf, in String address, in int requestId, in int status, in int offset, in byte[] value)108     void sendResponse(in int serverIf, in String address, in int requestId,
109                             in int status, in int offset, in byte[] value);
sendNotification(in int serverIf, in String address, in int handle, in boolean confirm, in byte[] value)110     void sendNotification(in int serverIf, in String address, in int handle,
111                             in boolean confirm, in byte[] value);
disconnectAll()112     void disconnectAll();
unregAll()113     void unregAll();
numHwTrackFiltersAvailable()114     int numHwTrackFiltersAvailable();
115 }
116