1/* 2 * Copyright (C) 2008, 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.IBluetoothCallback; 20import android.bluetooth.IBluetoothStateChangeCallback; 21import android.bluetooth.BluetoothActivityEnergyInfo; 22import android.bluetooth.BluetoothDevice; 23import android.bluetooth.OobData; 24import android.os.ParcelUuid; 25import android.os.ParcelFileDescriptor; 26import android.os.ResultReceiver; 27 28/** 29 * System private API for talking with the Bluetooth service. 30 * 31 * {@hide} 32 */ 33interface IBluetooth 34{ 35 boolean isEnabled(); 36 int getState(); 37 boolean enable(); 38 boolean enableNoAutoConnect(); 39 boolean disable(); 40 41 String getAddress(); 42 ParcelUuid[] getUuids(); 43 boolean setName(in String name); 44 String getName(); 45 46 int getScanMode(); 47 boolean setScanMode(int mode, int duration); 48 49 int getDiscoverableTimeout(); 50 boolean setDiscoverableTimeout(int timeout); 51 52 boolean startDiscovery(); 53 boolean cancelDiscovery(); 54 boolean isDiscovering(); 55 56 int getAdapterConnectionState(); 57 int getProfileConnectionState(int profile); 58 59 BluetoothDevice[] getBondedDevices(); 60 boolean createBond(in BluetoothDevice device, in int transport); 61 boolean createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData); 62 boolean cancelBondProcess(in BluetoothDevice device); 63 boolean removeBond(in BluetoothDevice device); 64 int getBondState(in BluetoothDevice device); 65 long getSupportedProfiles(); 66 int getConnectionState(in BluetoothDevice device); 67 68 String getRemoteName(in BluetoothDevice device); 69 int getRemoteType(in BluetoothDevice device); 70 String getRemoteAlias(in BluetoothDevice device); 71 boolean setRemoteAlias(in BluetoothDevice device, in String name); 72 int getRemoteClass(in BluetoothDevice device); 73 ParcelUuid[] getRemoteUuids(in BluetoothDevice device); 74 boolean fetchRemoteUuids(in BluetoothDevice device); 75 boolean sdpSearch(in BluetoothDevice device, in ParcelUuid uuid); 76 77 boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode); 78 boolean setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[] 79 passkey); 80 boolean setPairingConfirmation(in BluetoothDevice device, boolean accept); 81 82 int getPhonebookAccessPermission(in BluetoothDevice device); 83 boolean setPhonebookAccessPermission(in BluetoothDevice device, int value); 84 int getMessageAccessPermission(in BluetoothDevice device); 85 boolean setMessageAccessPermission(in BluetoothDevice device, int value); 86 int getSimAccessPermission(in BluetoothDevice device); 87 boolean setSimAccessPermission(in BluetoothDevice device, int value); 88 89 void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); 90 91 void registerCallback(in IBluetoothCallback callback); 92 void unregisterCallback(in IBluetoothCallback callback); 93 94 // For Socket 95 ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag); 96 ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag); 97 98 boolean configHciSnoopLog(boolean enable); 99 boolean factoryReset(); 100 101 boolean isMultiAdvertisementSupported(); 102 boolean isPeripheralModeSupported(); 103 boolean isOffloadedFilteringSupported(); 104 boolean isOffloadedScanBatchingSupported(); 105 boolean isActivityAndEnergyReportingSupported(); 106 BluetoothActivityEnergyInfo reportActivityInfo(); 107 108 /** 109 * Requests the controller activity info asynchronously. 110 * The implementor is expected to reply with the 111 * {@link android.bluetooth.BluetoothActivityEnergyInfo} object placed into the Bundle with the 112 * key {@link android.os.BatteryStats#RESULT_RECEIVER_CONTROLLER_KEY}. 113 * The result code is ignored. 114 */ 115 oneway void requestActivityInfo(in ResultReceiver result); 116 117 void onLeServiceUp(); 118 void onBrEdrDown(); 119} 120