Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "health-convert.h" |
| 18 | |
| 19 | namespace aidl::android::hardware::health { |
| 20 | |
| 21 | void convert(const HealthInfo& info, struct ::android::BatteryProperties* p) { |
| 22 | p->chargerAcOnline = info.chargerAcOnline; |
| 23 | p->chargerUsbOnline = info.chargerUsbOnline; |
| 24 | p->chargerWirelessOnline = info.chargerWirelessOnline; |
Jack Wu | 5b13512 | 2021-12-20 14:56:50 +0800 | [diff] [blame] | 25 | p->chargerDockOnline = info.chargerDockOnline; |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 26 | p->maxChargingCurrent = info.maxChargingCurrentMicroamps; |
| 27 | p->maxChargingVoltage = info.maxChargingVoltageMicrovolts; |
| 28 | p->batteryStatus = static_cast<int>(info.batteryStatus); |
| 29 | p->batteryHealth = static_cast<int>(info.batteryHealth); |
| 30 | p->batteryPresent = info.batteryPresent; |
| 31 | p->batteryLevel = info.batteryLevel; |
| 32 | p->batteryVoltage = info.batteryVoltageMillivolts; |
| 33 | p->batteryTemperature = info.batteryTemperatureTenthsCelsius; |
| 34 | p->batteryCurrent = info.batteryCurrentMicroamps; |
| 35 | p->batteryCycleCount = info.batteryCycleCount; |
| 36 | p->batteryFullCharge = info.batteryFullChargeUah; |
| 37 | p->batteryChargeCounter = info.batteryChargeCounterUah; |
| 38 | p->batteryTechnology = ::android::String8(info.batteryTechnology.c_str()); |
| 39 | } |
| 40 | |
| 41 | } // namespace aidl::android::hardware::health |