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_interface_test.h"
17
18using namespace std;
19namespace OHOS {
20namespace Telephony {
21using namespace OHOS::HDI::Ril::V1_3;
22sptr<OHOS::HDI::Ril::V1_3::IRil> g_rilInterface = nullptr;
23constexpr int32_t DEFAULT_CHOICE = -1;
24constexpr int32_t MENU_OFFSET = 1;
25constexpr int32_t WAIT_TIME = 500000;
26constexpr int32_t IN_BUF_LEN = 1024;
27constexpr int32_t MAX_RANDOM = 100000000;
28constexpr int32_t MAX_CALL_TYPE = 3;
29constexpr int32_t STRESS_TEST_NUM = 10000;
30constexpr int32_t MAX_CALL_ID = 7;
31constexpr int32_t HANGUP_ACTIVE = 2;
32constexpr int32_t DTMF_ON_LEN = 300;
33constexpr int32_t RAT_TYPE_LTE = 5;
34constexpr int32_t BANDWIDTH_HYSTERESIS_MS = 3000;
35constexpr int32_t BANDWIDTH_HYSTERESIS_KBPS = 50;
36constexpr int32_t SIM_LOCK_MODE_QUERY = 2;
37constexpr int32_t MAX_UPLINK_LINK_BANDWIDTH[] = {
38    100,
39    500,
40    1000,
41    5000,
42    10000,
43    20000,
44    50000,
45    100000,
46    200000,
47};
48constexpr int32_t MAX_DOWNLINK_LINK_BANDWIDTH[] = {
49    100, // VoIP
50    500, // Web
51    1000, // SD
52    5000, // HD
53    10000, // file
54    20000, // 4K
55    50000, // LTE
56    100000,
57    200000, // 5G
58    500000,
59    1000000,
60};
61typedef enum {
62    HREQ_CALL_BASE = 0,
63    HREQ_CALL_GET_CALL_LIST,
64    HREQ_CALL_DIAL,
65    HREQ_CALL_HANGUP,
66    HREQ_CALL_REJECT,
67    HREQ_CALL_ANSWER,
68    HREQ_CALL_HOLD_CALL, // call hold value 6
69    HREQ_CALL_UNHOLD_CALL, // call active value 6
70    HREQ_CALL_SWITCH_CALL,
71    HREQ_CALL_COMBINE_CONFERENCE,
72    HREQ_CALL_SEPARATE_CONFERENCE, // Keep all other calls except the xth call
73    HREQ_CALL_CALL_SUPPLEMENT,
74    HREQ_CALL_SEND_DTMF,
75    HREQ_CALL_START_DTMF,
76    HREQ_CALL_STOP_DTMF,
77    HREQ_CALL_SET_CLIP,
78    HREQ_CALL_GET_CLIP,
79    HREQ_CALL_GET_CALL_WAITING,
80    HREQ_CALL_SET_CALL_WAITING,
81    HREQ_CALL_GET_CALL_RESTRICTION,
82    HREQ_CALL_SET_CALL_RESTRICTION,
83    HREQ_CALL_GET_CALL_TRANSFER_INFO,
84    HREQ_CALL_SET_CALL_TRANSFER_INFO,
85    HREQ_CALL_GET_CLIR,
86    HREQ_CALL_SET_CLIR,
87    HREQ_CALL_GET_CALL_PREFERENCE,
88    HREQ_CALL_SET_CALL_PREFERENCE,
89    HREQ_CALL_SET_USSD,
90    HREQ_CALL_GET_USSD,
91    HREQ_CALL_SET_MUTE,
92    HREQ_CALL_GET_MUTE,
93    HREQ_CALL_GET_EMERGENCY_LIST,
94    HREQ_CALL_SET_EMERGENCY_LIST,
95    HREQ_CALL_GET_FAIL_REASON,
96    HREQ_CALL_SET_BARRING_PASSWORD,
97    HREQ_SET_VONR_SWITCH,
98
99    HREQ_SMS_BASE = 100,
100    HREQ_SMS_SEND_GSM_SMS,
101    HREQ_SMS_SEND_CDMA_SMS,
102    HREQ_SMS_ADD_SIM_MESSAGE,
103    HREQ_SMS_DEL_SIM_MESSAGE,
104    HREQ_SMS_UPDATE_SIM_MESSAGE,
105    HREQ_SMS_SEND_SMS_MORE_MODE,
106    HREQ_SMS_SEND_SMS_ACK,
107    HREQ_SMS_SET_SMSC_ADDR,
108    HREQ_SMS_GET_SMSC_ADDR,
109    HREQ_SMS_SET_CB_CONFIG,
110    HREQ_SMS_GET_CB_CONFIG,
111    HREQ_SMS_GET_CDMA_CB_CONFIG,
112    HREQ_SMS_SET_CDMA_CB_CONFIG,
113    HREQ_SMS_ADD_CDMA_SIM_MESSAGE,
114    HREQ_SMS_DEL_CDMA_SIM_MESSAGE,
115    HREQ_SMS_UPDATE_CDMA_SIM_MESSAGE,
116
117    HREQ_SIM_BASE = 200,
118    HREQ_SIM_GET_SIM_STATUS,
119    HREQ_SIM_GET_IMSI,
120    HREQ_SIM_GET_SIM_IO,
121    HREQ_SIM_GET_SIM_LOCK_STATUS,
122    HREQ_SIM_SET_SIM_LOCK,
123    HREQ_SIM_CHANGE_SIM_PASSWORD,
124    HREQ_SIM_UNLOCK_PIN,
125    HREQ_SIM_UNLOCK_PUK,
126    HREQ_SIM_GET_SIM_PIN_INPUT_TIMES,
127    HREQ_SIM_UNLOCK_PIN2,
128    HREQ_SIM_UNLOCK_PUK2,
129    HREQ_SIM_GET_SIM_PIN2_INPUT_TIMES,
130    HREQ_SIM_SET_ACTIVE_SIM,
131    HREQ_SIM_GET_RADIO_PROTOCOL,
132    HREQ_SIM_SET_RADIO_PROTOCOL,
133    HREQ_SIM_STK_SEND_TERMINAL_RESPONSE,
134    HREQ_SIM_STK_SEND_ENVELOPE,
135    HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT,
136    HREQ_SIM_STK_IS_READY,
137    HREQ_SIM_OPEN_LOGICAL_CHANNEL,
138    HREQ_SIM_CLOSE_LOGICAL_CHANNEL,
139    HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL,
140    HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL,
141    HREQ_SIM_AUTHENTICATION,
142    HREQ_SIM_UNLOCK_SIM_LOCK,
143    HREQ_SIM_SEND_NCFG_OPER_INFO,
144
145    HREQ_DATA_BASE = 300,
146    HREQ_DATA_SET_INIT_APN_INFO,
147    HREQ_DATA_DEACTIVATE_PDP_CONTEXT,
148    HREQ_DATA_ACTIVATE_PDP_CONTEXT,
149    HREQ_DATA_GET_PDP_CONTEXT_LIST,
150    HREQ_DATA_GET_LINK_BANDWIDTH_INFO,
151    HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE,
152    HREQ_DATA_SET_DATA_PROFILE_INFO,
153    HREQ_DATA_SEND_DATA_PERFORMANCE_MODE,
154    HREQ_DATA_SEND_DATA_SLEEP_MODE,
155    HREQ_DATA_SET_DATA_PERMITTED,
156    HREQ_DATA_GET_LINK_CAPABILITY,
157    HREQ_DATA_CLEAN_ALL_CONNECTIONS,
158
159    HREQ_NETWORK_BASE = 400,
160    HREQ_NETWORK_GET_SIGNAL_STRENGTH,
161    HREQ_NETWORK_GET_CS_REG_STATUS,
162    HREQ_NETWORK_GET_PS_REG_STATUS,
163    HREQ_NETWORK_GET_OPERATOR_INFO,
164    HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION,
165    HREQ_NETWORK_GET_NETWORK_SELECTION_MODE,
166    HREQ_NETWORK_SET_NETWORK_SELECTION_MODE,
167    HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST,
168    HREQ_NETWORK_GET_CURRENT_CELL_INFO,
169    HREQ_NETWORK_SET_PREFERRED_NETWORK,
170    HREQ_NETWORK_GET_PREFERRED_NETWORK,
171    HREQ_NETWORK_GET_RADIO_CAPABILITY,
172    HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG,
173    HREQ_NETWORK_SET_LOCATE_UPDATES,
174    HREQ_NETWORK_SET_NOTIFICATION_FILTER,
175    HREQ_NETWORK_SET_DEVICE_STATE,
176    HREQ_NETWORK_SET_NR_OPTION_MODE,
177    HREQ_NETWORK_GET_NR_OPTION_MODE,
178    HREQ_NETWORK_GET_RRC_CONNECTION_STATE,
179    HREQ_NETWORK_GET_NR_SSBID_INFO,
180
181    HREQ_COMMON_BASE = 500,
182    HREQ_MODEM_SHUT_DOWN,
183    HREQ_MODEM_SET_RADIO_STATUS,
184    HREQ_MODEM_GET_RADIO_STATUS,
185    HREQ_MODEM_GET_IMEI,
186    HREQ_MODEM_GET_IMEISV,
187    HREQ_MODEM_GET_MEID,
188    HREQ_MODEM_GET_BASEBAND_VERSION,
189    HREQ_MODEM_GET_VOICE_RADIO,
190    HREQ_MODEM_EXIT = 1000
191} HRilRequest;
192
193enum class TestMenu : int32_t { NONE = -1, EXIT, MODEM, CALL, NETWORK, SIM, DATA, SMS, STRESS };
194
195static int32_t InputInt32(int32_t start, int32_t end, const string &title)
196{
197    int32_t choice;
198    bool firstFlg = true;
199
200    do {
201        if (!firstFlg) {
202            cin.clear();
203            cin.ignore(IN_BUF_LEN, '\n');
204            cout << "---->Invalid Input, Please Enter Again !" << endl;
205        }
206        firstFlg = false;
207        cout << "---->Please Enter " << title << " (" << start << "-" << end << "): ";
208        cin >> choice;
209    } while (cin.fail() || choice < start || choice > end);
210
211    return choice;
212}
213
214int32_t RilInterfaceTest::GetSerialId()
215{
216    return rand() % MAX_RANDOM;
217}
218
219void RilInterfaceTest::GetCallListTest(int32_t slotId)
220{
221    cout << "RilInterfaceTest::GetCallListTest -->" << endl;
222    int32_t ret = g_rilInterface->GetCallList(slotId, GetSerialId());
223    cout << "RilInterfaceTest::GetCallListTest finish ret : " << ret << endl << endl;
224}
225
226void RilInterfaceTest::RilCmDialTest(int32_t slotId)
227{
228    cout << "RilInterfaceTest::RilCmDialTest -->" << endl;
229    DialInfo dialInfo = {};
230    dialInfo.clir = 0;
231    cout << "---->Please enter the phone number:";
232    cin >> dialInfo.address;
233    int32_t ret = g_rilInterface->Dial(slotId, GetSerialId(), dialInfo);
234    cout << "RilInterfaceTest::RilCmDialTest finish ret : " << ret << endl << endl;
235}
236
237void RilInterfaceTest::RilCmDialStressTest(int32_t slotId)
238{
239    cout << "RilInterfaceTest::RilCmDialStressTest -->" << endl;
240    DialInfo dialInfo = {};
241    dialInfo.clir = 0;
242    cout << "---->Please enter the phone number:";
243    cin >> dialInfo.address;
244    int32_t ret = -1;
245    for (int32_t i = 0; i < STRESS_TEST_NUM; i++) {
246        ret = g_rilInterface->Dial(slotId, GetSerialId(), dialInfo);
247    }
248    cout << "RilInterfaceTest::RilCmDialStressTest finish ret : " << ret << endl << endl;
249}
250
251void RilInterfaceTest::HangupTest(int32_t slotId)
252{
253    cout << "RilInterfaceTest::HangupTest -->" << endl;
254    int32_t callIndex = InputInt32(1, MAX_CALL_ID, "Hangup call number");
255    int ret = g_rilInterface->Hangup(slotId, GetSerialId(), callIndex);
256    cout << "RilInterfaceTest::HangupTest finish ret : " << ret << endl << endl;
257}
258
259void RilInterfaceTest::RejectTest(int32_t slotId)
260{
261    cout << "RilInterfaceTest::RejectTest -->" << endl;
262    int ret = g_rilInterface->Reject(slotId, GetSerialId());
263    cout << "RilInterfaceTest::RejectTest finish ret : " << ret << endl << endl;
264}
265
266void RilInterfaceTest::AnswerCallTest(int32_t slotId)
267{
268    cout << "RilInterfaceTest::AnswerCallTest -->" << endl;
269    int ret = g_rilInterface->Answer(slotId, GetSerialId());
270    cout << "RilInterfaceTest::AnswerCallTest finish ret : " << ret << endl << endl;
271}
272
273void RilInterfaceTest::HoldCallTest(int32_t slotId)
274{
275    cout << "RilInterfaceTest::HoldCallTest -->" << endl;
276    int ret = g_rilInterface->HoldCall(slotId, GetSerialId());
277    cout << "RilInterfaceTest::HoldCallTest finish ret : " << ret << endl << endl;
278}
279
280void RilInterfaceTest::UnHoldCallTest(int32_t slotId)
281{
282    cout << "RilInterfaceTest::UnHoldCallTest -->" << endl;
283    int ret = g_rilInterface->UnHoldCall(slotId, GetSerialId());
284    cout << "RilInterfaceTest::UnHoldCall finish ret : " << ret << endl << endl;
285}
286
287void RilInterfaceTest::SwitchCallTest(int32_t slotId)
288{
289    cout << "RilInterfaceTest::SwitchCallTest -->" << endl;
290    int ret = g_rilInterface->SwitchCall(slotId, GetSerialId());
291    cout << "RilInterfaceTest::SwitchCallTest finish ret : " << ret << endl << endl;
292}
293
294void RilInterfaceTest::RilCmJoinCallTest(int32_t slotId)
295{
296    cout << "RilInterfaceTest::RilCmJoinCallTest -->" << endl;
297    int32_t callType = InputInt32(0, MAX_CALL_TYPE, "Call Type");
298    int ret = g_rilInterface->CombineConference(slotId, GetSerialId(), callType);
299    cout << "RilInterfaceTest::RilCmJoinCallTest finish ret : " << ret << endl << endl;
300}
301
302void RilInterfaceTest::RilCmSplitCallTest(int32_t slotId)
303{
304    cout << "RilInterfaceTest::RilCmSplitCallTest -->" << endl;
305    int32_t callIndex = InputInt32(1, MAX_CALL_ID, "The Split Call Number");
306    cout << "call type:" << endl;
307    cout << "0: Voice call" << endl;
308    cout << "1: Video call: send one-way video, two-way voice" << endl;
309    cout << "2: Video call: one-way receiving video, two-way voice" << endl;
310    cout << "3: Video call: two-way video, two-way voice" << endl;
311    int32_t callType = InputInt32(0, MAX_CALL_TYPE, "Call Type");
312    int ret = g_rilInterface->SeparateConference(slotId, GetSerialId(), callIndex, callType);
313    cout << "RilInterfaceTest::RilCmSplitCallTest finish ret : " << ret << endl << endl;
314}
315
316void RilInterfaceTest::CallSupplementTest(int32_t slotId)
317{
318    cout << "RilInterfaceTest::CallSupplementTest -->" << endl;
319    cout << "---->CallSupplement Hangup hold wait: 1, Hangup active: 2: " << endl;
320    int32_t hangupType = InputInt32(1, HANGUP_ACTIVE, "Option");
321    int ret = g_rilInterface->CallSupplement(slotId, GetSerialId(), hangupType);
322    cout << "RilInterfaceTest::CallSupplementTest finish ret : " << ret << endl << endl;
323}
324
325void RilInterfaceTest::SendDtmfTest(int32_t slotId)
326{
327    cout << "RilInterfaceTest::SendDtmfTest -->" << endl;
328    DtmfInfo dtmfInfo = {};
329    dtmfInfo.callId = 1;
330    dtmfInfo.onLength = DTMF_ON_LEN;
331    dtmfInfo.offLength = 0;
332    dtmfInfo.stringLength = 1;
333    cout << "---->Please input dtmf key: ";
334    cin >> dtmfInfo.dtmfKey;
335    cout << endl << "====>Send Dtmf Key: " << dtmfInfo.dtmfKey << endl;
336
337    int ret = g_rilInterface->SendDtmf(slotId, GetSerialId(), dtmfInfo);
338    cout << "RilInterfaceTest::SendDtmfTest finish ret : " << ret << endl << endl;
339}
340
341void RilInterfaceTest::StartDtmfTest(int32_t slotId)
342{
343    cout << "RilInterfaceTest::StartDtmfTest -->" << endl;
344    DtmfInfo dtmfInfo = {};
345    dtmfInfo.callId = 1;
346    cout << "---->Please input dtmf key: ";
347    cin >> dtmfInfo.dtmfKey;
348    cout << endl << "====>Start Dtmf Key: " << dtmfInfo.dtmfKey << endl;
349    int ret = g_rilInterface->StartDtmf(slotId, GetSerialId(), dtmfInfo);
350    cout << "RilInterfaceTest::StartDtmfTest finish ret : " << ret << endl << endl;
351}
352
353void RilInterfaceTest::StopDtmfTest(int32_t slotId)
354{
355    cout << "RilInterfaceTest::StopDtmfTest -->" << endl;
356    DtmfInfo dtmfInfo = {};
357    dtmfInfo.callId = 1;
358    cout << "---->Please input dtmf key: ";
359    cin >> dtmfInfo.dtmfKey;
360    cout << endl << "====>Start Dtmf Key: " << dtmfInfo.dtmfKey << endl;
361    int ret = g_rilInterface->StopDtmf(slotId, GetSerialId(), dtmfInfo);
362    cout << "RilInterfaceTest::StopDtmfTest finish ret : " << ret << endl << endl;
363}
364
365void RilInterfaceTest::SetUssdCusdTest(int32_t slotId)
366{
367    cout << "RilInterfaceTest::SetUssdCusdTest -->" << endl;
368    int ret = g_rilInterface->SetUssd(slotId, GetSerialId(), "12345678");
369    cout << "RilInterfaceTest::SetUssdCusdTest finish ret : " << ret << endl << endl;
370}
371
372void RilInterfaceTest::GetUssdCusdTest(int32_t slotId)
373{
374    cout << "RilInterfaceTest::GetUssdCusdTest -->" << endl;
375    int ret = g_rilInterface->GetUssd(1, GetSerialId());
376    cout << "RilInterfaceTest::GetUssdCusdTest finish ret : " << ret << endl << endl;
377}
378
379void RilInterfaceTest::SetMuteTest(int32_t slotId)
380{
381    cout << "RilInterfaceTest::SetMuteTest -->" << endl;
382    cout << "---->Unmute: 0, Mute: 1: " << endl;
383    int32_t mute = InputInt32(0, 1, "Option");
384    int ret = g_rilInterface->SetMute(slotId, GetSerialId(), mute);
385    cout << "RilInterfaceTest::SetMuteTest finish ret : " << ret << endl << endl;
386}
387
388void RilInterfaceTest::GetMuteTest(int32_t slotId)
389{
390    cout << "RilInterfaceTest::GetMuteTest -->" << endl;
391    int ret = g_rilInterface->GetMute(slotId, GetSerialId());
392    cout << "RilInterfaceTest::GetMuteTest finish ret : " << ret << endl << endl;
393}
394
395void RilInterfaceTest::GetEmergencyListTest(int32_t slotId)
396{
397    cout << "RilInterfaceTest::GetEmergencyListTest -->" << endl;
398    int32_t ret = g_rilInterface->GetEmergencyCallList(slotId, GetSerialId());
399    cout << "RilInterfaceTest::GetEmergencyListTest finish ret : " << ret << endl << endl;
400}
401
402void RilInterfaceTest::SetEmergencyCallListTest(int32_t slotId)
403{
404    cout << "RilInterfaceTest::SetEmergencyCallListTest -->" << endl;
405    EmergencyInfoList emergencyInfoList;
406    EmergencyCall emergencyInfo = {};
407    emergencyInfo.index = 1;
408    emergencyInfo.total = 1;
409    emergencyInfo.eccNum = "120";
410    emergencyInfo.eccType = EccType::TYPE_CATEGORY;
411    emergencyInfo.simpresent = SimpresentType::TYPE_HAS_CARD;
412    emergencyInfo.mcc = "460";
413    emergencyInfo.abnormalService = AbnormalServiceType::TYPE_ALL;
414    emergencyInfoList.calls.push_back(emergencyInfo);
415    int32_t ret = g_rilInterface->SetEmergencyCallList(slotId, GetSerialId(), emergencyInfoList);
416    cout << "RilInterfaceTest::SetEmergencyCallListTest finish ret : " << ret << endl << endl;
417}
418
419void RilInterfaceTest::SetBarringPasswordTest(int32_t slotId)
420{
421    cout << "RilInterfaceTest::SetBarringPasswordTest -->" << endl;
422    SetBarringInfo setBarringInfo;
423    setBarringInfo.fac = "AB";
424
425    cout << "Please input old password:";
426    cin >> setBarringInfo.oldPassword;
427    cout << "Your input old password is : " << setBarringInfo.oldPassword << endl;
428
429    cout << "Please input new password:";
430    cin >> setBarringInfo.newPassword;
431    cout << "Your input new password is : " << setBarringInfo.newPassword << endl;
432    int32_t ret = g_rilInterface->SetBarringPassword(slotId, GetSerialId(), setBarringInfo);
433    cout << "RilInterfaceTest::SetBarringPasswordTest finish ret : " << ret << endl << endl;
434}
435
436void RilInterfaceTest::GetFailReasonTest(int32_t slotId)
437{
438    cout << "RilInterfaceTest::GetFailReasonTest -->" << endl;
439    int32_t ret = g_rilInterface->GetCallFailReason(slotId, GetSerialId());
440    cout << "RilInterfaceTest::GetFailReasonTest finish ret : " << ret << endl << endl;
441}
442
443void RilInterfaceTest::IccRilSimIoForAppTest(int32_t slotId)
444{
445    cout << "RilInterfaceTest::IccRilSimIoForAppTest -->" << endl;
446    cout << "176 : READ BINARY" << endl;
447    cout << "178 : READ RECORD" << endl;
448    cout << "192 : GET RESPONSE" << endl;
449    cout << "214 : UPDATE BINARY" << endl;
450    cout << "220 : UPDATE RECORD" << endl;
451    cout << "242 : STATUS" << endl;
452    cout << "203 : RETRIEVE DATA" << endl;
453    cout << "219 : SET DATA" << endl;
454    cout << "Please input command type:";
455    int32_t curCommand;
456    cin >> curCommand;
457    cout << "Your input command type is : " << curCommand << endl;
458    cout << "Please Input file id:";
459    int32_t fileId;
460    cin >> fileId;
461    cout << "Your input file id is : " << fileId << endl;
462    cout << "Please Input file path:";
463    string filePath;
464    cin >> filePath;
465    cout << "Your input file path is : " << filePath << endl;
466    cout << "Please Input p1:";
467    int32_t p1;
468    cin >> p1;
469    cout << "Your input p1 is : " << p1 << endl;
470    cout << "Please Input p2:";
471    int32_t p2;
472    cin >> p2;
473    cout << "Your input p2 is : " << p2 << endl;
474    cout << "Please Input p3:";
475    int32_t p3;
476    cin >> p3;
477    cout << "Your input p3 is : " << p3 << endl;
478    cout << "Please Input command data:";
479    string cmdData;
480    cin >> cmdData;
481    cout << "Your input command data is : " << cmdData << endl;
482    SimIoRequestInfo msg;
483    msg.command = curCommand;
484    msg.fileId = fileId;
485    msg.p1 = p1;
486    msg.p2 = p2;
487    msg.p3 = p3;
488    msg.data = cmdData;
489    msg.path = "3F00";
490    msg.pin2 = "";
491    int32_t ret = g_rilInterface->GetSimIO(slotId, GetSerialId(), msg);
492    cout << "RilInterfaceTest::IccRilSimIoForAppTest --> finish ret : " << ret << endl << endl;
493}
494
495void RilInterfaceTest::GetRilCmImsiForAppTest(int32_t slotId)
496{
497    cout << "RilInterfaceTest::GetRilCmImsiForAppTest -->" << endl;
498    int32_t ret = g_rilInterface->GetImsi(slotId, GetSerialId());
499    cout << "RilInterfaceTest::GetRilCmImsiForAppTest finish ret : " << ret << endl << endl;
500}
501
502void RilInterfaceTest::GetRilCmSignalIntensityTest(int32_t slotId)
503{
504    cout << "RilInterfaceTest::GetRilCmSignalIntensityTest -->" << endl;
505    int32_t ret = g_rilInterface->GetSignalStrength(slotId, GetSerialId());
506    cout << "GetRilCmSignalIntensityTest finish ret : " << ret << endl << endl;
507}
508
509void RilInterfaceTest::GetRilCmIccCardStatusTest(int32_t slotId)
510{
511    cout << "RilInterfaceTest::GetRilCmIccCardStatusTest -->" << endl;
512    int32_t ret = g_rilInterface->GetSimStatus(slotId, GetSerialId());
513    cout << "RilInterfaceTest::GetRilCmIccCardStatusTest finish ret : " << ret << endl << endl;
514}
515
516void RilInterfaceTest::GetRilCmCsRegStatusTest(int32_t slotId)
517{
518    cout << "RilInterfaceTest::GetRilCmCsRegStatusTest -->" << endl;
519    int32_t ret = g_rilInterface->GetCsRegStatus(slotId, GetSerialId());
520    cout << "GetRilCmCsRegStatusTest finish ret : " << ret << endl << endl;
521}
522
523void RilInterfaceTest::GetRilCmPsRegStatusTest(int32_t slotId)
524{
525    cout << "RilInterfaceTest::GetRilCmPsRegStatusTest -->" << endl;
526    int32_t ret = g_rilInterface->GetPsRegStatus(slotId, GetSerialId());
527    cout << "GetRilCmPsRegStatusTest finish ret : " << ret << endl << endl;
528}
529
530void RilInterfaceTest::GetRilCmCellInfoListTest(int32_t slotId)
531{
532    cout << "RilInterfaceTest::GetRilCmCellInfoListTest -->" << endl;
533    int32_t ret = g_rilInterface->GetNeighboringCellInfoList(slotId, GetSerialId());
534    cout << "RilInterfaceTest::GetRilCmOperatorTest -->" << endl;
535    cout << "GetRilCmCellInfoListTest finish ret : " << ret << endl << endl;
536}
537
538void RilInterfaceTest::GetRilCurrentCellInfoTest(int32_t slotId)
539{
540    cout << "RilInterfaceTest::GetRilCurrentCellInfoTest -->" << endl;
541    int32_t ret = g_rilInterface->GetCurrentCellInfo(slotId, GetSerialId());
542    cout << "GetRilCurrentCellInfoTest finish ret : " << ret << endl << endl;
543}
544
545void RilInterfaceTest::GetRilCmOperatorTest(int32_t slotId)
546{
547    cout << "RilInterfaceTest::GetRilCmOperatorTest -->" << endl;
548    int32_t ret = g_rilInterface->GetOperatorInfo(slotId, GetSerialId());
549    cout << "GetRilCmOperatorTest finish ret : " << ret << endl << endl;
550}
551
552void RilInterfaceTest::GetRilNetworkSearchInfoTest(int32_t slotId)
553{
554    cout << "RilInterfaceTest::GetRilNetworkSearchInfoTest -->" << endl;
555    int32_t ret = g_rilInterface->GetNetworkSearchInformation(slotId, GetSerialId());
556    cout << "GetRilNetworkSearchInfoTest finish ret : " << ret << endl << endl;
557}
558
559void RilInterfaceTest::GetRilNetworkSelectionModeTest(int32_t slotId)
560{
561    cout << "RilInterfaceTest::GetRilNetworkSelectionModeTest -->" << endl;
562    int32_t ret = g_rilInterface->GetNetworkSelectionMode(slotId, GetSerialId());
563    cout << "GetRilNetworkSelectionModeTest finish ret : " << ret << endl << endl;
564}
565
566void RilInterfaceTest::GetRilPreferredNetwrokTest(int32_t slotId)
567{
568    cout << "RilInterfaceTest::GetRilPreferredNetwrokTest -->" << endl;
569    int32_t ret = g_rilInterface->GetPreferredNetwork(slotId, GetSerialId());
570    cout << "GetRilPreferredNetwrokTest finish ret : " << ret << endl << endl;
571}
572
573void RilInterfaceTest::SetRilPreferredNetworkTest(int32_t slotId)
574{
575    cout << "RilInterfaceTest::SetRilPreferredNetworkTest -->" << endl;
576
577    int32_t preferredNetwork;
578    cout << "please enter the preferredNetwork:";
579    cin >> preferredNetwork;
580    cout << preferredNetwork << endl;
581
582    int32_t ret = g_rilInterface->SetPreferredNetwork(slotId, GetSerialId(), preferredNetwork);
583    cout << "SetRilPreferredNetworkTest finish ret : " << ret << endl << endl;
584}
585
586void RilInterfaceTest::SetRilLocationUpdateTest(int32_t slotId)
587{
588    cout << "RilInterfaceTest::SetRilLocationUpdateTest -->" << endl;
589
590    int32_t mode;
591    cout << "please enter the mode[0-2]:";
592    cin >> mode;
593    cout << mode << endl;
594
595    int32_t ret = g_rilInterface->SetLocateUpdates(slotId, GetSerialId(), static_cast<RilRegNotifyMode>(mode));
596    cout << "SetRilLocationUpdateTest finish ret : " << ret << endl << endl;
597}
598
599void RilInterfaceTest::SetRilNotificationFilterTest(int32_t slotId)
600{
601    cout << "RilInterfaceTest::SetRilNotificationFilterTest -->" << endl;
602
603    int32_t filter;
604    cout << "please enter the filter:";
605    cin >> filter;
606    cout << filter << endl;
607
608    int32_t ret = g_rilInterface->SetNotificationFilter(slotId, GetSerialId(), filter);
609    cout << "SetRilNotificationFilterTest finish ret : " << ret << endl << endl;
610}
611
612void RilInterfaceTest::SetRilDeviceStateTest(int32_t slotId)
613{
614    cout << "RilInterfaceTest::SetRilDeviceStateTest -->" << endl;
615
616    int32_t deviceStateType;
617    bool deviceStateOn;
618
619    cout << "please enter the deviceStateType:" << endl;
620    cin >> deviceStateType;
621    cout << deviceStateType << endl;
622    cout << "please enter the deviceStateOn:" << endl;
623    cin >> deviceStateOn;
624    cout << deviceStateOn << endl;
625
626    int32_t ret = g_rilInterface->SetDeviceState(slotId, GetSerialId(), deviceStateType, deviceStateOn);
627    cout << "SetRilDeviceStateTest finish ret : " << ret << endl << endl;
628}
629
630void RilInterfaceTest::SetNrOptionModeTest(int32_t slotId)
631{
632    cout << "RilInterfaceTest::SetNrOptionModeTest -->" << endl;
633
634    int32_t mode;
635    cout << "please enter the mode:" << endl;
636    cin >> mode;
637    cout << mode << endl;
638
639    int32_t ret = g_rilInterface->SetNrOptionMode(slotId, GetSerialId(), mode);
640    cout << "SetNrOptionModeTest finish ret : " << ret << endl << endl;
641}
642
643void RilInterfaceTest::GetNrOptionModeTest(int32_t slotId)
644{
645    cout << "RilInterfaceTest::GetNrOptionModeTest -->" << endl;
646    int32_t ret = g_rilInterface->GetNrOptionMode(slotId, GetSerialId());
647    cout << "GetNrOptionModeTest finish ret : " << ret << endl << endl;
648}
649
650void RilInterfaceTest::GetRrcConnectionStateTest(int32_t slotId)
651{
652    cout << "RilInterfaceTest::GetRrcConnectionStateTest -->" << endl;
653    int32_t ret = g_rilInterface->GetRrcConnectionState(slotId, GetSerialId());
654    cout << "GetRrcConnectionStateTest finish ret : " << ret << endl << endl;
655}
656
657void RilInterfaceTest::GetNrSsbIdTest(int32_t slotId)
658{
659    cout << "RilInterfaceTest::GetNrSsbIdTest -->" << endl;
660    int32_t ret = g_rilInterface->GetNrSsbId(slotId, GetSerialId());
661    cout << "GetNrSsbIdTest finish ret : " << ret << endl << endl;
662}
663
664void RilInterfaceTest::SetRilNetworkSelectionModeTest(int32_t slotId)
665{
666    cout << "RilInterfaceTest::SetRilNetworkSelectionModeTest -->" << endl;
667
668    int32_t mode;
669    std::string oper;
670    int64_t flag;
671    cout << "please enter the mode:";
672    cin >> mode;
673    cout << mode << endl;
674
675    if (mode != 0) {
676        cout << "please enter the operator:";
677        cin >> oper;
678        cout << oper << endl;
679    }
680    cout << "please enter the flag:";
681    cin >> flag;
682    cout << flag << endl;
683    SetNetworkModeInfo networkModeInfo = {};
684    networkModeInfo.selectMode = mode;
685    networkModeInfo.oper = oper;
686    networkModeInfo.flag = flag;
687    int32_t ret = g_rilInterface->SetNetworkSelectionMode(slotId, GetSerialId(), networkModeInfo);
688    cout << "SetRilNetworkSelectionModeTest finish ret : " << ret << endl << endl;
689}
690
691void RilInterfaceTest::GetPhysicalChannelConfigTest(int32_t slotId)
692{
693    cout << "RilInterfaceTest::GetPhysicalChannelConfigTest -->" << endl;
694    int32_t ret = g_rilInterface->GetPhysicalChannelConfig(slotId, GetSerialId());
695    cout << "GetPhysicalChannelConfigTest finish ret : " << ret << endl << endl;
696}
697
698void RilInterfaceTest::SendRilCmSmsTest(int32_t slotId)
699{
700    cout << "RilInterfaceTest::SendRilCmSmsTest -->" << endl;
701    string smscPdu;
702    string pdu;
703    int32_t state;
704
705    cout << "please entry smsc(Pdu):" << endl;
706    cin >> smscPdu;
707    cout << "please entry sms message(Pdu):" << endl;
708    cin >> pdu;
709    cout << "please entry sms message state:" << endl;
710    cin >> state;
711
712    GsmSmsMessageInfo gsmSmsMessageInfo;
713    gsmSmsMessageInfo.serial = GetSerialId();
714    gsmSmsMessageInfo.smscPdu = smscPdu;
715    gsmSmsMessageInfo.pdu = pdu;
716    gsmSmsMessageInfo.state = state;
717
718    int32_t ret = g_rilInterface->SendGsmSms(slotId, GetSerialId(), gsmSmsMessageInfo);
719    cout << "RilInterfaceTest::SendRilCmSmsTest --> SendRilCmSmsTest finished ret:" << ret << endl << endl;
720}
721
722void RilInterfaceTest::SendRilCmSmsMoreModeTest(int32_t slotId)
723{
724    cout << "RilInterfaceTest::SendRilCmSmsMoreModeTest -->" << endl;
725    string smscPdu;
726    string pdu;
727    int32_t state;
728
729    cout << "please entry smsc(Pdu):" << endl;
730    cin >> smscPdu;
731    cout << "please entry sms message(Pdu):" << endl;
732    cin >> pdu;
733    cout << "please entry sms message state:" << endl;
734    cin >> state;
735
736    GsmSmsMessageInfo gsmSmsMessageInfo;
737    gsmSmsMessageInfo.serial = GetSerialId();
738    gsmSmsMessageInfo.smscPdu = smscPdu;
739    gsmSmsMessageInfo.pdu = pdu;
740    gsmSmsMessageInfo.state = state;
741
742    int32_t ret = g_rilInterface->SendGsmSms(slotId, GetSerialId(), gsmSmsMessageInfo);
743    cout << "RilInterfaceTest::SendRilCmSmsMoreModeTest --> SendRilCmSmsMoreModeTest finished ret:" << ret << endl
744         << endl;
745}
746
747void RilInterfaceTest::SendSmsAckTest(int32_t slotId)
748{
749    cout << "RilInterfaceTest::SendSmsAckTest -->" << endl;
750    const int32_t memExceededCause = 0xD3;
751    bool success;
752    int32_t cause;
753    string pdu;
754
755    cout << "send sms ack types are as follows:" << endl
756         << "\t[0]: report OK" << endl
757         << "\t[1]: report ERROR(Memory Capacity Exceeded)" << endl;
758    int32_t ackType = InputInt32(0, 1, "ack type");
759    if (ackType == 1) {
760        success = 0;
761        cause = memExceededCause;
762    } else {
763        success = 1;
764        cause = 0;
765    }
766    cout << "please entry sms message(Pdu):" << endl;
767    cin >> pdu;
768
769    ModeData modeData;
770    modeData.serial = GetSerialId();
771    modeData.result = success;
772    modeData.mode = cause;
773    modeData.pdu = pdu;
774
775    int32_t ret = g_rilInterface->SendSmsAck(slotId, GetSerialId(), modeData);
776    cout << "RilInterfaceTest::SendSmsAckTest --> SendSmsAckTest finished ret:" << ret << endl << endl;
777}
778
779void RilInterfaceTest::GetSmscAddrTest(int32_t slotId)
780{
781    cout << "RilInterfaceTest::GetSmscAddrTest -->" << endl;
782    int32_t ret = g_rilInterface->GetSmscAddr(slotId, GetSerialId());
783    cout << "RilInterfaceTest::GetSmscAddrTest --> GetSmscAddrTest finished ret:" << ret << endl << endl;
784}
785
786void RilInterfaceTest::SetSmscAddrTest(int32_t slotId)
787{
788    cout << "RilInterfaceTest::SetSmscAddrTest -->" << endl;
789    int32_t tosca;
790    string address;
791    cout << "please entry tosca:" << endl;
792    cin >> tosca;
793    cout << "please entry smsc:" << endl;
794    cin >> address;
795
796    ServiceCenterAddress serviceCenterAddress;
797    serviceCenterAddress.serial = GetSerialId();
798    serviceCenterAddress.tosca = tosca;
799    serviceCenterAddress.address = address;
800
801    int32_t ret = g_rilInterface->SetSmscAddr(slotId, GetSerialId(), serviceCenterAddress);
802    cout << "RilInterfaceTest::SetSmscAddrTest --> SetSmscAddrTest finished ret:" << ret << endl << endl;
803}
804
805void RilInterfaceTest::GetImeiTest(int32_t slotId)
806{
807    cout << "RilInterfaceTest::GetImeiTest -->" << endl;
808    int32_t ret = g_rilInterface->GetImei(slotId, GetSerialId());
809    cout << "RilInterfaceTest::GetImeiTest finish ret : " << ret << endl << endl;
810}
811
812void RilInterfaceTest::GetImeiStressTest(int32_t slotId)
813{
814    cout << "RilInterfaceTest::GetImeiStressTest -->" << endl;
815    for (int32_t i = 0; i < STRESS_TEST_NUM; i++) {
816        g_rilInterface->GetImei(slotId, GetSerialId());
817    }
818    cout << "RilInterfaceTest::GetImeiStressTest --> GetImeiStressTest finished" << endl << endl;
819}
820
821void RilInterfaceTest::GetImeiSvTest(int32_t slotId)
822{
823    cout << "RilInterfaceTest::GetImeiSvTest -->" << endl;
824    int32_t ret = g_rilInterface->GetImeiSv(slotId, GetSerialId());
825    cout << "RilInterfaceTest::GetImeiSvTest finish ret : " << ret << endl << endl;
826}
827
828void RilInterfaceTest::GetImeiSvStressTest(int32_t slotId)
829{
830    cout << "RilInterfaceTest::GetImeiSvStressTest -->" << endl;
831    for (int32_t i = 0; i < STRESS_TEST_NUM; i++) {
832        g_rilInterface->GetImeiSv(slotId, GetSerialId());
833    }
834    cout << "RilInterfaceTest::GetImeiSvStressTest --> GetImeiSvStressTest finished" << endl << endl;
835}
836
837void RilInterfaceTest::GetMeidTest(int32_t slotId)
838{
839    cout << "RilInterfaceTest::GetMeidTest -->" << endl;
840    int32_t ret = g_rilInterface->GetMeid(slotId, GetSerialId());
841    cout << "RilInterfaceTest::GetMeidTestfinish ret : " << ret << endl << endl;
842}
843
844void RilInterfaceTest::GetVoiceRadioTechnologyTest(int32_t slotId)
845{
846    cout << "RilInterfaceTest::GetVoiceRadioTechnologyTest -->" << endl;
847    int32_t ret = g_rilInterface->GetVoiceRadioTechnology(slotId, GetSerialId());
848    cout << "RilInterfaceTest::GetVoiceRadioTechnologyTestfinish ret : " << ret << endl << endl;
849}
850
851void RilInterfaceTest::GetBasebandVersionTest(int32_t slotId)
852{
853    cout << "RilInterfaceTest::GetBasebandVersionTest -->" << endl;
854    int32_t ret = g_rilInterface->GetBasebandVersion(slotId, GetSerialId());
855    cout << "RilInterfaceTest::GetBasebandVersionTestfinish ret : " << ret << endl << endl;
856}
857
858void RilInterfaceTest::ShutDownTest(int32_t slotId)
859{
860    cout << "RilInterfaceTest::ShutDownTest -->" << endl;
861    int32_t ret = g_rilInterface->ShutDown(slotId, GetSerialId());
862    cout << "RilInterfaceTest::ShutDownTestfinish ret : " << ret << endl << endl;
863}
864
865void RilInterfaceTest::SetRadioStateTest(int32_t slotId)
866{
867    cout << "RilInterfaceTest::SetRadioStateTest -->" << endl;
868    int32_t fun = InputInt32(0, 0x7fffffff, "fun");
869    int32_t ret = g_rilInterface->SetRadioState(slotId, GetSerialId(), fun, 0);
870    cout << "RilInterfaceTest::SetRadioStateTest finish ret : " << ret << endl << endl;
871}
872
873void RilInterfaceTest::SetRadioStateStressTest(int32_t slotId)
874{
875    cout << "RilInterfaceTest::SetRadioStateStressTest -->" << endl;
876    for (int32_t i = 0; i < STRESS_TEST_NUM; i++) {
877        g_rilInterface->SetRadioState(slotId, GetSerialId(), 0, 0);
878        g_rilInterface->SetRadioState(slotId, GetSerialId(), 1, 0);
879    }
880    cout << "RilInterfaceTest::SetRadioStateStressTest --> SetRadioStateStressTest finished" << endl << endl;
881}
882
883void RilInterfaceTest::GetRadioStateTest(int32_t slotId)
884{
885    cout << "RilInterfaceTest::GetRadioStateTest -->" << endl;
886    int32_t ret = g_rilInterface->GetRadioState(slotId, GetSerialId());
887    cout << "RilInterfaceTest::GetRadioStateTest finish ret : " << ret << endl << endl;
888}
889
890void RilInterfaceTest::ActivatePdpContextTest(int32_t slotId)
891{
892    cout << "RilInterfaceTest::ActivatePdpContextTest -->" << endl;
893    int32_t serialId = GetSerialId();
894    DataProfileDataInfo dataProfileInfo;
895    dataProfileInfo.profileId = 0;
896    dataProfileInfo.password = "";
897    dataProfileInfo.authenticationType = 0;
898    dataProfileInfo.userName = "";
899    dataProfileInfo.apn = "cmnet";
900    dataProfileInfo.protocol = "IPV4V6";
901    dataProfileInfo.roamingProtocol = "IPV4V6";
902
903    cout << "please enter the apn:";
904    cin >> dataProfileInfo.apn;
905    cout << "please enter the username:";
906    cin >> dataProfileInfo.userName;
907    cout << "please enter the password:";
908    cin >> dataProfileInfo.password;
909    cout << "please enter the protocol:";
910    cin >> dataProfileInfo.protocol;
911
912    DataCallInfo dataCallInfo;
913    dataCallInfo.serial = serialId;
914    dataCallInfo.radioTechnology = 0;
915    dataCallInfo.dataProfileInfo = dataProfileInfo;
916    dataCallInfo.roamingAllowed = true;
917    dataCallInfo.isRoaming = false;
918    int32_t ret = g_rilInterface->ActivatePdpContext(slotId, serialId, dataCallInfo);
919    cout << "ActivatePdpContextTest finished ret : " << ret << endl << endl;
920}
921
922void RilInterfaceTest::SetDataProfileInfoTest(int32_t slotId)
923{
924    cout << "RilInterfaceTest::SetDataProfileInfoTest -->" << endl;
925    int32_t size = 0;
926    cout << "please enter the profile size:";
927    cin >> size;
928    int32_t serialId = GetSerialId();
929    DataProfilesInfo dataProfilesInfo;
930    dataProfilesInfo.serial = serialId;
931    dataProfilesInfo.profilesSize = size;
932    for (int32_t i = 0; i < size; i++) {
933        string apn;
934        cout << "please enter the apn:";
935        cin >> apn;
936        string username;
937
938        cout << "please enter the username:";
939        cin >> username;
940
941        string dataInfoPwd;
942        cout << "please enter the password:";
943        cin >> dataInfoPwd;
944
945        string protocol;
946        cout << "please enter the protocol:";
947        cin >> protocol;
948        DataProfileDataInfo dataInfo;
949        dataInfo.serial = serialId;
950        dataInfo.profileId = i;
951        dataInfo.apn = apn;
952        dataInfo.protocol = protocol;
953        dataInfo.roamingProtocol = "IPV4V6";
954        dataInfo.authenticationType = 0;
955        dataInfo.userName = username;
956        dataInfo.password = dataInfoPwd;
957        dataProfilesInfo.profiles.push_back(dataInfo);
958    }
959    int32_t ret = g_rilInterface->SetDataProfileInfo(slotId, serialId, dataProfilesInfo);
960    cout << "SetDataProfileInfoTest finished ret : " << ret << endl << endl;
961}
962
963void RilInterfaceTest::SetDataPermittedTest(int32_t slotId)
964{
965    cout << "RilInterfaceTest::SetDataPermittedTestTest -->" << endl;
966    int32_t enabled = 0;
967    cout << "please enter the enabled:";
968    cin >> enabled;
969    int32_t ret = g_rilInterface->SetDataPermitted(slotId, GetSerialId(), enabled);
970    cout << "SetDataPermittedTest finished ret : " << ret << endl << endl;
971}
972
973void RilInterfaceTest::SendDataPerformanceModeTest(int32_t slotId)
974{
975    cout << "RilInterfaceTest::SendDataPerformanceModeTest -->" << endl;
976    DataPerformanceInfo dataPerformanceInfo;
977    cout << "please enter the performanceEnable:";
978    cin >> dataPerformanceInfo.performanceEnable;
979    cout << "please enter the enforce:";
980    cin >> dataPerformanceInfo.enforce;
981    int32_t ret = g_rilInterface->SendDataPerformanceMode(slotId, GetSerialId(), dataPerformanceInfo);
982    cout << "SendDataPerformanceModeTest finished ret : " << ret << endl << endl;
983}
984
985void RilInterfaceTest::SendDataSleepModeTest(int32_t slotId)
986{
987    cout << "RilInterfaceTest::SendDataSleepModeTest -->" << endl;
988    DataSleepInfo dataSleepInfo;
989    cout << "please enter the sleepEnable:";
990    cin >> dataSleepInfo.sleepEnable;
991    int32_t ret = g_rilInterface->SendDataSleepMode(slotId, GetSerialId(), dataSleepInfo);
992    cout << "SendDataSleepModeTest finished ret : " << ret << endl << endl;
993}
994
995void RilInterfaceTest::DeactivatePdpContextTest(int32_t slotId)
996{
997    cout << "RilInterfaceTest::DeactivatePdpContextTest -->" << endl;
998    UniInfo uniInfo;
999    cout << "please enter the cid:";
1000    cin >> uniInfo.gsmIndex;
1001    cout << "please enter the reason:";
1002    cin >> uniInfo.arg1;
1003    int32_t ret = g_rilInterface->DeactivatePdpContext(slotId, GetSerialId(), uniInfo);
1004    cout << "DeactivatePdpContextTest finished ret : " << ret << endl << endl;
1005}
1006
1007void RilInterfaceTest::GetPdpContextListTest(int32_t slotId)
1008{
1009    cout << "RilInterfaceTest::GetPdpContextListTest -->" << endl;
1010    int32_t serialId = GetSerialId();
1011    UniInfo uniInfo;
1012    uniInfo.serial = serialId;
1013    cout << "please enter the cid:";
1014    cin >> uniInfo.gsmIndex;
1015    int32_t ret = g_rilInterface->GetPdpContextList(slotId, serialId, uniInfo);
1016    cout << "GetPdpContextListTest finished ret : " << ret << endl << endl;
1017}
1018
1019void RilInterfaceTest::SetInitialApnTest(int32_t slotId)
1020{
1021    cout << "RilInterfaceTest::SetInitialApnTest -->" << endl;
1022    int32_t serialId = GetSerialId();
1023    DataProfileDataInfo dataProfileInfo;
1024    dataProfileInfo.profileId = 0;
1025    dataProfileInfo.password = "";
1026    dataProfileInfo.authenticationType = 0;
1027    dataProfileInfo.userName = "";
1028    dataProfileInfo.apn = "cmnet";
1029    dataProfileInfo.protocol = "IPV4V6";
1030    dataProfileInfo.roamingProtocol = "IPV4V6";
1031    dataProfileInfo.serial = serialId;
1032
1033    cout << "please enter the apn:";
1034    cin >> dataProfileInfo.apn;
1035    cout << "please enter the username:";
1036    cin >> dataProfileInfo.userName;
1037    cout << "please enter the password:";
1038    cin >> dataProfileInfo.password;
1039    cout << "please enter the protocol:";
1040    cin >> dataProfileInfo.protocol;
1041
1042    int32_t ret = g_rilInterface->SetInitApnInfo(slotId, serialId, dataProfileInfo);
1043    cout << "SetInitialApnTest finished ret : " << ret << endl << endl;
1044}
1045
1046void RilInterfaceTest::GetLinkBandwidthInfoTest(int32_t slotId)
1047{
1048    cout << "RilInterfaceTest::GetLinkBandwidthInfoTest -->" << endl;
1049    int32_t cid;
1050    cout << "please enter the cid:";
1051    cin >> cid;
1052    int32_t ret = g_rilInterface->GetLinkBandwidthInfo(slotId, GetSerialId(), cid);
1053    cout << "GetLinkBandwidthInfoTest finished ret : " << ret << endl << endl;
1054}
1055
1056void RilInterfaceTest::GetLinkCapabilityTest(int32_t slotId)
1057{
1058    cout << "RilInterfaceTest::GetLinkCapabilityTest -->" << endl;
1059    int32_t ret = g_rilInterface->GetLinkCapability(slotId, GetSerialId());
1060    cout << "GetLinkCapabilityTest finished ret : " << ret << endl << endl;
1061}
1062
1063void RilInterfaceTest::CleanAllConnectionsTest(int32_t slotId)
1064{
1065    cout << "RilInterfaceTest::CleanAllConnectionsTest -->" << endl;
1066    int32_t ret = g_rilInterface->CleanAllConnections(slotId, GetSerialId());
1067    cout << "CleanAllConnectionsTest finished ret : " << ret << endl << endl;
1068}
1069
1070void RilInterfaceTest::SetLinkBandwidthReportingRuleTest(int32_t slotId)
1071{
1072    cout << "RilInterfaceTest::SetLinkBandwidthReportingRuleTest -->" << endl;
1073    int32_t serialId = GetSerialId();
1074    uint32_t uplinkKbpsSize = sizeof(MAX_UPLINK_LINK_BANDWIDTH) / sizeof(int32_t);
1075    uint32_t downlinkKbpsSize = sizeof(MAX_DOWNLINK_LINK_BANDWIDTH) / sizeof(int32_t);
1076    DataLinkBandwidthReportingRule dLinkBandwidth;
1077    dLinkBandwidth.serial = serialId;
1078    dLinkBandwidth.rat = RAT_TYPE_LTE;
1079    dLinkBandwidth.delayMs = BANDWIDTH_HYSTERESIS_MS;
1080    dLinkBandwidth.delayUplinkKbps = BANDWIDTH_HYSTERESIS_KBPS;
1081    dLinkBandwidth.delayDownlinkKbps = BANDWIDTH_HYSTERESIS_KBPS;
1082    dLinkBandwidth.maximumUplinkKbpsSize = uplinkKbpsSize;
1083    dLinkBandwidth.maximumDownlinkKbpsSize = downlinkKbpsSize;
1084    for (uint32_t i = 0; i < uplinkKbpsSize; i++) {
1085        dLinkBandwidth.maximumUplinkKbps.push_back(MAX_UPLINK_LINK_BANDWIDTH[i]);
1086    }
1087    for (uint32_t i = 0; i < downlinkKbpsSize; i++) {
1088        dLinkBandwidth.maximumDownlinkKbps.push_back(MAX_DOWNLINK_LINK_BANDWIDTH[i]);
1089    }
1090    int32_t ret = g_rilInterface->SetLinkBandwidthReportingRule(slotId, serialId, dLinkBandwidth);
1091    cout << "SetLinkBandwidthReportingRuleTest finished ret : " << ret << endl << endl;
1092}
1093
1094void RilInterfaceTest::OnProcessInput(int32_t what)
1095{
1096    if (g_rilInterface == nullptr) {
1097        cout << "g_rilInterface is null";
1098        return;
1099    }
1100    auto itFunc = memberFuncMap_.find(what);
1101    if (itFunc != memberFuncMap_.end()) {
1102        auto memberFunc = itFunc->second;
1103        if (memberFunc != nullptr) {
1104            cout << "Please input slotId:";
1105            int32_t slotId;
1106            cin >> slotId;
1107            (this->*memberFunc)(slotId);
1108            return;
1109        }
1110    }
1111
1112    cout << "----> Unsupported Command!" << endl;
1113}
1114
1115void RilInterfaceTest::OnStressInput(int32_t what)
1116{
1117    if (g_rilInterface == nullptr) {
1118        cout << "g_rilInterface is null";
1119        return;
1120    }
1121    auto itFunc = stressMemberFuncMap_.find(what);
1122    if (itFunc != stressMemberFuncMap_.end()) {
1123        auto memberFunc = itFunc->second;
1124        if (memberFunc != nullptr) {
1125            cout << "Please input slotId:";
1126            int32_t slotId;
1127            cin >> slotId;
1128            (this->*memberFunc)(slotId);
1129            return;
1130        }
1131    }
1132    cout << "----> Unsupported Command!" << endl;
1133}
1134
1135void RilInterfaceTest::SimOpenLogicalChannelTest(int32_t slotId)
1136{
1137    cout << "RilInterfaceTest::SimOpenLogicalChannelTest -->" << endl;
1138    std::string appId;
1139    int32_t p2;
1140    cout << "input appId:";
1141    cin >> appId;
1142    cout << "input p2:";
1143    cin >> p2;
1144    int32_t ret = g_rilInterface->SimOpenLogicalChannel(slotId, GetSerialId(), appId, p2);
1145    cout << "RilInterfaceTest::SimOpenLogicalChannelTest finish ret : " << ret << endl << endl;
1146}
1147
1148void RilInterfaceTest::SimCloseLogicalChannelTest(int32_t slotId)
1149{
1150    cout << "RilInterfaceTest::SimCloseLogicalChannelTest -->" << endl;
1151    int32_t channelId;
1152    cout << "input channelId:";
1153    cin >> channelId;
1154    int32_t ret = g_rilInterface->SimCloseLogicalChannel(slotId, GetSerialId(), channelId);
1155    cout << "RilInterfaceTest::SimCloseLogicalChannelTest finish ret : " << ret << endl << endl;
1156}
1157
1158void RilInterfaceTest::InputTransmitApduChannelParam(ApduSimIORequestInfo &reqInfo)
1159{
1160    cout << "input channelId:";
1161    cin >> reqInfo.channelId;
1162    cout << "input type:";
1163    cin >> reqInfo.type;
1164    cout << "input instruction:";
1165    cin >> reqInfo.instruction;
1166    cout << "input p1:";
1167    cin >> reqInfo.p1;
1168    cout << "input p2:";
1169    cin >> reqInfo.p2;
1170    cout << "input p3:";
1171    cin >> reqInfo.p3;
1172}
1173
1174void RilInterfaceTest::SimTransmitApduLogicalChannelTest(int32_t slotId)
1175{
1176    cout << "RilInterfaceTest::SimTransmitApduLogicalChannelTest -->" << endl;
1177    ApduSimIORequestInfo reqInfo = ApduSimIORequestInfo();
1178    InputTransmitApduChannelParam(reqInfo);
1179    int32_t ret = g_rilInterface->SimTransmitApduLogicalChannel(slotId, GetSerialId(), reqInfo);
1180    cout << "RilInterfaceTest::SimTransmitApduLogicalChannelTest finish ret : " << ret << endl << endl;
1181}
1182
1183void RilInterfaceTest::SimTransmitApduBasicChannelTest(int32_t slotId)
1184{
1185    cout << "RilInterfaceTest::SimTransmitApduBasicChannelTest -->" << endl;
1186    ApduSimIORequestInfo reqInfo = ApduSimIORequestInfo();
1187    InputTransmitApduChannelParam(reqInfo);
1188    int32_t ret = g_rilInterface->SimTransmitApduBasicChannel(slotId, GetSerialId(), reqInfo);
1189    cout << "RilInterfaceTest::SimTransmitApduBasicChannelTest finish ret : " << ret << endl << endl;
1190}
1191
1192void RilInterfaceTest::SimAuthenticationTest(int32_t slotId)
1193{
1194    cout << "RilInterfaceTest::SimAuthenticationTest -->" << endl;
1195    SimAuthenticationRequestInfo reqInfo = SimAuthenticationRequestInfo();
1196    cout << "input authType:" << std::endl;
1197    cout << "SIM_AUTH_EAP_SIM_TYPE is 128" << std::endl;
1198    cout << "SIM_AUTH_EAP_AKA_TYPE is 129" << std::endl;
1199    cin >> reqInfo.serial;
1200    cout << "input aid:" << std::endl;
1201    cout << "USIM_AID" << std::endl;
1202    cout << "CDMA_FAKE_AID" << std::endl;
1203    cout << "GSM_FAKE_AID" << std::endl;
1204    cin >> reqInfo.aid;
1205    cout << "input authData:" << std::endl;
1206    cin >> reqInfo.authData;
1207    int32_t ret = g_rilInterface->SimAuthentication(slotId, GetSerialId(), reqInfo);
1208    cout << "RilInterfaceTest::SimAuthenticationTest finish ret : " << ret << endl << endl;
1209}
1210
1211void RilInterfaceTest::SendSimMatchedOperatorInfoTest(int32_t slotId)
1212{
1213    cout << "RilInterfaceTest::SendSimMatchedOperatorInfoTest -->" << endl;
1214    NcfgOperatorInfo reqInfo = NcfgOperatorInfo();
1215    cout << "input operName:" << std::endl;
1216    cin >> reqInfo.operName;
1217    cout << "input operKey:" << std::endl;
1218    cin >> reqInfo.operKey;
1219    cout << "input state:" << std::endl;
1220    cin >> reqInfo.state;
1221    cout << "input reserve:" << std::endl;
1222    cin >> reqInfo.reserve;
1223    int32_t ret = g_rilInterface->SendSimMatchedOperatorInfo(slotId, GetSerialId(), reqInfo);
1224    cout << "RilInterfaceTest::SendSimMatchedOperatorInfoTest finish ret : " << ret << endl << endl;
1225}
1226
1227void RilInterfaceTest::SetActiveSimTest(int32_t slotId)
1228{
1229    cout << "RilInterfaceTest::SetActiveSimTest -->" << endl;
1230    int32_t index;
1231    cout << "please enter the index:";
1232    cin >> index;
1233    int32_t enable;
1234    cout << "please enter the enable:";
1235    cin >> enable;
1236    int32_t ret = g_rilInterface->SetActiveSim(slotId, GetSerialId(), index, enable);
1237    cout << "RilInterfaceTest::SetActiveSimTest finish ret : " << ret << endl << endl;
1238}
1239
1240void RilInterfaceTest::UnlockSimLockTest(int32_t slotId)
1241{
1242    cout << "RilInterfaceTest::UnlockSimLockTest -->" << endl;
1243    int lockType;
1244    cout << "input lockType:";
1245    cin >> lockType;
1246    string password = "";
1247    cout << "input password:";
1248    cin >> password;
1249    int32_t ret = g_rilInterface->UnlockSimLock(slotId, GetSerialId(), lockType, password);
1250    cout << "RilInterfaceTest::UnlockSimLockTest finish ret : " << ret << endl << endl;
1251}
1252
1253void RilInterfaceTest::UnLockPINTest(int32_t slotId)
1254{
1255    cout << "RilInterfaceTest::UnLockPINTest -->" << endl;
1256    std::string pin;
1257    cout << "please enter the pin:";
1258    cin >> pin;
1259    int32_t ret = g_rilInterface->UnlockPin(slotId, GetSerialId(), pin);
1260    cout << "RilInterfaceTest::UnLockPINTest finish ret : " << ret << endl << endl;
1261}
1262
1263void RilInterfaceTest::UnLockPIN2Test(int32_t slotId)
1264{
1265    cout << "RilInterfaceTest::UnLockPIN2Test -->" << endl;
1266    std::string pin2;
1267    cout << "please enter the pin2:";
1268    cin >> pin2;
1269    int32_t ret = g_rilInterface->UnlockPin2(slotId, GetSerialId(), pin2);
1270    cout << "RilInterfaceTest::UnLockPIN2Test finish ret : " << ret << endl << endl;
1271}
1272
1273void RilInterfaceTest::UnLockPUKTest(int32_t slotId)
1274{
1275    cout << "RilInterfaceTest::UnLockPUKTest -->" << endl;
1276    std::string puk;
1277    cout << "please enter the puk:";
1278    cin >> puk;
1279    std::string pin;
1280    cout << "please enter the pin:";
1281    cin >> pin;
1282    int32_t ret = g_rilInterface->UnlockPuk(slotId, GetSerialId(), puk, pin);
1283    cout << "RilInterfaceTest::UnLockPUKTest finish ret : " << ret << endl << endl;
1284}
1285
1286void RilInterfaceTest::UnLockPUK2Test(int32_t slotId)
1287{
1288    cout << "RilInterfaceTest::UnLockPUK2Test -->" << endl;
1289    std::string puk2;
1290    cout << "please enter the puk2:";
1291    cin >> puk2;
1292    std::string pin2;
1293    cout << "please enter the pin2:";
1294    cin >> pin2;
1295    int32_t ret = g_rilInterface->UnlockPuk2(slotId, GetSerialId(), puk2, pin2);
1296    cout << "RilInterfaceTest::UnLockPUK2Test finish ret : " << ret << endl << endl;
1297}
1298
1299void RilInterfaceTest::ChangeSimPasswordTest(int32_t slotId)
1300{
1301    cout << "RilInterfaceTest::ChangeSimPasswordTest -->" << endl;
1302    std::string fac;
1303    cout << "please enter the fac, SC for pin1, FD for pin2:";
1304    cin >> fac;
1305    std::string oldPassword;
1306    cout << "please enter the oldPassword:";
1307    cin >> oldPassword;
1308    std::string newPassword;
1309    cout << "please enter the newPassword:";
1310    cin >> newPassword;
1311    SimPasswordInfo simPassword;
1312    simPassword.fac = fac;
1313    simPassword.oldPassword = oldPassword;
1314    simPassword.newPassword = newPassword;
1315    simPassword.passwordLength = newPassword.length();
1316    int32_t ret = g_rilInterface->ChangeSimPassword(slotId, GetSerialId(), simPassword);
1317    cout << "RilInterfaceTest::ChangeSimPasswordTest finish ret : " << ret << endl << endl;
1318}
1319
1320void RilInterfaceTest::SetSimLockTest(int32_t slotId)
1321{
1322    cout << "RilInterfaceTest::SetSimLockTest -->" << endl;
1323    std::string fac;
1324    cout << "please enter the fac, SC for pin1, FD for pin2:";
1325    cin >> fac;
1326    int32_t mode;
1327    cout << "please enter the mode:";
1328    cin >> mode;
1329    std::string password;
1330    cout << "please enter the password:";
1331    cin >> password;
1332    SimLockInfo simLockInfo;
1333    simLockInfo.fac = fac;
1334    simLockInfo.mode = mode;
1335    simLockInfo.classx = 0;
1336    simLockInfo.passwd = password;
1337    int32_t ret = g_rilInterface->SetSimLock(slotId, GetSerialId(), simLockInfo);
1338    cout << "RilInterfaceTest::SetSimLockTest finish ret : " << ret << endl << endl;
1339}
1340
1341void RilInterfaceTest::GetSimLockStatusTest(int32_t slotId)
1342{
1343    cout << "RilInterfaceTest::GetSimLockStatusTest -->" << endl;
1344    std::string fac;
1345    cout << "please enter the fac, SC for pin1, FD for pin2:";
1346    cin >> fac;
1347    SimLockInfo simLockInfo;
1348    simLockInfo.fac = fac;
1349    simLockInfo.mode = SIM_LOCK_MODE_QUERY;
1350    simLockInfo.classx = 0;
1351    int32_t ret = g_rilInterface->GetSimLockStatus(slotId, GetSerialId(), simLockInfo);
1352    cout << "RilInterfaceTest::GetSimLockStatusTest finish ret : " << ret << endl << endl;
1353}
1354
1355void RilInterfaceTest::SendTerminalResponseCmdTest(int32_t slotId)
1356{
1357    cout << "RilInterfaceTest::SendTerminalResponseCmdTest -->" << endl;
1358    std::string cmd;
1359    cout << "please enter terminal response command:";
1360    cin >> cmd;
1361    int32_t ret = g_rilInterface->SimStkSendTerminalResponse(slotId, GetSerialId(), cmd);
1362    cout << "RilInterfaceTest::SendTerminalResponseCmdTest finish ret : " << ret << endl << endl;
1363}
1364
1365void RilInterfaceTest::SendEnvelopeCmdTest(int32_t slotId)
1366{
1367    cout << "RilInterfaceTest::SendEnvelopeCmdTest -->" << endl;
1368    std::string cmd;
1369    cout << "please enter envelope command:";
1370    cin >> cmd;
1371    int32_t ret = g_rilInterface->SimStkSendEnvelope(slotId, GetSerialId(), cmd);
1372    cout << "RilInterfaceTest::SendEnvelopeCmdTest finish ret : " << ret << endl << endl;
1373}
1374
1375void RilInterfaceTest::SendCallSetupRequestResultTest(int32_t slotId)
1376{
1377    cout << "RilInterfaceTest::SendCallSetupRequestResultTest -->" << endl;
1378    int32_t accept;
1379    cout << "please enter call setup request result:";
1380    cin >> accept;
1381    int32_t ret = g_rilInterface->SimStkSendCallSetupRequestResult(slotId, GetSerialId(), accept);
1382    cout << "RilInterfaceTest::SendCallSetupRequestResultTest finish ret : " << ret << endl << endl;
1383}
1384
1385void RilInterfaceTest::SimStkIsReadyTest(int32_t slotId)
1386{
1387    cout << "RilInterfaceTest::SimStkIsReadyTest -->" << endl;
1388    int32_t ret = g_rilInterface->SimStkIsReady(slotId, GetSerialId());
1389    cout << "RilInterfaceTest::SimStkIsReadyTest finish ret : " << ret << endl << endl;
1390}
1391
1392void RilInterfaceTest::OnInitStressInterface()
1393{
1394    stressMemberFuncMap_[HREQ_CALL_DIAL] = &RilInterfaceTest::RilCmDialStressTest;
1395    stressMemberFuncMap_[HREQ_MODEM_GET_IMEI] = &RilInterfaceTest::GetImeiStressTest;
1396    stressMemberFuncMap_[HREQ_MODEM_GET_IMEISV] = &RilInterfaceTest::GetImeiSvStressTest;
1397    stressMemberFuncMap_[HREQ_MODEM_SET_RADIO_STATUS] = &RilInterfaceTest::SetRadioStateStressTest;
1398}
1399
1400void RilInterfaceTest::OnInitCallProcessInterface()
1401{
1402    // // call
1403    memberFuncMap_[HREQ_CALL_GET_CALL_LIST] = &RilInterfaceTest::GetCallListTest;
1404    memberFuncMap_[HREQ_CALL_DIAL] = &RilInterfaceTest::RilCmDialTest;
1405    memberFuncMap_[HREQ_CALL_HANGUP] = &RilInterfaceTest::HangupTest;
1406    memberFuncMap_[HREQ_CALL_REJECT] = &RilInterfaceTest::RejectTest;
1407    memberFuncMap_[HREQ_CALL_ANSWER] = &RilInterfaceTest::AnswerCallTest;
1408    memberFuncMap_[HREQ_CALL_HOLD_CALL] = &RilInterfaceTest::HoldCallTest;
1409    memberFuncMap_[HREQ_CALL_UNHOLD_CALL] = &RilInterfaceTest::UnHoldCallTest;
1410    memberFuncMap_[HREQ_CALL_SWITCH_CALL] = &RilInterfaceTest::SwitchCallTest;
1411
1412    memberFuncMap_[HREQ_CALL_COMBINE_CONFERENCE] = &RilInterfaceTest::RilCmJoinCallTest;
1413    memberFuncMap_[HREQ_CALL_SEPARATE_CONFERENCE] = &RilInterfaceTest::RilCmSplitCallTest;
1414
1415    memberFuncMap_[HREQ_CALL_CALL_SUPPLEMENT] = &RilInterfaceTest::CallSupplementTest;
1416    memberFuncMap_[HREQ_CALL_SEND_DTMF] = &RilInterfaceTest::SendDtmfTest;
1417    memberFuncMap_[HREQ_CALL_START_DTMF] = &RilInterfaceTest::StartDtmfTest;
1418    memberFuncMap_[HREQ_CALL_STOP_DTMF] = &RilInterfaceTest::StopDtmfTest;
1419
1420    memberFuncMap_[HREQ_CALL_SET_USSD] = &RilInterfaceTest::SetUssdCusdTest;
1421    memberFuncMap_[HREQ_CALL_GET_USSD] = &RilInterfaceTest::GetUssdCusdTest;
1422
1423    memberFuncMap_[HREQ_CALL_SET_MUTE] = &RilInterfaceTest::SetMuteTest;
1424    memberFuncMap_[HREQ_CALL_GET_MUTE] = &RilInterfaceTest::GetMuteTest;
1425    memberFuncMap_[HREQ_CALL_GET_EMERGENCY_LIST] = &RilInterfaceTest::GetEmergencyListTest;
1426    memberFuncMap_[HREQ_CALL_SET_EMERGENCY_LIST] = &RilInterfaceTest::SetEmergencyCallListTest;
1427    memberFuncMap_[HREQ_CALL_GET_FAIL_REASON] = &RilInterfaceTest::GetFailReasonTest;
1428    memberFuncMap_[HREQ_CALL_SET_BARRING_PASSWORD] = &RilInterfaceTest::SetBarringPasswordTest;
1429}
1430
1431void RilInterfaceTest::OnInitSmsProcessInterface()
1432{
1433    // sms
1434    memberFuncMap_[HREQ_SMS_SEND_GSM_SMS] = &RilInterfaceTest::SendRilCmSmsTest;
1435    memberFuncMap_[HREQ_SMS_SEND_SMS_MORE_MODE] = &RilInterfaceTest::SendRilCmSmsMoreModeTest;
1436    memberFuncMap_[HREQ_SMS_SEND_SMS_ACK] = &RilInterfaceTest::SendSmsAckTest;
1437    memberFuncMap_[HREQ_SMS_SET_SMSC_ADDR] = &RilInterfaceTest::SetSmscAddrTest;
1438    memberFuncMap_[HREQ_SMS_GET_SMSC_ADDR] = &RilInterfaceTest::GetSmscAddrTest;
1439}
1440
1441void RilInterfaceTest::OnInitSimProcessInterface()
1442{
1443    // sim
1444    memberFuncMap_[HREQ_SIM_GET_SIM_STATUS] = &RilInterfaceTest::GetRilCmIccCardStatusTest;
1445    memberFuncMap_[HREQ_SIM_GET_IMSI] = &RilInterfaceTest::GetRilCmImsiForAppTest;
1446    memberFuncMap_[HREQ_SIM_GET_SIM_IO] = &RilInterfaceTest::IccRilSimIoForAppTest;
1447    memberFuncMap_[HREQ_SIM_OPEN_LOGICAL_CHANNEL] = &RilInterfaceTest::SimOpenLogicalChannelTest;
1448    memberFuncMap_[HREQ_SIM_CLOSE_LOGICAL_CHANNEL] = &RilInterfaceTest::SimCloseLogicalChannelTest;
1449    memberFuncMap_[HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL] = &RilInterfaceTest::SimTransmitApduLogicalChannelTest;
1450    memberFuncMap_[HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL] = &RilInterfaceTest::SimTransmitApduBasicChannelTest;
1451    memberFuncMap_[HREQ_SIM_AUTHENTICATION] = &RilInterfaceTest::SimAuthenticationTest;
1452    memberFuncMap_[HREQ_SIM_SET_ACTIVE_SIM] = &RilInterfaceTest::SetActiveSimTest;
1453    memberFuncMap_[HREQ_SIM_UNLOCK_SIM_LOCK] = &RilInterfaceTest::UnlockSimLockTest;
1454    memberFuncMap_[HREQ_SIM_UNLOCK_PIN] = &RilInterfaceTest::UnLockPINTest;
1455    memberFuncMap_[HREQ_SIM_UNLOCK_PIN2] = &RilInterfaceTest::UnLockPIN2Test;
1456    memberFuncMap_[HREQ_SIM_UNLOCK_PUK] = &RilInterfaceTest::UnLockPUKTest;
1457    memberFuncMap_[HREQ_SIM_UNLOCK_PUK2] = &RilInterfaceTest::UnLockPUK2Test;
1458    memberFuncMap_[HREQ_SIM_CHANGE_SIM_PASSWORD] = &RilInterfaceTest::ChangeSimPasswordTest;
1459    memberFuncMap_[HREQ_SIM_SET_SIM_LOCK] = &RilInterfaceTest::SetSimLockTest;
1460    memberFuncMap_[HREQ_SIM_GET_SIM_LOCK_STATUS] = &RilInterfaceTest::GetSimLockStatusTest;
1461    memberFuncMap_[HREQ_SIM_STK_SEND_TERMINAL_RESPONSE] = &RilInterfaceTest::SendTerminalResponseCmdTest;
1462    memberFuncMap_[HREQ_SIM_STK_SEND_ENVELOPE] = &RilInterfaceTest::SendEnvelopeCmdTest;
1463    memberFuncMap_[HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT] = &RilInterfaceTest::SendCallSetupRequestResultTest;
1464    memberFuncMap_[HREQ_SIM_STK_IS_READY] = &RilInterfaceTest::SimStkIsReadyTest;
1465}
1466
1467void RilInterfaceTest::OnInitDataProcessInterface()
1468{
1469    // data
1470    memberFuncMap_[HREQ_DATA_SET_INIT_APN_INFO] = &RilInterfaceTest::SetInitialApnTest;
1471    memberFuncMap_[HREQ_DATA_DEACTIVATE_PDP_CONTEXT] = &RilInterfaceTest::DeactivatePdpContextTest;
1472    memberFuncMap_[HREQ_DATA_ACTIVATE_PDP_CONTEXT] = &RilInterfaceTest::ActivatePdpContextTest;
1473    memberFuncMap_[HREQ_DATA_GET_PDP_CONTEXT_LIST] = &RilInterfaceTest::GetPdpContextListTest;
1474    memberFuncMap_[HREQ_DATA_GET_LINK_BANDWIDTH_INFO] = &RilInterfaceTest::GetLinkBandwidthInfoTest;
1475    memberFuncMap_[HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE] = &RilInterfaceTest::SetLinkBandwidthReportingRuleTest;
1476    memberFuncMap_[HREQ_DATA_SET_DATA_PROFILE_INFO] = &RilInterfaceTest::SetDataProfileInfoTest;
1477    memberFuncMap_[HREQ_DATA_SEND_DATA_PERFORMANCE_MODE] = &RilInterfaceTest::SendDataPerformanceModeTest;
1478    memberFuncMap_[HREQ_DATA_SEND_DATA_SLEEP_MODE] = &RilInterfaceTest::SendDataSleepModeTest;
1479    memberFuncMap_[HREQ_DATA_SET_DATA_PERMITTED] = &RilInterfaceTest::SetDataPermittedTest;
1480    memberFuncMap_[HREQ_DATA_GET_LINK_CAPABILITY] = &RilInterfaceTest::GetLinkCapabilityTest;
1481    memberFuncMap_[HREQ_DATA_CLEAN_ALL_CONNECTIONS] = &RilInterfaceTest::CleanAllConnectionsTest;
1482}
1483
1484void RilInterfaceTest::OnInitNetworkProcessInterface()
1485{
1486    // networksearch
1487    memberFuncMap_[HREQ_NETWORK_GET_SIGNAL_STRENGTH] = &RilInterfaceTest::GetRilCmSignalIntensityTest;
1488    memberFuncMap_[HREQ_NETWORK_GET_CS_REG_STATUS] = &RilInterfaceTest::GetRilCmCsRegStatusTest;
1489    memberFuncMap_[HREQ_NETWORK_GET_PS_REG_STATUS] = &RilInterfaceTest::GetRilCmPsRegStatusTest;
1490    memberFuncMap_[HREQ_NETWORK_GET_OPERATOR_INFO] = &RilInterfaceTest::GetRilCmOperatorTest;
1491    memberFuncMap_[HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION] = &RilInterfaceTest::GetRilNetworkSearchInfoTest;
1492    memberFuncMap_[HREQ_NETWORK_GET_NETWORK_SELECTION_MODE] = &RilInterfaceTest::GetRilNetworkSelectionModeTest;
1493    memberFuncMap_[HREQ_NETWORK_SET_NETWORK_SELECTION_MODE] = &RilInterfaceTest::SetRilNetworkSelectionModeTest;
1494    memberFuncMap_[HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST] = &RilInterfaceTest::GetRilCmCellInfoListTest;
1495    memberFuncMap_[HREQ_NETWORK_GET_CURRENT_CELL_INFO] = &RilInterfaceTest::GetRilCurrentCellInfoTest;
1496    memberFuncMap_[HREQ_NETWORK_SET_PREFERRED_NETWORK] = &RilInterfaceTest::SetRilPreferredNetworkTest;
1497    memberFuncMap_[HREQ_NETWORK_GET_PREFERRED_NETWORK] = &RilInterfaceTest::GetRilPreferredNetwrokTest;
1498    memberFuncMap_[HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG] = &RilInterfaceTest::GetPhysicalChannelConfigTest;
1499    memberFuncMap_[HREQ_NETWORK_SET_LOCATE_UPDATES] = &RilInterfaceTest::SetRilLocationUpdateTest;
1500    memberFuncMap_[HREQ_NETWORK_SET_NOTIFICATION_FILTER] = &RilInterfaceTest::SetRilNotificationFilterTest;
1501    memberFuncMap_[HREQ_NETWORK_SET_DEVICE_STATE] = &RilInterfaceTest::SetRilDeviceStateTest;
1502    memberFuncMap_[HREQ_NETWORK_SET_NR_OPTION_MODE] = &RilInterfaceTest::SetNrOptionModeTest;
1503    memberFuncMap_[HREQ_NETWORK_GET_NR_OPTION_MODE] = &RilInterfaceTest::GetNrOptionModeTest;
1504    memberFuncMap_[HREQ_NETWORK_GET_RRC_CONNECTION_STATE] = &RilInterfaceTest::GetRrcConnectionStateTest;
1505    memberFuncMap_[HREQ_NETWORK_GET_NR_SSBID_INFO] = &RilInterfaceTest::GetNrSsbIdTest;
1506}
1507
1508void RilInterfaceTest::OnInitModemProcessInterface()
1509{
1510    memberFuncMap_[HREQ_MODEM_SHUT_DOWN] = &RilInterfaceTest::ShutDownTest;
1511    memberFuncMap_[HREQ_MODEM_SET_RADIO_STATUS] = &RilInterfaceTest::SetRadioStateTest;
1512    memberFuncMap_[HREQ_MODEM_GET_RADIO_STATUS] = &RilInterfaceTest::GetRadioStateTest;
1513    memberFuncMap_[HREQ_MODEM_GET_IMEI] = &RilInterfaceTest::GetImeiTest;
1514    memberFuncMap_[HREQ_MODEM_GET_IMEISV] = &RilInterfaceTest::GetImeiSvTest;
1515    memberFuncMap_[HREQ_MODEM_GET_MEID] = &RilInterfaceTest::GetMeidTest;
1516    memberFuncMap_[HREQ_MODEM_GET_VOICE_RADIO] = &RilInterfaceTest::GetVoiceRadioTechnologyTest;
1517    memberFuncMap_[HREQ_MODEM_GET_BASEBAND_VERSION] = &RilInterfaceTest::GetBasebandVersionTest;
1518}
1519
1520void RilInterfaceTest::OnInitProcessInterface()
1521{
1522    OnInitCallProcessInterface();
1523    OnInitSmsProcessInterface();
1524    OnInitSimProcessInterface();
1525    OnInitDataProcessInterface();
1526    OnInitNetworkProcessInterface();
1527    OnInitModemProcessInterface();
1528}
1529
1530void RilInterfaceTest::OnInitInterface()
1531{
1532    OnInitStressInterface();
1533    OnInitProcessInterface();
1534}
1535} // namespace Telephony
1536} // namespace OHOS
1537
1538using namespace OHOS;
1539using namespace OHOS::Telephony;
1540
1541static int32_t PrintMenu()
1542{
1543    cout << endl << "---->Test Module:" << endl;
1544    cout << "----> 0. EXIT --------------------------" << endl;
1545    cout << "----> 1. MODEM -------------------------" << endl;
1546    cout << "----> 2. CALL --------------------------" << endl;
1547    cout << "----> 3. NETWORK -----------------------" << endl;
1548    cout << "----> 4. SIM ---------------------------" << endl;
1549    cout << "----> 5. DATA --------------------------" << endl;
1550    cout << "----> 6. SMS ---------------------------" << endl;
1551    cout << "----> 7. STRESS ------------------------" << endl;
1552    int32_t choice = InputInt32(0, static_cast<int32_t>(TestMenu::STRESS), "Test Module Index");
1553    cout << "---->You choose: " << choice << endl;
1554    return choice;
1555}
1556
1557static int32_t PrintStressMenu()
1558{
1559    cout << "---->[MODULE]STRESS:" << endl;
1560    cout << "----> [" << 0 << "] ---->Back to the previous menu." << endl;
1561    cout << "----> [" << HREQ_CALL_DIAL << "] ---->[ HREQ_CALL_DIAL ]" << endl;
1562    cout << "----> [" << HREQ_MODEM_SET_RADIO_STATUS << "] ---->[ HREQ_MODEM_SET_RADIO_STATUS ]" << endl;
1563    cout << "----> [" << HREQ_MODEM_GET_IMEI << "] ---->[ HREQ_MODEM_GET_IMEI ]" << endl;
1564    cout << "----> [" << HREQ_MODEM_GET_IMEISV << "] ---->[ HREQ_MODEM_GET_IMEISV ]" << endl;
1565
1566    int32_t choice = InputInt32(HREQ_CALL_BASE, HREQ_MODEM_EXIT - 1, "Command");
1567    cout << "---->You choose: " << choice << endl;
1568    choice = (choice == HREQ_CALL_BASE) ? DEFAULT_CHOICE : choice;
1569    return choice;
1570}
1571
1572static int32_t PrintCallMenu()
1573{
1574    cout << "---->[MODULE]CALL:" << endl;
1575    cout << "----> [" << HREQ_CALL_BASE << "] ---->Back to the previous menu." << endl;
1576    cout << "----> [" << HREQ_CALL_GET_CALL_LIST << "] ---->[ HREQ_CALL_GET_CALL_LIST ]" << endl;
1577    cout << "----> [" << HREQ_CALL_DIAL << "] ---->[ HREQ_CALL_DIAL ]" << endl;
1578    cout << "----> [" << HREQ_CALL_HANGUP << "] ---->[ HREQ_CALL_HANGUP ]" << endl;
1579    cout << "----> [" << HREQ_CALL_REJECT << "] ---->[ HREQ_CALL_REJECT ]" << endl;
1580    cout << "----> [" << HREQ_CALL_ANSWER << "] ---->[ HREQ_CALL_ANSWER ]" << endl;
1581    cout << "----> [" << HREQ_CALL_HOLD_CALL << "] ---->[ HREQ_CALL_HOLD_CALL ]" << endl;
1582    cout << "----> [" << HREQ_CALL_UNHOLD_CALL << "] ---->[ HREQ_CALL_UNHOLD_CALL ]" << endl;
1583    cout << "----> [" << HREQ_CALL_SWITCH_CALL << "] ---->[ HREQ_CALL_SWITCH_CALL ]" << endl;
1584    cout << "----> [" << HREQ_CALL_COMBINE_CONFERENCE << "] ---->[ HREQ_CALL_COMBINE_CONFERENCE ]" << endl;
1585    cout << "----> [" << HREQ_CALL_SEPARATE_CONFERENCE << "] ---->[ HREQ_CALL_SEPARATE_CONFERENCE ]" << endl;
1586    cout << "----> [" << HREQ_CALL_CALL_SUPPLEMENT << "] ---->[ HREQ_CALL_CALL_SUPPLEMENT ]" << endl;
1587    cout << "----> [" << HREQ_CALL_SEND_DTMF << "] ---->[ HREQ_CALL_SEND_DTMF ]" << endl;
1588    cout << "----> [" << HREQ_CALL_START_DTMF << "] ---->[ HREQ_CALL_START_DTMF ]" << endl;
1589    cout << "----> [" << HREQ_CALL_STOP_DTMF << "] ---->[ HREQ_CALL_STOP_DTMF ]" << endl;
1590    cout << "----> [" << HREQ_CALL_SET_USSD << "] ---->[ HREQ_CALL_SET_USSD ]" << endl;
1591    cout << "----> [" << HREQ_CALL_GET_USSD << "] ---->[ HREQ_CALL_GET_USSD ]" << endl;
1592    cout << "----> [" << HREQ_CALL_SET_MUTE << "] ---->[ HREQ_CALL_SET_MUTE ]" << endl;
1593    cout << "----> [" << HREQ_CALL_GET_MUTE << "] ---->[ HREQ_CALL_GET_MUTE ]" << endl;
1594    cout << "----> [" << HREQ_CALL_GET_EMERGENCY_LIST << "] ---->[ HREQ_CALL_GET_EMERGENCY_LIST ]" << endl;
1595    cout << "----> [" << HREQ_CALL_SET_EMERGENCY_LIST << "] ---->[ HREQ_CALL_SET_EMERGENCY_LIST ]" << endl;
1596    cout << "----> [" << HREQ_CALL_GET_FAIL_REASON << "] ---->[ HREQ_CALL_GET_FAIL_REASON ]" << endl;
1597    cout << "----> [" << HREQ_CALL_SET_BARRING_PASSWORD << "] ---->[ HREQ_CALL_SET_BARRING_PASSWORD ]" << endl;
1598
1599    int32_t choice = InputInt32(HREQ_CALL_BASE, HREQ_SMS_BASE - MENU_OFFSET, "Command");
1600    cout << "---->You choose: " << choice << endl;
1601    choice = (choice == HREQ_CALL_BASE) ? DEFAULT_CHOICE : choice;
1602    return choice;
1603}
1604
1605static int32_t PrintSmsMenu()
1606{
1607    cout << "---->[MODULE]SMS:" << endl;
1608    cout << "----> [" << HREQ_SMS_BASE << "] ---->Back to the previous menu." << endl;
1609    cout << "----> [" << HREQ_SMS_SEND_GSM_SMS << "] ---->[ HREQ_SMS_SEND_GSM_SMS ]" << endl;
1610    cout << "----> [" << HREQ_SMS_SEND_SMS_MORE_MODE << "] ---->[ HREQ_SMS_SEND_SMS_MORE_MODE ]" << endl;
1611    cout << "----> [" << HREQ_SMS_SEND_SMS_ACK << "] ---->[ HREQ_SMS_SEND_SMS_ACK ]" << endl;
1612    cout << "----> [" << HREQ_SMS_SET_SMSC_ADDR << "] ---->[ HREQ_SMS_SET_SMSC_ADDR ]" << endl;
1613    cout << "----> [" << HREQ_SMS_GET_SMSC_ADDR << "] ---->[ HREQ_SMS_GET_SMSC_ADDR ]" << endl;
1614
1615    int32_t choice = InputInt32(HREQ_SMS_BASE, HREQ_SIM_BASE - MENU_OFFSET, "Command");
1616    cout << "---->You choose: " << choice << endl;
1617    choice = (choice == HREQ_SMS_BASE) ? DEFAULT_CHOICE : choice;
1618    return choice;
1619}
1620
1621static int32_t PrintSimMenu()
1622{
1623    cout << "---->[MODULE]SIM:" << endl;
1624    cout << "----> [" << HREQ_SIM_BASE << "] ---->Back to the previous menu." << endl;
1625    cout << "----> [" << HREQ_SIM_GET_SIM_STATUS << "] ---->[ HREQ_SIM_GET_SIM_STATUS ]" << endl;
1626    cout << "----> [" << HREQ_SIM_GET_IMSI << "] ---->[ HREQ_SIM_GET_IMSI ]" << endl;
1627    cout << "----> [" << HREQ_SIM_GET_SIM_IO << "] ---->[ HREQ_SIM_GET_SIM_IO ]" << endl;
1628    cout << "----> [" << HREQ_SIM_SET_ACTIVE_SIM << "] ---->[ HREQ_SIM_SET_ACTIVE_SIM ]" << endl;
1629    cout << "----> [" << HREQ_SIM_OPEN_LOGICAL_CHANNEL << "] ---->[ HREQ_SIM_OPEN_LOGICAL_CHANNEL ]" << endl;
1630    cout << "----> [" << HREQ_SIM_CLOSE_LOGICAL_CHANNEL << "] ---->[ HREQ_SIM_CLOSE_LOGICAL_CHANNEL ]" << endl;
1631    cout << "----> [" << HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL << "] ---->[ HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL ]"
1632         << endl;
1633    cout << "----> [" << HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL << "] ---->[ HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL ]"
1634         << endl;
1635    cout << "----> [" << HREQ_SIM_AUTHENTICATION << "] ---->[ HREQ_SIM_AUTHENTICATION ]" << endl;
1636    cout << "----> [" << HREQ_SIM_UNLOCK_SIM_LOCK << "] ---->[ HREQ_SIM_UNLOCK_SIM_LOCK ]" << endl;
1637    cout << "----> [" << HREQ_SIM_UNLOCK_PIN << "] ---->[ HREQ_SIM_UNLOCK_PIN ]" << endl;
1638    cout << "----> [" << HREQ_SIM_UNLOCK_PIN2 << "] ---->[ HREQ_SIM_UNLOCK_PIN2 ]" << endl;
1639    cout << "----> [" << HREQ_SIM_UNLOCK_PUK << "] ---->[ HREQ_SIM_UNLOCK_PUK ]" << endl;
1640    cout << "----> [" << HREQ_SIM_UNLOCK_PUK2 << "] ---->[ HREQ_SIM_UNLOCK_PUK2 ]" << endl;
1641    cout << "----> [" << HREQ_SIM_CHANGE_SIM_PASSWORD << "] ---->[ HREQ_SIM_CHANGE_SIM_PASSWORD ]" << endl;
1642    cout << "----> [" << HREQ_SIM_SET_SIM_LOCK << "] ---->[ HREQ_SIM_SET_SIM_LOCK ]" << endl;
1643    cout << "----> [" << HREQ_SIM_GET_SIM_LOCK_STATUS << "] ---->[ HREQ_SIM_GET_SIM_LOCK_STATUS ]" << endl;
1644    cout << "----> [" << HREQ_SIM_STK_SEND_TERMINAL_RESPONSE << "] ---->[ HREQ_SIM_STK_SEND_TERMINAL_RESPONSE ]"
1645         << endl;
1646    cout << "----> [" << HREQ_SIM_STK_SEND_ENVELOPE << "] ---->[ HREQ_SIM_STK_SEND_ENVELOPE ]" << endl;
1647    cout << "----> [" << HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT
1648         << "] ---->[ HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT ]" << endl;
1649    cout << "----> [" << HREQ_SIM_STK_IS_READY << "] ---->[ HREQ_SIM_STK_IS_READY ]" << endl;
1650
1651    int32_t choice = InputInt32(HREQ_SIM_BASE, HREQ_DATA_BASE - MENU_OFFSET, "Command");
1652    cout << "---->You choose: " << choice << endl;
1653    choice = (choice == HREQ_SIM_BASE) ? DEFAULT_CHOICE : choice;
1654    return choice;
1655}
1656
1657static int32_t PrintDataMenu()
1658{
1659    cout << "---->[MODULE]DATA:" << endl;
1660    cout << "----> [" << HREQ_DATA_BASE << "] ---->Back to the previous menu." << endl;
1661    cout << "----> [" << HREQ_DATA_SET_INIT_APN_INFO << "] ---->[ HREQ_DATA_SET_INIT_APN_INFO ]" << endl;
1662    cout << "----> [" << HREQ_DATA_DEACTIVATE_PDP_CONTEXT << "] ---->[ HREQ_DATA_DEACTIVATE_PDP_CONTEXT ]" << endl;
1663    cout << "----> [" << HREQ_DATA_ACTIVATE_PDP_CONTEXT << "] ---->[ HREQ_DATA_ACTIVATE_PDP_CONTEXT ]" << endl;
1664    cout << "----> [" << HREQ_DATA_GET_PDP_CONTEXT_LIST << "] ---->[ HREQ_DATA_GET_PDP_CONTEXT_LIST ]" << endl;
1665    cout << "----> [" << HREQ_DATA_GET_LINK_BANDWIDTH_INFO << "] ---->[ HREQ_DATA_GET_LINK_BANDWIDTH_INFO ]" << endl;
1666    cout << "----> [" << HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE
1667         << "] ---->[ HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE ]" << endl;
1668    cout << "----> [" << HREQ_DATA_SET_DATA_PROFILE_INFO << "] ---->[ HREQ_DATA_SET_DATA_PROFILE_INFO ]" << endl;
1669    cout << "----> [" << HREQ_DATA_SEND_DATA_PERFORMANCE_MODE << "] ---->[ HREQ_DATA_SEND_DATA_PERFORMANCE_MODE ]"
1670         << endl;
1671    cout << "----> [" << HREQ_DATA_SEND_DATA_SLEEP_MODE << "] ---->[ HREQ_DATA_SEND_DATA_SLEEP_MODE ]" << endl;
1672    cout << "----> [" << HREQ_DATA_SET_DATA_PERMITTED << "] ---->[ HREQ_DATA_SET_DATA_PERMITTED ]" << endl;
1673    cout << "----> [" << HREQ_DATA_GET_LINK_CAPABILITY << "] ---->[ HREQ_DATA_GET_LINK_CAPABILITY ]" << endl;
1674    cout << "----> [" << HREQ_DATA_CLEAN_ALL_CONNECTIONS << "] ---->[ HREQ_DATA_CLEAN_ALL_CONNECTIONS ]" << endl;
1675
1676    int32_t choice = InputInt32(HREQ_DATA_BASE, HREQ_NETWORK_BASE - MENU_OFFSET, "Command");
1677    cout << "---->You choose: " << choice << endl;
1678    choice = (choice == HREQ_DATA_BASE) ? DEFAULT_CHOICE : choice;
1679    return choice;
1680}
1681
1682static int32_t PrintNetworkMenu()
1683{
1684    cout << "---->[MODULE]NETWORK:" << endl;
1685    cout << "----> [" << HREQ_NETWORK_BASE << "] ---->Back to the previous menu." << endl;
1686    cout << "----> [" << HREQ_NETWORK_GET_SIGNAL_STRENGTH << "] ---->[ HREQ_NETWORK_GET_SIGNAL_STRENGTH ]" << endl;
1687    cout << "----> [" << HREQ_NETWORK_GET_CS_REG_STATUS << "] ---->[ HREQ_NETWORK_GET_CS_REG_STATUS ]" << endl;
1688    cout << "----> [" << HREQ_NETWORK_GET_PS_REG_STATUS << "] ---->[ HREQ_NETWORK_GET_PS_REG_STATUS ]" << endl;
1689    cout << "----> [" << HREQ_NETWORK_GET_OPERATOR_INFO << "] ---->[ HREQ_NETWORK_GET_OPERATOR_INFO ]" << endl;
1690    cout << "----> [" << HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION
1691         << "] ---->[ HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION ]" << endl;
1692    cout << "----> [" << HREQ_NETWORK_GET_NETWORK_SELECTION_MODE << "] ---->[ HREQ_NETWORK_GET_NETWORK_SELECTION_MODE ]"
1693         << endl;
1694    cout << "----> [" << HREQ_NETWORK_SET_NETWORK_SELECTION_MODE << "] ---->[ HREQ_NETWORK_SET_NETWORK_SELECTION_MODE ]"
1695         << endl;
1696    cout << "----> [" << HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST
1697         << "] ---->[ HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST ]" << endl;
1698    cout << "----> [" << HREQ_NETWORK_GET_CURRENT_CELL_INFO << "] ---->[ HREQ_NETWORK_GET_CURRENT_CELL_INFO ]" << endl;
1699    cout << "----> [" << HREQ_NETWORK_SET_PREFERRED_NETWORK << "] ---->[ HREQ_NETWORK_SET_PREFERRED_NETWORK ]" << endl;
1700    cout << "----> [" << HREQ_NETWORK_GET_PREFERRED_NETWORK << "] ---->[ HREQ_NETWORK_GET_PREFERRED_NETWORK ]" << endl;
1701    cout << "----> [" << HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG
1702         << "] ---->[ HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG ]" << endl;
1703    cout << "----> [" << HREQ_NETWORK_SET_LOCATE_UPDATES << "] ---->[ HREQ_NETWORK_SET_LOCATE_UPDATES ]" << endl;
1704    cout << "----> [" << HREQ_NETWORK_SET_NOTIFICATION_FILTER << "] ---->[ HREQ_NETWORK_SET_NOTIFICATION_FILTER ]"
1705         << endl;
1706    cout << "----> [" << HREQ_NETWORK_SET_DEVICE_STATE << "] ---->[ HREQ_NETWORK_SET_DEVICE_STATE ]" << endl;
1707    cout << "----> [" << HREQ_NETWORK_SET_NR_OPTION_MODE << "] ---->[ HREQ_NETWORK_SET_NR_OPTION_MODE ]" << endl;
1708    cout << "----> [" << HREQ_NETWORK_GET_NR_OPTION_MODE << "] ---->[ HREQ_NETWORK_GET_NR_OPTION_MODE ]" << endl;
1709    cout << "----> [" << HREQ_NETWORK_GET_RRC_CONNECTION_STATE << "] ---->[ HREQ_NETWORK_GET_RRC_CONNECTION_STATE ]"
1710         << endl;
1711    cout << "----> [" << HREQ_NETWORK_GET_NR_SSBID_INFO << "] ---->[ HREQ_NETWORK_GET_NR_SSBID_INFO ]" << endl;
1712
1713    int32_t choice = InputInt32(HREQ_NETWORK_BASE, HREQ_COMMON_BASE - MENU_OFFSET, "Command");
1714    cout << "---->You choose: " << choice << endl;
1715    choice = (choice == HREQ_NETWORK_BASE) ? DEFAULT_CHOICE : choice;
1716    return choice;
1717}
1718
1719static int32_t PrintModemMenu()
1720{
1721    cout << "---->[MODULE]MODEM:" << endl;
1722    cout << "----> [" << HREQ_COMMON_BASE << "] ---->Back to the previous menu." << endl;
1723    cout << "----> [" << HREQ_MODEM_SHUT_DOWN << "] ---->[ HREQ_MODEM_SHUT_DOWN ]" << endl;
1724    cout << "----> [" << HREQ_MODEM_SET_RADIO_STATUS << "] ---->[ HREQ_MODEM_SET_RADIO_STATUS ]" << endl;
1725    cout << "----> [" << HREQ_MODEM_GET_RADIO_STATUS << "] ---->[ HREQ_MODEM_GET_RADIO_STATUS ]" << endl;
1726    cout << "----> [" << HREQ_MODEM_GET_IMEI << "] ---->[ HREQ_MODEM_GET_IMEI ]" << endl;
1727    cout << "----> [" << HREQ_MODEM_GET_IMEISV << "] ---->[ HREQ_MODEM_GET_IMEISV ]" << endl;
1728    cout << "----> [" << HREQ_MODEM_GET_MEID << "] ---->[ HREQ_MODEM_GET_MEID ]" << endl;
1729    cout << "----> [" << HREQ_MODEM_GET_VOICE_RADIO << "] ---->[ HREQ_MODEM_GET_VOICE_RADIO ]" << endl;
1730    cout << "----> [" << HREQ_MODEM_GET_BASEBAND_VERSION << "] ---->[ HREQ_MODEM_GET_BASEBAND_VERSION ]" << endl;
1731
1732    int32_t choice = InputInt32(HREQ_COMMON_BASE, HREQ_MODEM_EXIT - MENU_OFFSET, "Command");
1733    cout << "---->You choose: " << choice << endl;
1734    choice = (choice == HREQ_COMMON_BASE) ? DEFAULT_CHOICE : choice;
1735    return choice;
1736}
1737
1738static int32_t SwitchMenu(TestMenu module, bool *loopFlag)
1739{
1740    int32_t mWhat = static_cast<int32_t>(TestMenu::NONE);
1741    switch (module) {
1742        case TestMenu::EXIT:
1743            if (loopFlag != nullptr) {
1744                *loopFlag = false;
1745            }
1746            break;
1747        case TestMenu::MODEM:
1748            mWhat = PrintModemMenu();
1749            break;
1750        case TestMenu::CALL:
1751            mWhat = PrintCallMenu();
1752            break;
1753        case TestMenu::NETWORK:
1754            mWhat = PrintNetworkMenu();
1755            break;
1756        case TestMenu::SIM:
1757            mWhat = PrintSimMenu();
1758            break;
1759        case TestMenu::DATA:
1760            mWhat = PrintDataMenu();
1761            break;
1762        case TestMenu::SMS:
1763            mWhat = PrintSmsMenu();
1764            break;
1765        case TestMenu::STRESS:
1766            mWhat = PrintStressMenu();
1767            break;
1768        default:
1769            break;
1770    }
1771    return mWhat;
1772}
1773
1774int32_t main()
1775{
1776    cout << "---->Ril Adapter Test Enter" << endl;
1777    g_rilInterface = OHOS::HDI::Ril::V1_3::IRil::Get();
1778    if (g_rilInterface == nullptr) {
1779        cout << "g_rilInterface is null" << endl;
1780        return 0;
1781    }
1782    RilCallbackTest callback_;
1783    g_rilInterface->SetCallback(&callback_);
1784    RilInterfaceTest rilInterfaceTest;
1785    rilInterfaceTest.OnInitInterface();
1786    bool loopFlag = true;
1787    while (loopFlag) {
1788        int32_t mWhat = static_cast<int32_t>(TestMenu::NONE);
1789        int32_t module = static_cast<int32_t>(TestMenu::NONE);
1790        module = PrintMenu();
1791        mWhat = SwitchMenu(static_cast<TestMenu>(module), &loopFlag);
1792        if (mWhat <= 0) {
1793            continue;
1794        }
1795        if (module == static_cast<int32_t>(TestMenu::STRESS)) {
1796            rilInterfaceTest.OnStressInput(mWhat);
1797        } else {
1798            rilInterfaceTest.OnProcessInput(mWhat);
1799        }
1800        usleep(WAIT_TIME);
1801    }
1802    cout << "---->Ril Adapter Test end" << endl;
1803    return 0;
1804}
1805