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