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