!2166 分布式通信场景下telephony卡槽数适配

Merge pull request !2166 from 张金辉撒/master
This commit is contained in:
openharmony_ci 2024-08-19 01:46:10 +00:00 committed by Gitee
commit e06e4eb826
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -46,6 +46,8 @@ inline int32_t vSimModemCount_ = VSIM_DEFAULT_VALUE;
inline constexpr const char *SATELLITE_DEFAULT_VALUE = "0";
inline constexpr const char *DEFAULT_SLOT_COUNT = "1";
inline constexpr const char *TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
inline constexpr const char *VIRTUAL_MODEM_SWITCH = "const.booster.virtual_modem_switch";
inline constexpr const char *VIRTUAL_MODEM_DEFAULT_SWITCH = "false";
inline constexpr const char *DEFAULT_PREFERRED_NETWORK_TYPE = "5"; // CORE_NETWORK_MODE_LTE_WCDMA_GSM
inline constexpr const char *TEL_PREFERRED_NETWORK_TYPE = "const.telephony.preferredNetworkType";
inline constexpr const char *DEFAULT_OPERATOR_KEY = "";
@ -57,6 +59,17 @@ inline constexpr const char *TEL_SATELLITE_SUPPORTED = "const.telephony.satellit
inline constexpr const char *DEFAULT_VSIM_MODEM_COUNT = "0";
inline constexpr const char *VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount";
template<typename T>
inline T GetVirtualModemSwitch()
{
char virtualModemSwitch[SYSPARA_SIZE] = {0};
GetParameter(VIRTUAL_MODEM_SWITCH, VIRTUAL_MODEM_DEFAULT_SWITCH, virtualModemSwitch, SYSPARA_SIZE);
if (strcmp(virtualModemSwitch, "true") == 0) {
return true;
}
return false;
}
template<typename T>
inline T GetMaxSlotCount()
{
@ -64,6 +77,9 @@ inline T GetMaxSlotCount()
char simSlotCount[SYSPARA_SIZE] = { 0 };
GetParameter(TEL_SIM_SLOT_COUNT, DEFAULT_SLOT_COUNT, simSlotCount, SYSPARA_SIZE);
maxSlotCount_ = std::atoi(simSlotCount);
if (GetVirtualModemSwitch<bool>() && maxSlotCount_ == 0) {
maxSlotCount_ = 1;
}
}
return maxSlotCount_;
}