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