1 /*
2  * Copyright (C) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ril_callback_test.h"
17 
18 #include "telephony_log_wrapper.h"
19 
20 namespace OHOS {
21 namespace Telephony {
22 using namespace OHOS::HDI::Ril::V1_2;
NotifyAll()23 void RilCallbackTest::NotifyAll()
24 {
25     std::unique_lock<std::mutex> callbackLock(callbackMutex_);
26     if (resultInfo_.serial != currentSerialId_) {
27         hdiId_ = HdiId::HREQ_NONE;
28         TELEPHONY_LOGI("NotifyAll currentSerialId_ : %{public}d, serial: %{public}d not equal", currentSerialId_,
29             resultInfo_.serial);
30         return;
31     }
32     cv_.notify_all();
33 }
34 
WaitFor(int32_t timeoutSecond)35 void RilCallbackTest::WaitFor(int32_t timeoutSecond)
36 {
37     Clean();
38     std::unique_lock<std::mutex> callbackLock(callbackMutex_);
39     cv_.wait_for(callbackLock, std::chrono::seconds(timeoutSecond));
40 }
41 
Clean()42 void RilCallbackTest::Clean()
43 {
44     hdiId_ = HdiId::HREQ_NONE;
45 }
46 
GetBoolResult(HdiId hdiId)47 bool RilCallbackTest::GetBoolResult(HdiId hdiId)
48 {
49     TELEPHONY_LOGI("GetBoolResult hdiId: %{public}d, error: %{public}d", hdiId, (int32_t)resultInfo_.error);
50     bool ret = false;
51     if (hdiId_ == HdiId::HREQ_NONE) {
52         TELEPHONY_LOGE(
53             "response timeout, not implemented hdiId: %{public}d, current hdiId_: %{public}d", (int32_t)hdiId, hdiId_);
54         ret = true;
55         Clean();
56         return ret;
57     }
58     if (hdiId_ != hdiId) {
59         ret = false;
60         TELEPHONY_LOGE(
61             "GetBoolResult hdiId does not match. hdiId: %{public}d, current hdiId: %{public}d", (int32_t)hdiId, hdiId_);
62         Clean();
63         return ret;
64     }
65     ret = true;
66     Clean();
67     return ret;
68 }
69 
70 // SIM
SimStateUpdated(const RilRadioResponseInfo & responseInfo)71 int32_t RilCallbackTest::SimStateUpdated(const RilRadioResponseInfo &responseInfo)
72 {
73     TELEPHONY_LOGI("SimStateUpdated notice : slotId = %{public}d", responseInfo.slotId);
74     auto g_rilInterface = OHOS::HDI::Ril::V1_2::IRil::Get();
75     if (g_rilInterface != nullptr) {
76         g_rilInterface->GetSimStatus(GetSerialId(), responseInfo.slotId);
77     }
78     return 0;
79 }
80 
SimStkSessionEndNotify(const RilRadioResponseInfo & responseInfo)81 int32_t RilCallbackTest::SimStkSessionEndNotify(const RilRadioResponseInfo &responseInfo)
82 {
83     TELEPHONY_LOGI("SimStkSessionEndNotify notice : slotId = %{public}d", responseInfo.slotId);
84     return 0;
85 }
86 
SimStkProactiveNotify(const RilRadioResponseInfo & responseInfo,const std::string & response)87 int32_t RilCallbackTest::SimStkProactiveNotify(const RilRadioResponseInfo &responseInfo, const std::string &response)
88 {
89     TELEPHONY_LOGI("SimStkProactiveNotify notice : slotId = %{public}d, response = %{public}s", responseInfo.slotId,
90         response.c_str());
91     return 0;
92 }
93 
SimStkAlphaNotify(const RilRadioResponseInfo & responseInfo,const std::string & response)94 int32_t RilCallbackTest::SimStkAlphaNotify(const RilRadioResponseInfo &responseInfo, const std::string &response)
95 {
96     TELEPHONY_LOGI(
97         "SimStkAlphaNotify notice : slotId = %{public}d, response = %{public}s", responseInfo.slotId, response.c_str());
98     return 0;
99 }
100 
SimStkEventNotify(const RilRadioResponseInfo & responseInfo,const std::string & response)101 int32_t RilCallbackTest::SimStkEventNotify(const RilRadioResponseInfo &responseInfo, const std::string &response)
102 {
103     TELEPHONY_LOGI(
104         "SimStkEventNotify notice : slotId = %{public}d, response = %{public}s", responseInfo.slotId, response.c_str());
105     return 0;
106 }
107 
SimStkCallSetupNotify(const RilRadioResponseInfo & responseInfo)108 int32_t RilCallbackTest::SimStkCallSetupNotify(const RilRadioResponseInfo &responseInfo)
109 {
110     TELEPHONY_LOGI("SimStkCallSetupNotify notice : slotId = %{public}d", responseInfo.slotId);
111     return 0;
112 }
113 
SimRefreshNotify(const RilRadioResponseInfo & responseInfo)114 int32_t RilCallbackTest::SimRefreshNotify(const RilRadioResponseInfo &responseInfo)
115 {
116     TELEPHONY_LOGI("SimRefreshNotify notice : slotId = %{public}d", responseInfo.slotId);
117     return 0;
118 }
119 
GetSimStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_1::CardStatusInfo & result)120 int32_t RilCallbackTest::GetSimStatusResponse(
121     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::CardStatusInfo &result)
122 {
123     TELEPHONY_LOGI(
124         "GetBoolResult GetSimStatus result : slotId = %{public}d, simType = %{public}d, simState = %{public}d",
125         responseInfo.slotId, result.simType, result.simState);
126     simState_[responseInfo.slotId] = result.simState;
127     TELEPHONY_LOGI("IsReady %{public}d %{public}d", responseInfo.slotId, simState_[responseInfo.slotId]);
128     hdiId_ = HdiId::HREQ_SIM_GET_SIM_STATUS;
129     resultInfo_ = responseInfo;
130     NotifyAll();
131     return 0;
132 }
133 
GetSimCardStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_3::SimCardStatusInfo & result)134 int32_t RilCallbackTest::GetSimCardStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
135     const HDI::Ril::V1_3::SimCardStatusInfo &result)
136 {
137     TELEPHONY_LOGI("GetBoolResult GetSimCardStatus result : slotId = %{public}d, simType = %{public}d,"
138         "simState = %{public}d", responseInfo.slotId, result.simType, result.simState);
139     simState_[responseInfo.slotId] = result.simState;
140     TELEPHONY_LOGI("IsReady %{public}d %{public}d", responseInfo.slotId, simState_[responseInfo.slotId]);
141     hdiId_ = HdiId::HREQ_SIM_GET_SIM_STATUS;
142     resultInfo_ = responseInfo;
143     NotifyAll();
144     return 0;
145 }
146 
GetSimIOResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)147 int32_t RilCallbackTest::GetSimIOResponse(const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
148 {
149     TELEPHONY_LOGI("GetBoolResult GetSimIO result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
150         result.sw1, result.sw2, result.response.c_str());
151     hdiId_ = HdiId::HREQ_SIM_GET_SIM_IO;
152     resultInfo_ = responseInfo;
153     NotifyAll();
154     return 0;
155 }
156 
GetImsiResponse(const RilRadioResponseInfo & responseInfo,const std::string & response)157 int32_t RilCallbackTest::GetImsiResponse(const RilRadioResponseInfo &responseInfo, const std::string &response)
158 {
159     TELEPHONY_LOGI("GetBoolResult GetImsi result : response = %{public}s", response.c_str());
160     hdiId_ = HdiId::HREQ_SIM_GET_IMSI;
161     resultInfo_ = responseInfo;
162     NotifyAll();
163     return 0;
164 }
165 
GetSimLockStatusResponse(const RilRadioResponseInfo & responseInfo,int32_t simLockStatus)166 int32_t RilCallbackTest::GetSimLockStatusResponse(const RilRadioResponseInfo &responseInfo, int32_t simLockStatus)
167 {
168     TELEPHONY_LOGI("GetBoolResult GetSimLockStatus result : simLockStatus = %{public}d", simLockStatus);
169     hdiId_ = HdiId::HREQ_SIM_GET_SIM_LOCK_STATUS;
170     resultInfo_ = responseInfo;
171     NotifyAll();
172     return 0;
173 }
174 
SetSimLockResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)175 int32_t RilCallbackTest::SetSimLockResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
176 {
177     TELEPHONY_LOGI("GetBoolResult SetSimLock result : result = %{public}d, remain = %{public}d", lockStatus.result,
178         lockStatus.remain);
179     hdiId_ = HdiId::HREQ_SIM_SET_SIM_LOCK;
180     resultInfo_ = responseInfo;
181     NotifyAll();
182     return 0;
183 }
184 
ChangeSimPasswordResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)185 int32_t RilCallbackTest::ChangeSimPasswordResponse(
186     const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
187 {
188     TELEPHONY_LOGI("GetBoolResult ChangeSimPassword result : result = %{public}d, remain = %{public}d",
189         lockStatus.result, lockStatus.remain);
190     hdiId_ = HdiId::HREQ_SIM_CHANGE_SIM_PASSWORD;
191     resultInfo_ = responseInfo;
192     NotifyAll();
193     return 0;
194 }
195 
UnlockPinResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)196 int32_t RilCallbackTest::UnlockPinResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
197 {
198     TELEPHONY_LOGI("GetBoolResult UnlockPin result : result = %{public}d, remain = %{public}d", lockStatus.result,
199         lockStatus.remain);
200     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PIN;
201     resultInfo_ = responseInfo;
202     NotifyAll();
203     return 0;
204 }
205 
UnlockPukResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)206 int32_t RilCallbackTest::UnlockPukResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
207 {
208     TELEPHONY_LOGI("GetBoolResult UnlockPuk result : result = %{public}d, remain = %{public}d", lockStatus.result,
209         lockStatus.remain);
210     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PUK;
211     resultInfo_ = responseInfo;
212     NotifyAll();
213     return 0;
214 }
215 
UnlockPin2Response(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)216 int32_t RilCallbackTest::UnlockPin2Response(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
217 {
218     TELEPHONY_LOGI("GetBoolResult UnlockPin2 result : result = %{public}d, remain = %{public}d", lockStatus.result,
219         lockStatus.remain);
220     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PIN2;
221     resultInfo_ = responseInfo;
222     NotifyAll();
223     return 0;
224 }
225 
UnlockPuk2Response(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)226 int32_t RilCallbackTest::UnlockPuk2Response(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
227 {
228     TELEPHONY_LOGI("GetBoolResult UnlockPuk2 result : result = %{public}d, remain = %{public}d", lockStatus.result,
229         lockStatus.remain);
230     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PUK2;
231     resultInfo_ = responseInfo;
232     NotifyAll();
233     return 0;
234 }
235 
SetActiveSimResponse(const RilRadioResponseInfo & responseInfo)236 int32_t RilCallbackTest::SetActiveSimResponse(const RilRadioResponseInfo &responseInfo)
237 {
238     TELEPHONY_LOGI("GetBoolResult SetActiveSim result");
239     hdiId_ = HdiId::HREQ_SIM_SET_ACTIVE_SIM;
240     resultInfo_ = responseInfo;
241     NotifyAll();
242     return 0;
243 }
244 
SimStkSendTerminalResponseResponse(const RilRadioResponseInfo & responseInfo)245 int32_t RilCallbackTest::SimStkSendTerminalResponseResponse(const RilRadioResponseInfo &responseInfo)
246 {
247     TELEPHONY_LOGI("GetBoolResult SimStkSendTerminalResponse result");
248     hdiId_ = HdiId::HREQ_SIM_STK_SEND_TERMINAL_RESPONSE;
249     resultInfo_ = responseInfo;
250     NotifyAll();
251     return 0;
252 }
253 
SimStkSendEnvelopeResponse(const RilRadioResponseInfo & responseInfo)254 int32_t RilCallbackTest::SimStkSendEnvelopeResponse(const RilRadioResponseInfo &responseInfo)
255 {
256     TELEPHONY_LOGI("GetBoolResult SimStkSendEnvelope result");
257     hdiId_ = HdiId::HREQ_SIM_STK_SEND_ENVELOPE;
258     resultInfo_ = responseInfo;
259     NotifyAll();
260     return 0;
261 }
262 
SimStkSendCallSetupRequestResultResponse(const RilRadioResponseInfo & responseInfo)263 int32_t RilCallbackTest::SimStkSendCallSetupRequestResultResponse(const RilRadioResponseInfo &responseInfo)
264 {
265     TELEPHONY_LOGI("GetBoolResult SimStkSendCallSetupRequestResult result");
266     hdiId_ = HdiId::HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT;
267     resultInfo_ = responseInfo;
268     NotifyAll();
269     return 0;
270 }
271 
SimStkIsReadyResponse(const RilRadioResponseInfo & responseInfo)272 int32_t RilCallbackTest::SimStkIsReadyResponse(const RilRadioResponseInfo &responseInfo)
273 {
274     TELEPHONY_LOGI("GetBoolResult SimStkIsReady result");
275     hdiId_ = HdiId::HREQ_SIM_STK_IS_READY;
276     resultInfo_ = responseInfo;
277     NotifyAll();
278     return 0;
279 }
280 
SetRadioProtocolResponse(const RilRadioResponseInfo & responseInfo,const RadioProtocol & radioProtocol)281 int32_t RilCallbackTest::SetRadioProtocolResponse(
282     const RilRadioResponseInfo &responseInfo, const RadioProtocol &radioProtocol)
283 {
284     TELEPHONY_LOGI("GetBoolResult SetRadioProtocol result : phase = %{public}d, slotId = %{public}d",
285         radioProtocol.phase, radioProtocol.slotId);
286     hdiId_ = HdiId::HREQ_SIM_RADIO_PROTOCOL;
287     resultInfo_ = responseInfo;
288     NotifyAll();
289     return 0;
290 }
291 
SimOpenLogicalChannelResponse(const RilRadioResponseInfo & responseInfo,const OpenLogicalChannelResponse & pOpenLogicalChannelResponse)292 int32_t RilCallbackTest::SimOpenLogicalChannelResponse(
293     const RilRadioResponseInfo &responseInfo, const OpenLogicalChannelResponse &pOpenLogicalChannelResponse)
294 {
295     TELEPHONY_LOGI(
296         "GetBoolResult SimOpenLogicalChannel result : sw1 = %{public}d, sw2 = %{public}d, channelId = %{public}d, "
297         "response = %{public}s",
298         pOpenLogicalChannelResponse.sw1, pOpenLogicalChannelResponse.sw2, pOpenLogicalChannelResponse.channelId,
299         pOpenLogicalChannelResponse.response.c_str());
300     currentChannelId_ = pOpenLogicalChannelResponse.channelId;
301     hdiId_ = HdiId::HREQ_SIM_OPEN_LOGICAL_CHANNEL;
302     resultInfo_ = responseInfo;
303     NotifyAll();
304     return 0;
305 }
306 
SimCloseLogicalChannelResponse(const RilRadioResponseInfo & responseInfo)307 int32_t RilCallbackTest::SimCloseLogicalChannelResponse(const RilRadioResponseInfo &responseInfo)
308 {
309     TELEPHONY_LOGI("GetBoolResult SimCloseLogicalChannel result");
310     hdiId_ = HdiId::HREQ_SIM_CLOSE_LOGICAL_CHANNEL;
311     resultInfo_ = responseInfo;
312     NotifyAll();
313     return 0;
314 }
315 
SimTransmitApduLogicalChannelResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)316 int32_t RilCallbackTest::SimTransmitApduLogicalChannelResponse(
317     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
318 {
319     TELEPHONY_LOGI(
320         "GetBoolResult SimTransmitApduLogicalChannel result : sw1 = %{public}d, sw2 = %{public}d, response = "
321         "%{public}s",
322         result.sw1, result.sw2, result.response.c_str());
323     hdiId_ = HdiId::HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL;
324     resultInfo_ = responseInfo;
325     NotifyAll();
326     return 0;
327 }
328 
SimTransmitApduBasicChannelResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)329 int32_t RilCallbackTest::SimTransmitApduBasicChannelResponse(
330     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
331 {
332     TELEPHONY_LOGI(
333         "GetBoolResult SimTransmitApduBasicChannel result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
334         result.sw1, result.sw2, result.response.c_str());
335     hdiId_ = HdiId::HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL;
336     resultInfo_ = responseInfo;
337     NotifyAll();
338     return 0;
339 }
340 
SimAuthenticationResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)341 int32_t RilCallbackTest::SimAuthenticationResponse(
342     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
343 {
344     TELEPHONY_LOGI("GetBoolResult SimAuthentication result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
345         result.sw1, result.sw2, result.response.c_str());
346     hdiId_ = HdiId::HREQ_SIM_AUTHENTICATION;
347     resultInfo_ = responseInfo;
348     NotifyAll();
349     return 0;
350 }
351 
UnlockSimLockResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)352 int32_t RilCallbackTest::UnlockSimLockResponse(
353     const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
354 {
355     TELEPHONY_LOGI("GetBoolResult UnlockSimLock result : result = %{public}d, remain = %{public}d", lockStatus.result,
356         lockStatus.remain);
357     hdiId_ = HdiId::HREQ_SIM_UNLOCK_SIM_LOCK;
358     resultInfo_ = responseInfo;
359     NotifyAll();
360     return 0;
361 }
362 
SendSimMatchedOperatorInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo)363 int32_t RilCallbackTest::SendSimMatchedOperatorInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo)
364 {
365     TELEPHONY_LOGI("GetBoolResult SendSimMatchedOperatorInfo result");
366     hdiId_ = HdiId::HREQ_SIM_SEND_NCFG_OPER_INFO;
367     resultInfo_ = responseInfo;
368     NotifyAll();
369     return 0;
370 }
371 
372 // Network
NetworkCsRegStatusUpdated(const RilRadioResponseInfo & responseInfo,const CsRegStatusInfo & csRegStatusInfo)373 int32_t RilCallbackTest::NetworkCsRegStatusUpdated(
374     const RilRadioResponseInfo &responseInfo, const CsRegStatusInfo &csRegStatusInfo)
375 {
376     TELEPHONY_LOGI("RilCallbackTest::NetworkCsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, "
377         "lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
378         csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId,
379         csRegStatusInfo.radioTechnology);
380     return 0;
381 }
382 
NetworkPsRegStatusUpdated(const RilRadioResponseInfo & responseInfo,const PsRegStatusInfo & psRegStatusInfo)383 int32_t RilCallbackTest::NetworkPsRegStatusUpdated(
384     const RilRadioResponseInfo &responseInfo, const PsRegStatusInfo &psRegStatusInfo)
385 {
386     TELEPHONY_LOGI(
387         "RilCallbackTest::NetworkPsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, "
388         "cellId:%{public}d, tech:%{public}d, nrRestricted:%{public}d, nrAvailable:%{public}d, enDcAvailable:%{public}d",
389         psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId,
390         psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable,
391         psRegStatusInfo.isEnDcAvailable);
392     return 0;
393 }
394 
SignalStrengthUpdated(const RilRadioResponseInfo & responseInfo,const Rssi & rssi)395 int32_t RilCallbackTest::SignalStrengthUpdated(const RilRadioResponseInfo &responseInfo, const Rssi &rssi)
396 {
397     TELEPHONY_LOGI(
398         "RilCallbackTest::SignalStrengthUpdated rxlev:%{public}d rsrp:%{public}d", rssi.lte.rxlev, rssi.lte.rsrp);
399     return 0;
400 }
401 
NetworkTimeZoneUpdated(const RilRadioResponseInfo & responseInfo,const std::string & timeZoneStr)402 int32_t RilCallbackTest::NetworkTimeZoneUpdated(
403     const RilRadioResponseInfo &responseInfo, const std::string &timeZoneStr)
404 {
405     TELEPHONY_LOGI("RilCallbackTest::NetworkTimeZoneUpdated timeZone:%{public}s", timeZoneStr.c_str());
406     return 0;
407 }
408 
NetworkTimeUpdated(const RilRadioResponseInfo & responseInfo,const std::string & timeStr)409 int32_t RilCallbackTest::NetworkTimeUpdated(const RilRadioResponseInfo &responseInfo, const std::string &timeStr)
410 {
411     TELEPHONY_LOGI("RilCallbackTest::NetworkTimeZoneUpdated time:%{public}s", timeStr.c_str());
412     return 0;
413 }
414 
NetworkPhyChnlCfgUpdated(const RilRadioResponseInfo & responseInfo,const ChannelConfigInfoList & channelConfigInfoList)415 int32_t RilCallbackTest::NetworkPhyChnlCfgUpdated(
416     const RilRadioResponseInfo &responseInfo, const ChannelConfigInfoList &channelConfigInfoList)
417 {
418     TELEPHONY_LOGI("RilCallbackTest::NetworkPhyChnlCfgUpdated itemNum:%{public}d", channelConfigInfoList.itemNum);
419     for (PhysicalChannelConfig phyChnlCfg : channelConfigInfoList.channelConfigInfos) {
420         TELEPHONY_LOGI(
421             "RilCallbackTest::NetworkPhyChnlCfgUpdated cellConnStatus:%{public}d, "
422             "cellBandwidthDownlinkKhz:%{public}d, cellBandwidthUplinkKhz:%{public}d, physicalCellId:%{public}d, "
423             "ratType:%{public}d, freqRange:%{public}d, downlinkChannelNum:%{public}d, "
424             "uplinkChannelNum:%{public}d, contextIdNum:%{public}d",
425             phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz,
426             phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum,
427             phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum);
428         for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) {
429             TELEPHONY_LOGI("contextIds[%{public}d]:%{public}d", j, phyChnlCfg.contextIds[j]);
430         }
431     }
432     return 0;
433 }
434 
NetworkCurrentCellUpdated(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo & cellListCurrentInfo)435 int32_t RilCallbackTest::NetworkCurrentCellUpdated(
436     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo &cellListCurrentInfo)
437 {
438     TELEPHONY_LOGI("itemNum:%{public}d", cellListCurrentInfo.itemNum);
439     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
440         TELEPHONY_LOGI("ratType:%{public}d, mcc:%{public}d, mnc:%{public}d", info.ratType, info.mcc, info.mnc);
441         switch (static_cast<RatType>(info.ratType)) {
442             case RatType::NETWORK_TYPE_LTE:
443                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
444                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
445                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
446                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
447                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
448                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
449                 break;
450             case RatType::NETWORK_TYPE_GSM:
451                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
452                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
453                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
454                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
455                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
456                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
457                 break;
458             case RatType::NETWORK_TYPE_WCDMA:
459                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
460                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
461                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
462                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
463                 break;
464             case RatType::NETWORK_TYPE_NR:
465                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
466                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
467                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
468                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
469                 break;
470             default:
471                 TELEPHONY_LOGE("invalid ratType");
472                 break;
473         }
474     }
475     return 0;
476 }
477 
NetworkCurrentCellUpdated_1_1(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo_1_1 & cellListCurrentInfo)478 int32_t RilCallbackTest::NetworkCurrentCellUpdated_1_1(
479     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo_1_1 &cellListCurrentInfo)
480 {
481     TELEPHONY_LOGI("itemNum:%{public}d", cellListCurrentInfo.itemNum);
482     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
483         TELEPHONY_LOGI("ratType:%{public}d, mcc:%{public}d, mnc:%{public}d", info.ratType, info.mcc, info.mnc);
484         switch (static_cast<RatType>(info.ratType)) {
485             case RatType::NETWORK_TYPE_LTE:
486                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
487                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
488                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
489                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
490                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
491                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
492                 break;
493             case RatType::NETWORK_TYPE_GSM:
494                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
495                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
496                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
497                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
498                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
499                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
500                 break;
501             case RatType::NETWORK_TYPE_WCDMA:
502                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
503                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
504                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
505                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
506                 break;
507             case RatType::NETWORK_TYPE_NR:
508                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
509                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
510                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
511                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
512                 break;
513             default:
514                 TELEPHONY_LOGE("invalid ratType");
515                 break;
516         }
517     }
518     return 0;
519 }
520 
NetworkCurrentCellUpdated_1_2(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo_1_2 & cellListCurrentInfo)521 int32_t RilCallbackTest::NetworkCurrentCellUpdated_1_2(
522     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo_1_2 &cellListCurrentInfo)
523 {
524     TELEPHONY_LOGI("itemNum:%{public}d", cellListCurrentInfo.itemNum);
525     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
526         TELEPHONY_LOGI("ratType:%{public}d, mcc:%{public}d, mnc:%{public}d", info.ratType, info.mcc, info.mnc);
527         switch (static_cast<RatType>(info.ratType)) {
528             case RatType::NETWORK_TYPE_LTE:
529                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
530                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
531                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
532                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
533                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
534                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
535                 break;
536             case RatType::NETWORK_TYPE_GSM:
537                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
538                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
539                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
540                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
541                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
542                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
543                 break;
544             case RatType::NETWORK_TYPE_WCDMA:
545                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
546                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
547                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
548                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
549                 break;
550             case RatType::NETWORK_TYPE_NR:
551                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
552                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
553                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
554                 break;
555             default:
556                 TELEPHONY_LOGE("invalid ratType");
557                 break;
558         }
559     }
560     return 0;
561 }
562 
ResidentNetworkUpdated(const RilRadioResponseInfo & responseInfo,const std::string & plmn)563 int32_t RilCallbackTest::ResidentNetworkUpdated(const RilRadioResponseInfo &responseInfo, const std::string &plmn)
564 {
565     TELEPHONY_LOGI("RilCallbackTest::ResidentNetworkUpdated plmn:%{public}s", plmn.c_str());
566     return 0;
567 }
568 
GetSignalStrengthResponse(const RilRadioResponseInfo & responseInfo,const Rssi & rssi)569 int32_t RilCallbackTest::GetSignalStrengthResponse(const RilRadioResponseInfo &responseInfo, const Rssi &rssi)
570 {
571     TELEPHONY_LOGI(
572         "RilCallbackTest::GetSignalStrengthResponse rxlev:%{public}d rsrp:%{public}d", rssi.lte.rxlev, rssi.lte.rsrp);
573     hdiId_ = HdiId::HREQ_NETWORK_GET_SIGNAL_STRENGTH;
574     resultInfo_ = responseInfo;
575     NotifyAll();
576     return 0;
577 }
578 
GetCsRegStatusResponse(const RilRadioResponseInfo & responseInfo,const CsRegStatusInfo & csRegStatusInfo)579 int32_t RilCallbackTest::GetCsRegStatusResponse(
580     const RilRadioResponseInfo &responseInfo, const CsRegStatusInfo &csRegStatusInfo)
581 {
582     TELEPHONY_LOGI("RilCallbackTest::GetCsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, "
583                    "lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
584         csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId,
585         csRegStatusInfo.radioTechnology);
586     hdiId_ = HdiId::HREQ_NETWORK_GET_CS_REG_STATUS;
587     resultInfo_ = responseInfo;
588     NotifyAll();
589     return 0;
590 }
591 
GetPsRegStatusResponse(const RilRadioResponseInfo & responseInfo,const PsRegStatusInfo & psRegStatusInfo)592 int32_t RilCallbackTest::GetPsRegStatusResponse(
593     const RilRadioResponseInfo &responseInfo, const PsRegStatusInfo &psRegStatusInfo)
594 {
595     TELEPHONY_LOGI(
596         "RilCallbackTest::GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, "
597         "cellId:%{public}d, tech:%{public}d, nrRestricted:%{public}d, nrAvailable:%{public}d, enDcAvailable:%{public}d",
598         psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId,
599         psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable,
600         psRegStatusInfo.isEnDcAvailable);
601     hdiId_ = HdiId::HREQ_NETWORK_GET_PS_REG_STATUS;
602     resultInfo_ = responseInfo;
603     NotifyAll();
604     return 0;
605 }
606 
GetOperatorInfoResponse(const RilRadioResponseInfo & responseInfo,const OperatorInfo & operatorInfo)607 int32_t RilCallbackTest::GetOperatorInfoResponse(
608     const RilRadioResponseInfo &responseInfo, const OperatorInfo &operatorInfo)
609 {
610     TELEPHONY_LOGI(
611         "RilCallbackTest::GetOperatorInfoResponse longName:%{public}s, shortName:%{public}s, numeric:%{public}s",
612         operatorInfo.longName.c_str(), operatorInfo.shortName.c_str(), operatorInfo.numeric.c_str());
613     hdiId_ = HdiId::HREQ_NETWORK_GET_OPERATOR_INFO;
614     resultInfo_ = responseInfo;
615     NotifyAll();
616     return 0;
617 }
618 
GetNetworkSearchInformationResponse(const RilRadioResponseInfo & responseInfo,const AvailableNetworkList & availableNetworkList)619 int32_t RilCallbackTest::GetNetworkSearchInformationResponse(
620     const RilRadioResponseInfo &responseInfo, const AvailableNetworkList &availableNetworkList)
621 {
622     TELEPHONY_LOGI(
623         "RilCallbackTest::GetNetworkSearchInformationResponse itemNum:%{public}d", availableNetworkList.itemNum);
624     for (auto availableInfo : availableNetworkList.availableNetworkInfo) {
625         TELEPHONY_LOGI("status:%{public}d", availableInfo.status);
626         TELEPHONY_LOGI("numeric:%{public}s", availableInfo.numeric.c_str());
627         TELEPHONY_LOGI("shortName:%{public}s", availableInfo.shortName.c_str());
628         TELEPHONY_LOGI("longName:%{public}s", availableInfo.longName.c_str());
629         TELEPHONY_LOGI("rat:%{public}d", availableInfo.rat);
630     }
631     hdiId_ = HdiId::HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION;
632     resultInfo_ = responseInfo;
633     NotifyAll();
634     return 0;
635 }
636 
GetNetworkSelectionModeResponse(const RilRadioResponseInfo & responseInfo,const SetNetworkModeInfo & setNetworkModeInfo)637 int32_t RilCallbackTest::GetNetworkSelectionModeResponse(
638     const RilRadioResponseInfo &responseInfo, const SetNetworkModeInfo &setNetworkModeInfo)
639 {
640     TELEPHONY_LOGI(
641         "RilCallbackTest::GetNetworkSelectionModeResponse selectMode:%{public}d", setNetworkModeInfo.selectMode);
642     hdiId_ = HdiId::HREQ_NETWORK_GET_NETWORK_SELECTION_MODE;
643     resultInfo_ = responseInfo;
644     NotifyAll();
645     return 0;
646 }
647 
SetNetworkSelectionModeResponse(const RilRadioResponseInfo & responseInfo)648 int32_t RilCallbackTest::SetNetworkSelectionModeResponse(const RilRadioResponseInfo &responseInfo)
649 {
650     TELEPHONY_LOGI("RilCallbackTest::SetNetworkSelectionModeResponse error:%{public}d", responseInfo.error);
651     hdiId_ = HdiId::HREQ_NETWORK_SET_NETWORK_SELECTION_MODE;
652     resultInfo_ = responseInfo;
653     NotifyAll();
654     return 0;
655 }
656 
GetNeighboringCellInfoListResponse(const RilRadioResponseInfo & responseInfo,const CellListNearbyInfo & cellInfoList)657 int32_t RilCallbackTest::GetNeighboringCellInfoListResponse(
658     const RilRadioResponseInfo &responseInfo, const CellListNearbyInfo &cellInfoList)
659 {
660     TELEPHONY_LOGI("RilCallbackTest::GetNeighboringCellInfoListResponse itemNum:%{public}d", cellInfoList.itemNum);
661     for (auto info : cellInfoList.cellNearbyInfo) {
662         TELEPHONY_LOGI("RilCallbackTest::GetNeighboringCellInfoListResponse ratType:%{public}d", info.ratType);
663         switch (static_cast<RatType>(info.ratType)) {
664             case RatType::NETWORK_TYPE_LTE:
665                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
666                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
667                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
668                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
669                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rxlev);
670                 break;
671             case RatType::NETWORK_TYPE_GSM:
672                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
673                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
674                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
675                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
676                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
677                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
678                 break;
679             case RatType::NETWORK_TYPE_WCDMA:
680                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
681                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
682                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
683                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
684                 break;
685             case RatType::NETWORK_TYPE_NR:
686                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
687                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
688                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
689                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
690                 break;
691             default:
692                 TELEPHONY_LOGE("invalid ratType");
693                 break;
694         }
695     }
696     hdiId_ = HdiId::HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST;
697     resultInfo_ = responseInfo;
698     NotifyAll();
699     return 0;
700 }
701 
GetNeighboringCellInfoListResponse_1_2(const RilRadioResponseInfo & responseInfo,const CellListNearbyInfo_1_2 & cellInfoList)702 int32_t RilCallbackTest::GetNeighboringCellInfoListResponse_1_2(
703     const RilRadioResponseInfo &responseInfo, const CellListNearbyInfo_1_2 &cellInfoList)
704 {
705     TELEPHONY_LOGI("itemNum:%{public}d", cellInfoList.itemNum);
706     for (auto info : cellInfoList.cellNearbyInfo) {
707         TELEPHONY_LOGI("ratType:%{public}d", info.ratType);
708         switch (static_cast<RatType>(info.ratType)) {
709             case RatType::NETWORK_TYPE_LTE:
710                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
711                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
712                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
713                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
714                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rxlev);
715                 break;
716             case RatType::NETWORK_TYPE_GSM:
717                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
718                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
719                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
720                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
721                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
722                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
723                 break;
724             case RatType::NETWORK_TYPE_WCDMA:
725                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
726                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
727                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
728                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
729                 break;
730             case RatType::NETWORK_TYPE_NR:
731                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
732                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
733                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
734                 break;
735             default:
736                 TELEPHONY_LOGE("invalid ratType");
737                 break;
738         }
739     }
740     hdiId_ = HdiId::HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST;
741     resultInfo_ = responseInfo;
742     NotifyAll();
743     return 0;
744 }
745 
GetCurrentCellInfoResponse(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo & cellInfoList)746 int32_t RilCallbackTest::GetCurrentCellInfoResponse(
747     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo &cellInfoList)
748 {
749     TELEPHONY_LOGI("RilCallbackTest::GetCurrentCellInfoResponse itemNum:%{public}d", cellInfoList.itemNum);
750     for (auto info : cellInfoList.cellCurrentInfo) {
751         TELEPHONY_LOGI("RilCallbackTest::GetCurrentCellInfoResponse ratType:%{public}d, mcc:%{public}d, mnc:%{public}d",
752             info.ratType, info.mcc, info.mnc);
753         switch (static_cast<RatType>(info.ratType)) {
754             case RatType::NETWORK_TYPE_LTE:
755                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
756                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
757                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
758                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
759                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
760                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
761                 break;
762             case RatType::NETWORK_TYPE_GSM:
763                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
764                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
765                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
766                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
767                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
768                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
769                 break;
770             case RatType::NETWORK_TYPE_WCDMA:
771                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
772                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
773                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
774                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
775                 break;
776             case RatType::NETWORK_TYPE_NR:
777                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
778                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
779                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
780                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
781                 break;
782             default:
783                 TELEPHONY_LOGE("invalid ratType");
784                 break;
785         }
786     }
787     hdiId_ = HdiId::HREQ_NETWORK_GET_CURRENT_CELL_INFO;
788     resultInfo_ = responseInfo;
789     NotifyAll();
790     return 0;
791 }
792 
GetCurrentCellInfoResponse_1_1(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo_1_1 & cellListCurrentInfo)793 int32_t RilCallbackTest::GetCurrentCellInfoResponse_1_1(
794     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo_1_1 &cellListCurrentInfo)
795 {
796     TELEPHONY_LOGI("itemNum:%{public}d", cellListCurrentInfo.itemNum);
797     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
798         TELEPHONY_LOGI("ratType:%{public}d, mcc:%{public}d, mnc:%{public}d", info.ratType, info.mcc, info.mnc);
799         switch (static_cast<RatType>(info.ratType)) {
800             case RatType::NETWORK_TYPE_LTE:
801                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
802                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
803                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
804                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
805                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
806                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
807                 break;
808             case RatType::NETWORK_TYPE_GSM:
809                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
810                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
811                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
812                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
813                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
814                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
815                 break;
816             case RatType::NETWORK_TYPE_WCDMA:
817                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
818                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
819                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
820                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
821                 break;
822             case RatType::NETWORK_TYPE_NR:
823                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
824                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
825                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
826                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
827                 break;
828             default:
829                 TELEPHONY_LOGE("invalid ratType");
830                 break;
831         }
832     }
833     hdiId_ = HdiId::HREQ_NETWORK_GET_CURRENT_CELL_INFO;
834     resultInfo_ = responseInfo;
835     NotifyAll();
836     return 0;
837 }
838 
GetCurrentCellInfoResponse_1_2(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo_1_2 & cellListCurrentInfo)839 int32_t RilCallbackTest::GetCurrentCellInfoResponse_1_2(
840     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo_1_2 &cellListCurrentInfo)
841 {
842     TELEPHONY_LOGI("itemNum:%{public}d", cellListCurrentInfo.itemNum);
843     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
844         TELEPHONY_LOGI("ratType:%{public}d, mcc:%{public}d, mnc:%{public}d", info.ratType, info.mcc, info.mnc);
845         switch (static_cast<RatType>(info.ratType)) {
846             case RatType::NETWORK_TYPE_LTE:
847                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
848                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
849                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
850                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
851                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
852                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
853                 break;
854             case RatType::NETWORK_TYPE_GSM:
855                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
856                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
857                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
858                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
859                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
860                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
861                 break;
862             case RatType::NETWORK_TYPE_WCDMA:
863                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
864                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
865                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
866                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
867                 break;
868             case RatType::NETWORK_TYPE_NR:
869                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
870                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
871                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
872                 break;
873             default:
874                 TELEPHONY_LOGE("invalid ratType");
875                 break;
876         }
877     }
878     hdiId_ = HdiId::HREQ_NETWORK_GET_CURRENT_CELL_INFO;
879     resultInfo_ = responseInfo;
880     NotifyAll();
881     return 0;
882 }
883 
SetPreferredNetworkResponse(const RilRadioResponseInfo & responseInfo)884 int32_t RilCallbackTest::SetPreferredNetworkResponse(const RilRadioResponseInfo &responseInfo)
885 {
886     TELEPHONY_LOGI("RilCallbackTest::SetPreferredNetworkResponse error:%{public}d", responseInfo.error);
887     hdiId_ = HdiId::HREQ_NETWORK_SET_PREFERRED_NETWORK;
888     resultInfo_ = responseInfo;
889     NotifyAll();
890     return 0;
891 }
892 
GetPreferredNetworkResponse(const RilRadioResponseInfo & responseInfo,const PreferredNetworkTypeInfo & preferredNetworkTypeInfo)893 int32_t RilCallbackTest::GetPreferredNetworkResponse(
894     const RilRadioResponseInfo &responseInfo, const PreferredNetworkTypeInfo &preferredNetworkTypeInfo)
895 {
896     TELEPHONY_LOGI(
897         "RilCallbackTest::GetPreferredNetworkResponse type:%{public}d", preferredNetworkTypeInfo.preferredNetworkType);
898     hdiId_ = HdiId::HREQ_NETWORK_GET_PREFERRED_NETWORK;
899     resultInfo_ = responseInfo;
900     NotifyAll();
901     return 0;
902 }
903 
GetPhysicalChannelConfigResponse(const RilRadioResponseInfo & responseInfo,const ChannelConfigInfoList & channelConfigInfoList)904 int32_t RilCallbackTest::GetPhysicalChannelConfigResponse(
905     const RilRadioResponseInfo &responseInfo, const ChannelConfigInfoList &channelConfigInfoList)
906 {
907     TELEPHONY_LOGI(
908         "RilCallbackTest::GetPhysicalChannelConfigResponse itemNum:%{public}d", channelConfigInfoList.itemNum);
909     for (PhysicalChannelConfig phyChnlCfg : channelConfigInfoList.channelConfigInfos) {
910         TELEPHONY_LOGI(
911             "RilCallbackTest::GetPhysicalChannelConfigResponse cellConnStatus:%{public}d, "
912             "cellBandwidthDownlinkKhz:%{public}d, cellBandwidthUplinkKhz:%{public}d, physicalCellId:%{public}d, "
913             "ratType:%{public}d, freqRange:%{public}d, downlinkChannelNum:%{public}d, "
914             "uplinkChannelNum:%{public}d, contextIdNum:%{public}d",
915             phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz,
916             phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum,
917             phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum);
918         for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) {
919             TELEPHONY_LOGI("contextIds[%{public}d]:%{public}d", j, phyChnlCfg.contextIds[j]);
920         }
921     }
922     hdiId_ = HdiId::HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG;
923     resultInfo_ = responseInfo;
924     NotifyAll();
925     return 0;
926 }
927 
SetLocateUpdatesResponse(const RilRadioResponseInfo & responseInfo)928 int32_t RilCallbackTest::SetLocateUpdatesResponse(const RilRadioResponseInfo &responseInfo)
929 {
930     TELEPHONY_LOGI("RilCallbackTest::SetLocateUpdatesResponse error:%{public}d", responseInfo.error);
931     hdiId_ = HdiId::HREQ_NETWORK_SET_LOCATE_UPDATES;
932     resultInfo_ = responseInfo;
933     NotifyAll();
934     return 0;
935 }
936 
SetNotificationFilterResponse(const RilRadioResponseInfo & responseInfo)937 int32_t RilCallbackTest::SetNotificationFilterResponse(const RilRadioResponseInfo &responseInfo)
938 {
939     TELEPHONY_LOGI("RilCallbackTest::SetNotificationFilterResponse error:%{public}d", responseInfo.error);
940     hdiId_ = HdiId::HREQ_NETWORK_SET_NOTIFICATION_FILTER;
941     resultInfo_ = responseInfo;
942     NotifyAll();
943     return 0;
944 }
945 
SetDeviceStateResponse(const RilRadioResponseInfo & responseInfo)946 int32_t RilCallbackTest::SetDeviceStateResponse(const RilRadioResponseInfo &responseInfo)
947 {
948     TELEPHONY_LOGI("RilCallbackTest::SetDeviceStateResponse error:%{public}d", responseInfo.error);
949     hdiId_ = HdiId::HREQ_NETWORK_SET_DEVICE_STATE;
950     resultInfo_ = responseInfo;
951     NotifyAll();
952     return 0;
953 }
954 
SetNrOptionModeResponse(const RilRadioResponseInfo & responseInfo)955 int32_t RilCallbackTest::SetNrOptionModeResponse(const RilRadioResponseInfo &responseInfo)
956 {
957     TELEPHONY_LOGI("RilCallbackTest::SetNrOptionModeResponse error:%{public}d", responseInfo.error);
958     hdiId_ = HdiId::HREQ_NETWORK_SET_NR_OPTION_MODE;
959     resultInfo_ = responseInfo;
960     NotifyAll();
961     return 0;
962 }
963 
GetNrOptionModeResponse(const RilRadioResponseInfo & responseInfo,const int32_t mode)964 int32_t RilCallbackTest::GetNrOptionModeResponse(const RilRadioResponseInfo &responseInfo, const int32_t mode)
965 {
966     TELEPHONY_LOGI("RilCallbackTest::GetNrOptionModeResponse mode:%{public}d", mode);
967     hdiId_ = HdiId::HREQ_NETWORK_GET_NR_OPTION_MODE;
968     resultInfo_ = responseInfo;
969     NotifyAll();
970     return 0;
971 }
972 
GetRrcConnectionStateResponse(const RilRadioResponseInfo & responseInfo,int32_t rrcConnectionState)973 int32_t RilCallbackTest::GetRrcConnectionStateResponse(
974     const RilRadioResponseInfo &responseInfo, int32_t rrcConnectionState)
975 {
976     TELEPHONY_LOGI("RilCallbackTest::GetRrcConnectionStateResponse rrcConnectionState:%{public}d", rrcConnectionState);
977     hdiId_ = HdiId::HREQ_NETWORK_GET_RRC_CONNECTION_STATE;
978     resultInfo_ = responseInfo;
979     NotifyAll();
980     return 0;
981 }
982 
GetNrSsbIdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_2::NrCellSsbIds & nrCellSsbIds)983 int32_t RilCallbackTest::GetNrSsbIdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
984     const HDI::Ril::V1_2::NrCellSsbIds &nrCellSsbIds)
985 {
986     TELEPHONY_LOGI("GetNrSsbIdResponse rsrp:%{public}d", nrCellSsbIds.rsrp);
987     TELEPHONY_LOGI("GetNrSsbIdResponse sinr:%{public}d", nrCellSsbIds.sinr);
988     TELEPHONY_LOGI("GetNrSsbIdResponse nbCellCount:%{public}d", nrCellSsbIds.nbCellCount);
989     hdiId_ = HdiId::HREQ_NETWORK_GET_NR_SSBID_INFO;
990     resultInfo_ = responseInfo;
991     NotifyAll();
992     return 0;
993 }
994 
995 // Call
CallEmergencyNotice(const RilRadioResponseInfo & responseInfo,const EmergencyInfoList & emergencyInfoList)996 int32_t RilCallbackTest::CallEmergencyNotice(
997     const RilRadioResponseInfo &responseInfo, const EmergencyInfoList &emergencyInfoList)
998 {
999     TELEPHONY_LOGI("GetBoolResult CallEmergencyNotice callSize : %{public}d", emergencyInfoList.callSize);
1000     return 0;
1001 }
1002 
CallStateUpdated(const RilRadioResponseInfo & responseInfo)1003 int32_t RilCallbackTest::CallStateUpdated(const RilRadioResponseInfo &responseInfo)
1004 {
1005     TELEPHONY_LOGI(
1006         "GetBoolResult CallStateUpdated slotId : %{public}d, type: %{public}d", responseInfo.slotId, responseInfo.type);
1007     return 0;
1008 }
1009 
CallRingbackVoiceNotice(const RilRadioResponseInfo & responseInfo,const RingbackVoice & ringbackVoice)1010 int32_t RilCallbackTest::CallRingbackVoiceNotice(
1011     const RilRadioResponseInfo &responseInfo, const RingbackVoice &ringbackVoice)
1012 {
1013     TELEPHONY_LOGI("GetBoolResult CallRingbackVoiceNotice slotId : %{public}d, ringbackVoice: %{public}d",
1014         responseInfo.slotId, ringbackVoice.status);
1015     return 0;
1016 }
1017 
CallSrvccStatusNotice(const RilRadioResponseInfo & responseInfo,const SrvccStatus & srvccStatus)1018 int32_t RilCallbackTest::CallSrvccStatusNotice(const RilRadioResponseInfo &responseInfo, const SrvccStatus &srvccStatus)
1019 {
1020     TELEPHONY_LOGI("GetBoolResult CallSrvccStatusNotice slotId : %{public}d, srvccStatus: %{public}d",
1021         responseInfo.slotId, srvccStatus.status);
1022     return 0;
1023 }
1024 
CallUssdNotice(const RilRadioResponseInfo & responseInfo,const UssdNoticeInfo & ussdNoticeInfo)1025 int32_t RilCallbackTest::CallUssdNotice(const RilRadioResponseInfo &responseInfo, const UssdNoticeInfo &ussdNoticeInfo)
1026 {
1027     TELEPHONY_LOGI("GetBoolResult CallUssdNotice slotId : %{public}d, ussdNoticeInfo m: %{public}d, str: %{public}s",
1028         responseInfo.slotId, ussdNoticeInfo.type, ussdNoticeInfo.message.c_str());
1029     return 0;
1030 }
1031 
CallSsNotice(const RilRadioResponseInfo & responseInfo,const SsNoticeInfo & ssNoticeInfo)1032 int32_t RilCallbackTest::CallSsNotice(const RilRadioResponseInfo &responseInfo, const SsNoticeInfo &ssNoticeInfo)
1033 {
1034     TELEPHONY_LOGI("GetBoolResult CallSsNotice slotId : %{public}d, result: %{public}d, serviceType: %{public}d,"
1035                    "requestType: %{public}d, serviceClass: %{public}d",
1036         responseInfo.slotId, ssNoticeInfo.result, ssNoticeInfo.serviceType, ssNoticeInfo.requestType,
1037         ssNoticeInfo.serviceClass);
1038     return 0;
1039 }
1040 
CallRsrvccStatusNotify(const RilRadioResponseInfo & responseInfo)1041 int32_t RilCallbackTest::CallRsrvccStatusNotify(const RilRadioResponseInfo &responseInfo)
1042 {
1043     TELEPHONY_LOGI(
1044         "CallRsrvccStatusNotify slotId : %{public}d, type: %{public}d", responseInfo.slotId, responseInfo.type);
1045     return 0;
1046 }
1047 
GetEmergencyCallListResponse(const RilRadioResponseInfo & responseInfo,const EmergencyInfoList & emergencyInfoList)1048 int32_t RilCallbackTest::GetEmergencyCallListResponse(
1049     const RilRadioResponseInfo &responseInfo, const EmergencyInfoList &emergencyInfoList)
1050 {
1051     TELEPHONY_LOGI("GetBoolResult emergencyInfoList callSize : %{public}d", emergencyInfoList.callSize);
1052     hdiId_ = HdiId::HREQ_CALL_GET_EMERGENCY_LIST;
1053     resultInfo_ = responseInfo;
1054     NotifyAll();
1055     return 0;
1056 }
1057 
SetEmergencyCallListResponse(const RilRadioResponseInfo & responseInfo)1058 int32_t RilCallbackTest::SetEmergencyCallListResponse(const RilRadioResponseInfo &responseInfo)
1059 {
1060     TELEPHONY_LOGI("GetBoolResult SetEmergencyCallListResponse");
1061     hdiId_ = HdiId::HREQ_CALL_SET_EMERGENCY_LIST;
1062     resultInfo_ = responseInfo;
1063     NotifyAll();
1064     return 0;
1065 }
1066 
GetCallListResponse(const RilRadioResponseInfo & responseInfo,const CallInfoList & callList)1067 int32_t RilCallbackTest::GetCallListResponse(const RilRadioResponseInfo &responseInfo, const CallInfoList &callList)
1068 {
1069     TELEPHONY_LOGI("GetBoolResult CallInfoList callSize : %{public}d", callList.callSize);
1070     hdiId_ = HdiId::HREQ_CALL_GET_CALL_LIST;
1071     resultInfo_ = responseInfo;
1072     NotifyAll();
1073     return 0;
1074 }
1075 
DialResponse(const RilRadioResponseInfo & responseInfo)1076 int32_t RilCallbackTest::DialResponse(const RilRadioResponseInfo &responseInfo)
1077 {
1078     TELEPHONY_LOGI("GetBoolResult DialResponse");
1079     hdiId_ = HdiId::HREQ_CALL_DIAL;
1080     resultInfo_ = responseInfo;
1081     NotifyAll();
1082     return 0;
1083 }
1084 
HangupResponse(const RilRadioResponseInfo & responseInfo)1085 int32_t RilCallbackTest::HangupResponse(const RilRadioResponseInfo &responseInfo)
1086 {
1087     TELEPHONY_LOGI("GetBoolResult HangupResponse");
1088     hdiId_ = HdiId::HREQ_CALL_HANGUP;
1089     resultInfo_ = responseInfo;
1090     NotifyAll();
1091     return 0;
1092 }
1093 
RejectResponse(const RilRadioResponseInfo & responseInfo)1094 int32_t RilCallbackTest::RejectResponse(const RilRadioResponseInfo &responseInfo)
1095 {
1096     TELEPHONY_LOGI("GetBoolResult RejectResponse");
1097     hdiId_ = HdiId::HREQ_CALL_REJECT;
1098     resultInfo_ = responseInfo;
1099     NotifyAll();
1100     return 0;
1101 }
1102 
AnswerResponse(const RilRadioResponseInfo & responseInfo)1103 int32_t RilCallbackTest::AnswerResponse(const RilRadioResponseInfo &responseInfo)
1104 {
1105     TELEPHONY_LOGI("GetBoolResult AnswerResponse");
1106     hdiId_ = HdiId::HREQ_CALL_ANSWER;
1107     resultInfo_ = responseInfo;
1108     NotifyAll();
1109     return 0;
1110 }
1111 
HoldCallResponse(const RilRadioResponseInfo & responseInfo)1112 int32_t RilCallbackTest::HoldCallResponse(const RilRadioResponseInfo &responseInfo)
1113 {
1114     TELEPHONY_LOGI("GetBoolResult HoldCallResponse");
1115     hdiId_ = HdiId::HREQ_CALL_HOLD_CALL;
1116     resultInfo_ = responseInfo;
1117     NotifyAll();
1118     return 0;
1119 }
1120 
UnHoldCallResponse(const RilRadioResponseInfo & responseInfo)1121 int32_t RilCallbackTest::UnHoldCallResponse(const RilRadioResponseInfo &responseInfo)
1122 {
1123     TELEPHONY_LOGI("GetBoolResult UnHoldCallResponse");
1124     hdiId_ = HdiId::HREQ_CALL_UNHOLD_CALL;
1125     resultInfo_ = responseInfo;
1126     NotifyAll();
1127     return 0;
1128 }
1129 
SwitchCallResponse(const RilRadioResponseInfo & responseInfo)1130 int32_t RilCallbackTest::SwitchCallResponse(const RilRadioResponseInfo &responseInfo)
1131 {
1132     TELEPHONY_LOGI("GetBoolResult SwitchCallResponse");
1133     hdiId_ = HdiId::HREQ_CALL_SWITCH_CALL;
1134     resultInfo_ = responseInfo;
1135     NotifyAll();
1136     return 0;
1137 }
1138 
GetClipResponse(const RilRadioResponseInfo & responseInfo,const GetClipResult & getClipResult)1139 int32_t RilCallbackTest::GetClipResponse(const RilRadioResponseInfo &responseInfo, const GetClipResult &getClipResult)
1140 {
1141     TELEPHONY_LOGI("GetBoolResult result: %{public}d, action: %{public}d, clipStat: %{public}d", getClipResult.result,
1142         getClipResult.action, getClipResult.clipStat);
1143     hdiId_ = HdiId::HREQ_CALL_GET_CLIP;
1144     resultInfo_ = responseInfo;
1145     NotifyAll();
1146     return 0;
1147 }
1148 
SetClipResponse(const RilRadioResponseInfo & responseInfo)1149 int32_t RilCallbackTest::SetClipResponse(const RilRadioResponseInfo &responseInfo)
1150 {
1151     TELEPHONY_LOGI("GetBoolResult SetClipResponse");
1152     hdiId_ = HdiId::HREQ_CALL_SET_CLIP;
1153     resultInfo_ = responseInfo;
1154     NotifyAll();
1155     return 0;
1156 }
1157 
CombineConferenceResponse(const RilRadioResponseInfo & responseInfo)1158 int32_t RilCallbackTest::CombineConferenceResponse(const RilRadioResponseInfo &responseInfo)
1159 {
1160     TELEPHONY_LOGI("GetBoolResult CombineConferenceResponse");
1161     hdiId_ = HdiId::HREQ_CALL_COMBINE_CONFERENCE;
1162     resultInfo_ = responseInfo;
1163     NotifyAll();
1164     return 0;
1165 }
1166 
SeparateConferenceResponse(const RilRadioResponseInfo & responseInfo)1167 int32_t RilCallbackTest::SeparateConferenceResponse(const RilRadioResponseInfo &responseInfo)
1168 {
1169     TELEPHONY_LOGI("GetBoolResult SeparateConferenceResponse");
1170     hdiId_ = HdiId::HREQ_CALL_SEPARATE_CONFERENCE;
1171     resultInfo_ = responseInfo;
1172     NotifyAll();
1173     return 0;
1174 }
1175 
CallSupplementResponse(const RilRadioResponseInfo & responseInfo)1176 int32_t RilCallbackTest::CallSupplementResponse(const RilRadioResponseInfo &responseInfo)
1177 {
1178     TELEPHONY_LOGI("GetBoolResult CallSupplementResponse");
1179     hdiId_ = HdiId::HREQ_CALL_CALL_SUPPLEMENT;
1180     resultInfo_ = responseInfo;
1181     NotifyAll();
1182     return 0;
1183 }
1184 
GetCallWaitingResponse(const RilRadioResponseInfo & responseInfo,const CallWaitResult & callWaitResult)1185 int32_t RilCallbackTest::GetCallWaitingResponse(
1186     const RilRadioResponseInfo &responseInfo, const CallWaitResult &callWaitResult)
1187 {
1188     TELEPHONY_LOGI("GetBoolResult GetCallWaitingResponse result: %{public}d, status: %{public}d, classCw: %{public}d",
1189         callWaitResult.result, callWaitResult.status, callWaitResult.classCw);
1190     hdiId_ = HdiId::HREQ_CALL_GET_CALL_WAITING;
1191     resultInfo_ = responseInfo;
1192     NotifyAll();
1193     return 0;
1194 }
1195 
SetCallWaitingResponse(const RilRadioResponseInfo & responseInfo)1196 int32_t RilCallbackTest::SetCallWaitingResponse(const RilRadioResponseInfo &responseInfo)
1197 {
1198     TELEPHONY_LOGI("GetBoolResult SetCallWaitingResponse");
1199     hdiId_ = HdiId::HREQ_CALL_SET_CALL_WAITING;
1200     resultInfo_ = responseInfo;
1201     NotifyAll();
1202     return 0;
1203 }
1204 
GetCallTransferInfoResponse(const RilRadioResponseInfo & responseInfo,const CallForwardQueryInfoList & cFQueryList)1205 int32_t RilCallbackTest::GetCallTransferInfoResponse(
1206     const RilRadioResponseInfo &responseInfo, const CallForwardQueryInfoList &cFQueryList)
1207 {
1208     TELEPHONY_LOGI("GetBoolResult GetCallTransferInfoResponse cFQueryList: %{public}d", cFQueryList.callSize);
1209     hdiId_ = HdiId::HREQ_CALL_GET_CALL_TRANSFER_INFO;
1210     resultInfo_ = responseInfo;
1211     NotifyAll();
1212     return 0;
1213 }
1214 
SetCallTransferInfoResponse(const RilRadioResponseInfo & responseInfo)1215 int32_t RilCallbackTest::SetCallTransferInfoResponse(const RilRadioResponseInfo &responseInfo)
1216 {
1217     TELEPHONY_LOGI("GetBoolResult SetCallTransferInfoResponse");
1218     hdiId_ = HdiId::HREQ_CALL_SET_CALL_TRANSFER_INFO;
1219     resultInfo_ = responseInfo;
1220     NotifyAll();
1221     return 0;
1222 }
1223 
GetCallRestrictionResponse(const RilRadioResponseInfo & responseInfo,const CallRestrictionResult & result)1224 int32_t RilCallbackTest::GetCallRestrictionResponse(
1225     const RilRadioResponseInfo &responseInfo, const CallRestrictionResult &result)
1226 {
1227     TELEPHONY_LOGI("GetBoolResult result: %{public}d, status: %{public}d, classCw: %{public}d", result.result,
1228         result.status, result.classCw);
1229     hdiId_ = HdiId::HREQ_CALL_GET_CALL_RESTRICTION;
1230     resultInfo_ = responseInfo;
1231     NotifyAll();
1232     return 0;
1233 }
1234 
SetCallRestrictionResponse(const RilRadioResponseInfo & responseInfo)1235 int32_t RilCallbackTest::SetCallRestrictionResponse(const RilRadioResponseInfo &responseInfo)
1236 {
1237     TELEPHONY_LOGI("GetBoolResult SetCallRestrictionResponse");
1238     hdiId_ = HdiId::HREQ_CALL_SET_CALL_RESTRICTION;
1239     resultInfo_ = responseInfo;
1240     NotifyAll();
1241     return 0;
1242 }
1243 
GetClirResponse(const RilRadioResponseInfo & responseInfo,const GetClirResult & getClirResult)1244 int32_t RilCallbackTest::GetClirResponse(const RilRadioResponseInfo &responseInfo, const GetClirResult &getClirResult)
1245 {
1246     TELEPHONY_LOGI("GetBoolResult result: %{public}d, action: %{public}d, clirStat: %{public}d", getClirResult.result,
1247         getClirResult.action, getClirResult.clirStat);
1248     hdiId_ = HdiId::HREQ_CALL_GET_CLIR;
1249     resultInfo_ = responseInfo;
1250     NotifyAll();
1251     return 0;
1252 }
1253 
SetClirResponse(const RilRadioResponseInfo & responseInfo)1254 int32_t RilCallbackTest::SetClirResponse(const RilRadioResponseInfo &responseInfo)
1255 {
1256     TELEPHONY_LOGI("GetBoolResult SetClirResponse");
1257     hdiId_ = HdiId::HREQ_CALL_SET_CLIR;
1258     resultInfo_ = responseInfo;
1259     NotifyAll();
1260     return 0;
1261 }
1262 
StartDtmfResponse(const RilRadioResponseInfo & responseInfo)1263 int32_t RilCallbackTest::StartDtmfResponse(const RilRadioResponseInfo &responseInfo)
1264 {
1265     TELEPHONY_LOGI("GetBoolResult StartDtmfResponse");
1266     hdiId_ = HdiId::HREQ_CALL_START_DTMF;
1267     resultInfo_ = responseInfo;
1268     NotifyAll();
1269     return 0;
1270 }
1271 
SendDtmfResponse(const RilRadioResponseInfo & responseInfo)1272 int32_t RilCallbackTest::SendDtmfResponse(const RilRadioResponseInfo &responseInfo)
1273 {
1274     TELEPHONY_LOGI("GetBoolResult SendDtmfResponse");
1275     hdiId_ = HdiId::HREQ_CALL_SEND_DTMF;
1276     resultInfo_ = responseInfo;
1277     NotifyAll();
1278     return 0;
1279 }
1280 
StopDtmfResponse(const RilRadioResponseInfo & responseInfo)1281 int32_t RilCallbackTest::StopDtmfResponse(const RilRadioResponseInfo &responseInfo)
1282 {
1283     TELEPHONY_LOGI("GetBoolResult StopDtmfResponse");
1284     hdiId_ = HdiId::HREQ_CALL_STOP_DTMF;
1285     resultInfo_ = responseInfo;
1286     NotifyAll();
1287     return 0;
1288 }
1289 
GetCallPreferenceModeResponse(const RilRadioResponseInfo & responseInfo,int32_t mode)1290 int32_t RilCallbackTest::GetCallPreferenceModeResponse(const RilRadioResponseInfo &responseInfo, int32_t mode)
1291 {
1292     TELEPHONY_LOGI("GetBoolResult GetCallPreferenceModeResponse mode: %{public}d", mode);
1293     hdiId_ = HdiId::HREQ_CALL_GET_CALL_PREFERENCE;
1294     resultInfo_ = responseInfo;
1295     NotifyAll();
1296     return 0;
1297 }
1298 
SetCallPreferenceModeResponse(const RilRadioResponseInfo & responseInfo)1299 int32_t RilCallbackTest::SetCallPreferenceModeResponse(const RilRadioResponseInfo &responseInfo)
1300 {
1301     TELEPHONY_LOGI("GetBoolResult SetCallPreferenceModeResponse");
1302     hdiId_ = HdiId::HREQ_CALL_SET_CALL_PREFERENCE;
1303     resultInfo_ = responseInfo;
1304     NotifyAll();
1305     return 0;
1306 }
1307 
SetUssdResponse(const RilRadioResponseInfo & responseInfo)1308 int32_t RilCallbackTest::SetUssdResponse(const RilRadioResponseInfo &responseInfo)
1309 {
1310     TELEPHONY_LOGI("GetBoolResult SetUssdResponse");
1311     hdiId_ = HdiId::HREQ_CALL_SET_USSD;
1312     resultInfo_ = responseInfo;
1313     NotifyAll();
1314     return 0;
1315 }
1316 
GetUssdResponse(const RilRadioResponseInfo & responseInfo,int32_t cusd)1317 int32_t RilCallbackTest::GetUssdResponse(const RilRadioResponseInfo &responseInfo, int32_t cusd)
1318 {
1319     TELEPHONY_LOGI("GetBoolResult GetUssdResponse cusd: %{public}d", cusd);
1320     hdiId_ = HdiId::HREQ_CALL_GET_USSD;
1321     resultInfo_ = responseInfo;
1322     NotifyAll();
1323     return 0;
1324 }
1325 
SetMuteResponse(const RilRadioResponseInfo & responseInfo)1326 int32_t RilCallbackTest::SetMuteResponse(const RilRadioResponseInfo &responseInfo)
1327 {
1328     TELEPHONY_LOGI("GetBoolResult SetMuteResponse");
1329     hdiId_ = HdiId::HREQ_CALL_SET_MUTE;
1330     resultInfo_ = responseInfo;
1331     NotifyAll();
1332     return 0;
1333 }
1334 
GetMuteResponse(const RilRadioResponseInfo & responseInfo,int32_t mute)1335 int32_t RilCallbackTest::GetMuteResponse(const RilRadioResponseInfo &responseInfo, int32_t mute)
1336 {
1337     TELEPHONY_LOGI("GetBoolResult GetMuteResponse mute: %{public}d", mute);
1338     hdiId_ = HdiId::HREQ_CALL_GET_MUTE;
1339     resultInfo_ = responseInfo;
1340     NotifyAll();
1341     return 0;
1342 }
1343 
GetCallFailReasonResponse(const RilRadioResponseInfo & responseInfo,int32_t callFail)1344 int32_t RilCallbackTest::GetCallFailReasonResponse(const RilRadioResponseInfo &responseInfo, int32_t callFail)
1345 {
1346     TELEPHONY_LOGI("GetBoolResult GetCallFailReasonResponse callFail: %{public}d", callFail);
1347     hdiId_ = HdiId::HREQ_CALL_GET_FAIL_REASON;
1348     resultInfo_ = responseInfo;
1349     NotifyAll();
1350     return 0;
1351 }
1352 
SetBarringPasswordResponse(const RilRadioResponseInfo & responseInfo)1353 int32_t RilCallbackTest::SetBarringPasswordResponse(const RilRadioResponseInfo &responseInfo)
1354 {
1355     TELEPHONY_LOGI("GetBoolResult SetBarringPasswordResponse");
1356     hdiId_ = HdiId::HREQ_CALL_SET_BARRING_PASSWORD;
1357     resultInfo_ = responseInfo;
1358     NotifyAll();
1359     return 0;
1360 }
1361 
CloseUnFinishedUssdResponse(const RilRadioResponseInfo & responseInfo)1362 int32_t RilCallbackTest::CloseUnFinishedUssdResponse(const RilRadioResponseInfo &responseInfo)
1363 {
1364     TELEPHONY_LOGI("GetBoolResult CloseUnFinishedUssdResponse");
1365     hdiId_ = HdiId::HREQ_CALL_CLOSE_UNFINISHED_USSD;
1366     resultInfo_ = responseInfo;
1367     NotifyAll();
1368     return 0;
1369 }
1370 
SetVonrSwitchResponse(const RilRadioResponseInfo & responseInfo)1371 int32_t RilCallbackTest::SetVonrSwitchResponse(const RilRadioResponseInfo &responseInfo)
1372 {
1373     TELEPHONY_LOGI("GetBoolResult SetVonrSwitchResponse");
1374     hdiId_ = HdiId::HREQ_SET_VONR_SWITCH;
1375     resultInfo_ = responseInfo;
1376     NotifyAll();
1377     return 0;
1378 }
1379 
1380 /**
1381  * modem
1382  **/
RadioStateUpdated(const RilRadioResponseInfo & responseInfo,int32_t state)1383 int32_t RilCallbackTest::RadioStateUpdated(const RilRadioResponseInfo &responseInfo, int32_t state)
1384 {
1385     TELEPHONY_LOGI("RadioStateUpdated state : %{public}d", state);
1386     return 0;
1387 }
1388 
VoiceRadioTechUpdated(const RilRadioResponseInfo & responseInfo,const VoiceRadioTechnology & voiceRadioTechnology)1389 int32_t RilCallbackTest::VoiceRadioTechUpdated(
1390     const RilRadioResponseInfo &responseInfo, const VoiceRadioTechnology &voiceRadioTechnology)
1391 {
1392     TELEPHONY_LOGI(
1393         "GetVoiceRadioTechnologyResponse srvStatus : %{public}d srvDomain : %{public}d roamStatus: %{public}d "
1394         "simStatus : %{public}d lockStatus : %{public}d sysMode : %{public}d actType : %{public}d sysModeName : "
1395         "%{public}s actName : %{public}s",
1396         voiceRadioTechnology.srvStatus, voiceRadioTechnology.srvDomain, voiceRadioTechnology.roamStatus,
1397         voiceRadioTechnology.simStatus, voiceRadioTechnology.lockStatus, voiceRadioTechnology.sysMode,
1398         voiceRadioTechnology.actType, voiceRadioTechnology.sysModeName.c_str(), voiceRadioTechnology.actName.c_str());
1399     return 0;
1400 }
1401 
DsdsModeUpdated(const RilRadioResponseInfo & responseInfo,int32_t mode)1402 int32_t RilCallbackTest::DsdsModeUpdated(const RilRadioResponseInfo &responseInfo, int32_t mode)
1403 {
1404     TELEPHONY_LOGI("DsdsModeUpdated mode : %{public}d", mode);
1405     return 0;
1406 }
1407 
ShutDownResponse(const RilRadioResponseInfo & responseInfo)1408 int32_t RilCallbackTest::ShutDownResponse(const RilRadioResponseInfo &responseInfo)
1409 {
1410     TELEPHONY_LOGI("ShutDownResponse");
1411     hdiId_ = HdiId::HREQ_MODEM_SHUT_DOWN;
1412     resultInfo_ = responseInfo;
1413     NotifyAll();
1414     return 0;
1415 }
1416 
SetRadioStateResponse(const RilRadioResponseInfo & responseInfo)1417 int32_t RilCallbackTest::SetRadioStateResponse(const RilRadioResponseInfo &responseInfo)
1418 {
1419     TELEPHONY_LOGI("SetRadioStateResponse");
1420     hdiId_ = HdiId::HREQ_MODEM_SET_RADIO_STATUS;
1421     resultInfo_ = responseInfo;
1422     NotifyAll();
1423     return 0;
1424 }
1425 
GetRadioStateResponse(const RilRadioResponseInfo & responseInfo,int32_t state)1426 int32_t RilCallbackTest::GetRadioStateResponse(const RilRadioResponseInfo &responseInfo, int32_t state)
1427 {
1428     TELEPHONY_LOGI("GetRadioStateResponse state : %{public}d", state);
1429     hdiId_ = HdiId::HREQ_MODEM_GET_RADIO_STATUS;
1430     resultInfo_ = responseInfo;
1431     NotifyAll();
1432     return 0;
1433 }
1434 
GetImeiResponse(const RilRadioResponseInfo & responseInfo,const std::string & imei)1435 int32_t RilCallbackTest::GetImeiResponse(const RilRadioResponseInfo &responseInfo, const std::string &imei)
1436 {
1437     TELEPHONY_LOGI("GetImeiResponse imei : %{public}s", imei.c_str());
1438     hdiId_ = HdiId::HREQ_MODEM_GET_IMEI;
1439     resultInfo_ = responseInfo;
1440     NotifyAll();
1441     return 0;
1442 }
1443 
GetImeiSvResponse(const RilRadioResponseInfo & responseInfo,const std::string & imeiSv)1444 int32_t RilCallbackTest::GetImeiSvResponse(const RilRadioResponseInfo &responseInfo, const std::string &imeiSv)
1445 {
1446     hdiId_ = HdiId::HREQ_MODEM_GET_IMEISV;
1447     resultInfo_ = responseInfo;
1448     NotifyAll();
1449     return 0;
1450 }
1451 
GetMeidResponse(const RilRadioResponseInfo & responseInfo,const std::string & meid)1452 int32_t RilCallbackTest::GetMeidResponse(const RilRadioResponseInfo &responseInfo, const std::string &meid)
1453 {
1454     TELEPHONY_LOGI("GetMeidResponse meid : %{public}s", meid.c_str());
1455     hdiId_ = HdiId::HREQ_MODEM_GET_MEID;
1456     resultInfo_ = responseInfo;
1457     NotifyAll();
1458     return 0;
1459 }
1460 
GetVoiceRadioTechnologyResponse(const RilRadioResponseInfo & responseInfo,const VoiceRadioTechnology & voiceRadioTechnology)1461 int32_t RilCallbackTest::GetVoiceRadioTechnologyResponse(
1462     const RilRadioResponseInfo &responseInfo, const VoiceRadioTechnology &voiceRadioTechnology)
1463 {
1464     TELEPHONY_LOGI(
1465         "GetVoiceRadioTechnologyResponse srvStatus : %{public}d srvDomain : %{public}d roamStatus: %{public}d "
1466         "simStatus : %{public}d lockStatus : %{public}d sysMode : %{public}d actType : %{public}d sysModeName : "
1467         "%{public}s actName : %{public}s",
1468         voiceRadioTechnology.srvStatus, voiceRadioTechnology.srvDomain, voiceRadioTechnology.roamStatus,
1469         voiceRadioTechnology.simStatus, voiceRadioTechnology.lockStatus, voiceRadioTechnology.sysMode,
1470         voiceRadioTechnology.actType, voiceRadioTechnology.sysModeName.c_str(), voiceRadioTechnology.actName.c_str());
1471     hdiId_ = HdiId::HREQ_MODEM_GET_VOICE_RADIO;
1472     resultInfo_ = responseInfo;
1473     NotifyAll();
1474     return 0;
1475 }
1476 
GetBasebandVersionResponse(const RilRadioResponseInfo & responseInfo,const std::string & basebandVersion)1477 int32_t RilCallbackTest::GetBasebandVersionResponse(
1478     const RilRadioResponseInfo &responseInfo, const std::string &basebandVersion)
1479 {
1480     TELEPHONY_LOGI("GetBasebandVersionResponse basebandVersion : %{public}s", basebandVersion.c_str());
1481     hdiId_ = HdiId::HREQ_MODEM_GET_BASEBAND_VERSION;
1482     resultInfo_ = responseInfo;
1483     NotifyAll();
1484     return 0;
1485 }
1486 
GetRrcConnectionStateUpdated(const RilRadioResponseInfo & responseInfo,int32_t state)1487 int32_t RilCallbackTest::GetRrcConnectionStateUpdated(const RilRadioResponseInfo &responseInfo, int32_t state)
1488 {
1489     TELEPHONY_LOGI("GetRrcConnectionStateUpdated state : %{public}d", state);
1490     return 0;
1491 }
1492 
1493 // Data
PdpContextListUpdated(const RilRadioResponseInfo & responseInfo,const DataCallResultList & dataCallResultList)1494 int32_t RilCallbackTest::PdpContextListUpdated(
1495     const RilRadioResponseInfo &responseInfo, const DataCallResultList &dataCallResultList)
1496 {
1497     TELEPHONY_LOGI("RilCallbackTest::PdpContextListUpdated size:%{public}d", dataCallResultList.size);
1498     for (auto &setupDataCallResultInfo : dataCallResultList.dcList) {
1499         TELEPHONY_LOGI(
1500             "RilCallbackTest::PdpContextListUpdated flag:%{public}d reason:%{public}d retryTime:%{public}d "
1501             "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1502             "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1503             "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1504             setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1505             setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1506             setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1507             setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1508             setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1509             setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1510             setupDataCallResultInfo.pduSessionId);
1511     }
1512     return 0;
1513 }
1514 
DataLinkCapabilityUpdated(const RilRadioResponseInfo & responseInfo,const DataLinkCapability & dataLinkCapability)1515 int32_t RilCallbackTest::DataLinkCapabilityUpdated(
1516     const RilRadioResponseInfo &responseInfo, const DataLinkCapability &dataLinkCapability)
1517 {
1518     TELEPHONY_LOGI(
1519         "RilCallbackTest::DataLinkCapabilityUpdated primaryDownlinkKbps:%{public}d primaryUplinkKbps:%{public}d "
1520         "secondaryDownlinkKbps:%{public}d secondaryUplinkKbps:%{public}d",
1521         dataLinkCapability.primaryDownlinkKbps, dataLinkCapability.primaryUplinkKbps,
1522         dataLinkCapability.secondaryDownlinkKbps, dataLinkCapability.secondaryUplinkKbps);
1523     return 0;
1524 }
1525 
ActivatePdpContextResponse(const RilRadioResponseInfo & responseInfo,const SetupDataCallResultInfo & setupDataCallResultInfo)1526 int32_t RilCallbackTest::ActivatePdpContextResponse(
1527     const RilRadioResponseInfo &responseInfo, const SetupDataCallResultInfo &setupDataCallResultInfo)
1528 {
1529     TELEPHONY_LOGI(
1530         "RilCallbackTest::ActivatePdpContextResponse flag:%{public}d reason:%{public}d retryTime:%{public}d "
1531         "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1532         "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1533         "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1534         setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1535         setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1536         setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1537         setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1538         setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1539         setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1540         setupDataCallResultInfo.pduSessionId);
1541     hdiId_ = HdiId::HREQ_DATA_ACTIVATE_PDP_CONTEXT;
1542     resultInfo_ = responseInfo;
1543     NotifyAll();
1544     return 0;
1545 }
1546 
DeactivatePdpContextResponse(const RilRadioResponseInfo & responseInfo)1547 int32_t RilCallbackTest::DeactivatePdpContextResponse(const RilRadioResponseInfo &responseInfo)
1548 {
1549     TELEPHONY_LOGI("RilCallbackTest::DeactivatePdpContextResponse error:%{public}d", responseInfo.error);
1550     hdiId_ = HdiId::HREQ_DATA_DEACTIVATE_PDP_CONTEXT;
1551     resultInfo_ = responseInfo;
1552     NotifyAll();
1553     return 0;
1554 }
1555 
GetPdpContextListResponse(const RilRadioResponseInfo & responseInfo,const DataCallResultList & dataCallResultList)1556 int32_t RilCallbackTest::GetPdpContextListResponse(
1557     const RilRadioResponseInfo &responseInfo, const DataCallResultList &dataCallResultList)
1558 {
1559     TELEPHONY_LOGI("RilCallbackTest::GetPdpContextListResponse size:%{public}d", dataCallResultList.size);
1560     for (auto &setupDataCallResultInfo : dataCallResultList.dcList) {
1561         TELEPHONY_LOGI(
1562             "RilCallbackTest::GetPdpContextListResponse flag:%{public}d reason:%{public}d retryTime:%{public}d "
1563             "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1564             "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1565             "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1566             setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1567             setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1568             setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1569             setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1570             setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1571             setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1572             setupDataCallResultInfo.pduSessionId);
1573     }
1574     hdiId_ = HdiId::HREQ_DATA_GET_PDP_CONTEXT_LIST;
1575     resultInfo_ = responseInfo;
1576     NotifyAll();
1577     return 0;
1578 }
1579 
SetInitApnInfoResponse(const RilRadioResponseInfo & responseInfo)1580 int32_t RilCallbackTest::SetInitApnInfoResponse(const RilRadioResponseInfo &responseInfo)
1581 {
1582     TELEPHONY_LOGI("RilCallbackTest::SetInitApnInfoResponse error:%{public}d", responseInfo.error);
1583     hdiId_ = HdiId::HREQ_DATA_SET_INIT_APN_INFO;
1584     resultInfo_ = responseInfo;
1585     NotifyAll();
1586     return 0;
1587 }
1588 
SetLinkBandwidthReportingRuleResponse(const RilRadioResponseInfo & responseInfo)1589 int32_t RilCallbackTest::SetLinkBandwidthReportingRuleResponse(const RilRadioResponseInfo &responseInfo)
1590 {
1591     TELEPHONY_LOGI("RilCallbackTest::SetLinkBandwidthReportingRuleResponse error:%{public}d", responseInfo.error);
1592     hdiId_ = HdiId::HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE;
1593     resultInfo_ = responseInfo;
1594     NotifyAll();
1595     return 0;
1596 }
1597 
GetLinkBandwidthInfoResponse(const RilRadioResponseInfo & responseInfo,const DataLinkBandwidthInfo & dataLinkBandwidthInfo)1598 int32_t RilCallbackTest::GetLinkBandwidthInfoResponse(
1599     const RilRadioResponseInfo &responseInfo, const DataLinkBandwidthInfo &dataLinkBandwidthInfo)
1600 {
1601     TELEPHONY_LOGI("RilCallbackTest::GetLinkBandwidthInfoResponse serial:%{public}d cid:%{public}d qi:%{public}d "
1602                    "dlGfbr:%{public}d "
1603                    "ulGfbr:%{public}d dlMfbr:%{public}d ulMfbr:%{public}d ulSambr:%{public}d dlSambr:%{public}d "
1604                    "averagingWindow:%{public}d",
1605         dataLinkBandwidthInfo.serial, dataLinkBandwidthInfo.cid, dataLinkBandwidthInfo.qi, dataLinkBandwidthInfo.dlGfbr,
1606         dataLinkBandwidthInfo.ulGfbr, dataLinkBandwidthInfo.dlMfbr, dataLinkBandwidthInfo.ulMfbr,
1607         dataLinkBandwidthInfo.ulSambr, dataLinkBandwidthInfo.dlSambr, dataLinkBandwidthInfo.averagingWindow);
1608     hdiId_ = HdiId::HREQ_DATA_GET_LINK_BANDWIDTH_INFO;
1609     resultInfo_ = responseInfo;
1610     NotifyAll();
1611     return 0;
1612 }
1613 
GetLinkCapabilityResponse(const RilRadioResponseInfo & responseInfo,const DataLinkCapability & dataLinkCapability)1614 int32_t RilCallbackTest::GetLinkCapabilityResponse(
1615     const RilRadioResponseInfo &responseInfo, const DataLinkCapability &dataLinkCapability)
1616 {
1617     TELEPHONY_LOGI("RilCallbackTest::GetLinkCapabilityResponse primaryDownlinkKbps:%{public}d "
1618                    "primaryUplinkKbps:%{public}d secondaryDownlinkKbps:%{public}d "
1619                    "secondaryUplinkKbps:%{public}d",
1620         dataLinkCapability.primaryDownlinkKbps, dataLinkCapability.primaryUplinkKbps,
1621         dataLinkCapability.secondaryDownlinkKbps, dataLinkCapability.secondaryUplinkKbps);
1622     hdiId_ = HdiId::HREQ_DATA_GET_LINK_CAPABILITY;
1623     resultInfo_ = responseInfo;
1624     NotifyAll();
1625     return 0;
1626 }
1627 
SetDataPermittedResponse(const RilRadioResponseInfo & responseInfo)1628 int32_t RilCallbackTest::SetDataPermittedResponse(const RilRadioResponseInfo &responseInfo)
1629 {
1630     TELEPHONY_LOGI("RilCallbackTest::SetDataPermittedResponse error:%{public}d", responseInfo.error);
1631     hdiId_ = HdiId::HREQ_DATA_SET_DATA_PERMITTED;
1632     resultInfo_ = responseInfo;
1633     NotifyAll();
1634     return 0;
1635 }
1636 
SetDataProfileInfoResponse(const RilRadioResponseInfo & responseInfo)1637 int32_t RilCallbackTest::SetDataProfileInfoResponse(const RilRadioResponseInfo &responseInfo)
1638 {
1639     TELEPHONY_LOGI("RilCallbackTest::SetDataProfileInfoResponse error:%{public}d", responseInfo.error);
1640     hdiId_ = HdiId::HREQ_DATA_SET_DATA_PROFILE_INFO;
1641     resultInfo_ = responseInfo;
1642     NotifyAll();
1643     return 0;
1644 }
1645 
CleanAllConnectionsResponse(const RilRadioResponseInfo & responseInfo)1646 int32_t RilCallbackTest::CleanAllConnectionsResponse(const RilRadioResponseInfo &responseInfo)
1647 {
1648     TELEPHONY_LOGI("RilCallbackTest::CleanAllConnectionsResponse error:%{public}d", responseInfo.error);
1649     hdiId_ = HdiId::HREQ_DATA_CLEAN_ALL_CONNECTIONS;
1650     resultInfo_ = responseInfo;
1651     NotifyAll();
1652     return 0;
1653 }
1654 
1655 // Sms
NewSmsNotify(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1656 int32_t RilCallbackTest::NewSmsNotify(
1657     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1658 {
1659     TELEPHONY_LOGI("RilCallbackTest::NewSmsNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1660     return 0;
1661 }
1662 
NewCdmaSmsNotify(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1663 int32_t RilCallbackTest::NewCdmaSmsNotify(
1664     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1665 {
1666     TELEPHONY_LOGI("RilCallbackTest::NewCdmaSmsNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1667     return 0;
1668 }
1669 
SmsStatusReportNotify(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1670 int32_t RilCallbackTest::SmsStatusReportNotify(
1671     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1672 {
1673     TELEPHONY_LOGI("RilCallbackTest::SmsStatusReportNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1674     return 0;
1675 }
1676 
NewSmsStoredOnSimNotify(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,int32_t recordNumber,int32_t indicationType)1677 int32_t RilCallbackTest::NewSmsStoredOnSimNotify(
1678     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t recordNumber, int32_t indicationType)
1679 {
1680     TELEPHONY_LOGI("RilCallbackTest::NewSmsStoredOnSimNotify recordNumber : %{public}d, indicationType : %{public}d",
1681         recordNumber, indicationType);
1682     return 0;
1683 }
1684 
CBConfigNotify(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const CBConfigReportInfo & cellBroadConfigReportInfo)1685 int32_t RilCallbackTest::CBConfigNotify(
1686     const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const CBConfigReportInfo &cellBroadConfigReportInfo)
1687 {
1688     TELEPHONY_LOGI("RilCallbackTest::CBConfigNotify cellBroadConfigReportInfo dcs : %{public}s",
1689         cellBroadConfigReportInfo.dcs.c_str());
1690     return 0;
1691 }
1692 
SendGsmSmsResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1693 int32_t RilCallbackTest::SendGsmSmsResponse(
1694     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1695 {
1696     TELEPHONY_LOGI("RilCallbackTest::SendGsmSmsResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1697         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1698     hdiId_ = HdiId::HREQ_SMS_SEND_GSM_SMS;
1699     resultInfo_ = responseInfo;
1700     NotifyAll();
1701     return 0;
1702 }
1703 
SendCdmaSmsResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1704 int32_t RilCallbackTest::SendCdmaSmsResponse(
1705     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1706 {
1707     TELEPHONY_LOGI("RilCallbackTest::SendCdmaSmsResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1708         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1709     hdiId_ = HdiId::HREQ_SMS_SEND_CDMA_SMS;
1710     resultInfo_ = responseInfo;
1711     NotifyAll();
1712     return 0;
1713 }
1714 
AddSimMessageResponse(const RilRadioResponseInfo & responseInfo)1715 int32_t RilCallbackTest::AddSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1716 {
1717     TELEPHONY_LOGI("RilCallbackTest::AddSimMessageResponse error : %{public}d", responseInfo.error);
1718     hdiId_ = HdiId::HREQ_SMS_ADD_SIM_MESSAGE;
1719     resultInfo_ = responseInfo;
1720     NotifyAll();
1721     return 0;
1722 }
1723 
DelSimMessageResponse(const RilRadioResponseInfo & responseInfo)1724 int32_t RilCallbackTest::DelSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1725 {
1726     TELEPHONY_LOGI("RilCallbackTest::DelSimMessageResponse error : %{public}d", responseInfo.error);
1727     hdiId_ = HdiId::HREQ_SMS_DEL_SIM_MESSAGE;
1728     resultInfo_ = responseInfo;
1729     NotifyAll();
1730     return 0;
1731 }
1732 
UpdateSimMessageResponse(const RilRadioResponseInfo & responseInfo)1733 int32_t RilCallbackTest::UpdateSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1734 {
1735     TELEPHONY_LOGI("RilCallbackTest::UpdateSimMessageResponse error : %{public}d", responseInfo.error);
1736     hdiId_ = HdiId::HREQ_SMS_UPDATE_SIM_MESSAGE;
1737     resultInfo_ = responseInfo;
1738     NotifyAll();
1739     return 0;
1740 }
1741 
AddCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1742 int32_t RilCallbackTest::AddCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1743 {
1744     TELEPHONY_LOGI("RilCallbackTest::AddCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1745     hdiId_ = HdiId::HREQ_SMS_ADD_CDMA_SIM_MESSAGE;
1746     resultInfo_ = responseInfo;
1747     NotifyAll();
1748     return 0;
1749 }
1750 
DelCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1751 int32_t RilCallbackTest::DelCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1752 {
1753     TELEPHONY_LOGI("RilCallbackTest::DelCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1754     hdiId_ = HdiId::HREQ_SMS_DEL_CDMA_SIM_MESSAGE;
1755     resultInfo_ = responseInfo;
1756     NotifyAll();
1757     return 0;
1758 }
1759 
UpdateCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1760 int32_t RilCallbackTest::UpdateCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1761 {
1762     TELEPHONY_LOGI("RilCallbackTest::UpdateCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1763     hdiId_ = HdiId::HREQ_SMS_UPDATE_CDMA_SIM_MESSAGE;
1764     resultInfo_ = responseInfo;
1765     NotifyAll();
1766     return 0;
1767 }
1768 
SetSmscAddrResponse(const RilRadioResponseInfo & responseInfo)1769 int32_t RilCallbackTest::SetSmscAddrResponse(const RilRadioResponseInfo &responseInfo)
1770 {
1771     TELEPHONY_LOGI("RilCallbackTest::SetSmscAddrResponse error : %{public}d", responseInfo.error);
1772     hdiId_ = HdiId::HREQ_SMS_SET_SMSC_ADDR;
1773     resultInfo_ = responseInfo;
1774     NotifyAll();
1775     return 0;
1776 }
1777 
GetSmscAddrResponse(const RilRadioResponseInfo & responseInfo,const ServiceCenterAddress & serviceCenterAddress)1778 int32_t RilCallbackTest::GetSmscAddrResponse(
1779     const RilRadioResponseInfo &responseInfo, const ServiceCenterAddress &serviceCenterAddress)
1780 {
1781     TELEPHONY_LOGI("RilCallbackTest::GetSmscAddrResponse serviceCenterAddress tosca : %{public}d, address : %{public}s",
1782         serviceCenterAddress.tosca, serviceCenterAddress.address.c_str());
1783     smscAddr_ = serviceCenterAddress.address;
1784     hdiId_ = HdiId::HREQ_SMS_GET_SMSC_ADDR;
1785     resultInfo_ = responseInfo;
1786     NotifyAll();
1787     return 0;
1788 }
1789 
SetCBConfigResponse(const RilRadioResponseInfo & responseInfo)1790 int32_t RilCallbackTest::SetCBConfigResponse(const RilRadioResponseInfo &responseInfo)
1791 {
1792     TELEPHONY_LOGI("RilCallbackTest::SetCBConfigResponse error : %{public}d", responseInfo.error);
1793     hdiId_ = HdiId::HREQ_SMS_SET_CB_CONFIG;
1794     resultInfo_ = responseInfo;
1795     NotifyAll();
1796     return 0;
1797 }
1798 
GetCBConfigResponse(const RilRadioResponseInfo & responseInfo,const CBConfigInfo & cellBroadcastInfo)1799 int32_t RilCallbackTest::GetCBConfigResponse(
1800     const RilRadioResponseInfo &responseInfo, const CBConfigInfo &cellBroadcastInfo)
1801 {
1802     TELEPHONY_LOGI("RilCallbackTest::GetCBConfigResponse cellBroadcastInfo mids : %{public}s, dcss: %{public}s",
1803         cellBroadcastInfo.mids.c_str(), cellBroadcastInfo.dcss.c_str());
1804     hdiId_ = HdiId::HREQ_SMS_GET_CB_CONFIG;
1805     resultInfo_ = responseInfo;
1806     NotifyAll();
1807     return 0;
1808 }
1809 
SetCdmaCBConfigResponse(const RilRadioResponseInfo & responseInfo)1810 int32_t RilCallbackTest::SetCdmaCBConfigResponse(const RilRadioResponseInfo &responseInfo)
1811 {
1812     TELEPHONY_LOGI("RilCallbackTest::SetCdmaCBConfigResponse error : %{public}d", responseInfo.error);
1813     hdiId_ = HdiId::HREQ_SMS_SET_CDMA_CB_CONFIG;
1814     resultInfo_ = responseInfo;
1815     NotifyAll();
1816     return 0;
1817 }
1818 
GetCdmaCBConfigResponse(const RilRadioResponseInfo & responseInfo,const CdmaCBConfigInfo & cdmaCBConfigInfo)1819 int32_t RilCallbackTest::GetCdmaCBConfigResponse(
1820     const RilRadioResponseInfo &responseInfo, const CdmaCBConfigInfo &cdmaCBConfigInfo)
1821 {
1822     TELEPHONY_LOGI(
1823         "RilCallbackTest::GetCdmaCBConfigResponse cdmaCBConfigInfo service : %{public}d, language : %{public}d, "
1824         "checked: %{public}d",
1825         cdmaCBConfigInfo.service, cdmaCBConfigInfo.language, cdmaCBConfigInfo.checked);
1826     hdiId_ = HdiId::HREQ_SMS_GET_CDMA_CB_CONFIG;
1827     resultInfo_ = responseInfo;
1828     NotifyAll();
1829     return 0;
1830 }
1831 
SendSmsMoreModeResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1832 int32_t RilCallbackTest::SendSmsMoreModeResponse(
1833     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1834 {
1835     TELEPHONY_LOGI("RilCallbackTest::SendSmsMoreModeResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1836         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1837     hdiId_ = HdiId::HREQ_SMS_SEND_SMS_MORE_MODE;
1838     resultInfo_ = responseInfo;
1839     NotifyAll();
1840     return 0;
1841 }
1842 
SendSmsAckResponse(const RilRadioResponseInfo & responseInfo)1843 int32_t RilCallbackTest::SendSmsAckResponse(const RilRadioResponseInfo &responseInfo)
1844 {
1845     TELEPHONY_LOGI("RilCallbackTest::SendSmsAckResponse error:%{public}d", responseInfo.error);
1846     hdiId_ = HdiId::HREQ_SMS_SEND_SMS_ACK;
1847     resultInfo_ = responseInfo;
1848     NotifyAll();
1849     return 0;
1850 }
1851 
CommonErrorResponse(const RilRadioResponseInfo & responseInfo)1852 int32_t RilCallbackTest::CommonErrorResponse(const RilRadioResponseInfo &responseInfo)
1853 {
1854     TELEPHONY_LOGI(
1855         "RilCallbackTest::CommonErrorResponse type:%{public}d error:%{public}d", responseInfo.type, responseInfo.error);
1856     return 0;
1857 }
1858 } // namespace Telephony
1859 } // namespace OHOS
1860