blob: c1cd64cf61baaa41bc2c53423b7f3392d5b633c0 [file] [log] [blame]
Tomasz Wasilczykdcbae482021-11-08 16:10:28 -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 "structs.h"
18
19#include "commonStructs.h"
20
21#include "collections.h"
22
23#include <android-base/logging.h>
24
25namespace android::hardware::radio::compat {
26
27using ::aidl::android::hardware::radio::RadioAccessFamily;
28using ::aidl::android::hardware::radio::RadioTechnology;
29namespace aidl = ::aidl::android::hardware::radio::modem;
30
31V1_0::NvWriteItem toHidl(const aidl::NvWriteItem& item) {
32 return {
33 .itemId = V1_0::NvItem{item.itemId},
34 .value = item.value,
35 };
36}
37
38aidl::RadioCapability toAidl(const V1_0::RadioCapability& capa) {
39 return {
40 .session = capa.session,
41 .phase = static_cast<int32_t>(capa.phase),
42 .raf = RadioAccessFamily(capa.raf),
43 .logicalModemUuid = capa.logicalModemUuid,
44 .status = static_cast<int32_t>(capa.status),
45 };
46}
47
48V1_0::RadioCapability toHidl(const aidl::RadioCapability& capa) {
49 return {
50 .session = capa.session,
51 .phase = V1_0::RadioCapabilityPhase{capa.phase},
52 .raf = toHidlBitfield<V1_0::RadioAccessFamily>(capa.raf),
53 .logicalModemUuid = capa.logicalModemUuid,
54 .status = V1_0::RadioCapabilityStatus{capa.status},
55 };
56}
57
58aidl::HardwareConfig toAidl(const V1_0::HardwareConfig& config) {
59 return {
60 .type = static_cast<int32_t>(config.type),
61 .uuid = config.uuid,
62 .state = static_cast<int32_t>(config.state),
63 .modem = toAidl(config.modem),
64 .sim = toAidl(config.sim),
65 };
66}
67
68aidl::HardwareConfigModem toAidl(const V1_0::HardwareConfigModem& modem) {
69 return {
70 .rilModel = modem.rilModel,
71 .rat = RadioTechnology(modem.rat),
72 .maxVoiceCalls = modem.maxVoice,
73 .maxDataCalls = modem.maxData,
74 .maxStandby = modem.maxStandby,
75 };
76}
77
78aidl::HardwareConfigSim toAidl(const V1_0::HardwareConfigSim& sim) {
79 return {
80 .modemUuid = sim.modemUuid,
81 };
82}
83
84aidl::ActivityStatsInfo toAidl(const V1_0::ActivityStatsInfo& info) {
85 return {
86 .sleepModeTimeMs = static_cast<int32_t>(info.sleepModeTimeMs),
87 .idleModeTimeMs = static_cast<int32_t>(info.idleModeTimeMs),
88 .txmModetimeMs = toAidl(info.txmModetimeMs),
89 .rxModeTimeMs = static_cast<int32_t>(info.rxModeTimeMs),
90 };
91}
92
93} // namespace android::hardware::radio::compat