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 <libradiocompat/RadioIndication.h>
18
19 #include "commonStructs.h"
20 #include "debug.h"
21 #include "structs.h"
22
23 #include "collections.h"
24
25 #define RADIO_MODULE "ModemIndication"
26
27 namespace android::hardware::radio::compat {
28
29 namespace aidl = ::aidl::android::hardware::radio::modem;
30
setResponseFunction(std::shared_ptr<aidl::IRadioModemIndication> modemCb)31 void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioModemIndication> modemCb) {
32 mModemCb = modemCb;
33 }
34
modemCb()35 std::shared_ptr<aidl::IRadioModemIndication> RadioIndication::modemCb() {
36 return mModemCb.get();
37 }
38
hardwareConfigChanged(V1_0::RadioIndicationType type,const hidl_vec<V1_0::HardwareConfig> & configs)39 Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type,
40 const hidl_vec<V1_0::HardwareConfig>& configs) {
41 LOG_CALL << type;
42 modemCb()->hardwareConfigChanged(toAidl(type), toAidl(configs));
43 return {};
44 }
45
modemReset(V1_0::RadioIndicationType type,const hidl_string & reasn)46 Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type, const hidl_string& reasn) {
47 LOG_CALL << type;
48 modemCb()->modemReset(toAidl(type), reasn);
49 return {};
50 }
51
radioCapabilityIndication(V1_0::RadioIndicationType type,const V1_0::RadioCapability & rc)52 Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type,
53 const V1_0::RadioCapability& rc) {
54 LOG_CALL << type;
55 modemCb()->radioCapabilityIndication(toAidl(type), toAidl(rc));
56 return {};
57 }
58
radioStateChanged(V1_0::RadioIndicationType t,V1_0::RadioState st)59 Return<void> RadioIndication::radioStateChanged(V1_0::RadioIndicationType t, V1_0::RadioState st) {
60 LOG_CALL << t;
61 modemCb()->radioStateChanged(toAidl(t), aidl::RadioState(st));
62 return {};
63 }
64
rilConnected(V1_0::RadioIndicationType type)65 Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) {
66 LOG_CALL << type;
67 modemCb()->rilConnected(toAidl(type));
68 return {};
69 }
70
onImeiMappingChanged(V1_0::RadioIndicationType type,::aidl::android::hardware::radio::modem::ImeiInfo imeiInfo)71 Return<void> RadioIndication::onImeiMappingChanged(V1_0::RadioIndicationType type,
72 ::aidl::android::hardware::radio::modem::ImeiInfo imeiInfo) {
73 LOG_CALL << type;
74 modemCb()->onImeiMappingChanged(toAidl(type), imeiInfo);
75 return {};
76 }
77
78 } // namespace android::hardware::radio::compat
79