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