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