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.IBluetoothMetadataListener; 21 import android.bluetooth.IBluetoothSocketManager; 22 import android.bluetooth.IBluetoothStateChangeCallback; 23 import android.bluetooth.BluetoothActivityEnergyInfo; 24 import android.bluetooth.BluetoothClass; 25 import android.bluetooth.BluetoothDevice; 26 import android.bluetooth.OobData; 27 import android.os.ParcelUuid; 28 import android.os.ParcelFileDescriptor; 29 import android.os.ResultReceiver; 30 31 /** 32 * System private API for talking with the Bluetooth service. 33 * 34 * {@hide} 35 */ 36 interface IBluetooth 37 { getState()38 int getState(); enable(boolean quietMode)39 boolean enable(boolean quietMode); disable()40 boolean disable(); 41 42 @UnsupportedAppUsage 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 getIoCapability()50 int getIoCapability(); setIoCapability(int capability)51 boolean setIoCapability(int capability); getLeIoCapability()52 int getLeIoCapability(); setLeIoCapability(int capability)53 boolean setLeIoCapability(int capability); 54 getScanMode()55 int getScanMode(); setScanMode(int mode, int duration)56 boolean setScanMode(int mode, int duration); 57 getDiscoverableTimeout()58 int getDiscoverableTimeout(); setDiscoverableTimeout(int timeout)59 boolean setDiscoverableTimeout(int timeout); 60 startDiscovery(String callingPackage, String callingFeatureId)61 boolean startDiscovery(String callingPackage, String callingFeatureId); cancelDiscovery()62 boolean cancelDiscovery(); isDiscovering()63 boolean isDiscovering(); getDiscoveryEndMillis()64 long getDiscoveryEndMillis(); 65 getAdapterConnectionState()66 int getAdapterConnectionState(); getProfileConnectionState(int profile)67 int getProfileConnectionState(int profile); 68 getBondedDevices()69 BluetoothDevice[] getBondedDevices(); createBond(in BluetoothDevice device, in int transport, in OobData oobData)70 boolean createBond(in BluetoothDevice device, in int transport, in OobData oobData); cancelBondProcess(in BluetoothDevice device)71 boolean cancelBondProcess(in BluetoothDevice device); removeBond(in BluetoothDevice device)72 boolean removeBond(in BluetoothDevice device); getBondState(in BluetoothDevice device)73 int getBondState(in BluetoothDevice device); isBondingInitiatedLocally(in BluetoothDevice device)74 boolean isBondingInitiatedLocally(in BluetoothDevice device); getSupportedProfiles()75 long getSupportedProfiles(); getConnectionState(in BluetoothDevice device)76 int getConnectionState(in BluetoothDevice device); 77 getRemoteName(in BluetoothDevice device)78 String getRemoteName(in BluetoothDevice device); getRemoteType(in BluetoothDevice device)79 int getRemoteType(in BluetoothDevice device); 80 @UnsupportedAppUsage getRemoteAlias(in BluetoothDevice device)81 String getRemoteAlias(in BluetoothDevice device); setRemoteAlias(in BluetoothDevice device, in String name)82 boolean setRemoteAlias(in BluetoothDevice device, in String name); getRemoteClass(in BluetoothDevice device)83 int getRemoteClass(in BluetoothDevice device); getRemoteUuids(in BluetoothDevice device)84 ParcelUuid[] getRemoteUuids(in BluetoothDevice device); 85 @UnsupportedAppUsage fetchRemoteUuids(in BluetoothDevice device)86 boolean fetchRemoteUuids(in BluetoothDevice device); sdpSearch(in BluetoothDevice device, in ParcelUuid uuid)87 boolean sdpSearch(in BluetoothDevice device, in ParcelUuid uuid); getBatteryLevel(in BluetoothDevice device)88 int getBatteryLevel(in BluetoothDevice device); getMaxConnectedAudioDevices()89 int getMaxConnectedAudioDevices(); 90 setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode)91 boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode); setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[] passkey)92 boolean setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[] 93 passkey); setPairingConfirmation(in BluetoothDevice device, boolean accept)94 boolean setPairingConfirmation(in BluetoothDevice device, boolean accept); 95 getPhonebookAccessPermission(in BluetoothDevice device)96 int getPhonebookAccessPermission(in BluetoothDevice device); setSilenceMode(in BluetoothDevice device, boolean silence)97 boolean setSilenceMode(in BluetoothDevice device, boolean silence); getSilenceMode(in BluetoothDevice device)98 boolean getSilenceMode(in BluetoothDevice device); setPhonebookAccessPermission(in BluetoothDevice device, int value)99 boolean setPhonebookAccessPermission(in BluetoothDevice device, int value); getMessageAccessPermission(in BluetoothDevice device)100 int getMessageAccessPermission(in BluetoothDevice device); setMessageAccessPermission(in BluetoothDevice device, int value)101 boolean setMessageAccessPermission(in BluetoothDevice device, int value); getSimAccessPermission(in BluetoothDevice device)102 int getSimAccessPermission(in BluetoothDevice device); setSimAccessPermission(in BluetoothDevice device, int value)103 boolean setSimAccessPermission(in BluetoothDevice device, int value); 104 registerCallback(in IBluetoothCallback callback)105 void registerCallback(in IBluetoothCallback callback); unregisterCallback(in IBluetoothCallback callback)106 void unregisterCallback(in IBluetoothCallback callback); 107 108 // For Socket getSocketManager()109 IBluetoothSocketManager getSocketManager(); 110 factoryReset()111 boolean factoryReset(); 112 isMultiAdvertisementSupported()113 boolean isMultiAdvertisementSupported(); isOffloadedFilteringSupported()114 boolean isOffloadedFilteringSupported(); isOffloadedScanBatchingSupported()115 boolean isOffloadedScanBatchingSupported(); isActivityAndEnergyReportingSupported()116 boolean isActivityAndEnergyReportingSupported(); isLe2MPhySupported()117 boolean isLe2MPhySupported(); isLeCodedPhySupported()118 boolean isLeCodedPhySupported(); isLeExtendedAdvertisingSupported()119 boolean isLeExtendedAdvertisingSupported(); isLePeriodicAdvertisingSupported()120 boolean isLePeriodicAdvertisingSupported(); getLeMaximumAdvertisingDataLength()121 int getLeMaximumAdvertisingDataLength(); reportActivityInfo()122 BluetoothActivityEnergyInfo reportActivityInfo(); 123 124 // For Metadata registerMetadataListener(in IBluetoothMetadataListener listener, in BluetoothDevice device)125 boolean registerMetadataListener(in IBluetoothMetadataListener listener, in BluetoothDevice device); unregisterMetadataListener(in BluetoothDevice device)126 boolean unregisterMetadataListener(in BluetoothDevice device); setMetadata(in BluetoothDevice device, in int key, in byte[] value)127 boolean setMetadata(in BluetoothDevice device, in int key, in byte[] value); getMetadata(in BluetoothDevice device, in int key)128 byte[] getMetadata(in BluetoothDevice device, in int key); 129 130 131 /** 132 * Requests the controller activity info asynchronously. 133 * The implementor is expected to reply with the 134 * {@link android.bluetooth.BluetoothActivityEnergyInfo} object placed into the Bundle with the 135 * key {@link android.os.BatteryStats#RESULT_RECEIVER_CONTROLLER_KEY}. 136 * The result code is ignored. 137 */ requestActivityInfo(in ResultReceiver result)138 oneway void requestActivityInfo(in ResultReceiver result); 139 onLeServiceUp()140 void onLeServiceUp(); onBrEdrDown()141 void onBrEdrDown(); 142 connectAllEnabledProfiles(in BluetoothDevice device)143 boolean connectAllEnabledProfiles(in BluetoothDevice device); disconnectAllEnabledProfiles(in BluetoothDevice device)144 boolean disconnectAllEnabledProfiles(in BluetoothDevice device); 145 setActiveDevice(in BluetoothDevice device, in int profiles)146 boolean setActiveDevice(in BluetoothDevice device, in int profiles); 147 getMostRecentlyConnectedDevices()148 List<BluetoothDevice> getMostRecentlyConnectedDevices(); 149 removeActiveDevice(in int profiles)150 boolean removeActiveDevice(in int profiles); 151 } 152