modify sim slot.

Signed-off-by: clevercong <lichunlin2@huawei.com>
This commit is contained in:
clevercong 2024-01-24 16:43:16 +08:00
parent 4d7a835e84
commit a6857b7d93
4 changed files with 18 additions and 1 deletions

View File

@ -405,6 +405,8 @@ static constexpr uint32_t HRIL_NETWORKS_SELECT_MODE = 0;
inline const int32_t HRIL_SYSPARA_SIZE = 128;
inline constexpr const char *HRIL_DEFAULT_SLOT_COUNT = "1";
inline constexpr const char *HRIL_TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
inline constexpr const char *HRIL_DEFAULT_VSIM_MODEM_COUNT = "0";
inline constexpr const char *HRIL_VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount";
/** Interface token */
inline const std::u16string HRIL_INTERFACE_TOKEN = u"ohos.telephony.hril";

View File

@ -12,6 +12,7 @@
# limitations under the License.
import("//build/ohos.gni")
import("../../../core_service/telephony_core_service.gni")
RIL_ADAPTER = "../../"
RIL_HRIL = "../../services/hril/src"
@ -45,6 +46,8 @@ ohos_shared_library("hril") {
"LOG_DOMAIN = 0xD001F08",
]
defines += telephony_extra_defines
deps = [ "$RIL_ADAPTER/interfaces/innerkits:hril_innerkits" ]
external_deps = [

View File

@ -33,6 +33,9 @@
namespace OHOS {
namespace Telephony {
inline const int32_t DUAL_SLOT_COUNT = 2;
inline const int32_t MAX_SLOT_COUNT = 3;
typedef enum : int32_t {
RIL_REGISTER_IS_NONE = 0,
RIL_REGISTER_IS_RUNNING,

View File

@ -1025,7 +1025,16 @@ int32_t GetSimSlotCount()
{
char simSlotCount[HRIL_SYSPARA_SIZE] = { 0 };
GetParameter(HRIL_TEL_SIM_SLOT_COUNT, HRIL_DEFAULT_SLOT_COUNT, simSlotCount, HRIL_SYSPARA_SIZE);
return std::atoi(simSlotCount);
int32_t simSlotCountNumber = std::atoi(simSlotCount);
#ifdef OHOS_BUILD_ENABLE_TELEPHONY_VSIM
char vSimModemCount[HRIL_SYSPARA_SIZE] = { 0 };
GetParameter(HRIL_VSIM_MODEM_COUNT_STR, HRIL_DEFAULT_VSIM_MODEM_COUNT, vSimModemCount, HRIL_SYSPARA_SIZE);
int32_t vSimModemCountNumber = std::atoi(vSimModemCount);
if (simSlotCountNumber == DUAL_SLOT_COUNT && vSimModemCountNumber == MAX_SLOT_COUNT) {
simSlotCountNumber = MAX_SLOT_COUNT;
}
#endif
return simSlotCountNumber;
}
static void HRilBootUpEventLoop()