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. |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 26 | */ |
| 27 | public abstract class BluetoothHealthCallback { |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 28 | private static final String TAG = "BluetoothHealthCallback"; |
| 29 | |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Callback to inform change in registration state of the health |
| 32 | * application. |
| 33 | * <p> This callback is called on the binder thread (not on the UI thread) |
| 34 | * |
| 35 | * @param config Bluetooth Health app configuration |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 36 | * @param status Success or failure of the registration or unregistration calls. Can be one of |
| 37 | * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or {@link |
| 38 | * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or |
| 39 | * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} |
| 40 | * or {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 41 | */ |
Tor Norbye | 83c6896 | 2015-03-10 20:55:31 -0700 | [diff] [blame] | 42 | @BinderThread |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 43 | public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 44 | int status) { |
| 45 | Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 46 | } |
| 47 | |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 48 | /** |
| 49 | * Callback to inform change in channel state. |
| 50 | * <p> Its the responsibility of the implementor of this callback to close the |
| 51 | * parcel file descriptor when done. This callback is called on the Binder |
| 52 | * thread (not the UI thread) |
| 53 | * |
| 54 | * @param config The Health app configutation |
| 55 | * @param device The Bluetooth Device |
| 56 | * @param prevState The previous state of the channel |
| 57 | * @param newState The new state of the channel. |
| 58 | * @param fd The Parcel File Descriptor when the channel state is connected. |
Jack He | a355e5e | 2017-08-22 16:06:54 -0700 | [diff] [blame] | 59 | * @param channelId The id associated with the channel. This id will be used in future calls |
| 60 | * like when disconnecting the channel. |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 61 | */ |
Tor Norbye | 83c6896 | 2015-03-10 20:55:31 -0700 | [diff] [blame] | 62 | @BinderThread |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 63 | public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, |
Jaikumar Ganesh | eb9d346 | 2011-08-31 15:36:05 -0700 | [diff] [blame] | 64 | BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, |
| 65 | int channelId) { |
Jack He | 2992cd0 | 2017-08-22 21:21:23 -0700 | [diff] [blame] | 66 | Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device |
| 67 | + "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd |
| 68 | + "ChannelId:" + channelId); |
Jaikumar Ganesh | fb658c7 | 2011-07-06 17:37:02 -0700 | [diff] [blame] | 69 | } |
| 70 | } |