1fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh/* 2fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * Copyright (C) 2011 The Android Open Source Project 3fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * 4fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * Licensed under the Apache License, Version 2.0 (the "License"); 5fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * you may not use this file except in compliance with the License. 6fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * You may obtain a copy of the License at 7fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * 8fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * http://www.apache.org/licenses/LICENSE-2.0 9fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * 10fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * Unless required by applicable law or agreed to in writing, software 11fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * distributed under the License is distributed on an "AS IS" BASIS, 12fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * See the License for the specific language governing permissions and 14fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh * limitations under the License. 15fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh */ 16fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 17fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 18fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganeshpackage android.bluetooth; 19fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 20fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganeshimport android.os.ParcelFileDescriptor; 21fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganeshimport android.util.Log; 22fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 23fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh/** 24eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * This abstract class is used to implement {@link BluetoothHealth} callbacks. 25fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh */ 26fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganeshpublic abstract class BluetoothHealthCallback { 27fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh private static final String TAG = "BluetoothHealthCallback"; 28fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 29eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh /** 30eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * Callback to inform change in registration state of the health 31eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * application. 32eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * <p> This callback is called on the binder thread (not on the UI thread) 33eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * 34eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param config Bluetooth Health app configuration 35eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param status Success or failure of the registration or unregistration 36eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * calls. Can be one of 37eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or 38eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or 39eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} or 40eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} 41eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh */ 42fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, 43eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh int status) { 44eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); 45fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh } 46fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh 47eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh /** 48eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * Callback to inform change in channel state. 49eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * <p> Its the responsibility of the implementor of this callback to close the 50eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * parcel file descriptor when done. This callback is called on the Binder 51eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * thread (not the UI thread) 52eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * 53eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param config The Health app configutation 54eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param device The Bluetooth Device 55eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param prevState The previous state of the channel 56eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param newState The new state of the channel. 57eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param fd The Parcel File Descriptor when the channel state is connected. 58eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * @param channelId The id associated with the channel. This id will be used 59eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh * in future calls like when disconnecting the channel. 60eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh */ 61fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, 62eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, 63eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh int channelId) { 64eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device + 65eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd + 66eb9d34630f74d0260690287f2df57c0cd3d7ba1dJaikumar Ganesh "ChannelId:" + channelId); 67fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh } 68fb658c72a3a76dac334c39070d1501a2575c1069Jaikumar Ganesh} 69