1 /*
2 * Copyright (C) 2021 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 "bluetooth_call_test.h"
17
18 #include <iostream>
19
20 #include "call_manager_errors.h"
21
22 #include "bluetooth_call_client.h"
23 #include "call_manager_test_types.h"
24 #include "call_manager_callback_test.h"
25
26 namespace OHOS {
27 namespace Telephony {
28 using namespace Security::AccessToken;
29 using Security::AccessToken::AccessTokenID;
30 std::shared_ptr<BluetoothCallClient> g_bluetoothCallPtr = nullptr;
31
32 HapInfoParams testInfoParamsCase = {
33 .userID = 1,
34 .bundleName = "tel_call_manager_ui_test",
35 .instIndex = 0,
36 .appIDDesc = "test",
37 .isSystemApp = true,
38 };
39
40 PermissionDef testPermPlaceCallDefCase = {
41 .permissionName = "ohos.permission.PLACE_CALL",
42 .bundleName = "tel_call_manager_ui_test",
43 .grantMode = 1, // SYSTEM_GRANT
44 .availableLevel = APL_SYSTEM_BASIC,
45 .label = "label",
46 .labelId = 1,
47 .description = "Test call maneger",
48 .descriptionId = 1,
49 };
50
51 PermissionStateFull testPlaceCallStateCase = {
52 .permissionName = "ohos.permission.PLACE_CALL",
53 .isGeneral = true,
54 .resDeviceID = { "local" },
55 .grantStatus = { PermissionState::PERMISSION_GRANTED },
56 .grantFlags = { 2 }, // PERMISSION_USER_SET
57 };
58
59 PermissionDef testPermSetTelephonyStateDefCase = {
60 .permissionName = "ohos.permission.SET_TELEPHONY_STATE",
61 .bundleName = "tel_call_manager_ui_test",
62 .grantMode = 1, // SYSTEM_GRANT
63 .availableLevel = APL_SYSTEM_BASIC,
64 .label = "label",
65 .labelId = 1,
66 .description = "Test call maneger",
67 .descriptionId = 1,
68 };
69
70 PermissionStateFull testSetTelephonyStateCase = {
71 .permissionName = "ohos.permission.SET_TELEPHONY_STATE",
72 .isGeneral = true,
73 .resDeviceID = { "local" },
74 .grantStatus = { PermissionState::PERMISSION_GRANTED },
75 .grantFlags = { 2 }, // PERMISSION_USER_SET
76 };
77
78 PermissionDef testPermGetTelephonyStateDefCase = {
79 .permissionName = "ohos.permission.GET_TELEPHONY_STATE",
80 .bundleName = "tel_call_manager_ui_test",
81 .grantMode = 1, // SYSTEM_GRANT
82 .availableLevel = APL_SYSTEM_BASIC,
83 .label = "label",
84 .labelId = 1,
85 .description = "Test call maneger",
86 .descriptionId = 1,
87 };
88
89 PermissionStateFull testGetTelephonyStateCase = {
90 .permissionName = "ohos.permission.GET_TELEPHONY_STATE",
91 .isGeneral = true,
92 .resDeviceID = { "local" },
93 .grantStatus = { PermissionState::PERMISSION_GRANTED },
94 .grantFlags = { 2 }, // PERMISSION_USER_SET
95 };
96
97 PermissionDef testPermAnswerCallDefCase = {
98 .permissionName = "ohos.permission.ANSWER_CALL",
99 .bundleName = "tel_call_manager_ui_test",
100 .grantMode = 1, // SYSTEM_GRANT
101 .availableLevel = APL_SYSTEM_BASIC,
102 .label = "label",
103 .labelId = 1,
104 .description = "Test call maneger",
105 .descriptionId = 1,
106 };
107
108 PermissionStateFull testAnswerCallStateCase = {
109 .permissionName = "ohos.permission.ANSWER_CALL",
110 .isGeneral = true,
111 .resDeviceID = { "local" },
112 .grantStatus = { PermissionState::PERMISSION_GRANTED },
113 .grantFlags = { 2 }, // PERMISSION_USER_SET
114 };
115
116 HapPolicyParams testPolicyParamsCase = {
117 .apl = APL_SYSTEM_BASIC,
118 .domain = "test.domain",
119 .permList = { testPermPlaceCallDefCase, testPermSetTelephonyStateDefCase, testPermGetTelephonyStateDefCase,
120 testPermAnswerCallDefCase },
121 .permStateList = { testPlaceCallStateCase, testSetTelephonyStateCase, testGetTelephonyStateCase,
122 testAnswerCallStateCase },
123 };
124
125 class AccessToken {
126 public:
AccessToken()127 AccessToken()
128 {
129 currentTokenID_ = GetSelfTokenID();
130 AccessTokenIDEx tokenIdEx = AccessTokenKit::AllocHapToken(testInfoParamsCase, testPolicyParamsCase);
131 accessID_ = tokenIdEx.tokenIdExStruct.tokenID;
132 SetSelfTokenID(tokenIdEx.tokenIDEx);
133 }
~AccessToken()134 ~AccessToken()
135 {
136 AccessTokenKit::DeleteToken(accessID_);
137 SetSelfTokenID(currentTokenID_);
138 }
139
140 private:
141 AccessTokenID currentTokenID_ = 0;
142 AccessTokenID accessID_ = 0;
143 };
144
Init()145 int32_t BluetoothCallTest::Init()
146 {
147 AccessToken token;
148 g_bluetoothCallPtr = DelayedSingleton<BluetoothCallClient>::GetInstance();
149 if (g_bluetoothCallPtr == nullptr) {
150 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
151 return TELEPHONY_ERROR;
152 }
153 g_bluetoothCallPtr->Init();
154 std::unique_ptr<CallManagerCallbackTest> callbackPtr = std::make_unique<CallManagerCallbackTest>();
155 if (callbackPtr == nullptr) {
156 std::cout << "make_unique CallManagerCallbackTest failed!" << std::endl;
157 return TELEPHONY_ERROR;
158 }
159 int32_t ret = g_bluetoothCallPtr->RegisterCallBack(std::move(callbackPtr));
160 if (ret != TELEPHONY_SUCCESS) {
161 std::cout << "RegisterCallBack failed!" << std::endl;
162 return TELEPHONY_ERROR;
163 }
164 std::cout << "RegisterCallBack success!" << std::endl;
165 InitFunMap();
166 return TELEPHONY_SUCCESS;
167 }
168
RunBluetoothCallTest()169 void BluetoothCallTest::RunBluetoothCallTest()
170 {
171 int32_t interfaceNum = OHOS::Telephony::DEFAULT_VALUE;
172 const int32_t exitNumber = 1000;
173 while (true) {
174 PrintfUsage();
175 std::cin >> interfaceNum;
176 if (interfaceNum == exitNumber) {
177 std::cout << "start to exit now...." << std::endl;
178 break;
179 }
180 auto itFunc = memberFuncMap_.find(interfaceNum);
181 if (itFunc != memberFuncMap_.end() && itFunc->second != nullptr) {
182 auto BluetoothCallFunc = itFunc->second;
183 (this->*BluetoothCallFunc)();
184 continue;
185 }
186 std::cout << "err: invalid input!" << std::endl;
187 }
188 memberFuncMap_.clear();
189 }
190
PrintfUsage()191 void BluetoothCallTest::PrintfUsage()
192 {
193 std::cout << "\n\n-----------bluetooth call test start--------------\n";
194 std::cout << "usage:please input a cmd num:\n";
195 std::cout << "0:dial\n";
196 std::cout << "1:answer\n";
197 std::cout << "2:reject\n";
198 std::cout << "3:hangup\n";
199 std::cout << "4:getCallState\n";
200 std::cout << "5:hold\n";
201 std::cout << "6:unhold\n";
202 std::cout << "7:switchCall\n";
203 std::cout << "8:combineConference\n";
204 std::cout << "9:separateConference\n";
205 std::cout << "10:startDtmf\n";
206 std::cout << "11:stopRtt\n";
207 std::cout << "12:isRinging\n";
208 std::cout << "13:hasCall\n";
209 std::cout << "14:isNewCallAllowed\n";
210 std::cout << "15:isInEmergencyCall\n";
211 std::cout << "16:setMuted\n";
212 std::cout << "17:muteRinger\n";
213 std::cout << "18:setAudioDevice\n";
214 std::cout << "19:GetCurrentCallList\n";
215 std::cout << "20:kickOutFromConference\n";
216 std::cout << "1000:exit\n";
217 }
218
InitFunMap()219 void BluetoothCallTest::InitFunMap()
220 {
221 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_DIAL)] = &BluetoothCallTest::DialCall;
222 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_ANSWER)] = &BluetoothCallTest::AnswerCall;
223 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_REJECT)] = &BluetoothCallTest::RejectCall;
224 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_HANGUP)] = &BluetoothCallTest::HangUpCall;
225 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_GET_CALL_STATE)] =
226 &BluetoothCallTest::GetCallState;
227 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_HOLD)] = &BluetoothCallTest::HoldCall;
228 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_UNHOLD)] = &BluetoothCallTest::UnHoldCall;
229 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_SWITCH)] = &BluetoothCallTest::SwitchCall;
230 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_COMBINE_CONFERENCE)] =
231 &BluetoothCallTest::CombineConference;
232 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_SEPARATE_CONFERENCE)] =
233 &BluetoothCallTest::SeparateConference;
234 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_KICK_OUT_CONFERENCE)] =
235 &BluetoothCallTest::KickOutFromConference;
236 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_START_DTMF)] = &BluetoothCallTest::StartDtmf;
237 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_STOP_DTMF)] = &BluetoothCallTest::StopDtmf;
238 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_IS_RINGING)] = &BluetoothCallTest::IsRinging;
239 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_HAS_CALL)] = &BluetoothCallTest::HasCall;
240 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_IS_NEW_CALL_ALLOWED)] =
241 &BluetoothCallTest::IsNewCallAllowed;
242 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_IS_IN_EMERGENCY_CALL)] =
243 &BluetoothCallTest::IsInEmergencyCall;
244 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_SET_MUTED)] = &BluetoothCallTest::SetMute;
245 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_MUTE_RINGER)] = &BluetoothCallTest::MuteRinger;
246 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_SET_AUDIO_DEVICE)] =
247 &BluetoothCallTest::SetAudioDevice;
248 memberFuncMap_[static_cast<uint32_t>(BluetoothCallFuncCode::TEST_GET_CURRENT_CALL_LIST)] =
249 &BluetoothCallTest::GetCurrentCallList;
250 }
251
DialCall()252 void BluetoothCallTest::DialCall()
253 {
254 AccessToken token;
255 int32_t accountId = DEFAULT_ACCOUNT_ID;
256 int32_t videoCallState = DEFAULT_VIDEO_STATE;
257 int32_t dialScene = DEFAULT_DIAL_SCENE;
258 int32_t dialType = DEFAULT_DIAL_TYPE;
259 int32_t callType = DEFAULT_CALL_TYPE;
260 std::u16string u16PhoneNumber;
261 std::string tmpStr;
262 AppExecFwk::PacMap dialInfo;
263 std::cout << "-------Dial-------" << std::endl;
264 std::cout << "please input phone number:" << std::endl;
265 u16PhoneNumber.clear();
266 tmpStr.clear();
267 std::cin >> tmpStr;
268 u16PhoneNumber = Str8ToStr16(tmpStr);
269 std::cout << "you want to call " << tmpStr << std::endl;
270 std::cout << "please input accountId:" << std::endl;
271 std::cin >> accountId;
272 std::cout << "please input videoState[0:audio,1:video]:" << std::endl;
273 std::cin >> videoCallState;
274 std::cout << "please input dialScene[0:normal,1:privileged,2:emergency]:" << std::endl;
275 std::cin >> dialScene;
276 std::cout << "please input dialType[0:carrier,1:voice mail,2:ott]:" << std::endl;
277 std::cin >> dialType;
278 std::cout << "please input callType[0:cs,1:ims,2:ott]:" << std::endl;
279 std::cin >> callType;
280
281 dialInfo.PutIntValue("accountId", accountId);
282 dialInfo.PutIntValue("videoState", videoCallState);
283 dialInfo.PutIntValue("dialScene", dialScene);
284 dialInfo.PutIntValue("dialType", dialType);
285 dialInfo.PutIntValue("callType", callType);
286 if (g_bluetoothCallPtr == nullptr) {
287 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
288 return;
289 }
290 int32_t ret = g_bluetoothCallPtr->DialCall(u16PhoneNumber, dialInfo);
291 std::cout << "return value:" << ret << std::endl;
292 }
293
AnswerCall()294 void BluetoothCallTest::AnswerCall()
295 {
296 AccessToken token;
297 std::cout << "------Answer------" << std::endl;
298 if (g_bluetoothCallPtr == nullptr) {
299 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
300 return;
301 }
302 int32_t ret = g_bluetoothCallPtr->AnswerCall();
303 std::cout << "return value:" << ret << std::endl;
304 }
305
RejectCall()306 void BluetoothCallTest::RejectCall()
307 {
308 AccessToken token;
309 std::cout << "------Reject------" << std::endl;
310 if (g_bluetoothCallPtr == nullptr) {
311 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
312 return;
313 }
314 int32_t ret = g_bluetoothCallPtr->RejectCall();
315 std::cout << "return value:" << ret << std::endl;
316 }
317
HangUpCall()318 void BluetoothCallTest::HangUpCall()
319 {
320 AccessToken token;
321 std::cout << "------HangUpCall------" << std::endl;
322 if (g_bluetoothCallPtr == nullptr) {
323 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
324 return;
325 }
326 int32_t ret = g_bluetoothCallPtr->HangUpCall();
327 std::cout << "return value:" << ret << std::endl;
328 }
329
GetCallState()330 void BluetoothCallTest::GetCallState()
331 {
332 std::cout << "------GetCallState------" << std::endl;
333 if (g_bluetoothCallPtr == nullptr) {
334 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
335 return;
336 }
337 int32_t ret = g_bluetoothCallPtr->GetCallState();
338 std::cout << "return value:" << ret << std::endl;
339 }
340
HoldCall()341 void BluetoothCallTest::HoldCall()
342 {
343 AccessToken token;
344 std::cout << "------HoldCall------" << std::endl;
345 if (g_bluetoothCallPtr == nullptr) {
346 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
347 return;
348 }
349 int32_t ret = g_bluetoothCallPtr->HoldCall();
350 std::cout << "return value:" << ret << std::endl;
351 }
352
UnHoldCall()353 void BluetoothCallTest::UnHoldCall()
354 {
355 AccessToken token;
356 std::cout << "------UnHoldCall------" << std::endl;
357 if (g_bluetoothCallPtr == nullptr) {
358 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
359 return;
360 }
361 int32_t ret = g_bluetoothCallPtr->UnHoldCall();
362 std::cout << "return value:" << ret << std::endl;
363 }
364
CombineConference()365 void BluetoothCallTest::CombineConference()
366 {
367 std::cout << "------CombineConference------" << std::endl;
368 if (g_bluetoothCallPtr == nullptr) {
369 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
370 return;
371 }
372 int32_t ret = g_bluetoothCallPtr->CombineConference();
373 std::cout << "return value:" << ret << std::endl;
374 }
375
SeparateConference()376 void BluetoothCallTest::SeparateConference()
377 {
378 std::cout << "------SeparateConference------" << std::endl;
379 if (g_bluetoothCallPtr == nullptr) {
380 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
381 return;
382 }
383 int32_t ret = g_bluetoothCallPtr->SeparateConference();
384 std::cout << "return value:" << ret << std::endl;
385 }
386
KickOutFromConference()387 void BluetoothCallTest::KickOutFromConference()
388 {
389 std::cout << "------KickOutFromConference------" << std::endl;
390 if (g_bluetoothCallPtr == nullptr) {
391 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
392 return;
393 }
394 int32_t ret = g_bluetoothCallPtr->KickOutFromConference();
395 std::cout << "return value:" << ret << std::endl;
396 }
397
SwitchCall()398 void BluetoothCallTest::SwitchCall()
399 {
400 AccessToken token;
401 std::cout << "------SwitchCall------" << std::endl;
402 if (g_bluetoothCallPtr == nullptr) {
403 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
404 return;
405 }
406 int32_t ret = g_bluetoothCallPtr->SwitchCall();
407 std::cout << "return value:" << ret << std::endl;
408 }
409
HasCall()410 void BluetoothCallTest::HasCall()
411 {
412 std::cout << "------HasCall------" << std::endl;
413 if (g_bluetoothCallPtr == nullptr) {
414 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
415 return;
416 }
417 int32_t ret = g_bluetoothCallPtr->HasCall();
418 std::cout << "return value:" << ret << std::endl;
419 }
420
IsNewCallAllowed()421 void BluetoothCallTest::IsNewCallAllowed()
422 {
423 std::cout << "------IsNewCallAllowed------" << std::endl;
424 if (g_bluetoothCallPtr == nullptr) {
425 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
426 return;
427 }
428 bool enabled = false;
429 int32_t ret = g_bluetoothCallPtr->IsNewCallAllowed(enabled);
430 std::cout << "ret:" << ret << std::endl;
431 std::cout << "enabled value:" << enabled << std::endl;
432 }
433
IsRinging()434 void BluetoothCallTest::IsRinging()
435 {
436 AccessToken token;
437 std::cout << "------IsRinging------" << std::endl;
438 if (g_bluetoothCallPtr == nullptr) {
439 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
440 return;
441 }
442 bool enabled = false;
443 int32_t ret = g_bluetoothCallPtr->IsRinging(enabled);
444 std::cout << "ret:" << ret << std::endl;
445 std::cout << "enabled value:" << enabled << std::endl;
446 }
447
IsInEmergencyCall()448 void BluetoothCallTest::IsInEmergencyCall()
449 {
450 AccessToken token;
451 std::cout << "------IsInEmergencyCall------" << std::endl;
452 if (g_bluetoothCallPtr == nullptr) {
453 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
454 return;
455 }
456 bool enabled = false;
457 int32_t ret = g_bluetoothCallPtr->IsInEmergencyCall(enabled);
458 std::cout << "ret:" << ret << std::endl;
459 std::cout << "enabled value:" << enabled << std::endl;
460 }
461
StartDtmf()462 void BluetoothCallTest::StartDtmf()
463 {
464 char c = DEFAULT_VALUE;
465 std::cout << "------StartDtmf------" << std::endl;
466 std::cout << "Please enter to send dtmf characters:" << std::endl;
467 std::cin >> c;
468 if (g_bluetoothCallPtr == nullptr) {
469 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
470 return;
471 }
472 int32_t ret = g_bluetoothCallPtr->StartDtmf(c);
473 std::cout << "return value:" << ret << std::endl;
474 }
475
StopDtmf()476 void BluetoothCallTest::StopDtmf()
477 {
478 std::cout << "------StopDtmf------" << std::endl;
479 if (g_bluetoothCallPtr == nullptr) {
480 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
481 return;
482 }
483 int32_t ret = g_bluetoothCallPtr->StopDtmf();
484 std::cout << "return value:" << ret << std::endl;
485 }
486
SetMute()487 void BluetoothCallTest::SetMute()
488 {
489 int32_t isMute = DEFAULT_VALUE;
490 std::cout << "------SetMute------" << std::endl;
491 std::cout << "please input mute state(0:false 1:true):" << std::endl;
492 std::cin >> isMute;
493 if (g_bluetoothCallPtr == nullptr) {
494 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
495 return;
496 }
497 int32_t ret = g_bluetoothCallPtr->SetMuted((isMute == 1) ? true : false);
498 std::cout << "return value:" << ret << std::endl;
499 }
500
MuteRinger()501 void BluetoothCallTest::MuteRinger()
502 {
503 AccessToken token;
504 std::cout << "------MuteRinger------" << std::endl;
505 if (g_bluetoothCallPtr == nullptr) {
506 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
507 return;
508 }
509 int32_t ret = g_bluetoothCallPtr->MuteRinger();
510 std::cout << "return value:" << ret << std::endl;
511 }
512
SetAudioDevice()513 void BluetoothCallTest::SetAudioDevice()
514 {
515 int32_t deviceType = DEFAULT_VALUE;
516 std::cout << "------SetAudioDevice------" << std::endl;
517 std::cout << "please input device type(0:earpiece 1:speaker 2:wired headset 3:bluetooth sco):" << std::endl;
518 std::cin >> deviceType;
519 if (g_bluetoothCallPtr == nullptr) {
520 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
521 return;
522 }
523 AudioDeviceType device = static_cast<AudioDeviceType>(deviceType);
524 std::string address = "0C:D7:46:14:AA:33";
525 int32_t ret = g_bluetoothCallPtr->SetAudioDevice(device, address);
526 std::cout << "return value:" << ret << std::endl;
527 }
528
GetCurrentCallList()529 void BluetoothCallTest::GetCurrentCallList()
530 {
531 AccessToken token;
532 int32_t slotId = DEFAULT_VALUE;
533 std::cout << "------GetCurrentCallList------" << std::endl;
534 std::cout << "Please enter slotId:" << std::endl;
535 std::cin >> slotId;
536 if (g_bluetoothCallPtr == nullptr) {
537 std::cout << "g_bluetoothCallPtr is nullptr" << std::endl;
538 return;
539 }
540 std::vector<CallAttributeInfo> callVec = g_bluetoothCallPtr->GetCurrentCallList(slotId);
541 std::cout << "call list count:" << callVec.size() << std::endl;
542 std::vector<CallAttributeInfo>::iterator it = callVec.begin();
543 for (; it != callVec.end(); ++it) {
544 std::cout << "number:" << (*it).accountNumber << ", callState:"
545 << static_cast<int32_t>((*it).callState) << std::endl;
546 }
547 }
548 } // namespace Telephony
549 } // namespace OHOS
550