mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2025-02-12 12:28:57 +00:00
commit
16c09d57e3
3
BUILD.gn
3
BUILD.gn
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2021-2024 Huawei Device Co., Ltd.
|
||||
# Copyright (C) 2021-2025 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -88,6 +88,7 @@ ohos_shared_library("tel_core_service") {
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_char_decode.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file_init_controller.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_file_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_manager.cpp",
|
||||
"$TELEPHONY_SIM_ROOT/src/sim_number_decode.cpp",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -314,6 +314,142 @@ enum CallForwardingStatus {
|
||||
CALL_FORWARDING_STATUS_UNKNOWN = -1,
|
||||
};
|
||||
|
||||
enum class UsimService {
|
||||
PHONEBOOK = 1,
|
||||
FDN, // Fixed Dialing Numbers
|
||||
FDN_EXTENSION,
|
||||
SDN,
|
||||
SDN_EXTENSION,
|
||||
BDN,
|
||||
BDN_EXTENSION,
|
||||
OUTGOING_CALL_INFO,
|
||||
INCOMING_CALL_INFO,
|
||||
SM_STORAGE,
|
||||
SM_STATUS_REPORTS,
|
||||
SM_SERVICE_PARAMS,
|
||||
ADVICE_OF_CHARGE,
|
||||
CAP_CONFIG_PARAMS_2,
|
||||
CB_MESSAGE_ID,
|
||||
CB_MESSAGE_ID_RANGES,
|
||||
GROUP_ID_LEVEL_1,
|
||||
GROUP_ID_LEVEL_2,
|
||||
SPN,
|
||||
USER_PLMN_SELECT,
|
||||
MSISDN,
|
||||
IMAGE,
|
||||
LOCALISED_SERVICE_AREAS,
|
||||
EMLPP,
|
||||
EMLPP_AUTO_ANSWER,
|
||||
RFU,
|
||||
GSM_ACCESS,
|
||||
DATA_DL_VIA_SMS_PP,
|
||||
DATA_DL_VIA_SMS_CB,
|
||||
CALL_CONTROL_BY_USIM,
|
||||
MO_SMS_CONTROL_BY_USIM,
|
||||
RUN_AT_COMMAND,
|
||||
IGNORED_1,
|
||||
ENABLED_SERVICE_TABLE,
|
||||
APN_CONTROL_LIST,
|
||||
DEPERSONALISATION_CONTROL_KEYS,
|
||||
COOPERATIVE_NETWORK_LIST,
|
||||
GSM_SECURITY_CONTEXT,
|
||||
CPBCCH_INFO,
|
||||
INVESTIGATION_SCAN,
|
||||
MEXE,
|
||||
OPERATOR_PLMN_SELECT,
|
||||
HPLMN_SELECT,
|
||||
EXTENSION_5,
|
||||
PLMN_NETWORK_NAME,
|
||||
OPERATOR_PLMN_LIST,
|
||||
MBDN,
|
||||
MWI_STATUS,
|
||||
CFI_STATUS,
|
||||
IGNORED_2,
|
||||
SERVICE_PROVIDER_DISPLAY_INFO,
|
||||
MMS_NOTIFICATION,
|
||||
MMS_NOTIFICATION_EXTENSION,
|
||||
GPRS_CALL_CONTROL_BY_USIM,
|
||||
MMS_CONNECTIVITY_PARAMS,
|
||||
NETWORK_INDICATION_OF_ALERTING,
|
||||
VGCS_GROUP_ID_LIST,
|
||||
VBS_GROUP_ID_LIST,
|
||||
PSEUDONYM,
|
||||
IWLAN_USER_PLMN_SELECT,
|
||||
IWLAN_OPERATOR_PLMN_SELECT,
|
||||
USER_WSID_LIST,
|
||||
OPERATOR_WSID_LIST,
|
||||
VGCS_SECURITY,
|
||||
VBS_SECURITY,
|
||||
WLAN_REAUTH_IDENTITY,
|
||||
MM_STORAGE,
|
||||
GBA,
|
||||
MBMS_SECURITY,
|
||||
DATA_DL_VIA_USSD,
|
||||
EQUIVALENT_HPLMN,
|
||||
TERMINAL_PROFILE_AFTER_UICC_ACTIVATION,
|
||||
EQUIVALENT_HPLMN_PRESENTATION,
|
||||
LAST_RPLMN_SELECTION_INDICATION,
|
||||
OMA_BCAST_PROFILE,
|
||||
GBA_LOCAL_KEY_ESTABLISHMENT,
|
||||
TERMINAL_APPLICATIONS,
|
||||
SPN_ICON,
|
||||
PLMN_NETWORK_NAME_ICON,
|
||||
USIM_IP_CONNECTION_PARAMS,
|
||||
IWLAN_HOME_ID_LIST,
|
||||
IWLAN_EQUIVALENT_HPLMN_PRESENTATION,
|
||||
IWLAN_HPLMN_PRIORITY_INDICATION,
|
||||
IWLAN_LAST_REGISTERED_PLMN,
|
||||
EPS_MOBILITY_MANAGEMENT_INFO,
|
||||
ALLOWED_CSG_LISTS_AND_INDICATIONS,
|
||||
CALL_CONTROL_ON_EPS_PDN_CONNECTION_BY_USIM,
|
||||
HPLMN_DIRECT_ACCESS,
|
||||
ECALL_DATA,
|
||||
OPERATOR_CSG_LISTS_AND_INDICATIONS,
|
||||
SM_OVER_IP,
|
||||
CSG_DISPLAY_CONTROL,
|
||||
IMS_COMMUNICATION_CONTROL_BY_USIM,
|
||||
EXTENDED_TERMINAL_APPLICATIONS,
|
||||
UICC_ACCESS_TO_IMS,
|
||||
NAS_CONFIG_BY_USIM,
|
||||
PWS_CONFIG_BY_USIM,
|
||||
RFU2,
|
||||
URI_SUPPORT_BY_UICC,
|
||||
EXTENDED_EARFCN_SUPPORT,
|
||||
PROSE,
|
||||
USAT_APPLICATION_PAIRING,
|
||||
MEDIA_TYPE_SUPPORT,
|
||||
IMS_CALL_DISCONNECTION_CAUSE,
|
||||
URI_SUPPORT_FOR_MO_SHORT_MSG_CTL,
|
||||
EPDG_CONFIG_INFO_FOR_SERVICE_SUPPORT,
|
||||
EPDG_CONFIG_INFO_FOR_SERVICE_CONFIGURED,
|
||||
ACDC_SUPPORT,
|
||||
MISSION_CTITICAL_SERVICES,
|
||||
EPDG_CONFIG_INFO_FOR_EMG_SERVICE_SUPPORT,
|
||||
EPDG_CONFIG_INFO_FOR_EMG_SERVICE_CONFIGURED,
|
||||
ECALL_DATA_OVER_MIS,
|
||||
URI_SUPPORTED_FOR_SMS_PP_DOWNLOAD,
|
||||
FROM_PREFERRED,
|
||||
IMS_CONFIG_DATA,
|
||||
TV_CONFIG,
|
||||
FOR_3GPP_PS_DATA_OFF,
|
||||
FOR_3GPP_PS_DATA_OFF_SERVICE_LIST,
|
||||
V2X,
|
||||
XCAP_CONFIG_DATA,
|
||||
EARFCN_LIST_FOR_MTC_OR_NB_LOT_UES,
|
||||
FOR_5GS_MOBILITY_MANAGEMENT_INFO,
|
||||
FOR_5G_SECURITY_PARAMETERS,
|
||||
SUBSCRIPTION_IDENTIFIER_PRIVACY_SUPPORT,
|
||||
SUCI_CALCULATION_BY_THE_USIM,
|
||||
UAC_ACCESS_IDENTITIES_SUPPORT,
|
||||
CTRL_PLANE_BASED_STEERING_OF_UE_IN_VPLMN,
|
||||
CALL_CTRL_ON_PDU_SESSION_BY_USIM,
|
||||
FOR_5GS_OPERATOR_PLMN_LIST,
|
||||
SUPPORT_FOR_SUPI_OF_TYPE_NET_SPEC_IDENTIFIER,
|
||||
FOR_3GPP_PS_DATA_OFF_SEPARATE_HOME_AND_ROAMING_LISTS,
|
||||
SUPPORT_FOR_URSP_BY_USIM,
|
||||
FOR_5G_SECURITY_PARAMETERS_EXTENDED,
|
||||
};
|
||||
|
||||
inline const std::string DATASHARE_READY_EVENT = "usual.event.DATA_SHARE_READY";
|
||||
inline const std::string BUNDLE_SCAN_FINISHED_EVENT = "usual.event.BUNDLE_SCAN_FINISHED";
|
||||
} // namespace Telephony
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -161,6 +161,9 @@ private:
|
||||
const int SPN_CHAR_POS = 0;
|
||||
const int MAIL_DELAY_TIME = 50 * 1000;
|
||||
const int RELOAD_ICCID_COUNT = 3;
|
||||
const int BYTE_TO_BIT_LEN = 8;
|
||||
const int HEX_TO_BYTE_LEN = 2;
|
||||
const int HEX_TYPE = 16;
|
||||
bool hasRetryGetImsi_ = false;
|
||||
static const uint8_t CPHS_VOICE_MAIL_MASK = 0x30;
|
||||
static const uint8_t CPHS_VOICE_MAIL_EXSIT = 0x30;
|
||||
@ -178,6 +181,8 @@ private:
|
||||
void ParseOpl5g(const std::vector<std::string> &records);
|
||||
bool FillNumber(std::shared_ptr<unsigned char> efCfisData, int32_t efCfisSize, const std::string &number);
|
||||
bool VoiceMailNotEditToSim();
|
||||
bool IsServiceAvailable(UsimService service);
|
||||
std::string serviceTable_;
|
||||
};
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -285,32 +285,42 @@ void SimFile::ObtainCallForwardFiles()
|
||||
|
||||
void SimFile::LoadSimOtherFile()
|
||||
{
|
||||
AppExecFwk::InnerEvent::Pointer eventPnn = BuildCallerInfo(MSG_SIM_OBTAIN_PNN_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_PNN, eventPnn);
|
||||
fileToGet_++;
|
||||
|
||||
AppExecFwk::InnerEvent::Pointer eventOpl = BuildCallerInfo(MSG_SIM_OBTAIN_OPL_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_OPL, eventOpl);
|
||||
fileToGet_++;
|
||||
|
||||
AppExecFwk::InnerEvent::Pointer eventOpl5g = BuildCallerInfo(MSG_SIM_OBTAIN_OPL5G_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_OPL5G, eventOpl5g);
|
||||
fileToGet_++;
|
||||
|
||||
AppExecFwk::InnerEvent::Pointer phoneNumberEvent =
|
||||
CreateDiallingNumberPointer(MSG_SIM_OBTAIN_MSISDN_DONE, 0, 0, nullptr);
|
||||
diallingNumberHandler_->GetDiallingNumbers(
|
||||
ELEMENTARY_FILE_MSISDN, ObtainExtensionElementaryFile(ELEMENTARY_FILE_MSISDN), 1, phoneNumberEvent);
|
||||
fileToGet_++;
|
||||
|
||||
AppExecFwk::InnerEvent::Pointer eventMBI = BuildCallerInfo(MSG_SIM_OBTAIN_MBI_DONE);
|
||||
fileController_->ObtainLinearFixedFile(ELEMENTARY_FILE_MBI, 1, eventMBI);
|
||||
fileToGet_++;
|
||||
|
||||
AppExecFwk::InnerEvent::Pointer eventMWIS = BuildCallerInfo(MSG_SIM_OBTAIN_MWIS_DONE);
|
||||
fileController_->ObtainLinearFixedFile(ELEMENTARY_FILE_MWIS, 1, eventMWIS);
|
||||
fileToGet_++;
|
||||
|
||||
if (serviceTable_.empty()) {
|
||||
TELEPHONY_LOGE("get sst fail, serviceTable_ is null");
|
||||
return;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::PLMN_NETWORK_NAME)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventPnn = BuildCallerInfo(MSG_SIM_OBTAIN_PNN_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_PNN, eventPnn);
|
||||
fileToGet_++;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::OPERATOR_PLMN_LIST)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventOpl = BuildCallerInfo(MSG_SIM_OBTAIN_OPL_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_OPL, eventOpl);
|
||||
fileToGet_++;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::FOR_5GS_OPERATOR_PLMN_LIST)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventOpl5g = BuildCallerInfo(MSG_SIM_OBTAIN_OPL5G_DONE);
|
||||
fileController_->ObtainAllLinearFixedFile(ELEMENTARY_FILE_OPL5G, eventOpl5g);
|
||||
fileToGet_++;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::MSISDN)) {
|
||||
AppExecFwk::InnerEvent::Pointer phoneNumberEvent =
|
||||
CreateDiallingNumberPointer(MSG_SIM_OBTAIN_MSISDN_DONE, 0, 0, nullptr);
|
||||
diallingNumberHandler_->GetDiallingNumbers(
|
||||
ELEMENTARY_FILE_MSISDN, ObtainExtensionElementaryFile(ELEMENTARY_FILE_MSISDN), 1, phoneNumberEvent);
|
||||
fileToGet_++;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::MBDN)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventMBI = BuildCallerInfo(MSG_SIM_OBTAIN_MBI_DONE);
|
||||
fileController_->ObtainLinearFixedFile(ELEMENTARY_FILE_MBI, 1, eventMBI);
|
||||
fileToGet_++;
|
||||
}
|
||||
if (IsServiceAvailable(UsimService::MWI_STATUS)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventMWIS = BuildCallerInfo(MSG_SIM_OBTAIN_MWIS_DONE);
|
||||
fileController_->ObtainLinearFixedFile(ELEMENTARY_FILE_MWIS, 1, eventMWIS);
|
||||
fileToGet_++;
|
||||
}
|
||||
AppExecFwk::InnerEvent::Pointer eventCPHS = BuildCallerInfo(MSG_SIM_OBTAIN_VOICE_MAIL_INDICATOR_CPHS_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_VOICE_MAIL_INDICATOR_CPHS, eventCPHS);
|
||||
fileToGet_++;
|
||||
@ -333,20 +343,23 @@ void SimFile::LoadSimFiles()
|
||||
AppExecFwk::InnerEvent::Pointer eventIccId = BuildCallerInfo(MSG_SIM_OBTAIN_ICCID_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_ICCID, eventIccId);
|
||||
fileToGet_++;
|
||||
AppExecFwk::InnerEvent::Pointer eventAD = BuildCallerInfo(MSG_SIM_OBTAIN_AD_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_AD, eventAD);
|
||||
fileToGet_++;
|
||||
AppExecFwk::InnerEvent::Pointer eventSST = BuildCallerInfo(MSG_SIM_OBTAIN_SST_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_SST, eventSST);
|
||||
fileToGet_++;
|
||||
AppExecFwk::InnerEvent::Pointer eventGid1 = BuildCallerInfo(MSG_SIM_OBTAIN_GID1_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_GID1, eventGid1);
|
||||
fileToGet_++;
|
||||
AppExecFwk::InnerEvent::Pointer eventGid2 = BuildCallerInfo(MSG_SIM_OBTAIN_GID2_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_GID2, eventGid2);
|
||||
fileToGet_++;
|
||||
AppExecFwk::InnerEvent::Pointer eventAD = BuildCallerInfo(MSG_SIM_OBTAIN_AD_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_AD, eventAD);
|
||||
fileToGet_++;
|
||||
}
|
||||
AppExecFwk::InnerEvent::Pointer eventSpn = AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
|
||||
ObtainSpnPhase(true, eventSpn);
|
||||
LoadSimOtherFile();
|
||||
ObtainCallForwardFiles();
|
||||
AppExecFwk::InnerEvent::Pointer eventCPHS = BuildCallerInfo(MSG_SIM_OBTAIN_VOICE_MAIL_INDICATOR_CPHS_DONE);
|
||||
fileController_->ObtainBinaryFile(ELEMENTARY_FILE_VOICE_MAIL_INDICATOR_CPHS, eventCPHS);
|
||||
fileToGet_++;
|
||||
}
|
||||
|
||||
void SimFile::ObtainSpnPhase(bool start, const AppExecFwk::InnerEvent::Pointer &event)
|
||||
@ -1505,6 +1518,7 @@ bool SimFile::ProcessGetInfoCphs(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
bool SimFile::ProcessGetSstDone(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
bool isFileProcessResponse = true;
|
||||
std::string tempStr;
|
||||
if (event == nullptr) {
|
||||
TELEPHONY_LOGE("get Sst event is nullptr!");
|
||||
return isFileProcessResponse;
|
||||
@ -1515,16 +1529,65 @@ bool SimFile::ProcessGetSstDone(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
return isFileProcessResponse;
|
||||
}
|
||||
std::string iccData = fd->resultData;
|
||||
char *rawData = const_cast<char *>(iccData.c_str());
|
||||
unsigned char *fileData = reinterpret_cast<unsigned char *>(rawData);
|
||||
|
||||
if (fd->exception != nullptr) {
|
||||
FileChangeToExt(tempStr, FileChangeType::SPN_FILE_LOAD);
|
||||
return isFileProcessResponse;
|
||||
}
|
||||
TELEPHONY_LOGI("SimFile MSG_SIM_OBTAIN_SST_DONE data:%{public}s", fileData);
|
||||
if (iccData.empty()) {
|
||||
TELEPHONY_LOGE("sst data is nullptr");
|
||||
return false;
|
||||
}
|
||||
serviceTable_ = iccData;
|
||||
if (IsServiceAvailable(UsimService::SPN)) {
|
||||
AppExecFwk::InnerEvent::Pointer eventSpn = AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
|
||||
ObtainSpnPhase(true, eventSpn);
|
||||
} else {
|
||||
FileChangeToExt(tempStr, FileChangeType::SPN_FILE_LOAD);
|
||||
}
|
||||
TELEPHONY_LOGI("SimFile MSG_SIM_OBTAIN_SST_DONE data:%{public}s", serviceTable_.c_str());
|
||||
LoadSimOtherFile();
|
||||
return isFileProcessResponse;
|
||||
}
|
||||
|
||||
bool SimFile::IsServiceAvailable(UsimService service)
|
||||
{
|
||||
if (serviceTable_.empty()) {
|
||||
TELEPHONY_LOGE("serviceTable_ is unavailable");
|
||||
return false;
|
||||
}
|
||||
CardType cardType = CardType::UNKNOWN_CARD;
|
||||
if (stateManager_ != nullptr) {
|
||||
cardType = stateManager_->GetCardType();
|
||||
} else {
|
||||
TELEPHONY_LOGE("stateManager_ is unavailable");
|
||||
return false;
|
||||
}
|
||||
if (cardType == CardType::SINGLE_MODE_SIM_CARD) {
|
||||
return true;
|
||||
}
|
||||
if (service < UsimService::PHONEBOOK || service > UsimService::FOR_5G_SECURITY_PARAMETERS_EXTENDED) {
|
||||
TELEPHONY_LOGE("service %{public}d is unavailable", service);
|
||||
return false;
|
||||
}
|
||||
uint32_t offset = static_cast<uint32_t>(service) / BYTE_TO_BIT_LEN;
|
||||
uint32_t mask = static_cast<uint32_t>(service) % BYTE_TO_BIT_LEN;
|
||||
if (mask == 0 && offset!=0) {
|
||||
offset--;
|
||||
mask = 7; // 7 means max index in one byte
|
||||
} else {
|
||||
mask--;
|
||||
}
|
||||
if (offset * HEX_TO_BYTE_LEN >= serviceTable_.length()) {
|
||||
TELEPHONY_LOGE("offset exceeds serviceTable_ length");
|
||||
return false;
|
||||
}
|
||||
std::istringstream istr(serviceTable_.substr(offset * HEX_TO_BYTE_LEN, HEX_TO_BYTE_LEN));
|
||||
uint32_t num = 0;
|
||||
istr >> std::hex >> num;
|
||||
return (num & (1 << mask)) != 0;
|
||||
}
|
||||
|
||||
bool SimFile::ProcessGetPnnDone(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
TELEPHONY_LOGI("ProcessGetPnnDone: start");
|
||||
@ -1811,107 +1874,6 @@ bool SimFile::IsContinueGetSpn(bool start, SpnStatus curStatus, SpnStatus &newSt
|
||||
}
|
||||
}
|
||||
|
||||
void SimFile::InitMemberFunc()
|
||||
{
|
||||
InitBaseMemberFunc();
|
||||
InitObtainMemberFunc();
|
||||
InitPlmnMemberFunc();
|
||||
}
|
||||
|
||||
void SimFile::InitBaseMemberFunc()
|
||||
{
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_READY] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccReady(event); };
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_LOCKED] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccLocked(event); };
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_SIMLOCK] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccLocked(event); };
|
||||
memberFuncMap_[SimFile::RELOAD_ICCID_EVENT] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessReloadIccid(event); };
|
||||
memberFuncMap_[SimFile::RELOAD_IMSI_EVENT] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessReloadImsi(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_MSISDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetMsisdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_UPDATE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessUpdateDone(event); };
|
||||
memberFuncMap_[MSG_SIM_MARK_SMS_READ_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessMarkSms(event); };
|
||||
memberFuncMap_[MSG_SIM_SMS_ON_SIM] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSmsOnSim(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_MBDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetMbdn(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_CPHS_MAILBOX_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetCphsMailbox(event); };
|
||||
}
|
||||
|
||||
void SimFile::InitObtainMemberFunc()
|
||||
{
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_IMSI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainIMSIDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_ICCID_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetIccIdDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MBI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMbiDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CPHS_MAILBOX_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCphsMailBoxDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MBDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMbdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MSISDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMsisdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MWIS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMwisDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_VOICE_MAIL_INDICATOR_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessVoiceMailCphs(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_AD_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetAdDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_LI_LANGUAGE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainLiLanguage(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PL_LANGUAGE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainPlLanguage(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CFF_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCffDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SPDI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSpdiDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PNN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetPnnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPL_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOplDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPL5G_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOpl5gDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_ALL_SMS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetAllSmsDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SMS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSmsDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SST_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSstDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_INFO_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetInfoCphs(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CFIS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCfisDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CSP_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCspCphs(event); };
|
||||
}
|
||||
|
||||
void SimFile::InitPlmnMemberFunc()
|
||||
{
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SPN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainSpnPhase(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_GID1_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainGid1Done(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_GID2_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainGid2Done(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetPlmnActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOplmnActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_HPLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetHplmActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_EHPLMN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetEhplmnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_FPLMN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetFplmnDone(event); };
|
||||
}
|
||||
|
||||
int SimFile::ObtainSpnCondition(bool roaming, const std::string &operatorNum)
|
||||
{
|
||||
unsigned int cond = 0;
|
||||
|
127
services/sim/src/sim_file_init_controller.cpp
Normal file
127
services/sim/src/sim_file_init_controller.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "sim_file.h"
|
||||
|
||||
#include "common_event_manager.h"
|
||||
#include "radio_event.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace OHOS::AppExecFwk;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Telephony {
|
||||
void SimFile::InitMemberFunc()
|
||||
{
|
||||
InitBaseMemberFunc();
|
||||
InitObtainMemberFunc();
|
||||
InitPlmnMemberFunc();
|
||||
}
|
||||
|
||||
void SimFile::InitBaseMemberFunc()
|
||||
{
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_READY] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccReady(event); };
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_LOCKED] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccLocked(event); };
|
||||
memberFuncMap_[RadioEvent::RADIO_SIM_STATE_SIMLOCK] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessIccLocked(event); };
|
||||
memberFuncMap_[SimFile::RELOAD_ICCID_EVENT] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessReloadIccid(event); };
|
||||
memberFuncMap_[SimFile::RELOAD_IMSI_EVENT] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessReloadImsi(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_MSISDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetMsisdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_UPDATE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessUpdateDone(event); };
|
||||
memberFuncMap_[MSG_SIM_MARK_SMS_READ_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessMarkSms(event); };
|
||||
memberFuncMap_[MSG_SIM_SMS_ON_SIM] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSmsOnSim(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_MBDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetMbdn(event); };
|
||||
memberFuncMap_[MSG_SIM_SET_CPHS_MAILBOX_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessSetCphsMailbox(event); };
|
||||
}
|
||||
|
||||
void SimFile::InitObtainMemberFunc()
|
||||
{
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_IMSI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainIMSIDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_ICCID_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetIccIdDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MBI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMbiDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CPHS_MAILBOX_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCphsMailBoxDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MBDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMbdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MSISDN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMsisdnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_MWIS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetMwisDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_VOICE_MAIL_INDICATOR_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessVoiceMailCphs(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_AD_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetAdDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_LI_LANGUAGE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainLiLanguage(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PL_LANGUAGE_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainPlLanguage(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CFF_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCffDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SPDI_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSpdiDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PNN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetPnnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPL_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOplDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPL5G_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOpl5gDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_ALL_SMS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetAllSmsDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SMS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSmsDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SST_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetSstDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_INFO_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetInfoCphs(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CFIS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCfisDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_CSP_CPHS_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetCspCphs(event); };
|
||||
}
|
||||
|
||||
void SimFile::InitPlmnMemberFunc()
|
||||
{
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_SPN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainSpnPhase(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_GID1_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainGid1Done(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_GID2_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessObtainGid2Done(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_PLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetPlmnActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_OPLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetOplmnActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_HPLMN_W_ACT_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetHplmActDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_EHPLMN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetEhplmnDone(event); };
|
||||
memberFuncMap_[MSG_SIM_OBTAIN_FPLMN_DONE] =
|
||||
[this](const AppExecFwk::InnerEvent::Pointer &event) { return ProcessGetFplmnDone(event); };
|
||||
}
|
||||
} // namespace telephony
|
||||
} // namespace OHOS
|
@ -587,6 +587,8 @@ HWTEST_F(BranchTest, Telephony_SimFile_001, Function | MediumTest | Level1)
|
||||
EXPECT_TRUE(simFile->ProcessVoiceMailCphs(event));
|
||||
EXPECT_TRUE(simFile->ProcessGetMwisDone(event));
|
||||
EXPECT_TRUE(simFile->ProcessGetMbdnDone(event));
|
||||
simFile->serviceTable_ = "867F1F1C234E0000400050";
|
||||
EXPECT_TRUE(simFile->IsServiceAvailable(UsimService::FDN));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user