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 17package android.bluetooth; 18 19import android.bluetooth.BluetoothDevice; 20import android.bluetooth.le.AdvertiseSettings; 21import android.bluetooth.le.AdvertiseData; 22import android.bluetooth.le.ScanFilter; 23import android.bluetooth.le.ScanSettings; 24import android.bluetooth.le.ResultStorageDescriptor; 25import android.os.ParcelUuid; 26import android.os.WorkSource; 27 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 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); 41 void stopScan(in int appIf, in boolean isServer); 42 void flushPendingBatchResults(in int appIf, in boolean isServer); 43 void startMultiAdvertising(in int appIf, 44 in AdvertiseData advertiseData, 45 in AdvertiseData scanResponse, 46 in AdvertiseSettings settings); 47 void stopMultiAdvertising(in int appIf); 48 void registerClient(in ParcelUuid appId, in IBluetoothGattCallback callback); 49 void unregisterClient(in int clientIf); 50 void clientConnect(in int clientIf, in String address, in boolean isDirect, in int transport); 51 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); 54 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, 56 in int writeType, in int authReq, in byte[] value); 57 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, 59 in int writeType, in int authReq, in byte[] value); 60 void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable); 61 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); 64 void configureMTU(in int clientIf, in String address, in int mtu); 65 void connectionParameterUpdate(in int clientIf, in String address, in int connectionPriority); 66 67 void registerServer(in ParcelUuid appId, in IBluetoothGattServerCallback callback); 68 void unregisterServer(in int serverIf); 69 void serverConnect(in int servertIf, in String address, in boolean isDirect, in int transport); 70 void serverDisconnect(in int serverIf, in String address); 71 void beginServiceDeclaration(in int serverIf, in int srvcType, 72 in int srvcInstanceId, in int minHandles, 73 in ParcelUuid srvcId, boolean advertisePreferred); 74 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); 90 void disconnectAll(); 91 void unregAll(); 92 int numHwTrackFiltersAvailable(); 93} 94