1d590543dSopenharmony_ci/*
2d590543dSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3d590543dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d590543dSopenharmony_ci * you may not use this file except in compliance with the License.
5d590543dSopenharmony_ci * You may obtain a copy of the License at
6d590543dSopenharmony_ci *
7d590543dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d590543dSopenharmony_ci *
9d590543dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d590543dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d590543dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d590543dSopenharmony_ci * See the License for the specific language governing permissions and
13d590543dSopenharmony_ci * limitations under the License.
14d590543dSopenharmony_ci */
15d590543dSopenharmony_ci
16d590543dSopenharmony_ci#ifndef BATTERY_STATS_PROXY_H
17d590543dSopenharmony_ci#define BATTERY_STATS_PROXY_H
18d590543dSopenharmony_ci
19d590543dSopenharmony_ci#include <cstdint>
20d590543dSopenharmony_ci#include <functional>
21d590543dSopenharmony_ci#include <iosfwd>
22d590543dSopenharmony_ci#include <vector>
23d590543dSopenharmony_ci#include <iremote_proxy.h>
24d590543dSopenharmony_ci#include <nocopyable.h>
25d590543dSopenharmony_ci#include "iremote_broker.h"
26d590543dSopenharmony_ci#include "iremote_object.h"
27d590543dSopenharmony_ci#include "refbase.h"
28d590543dSopenharmony_ci#include "ibattery_stats.h"
29d590543dSopenharmony_ci#include "battery_stats_info.h"
30d590543dSopenharmony_ci
31d590543dSopenharmony_cinamespace OHOS {
32d590543dSopenharmony_cinamespace PowerMgr {
33d590543dSopenharmony_ciclass BatteryStatsProxy : public IRemoteProxy<IBatteryStats> {
34d590543dSopenharmony_cipublic:
35d590543dSopenharmony_ci    explicit BatteryStatsProxy(const sptr<IRemoteObject>& impl)
36d590543dSopenharmony_ci        : IRemoteProxy<IBatteryStats>(impl) {}
37d590543dSopenharmony_ci    ~BatteryStatsProxy() = default;
38d590543dSopenharmony_ci    DISALLOW_COPY_AND_MOVE(BatteryStatsProxy);
39d590543dSopenharmony_ci
40d590543dSopenharmony_ci    virtual BatteryStatsInfoList GetBatteryStats() override;
41d590543dSopenharmony_ci    virtual void SetOnBattery(bool isOnBattery) override;
42d590543dSopenharmony_ci    virtual double GetAppStatsMah(const int32_t& uid) override;
43d590543dSopenharmony_ci    virtual double GetAppStatsPercent(const int32_t& uid) override;
44d590543dSopenharmony_ci    virtual double GetPartStatsMah(const BatteryStatsInfo::ConsumptionType& type) override;
45d590543dSopenharmony_ci    virtual double GetPartStatsPercent(const BatteryStatsInfo::ConsumptionType& type) override;
46d590543dSopenharmony_ci    virtual uint64_t GetTotalTimeSecond(const StatsUtils::StatsType& statsType, const int32_t& uid) override;
47d590543dSopenharmony_ci    virtual uint64_t GetTotalDataBytes(const StatsUtils::StatsType& statsType, const int32_t& uid) override;
48d590543dSopenharmony_ci    virtual void Reset() override;
49d590543dSopenharmony_ci    virtual std::string ShellDump(const std::vector<std::string>& args, uint32_t argc) override;
50d590543dSopenharmony_ci    virtual StatsError GetLastError() override;
51d590543dSopenharmony_ciprivate:
52d590543dSopenharmony_ci    static inline BrokerDelegator<BatteryStatsProxy> delegator_;
53d590543dSopenharmony_ci    StatsError lastError_ {StatsError::ERR_OK};
54d590543dSopenharmony_ci};
55d590543dSopenharmony_ci} // namespace PowerMgr
56d590543dSopenharmony_ci} // namespace OHOS
57d590543dSopenharmony_ci#endif // BATTERY_STATS_PROXY_H