The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Nick Pelly | 16fb88a | 2009-10-07 07:44:03 +0200 | [diff] [blame] | 19 | import android.bluetooth.IBluetoothCallback; |
Jaikumar Ganesh | ef2cb7c | 2011-07-21 18:13:38 -0700 | [diff] [blame] | 20 | import android.bluetooth.IBluetoothStateChangeCallback; |
Prerepa Viswanadham | 8caac74 | 2014-07-22 17:00:09 -0700 | [diff] [blame] | 21 | import android.bluetooth.BluetoothActivityEnergyInfo; |
Jaikumar Ganesh | 545e670 | 2010-06-04 10:23:03 -0700 | [diff] [blame] | 22 | import android.bluetooth.BluetoothDevice; |
Jakub Pawlowski | 2fc6e6b | 2015-12-29 13:19:21 -0800 | [diff] [blame] | 23 | import android.bluetooth.OobData; |
Nick Pelly | aef439e | 2009-09-28 12:33:17 -0700 | [diff] [blame] | 24 | import android.os.ParcelUuid; |
Jaikumar Ganesh | 2ea1e85 | 2011-04-01 16:33:09 -0700 | [diff] [blame] | 25 | import android.os.ParcelFileDescriptor; |
Adam Lesinski | 010bf37 | 2016-04-11 12:18:18 -0700 | [diff] [blame] | 26 | import android.os.ResultReceiver; |
Jaikumar Ganesh | dd0463a | 2009-09-16 12:30:02 -0700 | [diff] [blame] | 27 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | /** |
| 29 | * System private API for talking with the Bluetooth service. |
| 30 | * |
| 31 | * {@hide} |
| 32 | */ |
Nick Pelly | bd022f4 | 2009-08-14 18:33:38 -0700 | [diff] [blame] | 33 | interface IBluetooth |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | { |
| 35 | boolean isEnabled(); |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 36 | int getState(); |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 37 | boolean enable(); |
Matthew Xie | 9631314 | 2012-06-29 16:57:31 -0700 | [diff] [blame] | 38 | boolean enableNoAutoConnect(); |
Fred | a8c6df0 | 2012-07-11 10:25:23 -0700 | [diff] [blame] | 39 | boolean disable(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | |
| 41 | String getAddress(); |
Jaikumar Ganesh | 58b93c3 | 2010-11-23 20:03:10 -0800 | [diff] [blame] | 42 | ParcelUuid[] getUuids(); |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 43 | boolean setName(in String name); |
| 44 | String getName(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | |
| 46 | int getScanMode(); |
Nick Pelly | 1283547 | 2009-09-25 15:00:29 -0700 | [diff] [blame] | 47 | boolean setScanMode(int mode, int duration); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | |
| 49 | int getDiscoverableTimeout(); |
| 50 | boolean setDiscoverableTimeout(int timeout); |
| 51 | |
Jaikumar Ganesh | d5ac1ae | 2009-05-05 22:26:12 -0700 | [diff] [blame] | 52 | boolean startDiscovery(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | boolean cancelDiscovery(); |
| 54 | boolean isDiscovering(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | |
Jaikumar Ganesh | c53cab2 | 2010-10-26 16:02:26 -0700 | [diff] [blame] | 56 | int getAdapterConnectionState(); |
Jaikumar Ganesh | cb1d354 | 2011-08-19 10:26:32 -0700 | [diff] [blame] | 57 | int getProfileConnectionState(int profile); |
Jaikumar Ganesh | c53cab2 | 2010-10-26 16:02:26 -0700 | [diff] [blame] | 58 | |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 59 | BluetoothDevice[] getBondedDevices(); |
Andre Eisenbach | 57210c7 | 2014-08-04 17:51:43 -0700 | [diff] [blame] | 60 | boolean createBond(in BluetoothDevice device, in int transport); |
Jakub Pawlowski | 2fc6e6b | 2015-12-29 13:19:21 -0800 | [diff] [blame] | 61 | boolean createBondOutOfBand(in BluetoothDevice device, in int transport, in OobData oobData); |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 62 | boolean cancelBondProcess(in BluetoothDevice device); |
| 63 | boolean removeBond(in BluetoothDevice device); |
| 64 | int getBondState(in BluetoothDevice device); |
Bryce Lee | b1301fa | 2016-10-09 12:54:42 -0700 | [diff] [blame] | 65 | long getSupportedProfiles(); |
Andre Eisenbach | 2b8696e | 2015-02-05 20:06:33 -0800 | [diff] [blame] | 66 | int getConnectionState(in BluetoothDevice device); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 68 | String getRemoteName(in BluetoothDevice device); |
Matthew Xie | 33ec984 | 2013-04-03 00:29:27 -0700 | [diff] [blame] | 69 | int getRemoteType(in BluetoothDevice device); |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 70 | 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); |
fredc | 4c9caca | 2012-04-06 02:08:46 -0700 | [diff] [blame] | 74 | boolean fetchRemoteUuids(in BluetoothDevice device); |
Casper Bonde | 238e0f9 | 2015-04-09 09:24:48 +0200 | [diff] [blame] | 75 | boolean sdpSearch(in BluetoothDevice device, in ParcelUuid uuid); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 76 | |
Jaikumar Ganesh | e4caddb | 2012-01-25 16:16:48 -0800 | [diff] [blame] | 77 | 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 Ganesh | 2ea1e85 | 2011-04-01 16:33:09 -0700 | [diff] [blame] | 81 | |
Edward Jee | 8dd30aa | 2014-09-05 00:29:14 -0700 | [diff] [blame] | 82 | 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 Bonde | d05bd46 | 2015-03-19 10:36:45 +0100 | [diff] [blame] | 86 | int getSimAccessPermission(in BluetoothDevice device); |
| 87 | boolean setSimAccessPermission(in BluetoothDevice device, int value); |
Edward Jee | 8dd30aa | 2014-09-05 00:29:14 -0700 | [diff] [blame] | 88 | |
Jaikumar Ganesh | cb1d354 | 2011-08-19 10:26:32 -0700 | [diff] [blame] | 89 | void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState); |
zzy | 3b147b7 | 2012-04-03 19:48:32 -0700 | [diff] [blame] | 90 | |
fredc | bf072a7 | 2012-05-09 16:52:50 -0700 | [diff] [blame] | 91 | void registerCallback(in IBluetoothCallback callback); |
| 92 | void unregisterCallback(in IBluetoothCallback callback); |
| 93 | |
zzy | 3b147b7 | 2012-04-03 19:48:32 -0700 | [diff] [blame] | 94 | // 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 Xu | af5971e | 2013-06-10 20:28:31 -0700 | [diff] [blame] | 97 | |
| 98 | boolean configHciSnoopLog(boolean enable); |
Ajay Panicker | cda6e87 | 2015-07-28 16:52:09 -0700 | [diff] [blame] | 99 | boolean factoryReset(); |
Prerepa Viswanadham | 0c116e1 | 2014-07-02 12:30:38 -0700 | [diff] [blame] | 100 | |
| 101 | boolean isMultiAdvertisementSupported(); |
Wei Wang | 35cd4c8 | 2014-09-25 19:05:03 -0700 | [diff] [blame] | 102 | boolean isPeripheralModeSupported(); |
Prerepa Viswanadham | 0c116e1 | 2014-07-02 12:30:38 -0700 | [diff] [blame] | 103 | boolean isOffloadedFilteringSupported(); |
| 104 | boolean isOffloadedScanBatchingSupported(); |
Prerepa Viswanadham | 8caac74 | 2014-07-22 17:00:09 -0700 | [diff] [blame] | 105 | boolean isActivityAndEnergyReportingSupported(); |
Prerepa Viswanadham | 8caac74 | 2014-07-22 17:00:09 -0700 | [diff] [blame] | 106 | BluetoothActivityEnergyInfo reportActivityInfo(); |
Mike Lockwood | 726d4de | 2014-10-28 14:06:28 -0700 | [diff] [blame] | 107 | |
Adam Lesinski | 010bf37 | 2016-04-11 12:18:18 -0700 | [diff] [blame] | 108 | /** |
| 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 Arora | 6ddbb5e | 2015-03-02 15:03:51 -0800 | [diff] [blame] | 117 | void onLeServiceUp(); |
| 118 | void onBrEdrDown(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 119 | } |