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