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