1 /*
2  * Copyright (c) 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 #ifndef STATS_SERVICE_TEST_PROXY_H
17 #define STATS_SERVICE_TEST_PROXY_H
18 
19 #include <cstdint>
20 #include <vector>
21 
22 #include "battery_stats_info.h"
23 #include "battery_stats_service.h"
24 #include "battery_stats_stub.h"
25 
26 namespace OHOS {
27 namespace PowerMgr {
28 class StatsServiceTestProxy {
29 public:
30     StatsServiceTestProxy(const sptr<BatteryStatsService>& service);
31     ~StatsServiceTestProxy() = default;
32 
33     BatteryStatsInfoList GetBatteryStats();
34     bool SetOnBattery(bool isOnBattery);
35     double GetAppStatsMah(const int32_t& uid);
36     double GetAppStatsPercent(const int32_t& uid);
37     double GetPartStatsMah(const BatteryStatsInfo::ConsumptionType& type);
38     double GetPartStatsPercent(const BatteryStatsInfo::ConsumptionType& type);
39     uint64_t GetTotalTimeSecond(const StatsUtils::StatsType& statsType, const int32_t& uid = StatsUtils::INVALID_VALUE);
40     uint64_t GetTotalDataBytes(const StatsUtils::StatsType& statsType, const int32_t& uid = StatsUtils::INVALID_VALUE);
41     bool Reset();
42     std::string ShellDump(const std::vector<std::string>& args, uint32_t argc);
43 
44 private:
45     sptr<BatteryStatsStub> stub_ {nullptr};
46 };
47 } // namespace PowerMgr
48 } // namespace OHOS
49 #endif // STATS_SERVICE_TEST_PROXY_H