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