• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 "cellular_call_register.h"
17 
18 #include "cellular_call_hisysevent.h"
19 #include "core_manager_inner.h"
20 #include "hitrace_meter.h"
21 #include "iservice_registry.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 constexpr size_t CHAR_LENG = 1;
26 
CellularCallRegister()27 CellularCallRegister::CellularCallRegister() : callManagerCallBack_(nullptr) {}
28 
~CellularCallRegister()29 CellularCallRegister::~CellularCallRegister() {}
30 
ReportCallsInfo(const CallsReportInfo & callsReportInfo)31 void CellularCallRegister::ReportCallsInfo(const CallsReportInfo &callsReportInfo)
32 {
33     TELEPHONY_LOGD("ReportCallsInfo entry.");
34     CallsReportInfo callsInfo = callsReportInfo;
35     CallDetailInfo detailInfo;
36     detailInfo.state = TelCallState::CALL_STATUS_UNKNOWN;
37     std::vector<CallReportInfo>::iterator it = callsInfo.callVec.begin();
38     for (; it != callsInfo.callVec.end(); ++it) {
39         detailInfo.callType = (*it).callType;
40         detailInfo.accountId = (*it).accountId;
41         detailInfo.state = (*it).state;
42         detailInfo.callMode = (*it).callMode;
43     }
44 
45     std::lock_guard<std::mutex> lock(mutex_);
46     if (callManagerCallBack_ == nullptr) {
47         TELEPHONY_LOGE("ReportCallsInfo return, callManagerCallBack_ is nullptr, report fail!");
48         if (detailInfo.state == TelCallState::CALL_STATUS_INCOMING) {
49             FinishAsyncTrace(HITRACE_TAG_OHOS, "CellularCallIncoming", getpid());
50         }
51         return;
52     }
53     CoreManagerInner::GetInstance().NotifyCallStatusToNetworkSearch(
54         detailInfo.accountId, static_cast<int32_t>(detailInfo.state));
55     if (detailInfo.state == TelCallState::CALL_STATUS_INCOMING) {
56         DelayedSingleton<CellularCallHiSysEvent>::GetInstance()->SetIncomingCallParameterInfo(
57             static_cast<int32_t>(detailInfo.callType), static_cast<int32_t>(detailInfo.callMode));
58         FinishAsyncTrace(HITRACE_TAG_OHOS, "CellularCallIncoming", getpid());
59     }
60     callManagerCallBack_->UpdateCallsReportInfo(callsReportInfo);
61 }
62 
RegisterCallManagerCallBack(const sptr<ICallStatusCallback> & callback)63 int32_t CellularCallRegister::RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback)
64 {
65     std::lock_guard<std::mutex> lock(mutex_);
66     callManagerCallBack_ = callback;
67     return TELEPHONY_SUCCESS;
68 }
69 
ReportSingleCallInfo(const CallReportInfo & info,TelCallState callState)70 void CellularCallRegister::ReportSingleCallInfo(const CallReportInfo &info, TelCallState callState)
71 {
72     TELEPHONY_LOGD("ReportSingleCallInfo entry");
73     CallReportInfo cellularCallReportInfo = info;
74     cellularCallReportInfo.state = callState;
75     std::lock_guard<std::mutex> lock(mutex_);
76     if (callManagerCallBack_ == nullptr) {
77         TELEPHONY_LOGE("ReportSingleCallInfo return, callManagerCallBack_ is nullptr, report fail!");
78         return;
79     }
80     callManagerCallBack_->UpdateCallReportInfo(cellularCallReportInfo);
81 }
82 
UnRegisterCallManagerCallBack()83 int32_t CellularCallRegister::UnRegisterCallManagerCallBack()
84 {
85     std::lock_guard<std::mutex> lock(mutex_);
86     callManagerCallBack_ = nullptr;
87     return TELEPHONY_SUCCESS;
88 }
89 
ReportEventResultInfo(const CellularCallEventInfo & info)90 void CellularCallRegister::ReportEventResultInfo(const CellularCallEventInfo &info)
91 {
92     TELEPHONY_LOGI("ReportEventResultInfo entry eventId:%{public}d", info.eventId);
93     std::lock_guard<std::mutex> lock(mutex_);
94     if (callManagerCallBack_ == nullptr) {
95         TELEPHONY_LOGE("ReportEventResultInfo return, callManagerCallBack_ is nullptr, report fail!");
96         return;
97     }
98     callManagerCallBack_->UpdateEventResultInfo(info);
99 }
100 
ReportGetWaitingResult(const CallWaitResponse & response)101 void CellularCallRegister::ReportGetWaitingResult(const CallWaitResponse &response)
102 {
103     TELEPHONY_LOGI("ReportGetWaitingResult result:%{public}d, status:%{public}d, class:%{public}d", response.result,
104         response.status, response.classCw);
105     std::lock_guard<std::mutex> lock(mutex_);
106     if (callManagerCallBack_ == nullptr) {
107         TELEPHONY_LOGE("ReportGetWaitingResult return, callManagerCallBack_ is nullptr, report fail!");
108         return;
109     }
110     callManagerCallBack_->UpdateGetWaitingResult(response);
111 }
112 
ReportSetWaitingResult(int32_t result)113 void CellularCallRegister::ReportSetWaitingResult(int32_t result)
114 {
115     TELEPHONY_LOGI("ReportSetWaitingResult result:%{public}d", result);
116     std::lock_guard<std::mutex> lock(mutex_);
117     if (callManagerCallBack_ == nullptr) {
118         TELEPHONY_LOGE("ReportSetWaitingResult return, callManagerCallBack_ is nullptr, report fail!");
119         return;
120     }
121     callManagerCallBack_->UpdateSetWaitingResult(result);
122 }
123 
ReportGetRestrictionResult(const CallRestrictionResponse & response)124 void CellularCallRegister::ReportGetRestrictionResult(const CallRestrictionResponse &response)
125 {
126     TELEPHONY_LOGI("ReportGetRestrictionResult result:%{public}d, status:%{public}d, class:%{public}d",
127         response.result, response.status, response.classCw);
128     std::lock_guard<std::mutex> lock(mutex_);
129     if (callManagerCallBack_ == nullptr) {
130         TELEPHONY_LOGE("ReportGetRestrictionResult return, callManagerCallBack_ is nullptr, report fail!");
131         return;
132     }
133     callManagerCallBack_->UpdateGetRestrictionResult(response);
134 }
135 
ReportSetRestrictionResult(int32_t result)136 void CellularCallRegister::ReportSetRestrictionResult(int32_t result)
137 {
138     TELEPHONY_LOGI("ReportSetRestrictionResult result:%{public}d", result);
139     std::lock_guard<std::mutex> lock(mutex_);
140     if (callManagerCallBack_ == nullptr) {
141         TELEPHONY_LOGE("ReportSetRestrictionResult return, callManagerCallBack_ is nullptr, report fail!");
142         return;
143     }
144     callManagerCallBack_->UpdateSetRestrictionResult(result);
145 }
146 
ReportGetTransferResult(const CallTransferResponse & response)147 void CellularCallRegister::ReportGetTransferResult(const CallTransferResponse &response)
148 {
149     TELEPHONY_LOGI("ReportGetTransferResult result:%{public}d, status:%{public}d, class:%{public}d", response.result,
150         response.status, response.classx);
151     TELEPHONY_LOGI("ReportGetTransferResult type:%{public}d, reason:%{public}d, time:%{public}d",
152         response.type, response.reason, response.time);
153     std::lock_guard<std::mutex> lock(mutex_);
154     if (callManagerCallBack_ == nullptr) {
155         TELEPHONY_LOGE("ReportGetTransferResult return, callManagerCallBack_ is nullptr, report fail!");
156         return;
157     }
158     callManagerCallBack_->UpdateGetTransferResult(response);
159 }
160 
ReportSetBarringPasswordResult(int32_t result)161 void CellularCallRegister::ReportSetBarringPasswordResult(int32_t result)
162 {
163     TELEPHONY_LOGI("Set barring password result:%{public}d", result);
164     std::lock_guard<std::mutex> lock(mutex_);
165     if (callManagerCallBack_ == nullptr) {
166         TELEPHONY_LOGE("callManagerCallBack_ is nullptr, report fail!");
167         return;
168     }
169     callManagerCallBack_->UpdateSetRestrictionPasswordResult(result);
170 }
171 
ReportSetTransferResult(int32_t result)172 void CellularCallRegister::ReportSetTransferResult(int32_t result)
173 {
174     TELEPHONY_LOGI("ReportSetTransferResult result:%{public}d", result);
175     std::lock_guard<std::mutex> lock(mutex_);
176     if (callManagerCallBack_ == nullptr) {
177         TELEPHONY_LOGE("ReportSetTransferResult return, callManagerCallBack_ is nullptr, report fail!");
178         return;
179     }
180     callManagerCallBack_->UpdateSetTransferResult(result);
181 }
182 
ReportGetClipResult(const ClipResponse & response)183 void CellularCallRegister::ReportGetClipResult(const ClipResponse &response)
184 {
185     TELEPHONY_LOGI("ReportGetClipResult result:%{public}d, action:%{public}d, stat:%{public}d", response.result,
186         response.action, response.clipStat);
187     std::lock_guard<std::mutex> lock(mutex_);
188     if (callManagerCallBack_ == nullptr) {
189         TELEPHONY_LOGE("ReportGetClipResult return, callManagerCallBack_ is nullptr, report fail!");
190         return;
191     }
192     callManagerCallBack_->UpdateGetCallClipResult(response);
193 }
194 
ReportGetClirResult(const ClirResponse & response)195 void CellularCallRegister::ReportGetClirResult(const ClirResponse &response)
196 {
197     TELEPHONY_LOGI("ReportGetClirResult result:%{public}d, action:%{public}d, stat:%{public}d", response.result,
198         response.action, response.clirStat);
199     std::lock_guard<std::mutex> lock(mutex_);
200     if (callManagerCallBack_ == nullptr) {
201         TELEPHONY_LOGE("ReportGetClirResult return, callManagerCallBack_ is nullptr, report fail!");
202         return;
203     }
204     callManagerCallBack_->UpdateGetCallClirResult(response);
205 }
206 
ReportSetClirResult(int32_t result)207 void CellularCallRegister::ReportSetClirResult(int32_t result)
208 {
209     TELEPHONY_LOGI("ReportSetClirResult result:%{public}d", result);
210     std::lock_guard<std::mutex> lock(mutex_);
211     if (callManagerCallBack_ == nullptr) {
212         TELEPHONY_LOGE("ReportSetClirResult return, callManagerCallBack_ is nullptr, report fail!");
213         return;
214     }
215     callManagerCallBack_->UpdateSetCallClirResult(result);
216 }
217 
ReportGetImsConfigResult(const GetImsConfigResponse & response)218 void CellularCallRegister::ReportGetImsConfigResult(const GetImsConfigResponse &response)
219 {
220     TELEPHONY_LOGI("ReportGetImsConfigResult entry, value:%{public}d", response.value);
221     std::lock_guard<std::mutex> lock(mutex_);
222     if (callManagerCallBack_ == nullptr) {
223         TELEPHONY_LOGE("ReportGetImsConfigResult return, callManagerCallBack_ is nullptr, report fail!");
224         return;
225     }
226     callManagerCallBack_->GetImsConfigResult(response);
227 }
228 
ReportSetImsConfigResult(int32_t result)229 void CellularCallRegister::ReportSetImsConfigResult(int32_t result)
230 {
231     std::lock_guard<std::mutex> lock(mutex_);
232     if (callManagerCallBack_ == nullptr) {
233         TELEPHONY_LOGE("ReportSetImsConfigResult return, callManagerCallBack_ is nullptr, report fail!");
234         return;
235     }
236     callManagerCallBack_->SetImsConfigResult(result);
237 }
238 
ReportSetImsFeatureResult(int32_t result)239 void CellularCallRegister::ReportSetImsFeatureResult(int32_t result)
240 {
241     std::lock_guard<std::mutex> lock(mutex_);
242     if (callManagerCallBack_ == nullptr) {
243         TELEPHONY_LOGE("ReportSetImsFeatureResult return, callManagerCallBack_ is nullptr, report fail!");
244         return;
245     }
246     callManagerCallBack_->SetImsFeatureValueResult(result);
247 }
248 
ReportGetImsFeatureResult(const GetImsFeatureValueResponse & response)249 void CellularCallRegister::ReportGetImsFeatureResult(const GetImsFeatureValueResponse &response)
250 {
251     TELEPHONY_LOGI("ReportGetImsFeatureResult entry, value:%{public}d", response.value);
252     std::lock_guard<std::mutex> lock(mutex_);
253     if (callManagerCallBack_ == nullptr) {
254         TELEPHONY_LOGE("ReportGetImsFeatureResult return, callManagerCallBack_ is nullptr, report fail!");
255         return;
256     }
257     callManagerCallBack_->GetImsFeatureValueResult(response);
258 }
259 
ReportCallRingBackResult(int32_t status)260 void CellularCallRegister::ReportCallRingBackResult(int32_t status)
261 {
262     TELEPHONY_LOGI("ReportCallRingBackResult entry");
263     std::lock_guard<std::mutex> lock(mutex_);
264     if (callManagerCallBack_ == nullptr) {
265         TELEPHONY_LOGE("ReportCallRingBackResult return, callManagerCallBack_ is nullptr, report fail!");
266         return;
267     }
268     callManagerCallBack_->UpdateRBTPlayInfo(static_cast<RBTPlayInfo>(status));
269 }
270 
ReportCallFailReason(const DisconnectedDetails & details)271 void CellularCallRegister::ReportCallFailReason(const DisconnectedDetails &details)
272 {
273     std::lock_guard<std::mutex> lock(mutex_);
274     if (callManagerCallBack_ == nullptr) {
275         TELEPHONY_LOGE("ReportCallFailReason return, callManagerCallBack_ is nullptr, report fail!");
276         return;
277     }
278     callManagerCallBack_->UpdateDisconnectedCause(details);
279 }
280 
ReportGetMuteResult(const MuteControlResponse & response)281 void CellularCallRegister::ReportGetMuteResult(const MuteControlResponse &response)
282 {
283     TELEPHONY_LOGI("ReportGetMuteResult entry result:%{public}d, value:%{public}d", response.result, response.value);
284     std::lock_guard<std::mutex> lock(mutex_);
285     if (callManagerCallBack_ == nullptr) {
286         TELEPHONY_LOGE("ReportMuteResult return, callManagerCallBack_ is nullptr, report fail!");
287         return;
288     }
289 }
290 
ReportSetMuteResult(const MuteControlResponse & response)291 void CellularCallRegister::ReportSetMuteResult(const MuteControlResponse &response)
292 {
293     TELEPHONY_LOGI("ReportSetMuteResult entry result:%{public}d, value:%{public}d", response.result, response.value);
294 }
295 
ReportInviteToConferenceResult(int32_t result)296 void CellularCallRegister::ReportInviteToConferenceResult(int32_t result)
297 {
298     TELEPHONY_LOGI("ReportInviteToConferenceResult entry result:%{public}d", result);
299     std::lock_guard<std::mutex> lock(mutex_);
300     if (callManagerCallBack_ == nullptr) {
301         TELEPHONY_LOGE("ReportInviteToConferenceResult return, callManagerCallBack_ is nullptr, report fail!");
302         return;
303     }
304     callManagerCallBack_->InviteToConferenceResult(result);
305 }
306 
ReportGetCallDataResult(int32_t result)307 void CellularCallRegister::ReportGetCallDataResult(int32_t result)
308 {
309     std::lock_guard<std::mutex> lock(mutex_);
310     if (callManagerCallBack_ == nullptr) {
311         TELEPHONY_LOGE("ReportGetCallDataResult return, callManagerCallBack_ is nullptr, report fail!");
312         return;
313     }
314     callManagerCallBack_->GetImsCallDataResult(result);
315 }
316 
ReportStartDtmfResult(int32_t result)317 void CellularCallRegister::ReportStartDtmfResult(int32_t result)
318 {
319     std::lock_guard<std::mutex> lock(mutex_);
320     if (callManagerCallBack_ == nullptr) {
321         TELEPHONY_LOGE("ReportStartDtmfResult return, callManagerCallBack_ is nullptr, report fail!");
322         return;
323     }
324     callManagerCallBack_->StartDtmfResult(result);
325 }
326 
ReportStopDtmfResult(int32_t result)327 void CellularCallRegister::ReportStopDtmfResult(int32_t result)
328 {
329     std::lock_guard<std::mutex> lock(mutex_);
330     if (callManagerCallBack_ == nullptr) {
331         TELEPHONY_LOGE("ReportStopDtmfResult return, callManagerCallBack_ is nullptr, report fail!");
332         return;
333     }
334     callManagerCallBack_->StopDtmfResult(result);
335 }
336 
ReportStartRttResult(int32_t result)337 void CellularCallRegister::ReportStartRttResult(int32_t result)
338 {
339     std::lock_guard<std::mutex> lock(mutex_);
340     if (callManagerCallBack_ == nullptr) {
341         TELEPHONY_LOGE("ReportStartRttResult return, callManagerCallBack_ is nullptr, report fail!");
342         return;
343     }
344     callManagerCallBack_->StartRttResult(result);
345 }
346 
ReportStopRttResult(int32_t result)347 void CellularCallRegister::ReportStopRttResult(int32_t result)
348 {
349     std::lock_guard<std::mutex> lock(mutex_);
350     if (callManagerCallBack_ == nullptr) {
351         TELEPHONY_LOGE("ReportStopRttResult return, callManagerCallBack_ is nullptr, report fail!");
352         return;
353     }
354     callManagerCallBack_->StopRttResult(result);
355 }
356 
ReportSendUssdResult(int32_t result)357 void CellularCallRegister::ReportSendUssdResult(int32_t result)
358 {
359     std::lock_guard<std::mutex> lock(mutex_);
360     if (callManagerCallBack_ == nullptr) {
361         TELEPHONY_LOGE("ReportSendUssdResult return, callManagerCallBack_ is nullptr, report fail!");
362         return;
363     }
364     callManagerCallBack_->SendUssdResult(result);
365 }
366 
ReportMmiCodeResult(const MmiCodeInfo & info)367 void CellularCallRegister::ReportMmiCodeResult(const MmiCodeInfo &info)
368 {
369     TELEPHONY_LOGI("ReportMmiCodeResult entry result:%{public}d, value:%{public}s", info.result, info.message);
370     std::lock_guard<std::mutex> lock(mutex_);
371     if (callManagerCallBack_ == nullptr) {
372         TELEPHONY_LOGE("ReportMmiCodeResult return, callManagerCallBack_ is nullptr, report fail!");
373         return;
374     }
375     callManagerCallBack_->SendMmiCodeResult(info);
376 }
377 
ReportSetEmergencyCallListResponse(const SetEccListResponse & response)378 void CellularCallRegister::ReportSetEmergencyCallListResponse(const SetEccListResponse &response)
379 {
380     TELEPHONY_LOGI("ReportSetEmergencyCallListResponse entry result:%{public}d, value:%{public}d",
381         response.result, response.value);
382 }
383 
IsCallManagerCallBackRegistered()384 bool CellularCallRegister::IsCallManagerCallBackRegistered()
385 {
386     std::lock_guard<std::mutex> lock(mutex_);
387     return callManagerCallBack_ != nullptr;
388 }
389 
ReportCloseUnFinishedUssdResult(int32_t result)390 void CellularCallRegister::ReportCloseUnFinishedUssdResult(int32_t result)
391 {
392     std::lock_guard<std::mutex> lock(mutex_);
393     if (callManagerCallBack_ == nullptr) {
394         TELEPHONY_LOGE("ReportCloseUnFinishedUssdResult return, callManagerCallBack_ is nullptr, report fail!");
395         return;
396     }
397     callManagerCallBack_->CloseUnFinishedUssdResult(result);
398 }
399 
ReportPostDialChar(char c)400 void CellularCallRegister::ReportPostDialChar(char c)
401 {
402     std::lock_guard<std::mutex> lock(mutex_);
403     if (callManagerCallBack_ == nullptr) {
404         TELEPHONY_LOGE("ReportPostDialChar return, callManagerCallBack_ is nullptr, report fail!");
405         return;
406     }
407     std::string nextDtmf(CHAR_LENG, c);
408     callManagerCallBack_->ReportPostDialChar(nextDtmf);
409 }
410 
ReportPostDialDelay(std::string str)411 void CellularCallRegister::ReportPostDialDelay(std::string str)
412 {
413     std::lock_guard<std::mutex> lock(mutex_);
414     if (callManagerCallBack_ == nullptr) {
415         TELEPHONY_LOGE("ReportPostDialChar return, callManagerCallBack_ is nullptr, report fail!");
416         return;
417     }
418     callManagerCallBack_->ReportPostDialDelay(str);
419 }
420 
ReceiveUpdateCallMediaModeRequest(ImsCallModeReceiveInfo & callModeInfo)421 void CellularCallRegister::ReceiveUpdateCallMediaModeRequest(ImsCallModeReceiveInfo &callModeInfo)
422 {
423     std::lock_guard<std::mutex> lock(mutex_);
424     if (callManagerCallBack_ == nullptr) {
425         TELEPHONY_LOGE("ReceiveUpdateCallMediaModeRequest return, callManagerCallBack_ is nullptr, report fail!");
426         return;
427     }
428     CallModeReportInfo response;
429     response.callIndex = callModeInfo.callIndex;
430     response.result = static_cast<VideoRequestResultType>(callModeInfo.result);
431     ImsCallMode callMode = ConverToImsCallMode(callModeInfo.callType);
432     response.callMode = callMode;
433     callManagerCallBack_->ReceiveUpdateCallMediaModeRequest(response);
434 }
435 
ReceiveUpdateCallMediaModeResponse(ImsCallModeReceiveInfo & callModeInfo)436 void CellularCallRegister::ReceiveUpdateCallMediaModeResponse(ImsCallModeReceiveInfo &callModeInfo)
437 {
438     std::lock_guard<std::mutex> lock(mutex_);
439     if (callManagerCallBack_ == nullptr) {
440         TELEPHONY_LOGE("ReceiveUpdateCallMediaModeResponse return, callManagerCallBack_ is nullptr, report fail!");
441         return;
442     }
443     CallModeReportInfo response;
444     response.callIndex = callModeInfo.callIndex;
445     response.result = static_cast<VideoRequestResultType>(callModeInfo.result);
446     ImsCallMode callMode = ConverToImsCallMode(callModeInfo.callType);
447     response.callMode = callMode;
448     callManagerCallBack_->ReceiveUpdateCallMediaModeResponse(response);
449 }
450 
HandleCallSessionEventChanged(ImsCallSessionEventInfo & callSessionEventInfo)451 void CellularCallRegister::HandleCallSessionEventChanged(ImsCallSessionEventInfo &callSessionEventInfo)
452 {
453     std::lock_guard<std::mutex> lock(mutex_);
454     if (callManagerCallBack_ == nullptr) {
455         TELEPHONY_LOGE("HandleCallSessionEventChanged return, callManagerCallBack_ is nullptr, report fail!");
456         return;
457     }
458     CallSessionReportInfo response;
459     response.index = callSessionEventInfo.callIndex;
460     response.eventId = static_cast<CallSessionEventId>(callSessionEventInfo.eventType);
461     callManagerCallBack_->HandleCallSessionEventChanged(response);
462 }
463 
HandlePeerDimensionsChanged(ImsCallPeerDimensionsInfo & callPeerDimensionsInfo)464 void CellularCallRegister::HandlePeerDimensionsChanged(ImsCallPeerDimensionsInfo &callPeerDimensionsInfo)
465 {
466     std::lock_guard<std::mutex> lock(mutex_);
467     if (callManagerCallBack_ == nullptr) {
468         TELEPHONY_LOGE("HandlePeerDimensionsChanged return, callManagerCallBack_ is nullptr, report fail!");
469         return;
470     }
471     PeerDimensionsReportInfo response;
472     response.index = callPeerDimensionsInfo.callIndex;
473     response.width = callPeerDimensionsInfo.width;
474     response.height = callPeerDimensionsInfo.height;
475     callManagerCallBack_->HandlePeerDimensionsChanged(response);
476 }
477 
HandleCallDataUsageChanged(ImsCallDataUsageInfo & callDataUsageInfo)478 void CellularCallRegister::HandleCallDataUsageChanged(ImsCallDataUsageInfo &callDataUsageInfo)
479 {
480     std::lock_guard<std::mutex> lock(mutex_);
481     if (callManagerCallBack_ == nullptr) {
482         TELEPHONY_LOGE("HandleCallDataUsageChanged return, callManagerCallBack_ is nullptr, report fail!");
483         return;
484     }
485     int64_t response = callDataUsageInfo.dataUsage;
486     callManagerCallBack_->HandleCallDataUsageChanged(response);
487 }
488 
HandleCameraCapabilitiesChanged(CameraCapabilitiesInfo & cameraCapabilitiesInfo)489 void CellularCallRegister::HandleCameraCapabilitiesChanged(CameraCapabilitiesInfo &cameraCapabilitiesInfo)
490 {
491     std::lock_guard<std::mutex> lock(mutex_);
492     if (callManagerCallBack_ == nullptr) {
493         TELEPHONY_LOGE("HandleCameraCapabilitiesChanged return, callManagerCallBack_ is nullptr, report fail!");
494         return;
495     }
496     CameraCapabilitiesReportInfo response;
497     response.index = cameraCapabilitiesInfo.callIndex;
498     response.width = cameraCapabilitiesInfo.width;
499     response.height = cameraCapabilitiesInfo.height;
500     callManagerCallBack_->HandleCameraCapabilitiesChanged(response);
501 }
502 
ConverToImsCallMode(ImsCallType callType)503 ImsCallMode CellularCallRegister::ConverToImsCallMode(ImsCallType callType)
504 {
505     ImsCallMode callMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
506     switch (callType) {
507         case ImsCallType::TEL_IMS_CALL_TYPE_VOICE:
508             callMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
509             break;
510         case ImsCallType::TEL_IMS_CALL_TYPE_VT_TX:
511             callMode = ImsCallMode::CALL_MODE_SEND_ONLY;
512             break;
513         case ImsCallType::TEL_IMS_CALL_TYPE_VT_RX:
514             callMode = ImsCallMode::CALL_MODE_RECEIVE_ONLY;
515             break;
516         case ImsCallType::TEL_IMS_CALL_TYPE_VT:
517             callMode = ImsCallMode::CALL_MODE_SEND_RECEIVE;
518             break;
519         case ImsCallType::TEL_IMS_CALL_TYPE_PAUSE:
520             callMode = ImsCallMode::CALL_MODE_VIDEO_PAUSED;
521             break;
522         default:
523             TELEPHONY_LOGE("unknown callType");
524             break;
525     }
526     return callMode;
527 }
528 } // namespace Telephony
529 } // namespace OHOS
530