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 "core_service_connection.h" 17 18 #include "call_manager_errors.h" 19 #include "core_service_client.h" 20 #include "telephony_log_wrapper.h" 21 22 namespace OHOS { 23 namespace Telephony { GetFdnNumberList(int slotId)24std::vector<std::u16string> CoreServiceConnection::GetFdnNumberList(int slotId) 25 { 26 std::vector<std::u16string> numberVec; 27 numberVec.clear(); 28 std::vector<std::shared_ptr<DiallingNumbersInfo>> diallingNumbers; 29 DelayedRefSingleton<CoreServiceClient>::GetInstance().QueryIccDiallingNumbers( 30 slotId, DiallingNumbersInfo::SIM_FDN, diallingNumbers); 31 if (diallingNumbers.empty()) { 32 TELEPHONY_LOGE("fdn number list is empty"); 33 return numberVec; 34 } 35 for (std::vector<std::shared_ptr<DiallingNumbersInfo>>::iterator it = diallingNumbers.begin(); 36 it != diallingNumbers.end(); ++it) { 37 numberVec.push_back((*it)->GetNumber()); 38 } 39 return numberVec; 40 } 41 IsFdnEnabled(int slotId)42bool CoreServiceConnection::IsFdnEnabled(int slotId) 43 { 44 LockState lockState = LockState::LOCK_ERROR; 45 int32_t ret = 46 DelayedRefSingleton<CoreServiceClient>::GetInstance().GetLockState(slotId, LockType::FDN_LOCK, lockState); 47 if (ret == TELEPHONY_ERR_SUCCESS && lockState == LockState::LOCK_ON) { 48 TELEPHONY_LOGI("Fdn is enabled"); 49 return true; 50 } 51 return false; 52 } 53 } // namespace Telephony 54 } // namespace OHOS 55