1 /* 2 * Copyright (c) 2021 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 #ifndef IBATTERY_STATS_H 17 #define IBATTERY_STATS_H 18 19 #include "iremote_broker.h" 20 #include "iremote_object.h" 21 22 #include "battery_stats_info.h" 23 24 namespace OHOS { 25 namespace PowerMgr { 26 class IBatteryStats : public IRemoteBroker { 27 public: 28 enum { 29 BATTERY_STATS_GET = 0, 30 BATTERY_STATS_GETAPPMAH, 31 BATTERY_STATS_GETAPPPER, 32 BATTERY_STATS_GETPARTMAH, 33 BATTERY_STATS_GETPARTPER, 34 BATTERY_STATS_GETTIME, 35 BATTERY_STATS_GETDATA, 36 BATTERY_STATS_RESET, 37 BATTERY_STATS_SETONBATT, 38 BATTERY_STATS_DUMP, 39 }; 40 virtual BatteryStatsInfoList GetBatteryStats() = 0; 41 virtual void SetOnBattery(bool isOnBattery) = 0; 42 virtual double GetAppStatsMah(const int32_t& uid) = 0; 43 virtual double GetAppStatsPercent(const int32_t& uid) = 0; 44 virtual double GetPartStatsMah(const BatteryStatsInfo::ConsumptionType& type) = 0; 45 virtual double GetPartStatsPercent(const BatteryStatsInfo::ConsumptionType& type) = 0; 46 virtual uint64_t GetTotalTimeSecond(const StatsUtils::StatsType& statsType, 47 const int32_t& uid = StatsUtils::INVALID_VALUE) = 0; 48 virtual uint64_t GetTotalDataBytes(const StatsUtils::StatsType& statsType, 49 const int32_t& uid = StatsUtils::INVALID_VALUE) = 0; 50 virtual void Reset() = 0; 51 virtual std::string ShellDump(const std::vector<std::string>& args, uint32_t argc) = 0; 52 public: 53 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.powermgr.IBatteryStats"); 54 }; 55 } // namespace PowerMgr 56 } // namespace OHOS 57 58 #endif // IBATTERY_STATS_H 59