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
18package android.bluetooth;
19
20import android.os.ParcelFileDescriptor;
21import android.util.Log;
22
23/**
24 * This abstract class is used to implement {@link BluetoothHealth} callbacks.
25 */
26public abstract class BluetoothHealthCallback {
27    private static final String TAG = "BluetoothHealthCallback";
28
29    /**
30     * Callback to inform change in registration state of the health
31     * application.
32     * <p> This callback is called on the binder thread (not on the UI thread)
33     *
34     * @param config Bluetooth Health app configuration
35     * @param status Success or failure of the registration or unregistration
36     *            calls. Can be one of
37     *            {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or
38     *            {@link BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or
39     *            {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} or
40     *            {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE}
41     */
42    public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config,
43            int status) {
44        Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status);
45    }
46
47    /**
48     * Callback to inform change in channel state.
49     * <p> Its the responsibility of the implementor of this callback to close the
50     * parcel file descriptor when done. This callback is called on the Binder
51     * thread (not the UI thread)
52     *
53     * @param config The Health app configutation
54     * @param device The Bluetooth Device
55     * @param prevState The previous state of the channel
56     * @param newState The new state of the channel.
57     * @param fd The Parcel File Descriptor when the channel state is connected.
58     * @param channelId The id associated with the channel. This id will be used
59     *            in future calls like when disconnecting the channel.
60     */
61    public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config,
62            BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd,
63            int channelId) {
64        Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device +
65              "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd +
66              "ChannelId:" + channelId);
67    }
68}
69