1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*
* Copyright 2015, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Binder IPC API for talking with the Bluetooth service and perform high-level
* operations on the adapter.
*/
interface IBluetooth {
/**
* Returns true if the Bluetooth adapter is powered and ready to use. This
* is equivalent to "getState() == ADAPTER_STATE_ON".
*/
boolean isEnabled();
/**
* Returns the current Bluetooth adapter state. The return value can be one of
* the following:
*
* - ADAPTER_STATE_OFF = 10
* - ADAPTER_STATE_TURNING_ON = 11
* - ADAPTER_STATE_ON = 12
* - ADAPTER_STATE_TURNING_OFF = 13
*/
int getState();
/**
* Turns on the Bluetooth radio. This function initiates the procedure to
* bring the adapter state from ADAPTER_STATE_OFF to ADAPTER_STATE_ON. Returns
* false, if the state is not ADAPTER_STATE_OFF or if there is an error while
* initiating the operation. On success, the adapter state will be
* asynchronously updated to ADAPTER_STATE_TURNING_ON and eventually to
* ADAPTER_STATE_ON. Callers can monitor the status of this call by observing
* the IBluetoothCallback.onBluetoothStateChange callback.
*/
boolean enable();
/**
* Turns off the Bluetooth radio. This function initiates the procedure to
* bring the adapter state from ADAPTER_STATE_ON to ADAPTER_STATE_OFF. Returns
* false, if the state is not ADAPTER_STATE_ON or if there is an error while
* initiating the operation. On success, the adapter state will be
* asynchronously updated to ADAPTER_STATE_TURNING_OFF and eventually to
* ADAPTER_STATE_OFF. Callers can monitor the status of this call by observing
* the IBluetoothCallback.onBluetoothStateChange callback.
*/
boolean disable();
/**
* Returns the identity Bluetooth Device Address (BD_ADDR) assigned to the
* underlying Bluetooth controller. Returns a string of the form
* "XX:XX:XX:XX:XX:XX", where each "X" is a hexadecimal digit. Returns
* "00:00:00:00:00:00" if the address is not known, which is usually the case
* before the adapter is enabled for the first time.
*/
String getAddress();
/**
* Sets the name assigned to the Bluetooth adapter. This is the name that will
* be seen by remote devices during discovery. Returns false if the operation
* fails.
*/
boolean setName(in String name);
/**
* Returns the current name assigned to the Bluetooth adapter. This is the
* name that is seen by remote devices during discovery. If the controller has
* not been initialized yet (before the first time it gets enabled), this will
* return "not-initialized".
*/
String getName();
/**
* Registers a callback receiver which can be used to listen to state updates
* from the adapter. The Bluetooth daemon will automatically register this if
* the owning process dies.
*/
void registerCallback(in IBluetoothCallback callback);
/**
* Unregisters a previously registered callback.
*/
void unregisterCallback(in IBluetoothCallback callback);
/**
* Returns true, if the multi-advertisement feature is supported. Returns
* false, if this device can only advertise a single instance.
*/
boolean isMultiAdvertisementSupported();
/**
* Returns a binder that can be used to interact with Low-Energy features.
*/
IBluetoothLowEnergy getLowEnergyInterface();
/**
* Returns a binder that can be used to interact with GATT client-role
* features.
*/
IBluetoothGattClient getGattClientInterface();
/**
* Returns a binder that can be used to interact with GATT server-role
* features.
*/
IBluetoothGattServer getGattServerInterface();
}
|