blob: 8ce684e9a0705c058e94f2933c406959f6b45654 [file] [log] [blame]
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -07001/*
2 * Copyright (C) 2011 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
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -060019import android.annotation.RequiresPermission;
20import android.annotation.SuppressLint;
21import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
22import android.bluetooth.annotations.RequiresLegacyBluetoothPermission;
David Duartef5b3bc52023-10-17 00:55:06 +000023import android.os.IBinder;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070024import android.os.ParcelFileDescriptor;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070025import android.util.Log;
26
William Escande5e8e1532024-03-27 18:02:23 +000027import java.util.Collections;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070028import java.util.List;
29
30/**
31 * Public API for Bluetooth Health Profile.
32 *
David Duarteee52b7e2023-12-02 01:32:11 +000033 * <p>BluetoothHealth is a proxy object for controlling the Bluetooth Service via IPC.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070034 *
David Duarteee52b7e2023-12-02 01:32:11 +000035 * <p>How to connect to a health device which is acting in the source role.
36 * <li>Use {@link BluetoothAdapter#getProfileProxy} to get the BluetoothHealth proxy object.
37 * <li>Create an {@link BluetoothHealth} callback and call {@link #registerSinkAppConfiguration} to
38 * register an application configuration
39 * <li>Pair with the remote device. This currently needs to be done manually from Bluetooth Settings
40 * <li>Connect to a health device using {@link #connectChannelToSource}. Some devices will connect
41 * the channel automatically. The {@link BluetoothHealth} callback will inform the application
42 * of channel state change.
43 * <li>Use the file descriptor provided with a connected channel to read and write data to the
44 * health channel.
45 * <li>The received data needs to be interpreted using a health manager which implements the IEEE
46 * 11073-xxxxx specifications.
47 * <li>When done, close the health channel by calling {@link #disconnectChannel} and unregister the
48 * application configuration calling {@link #unregisterAppConfiguration}
Jack He8bb9c7d2019-01-03 16:23:41 -080049 *
David Duarteee52b7e2023-12-02 01:32:11 +000050 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use
51 * Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +000052 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +000053 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070054 */
Jack He8bb9c7d2019-01-03 16:23:41 -080055@Deprecated
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070056public final class BluetoothHealth implements BluetoothProfile {
57 private static final String TAG = "BluetoothHealth";
David Duarteee52b7e2023-12-02 01:32:11 +000058
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070059 /**
60 * Health Profile Source Role - the health device.
Jack He8bb9c7d2019-01-03 16:23:41 -080061 *
David Duarteee52b7e2023-12-02 01:32:11 +000062 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
63 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +000064 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +000065 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070066 */
David Duarteee52b7e2023-12-02 01:32:11 +000067 @Deprecated public static final int SOURCE_ROLE = 1 << 0;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070068
69 /**
70 * Health Profile Sink Role the device talking to the health device.
Jack He8bb9c7d2019-01-03 16:23:41 -080071 *
David Duarteee52b7e2023-12-02 01:32:11 +000072 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
73 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +000074 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +000075 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070076 */
David Duarteee52b7e2023-12-02 01:32:11 +000077 @Deprecated public static final int SINK_ROLE = 1 << 1;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070078
79 /**
80 * Health Profile - Channel Type used - Reliable
Jack He8bb9c7d2019-01-03 16:23:41 -080081 *
David Duarteee52b7e2023-12-02 01:32:11 +000082 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
83 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +000084 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +000085 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070086 */
David Duarteee52b7e2023-12-02 01:32:11 +000087 @Deprecated public static final int CHANNEL_TYPE_RELIABLE = 10;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070088
89 /**
90 * Health Profile - Channel Type used - Streaming
Jack He8bb9c7d2019-01-03 16:23:41 -080091 *
David Duarteee52b7e2023-12-02 01:32:11 +000092 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
93 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +000094 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +000095 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070096 */
David Duarteee52b7e2023-12-02 01:32:11 +000097 @Deprecated public static final int CHANNEL_TYPE_STREAMING = 11;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -070098
Jack Hef2d49bd2019-03-28 17:42:26 -070099 /**
100 * Hide auto-created default constructor
David Duarteee52b7e2023-12-02 01:32:11 +0000101 *
Jack Hef2d49bd2019-03-28 17:42:26 -0700102 * @hide
103 */
104 BluetoothHealth() {}
Jaikumar Ganesh2c7f1482011-09-07 14:16:52 -0700105
David Duartef5b3bc52023-10-17 00:55:06 +0000106 /** @hide */
107 @Override
108 public void onServiceConnected(IBinder service) {}
109
110 /** @hide */
111 @Override
112 public void onServiceDisconnected() {}
113
114 /** @hide */
115 @Override
116 public BluetoothAdapter getAdapter() {
117 return null;
118 }
119
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700120 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000121 * Register an application configuration that acts as a Health SINK. This is the configuration
122 * that will be used to communicate with health devices which will act as the {@link
123 * #SOURCE_ROLE}. This is an asynchronous call and so the callback is used to notify success or
124 * failure if the function returns true.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700125 *
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700126 * @param name The friendly name associated with the application or configuration.
Jack He910201b2017-08-22 16:06:54 -0700127 * @param dataType The dataType of the Source role of Health Profile to which the sink wants to
David Duarteee52b7e2023-12-02 01:32:11 +0000128 * connect to.
Jack He910201b2017-08-22 16:06:54 -0700129 * @param callback A callback to indicate success or failure of the registration and all
David Duarteee52b7e2023-12-02 01:32:11 +0000130 * operations done on this application configuration.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700131 * @return If true, callback will be called.
David Duarteee52b7e2023-12-02 01:32:11 +0000132 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
133 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000134 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000135 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700136 */
Jack He8bb9c7d2019-01-03 16:23:41 -0800137 @Deprecated
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600138 @RequiresLegacyBluetoothPermission
139 @RequiresBluetoothConnectPermission
140 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
141 @SuppressLint("AndroidFrameworkRequiresPermission")
David Duarteee52b7e2023-12-02 01:32:11 +0000142 public boolean registerSinkAppConfiguration(
143 String name, int dataType, BluetoothHealthCallback callback) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800144 Log.e(TAG, "registerSinkAppConfiguration(): BluetoothHealth is deprecated");
145 return false;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700146 }
147
148 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000149 * Unregister an application configuration that has been registered using {@link
150 * #registerSinkAppConfiguration}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700151 *
Jack He910201b2017-08-22 16:06:54 -0700152 * @param config The health app configuration
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700153 * @return Success or failure.
David Duarteee52b7e2023-12-02 01:32:11 +0000154 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
155 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000156 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000157 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700158 */
Jack He8bb9c7d2019-01-03 16:23:41 -0800159 @Deprecated
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600160 @RequiresLegacyBluetoothPermission
161 @RequiresBluetoothConnectPermission
162 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
163 @SuppressLint("AndroidFrameworkRequiresPermission")
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700164 public boolean unregisterAppConfiguration(BluetoothHealthAppConfiguration config) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800165 Log.e(TAG, "unregisterAppConfiguration(): BluetoothHealth is deprecated");
166 return false;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700167 }
168
169 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000170 * Connect to a health device which has the {@link #SOURCE_ROLE}. This is an asynchronous call.
171 * If this function returns true, the callback associated with the application configuration
172 * will be called.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700173 *
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700174 * @param device The remote Bluetooth device.
Jack He910201b2017-08-22 16:06:54 -0700175 * @param config The application configuration which has been registered using {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000176 * #registerSinkAppConfiguration(String, int, BluetoothHealthCallback) }
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700177 * @return If true, the callback associated with the application config will be called.
David Duarteee52b7e2023-12-02 01:32:11 +0000178 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
179 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000180 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000181 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700182 */
Jack He8bb9c7d2019-01-03 16:23:41 -0800183 @Deprecated
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600184 @RequiresLegacyBluetoothPermission
185 @RequiresBluetoothConnectPermission
186 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
187 @SuppressLint("AndroidFrameworkRequiresPermission")
David Duarteee52b7e2023-12-02 01:32:11 +0000188 public boolean connectChannelToSource(
189 BluetoothDevice device, BluetoothHealthAppConfiguration config) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800190 Log.e(TAG, "connectChannelToSource(): BluetoothHealth is deprecated");
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700191 return false;
192 }
193
194 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000195 * Disconnect a connected health channel. This is an asynchronous call. If this function returns
196 * true, the callback associated with the application configuration will be called.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700197 *
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700198 * @param device The remote Bluetooth device.
Jack He910201b2017-08-22 16:06:54 -0700199 * @param config The application configuration which has been registered using {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000200 * #registerSinkAppConfiguration(String, int, BluetoothHealthCallback) }
Jaikumar Ganesh090847e2011-08-31 15:36:05 -0700201 * @param channelId The channel id associated with the channel
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700202 * @return If true, the callback associated with the application config will be called.
David Duarteee52b7e2023-12-02 01:32:11 +0000203 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
204 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000205 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000206 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700207 */
Jack He8bb9c7d2019-01-03 16:23:41 -0800208 @Deprecated
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600209 @RequiresLegacyBluetoothPermission
210 @RequiresBluetoothConnectPermission
211 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
212 @SuppressLint("AndroidFrameworkRequiresPermission")
David Duarteee52b7e2023-12-02 01:32:11 +0000213 public boolean disconnectChannel(
214 BluetoothDevice device, BluetoothHealthAppConfiguration config, int channelId) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800215 Log.e(TAG, "disconnectChannel(): BluetoothHealth is deprecated");
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700216 return false;
217 }
218
219 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000220 * Get the file descriptor of the main channel associated with the remote device and application
221 * configuration.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700222 *
David Duarte1c07fc72023-12-02 02:08:08 +0000223 * <p>It's the responsibility of the caller to close the ParcelFileDescriptor when done.
Jaikumar Ganesh090847e2011-08-31 15:36:05 -0700224 *
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700225 * @param device The remote Bluetooth health device
226 * @param config The application configuration
227 * @return null on failure, ParcelFileDescriptor on success.
David Duarteee52b7e2023-12-02 01:32:11 +0000228 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
229 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000230 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000231 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700232 */
Jack He8bb9c7d2019-01-03 16:23:41 -0800233 @Deprecated
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600234 @RequiresLegacyBluetoothPermission
235 @RequiresBluetoothConnectPermission
236 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
237 @SuppressLint("AndroidFrameworkRequiresPermission")
David Duarteee52b7e2023-12-02 01:32:11 +0000238 public ParcelFileDescriptor getMainChannelFd(
239 BluetoothDevice device, BluetoothHealthAppConfiguration config) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800240 Log.e(TAG, "getMainChannelFd(): BluetoothHealth is deprecated");
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700241 return null;
242 }
243
244 /**
245 * Get the current connection state of the profile.
246 *
David Duarteee52b7e2023-12-02 01:32:11 +0000247 * <p>This is not specific to any application configuration but represents the connection state
248 * of the local Bluetooth adapter with the remote device. This can be used by applications like
249 * status bar which would just like to know the state of the local adapter.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700250 *
251 * @param device Remote bluetooth device.
Jack He910201b2017-08-22 16:06:54 -0700252 * @return State of the profile connection. One of {@link #STATE_CONNECTED}, {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000253 * #STATE_CONNECTING}, {@link #STATE_DISCONNECTED}, {@link #STATE_DISCONNECTING}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700254 */
Jaikumar Ganeshd3b7d1d2011-07-06 17:37:02 -0700255 @Override
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600256 @RequiresLegacyBluetoothPermission
257 @RequiresBluetoothConnectPermission
258 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
259 @SuppressLint("AndroidFrameworkRequiresPermission")
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700260 public int getConnectionState(BluetoothDevice device) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800261 Log.e(TAG, "getConnectionState(): BluetoothHealth is deprecated");
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700262 return STATE_DISCONNECTED;
263 }
264
265 /**
Jaikumar Ganesh090847e2011-08-31 15:36:05 -0700266 * Get connected devices for the health profile.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700267 *
David Duarteee52b7e2023-12-02 01:32:11 +0000268 * <p>Return the set of devices which are in state {@link #STATE_CONNECTED}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700269 *
David Duarteee52b7e2023-12-02 01:32:11 +0000270 * <p>This is not specific to any application configuration but represents the connection state
271 * of the local Bluetooth adapter for this profile. This can be used by applications like status
272 * bar which would just like to know the state of the local adapter.
Jack He910201b2017-08-22 16:06:54 -0700273 *
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700274 * @return List of devices. The list will be empty on error.
275 */
Jaikumar Ganeshd3b7d1d2011-07-06 17:37:02 -0700276 @Override
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600277 @RequiresLegacyBluetoothPermission
278 @RequiresBluetoothConnectPermission
279 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
280 @SuppressLint("AndroidFrameworkRequiresPermission")
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700281 public List<BluetoothDevice> getConnectedDevices() {
Jack He8bb9c7d2019-01-03 16:23:41 -0800282 Log.e(TAG, "getConnectedDevices(): BluetoothHealth is deprecated");
William Escande5e8e1532024-03-27 18:02:23 +0000283 return Collections.emptyList();
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700284 }
285
286 /**
David Duarteee52b7e2023-12-02 01:32:11 +0000287 * Get a list of devices that match any of the given connection states.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700288 *
David Duarteee52b7e2023-12-02 01:32:11 +0000289 * <p>If none of the devices match any of the given states, an empty list will be returned.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700290 *
David Duarteee52b7e2023-12-02 01:32:11 +0000291 * <p>This is not specific to any application configuration but represents the connection state
292 * of the local Bluetooth adapter for this profile. This can be used by applications like status
293 * bar which would just like to know the state of the local adapter.
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700294 *
Jack He910201b2017-08-22 16:06:54 -0700295 * @param states Array of states. States can be one of {@link #STATE_CONNECTED}, {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000296 * #STATE_CONNECTING}, {@link #STATE_DISCONNECTED}, {@link #STATE_DISCONNECTING},
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700297 * @return List of devices. The list will be empty on error.
298 */
Jaikumar Ganeshd3b7d1d2011-07-06 17:37:02 -0700299 @Override
Jeff Sharkey8f80e4a2021-04-02 08:06:09 -0600300 @RequiresLegacyBluetoothPermission
301 @RequiresBluetoothConnectPermission
302 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
303 @SuppressLint("AndroidFrameworkRequiresPermission")
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700304 public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
Jack He8bb9c7d2019-01-03 16:23:41 -0800305 Log.e(TAG, "getDevicesMatchingConnectionStates(): BluetoothHealth is deprecated");
William Escande5e8e1532024-03-27 18:02:23 +0000306 return Collections.emptyList();
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700307 }
308
David Duarteee52b7e2023-12-02 01:32:11 +0000309 /**
310 * Health Channel Connection State - Disconnected
Jack He8bb9c7d2019-01-03 16:23:41 -0800311 *
David Duarteee52b7e2023-12-02 01:32:11 +0000312 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
313 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000314 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000315 * BluetoothDevice#createL2capChannel(int)}
Jack He8bb9c7d2019-01-03 16:23:41 -0800316 */
David Duarteee52b7e2023-12-02 01:32:11 +0000317 @Deprecated public static final int STATE_CHANNEL_DISCONNECTED = 0;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700318
David Duarteee52b7e2023-12-02 01:32:11 +0000319 /**
320 * Health Channel Connection State - Connecting
Jack He8bb9c7d2019-01-03 16:23:41 -0800321 *
David Duarteee52b7e2023-12-02 01:32:11 +0000322 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
323 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000324 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000325 * BluetoothDevice#createL2capChannel(int)}
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700326 */
David Duarteee52b7e2023-12-02 01:32:11 +0000327 @Deprecated public static final int STATE_CHANNEL_CONNECTING = 1;
328
329 /**
330 * Health Channel Connection State - Connected
Jack He8bb9c7d2019-01-03 16:23:41 -0800331 *
David Duarteee52b7e2023-12-02 01:32:11 +0000332 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
333 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000334 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000335 * BluetoothDevice#createL2capChannel(int)}
Jack He8bb9c7d2019-01-03 16:23:41 -0800336 */
David Duarteee52b7e2023-12-02 01:32:11 +0000337 @Deprecated public static final int STATE_CHANNEL_CONNECTED = 2;
338
339 /**
340 * Health Channel Connection State - Disconnecting
Jack He8bb9c7d2019-01-03 16:23:41 -0800341 *
David Duarteee52b7e2023-12-02 01:32:11 +0000342 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
343 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000344 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000345 * BluetoothDevice#createL2capChannel(int)}
Jack He8bb9c7d2019-01-03 16:23:41 -0800346 */
David Duarteee52b7e2023-12-02 01:32:11 +0000347 @Deprecated public static final int STATE_CHANNEL_DISCONNECTING = 3;
348
349 /**
350 * Health App Configuration registration success
Jack He8bb9c7d2019-01-03 16:23:41 -0800351 *
David Duarteee52b7e2023-12-02 01:32:11 +0000352 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
353 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000354 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000355 * BluetoothDevice#createL2capChannel(int)}
Jack He8bb9c7d2019-01-03 16:23:41 -0800356 */
David Duarteee52b7e2023-12-02 01:32:11 +0000357 @Deprecated public static final int APP_CONFIG_REGISTRATION_SUCCESS = 0;
358
359 /**
360 * Health App Configuration registration failure
361 *
362 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
363 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000364 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000365 * BluetoothDevice#createL2capChannel(int)}
366 */
367 @Deprecated public static final int APP_CONFIG_REGISTRATION_FAILURE = 1;
368
369 /**
370 * Health App Configuration un-registration success
371 *
372 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
373 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000374 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000375 * BluetoothDevice#createL2capChannel(int)}
376 */
377 @Deprecated public static final int APP_CONFIG_UNREGISTRATION_SUCCESS = 2;
378
379 /**
380 * Health App Configuration un-registration failure
381 *
382 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
383 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link
David Duarte5a02bb42023-12-04 23:07:42 +0000384 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link
David Duarteee52b7e2023-12-02 01:32:11 +0000385 * BluetoothDevice#createL2capChannel(int)}
386 */
387 @Deprecated public static final int APP_CONFIG_UNREGISTRATION_FAILURE = 3;
Jaikumar Ganeshbf981ca2011-04-01 16:33:09 -0700388}