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