blob: 851c93b921d7d4d468b125bd0ca6c92bf9f9d0d5 [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) {
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080032 mModemCb = modemCb;
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070033}
34
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080035std::shared_ptr<aidl::IRadioModemIndication> RadioIndication::modemCb() {
36 return mModemCb.get();
37}
38
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070039Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type,
40 const hidl_vec<V1_0::HardwareConfig>& configs) {
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080041 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080042 modemCb()->hardwareConfigChanged(toAidl(type), toAidl(configs));
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080043 return {};
44}
45
46Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type, const hidl_string& reasn) {
47 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080048 modemCb()->modemReset(toAidl(type), reasn);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070049 return {};
50}
51
52Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type,
53 const V1_0::RadioCapability& rc) {
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080054 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080055 modemCb()->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;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080061 modemCb()->radioStateChanged(toAidl(t), aidl::RadioState(st));
Tomasz Wasilczyk535f30c2021-11-08 16:10:28 -080062 return {};
63}
64
65Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) {
66 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080067 modemCb()->rilConnected(toAidl(type));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070068 return {};
69}
70
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070071} // namespace android::hardware::radio::compat