blob: b5251f4bb54e3299aa0cc7ee5d9f892038c0c5a9 [file] [log] [blame]
Yifan Hong830cdb12021-01-11 20:47:23 -08001/*
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
19namespace aidl::android::hardware::health {
20
21void convert(const HealthInfo& info, struct ::android::BatteryProperties* p) {
22 p->chargerAcOnline = info.chargerAcOnline;
23 p->chargerUsbOnline = info.chargerUsbOnline;
24 p->chargerWirelessOnline = info.chargerWirelessOnline;
25 p->maxChargingCurrent = info.maxChargingCurrentMicroamps;
26 p->maxChargingVoltage = info.maxChargingVoltageMicrovolts;
27 p->batteryStatus = static_cast<int>(info.batteryStatus);
28 p->batteryHealth = static_cast<int>(info.batteryHealth);
29 p->batteryPresent = info.batteryPresent;
30 p->batteryLevel = info.batteryLevel;
31 p->batteryVoltage = info.batteryVoltageMillivolts;
32 p->batteryTemperature = info.batteryTemperatureTenthsCelsius;
33 p->batteryCurrent = info.batteryCurrentMicroamps;
34 p->batteryCycleCount = info.batteryCycleCount;
35 p->batteryFullCharge = info.batteryFullChargeUah;
36 p->batteryChargeCounter = info.batteryChargeCounterUah;
37 p->batteryTechnology = ::android::String8(info.batteryTechnology.c_str());
38}
39
40} // namespace aidl::android::hardware::health