blob: f28ab275e4c77e30f0d887219aa5e216dec8ecfb [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package android.bluetooth;
18
Nick Pelly16fb88a2009-10-07 07:44:03 +020019import android.bluetooth.IBluetoothCallback;
Jaikumar Ganeshef2cb7c2011-07-21 18:13:38 -070020import android.bluetooth.IBluetoothStateChangeCallback;
Prerepa Viswanadham8caac742014-07-22 17:00:09 -070021import android.bluetooth.BluetoothActivityEnergyInfo;
Jaikumar Ganesh545e6702010-06-04 10:23:03 -070022import android.bluetooth.BluetoothDevice;
Jakub Pawlowski2fc6e6b2015-12-29 13:19:21 -080023import android.bluetooth.OobData;
Nick Pellyaef439e2009-09-28 12:33:17 -070024import android.os.ParcelUuid;
Jaikumar Ganesh2ea1e852011-04-01 16:33:09 -070025import android.os.ParcelFileDescriptor;
Adam Lesinski010bf372016-04-11 12:18:18 -070026import android.os.ResultReceiver;
Jaikumar Ganeshdd0463a2009-09-16 12:30:02 -070027
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028/**
29 * System private API for talking with the Bluetooth service.
30 *
31 * {@hide}
32 */
Nick Pellybd022f42009-08-14 18:33:38 -070033interface IBluetooth
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034{
35 boolean isEnabled();
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080036 int getState();
The Android Open Source Project10592532009-03-18 17:39:46 -070037 boolean enable();
Matthew Xie96313142012-06-29 16:57:31 -070038 boolean enableNoAutoConnect();
Freda8c6df02012-07-11 10:25:23 -070039 boolean disable();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040
41 String getAddress();
Jaikumar Ganesh58b93c32010-11-23 20:03:10 -080042 ParcelUuid[] getUuids();
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080043 boolean setName(in String name);
44 String getName();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
46 int getScanMode();
Nick Pelly12835472009-09-25 15:00:29 -070047 boolean setScanMode(int mode, int duration);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
49 int getDiscoverableTimeout();
50 boolean setDiscoverableTimeout(int timeout);
51
Jaikumar Ganeshd5ac1ae2009-05-05 22:26:12 -070052 boolean startDiscovery();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 boolean cancelDiscovery();
54 boolean isDiscovering();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055
Jaikumar Ganeshc53cab22010-10-26 16:02:26 -070056 int getAdapterConnectionState();
Jaikumar Ganeshcb1d3542011-08-19 10:26:32 -070057 int getProfileConnectionState(int profile);
Jaikumar Ganeshc53cab22010-10-26 16:02:26 -070058
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080059 BluetoothDevice[] getBondedDevices();
Andre Eisenbach57210c72014-08-04 17:51:43 -070060 boolean createBond(in BluetoothDevice device, in int transport);
Jakub Pawlowski2fc6e6b2015-12-29 13:19:21 -080061 boolean createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData);
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080062 boolean cancelBondProcess(in BluetoothDevice device);
63 boolean removeBond(in BluetoothDevice device);
64 int getBondState(in BluetoothDevice device);
Bryce Leeb1301fa2016-10-09 12:54:42 -070065 long getSupportedProfiles();
Andre Eisenbach2b8696e2015-02-05 20:06:33 -080066 int getConnectionState(in BluetoothDevice device);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080068 String getRemoteName(in BluetoothDevice device);
Matthew Xie33ec9842013-04-03 00:29:27 -070069 int getRemoteType(in BluetoothDevice device);
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080070 String getRemoteAlias(in BluetoothDevice device);
71 boolean setRemoteAlias(in BluetoothDevice device, in String name);
72 int getRemoteClass(in BluetoothDevice device);
73 ParcelUuid[] getRemoteUuids(in BluetoothDevice device);
fredc4c9caca2012-04-06 02:08:46 -070074 boolean fetchRemoteUuids(in BluetoothDevice device);
Casper Bonde238e0f92015-04-09 09:24:48 +020075 boolean sdpSearch(in BluetoothDevice device, in ParcelUuid uuid);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076
Jaikumar Ganeshe4caddb2012-01-25 16:16:48 -080077 boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode);
78 boolean setPasskey(in BluetoothDevice device, boolean accept, int len, in byte[]
79 passkey);
80 boolean setPairingConfirmation(in BluetoothDevice device, boolean accept);
Jaikumar Ganesh2ea1e852011-04-01 16:33:09 -070081
Edward Jee8dd30aa2014-09-05 00:29:14 -070082 int getPhonebookAccessPermission(in BluetoothDevice device);
83 boolean setPhonebookAccessPermission(in BluetoothDevice device, int value);
84 int getMessageAccessPermission(in BluetoothDevice device);
85 boolean setMessageAccessPermission(in BluetoothDevice device, int value);
Casper Bonded05bd462015-03-19 10:36:45 +010086 int getSimAccessPermission(in BluetoothDevice device);
87 boolean setSimAccessPermission(in BluetoothDevice device, int value);
Edward Jee8dd30aa2014-09-05 00:29:14 -070088
Jaikumar Ganeshcb1d3542011-08-19 10:26:32 -070089 void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState);
zzy3b147b72012-04-03 19:48:32 -070090
fredcbf072a72012-05-09 16:52:50 -070091 void registerCallback(in IBluetoothCallback callback);
92 void unregisterCallback(in IBluetoothCallback callback);
93
zzy3b147b72012-04-03 19:48:32 -070094 // For Socket
95 ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag);
96 ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag);
Zhihai Xuaf5971e2013-06-10 20:28:31 -070097
98 boolean configHciSnoopLog(boolean enable);
Ajay Panickercda6e872015-07-28 16:52:09 -070099 boolean factoryReset();
Prerepa Viswanadham0c116e12014-07-02 12:30:38 -0700100
101 boolean isMultiAdvertisementSupported();
Wei Wang35cd4c82014-09-25 19:05:03 -0700102 boolean isPeripheralModeSupported();
Prerepa Viswanadham0c116e12014-07-02 12:30:38 -0700103 boolean isOffloadedFilteringSupported();
104 boolean isOffloadedScanBatchingSupported();
Prerepa Viswanadham8caac742014-07-22 17:00:09 -0700105 boolean isActivityAndEnergyReportingSupported();
Prerepa Viswanadham8caac742014-07-22 17:00:09 -0700106 BluetoothActivityEnergyInfo reportActivityInfo();
Mike Lockwood726d4de2014-10-28 14:06:28 -0700107
Adam Lesinski010bf372016-04-11 12:18:18 -0700108 /**
109 * Requests the controller activity info asynchronously.
110 * The implementor is expected to reply with the
111 * {@link android.bluetooth.BluetoothActivityEnergyInfo} object placed into the Bundle with the
112 * key {@link android.os.BatteryStats#RESULT_RECEIVER_CONTROLLER_KEY}.
113 * The result code is ignored.
114 */
115 oneway void requestActivityInfo(in ResultReceiver result);
116
Nitin Arora6ddbb5e2015-03-02 15:03:51 -0800117 void onLeServiceUp();
118 void onBrEdrDown();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119}