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 { isEnabled()38 boolean isEnabled(); getState()39 int getState(); enable()40 boolean enable(); enableNoAutoConnect()41 boolean enableNoAutoConnect(); disable()42 boolean disable(); 43 getAddress()44 String getAddress(); getUuids()45 ParcelUuid[] getUuids(); setName(in String name)46 boolean setName(in String name); getName()47 String getName(); getBluetoothClass()48 BluetoothClass getBluetoothClass(); setBluetoothClass(in BluetoothClass bluetoothClass)49 boolean setBluetoothClass(in BluetoothClass bluetoothClass); 50 getIoCapability()51 int getIoCapability(); setIoCapability(int capability)52 boolean setIoCapability(int capability); getLeIoCapability()53 int getLeIoCapability(); setLeIoCapability(int capability)54 boolean setLeIoCapability(int capability); 55 getScanMode()56 int getScanMode(); setScanMode(int mode, int duration)57 boolean setScanMode(int mode, int duration); 58 getDiscoverableTimeout()59 int getDiscoverableTimeout(); setDiscoverableTimeout(int timeout)60 boolean setDiscoverableTimeout(int timeout); 61 startDiscovery(String callingPackage)62 boolean startDiscovery(String callingPackage); cancelDiscovery()63 boolean cancelDiscovery(); isDiscovering()64 boolean isDiscovering(); getDiscoveryEndMillis()65 long getDiscoveryEndMillis(); 66 getAdapterConnectionState()67 int getAdapterConnectionState(); getProfileConnectionState(int profile)68 int getProfileConnectionState(int profile); 69 getBondedDevices()70 BluetoothDevice[] getBondedDevices(); createBond(in BluetoothDevice device, in int transport)71 boolean createBond(in BluetoothDevice device, in int transport); createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData)72 boolean createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData); cancelBondProcess(in BluetoothDevice device)73 boolean cancelBondProcess(in BluetoothDevice device); removeBond(in BluetoothDevice device)74 boolean removeBond(in BluetoothDevice device); getBondState(in BluetoothDevice device)75 int getBondState(in BluetoothDevice device); isBondingInitiatedLocally(in BluetoothDevice device)76 boolean isBondingInitiatedLocally(in BluetoothDevice device); getSupportedProfiles()77 long getSupportedProfiles(); getConnectionState(in BluetoothDevice device)78 int getConnectionState(in BluetoothDevice device); 79 getRemoteName(in BluetoothDevice device)80 String getRemoteName(in BluetoothDevice device); getRemoteType(in BluetoothDevice device)81 int getRemoteType(in BluetoothDevice device); getRemoteAlias(in BluetoothDevice device)82 String getRemoteAlias(in BluetoothDevice device); setRemoteAlias(in BluetoothDevice device, in String name)83 boolean setRemoteAlias(in BluetoothDevice device, in String name); getRemoteClass(in BluetoothDevice device)84 int getRemoteClass(in BluetoothDevice device); getRemoteUuids(in BluetoothDevice device)85 ParcelUuid[] getRemoteUuids(in BluetoothDevice device); 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 sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState)105 void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); 106 registerCallback(in IBluetoothCallback callback)107 void registerCallback(in IBluetoothCallback callback); unregisterCallback(in IBluetoothCallback callback)108 void unregisterCallback(in IBluetoothCallback callback); 109 110 // For Socket getSocketManager()111 IBluetoothSocketManager getSocketManager(); 112 factoryReset()113 boolean factoryReset(); 114 isMultiAdvertisementSupported()115 boolean isMultiAdvertisementSupported(); isOffloadedFilteringSupported()116 boolean isOffloadedFilteringSupported(); isOffloadedScanBatchingSupported()117 boolean isOffloadedScanBatchingSupported(); isActivityAndEnergyReportingSupported()118 boolean isActivityAndEnergyReportingSupported(); isLe2MPhySupported()119 boolean isLe2MPhySupported(); isLeCodedPhySupported()120 boolean isLeCodedPhySupported(); isLeExtendedAdvertisingSupported()121 boolean isLeExtendedAdvertisingSupported(); isLePeriodicAdvertisingSupported()122 boolean isLePeriodicAdvertisingSupported(); getLeMaximumAdvertisingDataLength()123 int getLeMaximumAdvertisingDataLength(); reportActivityInfo()124 BluetoothActivityEnergyInfo reportActivityInfo(); 125 126 // For Metadata registerMetadataListener(in IBluetoothMetadataListener listener, in BluetoothDevice device)127 boolean registerMetadataListener(in IBluetoothMetadataListener listener, in BluetoothDevice device); unregisterMetadataListener(in BluetoothDevice device)128 boolean unregisterMetadataListener(in BluetoothDevice device); setMetadata(in BluetoothDevice device, in int key, in byte[] value)129 boolean setMetadata(in BluetoothDevice device, in int key, in byte[] value); getMetadata(in BluetoothDevice device, in int key)130 byte[] getMetadata(in BluetoothDevice device, in int key); 131 132 133 /** 134 * Requests the controller activity info asynchronously. 135 * The implementor is expected to reply with the 136 * {@link android.bluetooth.BluetoothActivityEnergyInfo} object placed into the Bundle with the 137 * key {@link android.os.BatteryStats#RESULT_RECEIVER_CONTROLLER_KEY}. 138 * The result code is ignored. 139 */ requestActivityInfo(in ResultReceiver result)140 oneway void requestActivityInfo(in ResultReceiver result); 141 onLeServiceUp()142 void onLeServiceUp(); onBrEdrDown()143 void onBrEdrDown(); 144 } 145