blob: 8fc4da62d59c1b4fcf65612e89fe966e711281bc [file] [log] [blame]
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -07001/*
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
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080019#include "commonStructs.h"
20#include "debug.h"
21#include "structs.h"
22
23#include "collections.h"
24
25#define RADIO_MODULE "ModemIndication"
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070026
27namespace android::hardware::radio::compat {
28
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080029namespace aidl = ::aidl::android::hardware::radio::modem;
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070030
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080031void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioModemIndication> modemCb) {
32 CHECK(modemCb);
33 mModemCb = modemCb;
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070034}
35
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070036Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type,
37 const hidl_vec<V1_0::HardwareConfig>& configs) {
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080038 LOG_CALL << type;
39 CHECK_CB(mModemCb);
40 mModemCb->hardwareConfigChanged(toAidl(type), toAidl(configs));
41 return {};
42}
43
44Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type, const hidl_string& reasn) {
45 LOG_CALL << type;
46 CHECK_CB(mModemCb);
47 mModemCb->modemReset(toAidl(type), reasn);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070048 return {};
49}
50
51Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type,
52 const V1_0::RadioCapability& rc) {
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080053 LOG_CALL << type;
54 CHECK_CB(mModemCb);
55 mModemCb->radioCapabilityIndication(toAidl(type), toAidl(rc));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070056 return {};
57}
58
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080059Return<void> RadioIndication::radioStateChanged(V1_0::RadioIndicationType t, V1_0::RadioState st) {
60 LOG_CALL << t;
61 CHECK_CB(mModemCb);
62 mModemCb->radioStateChanged(toAidl(t), aidl::RadioState(st));
63 return {};
64}
65
66Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) {
67 LOG_CALL << type;
68 CHECK_CB(mModemCb);
69 mModemCb->rilConnected(toAidl(type));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070070 return {};
71}
72
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070073} // namespace android::hardware::radio::compat