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_errors.h" 23 #include "battery_stats_info.h" 24 25 namespace OHOS { 26 namespace PowerMgr { 27 class IBatteryStats : public IRemoteBroker { 28 public: 29 virtual BatteryStatsInfoList GetBatteryStats() = 0; 30 virtual void SetOnBattery(bool isOnBattery) = 0; 31 virtual double GetAppStatsMah(const int32_t& uid) = 0; 32 virtual double GetAppStatsPercent(const int32_t& uid) = 0; 33 virtual double GetPartStatsMah(const BatteryStatsInfo::ConsumptionType& type) = 0; 34 virtual double GetPartStatsPercent(const BatteryStatsInfo::ConsumptionType& type) = 0; 35 virtual uint64_t GetTotalTimeSecond(const StatsUtils::StatsType& statsType, 36 const int32_t& uid = StatsUtils::INVALID_VALUE) = 0; 37 virtual uint64_t GetTotalDataBytes(const StatsUtils::StatsType& statsType, 38 const int32_t& uid = StatsUtils::INVALID_VALUE) = 0; 39 virtual void Reset() = 0; 40 virtual std::string ShellDump(const std::vector<std::string>& args, uint32_t argc) = 0; 41 virtual StatsError GetLastError() = 0; 42 public: 43 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.powermgr.IBatteryStats"); 44 }; 45 } // namespace PowerMgr 46 } // namespace OHOS 47 48 #endif // IBATTERY_STATS_H 49