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 package android.bluetooth; 18 19 import android.annotation.BinderThread; 20 import android.os.ParcelFileDescriptor; 21 import android.util.Log; 22 23 /** 24 * This abstract class is used to implement {@link BluetoothHealth} callbacks. 25 * 26 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use 27 * Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link 28 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link 29 * BluetoothDevice#createL2capChannel(int)} 30 */ 31 @Deprecated 32 public abstract class BluetoothHealthCallback { 33 private static final String TAG = "BluetoothHealthCallback"; 34 35 /** 36 * Callback to inform change in registration state of the health application. 37 * 38 * <p>This callback is called on the binder thread (not on the UI thread) 39 * 40 * @param config Bluetooth Health app configuration 41 * @param status Success or failure of the registration or unregistration calls. Can be one of 42 * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or {@link 43 * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or {@link 44 * BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} or {@link 45 * BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} 46 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should 47 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link 48 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link 49 * BluetoothDevice#createL2capChannel(int)} 50 */ 51 @BinderThread 52 @Deprecated onHealthAppConfigurationStatusChange( BluetoothHealthAppConfiguration config, int status)53 public void onHealthAppConfigurationStatusChange( 54 BluetoothHealthAppConfiguration config, int status) { 55 Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); 56 } 57 58 /** 59 * Callback to inform change in channel state. 60 * 61 * <p>It's the responsibility of the implementer of this callback to close the parcel file 62 * descriptor when done. This callback is called on the Binder thread (not the UI thread) 63 * 64 * @param config The Health app configuration 65 * @param device The Bluetooth Device 66 * @param prevState The previous state of the channel 67 * @param newState The new state of the channel. 68 * @param fd The Parcel File Descriptor when the channel state is connected. 69 * @param channelId The id associated with the channel. This id will be used in future calls 70 * like when disconnecting the channel. 71 * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should 72 * use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, {@link 73 * BluetoothAdapter#listenUsingL2capChannel()}, or {@link 74 * BluetoothDevice#createL2capChannel(int)} 75 */ 76 @BinderThread 77 @Deprecated onHealthChannelStateChange( BluetoothHealthAppConfiguration config, BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, int channelId)78 public void onHealthChannelStateChange( 79 BluetoothHealthAppConfiguration config, 80 BluetoothDevice device, 81 int prevState, 82 int newState, 83 ParcelFileDescriptor fd, 84 int channelId) { 85 Log.d( 86 TAG, 87 "onHealthChannelStateChange: " 88 + config 89 + "Device: " 90 + device 91 + "prevState:" 92 + prevState 93 + "newState:" 94 + newState 95 + "ParcelFd:" 96 + fd 97 + "ChannelId:" 98 + channelId); 99 } 100 } 101