blob: 20b44c5831e17a6ec036394aabdc5cc60e8fc667 [file] [log] [blame]
Sarah Chind2a41192021-12-21 11:34:00 -08001/*
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 Chin91997ac2021-12-29 00:35:12 -080019RadioModemResponse::RadioModemResponse(RadioServiceTest& parent) : parent_modem(parent) {}
Sarah Chind2a41192021-12-21 11:34:00 -080020
21ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
22 return ndk::ScopedAStatus::ok();
23}
24
Sarah Chin52de0ad2022-01-28 01:02:16 -080025ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& info) {
26 rspInfo = info;
Tim Lin95973602022-04-07 09:33:45 +080027 enableModemResponseToggle = !enableModemResponseToggle;
Sarah Chin52de0ad2022-01-28 01:02:16 -080028 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080029 return ndk::ScopedAStatus::ok();
30}
31
Sarah Chin52de0ad2022-01-28 01:02:16 -080032ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080033 const std::string& /*version*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080034 rspInfo = info;
35 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080036 return ndk::ScopedAStatus::ok();
37}
38
Sarah Chin52de0ad2022-01-28 01:02:16 -080039ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080040 const std::string& /*imei*/,
41 const std::string& /*imeisv*/,
42 const std::string& /*esn*/,
43 const std::string& /*meid*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080044 rspInfo = info;
45 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080046 return ndk::ScopedAStatus::ok();
47}
48
49ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -080050 const RadioResponseInfo& info, const std::vector<HardwareConfig>& /*config*/) {
51 rspInfo = info;
52 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080053 return ndk::ScopedAStatus::ok();
54}
55
56ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
Sarah Chin52de0ad2022-01-28 01:02:16 -080057 const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
58 rspInfo = info;
59 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080060 return ndk::ScopedAStatus::ok();
61}
62
Sarah Chin52de0ad2022-01-28 01:02:16 -080063ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(const RadioResponseInfo& info,
64 const bool enabled) {
65 rspInfo = info;
66 isModemEnabled = enabled;
67 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080068 return ndk::ScopedAStatus::ok();
69}
70
Sarah Chin52de0ad2022-01-28 01:02:16 -080071ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080072 const RadioCapability& /*rc*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080073 rspInfo = info;
74 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080075 return ndk::ScopedAStatus::ok();
76}
77
Sarah Chin52de0ad2022-01-28 01:02:16 -080078ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -080079 const std::string& /*result*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -080080 rspInfo = info;
81 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080082 return ndk::ScopedAStatus::ok();
83}
84
Sarah Chin52de0ad2022-01-28 01:02:16 -080085ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
86 rspInfo = info;
87 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080088 return ndk::ScopedAStatus::ok();
89}
90
Sarah Chin52de0ad2022-01-28 01:02:16 -080091ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
92 rspInfo = info;
93 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -080094 return ndk::ScopedAStatus::ok();
95}
96
Sarah Chin52de0ad2022-01-28 01:02:16 -080097ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
98 rspInfo = info;
99 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800100 return ndk::ScopedAStatus::ok();
101}
102
Sarah Chin52de0ad2022-01-28 01:02:16 -0800103ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& info) {
104 rspInfo = info;
105 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800106 return ndk::ScopedAStatus::ok();
107}
108
Sarah Chin52de0ad2022-01-28 01:02:16 -0800109ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& info) {
110 rspInfo = info;
111 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800112 return ndk::ScopedAStatus::ok();
113}
114
Sarah Chin52de0ad2022-01-28 01:02:16 -0800115ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& info,
Sarah Chind2a41192021-12-21 11:34:00 -0800116 const RadioCapability& /*rc*/) {
Sarah Chin52de0ad2022-01-28 01:02:16 -0800117 rspInfo = info;
118 parent_modem.notify(info.serial);
Sarah Chind2a41192021-12-21 11:34:00 -0800119 return ndk::ScopedAStatus::ok();
120}
121
122ndk::ScopedAStatus RadioModemResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
123 rspInfo = info;
124 parent_modem.notify(info.serial);
125 return ndk::ScopedAStatus::ok();
126}