• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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_0;
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 = 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_0::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_0::CardStatusInfo & result)120 int32_t RilCallbackTest::GetSimStatusResponse(
121     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_0::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 
GetSimIOResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)134 int32_t RilCallbackTest::GetSimIOResponse(const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
135 {
136     TELEPHONY_LOGI("GetBoolResult GetSimIO result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
137         result.sw1, result.sw2, result.response.c_str());
138     hdiId_ = HdiId::HREQ_SIM_GET_SIM_IO;
139     resultInfo_ = responseInfo;
140     NotifyAll();
141     return 0;
142 }
143 
GetImsiResponse(const RilRadioResponseInfo & responseInfo,const std::string & response)144 int32_t RilCallbackTest::GetImsiResponse(const RilRadioResponseInfo &responseInfo, const std::string &response)
145 {
146     TELEPHONY_LOGI("GetBoolResult GetImsi result : response = %{public}s", response.c_str());
147     hdiId_ = HdiId::HREQ_SIM_GET_IMSI;
148     resultInfo_ = responseInfo;
149     NotifyAll();
150     return 0;
151 }
152 
GetSimLockStatusResponse(const RilRadioResponseInfo & responseInfo,int32_t simLockStatus)153 int32_t RilCallbackTest::GetSimLockStatusResponse(const RilRadioResponseInfo &responseInfo, int32_t simLockStatus)
154 {
155     TELEPHONY_LOGI("GetBoolResult GetSimLockStatus result : simLockStatus = %{public}d", simLockStatus);
156     hdiId_ = HdiId::HREQ_SIM_GET_SIM_LOCK_STATUS;
157     resultInfo_ = responseInfo;
158     NotifyAll();
159     return 0;
160 }
161 
SetSimLockResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)162 int32_t RilCallbackTest::SetSimLockResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
163 {
164     TELEPHONY_LOGI("GetBoolResult SetSimLock result : result = %{public}d, remain = %{public}d", lockStatus.result,
165         lockStatus.remain);
166     hdiId_ = HdiId::HREQ_SIM_SET_SIM_LOCK;
167     resultInfo_ = responseInfo;
168     NotifyAll();
169     return 0;
170 }
171 
ChangeSimPasswordResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)172 int32_t RilCallbackTest::ChangeSimPasswordResponse(
173     const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
174 {
175     TELEPHONY_LOGI("GetBoolResult ChangeSimPassword result : result = %{public}d, remain = %{public}d",
176         lockStatus.result, lockStatus.remain);
177     hdiId_ = HdiId::HREQ_SIM_CHANGE_SIM_PASSWORD;
178     resultInfo_ = responseInfo;
179     NotifyAll();
180     return 0;
181 }
182 
UnlockPinResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)183 int32_t RilCallbackTest::UnlockPinResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
184 {
185     TELEPHONY_LOGI("GetBoolResult UnlockPin result : result = %{public}d, remain = %{public}d", lockStatus.result,
186         lockStatus.remain);
187     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PIN;
188     resultInfo_ = responseInfo;
189     NotifyAll();
190     return 0;
191 }
192 
UnlockPukResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)193 int32_t RilCallbackTest::UnlockPukResponse(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
194 {
195     TELEPHONY_LOGI("GetBoolResult UnlockPuk result : result = %{public}d, remain = %{public}d", lockStatus.result,
196         lockStatus.remain);
197     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PUK;
198     resultInfo_ = responseInfo;
199     NotifyAll();
200     return 0;
201 }
202 
UnlockPin2Response(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)203 int32_t RilCallbackTest::UnlockPin2Response(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
204 {
205     TELEPHONY_LOGI("GetBoolResult UnlockPin2 result : result = %{public}d, remain = %{public}d", lockStatus.result,
206         lockStatus.remain);
207     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PIN2;
208     resultInfo_ = responseInfo;
209     NotifyAll();
210     return 0;
211 }
212 
UnlockPuk2Response(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)213 int32_t RilCallbackTest::UnlockPuk2Response(const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
214 {
215     TELEPHONY_LOGI("GetBoolResult UnlockPuk2 result : result = %{public}d, remain = %{public}d", lockStatus.result,
216         lockStatus.remain);
217     hdiId_ = HdiId::HREQ_SIM_UNLOCK_PUK2;
218     resultInfo_ = responseInfo;
219     NotifyAll();
220     return 0;
221 }
222 
SetActiveSimResponse(const RilRadioResponseInfo & responseInfo)223 int32_t RilCallbackTest::SetActiveSimResponse(const RilRadioResponseInfo &responseInfo)
224 {
225     TELEPHONY_LOGI("GetBoolResult SetActiveSim result");
226     hdiId_ = HdiId::HREQ_SIM_SET_ACTIVE_SIM;
227     resultInfo_ = responseInfo;
228     NotifyAll();
229     return 0;
230 }
231 
SimStkSendTerminalResponseResponse(const RilRadioResponseInfo & responseInfo)232 int32_t RilCallbackTest::SimStkSendTerminalResponseResponse(const RilRadioResponseInfo &responseInfo)
233 {
234     TELEPHONY_LOGI("GetBoolResult SimStkSendTerminalResponse result");
235     hdiId_ = HdiId::HREQ_SIM_STK_SEND_TERMINAL_RESPONSE;
236     resultInfo_ = responseInfo;
237     NotifyAll();
238     return 0;
239 }
240 
SimStkSendEnvelopeResponse(const RilRadioResponseInfo & responseInfo)241 int32_t RilCallbackTest::SimStkSendEnvelopeResponse(const RilRadioResponseInfo &responseInfo)
242 {
243     TELEPHONY_LOGI("GetBoolResult SimStkSendEnvelope result");
244     hdiId_ = HdiId::HREQ_SIM_STK_SEND_ENVELOPE;
245     resultInfo_ = responseInfo;
246     NotifyAll();
247     return 0;
248 }
249 
SimStkSendCallSetupRequestResultResponse(const RilRadioResponseInfo & responseInfo)250 int32_t RilCallbackTest::SimStkSendCallSetupRequestResultResponse(const RilRadioResponseInfo &responseInfo)
251 {
252     TELEPHONY_LOGI("GetBoolResult SimStkSendCallSetupRequestResult result");
253     hdiId_ = HdiId::HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT;
254     resultInfo_ = responseInfo;
255     NotifyAll();
256     return 0;
257 }
258 
SimStkIsReadyResponse(const RilRadioResponseInfo & responseInfo)259 int32_t RilCallbackTest::SimStkIsReadyResponse(const RilRadioResponseInfo &responseInfo)
260 {
261     TELEPHONY_LOGI("GetBoolResult SimStkIsReady result");
262     hdiId_ = HdiId::HREQ_SIM_STK_IS_READY;
263     resultInfo_ = responseInfo;
264     NotifyAll();
265     return 0;
266 }
267 
SetRadioProtocolResponse(const RilRadioResponseInfo & responseInfo,const RadioProtocol & radioProtocol)268 int32_t RilCallbackTest::SetRadioProtocolResponse(
269     const RilRadioResponseInfo &responseInfo, const RadioProtocol &radioProtocol)
270 {
271     TELEPHONY_LOGI("GetBoolResult SetRadioProtocol result : phase = %{public}d, slotId = %{public}d",
272         radioProtocol.phase, radioProtocol.slotId);
273     hdiId_ = HdiId::HREQ_SIM_RADIO_PROTOCOL;
274     resultInfo_ = responseInfo;
275     NotifyAll();
276     return 0;
277 }
278 
SimOpenLogicalChannelResponse(const RilRadioResponseInfo & responseInfo,const OpenLogicalChannelResponse & pOpenLogicalChannelResponse)279 int32_t RilCallbackTest::SimOpenLogicalChannelResponse(
280     const RilRadioResponseInfo &responseInfo, const OpenLogicalChannelResponse &pOpenLogicalChannelResponse)
281 {
282     TELEPHONY_LOGI(
283         "GetBoolResult SimOpenLogicalChannel result : sw1 = %{public}d, sw2 = %{public}d, channelId = %{public}d, "
284         "response = %{public}s",
285         pOpenLogicalChannelResponse.sw1, pOpenLogicalChannelResponse.sw2, pOpenLogicalChannelResponse.channelId,
286         pOpenLogicalChannelResponse.response.c_str());
287     currentChannelId_ = pOpenLogicalChannelResponse.channelId;
288     hdiId_ = HdiId::HREQ_SIM_OPEN_LOGICAL_CHANNEL;
289     resultInfo_ = responseInfo;
290     NotifyAll();
291     return 0;
292 }
293 
SimCloseLogicalChannelResponse(const RilRadioResponseInfo & responseInfo)294 int32_t RilCallbackTest::SimCloseLogicalChannelResponse(const RilRadioResponseInfo &responseInfo)
295 {
296     TELEPHONY_LOGI("GetBoolResult SimCloseLogicalChannel result");
297     hdiId_ = HdiId::HREQ_SIM_CLOSE_LOGICAL_CHANNEL;
298     resultInfo_ = responseInfo;
299     NotifyAll();
300     return 0;
301 }
302 
SimTransmitApduLogicalChannelResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)303 int32_t RilCallbackTest::SimTransmitApduLogicalChannelResponse(
304     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
305 {
306     TELEPHONY_LOGI(
307         "GetBoolResult SimTransmitApduLogicalChannel result : sw1 = %{public}d, sw2 = %{public}d, response = "
308         "%{public}s",
309         result.sw1, result.sw2, result.response.c_str());
310     hdiId_ = HdiId::HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL;
311     resultInfo_ = responseInfo;
312     NotifyAll();
313     return 0;
314 }
315 
SimTransmitApduBasicChannelResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)316 int32_t RilCallbackTest::SimTransmitApduBasicChannelResponse(
317     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
318 {
319     TELEPHONY_LOGI(
320         "GetBoolResult SimTransmitApduBasicChannel result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
321         result.sw1, result.sw2, result.response.c_str());
322     hdiId_ = HdiId::HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL;
323     resultInfo_ = responseInfo;
324     NotifyAll();
325     return 0;
326 }
327 
SimAuthenticationResponse(const RilRadioResponseInfo & responseInfo,const IccIoResultInfo & result)328 int32_t RilCallbackTest::SimAuthenticationResponse(
329     const RilRadioResponseInfo &responseInfo, const IccIoResultInfo &result)
330 {
331     TELEPHONY_LOGI("GetBoolResult SimAuthentication result : sw1 = %{public}d, sw2 = %{public}d, response = %{public}s",
332         result.sw1, result.sw2, result.response.c_str());
333     hdiId_ = HdiId::HREQ_SIM_AUTHENTICATION;
334     resultInfo_ = responseInfo;
335     NotifyAll();
336     return 0;
337 }
338 
UnlockSimLockResponse(const RilRadioResponseInfo & responseInfo,const LockStatusResp & lockStatus)339 int32_t RilCallbackTest::UnlockSimLockResponse(
340     const RilRadioResponseInfo &responseInfo, const LockStatusResp &lockStatus)
341 {
342     TELEPHONY_LOGI("GetBoolResult UnlockSimLock result : result = %{public}d, remain = %{public}d", lockStatus.result,
343         lockStatus.remain);
344     hdiId_ = HdiId::HREQ_SIM_UNLOCK_SIM_LOCK;
345     resultInfo_ = responseInfo;
346     NotifyAll();
347     return 0;
348 }
349 
350 // Network
NetworkCsRegStatusUpdated(const RilRadioResponseInfo & responseInfo,const CsRegStatusInfo & csRegStatusInfo)351 int32_t RilCallbackTest::NetworkCsRegStatusUpdated(
352     const RilRadioResponseInfo &responseInfo, const CsRegStatusInfo &csRegStatusInfo)
353 {
354     TELEPHONY_LOGI("RilCallbackTest::NetworkCsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, "
355         "lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
356         csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId,
357         csRegStatusInfo.radioTechnology);
358     return 0;
359 }
360 
NetworkPsRegStatusUpdated(const RilRadioResponseInfo & responseInfo,const PsRegStatusInfo & psRegStatusInfo)361 int32_t RilCallbackTest::NetworkPsRegStatusUpdated(
362     const RilRadioResponseInfo &responseInfo, const PsRegStatusInfo &psRegStatusInfo)
363 {
364     TELEPHONY_LOGI(
365         "RilCallbackTest::NetworkPsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, "
366         "cellId:%{public}d, tech:%{public}d, nrRestricted:%{public}d, nrAvailable:%{public}d, enDcAvailable:%{public}d",
367         psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId,
368         psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable,
369         psRegStatusInfo.isEnDcAvailable);
370     return 0;
371 }
372 
SignalStrengthUpdated(const RilRadioResponseInfo & responseInfo,const Rssi & rssi)373 int32_t RilCallbackTest::SignalStrengthUpdated(const RilRadioResponseInfo &responseInfo, const Rssi &rssi)
374 {
375     TELEPHONY_LOGI(
376         "RilCallbackTest::SignalStrengthUpdated rxlev:%{public}d rsrp:%{public}d", rssi.lte.rxlev, rssi.lte.rsrp);
377     return 0;
378 }
379 
NetworkTimeZoneUpdated(const RilRadioResponseInfo & responseInfo,const std::string & timeZoneStr)380 int32_t RilCallbackTest::NetworkTimeZoneUpdated(
381     const RilRadioResponseInfo &responseInfo, const std::string &timeZoneStr)
382 {
383     TELEPHONY_LOGI("RilCallbackTest::NetworkTimeZoneUpdated timeZone:%{public}s", timeZoneStr.c_str());
384     return 0;
385 }
386 
NetworkTimeUpdated(const RilRadioResponseInfo & responseInfo,const std::string & timeStr)387 int32_t RilCallbackTest::NetworkTimeUpdated(const RilRadioResponseInfo &responseInfo, const std::string &timeStr)
388 {
389     TELEPHONY_LOGI("RilCallbackTest::NetworkTimeZoneUpdated time:%{public}s", timeStr.c_str());
390     return 0;
391 }
392 
NetworkPhyChnlCfgUpdated(const RilRadioResponseInfo & responseInfo,const ChannelConfigInfoList & channelConfigInfoList)393 int32_t RilCallbackTest::NetworkPhyChnlCfgUpdated(
394     const RilRadioResponseInfo &responseInfo, const ChannelConfigInfoList &channelConfigInfoList)
395 {
396     TELEPHONY_LOGI("RilCallbackTest::NetworkPhyChnlCfgUpdated itemNum:%{public}d", channelConfigInfoList.itemNum);
397     for (PhysicalChannelConfig phyChnlCfg : channelConfigInfoList.channelConfigInfos) {
398         TELEPHONY_LOGI(
399             "RilCallbackTest::NetworkPhyChnlCfgUpdated cellConnStatus:%{public}d, "
400             "cellBandwidthDownlinkKhz:%{public}d, cellBandwidthUplinkKhz:%{public}d, physicalCellId:%{public}d, "
401             "ratType:%{public}d, freqRange:%{public}d, downlinkChannelNum:%{public}d, "
402             "uplinkChannelNum:%{public}d, contextIdNum:%{public}d",
403             phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz,
404             phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum,
405             phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum);
406         for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) {
407             TELEPHONY_LOGI("contextIds[%{public}d]:%{public}d", j, phyChnlCfg.contextIds[j]);
408         }
409     }
410     return 0;
411 }
412 
NetworkCurrentCellUpdated(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo & cellListCurrentInfo)413 int32_t RilCallbackTest::NetworkCurrentCellUpdated(
414     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo &cellListCurrentInfo)
415 {
416     TELEPHONY_LOGI("RilCallbackTest::NetworkCurrentCellUpdated itemNum:%{public}d", cellListCurrentInfo.itemNum);
417     for (auto info : cellListCurrentInfo.cellCurrentInfo) {
418         TELEPHONY_LOGI("RilCallbackTest::NetworkCurrentCellUpdated ratType:%{public}d, mcc:%{public}d, mnc:%{public}d",
419             info.ratType, info.mcc, info.mnc);
420         switch (static_cast<RatType>(info.ratType)) {
421             case RatType::NETWORK_TYPE_LTE:
422                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
423                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
424                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
425                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
426                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
427                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
428                 break;
429             case RatType::NETWORK_TYPE_GSM:
430                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
431                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
432                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
433                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
434                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
435                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
436                 break;
437             case RatType::NETWORK_TYPE_WCDMA:
438                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
439                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
440                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
441                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
442                 break;
443             case RatType::NETWORK_TYPE_NR:
444                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
445                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
446                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
447                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
448                 break;
449             default:
450                 TELEPHONY_LOGE("RilCallbackTest::NetworkCurrentCellUpdated invalid ratType");
451         }
452     }
453     return 0;
454 }
455 
GetSignalStrengthResponse(const RilRadioResponseInfo & responseInfo,const Rssi & rssi)456 int32_t RilCallbackTest::GetSignalStrengthResponse(const RilRadioResponseInfo &responseInfo, const Rssi &rssi)
457 {
458     TELEPHONY_LOGI(
459         "RilCallbackTest::GetSignalStrengthResponse rxlev:%{public}d rsrp:%{public}d", rssi.lte.rxlev, rssi.lte.rsrp);
460     hdiId_ = HdiId::HREQ_NETWORK_GET_SIGNAL_STRENGTH;
461     resultInfo_ = responseInfo;
462     NotifyAll();
463     return 0;
464 }
465 
GetCsRegStatusResponse(const RilRadioResponseInfo & responseInfo,const CsRegStatusInfo & csRegStatusInfo)466 int32_t RilCallbackTest::GetCsRegStatusResponse(
467     const RilRadioResponseInfo &responseInfo, const CsRegStatusInfo &csRegStatusInfo)
468 {
469     TELEPHONY_LOGI("RilCallbackTest::GetCsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, "
470                    "lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
471         csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId,
472         csRegStatusInfo.radioTechnology);
473     hdiId_ = HdiId::HREQ_NETWORK_GET_CS_REG_STATUS;
474     resultInfo_ = responseInfo;
475     NotifyAll();
476     return 0;
477 }
478 
GetPsRegStatusResponse(const RilRadioResponseInfo & responseInfo,const PsRegStatusInfo & psRegStatusInfo)479 int32_t RilCallbackTest::GetPsRegStatusResponse(
480     const RilRadioResponseInfo &responseInfo, const PsRegStatusInfo &psRegStatusInfo)
481 {
482     TELEPHONY_LOGI(
483         "RilCallbackTest::GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, "
484         "cellId:%{public}d, tech:%{public}d, nrRestricted:%{public}d, nrAvailable:%{public}d, enDcAvailable:%{public}d",
485         psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId,
486         psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable,
487         psRegStatusInfo.isEnDcAvailable);
488     hdiId_ = HdiId::HREQ_NETWORK_GET_PS_REG_STATUS;
489     resultInfo_ = responseInfo;
490     NotifyAll();
491     return 0;
492 }
493 
GetOperatorInfoResponse(const RilRadioResponseInfo & responseInfo,const OperatorInfo & operatorInfo)494 int32_t RilCallbackTest::GetOperatorInfoResponse(
495     const RilRadioResponseInfo &responseInfo, const OperatorInfo &operatorInfo)
496 {
497     TELEPHONY_LOGI(
498         "RilCallbackTest::GetOperatorInfoResponse longName:%{public}s, shortName:%{public}s, numeric:%{public}s",
499         operatorInfo.longName.c_str(), operatorInfo.shortName.c_str(), operatorInfo.numeric.c_str());
500     hdiId_ = HdiId::HREQ_NETWORK_GET_OPERATOR_INFO;
501     resultInfo_ = responseInfo;
502     NotifyAll();
503     return 0;
504 }
505 
GetNetworkSearchInformationResponse(const RilRadioResponseInfo & responseInfo,const AvailableNetworkList & availableNetworkList)506 int32_t RilCallbackTest::GetNetworkSearchInformationResponse(
507     const RilRadioResponseInfo &responseInfo, const AvailableNetworkList &availableNetworkList)
508 {
509     TELEPHONY_LOGI(
510         "RilCallbackTest::GetNetworkSearchInformationResponse itemNum:%{public}d", availableNetworkList.itemNum);
511     for (auto availableInfo : availableNetworkList.availableNetworkInfo) {
512         TELEPHONY_LOGI("status:%{public}d", availableInfo.status);
513         TELEPHONY_LOGI("numeric:%{public}s", availableInfo.numeric.c_str());
514         TELEPHONY_LOGI("shortName:%{public}s", availableInfo.shortName.c_str());
515         TELEPHONY_LOGI("longName:%{public}s", availableInfo.longName.c_str());
516         TELEPHONY_LOGI("rat:%{public}d", availableInfo.rat);
517     }
518     hdiId_ = HdiId::HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION;
519     resultInfo_ = responseInfo;
520     NotifyAll();
521     return 0;
522 }
523 
GetNetworkSelectionModeResponse(const RilRadioResponseInfo & responseInfo,const SetNetworkModeInfo & setNetworkModeInfo)524 int32_t RilCallbackTest::GetNetworkSelectionModeResponse(
525     const RilRadioResponseInfo &responseInfo, const SetNetworkModeInfo &setNetworkModeInfo)
526 {
527     TELEPHONY_LOGI(
528         "RilCallbackTest::GetNetworkSelectionModeResponse selectMode:%{public}d", setNetworkModeInfo.selectMode);
529     hdiId_ = HdiId::HREQ_NETWORK_GET_NETWORK_SELECTION_MODE;
530     resultInfo_ = responseInfo;
531     NotifyAll();
532     return 0;
533 }
534 
SetNetworkSelectionModeResponse(const RilRadioResponseInfo & responseInfo)535 int32_t RilCallbackTest::SetNetworkSelectionModeResponse(const RilRadioResponseInfo &responseInfo)
536 {
537     TELEPHONY_LOGI("RilCallbackTest::SetNetworkSelectionModeResponse error:%{public}d", responseInfo.error);
538     hdiId_ = HdiId::HREQ_NETWORK_SET_NETWORK_SELECTION_MODE;
539     resultInfo_ = responseInfo;
540     NotifyAll();
541     return 0;
542 }
543 
GetNeighboringCellInfoListResponse(const RilRadioResponseInfo & responseInfo,const CellListNearbyInfo & cellInfoList)544 int32_t RilCallbackTest::GetNeighboringCellInfoListResponse(
545     const RilRadioResponseInfo &responseInfo, const CellListNearbyInfo &cellInfoList)
546 {
547     TELEPHONY_LOGI("RilCallbackTest::GetNeighboringCellInfoListResponse itemNum:%{public}d", cellInfoList.itemNum);
548     for (auto info : cellInfoList.cellNearbyInfo) {
549         TELEPHONY_LOGI("RilCallbackTest::GetNeighboringCellInfoListResponse ratType:%{public}d", info.ratType);
550         switch (static_cast<RatType>(info.ratType)) {
551             case RatType::NETWORK_TYPE_LTE:
552                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
553                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
554                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
555                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
556                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rxlev);
557                 break;
558             case RatType::NETWORK_TYPE_GSM:
559                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
560                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
561                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
562                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
563                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
564                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
565                 break;
566             case RatType::NETWORK_TYPE_WCDMA:
567                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
568                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
569                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
570                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
571                 break;
572             case RatType::NETWORK_TYPE_NR:
573                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
574                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
575                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
576                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
577                 break;
578             default:
579                 TELEPHONY_LOGE("RilCallbackTest::GetNeighboringCellInfoListResponse invalid ratType");
580         }
581     }
582     hdiId_ = HdiId::HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST;
583     resultInfo_ = responseInfo;
584     NotifyAll();
585     return 0;
586 }
587 
GetCurrentCellInfoResponse(const RilRadioResponseInfo & responseInfo,const CellListCurrentInfo & cellInfoList)588 int32_t RilCallbackTest::GetCurrentCellInfoResponse(
589     const RilRadioResponseInfo &responseInfo, const CellListCurrentInfo &cellInfoList)
590 {
591     TELEPHONY_LOGI("RilCallbackTest::GetCurrentCellInfoResponse itemNum:%{public}d", cellInfoList.itemNum);
592     for (auto info : cellInfoList.cellCurrentInfo) {
593         TELEPHONY_LOGI("RilCallbackTest::GetCurrentCellInfoResponse ratType:%{public}d, mcc:%{public}d, mnc:%{public}d",
594             info.ratType, info.mcc, info.mnc);
595         switch (static_cast<RatType>(info.ratType)) {
596             case RatType::NETWORK_TYPE_LTE:
597                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.lte.cellId);
598                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.lte.arfcn);
599                 TELEPHONY_LOGI("pci:%{public}d", info.serviceCells.lte.pci);
600                 TELEPHONY_LOGI("rsrp:%{public}d", info.serviceCells.lte.rsrp);
601                 TELEPHONY_LOGI("rsrq:%{public}d", info.serviceCells.lte.rsrq);
602                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.lte.rssi);
603                 break;
604             case RatType::NETWORK_TYPE_GSM:
605                 TELEPHONY_LOGI("band:%{public}d", info.serviceCells.gsm.band);
606                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.gsm.arfcn);
607                 TELEPHONY_LOGI("bsic:%{public}d", info.serviceCells.gsm.bsic);
608                 TELEPHONY_LOGI("cellId:%{public}d", info.serviceCells.gsm.cellId);
609                 TELEPHONY_LOGI("rxlev:%{public}d", info.serviceCells.gsm.rxlev);
610                 TELEPHONY_LOGI("lac:%{public}d", info.serviceCells.gsm.lac);
611                 break;
612             case RatType::NETWORK_TYPE_WCDMA:
613                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.wcdma.arfcn);
614                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.wcdma.psc);
615                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.wcdma.rscp);
616                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.wcdma.ecno);
617                 break;
618             case RatType::NETWORK_TYPE_NR:
619                 TELEPHONY_LOGI("arfcn:%{public}d", info.serviceCells.nr.nrArfcn);
620                 TELEPHONY_LOGI("psc:%{public}d", info.serviceCells.nr.pci);
621                 TELEPHONY_LOGI("rscp:%{public}d", info.serviceCells.nr.tac);
622                 TELEPHONY_LOGI("ecno:%{public}d", info.serviceCells.nr.nci);
623                 break;
624             default:
625                 TELEPHONY_LOGE("RilCallbackTest::GetCurrentCellInfoResponse invalid ratType");
626         }
627     }
628     hdiId_ = HdiId::HREQ_NETWORK_GET_CURRENT_CELL_INFO;
629     resultInfo_ = responseInfo;
630     NotifyAll();
631     return 0;
632 }
633 
SetPreferredNetworkResponse(const RilRadioResponseInfo & responseInfo)634 int32_t RilCallbackTest::SetPreferredNetworkResponse(const RilRadioResponseInfo &responseInfo)
635 {
636     TELEPHONY_LOGI("RilCallbackTest::SetPreferredNetworkResponse error:%{public}d", responseInfo.error);
637     hdiId_ = HdiId::HREQ_NETWORK_SET_PREFERRED_NETWORK;
638     resultInfo_ = responseInfo;
639     NotifyAll();
640     return 0;
641 }
642 
GetPreferredNetworkResponse(const RilRadioResponseInfo & responseInfo,const PreferredNetworkTypeInfo & preferredNetworkTypeInfo)643 int32_t RilCallbackTest::GetPreferredNetworkResponse(
644     const RilRadioResponseInfo &responseInfo, const PreferredNetworkTypeInfo &preferredNetworkTypeInfo)
645 {
646     TELEPHONY_LOGI(
647         "RilCallbackTest::GetPreferredNetworkResponse type:%{public}d", preferredNetworkTypeInfo.preferredNetworkType);
648     hdiId_ = HdiId::HREQ_NETWORK_GET_PREFERRED_NETWORK;
649     resultInfo_ = responseInfo;
650     NotifyAll();
651     return 0;
652 }
653 
GetPhysicalChannelConfigResponse(const RilRadioResponseInfo & responseInfo,const ChannelConfigInfoList & channelConfigInfoList)654 int32_t RilCallbackTest::GetPhysicalChannelConfigResponse(
655     const RilRadioResponseInfo &responseInfo, const ChannelConfigInfoList &channelConfigInfoList)
656 {
657     TELEPHONY_LOGI(
658         "RilCallbackTest::GetPhysicalChannelConfigResponse itemNum:%{public}d", channelConfigInfoList.itemNum);
659     for (PhysicalChannelConfig phyChnlCfg : channelConfigInfoList.channelConfigInfos) {
660         TELEPHONY_LOGI(
661             "RilCallbackTest::GetPhysicalChannelConfigResponse cellConnStatus:%{public}d, "
662             "cellBandwidthDownlinkKhz:%{public}d, cellBandwidthUplinkKhz:%{public}d, physicalCellId:%{public}d, "
663             "ratType:%{public}d, freqRange:%{public}d, downlinkChannelNum:%{public}d, "
664             "uplinkChannelNum:%{public}d, contextIdNum:%{public}d",
665             phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz,
666             phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum,
667             phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum);
668         for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) {
669             TELEPHONY_LOGI("contextIds[%{public}d]:%{public}d", j, phyChnlCfg.contextIds[j]);
670         }
671     }
672     hdiId_ = HdiId::HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG;
673     resultInfo_ = responseInfo;
674     NotifyAll();
675     return 0;
676 }
677 
SetLocateUpdatesResponse(const RilRadioResponseInfo & responseInfo)678 int32_t RilCallbackTest::SetLocateUpdatesResponse(const RilRadioResponseInfo &responseInfo)
679 {
680     TELEPHONY_LOGI("RilCallbackTest::SetLocateUpdatesResponse error:%{public}d", responseInfo.error);
681     hdiId_ = HdiId::HREQ_NETWORK_SET_LOCATE_UPDATES;
682     resultInfo_ = responseInfo;
683     NotifyAll();
684     return 0;
685 }
686 
SetNotificationFilterResponse(const RilRadioResponseInfo & responseInfo)687 int32_t RilCallbackTest::SetNotificationFilterResponse(const RilRadioResponseInfo &responseInfo)
688 {
689     TELEPHONY_LOGI("RilCallbackTest::SetNotificationFilterResponse error:%{public}d", responseInfo.error);
690     hdiId_ = HdiId::HREQ_NETWORK_SET_NOTIFICATION_FILTER;
691     resultInfo_ = responseInfo;
692     NotifyAll();
693     return 0;
694 }
695 
SetDeviceStateResponse(const RilRadioResponseInfo & responseInfo)696 int32_t RilCallbackTest::SetDeviceStateResponse(const RilRadioResponseInfo &responseInfo)
697 {
698     TELEPHONY_LOGI("RilCallbackTest::SetDeviceStateResponse error:%{public}d", responseInfo.error);
699     hdiId_ = HdiId::HREQ_NETWORK_SET_DEVICE_STATE;
700     resultInfo_ = responseInfo;
701     NotifyAll();
702     return 0;
703 }
704 
705 // Call
CallEmergencyNotice(const RilRadioResponseInfo & responseInfo,const EmergencyInfoList & emergencyInfoList)706 int32_t RilCallbackTest::CallEmergencyNotice(
707     const RilRadioResponseInfo &responseInfo, const EmergencyInfoList &emergencyInfoList)
708 {
709     TELEPHONY_LOGI("GetBoolResult CallEmergencyNotice callSize : %{public}d", emergencyInfoList.callSize);
710     return 0;
711 }
712 
CallStateUpdated(const RilRadioResponseInfo & responseInfo)713 int32_t RilCallbackTest::CallStateUpdated(const RilRadioResponseInfo &responseInfo)
714 {
715     TELEPHONY_LOGI(
716         "GetBoolResult CallStateUpdated slotId : %{public}d, type: %{public}d", responseInfo.slotId, responseInfo.type);
717     return 0;
718 }
719 
CallRingbackVoiceNotice(const RilRadioResponseInfo & responseInfo,const RingbackVoice & ringbackVoice)720 int32_t RilCallbackTest::CallRingbackVoiceNotice(
721     const RilRadioResponseInfo &responseInfo, const RingbackVoice &ringbackVoice)
722 {
723     TELEPHONY_LOGI("GetBoolResult CallRingbackVoiceNotice slotId : %{public}d, ringbackVoice: %{public}d",
724         responseInfo.slotId, ringbackVoice.status);
725     return 0;
726 }
727 
CallSrvccStatusNotice(const RilRadioResponseInfo & responseInfo,const SrvccStatus & srvccStatus)728 int32_t RilCallbackTest::CallSrvccStatusNotice(const RilRadioResponseInfo &responseInfo, const SrvccStatus &srvccStatus)
729 {
730     TELEPHONY_LOGI("GetBoolResult CallSrvccStatusNotice slotId : %{public}d, srvccStatus: %{public}d",
731         responseInfo.slotId, srvccStatus.status);
732     return 0;
733 }
734 
CallUssdNotice(const RilRadioResponseInfo & responseInfo,const UssdNoticeInfo & ussdNoticeInfo)735 int32_t RilCallbackTest::CallUssdNotice(const RilRadioResponseInfo &responseInfo, const UssdNoticeInfo &ussdNoticeInfo)
736 {
737     TELEPHONY_LOGI("GetBoolResult CallUssdNotice slotId : %{public}d, ussdNoticeInfo m: %{public}d, str: %{public}s",
738         responseInfo.slotId, ussdNoticeInfo.type, ussdNoticeInfo.message.c_str());
739     return 0;
740 }
741 
CallSsNotice(const RilRadioResponseInfo & responseInfo,const SsNoticeInfo & ssNoticeInfo)742 int32_t RilCallbackTest::CallSsNotice(const RilRadioResponseInfo &responseInfo, const SsNoticeInfo &ssNoticeInfo)
743 {
744     TELEPHONY_LOGI("GetBoolResult CallSsNotice slotId : %{public}d, result: %{public}d, serviceType: %{public}d,"
745                    "requestType: %{public}d, serviceClass: %{public}d",
746         responseInfo.slotId, ssNoticeInfo.result, ssNoticeInfo.serviceType, ssNoticeInfo.requestType,
747         ssNoticeInfo.serviceClass);
748     return 0;
749 }
750 
CallRsrvccStatusNotify(const RilRadioResponseInfo & responseInfo)751 int32_t RilCallbackTest::CallRsrvccStatusNotify(const RilRadioResponseInfo &responseInfo)
752 {
753     TELEPHONY_LOGI(
754         "CallRsrvccStatusNotify slotId : %{public}d, type: %{public}d", responseInfo.slotId, responseInfo.type);
755     return 0;
756 }
757 
GetEmergencyCallListResponse(const RilRadioResponseInfo & responseInfo,const EmergencyInfoList & emergencyInfoList)758 int32_t RilCallbackTest::GetEmergencyCallListResponse(
759     const RilRadioResponseInfo &responseInfo, const EmergencyInfoList &emergencyInfoList)
760 {
761     TELEPHONY_LOGI("GetBoolResult emergencyInfoList callSize : %{public}d", emergencyInfoList.callSize);
762     hdiId_ = HdiId::HREQ_CALL_GET_EMERGENCY_LIST;
763     resultInfo_ = responseInfo;
764     NotifyAll();
765     return 0;
766 }
767 
SetEmergencyCallListResponse(const RilRadioResponseInfo & responseInfo)768 int32_t RilCallbackTest::SetEmergencyCallListResponse(const RilRadioResponseInfo &responseInfo)
769 {
770     TELEPHONY_LOGI("GetBoolResult SetEmergencyCallListResponse");
771     hdiId_ = HdiId::HREQ_CALL_SET_EMERGENCY_LIST;
772     resultInfo_ = responseInfo;
773     NotifyAll();
774     return 0;
775 }
776 
GetCallListResponse(const RilRadioResponseInfo & responseInfo,const CallInfoList & callList)777 int32_t RilCallbackTest::GetCallListResponse(const RilRadioResponseInfo &responseInfo, const CallInfoList &callList)
778 {
779     TELEPHONY_LOGI("GetBoolResult CallInfoList callSize : %{public}d", callList.callSize);
780     hdiId_ = HdiId::HREQ_CALL_GET_CALL_LIST;
781     resultInfo_ = responseInfo;
782     NotifyAll();
783     return 0;
784 }
785 
DialResponse(const RilRadioResponseInfo & responseInfo)786 int32_t RilCallbackTest::DialResponse(const RilRadioResponseInfo &responseInfo)
787 {
788     TELEPHONY_LOGI("GetBoolResult DialResponse");
789     hdiId_ = HdiId::HREQ_CALL_DIAL;
790     resultInfo_ = responseInfo;
791     NotifyAll();
792     return 0;
793 }
794 
HangupResponse(const RilRadioResponseInfo & responseInfo)795 int32_t RilCallbackTest::HangupResponse(const RilRadioResponseInfo &responseInfo)
796 {
797     TELEPHONY_LOGI("GetBoolResult HangupResponse");
798     hdiId_ = HdiId::HREQ_CALL_HANGUP;
799     resultInfo_ = responseInfo;
800     NotifyAll();
801     return 0;
802 }
803 
RejectResponse(const RilRadioResponseInfo & responseInfo)804 int32_t RilCallbackTest::RejectResponse(const RilRadioResponseInfo &responseInfo)
805 {
806     TELEPHONY_LOGI("GetBoolResult RejectResponse");
807     hdiId_ = HdiId::HREQ_CALL_REJECT;
808     resultInfo_ = responseInfo;
809     NotifyAll();
810     return 0;
811 }
812 
AnswerResponse(const RilRadioResponseInfo & responseInfo)813 int32_t RilCallbackTest::AnswerResponse(const RilRadioResponseInfo &responseInfo)
814 {
815     TELEPHONY_LOGI("GetBoolResult AnswerResponse");
816     hdiId_ = HdiId::HREQ_CALL_ANSWER;
817     resultInfo_ = responseInfo;
818     NotifyAll();
819     return 0;
820 }
821 
HoldCallResponse(const RilRadioResponseInfo & responseInfo)822 int32_t RilCallbackTest::HoldCallResponse(const RilRadioResponseInfo &responseInfo)
823 {
824     TELEPHONY_LOGI("GetBoolResult HoldCallResponse");
825     hdiId_ = HdiId::HREQ_CALL_HOLD_CALL;
826     resultInfo_ = responseInfo;
827     NotifyAll();
828     return 0;
829 }
830 
UnHoldCallResponse(const RilRadioResponseInfo & responseInfo)831 int32_t RilCallbackTest::UnHoldCallResponse(const RilRadioResponseInfo &responseInfo)
832 {
833     TELEPHONY_LOGI("GetBoolResult UnHoldCallResponse");
834     hdiId_ = HdiId::HREQ_CALL_UNHOLD_CALL;
835     resultInfo_ = responseInfo;
836     NotifyAll();
837     return 0;
838 }
839 
SwitchCallResponse(const RilRadioResponseInfo & responseInfo)840 int32_t RilCallbackTest::SwitchCallResponse(const RilRadioResponseInfo &responseInfo)
841 {
842     TELEPHONY_LOGI("GetBoolResult SwitchCallResponse");
843     hdiId_ = HdiId::HREQ_CALL_SWITCH_CALL;
844     resultInfo_ = responseInfo;
845     NotifyAll();
846     return 0;
847 }
848 
GetClipResponse(const RilRadioResponseInfo & responseInfo,const GetClipResult & getClipResult)849 int32_t RilCallbackTest::GetClipResponse(const RilRadioResponseInfo &responseInfo, const GetClipResult &getClipResult)
850 {
851     TELEPHONY_LOGI("GetBoolResult result: %{public}d, action: %{public}d, clipStat: %{public}d", getClipResult.result,
852         getClipResult.action, getClipResult.clipStat);
853     hdiId_ = HdiId::HREQ_CALL_GET_CLIP;
854     resultInfo_ = responseInfo;
855     NotifyAll();
856     return 0;
857 }
858 
SetClipResponse(const RilRadioResponseInfo & responseInfo)859 int32_t RilCallbackTest::SetClipResponse(const RilRadioResponseInfo &responseInfo)
860 {
861     TELEPHONY_LOGI("GetBoolResult SetClipResponse");
862     hdiId_ = HdiId::HREQ_CALL_SET_CLIP;
863     resultInfo_ = responseInfo;
864     NotifyAll();
865     return 0;
866 }
867 
CombineConferenceResponse(const RilRadioResponseInfo & responseInfo)868 int32_t RilCallbackTest::CombineConferenceResponse(const RilRadioResponseInfo &responseInfo)
869 {
870     TELEPHONY_LOGI("GetBoolResult CombineConferenceResponse");
871     hdiId_ = HdiId::HREQ_CALL_COMBINE_CONFERENCE;
872     resultInfo_ = responseInfo;
873     NotifyAll();
874     return 0;
875 }
876 
SeparateConferenceResponse(const RilRadioResponseInfo & responseInfo)877 int32_t RilCallbackTest::SeparateConferenceResponse(const RilRadioResponseInfo &responseInfo)
878 {
879     TELEPHONY_LOGI("GetBoolResult SeparateConferenceResponse");
880     hdiId_ = HdiId::HREQ_CALL_SEPARATE_CONFERENCE;
881     resultInfo_ = responseInfo;
882     NotifyAll();
883     return 0;
884 }
885 
CallSupplementResponse(const RilRadioResponseInfo & responseInfo)886 int32_t RilCallbackTest::CallSupplementResponse(const RilRadioResponseInfo &responseInfo)
887 {
888     TELEPHONY_LOGI("GetBoolResult CallSupplementResponse");
889     hdiId_ = HdiId::HREQ_CALL_CALL_SUPPLEMENT;
890     resultInfo_ = responseInfo;
891     NotifyAll();
892     return 0;
893 }
894 
GetCallWaitingResponse(const RilRadioResponseInfo & responseInfo,const CallWaitResult & callWaitResult)895 int32_t RilCallbackTest::GetCallWaitingResponse(
896     const RilRadioResponseInfo &responseInfo, const CallWaitResult &callWaitResult)
897 {
898     TELEPHONY_LOGI("GetBoolResult GetCallWaitingResponse result: %{public}d, status: %{public}d, classCw: %{public}d",
899         callWaitResult.result, callWaitResult.status, callWaitResult.classCw);
900     hdiId_ = HdiId::HREQ_CALL_GET_CALL_WAITING;
901     resultInfo_ = responseInfo;
902     NotifyAll();
903     return 0;
904 }
905 
SetCallWaitingResponse(const RilRadioResponseInfo & responseInfo)906 int32_t RilCallbackTest::SetCallWaitingResponse(const RilRadioResponseInfo &responseInfo)
907 {
908     TELEPHONY_LOGI("GetBoolResult SetCallWaitingResponse");
909     hdiId_ = HdiId::HREQ_CALL_SET_CALL_WAITING;
910     resultInfo_ = responseInfo;
911     NotifyAll();
912     return 0;
913 }
914 
GetCallTransferInfoResponse(const RilRadioResponseInfo & responseInfo,const CallForwardQueryInfoList & cFQueryList)915 int32_t RilCallbackTest::GetCallTransferInfoResponse(
916     const RilRadioResponseInfo &responseInfo, const CallForwardQueryInfoList &cFQueryList)
917 {
918     TELEPHONY_LOGI("GetBoolResult GetCallTransferInfoResponse cFQueryList: %{public}d", cFQueryList.callSize);
919     hdiId_ = HdiId::HREQ_CALL_GET_CALL_TRANSFER_INFO;
920     resultInfo_ = responseInfo;
921     NotifyAll();
922     return 0;
923 }
924 
SetCallTransferInfoResponse(const RilRadioResponseInfo & responseInfo)925 int32_t RilCallbackTest::SetCallTransferInfoResponse(const RilRadioResponseInfo &responseInfo)
926 {
927     TELEPHONY_LOGI("GetBoolResult SetCallTransferInfoResponse");
928     hdiId_ = HdiId::HREQ_CALL_SET_CALL_TRANSFER_INFO;
929     resultInfo_ = responseInfo;
930     NotifyAll();
931     return 0;
932 }
933 
GetCallRestrictionResponse(const RilRadioResponseInfo & responseInfo,const CallRestrictionResult & result)934 int32_t RilCallbackTest::GetCallRestrictionResponse(
935     const RilRadioResponseInfo &responseInfo, const CallRestrictionResult &result)
936 {
937     TELEPHONY_LOGI("GetBoolResult result: %{public}d, status: %{public}d, classCw: %{public}d", result.result,
938         result.status, result.classCw);
939     hdiId_ = HdiId::HREQ_CALL_GET_CALL_RESTRICTION;
940     resultInfo_ = responseInfo;
941     NotifyAll();
942     return 0;
943 }
944 
SetCallRestrictionResponse(const RilRadioResponseInfo & responseInfo)945 int32_t RilCallbackTest::SetCallRestrictionResponse(const RilRadioResponseInfo &responseInfo)
946 {
947     TELEPHONY_LOGI("GetBoolResult SetCallRestrictionResponse");
948     hdiId_ = HdiId::HREQ_CALL_SET_CALL_RESTRICTION;
949     resultInfo_ = responseInfo;
950     NotifyAll();
951     return 0;
952 }
953 
GetClirResponse(const RilRadioResponseInfo & responseInfo,const GetClirResult & getClirResult)954 int32_t RilCallbackTest::GetClirResponse(const RilRadioResponseInfo &responseInfo, const GetClirResult &getClirResult)
955 {
956     TELEPHONY_LOGI("GetBoolResult result: %{public}d, action: %{public}d, clirStat: %{public}d", getClirResult.result,
957         getClirResult.action, getClirResult.clirStat);
958     hdiId_ = HdiId::HREQ_CALL_GET_CLIR;
959     resultInfo_ = responseInfo;
960     NotifyAll();
961     return 0;
962 }
963 
SetClirResponse(const RilRadioResponseInfo & responseInfo)964 int32_t RilCallbackTest::SetClirResponse(const RilRadioResponseInfo &responseInfo)
965 {
966     TELEPHONY_LOGI("GetBoolResult SetClirResponse");
967     hdiId_ = HdiId::HREQ_CALL_SET_CLIR;
968     resultInfo_ = responseInfo;
969     NotifyAll();
970     return 0;
971 }
972 
StartDtmfResponse(const RilRadioResponseInfo & responseInfo)973 int32_t RilCallbackTest::StartDtmfResponse(const RilRadioResponseInfo &responseInfo)
974 {
975     TELEPHONY_LOGI("GetBoolResult StartDtmfResponse");
976     hdiId_ = HdiId::HREQ_CALL_START_DTMF;
977     resultInfo_ = responseInfo;
978     NotifyAll();
979     return 0;
980 }
981 
SendDtmfResponse(const RilRadioResponseInfo & responseInfo)982 int32_t RilCallbackTest::SendDtmfResponse(const RilRadioResponseInfo &responseInfo)
983 {
984     TELEPHONY_LOGI("GetBoolResult SendDtmfResponse");
985     hdiId_ = HdiId::HREQ_CALL_SEND_DTMF;
986     resultInfo_ = responseInfo;
987     NotifyAll();
988     return 0;
989 }
990 
StopDtmfResponse(const RilRadioResponseInfo & responseInfo)991 int32_t RilCallbackTest::StopDtmfResponse(const RilRadioResponseInfo &responseInfo)
992 {
993     TELEPHONY_LOGI("GetBoolResult StopDtmfResponse");
994     hdiId_ = HdiId::HREQ_CALL_STOP_DTMF;
995     resultInfo_ = responseInfo;
996     NotifyAll();
997     return 0;
998 }
999 
GetCallPreferenceModeResponse(const RilRadioResponseInfo & responseInfo,int32_t mode)1000 int32_t RilCallbackTest::GetCallPreferenceModeResponse(const RilRadioResponseInfo &responseInfo, int32_t mode)
1001 {
1002     TELEPHONY_LOGI("GetBoolResult GetCallPreferenceModeResponse mode: %{public}d", mode);
1003     hdiId_ = HdiId::HREQ_CALL_GET_CALL_PREFERENCE;
1004     resultInfo_ = responseInfo;
1005     NotifyAll();
1006     return 0;
1007 }
1008 
SetCallPreferenceModeResponse(const RilRadioResponseInfo & responseInfo)1009 int32_t RilCallbackTest::SetCallPreferenceModeResponse(const RilRadioResponseInfo &responseInfo)
1010 {
1011     TELEPHONY_LOGI("GetBoolResult SetCallPreferenceModeResponse");
1012     hdiId_ = HdiId::HREQ_CALL_SET_CALL_PREFERENCE;
1013     resultInfo_ = responseInfo;
1014     NotifyAll();
1015     return 0;
1016 }
1017 
SetUssdResponse(const RilRadioResponseInfo & responseInfo)1018 int32_t RilCallbackTest::SetUssdResponse(const RilRadioResponseInfo &responseInfo)
1019 {
1020     TELEPHONY_LOGI("GetBoolResult SetUssdResponse");
1021     hdiId_ = HdiId::HREQ_CALL_SET_USSD;
1022     resultInfo_ = responseInfo;
1023     NotifyAll();
1024     return 0;
1025 }
1026 
GetUssdResponse(const RilRadioResponseInfo & responseInfo,int32_t cusd)1027 int32_t RilCallbackTest::GetUssdResponse(const RilRadioResponseInfo &responseInfo, int32_t cusd)
1028 {
1029     TELEPHONY_LOGI("GetBoolResult GetUssdResponse cusd: %{public}d", cusd);
1030     hdiId_ = HdiId::HREQ_CALL_GET_USSD;
1031     resultInfo_ = responseInfo;
1032     NotifyAll();
1033     return 0;
1034 }
1035 
SetMuteResponse(const RilRadioResponseInfo & responseInfo)1036 int32_t RilCallbackTest::SetMuteResponse(const RilRadioResponseInfo &responseInfo)
1037 {
1038     TELEPHONY_LOGI("GetBoolResult SetMuteResponse");
1039     hdiId_ = HdiId::HREQ_CALL_SET_MUTE;
1040     resultInfo_ = responseInfo;
1041     NotifyAll();
1042     return 0;
1043 }
1044 
GetMuteResponse(const RilRadioResponseInfo & responseInfo,int32_t mute)1045 int32_t RilCallbackTest::GetMuteResponse(const RilRadioResponseInfo &responseInfo, int32_t mute)
1046 {
1047     TELEPHONY_LOGI("GetBoolResult GetMuteResponse mute: %{public}d", mute);
1048     hdiId_ = HdiId::HREQ_CALL_GET_MUTE;
1049     resultInfo_ = responseInfo;
1050     NotifyAll();
1051     return 0;
1052 }
1053 
GetCallFailReasonResponse(const RilRadioResponseInfo & responseInfo,int32_t callFail)1054 int32_t RilCallbackTest::GetCallFailReasonResponse(const RilRadioResponseInfo &responseInfo, int32_t callFail)
1055 {
1056     TELEPHONY_LOGI("GetBoolResult GetCallFailReasonResponse callFail: %{public}d", callFail);
1057     hdiId_ = HdiId::HREQ_CALL_GET_FAIL_REASON;
1058     resultInfo_ = responseInfo;
1059     NotifyAll();
1060     return 0;
1061 }
1062 
SetBarringPasswordResponse(const RilRadioResponseInfo & responseInfo)1063 int32_t RilCallbackTest::SetBarringPasswordResponse(const RilRadioResponseInfo &responseInfo)
1064 {
1065     TELEPHONY_LOGI("GetBoolResult SetBarringPasswordResponse");
1066     hdiId_ = HdiId::HREQ_CALL_SET_BARRING_PASSWORD;
1067     resultInfo_ = responseInfo;
1068     NotifyAll();
1069     return 0;
1070 }
1071 
1072 /**
1073  * modem
1074  **/
RadioStateUpdated(const RilRadioResponseInfo & responseInfo,int32_t state)1075 int32_t RilCallbackTest::RadioStateUpdated(const RilRadioResponseInfo &responseInfo, int32_t state)
1076 {
1077     TELEPHONY_LOGI("RadioStateUpdated state : %{public}d", state);
1078     return 0;
1079 }
1080 
VoiceRadioTechUpdated(const RilRadioResponseInfo & responseInfo,const VoiceRadioTechnology & voiceRadioTechnology)1081 int32_t RilCallbackTest::VoiceRadioTechUpdated(
1082     const RilRadioResponseInfo &responseInfo, const VoiceRadioTechnology &voiceRadioTechnology)
1083 {
1084     TELEPHONY_LOGI(
1085         "GetVoiceRadioTechnologyResponse srvStatus : %{public}d srvDomain : %{public}d roamStatus: %{public}d "
1086         "simStatus : %{public}d lockStatus : %{public}d sysMode : %{public}d actType : %{public}d sysModeName : "
1087         "%{public}s actName : %{public}s",
1088         voiceRadioTechnology.srvStatus, voiceRadioTechnology.srvDomain, voiceRadioTechnology.roamStatus,
1089         voiceRadioTechnology.simStatus, voiceRadioTechnology.lockStatus, voiceRadioTechnology.sysMode,
1090         voiceRadioTechnology.actType, voiceRadioTechnology.sysModeName.c_str(), voiceRadioTechnology.actName.c_str());
1091     return 0;
1092 }
1093 
ShutDownResponse(const RilRadioResponseInfo & responseInfo)1094 int32_t RilCallbackTest::ShutDownResponse(const RilRadioResponseInfo &responseInfo)
1095 {
1096     TELEPHONY_LOGI("ShutDownResponse");
1097     hdiId_ = HdiId::HREQ_MODEM_SHUT_DOWN;
1098     resultInfo_ = responseInfo;
1099     NotifyAll();
1100     return 0;
1101 }
1102 
SetRadioStateResponse(const RilRadioResponseInfo & responseInfo)1103 int32_t RilCallbackTest::SetRadioStateResponse(const RilRadioResponseInfo &responseInfo)
1104 {
1105     TELEPHONY_LOGI("SetRadioStateResponse");
1106     hdiId_ = HdiId::HREQ_MODEM_SET_RADIO_STATUS;
1107     resultInfo_ = responseInfo;
1108     NotifyAll();
1109     return 0;
1110 }
1111 
GetRadioStateResponse(const RilRadioResponseInfo & responseInfo,int32_t state)1112 int32_t RilCallbackTest::GetRadioStateResponse(const RilRadioResponseInfo &responseInfo, int32_t state)
1113 {
1114     TELEPHONY_LOGI("GetRadioStateResponse state : %{public}d", state);
1115     hdiId_ = HdiId::HREQ_MODEM_GET_RADIO_STATUS;
1116     resultInfo_ = responseInfo;
1117     NotifyAll();
1118     return 0;
1119 }
1120 
GetImeiResponse(const RilRadioResponseInfo & responseInfo,const std::string & imei)1121 int32_t RilCallbackTest::GetImeiResponse(const RilRadioResponseInfo &responseInfo, const std::string &imei)
1122 {
1123     TELEPHONY_LOGI("GetImeiResponse imei : %{public}s", imei.c_str());
1124     hdiId_ = HdiId::HREQ_MODEM_GET_IMEI;
1125     resultInfo_ = responseInfo;
1126     NotifyAll();
1127     return 0;
1128 }
1129 
GetMeidResponse(const RilRadioResponseInfo & responseInfo,const std::string & meid)1130 int32_t RilCallbackTest::GetMeidResponse(const RilRadioResponseInfo &responseInfo, const std::string &meid)
1131 {
1132     TELEPHONY_LOGI("GetMeidResponse meid : %{public}s", meid.c_str());
1133     hdiId_ = HdiId::HREQ_MODEM_GET_MEID;
1134     resultInfo_ = responseInfo;
1135     NotifyAll();
1136     return 0;
1137 }
1138 
GetVoiceRadioTechnologyResponse(const RilRadioResponseInfo & responseInfo,const VoiceRadioTechnology & voiceRadioTechnology)1139 int32_t RilCallbackTest::GetVoiceRadioTechnologyResponse(
1140     const RilRadioResponseInfo &responseInfo, const VoiceRadioTechnology &voiceRadioTechnology)
1141 {
1142     TELEPHONY_LOGI(
1143         "GetVoiceRadioTechnologyResponse srvStatus : %{public}d srvDomain : %{public}d roamStatus: %{public}d "
1144         "simStatus : %{public}d lockStatus : %{public}d sysMode : %{public}d actType : %{public}d sysModeName : "
1145         "%{public}s actName : %{public}s",
1146         voiceRadioTechnology.srvStatus, voiceRadioTechnology.srvDomain, voiceRadioTechnology.roamStatus,
1147         voiceRadioTechnology.simStatus, voiceRadioTechnology.lockStatus, voiceRadioTechnology.sysMode,
1148         voiceRadioTechnology.actType, voiceRadioTechnology.sysModeName.c_str(), voiceRadioTechnology.actName.c_str());
1149     hdiId_ = HdiId::HREQ_MODEM_GET_VOICE_RADIO;
1150     resultInfo_ = responseInfo;
1151     NotifyAll();
1152     return 0;
1153 }
1154 
GetBasebandVersionResponse(const RilRadioResponseInfo & responseInfo,const std::string & basebandVersion)1155 int32_t RilCallbackTest::GetBasebandVersionResponse(
1156     const RilRadioResponseInfo &responseInfo, const std::string &basebandVersion)
1157 {
1158     TELEPHONY_LOGI("GetBasebandVersionResponse basebandVersion : %{public}s", basebandVersion.c_str());
1159     hdiId_ = HdiId::HREQ_MODEM_GET_BASEBAND_VERSION;
1160     resultInfo_ = responseInfo;
1161     NotifyAll();
1162     return 0;
1163 }
1164 
1165 // Data
PdpContextListUpdated(const RilRadioResponseInfo & responseInfo,const DataCallResultList & dataCallResultList)1166 int32_t RilCallbackTest::PdpContextListUpdated(
1167     const RilRadioResponseInfo &responseInfo, const DataCallResultList &dataCallResultList)
1168 {
1169     TELEPHONY_LOGI("RilCallbackTest::PdpContextListUpdated size:%{public}d", dataCallResultList.size);
1170     for (auto &setupDataCallResultInfo : dataCallResultList.dcList) {
1171         TELEPHONY_LOGI(
1172             "RilCallbackTest::PdpContextListUpdated flag:%{public}d reason:%{public}d retryTime:%{public}d "
1173             "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1174             "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1175             "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1176             setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1177             setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1178             setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1179             setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1180             setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1181             setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1182             setupDataCallResultInfo.pduSessionId);
1183     }
1184     return 0;
1185 }
1186 
ActivatePdpContextResponse(const RilRadioResponseInfo & responseInfo,const SetupDataCallResultInfo & setupDataCallResultInfo)1187 int32_t RilCallbackTest::ActivatePdpContextResponse(
1188     const RilRadioResponseInfo &responseInfo, const SetupDataCallResultInfo &setupDataCallResultInfo)
1189 {
1190     TELEPHONY_LOGI(
1191         "RilCallbackTest::ActivatePdpContextResponse flag:%{public}d reason:%{public}d retryTime:%{public}d "
1192         "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1193         "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1194         "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1195         setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1196         setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1197         setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1198         setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1199         setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1200         setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1201         setupDataCallResultInfo.pduSessionId);
1202     hdiId_ = HdiId::HREQ_DATA_ACTIVATE_PDP_CONTEXT;
1203     resultInfo_ = responseInfo;
1204     NotifyAll();
1205     return 0;
1206 }
1207 
DeactivatePdpContextResponse(const RilRadioResponseInfo & responseInfo)1208 int32_t RilCallbackTest::DeactivatePdpContextResponse(const RilRadioResponseInfo &responseInfo)
1209 {
1210     TELEPHONY_LOGI("RilCallbackTest::DeactivatePdpContextResponse error:%{public}d", responseInfo.error);
1211     hdiId_ = HdiId::HREQ_DATA_DEACTIVATE_PDP_CONTEXT;
1212     resultInfo_ = responseInfo;
1213     NotifyAll();
1214     return 0;
1215 }
1216 
GetPdpContextListResponse(const RilRadioResponseInfo & responseInfo,const DataCallResultList & dataCallResultList)1217 int32_t RilCallbackTest::GetPdpContextListResponse(
1218     const RilRadioResponseInfo &responseInfo, const DataCallResultList &dataCallResultList)
1219 {
1220     TELEPHONY_LOGI("RilCallbackTest::GetPdpContextListResponse size:%{public}d", dataCallResultList.size);
1221     for (auto &setupDataCallResultInfo : dataCallResultList.dcList) {
1222         TELEPHONY_LOGI(
1223             "RilCallbackTest::GetPdpContextListResponse flag:%{public}d reason:%{public}d retryTime:%{public}d "
1224             "cid:%{public}d active:%{public}d type:%{public}s netPortName:%{public}s address:%{public}s "
1225             "dns:%{public}s dnsSec:%{public}s gateway:%{public}s maxTransferUnit:%{public}d pCscfPrimAddr:%{public}s "
1226             "pCscfSecAddr:%{public}s pduSessionId:%{public}d",
1227             setupDataCallResultInfo.flag, setupDataCallResultInfo.reason, setupDataCallResultInfo.retryTime,
1228             setupDataCallResultInfo.cid, setupDataCallResultInfo.active, setupDataCallResultInfo.type.c_str(),
1229             setupDataCallResultInfo.netPortName.c_str(), setupDataCallResultInfo.address.c_str(),
1230             setupDataCallResultInfo.dns.c_str(), setupDataCallResultInfo.dnsSec.c_str(),
1231             setupDataCallResultInfo.gateway.c_str(), setupDataCallResultInfo.maxTransferUnit,
1232             setupDataCallResultInfo.pCscfPrimAddr.c_str(), setupDataCallResultInfo.pCscfSecAddr.c_str(),
1233             setupDataCallResultInfo.pduSessionId);
1234     }
1235     hdiId_ = HdiId::HREQ_DATA_GET_PDP_CONTEXT_LIST;
1236     resultInfo_ = responseInfo;
1237     NotifyAll();
1238     return 0;
1239 }
1240 
SetInitApnInfoResponse(const RilRadioResponseInfo & responseInfo)1241 int32_t RilCallbackTest::SetInitApnInfoResponse(const RilRadioResponseInfo &responseInfo)
1242 {
1243     TELEPHONY_LOGI("RilCallbackTest::SetInitApnInfoResponse error:%{public}d", responseInfo.error);
1244     hdiId_ = HdiId::HREQ_DATA_SET_INIT_APN_INFO;
1245     resultInfo_ = responseInfo;
1246     NotifyAll();
1247     return 0;
1248 }
1249 
SetLinkBandwidthReportingRuleResponse(const RilRadioResponseInfo & responseInfo)1250 int32_t RilCallbackTest::SetLinkBandwidthReportingRuleResponse(const RilRadioResponseInfo &responseInfo)
1251 {
1252     TELEPHONY_LOGI("RilCallbackTest::SetLinkBandwidthReportingRuleResponse error:%{public}d", responseInfo.error);
1253     hdiId_ = HdiId::HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE;
1254     resultInfo_ = responseInfo;
1255     NotifyAll();
1256     return 0;
1257 }
1258 
GetLinkBandwidthInfoResponse(const RilRadioResponseInfo & responseInfo,const DataLinkBandwidthInfo & dataLinkBandwidthInfo)1259 int32_t RilCallbackTest::GetLinkBandwidthInfoResponse(
1260     const RilRadioResponseInfo &responseInfo, const DataLinkBandwidthInfo &dataLinkBandwidthInfo)
1261 {
1262     TELEPHONY_LOGI("RilCallbackTest::GetLinkBandwidthInfoResponse serial:%{public}d cid:%{public}d qi:%{public}d "
1263                    "dlGfbr:%{public}d "
1264                    "ulGfbr:%{public}d dlMfbr:%{public}d ulMfbr:%{public}d ulSambr:%{public}d dlSambr:%{public}d "
1265                    "averagingWindow:%{public}d",
1266         dataLinkBandwidthInfo.serial, dataLinkBandwidthInfo.cid, dataLinkBandwidthInfo.qi, dataLinkBandwidthInfo.dlGfbr,
1267         dataLinkBandwidthInfo.ulGfbr, dataLinkBandwidthInfo.dlMfbr, dataLinkBandwidthInfo.ulMfbr,
1268         dataLinkBandwidthInfo.ulSambr, dataLinkBandwidthInfo.dlSambr, dataLinkBandwidthInfo.averagingWindow);
1269     hdiId_ = HdiId::HREQ_DATA_GET_LINK_BANDWIDTH_INFO;
1270     resultInfo_ = responseInfo;
1271     NotifyAll();
1272     return 0;
1273 }
1274 
SetDataPermittedResponse(const RilRadioResponseInfo & responseInfo)1275 int32_t RilCallbackTest::SetDataPermittedResponse(const RilRadioResponseInfo &responseInfo)
1276 {
1277     TELEPHONY_LOGI("RilCallbackTest::SetDataPermittedResponse error:%{public}d", responseInfo.error);
1278     hdiId_ = HdiId::HREQ_DATA_SET_DATA_PERMITTED;
1279     resultInfo_ = responseInfo;
1280     NotifyAll();
1281     return 0;
1282 }
1283 
SetDataProfileInfoResponse(const RilRadioResponseInfo & responseInfo)1284 int32_t RilCallbackTest::SetDataProfileInfoResponse(const RilRadioResponseInfo &responseInfo)
1285 {
1286     TELEPHONY_LOGI("RilCallbackTest::SetDataProfileInfoResponse error:%{public}d", responseInfo.error);
1287     hdiId_ = HdiId::HREQ_DATA_SET_DATA_PROFILE_INFO;
1288     resultInfo_ = responseInfo;
1289     NotifyAll();
1290     return 0;
1291 }
1292 
1293 // Sms
NewSmsNotify(const HDI::Ril::V1_0::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1294 int32_t RilCallbackTest::NewSmsNotify(
1295     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1296 {
1297     TELEPHONY_LOGI("RilCallbackTest::NewSmsNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1298     return 0;
1299 }
1300 
NewCdmaSmsNotify(const HDI::Ril::V1_0::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1301 int32_t RilCallbackTest::NewCdmaSmsNotify(
1302     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1303 {
1304     TELEPHONY_LOGI("RilCallbackTest::NewCdmaSmsNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1305     return 0;
1306 }
1307 
SmsStatusReportNotify(const HDI::Ril::V1_0::RilRadioResponseInfo & responseInfo,const SmsMessageInfo & smsMessageInfo)1308 int32_t RilCallbackTest::SmsStatusReportNotify(
1309     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, const SmsMessageInfo &smsMessageInfo)
1310 {
1311     TELEPHONY_LOGI("RilCallbackTest::SmsStatusReportNotify smsMessageInfo size : %{public}d", smsMessageInfo.size);
1312     return 0;
1313 }
1314 
NewSmsStoredOnSimNotify(const HDI::Ril::V1_0::RilRadioResponseInfo & responseInfo,int32_t recordNumber,int32_t indicationType)1315 int32_t RilCallbackTest::NewSmsStoredOnSimNotify(
1316     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, int32_t recordNumber, int32_t indicationType)
1317 {
1318     TELEPHONY_LOGI("RilCallbackTest::NewSmsStoredOnSimNotify recordNumber : %{public}d, indicationType : %{public}d",
1319         recordNumber, indicationType);
1320     return 0;
1321 }
1322 
CBConfigNotify(const HDI::Ril::V1_0::RilRadioResponseInfo & responseInfo,const CBConfigReportInfo & cellBroadConfigReportInfo)1323 int32_t RilCallbackTest::CBConfigNotify(
1324     const HDI::Ril::V1_0::RilRadioResponseInfo &responseInfo, const CBConfigReportInfo &cellBroadConfigReportInfo)
1325 {
1326     TELEPHONY_LOGI("RilCallbackTest::CBConfigNotify cellBroadConfigReportInfo dcs : %{public}s",
1327         cellBroadConfigReportInfo.dcs.c_str());
1328     return 0;
1329 }
1330 
SendGsmSmsResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1331 int32_t RilCallbackTest::SendGsmSmsResponse(
1332     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1333 {
1334     TELEPHONY_LOGI("RilCallbackTest::SendGsmSmsResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1335         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1336     hdiId_ = HdiId::HREQ_SMS_SEND_GSM_SMS;
1337     resultInfo_ = responseInfo;
1338     NotifyAll();
1339     return 0;
1340 }
1341 
SendCdmaSmsResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1342 int32_t RilCallbackTest::SendCdmaSmsResponse(
1343     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1344 {
1345     TELEPHONY_LOGI("RilCallbackTest::SendCdmaSmsResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1346         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1347     hdiId_ = HdiId::HREQ_SMS_SEND_CDMA_SMS;
1348     resultInfo_ = responseInfo;
1349     NotifyAll();
1350     return 0;
1351 }
1352 
AddSimMessageResponse(const RilRadioResponseInfo & responseInfo)1353 int32_t RilCallbackTest::AddSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1354 {
1355     TELEPHONY_LOGI("RilCallbackTest::AddSimMessageResponse error : %{public}d", responseInfo.error);
1356     hdiId_ = HdiId::HREQ_SMS_ADD_SIM_MESSAGE;
1357     resultInfo_ = responseInfo;
1358     NotifyAll();
1359     return 0;
1360 }
1361 
DelSimMessageResponse(const RilRadioResponseInfo & responseInfo)1362 int32_t RilCallbackTest::DelSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1363 {
1364     TELEPHONY_LOGI("RilCallbackTest::DelSimMessageResponse error : %{public}d", responseInfo.error);
1365     hdiId_ = HdiId::HREQ_SMS_DEL_SIM_MESSAGE;
1366     resultInfo_ = responseInfo;
1367     NotifyAll();
1368     return 0;
1369 }
1370 
UpdateSimMessageResponse(const RilRadioResponseInfo & responseInfo)1371 int32_t RilCallbackTest::UpdateSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1372 {
1373     TELEPHONY_LOGI("RilCallbackTest::UpdateSimMessageResponse error : %{public}d", responseInfo.error);
1374     hdiId_ = HdiId::HREQ_SMS_UPDATE_SIM_MESSAGE;
1375     resultInfo_ = responseInfo;
1376     NotifyAll();
1377     return 0;
1378 }
1379 
AddCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1380 int32_t RilCallbackTest::AddCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1381 {
1382     TELEPHONY_LOGI("RilCallbackTest::AddCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1383     hdiId_ = HdiId::HREQ_SMS_ADD_CDMA_SIM_MESSAGE;
1384     resultInfo_ = responseInfo;
1385     NotifyAll();
1386     return 0;
1387 }
1388 
DelCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1389 int32_t RilCallbackTest::DelCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1390 {
1391     TELEPHONY_LOGI("RilCallbackTest::DelCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1392     hdiId_ = HdiId::HREQ_SMS_DEL_CDMA_SIM_MESSAGE;
1393     resultInfo_ = responseInfo;
1394     NotifyAll();
1395     return 0;
1396 }
1397 
UpdateCdmaSimMessageResponse(const RilRadioResponseInfo & responseInfo)1398 int32_t RilCallbackTest::UpdateCdmaSimMessageResponse(const RilRadioResponseInfo &responseInfo)
1399 {
1400     TELEPHONY_LOGI("RilCallbackTest::UpdateCdmaSimMessageResponse error : %{public}d", responseInfo.error);
1401     hdiId_ = HdiId::HREQ_SMS_UPDATE_CDMA_SIM_MESSAGE;
1402     resultInfo_ = responseInfo;
1403     NotifyAll();
1404     return 0;
1405 }
1406 
SetSmscAddrResponse(const RilRadioResponseInfo & responseInfo)1407 int32_t RilCallbackTest::SetSmscAddrResponse(const RilRadioResponseInfo &responseInfo)
1408 {
1409     TELEPHONY_LOGI("RilCallbackTest::SetSmscAddrResponse error : %{public}d", responseInfo.error);
1410     hdiId_ = HdiId::HREQ_SMS_SET_SMSC_ADDR;
1411     resultInfo_ = responseInfo;
1412     NotifyAll();
1413     return 0;
1414 }
1415 
GetSmscAddrResponse(const RilRadioResponseInfo & responseInfo,const ServiceCenterAddress & serviceCenterAddress)1416 int32_t RilCallbackTest::GetSmscAddrResponse(
1417     const RilRadioResponseInfo &responseInfo, const ServiceCenterAddress &serviceCenterAddress)
1418 {
1419     TELEPHONY_LOGI("RilCallbackTest::GetSmscAddrResponse serviceCenterAddress tosca : %{public}d, address : %{public}s",
1420         serviceCenterAddress.tosca, serviceCenterAddress.address.c_str());
1421     smscAddr_ = serviceCenterAddress.address;
1422     hdiId_ = HdiId::HREQ_SMS_GET_SMSC_ADDR;
1423     resultInfo_ = responseInfo;
1424     NotifyAll();
1425     return 0;
1426 }
1427 
SetCBConfigResponse(const RilRadioResponseInfo & responseInfo)1428 int32_t RilCallbackTest::SetCBConfigResponse(const RilRadioResponseInfo &responseInfo)
1429 {
1430     TELEPHONY_LOGI("RilCallbackTest::SetCBConfigResponse error : %{public}d", responseInfo.error);
1431     hdiId_ = HdiId::HREQ_SMS_SET_CB_CONFIG;
1432     resultInfo_ = responseInfo;
1433     NotifyAll();
1434     return 0;
1435 }
1436 
GetCBConfigResponse(const RilRadioResponseInfo & responseInfo,const CBConfigInfo & cellBroadcastInfo)1437 int32_t RilCallbackTest::GetCBConfigResponse(
1438     const RilRadioResponseInfo &responseInfo, const CBConfigInfo &cellBroadcastInfo)
1439 {
1440     TELEPHONY_LOGI("RilCallbackTest::GetCBConfigResponse cellBroadcastInfo mids : %{public}s, dcss: %{public}s",
1441         cellBroadcastInfo.mids.c_str(), cellBroadcastInfo.dcss.c_str());
1442     hdiId_ = HdiId::HREQ_SMS_GET_CB_CONFIG;
1443     resultInfo_ = responseInfo;
1444     NotifyAll();
1445     return 0;
1446 }
1447 
SetCdmaCBConfigResponse(const RilRadioResponseInfo & responseInfo)1448 int32_t RilCallbackTest::SetCdmaCBConfigResponse(const RilRadioResponseInfo &responseInfo)
1449 {
1450     TELEPHONY_LOGI("RilCallbackTest::SetCdmaCBConfigResponse error : %{public}d", responseInfo.error);
1451     hdiId_ = HdiId::HREQ_SMS_SET_CDMA_CB_CONFIG;
1452     resultInfo_ = responseInfo;
1453     NotifyAll();
1454     return 0;
1455 }
1456 
GetCdmaCBConfigResponse(const RilRadioResponseInfo & responseInfo,const CdmaCBConfigInfo & cdmaCBConfigInfo)1457 int32_t RilCallbackTest::GetCdmaCBConfigResponse(
1458     const RilRadioResponseInfo &responseInfo, const CdmaCBConfigInfo &cdmaCBConfigInfo)
1459 {
1460     TELEPHONY_LOGI(
1461         "RilCallbackTest::GetCdmaCBConfigResponse cdmaCBConfigInfo service : %{public}d, language : %{public}d, "
1462         "checked: %{public}d",
1463         cdmaCBConfigInfo.service, cdmaCBConfigInfo.language, cdmaCBConfigInfo.checked);
1464     hdiId_ = HdiId::HREQ_SMS_GET_CDMA_CB_CONFIG;
1465     resultInfo_ = responseInfo;
1466     NotifyAll();
1467     return 0;
1468 }
1469 
SendSmsMoreModeResponse(const RilRadioResponseInfo & responseInfo,const SendSmsResultInfo & sendSmsResultInfo)1470 int32_t RilCallbackTest::SendSmsMoreModeResponse(
1471     const RilRadioResponseInfo &responseInfo, const SendSmsResultInfo &sendSmsResultInfo)
1472 {
1473     TELEPHONY_LOGI("RilCallbackTest::SendSmsMoreModeResponse sendSmsResultInfo pdu : %{public}s, error : %{public}d",
1474         sendSmsResultInfo.pdu.c_str(), sendSmsResultInfo.errCode);
1475     hdiId_ = HdiId::HREQ_SMS_SEND_SMS_MORE_MODE;
1476     resultInfo_ = responseInfo;
1477     NotifyAll();
1478     return 0;
1479 }
1480 
SendSmsAckResponse(const RilRadioResponseInfo & responseInfo)1481 int32_t RilCallbackTest::SendSmsAckResponse(const RilRadioResponseInfo &responseInfo)
1482 {
1483     TELEPHONY_LOGI("RilCallbackTest::SendSmsAckResponse error:%{public}d", responseInfo.error);
1484     hdiId_ = HdiId::HREQ_SMS_SEND_SMS_ACK;
1485     resultInfo_ = responseInfo;
1486     NotifyAll();
1487     return 0;
1488 }
1489 
CommonErrorResponse(const RilRadioResponseInfo & responseInfo)1490 int32_t RilCallbackTest::CommonErrorResponse(const RilRadioResponseInfo &responseInfo)
1491 {
1492     TELEPHONY_LOGI(
1493         "RilCallbackTest::CommonErrorResponse type:%{public}d error:%{public}d", responseInfo.type, responseInfo.error);
1494     return 0;
1495 }
1496 } // namespace Telephony
1497 } // namespace OHOS
1498