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_STUB_H 17 #define BATTERY_SRV_STUB_H 18 19 #include <cstdint> 20 #include "refbase.h" 21 #include "nocopyable.h" 22 #include "iremote_stub.h" 23 #include "ibattery_srv.h" 24 #include "message_option.h" 25 26 namespace OHOS { 27 namespace PowerMgr { 28 class BatterySrvStub : public IRemoteStub<IBatterySrv> { 29 public: 30 DISALLOW_COPY_AND_MOVE(BatterySrvStub); 31 32 BatterySrvStub() = default; 33 34 virtual ~BatterySrvStub() = default; 35 36 int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 37 38 private: 39 int32_t GetCapacityStub(MessageParcel& reply); 40 int32_t GetChargingStatusStub(MessageParcel& reply); 41 int32_t GetHealthStatusStub(MessageParcel& reply); 42 int32_t GetPluggedTypeStub(MessageParcel& reply); 43 int32_t GetVoltageStub(MessageParcel& reply); 44 int32_t GetPresentStub(MessageParcel& reply); 45 int32_t GetTechnologyStub(MessageParcel& reply); 46 int32_t GetBatteryTemperatureStub(MessageParcel& reply); 47 int32_t GetBatteryCapacityLevelStub(MessageParcel& reply); 48 int64_t GetRemainingChargeTimeStub(MessageParcel& reply); 49 int32_t GetNowCurrentStub(MessageParcel& reply); 50 int32_t GetRemainEnergyStub(MessageParcel& reply); 51 int32_t GetTotalEnergyStub(MessageParcel& reply); 52 int32_t GetCurrentAverageStub(MessageParcel& reply); 53 int32_t CheckRequestCode(const uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option); 54 int32_t SetChargeConfigStub(MessageParcel& data, MessageParcel& reply); 55 int32_t GetChargeConfigStub(MessageParcel& data, MessageParcel& reply); 56 int32_t SupportChargeConfigStub(MessageParcel& data, MessageParcel& reply); 57 }; 58 } // namespace PowerMgr 59 } // namespace OHOS 60 #endif // BATTERY_SRV_STUB_H 61