Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | |
| 18 | package android.bluetooth; |
| 19 | |
Tor Norbye | 83c6896 | 2015-03-10 20:55:31 -0700 | [diff] [blame] | 20 | import android.annotation.BinderThread; |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 21 | import android.os.ParcelFileDescriptor; |
| 22 | import android.util.Log; |
| 23 | |
| 24 | /** |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 25 | * This abstract class is used to implement {@link BluetoothHealth} callbacks. |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 26 | * |
| 27 | * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New |
| 28 | * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, |
| 29 | * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or |
| 30 | * {@link BluetoothDevice#createL2capChannel(int)} |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 31 | */ |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 32 | @Deprecated |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 33 | public abstract class BluetoothHealthCallback { |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 34 | private static final String TAG = "BluetoothHealthCallback"; |
| 35 | |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Callback to inform change in registration state of the health |
| 38 | * application. |
| 39 | * <p> This callback is called on the binder thread (not on the UI thread) |
| 40 | * |
| 41 | * @param config Bluetooth Health app configuration |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 42 | * @param status Success or failure of the registration or unregistration calls. Can be one of |
| 43 | * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or {@link |
| 44 | * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or |
| 45 | * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} |
| 46 | * or {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 47 | * |
| 48 | * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New |
| 49 | * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, |
| 50 | * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or |
| 51 | * {@link BluetoothDevice#createL2capChannel(int)} |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 52 | */ |
Tor Norbye | 83c6896 | 2015-03-10 20:55:31 -0700 | [diff] [blame] | 53 | @BinderThread |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 54 | @Deprecated |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 55 | public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 56 | int status) { |
| 57 | Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Callback to inform change in channel state. |
| 62 | * <p> Its the responsibility of the implementor of this callback to close the |
| 63 | * parcel file descriptor when done. This callback is called on the Binder |
| 64 | * thread (not the UI thread) |
| 65 | * |
| 66 | * @param config The Health app configutation |
| 67 | * @param device The Bluetooth Device |
| 68 | * @param prevState The previous state of the channel |
| 69 | * @param newState The new state of the channel. |
| 70 | * @param fd The Parcel File Descriptor when the channel state is connected. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 71 | * @param channelId The id associated with the channel. This id will be used in future calls |
| 72 | * like when disconnecting the channel. |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 73 | * |
| 74 | * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New |
| 75 | * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, |
| 76 | * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or |
| 77 | * {@link BluetoothDevice#createL2capChannel(int)} |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 78 | */ |
Tor Norbye | 83c6896 | 2015-03-10 20:55:31 -0700 | [diff] [blame] | 79 | @BinderThread |
Jack He | 6b73b32 | 2019-01-03 16:23:41 -0800 | [diff] [blame] | 80 | @Deprecated |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 81 | public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 82 | BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, |
| 83 | int channelId) { |
Jack He | 2992cd0 | 2017-08-22 21:21:23 -0700 | [diff] [blame] | 84 | Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device |
| 85 | + "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd |
| 86 | + "ChannelId:" + channelId); |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 87 | } |
| 88 | } |