1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Bluetooth 18 * @{ 19 * 20 * @brief Defines remote device battery level observer. 21 * 22 */ 23 24 /** 25 * @file classic_battery_observer.h 26 * 27 * @brief Classic remote device battery level observer functions. 28 * 29 */ 30 31 #ifndef CLASSIC_BATTERY_OBSERVER 32 #define CLASSIC_BATTERY_OBSERVER 33 34 #include "base_def.h" 35 #include "dispatcher.h" 36 #include "interface_profile_hfp_ag.h" 37 #include "interface_profile_hfp_hf.h" 38 39 namespace OHOS { 40 namespace bluetooth { 41 class ClassicBatteryObserverHf : public HfpHfServiceObserver { 42 public: 43 explicit ClassicBatteryObserverHf(utility::Dispatcher &dispatcher); 44 ~ClassicBatteryObserverHf(); 45 void OnBatteryLevelChanged(const RawAddress &device, int batteryLevel); 46 void SetBatteryLevel(const RawAddress &device, int batteryLevel) const; 47 48 private: 49 utility::Dispatcher *dispatcher_ = nullptr; 50 BT_DISALLOW_COPY_AND_ASSIGN(ClassicBatteryObserverHf); 51 }; 52 53 class ClassicBatteryObserverAg : public HfpAgServiceObserver { 54 public: 55 explicit ClassicBatteryObserverAg(utility::Dispatcher &dispatcher); 56 ~ClassicBatteryObserverAg(); 57 void OnHfBatteryLevelChanged(const RawAddress &device, int indValue); 58 void SetBatteryLevel(const RawAddress &device, int batteryLevel) const; 59 60 private: 61 utility::Dispatcher *dispatcher_ = nullptr; 62 63 BT_DISALLOW_COPY_AND_ASSIGN(ClassicBatteryObserverAg); 64 }; 65 } // namespace bluetooth 66 } // namespace OHOS 67 #endif // CLASSIC_BATTERY_OBSERVER