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) { |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame] | 32 | mModemCb = modemCb; |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 35 | std::shared_ptr<aidl::IRadioModemIndication> RadioIndication::modemCb() { |
| 36 | return mModemCb.get(); |
| 37 | } |
| 38 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 39 | Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type, |
| 40 | const hidl_vec<V1_0::HardwareConfig>& configs) { |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame] | 41 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 42 | modemCb()->hardwareConfigChanged(toAidl(type), toAidl(configs)); |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame] | 43 | return {}; |
| 44 | } |
| 45 | |
| 46 | Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type, const hidl_string& reasn) { |
| 47 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 48 | modemCb()->modemReset(toAidl(type), reasn); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 49 | return {}; |
| 50 | } |
| 51 | |
| 52 | Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type, |
| 53 | const V1_0::RadioCapability& rc) { |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame] | 54 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 55 | modemCb()->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; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 61 | modemCb()->radioStateChanged(toAidl(t), aidl::RadioState(st)); |
Tomasz Wasilczyk | 535f30c | 2021-11-08 16:10:28 -0800 | [diff] [blame] | 62 | return {}; |
| 63 | } |
| 64 | |
| 65 | Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) { |
| 66 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame^] | 67 | modemCb()->rilConnected(toAidl(type)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 68 | return {}; |
| 69 | } |
| 70 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 71 | } // namespace android::hardware::radio::compat |