Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [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 "radio_modem_utils.h" |
| 18 | |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 19 | RadioModemResponse::RadioModemResponse(RadioServiceTest& parent) : parent_modem(parent) {} |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 20 | |
| 21 | ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) { |
| 22 | return ndk::ScopedAStatus::ok(); |
| 23 | } |
| 24 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 25 | ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& info) { |
| 26 | rspInfo = info; |
Tim Lin | 62cf454 | 2022-04-07 09:33:45 +0800 | [diff] [blame] | 27 | enableModemResponseToggle = !enableModemResponseToggle; |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 28 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 29 | return ndk::ScopedAStatus::ok(); |
| 30 | } |
| 31 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 32 | ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 33 | const std::string& /*version*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 34 | rspInfo = info; |
| 35 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 36 | return ndk::ScopedAStatus::ok(); |
| 37 | } |
| 38 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 39 | ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 40 | const std::string& /*imei*/, |
| 41 | const std::string& /*imeisv*/, |
| 42 | const std::string& /*esn*/, |
| 43 | const std::string& /*meid*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 44 | rspInfo = info; |
| 45 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 46 | return ndk::ScopedAStatus::ok(); |
| 47 | } |
| 48 | |
arunvoddu | d9bbd44 | 2022-11-15 08:39:26 +0000 | [diff] [blame] | 49 | ndk::ScopedAStatus RadioModemResponse::getImeiResponse(const RadioResponseInfo& info, |
| 50 | const std::optional<ImeiInfo>& /*imeiInfo*/) { |
| 51 | rspInfo = info; |
| 52 | parent_modem.notify(info.serial); |
| 53 | return ndk::ScopedAStatus::ok(); |
| 54 | } |
| 55 | |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 56 | ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 57 | const RadioResponseInfo& info, const std::vector<HardwareConfig>& /*config*/) { |
| 58 | rspInfo = info; |
| 59 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 60 | return ndk::ScopedAStatus::ok(); |
| 61 | } |
| 62 | |
| 63 | ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse( |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 64 | const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) { |
| 65 | rspInfo = info; |
| 66 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 67 | return ndk::ScopedAStatus::ok(); |
| 68 | } |
| 69 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 70 | ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(const RadioResponseInfo& info, |
| 71 | const bool enabled) { |
| 72 | rspInfo = info; |
| 73 | isModemEnabled = enabled; |
| 74 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 75 | return ndk::ScopedAStatus::ok(); |
| 76 | } |
| 77 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 78 | ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 79 | const RadioCapability& /*rc*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 80 | rspInfo = info; |
| 81 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 82 | return ndk::ScopedAStatus::ok(); |
| 83 | } |
| 84 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 85 | ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 86 | const std::string& /*result*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 87 | rspInfo = info; |
| 88 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 89 | return ndk::ScopedAStatus::ok(); |
| 90 | } |
| 91 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 92 | ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& info) { |
| 93 | rspInfo = info; |
| 94 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 95 | return ndk::ScopedAStatus::ok(); |
| 96 | } |
| 97 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 98 | ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) { |
| 99 | rspInfo = info; |
| 100 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 101 | return ndk::ScopedAStatus::ok(); |
| 102 | } |
| 103 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 104 | ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& info) { |
| 105 | rspInfo = info; |
| 106 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 107 | return ndk::ScopedAStatus::ok(); |
| 108 | } |
| 109 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 110 | ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& info) { |
| 111 | rspInfo = info; |
| 112 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 113 | return ndk::ScopedAStatus::ok(); |
| 114 | } |
| 115 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 116 | ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& info) { |
| 117 | rspInfo = info; |
| 118 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 119 | return ndk::ScopedAStatus::ok(); |
| 120 | } |
| 121 | |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 122 | ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& info, |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 123 | const RadioCapability& /*rc*/) { |
Sarah Chin | 912bdf3 | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 124 | rspInfo = info; |
| 125 | parent_modem.notify(info.serial); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 126 | return ndk::ScopedAStatus::ok(); |
| 127 | } |
| 128 | |
| 129 | ndk::ScopedAStatus RadioModemResponse::setRadioPowerResponse(const RadioResponseInfo& info) { |
| 130 | rspInfo = info; |
| 131 | parent_modem.notify(info.serial); |
| 132 | return ndk::ScopedAStatus::ok(); |
| 133 | } |