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 17 package android.bluetooth; 18 19 import android.bluetooth.IBluetoothCallback; 20 import android.bluetooth.IBluetoothStateChangeCallback; 21 import android.bluetooth.IBluetoothHealthCallback; 22 import android.bluetooth.BluetoothDevice; 23 import android.bluetooth.BluetoothHealthAppConfiguration; 24 import android.os.ParcelUuid; 25 import android.os.ParcelFileDescriptor; 26 27 /** 28 * System private API for talking with the Bluetooth service. 29 * 30 * {@hide} 31 */ 32 interface IBluetooth 33 { isEnabled()34 boolean isEnabled(); getBluetoothState()35 int getBluetoothState(); enable()36 boolean enable(); enableNoAutoConnect()37 boolean enableNoAutoConnect(); disable(boolean persistSetting)38 boolean disable(boolean persistSetting); 39 getAddress()40 String getAddress(); getName()41 String getName(); setName(in String name)42 boolean setName(in String name); getUuids()43 ParcelUuid[] getUuids(); 44 getScanMode()45 int getScanMode(); setScanMode(int mode, int duration)46 boolean setScanMode(int mode, int duration); 47 getDiscoverableTimeout()48 int getDiscoverableTimeout(); setDiscoverableTimeout(int timeout)49 boolean setDiscoverableTimeout(int timeout); 50 startDiscovery()51 boolean startDiscovery(); cancelDiscovery()52 boolean cancelDiscovery(); isDiscovering()53 boolean isDiscovering(); readOutOfBandData()54 byte[] readOutOfBandData(); 55 getAdapterConnectionState()56 int getAdapterConnectionState(); getProfileConnectionState(int profile)57 int getProfileConnectionState(int profile); changeApplicationBluetoothState(boolean on, in IBluetoothStateChangeCallback callback, in IBinder b)58 boolean changeApplicationBluetoothState(boolean on, 59 in IBluetoothStateChangeCallback callback, in 60 IBinder b); 61 createBond(in String address)62 boolean createBond(in String address); createBondOutOfBand(in String address, in byte[] hash, in byte[] randomizer)63 boolean createBondOutOfBand(in String address, in byte[] hash, in byte[] randomizer); cancelBondProcess(in String address)64 boolean cancelBondProcess(in String address); removeBond(in String address)65 boolean removeBond(in String address); listBonds()66 String[] listBonds(); getBondState(in String address)67 int getBondState(in String address); setDeviceOutOfBandData(in String address, in byte[] hash, in byte[] randomizer)68 boolean setDeviceOutOfBandData(in String address, in byte[] hash, in byte[] randomizer); 69 getRemoteName(in String address)70 String getRemoteName(in String address); getRemoteAlias(in String address)71 String getRemoteAlias(in String address); setRemoteAlias(in String address, in String name)72 boolean setRemoteAlias(in String address, in String name); getRemoteClass(in String address)73 int getRemoteClass(in String address); getRemoteUuids(in String address)74 ParcelUuid[] getRemoteUuids(in String address); fetchRemoteUuids(in String address, in ParcelUuid uuid, in IBluetoothCallback callback)75 boolean fetchRemoteUuids(in String address, in ParcelUuid uuid, in IBluetoothCallback callback); getRemoteServiceChannel(in String address, in ParcelUuid uuid)76 int getRemoteServiceChannel(in String address, in ParcelUuid uuid); 77 setPin(in String address, in byte[] pin)78 boolean setPin(in String address, in byte[] pin); setPasskey(in String address, int passkey)79 boolean setPasskey(in String address, int passkey); setPairingConfirmation(in String address, boolean confirm)80 boolean setPairingConfirmation(in String address, boolean confirm); setRemoteOutOfBandData(in String addres)81 boolean setRemoteOutOfBandData(in String addres); cancelPairingUserInput(in String address)82 boolean cancelPairingUserInput(in String address); 83 setTrust(in String address, in boolean value)84 boolean setTrust(in String address, in boolean value); getTrustState(in String address)85 boolean getTrustState(in String address); isBluetoothDock(in String address)86 boolean isBluetoothDock(in String address); 87 addRfcommServiceRecord(in String serviceName, in ParcelUuid uuid, int channel, IBinder b)88 int addRfcommServiceRecord(in String serviceName, in ParcelUuid uuid, int channel, IBinder b); removeServiceRecord(int handle)89 void removeServiceRecord(int handle); allowIncomingProfileConnect(in BluetoothDevice device, boolean value)90 boolean allowIncomingProfileConnect(in BluetoothDevice device, boolean value); 91 connectHeadset(String address)92 boolean connectHeadset(String address); disconnectHeadset(String address)93 boolean disconnectHeadset(String address); notifyIncomingConnection(String address, boolean rejected)94 boolean notifyIncomingConnection(String address, boolean rejected); 95 96 // HID profile APIs connectInputDevice(in BluetoothDevice device)97 boolean connectInputDevice(in BluetoothDevice device); disconnectInputDevice(in BluetoothDevice device)98 boolean disconnectInputDevice(in BluetoothDevice device); getConnectedInputDevices()99 List<BluetoothDevice> getConnectedInputDevices(); getInputDevicesMatchingConnectionStates(in int[] states)100 List<BluetoothDevice> getInputDevicesMatchingConnectionStates(in int[] states); getInputDeviceConnectionState(in BluetoothDevice device)101 int getInputDeviceConnectionState(in BluetoothDevice device); setInputDevicePriority(in BluetoothDevice device, int priority)102 boolean setInputDevicePriority(in BluetoothDevice device, int priority); getInputDevicePriority(in BluetoothDevice device)103 int getInputDevicePriority(in BluetoothDevice device); 104 isTetheringOn()105 boolean isTetheringOn(); setBluetoothTethering(boolean value)106 void setBluetoothTethering(boolean value); getPanDeviceConnectionState(in BluetoothDevice device)107 int getPanDeviceConnectionState(in BluetoothDevice device); getConnectedPanDevices()108 List<BluetoothDevice> getConnectedPanDevices(); getPanDevicesMatchingConnectionStates(in int[] states)109 List<BluetoothDevice> getPanDevicesMatchingConnectionStates(in int[] states); connectPanDevice(in BluetoothDevice device)110 boolean connectPanDevice(in BluetoothDevice device); disconnectPanDevice(in BluetoothDevice device)111 boolean disconnectPanDevice(in BluetoothDevice device); 112 113 // HDP profile APIs registerAppConfiguration(in BluetoothHealthAppConfiguration config, in IBluetoothHealthCallback callback)114 boolean registerAppConfiguration(in BluetoothHealthAppConfiguration config, 115 in IBluetoothHealthCallback callback); unregisterAppConfiguration(in BluetoothHealthAppConfiguration config)116 boolean unregisterAppConfiguration(in BluetoothHealthAppConfiguration config); connectChannelToSource(in BluetoothDevice device, in BluetoothHealthAppConfiguration config)117 boolean connectChannelToSource(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); connectChannelToSink(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, int channelType)118 boolean connectChannelToSink(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, 119 int channelType); disconnectChannel(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, int id)120 boolean disconnectChannel(in BluetoothDevice device, in BluetoothHealthAppConfiguration config, int id); getMainChannelFd(in BluetoothDevice device, in BluetoothHealthAppConfiguration config)121 ParcelFileDescriptor getMainChannelFd(in BluetoothDevice device, in BluetoothHealthAppConfiguration config); getConnectedHealthDevices()122 List<BluetoothDevice> getConnectedHealthDevices(); getHealthDevicesMatchingConnectionStates(in int[] states)123 List<BluetoothDevice> getHealthDevicesMatchingConnectionStates(in int[] states); getHealthDeviceConnectionState(in BluetoothDevice device)124 int getHealthDeviceConnectionState(in BluetoothDevice device); 125 sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState)126 void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); 127 } 128