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