• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
getHardwareConfigResponse(const RadioResponseInfo & info,const std::vector<HardwareConfig> &)49 ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
50         const RadioResponseInfo& info, const std::vector<HardwareConfig>& /*config*/) {
51     rspInfo = info;
52     parent_modem.notify(info.serial);
53     return ndk::ScopedAStatus::ok();
54 }
55 
getModemActivityInfoResponse(const RadioResponseInfo & info,const ActivityStatsInfo &)56 ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
57         const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
58     rspInfo = info;
59     parent_modem.notify(info.serial);
60     return ndk::ScopedAStatus::ok();
61 }
62 
getModemStackStatusResponse(const RadioResponseInfo & info,const bool enabled)63 ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(const RadioResponseInfo& info,
64                                                                    const bool enabled) {
65     rspInfo = info;
66     isModemEnabled = enabled;
67     parent_modem.notify(info.serial);
68     return ndk::ScopedAStatus::ok();
69 }
70 
getRadioCapabilityResponse(const RadioResponseInfo & info,const RadioCapability &)71 ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& info,
72                                                                   const RadioCapability& /*rc*/) {
73     rspInfo = info;
74     parent_modem.notify(info.serial);
75     return ndk::ScopedAStatus::ok();
76 }
77 
nvReadItemResponse(const RadioResponseInfo & info,const std::string &)78 ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& info,
79                                                           const std::string& /*result*/) {
80     rspInfo = info;
81     parent_modem.notify(info.serial);
82     return ndk::ScopedAStatus::ok();
83 }
84 
nvResetConfigResponse(const RadioResponseInfo & info)85 ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
86     rspInfo = info;
87     parent_modem.notify(info.serial);
88     return ndk::ScopedAStatus::ok();
89 }
90 
nvWriteCdmaPrlResponse(const RadioResponseInfo & info)91 ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
92     rspInfo = info;
93     parent_modem.notify(info.serial);
94     return ndk::ScopedAStatus::ok();
95 }
96 
nvWriteItemResponse(const RadioResponseInfo & info)97 ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
98     rspInfo = info;
99     parent_modem.notify(info.serial);
100     return ndk::ScopedAStatus::ok();
101 }
102 
requestShutdownResponse(const RadioResponseInfo & info)103 ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& info) {
104     rspInfo = info;
105     parent_modem.notify(info.serial);
106     return ndk::ScopedAStatus::ok();
107 }
108 
sendDeviceStateResponse(const RadioResponseInfo & info)109 ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& info) {
110     rspInfo = info;
111     parent_modem.notify(info.serial);
112     return ndk::ScopedAStatus::ok();
113 }
114 
setRadioCapabilityResponse(const RadioResponseInfo & info,const RadioCapability &)115 ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& info,
116                                                                   const RadioCapability& /*rc*/) {
117     rspInfo = info;
118     parent_modem.notify(info.serial);
119     return ndk::ScopedAStatus::ok();
120 }
121 
setRadioPowerResponse(const RadioResponseInfo & info)122 ndk::ScopedAStatus RadioModemResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
123     rspInfo = info;
124     parent_modem.notify(info.serial);
125     return ndk::ScopedAStatus::ok();
126 }
127