更新SignalInfoUpdated消息里的信号等级

Signed-off-by: liuxiyao223 <liuxiyao223@huawei.com>
This commit is contained in:
liuxiyao223 2024-05-29 11:07:38 +08:00
parent 3a48392901
commit efdc921ef5
2 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (C) 2021-2024 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
@ -148,6 +148,9 @@ void SignalInfo::ProcessSignalIntensity(int32_t slotId, const Rssi *signalIntens
if (!gsmUpdate || !cdmaUpdate || !lteUpdate || !wcdmaUpdate || !tdScdmaUpdate || !nrUpdate) {
std::vector<sptr<SignalInformation>> signals;
GetSignalInfoList(signals);
if (TELEPHONY_EXT_WRAPPER.sortSignalInfoListExt_ != nullptr) {
TELEPHONY_EXT_WRAPPER.sortSignalInfoListExt_(slotId, signals);
}
DelayedSingleton<NetworkSearchNotify>::GetInstance()->NotifySignalInfoUpdated(slotId, signals);
int level = 0;
if (signals.size() != 0) {

View File

@ -45,6 +45,7 @@ constexpr int32_t NR_NSA_OPTION_ONLY = 1;
constexpr int32_t SIGNAL_STRENGTH_GOOD = 3;
const std::string NITZ_STR = "23/10/16,09:10:33+32,00";
const std::string NITZ_STR_INVALID = "202312102359";
constexpr int32_t LTE_RSSI_GOOD = -80;
} // namespace
class CoreServiceBranchTest : public testing::Test {
@ -818,5 +819,19 @@ HWTEST_F(CoreServiceBranchTest, Telephony_SignalInformation_001, Function | Medi
tdScdma->SetSignalLevel(SIGNAL_STRENGTH_GOOD);
EXPECT_EQ(tdScdma->GetSignalLevel(), SIGNAL_STRENGTH_GOOD);
}
/**
* @tc.number Telephony_SignalInfo_001
* @tc.name test normal branch
* @tc.desc Function test
*/
HWTEST_F(CoreServiceBranchTest, Telephony_SignalInfo_001, Function | MediumTest | Level1)
{
auto signalInfo = std::make_shared<SignalInfo>();
Rssi signalIntensity;
signalIntensity.lte.rsrp = LTE_RSSI_GOOD;
signalInfo->ProcessSignalIntensity(SLOT_ID, &signalIntensity);
EXPECT_TRUE(signalInfo->ProcessLte(signalIntensity.lte));
}
} // namespace Telephony
} // namespace OHOS