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.bluetooth.BluetoothDevice; 20 import android.bluetooth.le.AdvertiseSettings; 21 import android.bluetooth.le.AdvertiseData; 22 import android.bluetooth.le.ScanFilter; 23 import android.bluetooth.le.ScanSettings; 24 import android.bluetooth.le.ResultStorageDescriptor; 25 import android.os.ParcelUuid; 26 import android.os.WorkSource; 27 28 import android.bluetooth.IBluetoothGattCallback; 29 import android.bluetooth.IBluetoothGattServerCallback; 30 31 /** 32 * API for interacting with BLE / GATT 33 * @hide 34 */ 35 interface IBluetoothGatt { getDevicesMatchingConnectionStates(in int[] states)36 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states); 37 startScan(in int appIf, in boolean isServer, in ScanSettings settings, in List<ScanFilter> filters, in WorkSource workSource, in List scanStorages, in String callingPackage)38 void startScan(in int appIf, in boolean isServer, in ScanSettings settings, 39 in List<ScanFilter> filters, in WorkSource workSource, in List scanStorages, 40 in String callingPackage); stopScan(in int appIf, in boolean isServer)41 void stopScan(in int appIf, in boolean isServer); flushPendingBatchResults(in int appIf, in boolean isServer)42 void flushPendingBatchResults(in int appIf, in boolean isServer); startMultiAdvertising(in int appIf, in AdvertiseData advertiseData, in AdvertiseData scanResponse, in AdvertiseSettings settings)43 void startMultiAdvertising(in int appIf, 44 in AdvertiseData advertiseData, 45 in AdvertiseData scanResponse, 46 in AdvertiseSettings settings); stopMultiAdvertising(in int appIf)47 void stopMultiAdvertising(in int appIf); registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback)48 void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback); unregisterClient(in int clientIf)49 void unregisterClient(in int clientIf); clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport)50 void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport); clientDisconnect(in int clientIf, in String address)51 void clientDisconnect(in int clientIf, in String address); refreshDevice(in int clientIf, in String address)52 void refreshDevice(in int clientIf, in String address); discoverServices(in int clientIf, in String address)53 void discoverServices(in int clientIf, in String address); readCharacteristic(in int clientIf, in String address, in int handle, in int authReq)54 void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq); writeCharacteristic(in int clientIf, in String address, in int handle, in int writeType, in int authReq, in byte[] value)55 void writeCharacteristic(in int clientIf, in String address, in int handle, 56 in int writeType, in int authReq, in byte[] value); readDescriptor(in int clientIf, in String address, in int handle, in int authReq)57 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 writeType, in int authReq, in byte[] value)58 void writeDescriptor(in int clientIf, in String address, in int handle, 59 in int writeType, in int authReq, in byte[] value); registerForNotification(in int clientIf, in String address, in int handle, in boolean enable)60 void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable); beginReliableWrite(in int clientIf, in String address)61 void beginReliableWrite(in int clientIf, in String address); endReliableWrite(in int clientIf, in String address, in boolean execute)62 void endReliableWrite(in int clientIf, in String address, in boolean execute); readRemoteRssi(in int clientIf, in String address)63 void readRemoteRssi(in int clientIf, in String address); configureMTU(in int clientIf, in String address, in int mtu)64 void configureMTU(in int clientIf, in String address, in int mtu); connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority)65 void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority); 66 registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback)67 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback); unregisterServer(in int serverIf)68 void unregisterServer(in int serverIf); serverConnect(in int servertIf, in String address, in boolean isDirect, in int transport)69 void serverConnect(in int servertIf, in String address, in boolean isDirect, in int transport); serverDisconnect(in int serverIf, in String address)70 void serverDisconnect(in int serverIf, in String address); beginServiceDeclaration(in int serverIf, in int srvcType, in int srvcInstanceId, in int minHandles, in ParcelUuid srvcId, boolean advertisePreferred)71 void beginServiceDeclaration(in int serverIf, in int srvcType, 72 in int srvcInstanceId, in int minHandles, 73 in ParcelUuid srvcId, boolean advertisePreferred); addIncludedService(in int serverIf, in int srvcType, in int srvcInstanceId, in ParcelUuid srvcId)74 void addIncludedService(in int serverIf, in int srvcType, 75 in int srvcInstanceId, in ParcelUuid srvcId); addCharacteristic(in int serverIf, in ParcelUuid charId, in int properties, in int permissions)76 void addCharacteristic(in int serverIf, in ParcelUuid charId, 77 in int properties, in int permissions); addDescriptor(in int serverIf, in ParcelUuid descId, in int permissions)78 void addDescriptor(in int serverIf, in ParcelUuid descId, 79 in int permissions); endServiceDeclaration(in int serverIf)80 void endServiceDeclaration(in int serverIf); removeService(in int serverIf, in int srvcType, in int srvcInstanceId, in ParcelUuid srvcId)81 void removeService(in int serverIf, in int srvcType, 82 in int srvcInstanceId, in ParcelUuid srvcId); clearServices(in int serverIf)83 void clearServices(in int serverIf); sendResponse(in int serverIf, in String address, in int requestId, in int status, in int offset, in byte[] value)84 void sendResponse(in int serverIf, in String address, in int requestId, 85 in int status, in int offset, in byte[] value); sendNotification(in int serverIf, in String address, in int srvcType, in int srvcInstanceId, in ParcelUuid srvcId, in int charInstanceId, in ParcelUuid charId, in boolean confirm, 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); disconnectAll()90 void disconnectAll(); unregAll()91 void unregAll(); numHwTrackFiltersAvailable()92 int numHwTrackFiltersAvailable(); 93 } 94