Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 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 | |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 19 | #include "commonStructs.h" |
| 20 | #include "debug.h" |
| 21 | #include "structs.h" |
| 22 | |
| 23 | #include "collections.h" |
| 24 | |
| 25 | #define RADIO_MODULE "ModemIndication" |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 26 | |
| 27 | namespace android::hardware::radio::compat { |
| 28 | |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 29 | namespace aidl = ::aidl::android::hardware::radio::modem; |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 30 | |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 31 | void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioModemIndication> modemCb) { |
| 32 | CHECK(modemCb); |
| 33 | mModemCb = modemCb; |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 34 | } |
| 35 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 36 | Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type, |
| 37 | const hidl_vec<V1_0::HardwareConfig>& configs) { |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 38 | LOG_CALL << type; |
| 39 | CHECK_CB(mModemCb); |
| 40 | mModemCb->hardwareConfigChanged(toAidl(type), toAidl(configs)); |
| 41 | return {}; |
| 42 | } |
| 43 | |
| 44 | Return<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 Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 48 | return {}; |
| 49 | } |
| 50 | |
| 51 | Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type, |
| 52 | const V1_0::RadioCapability& rc) { |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 53 | LOG_CALL << type; |
| 54 | CHECK_CB(mModemCb); |
| 55 | mModemCb->radioCapabilityIndication(toAidl(type), toAidl(rc)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 56 | return {}; |
| 57 | } |
| 58 | |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame^] | 59 | Return<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 | |
| 66 | Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) { |
| 67 | LOG_CALL << type; |
| 68 | CHECK_CB(mModemCb); |
| 69 | mModemCb->rilConnected(toAidl(type)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 70 | return {}; |
| 71 | } |
| 72 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 73 | } // namespace android::hardware::radio::compat |