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