• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "cellular_call_callback.h"
17 
18 #include "cellular_call_proxy.h"
19 #include "system_ability_definition.h"
20 #include "iservice_registry.h"
21 #include "telephony_log_wrapper.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 CellularCallCallback::CellularCallCallback() = default;
26 
27 CellularCallCallback::~CellularCallCallback() = default;
28 
ClearCellularCallList(int32_t slotId)29 void CellularCallCallback::ClearCellularCallList(int32_t slotId)
30 {
31     auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
32     if (systemAbilityMgr == nullptr) {
33         TELEPHONY_LOGE("ClearCellularCallList return, Get ISystemAbilityManager failed.");
34         return;
35     }
36     auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
37     if (remote == nullptr) {
38         TELEPHONY_LOGE("ClearCellularCallList return, CellularCallService Remote service not exists.");
39         return;
40     }
41     TELEPHONY_LOGI("HangUpAllConnection for slotId[%{public}d]", slotId);
42     iface_cast<CellularCallInterface>(remote)->HangUpAllConnection(slotId);
43 }
44 
SetReadyToCall(int32_t slotId,int32_t callType,bool isReadyToCall)45 void CellularCallCallback::SetReadyToCall(int32_t slotId, int32_t callType, bool isReadyToCall)
46 {
47     auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
48     if (systemAbilityMgr == nullptr) {
49         TELEPHONY_LOGE("SetReadyToCall return, Get ISystemAbilityManager failed.");
50         return;
51     }
52     auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
53     if (remote == nullptr) {
54         TELEPHONY_LOGE("SetReadyToCall return, CellularCallService Remote service not exists.");
55         return;
56     }
57     iface_cast<CellularCallInterface>(remote)->SetReadyToCall(slotId, callType, isReadyToCall);
58 }
59 } // namespace Telephony
60 } // namespace OHOS
61