• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 BATTERY_SRV_PROXY_H
17 #define BATTERY_SRV_PROXY_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <iosfwd>
22 #include "refbase.h"
23 #include "nocopyable.h"
24 #include "iremote_broker.h"
25 #include "iremote_object.h"
26 #include "iremote_proxy.h"
27 #include "ibattery_srv.h"
28 #include "battery_info.h"
29 
30 namespace OHOS {
31 namespace PowerMgr {
32 class BatterySrvProxy : public IRemoteProxy<IBatterySrv> {
33 public:
BatterySrvProxy(const sptr<IRemoteObject> & impl)34     explicit BatterySrvProxy(const sptr<IRemoteObject>& impl)
35         : IRemoteProxy<IBatterySrv>(impl) {}
36     ~BatterySrvProxy() = default;
37     DISALLOW_COPY_AND_MOVE(BatterySrvProxy);
38 
39     virtual int32_t GetCapacity() override;
40     virtual BatteryChargeState GetChargingStatus() override;
41     virtual BatteryHealthState GetHealthStatus() override;
42     virtual BatteryPluggedType GetPluggedType() override;
43     virtual int32_t GetVoltage() override;
44     virtual bool GetPresent() override;
45     virtual std::string GetTechnology() override;
46     virtual int32_t GetTotalEnergy() override;
47     virtual int32_t GetCurrentAverage() override;
48     virtual int32_t GetNowCurrent() override;
49     virtual int32_t GetRemainEnergy() override;
50     virtual int32_t GetBatteryTemperature() override;
51     virtual BatteryCapacityLevel GetCapacityLevel() override;
52     virtual int64_t GetRemainingChargeTime() override;
53 private:
54     static inline BrokerDelegator<BatterySrvProxy> delegator_;
55 };
56 } // namespace PowerMgr
57 } // namespace OHOS
58 
59 #endif // BATTERY_SRV_PROXY_H
60