• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.BluetoothActivityEnergyInfo;
22 import android.bluetooth.BluetoothDevice;
23 import android.bluetooth.OobData;
24 import android.os.ParcelUuid;
25 import android.os.ParcelFileDescriptor;
26 import android.os.ResultReceiver;
27 
28 /**
29  * System private API for talking with the Bluetooth service.
30  *
31  * {@hide}
32  */
33 interface IBluetooth
34 {
isEnabled()35     boolean isEnabled();
getState()36     int getState();
enable()37     boolean enable();
enableNoAutoConnect()38     boolean enableNoAutoConnect();
disable()39     boolean disable();
40 
getAddress()41     String getAddress();
getUuids()42     ParcelUuid[] getUuids();
setName(in String name)43     boolean setName(in String name);
getName()44     String getName();
45 
getScanMode()46     int getScanMode();
setScanMode(int mode, int duration)47     boolean setScanMode(int mode, int duration);
48 
getDiscoverableTimeout()49     int getDiscoverableTimeout();
setDiscoverableTimeout(int timeout)50     boolean setDiscoverableTimeout(int timeout);
51 
startDiscovery()52     boolean startDiscovery();
cancelDiscovery()53     boolean cancelDiscovery();
isDiscovering()54     boolean isDiscovering();
getDiscoveryEndMillis()55     long getDiscoveryEndMillis();
56 
getAdapterConnectionState()57     int getAdapterConnectionState();
getProfileConnectionState(int profile)58     int getProfileConnectionState(int profile);
59 
getBondedDevices()60     BluetoothDevice[] getBondedDevices();
createBond(in BluetoothDevice device, in int transport)61     boolean createBond(in BluetoothDevice device, in int transport);
createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData)62     boolean createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData);
cancelBondProcess(in BluetoothDevice device)63     boolean cancelBondProcess(in BluetoothDevice device);
removeBond(in BluetoothDevice device)64     boolean removeBond(in BluetoothDevice device);
getBondState(in BluetoothDevice device)65     int getBondState(in BluetoothDevice device);
isBondingInitiatedLocally(in BluetoothDevice device)66     boolean isBondingInitiatedLocally(in BluetoothDevice device);
getSupportedProfiles()67     long getSupportedProfiles();
getConnectionState(in BluetoothDevice device)68     int getConnectionState(in BluetoothDevice device);
69 
getRemoteName(in BluetoothDevice device)70     String getRemoteName(in BluetoothDevice device);
getRemoteType(in BluetoothDevice device)71     int getRemoteType(in BluetoothDevice device);
getRemoteAlias(in BluetoothDevice device)72     String getRemoteAlias(in BluetoothDevice device);
setRemoteAlias(in BluetoothDevice device, in String name)73     boolean setRemoteAlias(in BluetoothDevice device, in String name);
getRemoteClass(in BluetoothDevice device)74     int getRemoteClass(in BluetoothDevice device);
getRemoteUuids(in BluetoothDevice device)75     ParcelUuid[] getRemoteUuids(in BluetoothDevice device);
fetchRemoteUuids(in BluetoothDevice device)76     boolean fetchRemoteUuids(in BluetoothDevice device);
sdpSearch(in BluetoothDevice device, in ParcelUuid uuid)77     boolean sdpSearch(in BluetoothDevice device, in ParcelUuid uuid);
getBatteryLevel(in BluetoothDevice device)78     int getBatteryLevel(in BluetoothDevice device);
79 
setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode)80     boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode);
setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[] passkey)81     boolean setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[]
82     passkey);
setPairingConfirmation(in BluetoothDevice device, boolean accept)83     boolean setPairingConfirmation(in BluetoothDevice device, boolean accept);
84 
getPhonebookAccessPermission(in BluetoothDevice device)85     int getPhonebookAccessPermission(in BluetoothDevice device);
setPhonebookAccessPermission(in BluetoothDevice device, int value)86     boolean setPhonebookAccessPermission(in BluetoothDevice device, int value);
getMessageAccessPermission(in BluetoothDevice device)87     int getMessageAccessPermission(in BluetoothDevice device);
setMessageAccessPermission(in BluetoothDevice device, int value)88     boolean setMessageAccessPermission(in BluetoothDevice device, int value);
getSimAccessPermission(in BluetoothDevice device)89     int getSimAccessPermission(in BluetoothDevice device);
setSimAccessPermission(in BluetoothDevice device, int value)90     boolean setSimAccessPermission(in BluetoothDevice device, int value);
91 
sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState)92     void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState);
93 
registerCallback(in IBluetoothCallback callback)94     void registerCallback(in IBluetoothCallback callback);
unregisterCallback(in IBluetoothCallback callback)95     void unregisterCallback(in IBluetoothCallback callback);
96 
97     // For Socket
connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag)98     ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag);
createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag)99     ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag);
100 
factoryReset()101     boolean factoryReset();
102 
isMultiAdvertisementSupported()103     boolean isMultiAdvertisementSupported();
isOffloadedFilteringSupported()104     boolean isOffloadedFilteringSupported();
isOffloadedScanBatchingSupported()105     boolean isOffloadedScanBatchingSupported();
isActivityAndEnergyReportingSupported()106     boolean isActivityAndEnergyReportingSupported();
isLe2MPhySupported()107     boolean isLe2MPhySupported();
isLeCodedPhySupported()108     boolean isLeCodedPhySupported();
isLeExtendedAdvertisingSupported()109     boolean isLeExtendedAdvertisingSupported();
isLePeriodicAdvertisingSupported()110     boolean isLePeriodicAdvertisingSupported();
getLeMaximumAdvertisingDataLength()111     int getLeMaximumAdvertisingDataLength();
reportActivityInfo()112     BluetoothActivityEnergyInfo reportActivityInfo();
113 
114     /**
115      * Requests the controller activity info asynchronously.
116      * The implementor is expected to reply with the
117      * {@link android.bluetooth.BluetoothActivityEnergyInfo} object placed into the Bundle with the
118      * key {@link android.os.BatteryStats#RESULT_RECEIVER_CONTROLLER_KEY}.
119      * The result code is ignored.
120      */
requestActivityInfo(in ResultReceiver result)121     oneway void requestActivityInfo(in ResultReceiver result);
122 
onLeServiceUp()123     void onLeServiceUp();
onBrEdrDown()124     void onBrEdrDown();
125 }
126