From 006d210a42977518b8a17f3f3e7832b02c255f9e Mon Sep 17 00:00:00 2001 From: Lukasz Mastalerz Date: Fri, 27 Jan 2023 17:10:32 +0100 Subject: [PATCH] [CP-1419] Signal range in Pure status without SIM card inserted Fix for incorrect signal strength displayed in Center when network status is NotRegistered. --- .../endpoints/deviceInfo/DeviceInfoEndpoint.cpp | 12 ++++++++++-- pure_changelog.md | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp b/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp index 2bf37e1a3bc1bfcd1870d4a23c09e9a7363c23fa..4ef95ead193c9328f87634a7ff3d33c4043f7526 100644 --- a/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +++ b/products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include @@ -38,12 +38,20 @@ namespace sdesktop::endpoints { auto [totalDeviceSpaceMiB, reservedSystemSpaceMiB, usedUserSpaceMiB] = getStorageInfo(); + const auto signalStrength = []() { + const auto status = Store::GSM::get()->getNetwork().status; + if (status == Store::Network::Status::NotRegistered) { + return 0; + } + return static_cast(Store::GSM::get()->getSignalStrength().rssiBar); + }(); + context.setResponseBody(json11::Json::object( {{json::batteryLevel, std::to_string(Store::Battery::get().level)}, {json::batteryState, std::to_string(static_cast(Store::Battery::get().state))}, {json::selectedSim, std::to_string(static_cast(Store::GSM::get()->selected))}, {json::trayState, std::to_string(static_cast(Store::GSM::get()->tray))}, - {json::signalStrength, std::to_string(static_cast(Store::GSM::get()->getSignalStrength().rssiBar))}, + {json::signalStrength, std::to_string(signalStrength)}, {json::accessTechnology, std::to_string(static_cast(Store::GSM::get()->getNetwork().accessTechnology))}, {json::networkStatus, std::to_string(static_cast(Store::GSM::get()->getNetwork().status))}, diff --git a/pure_changelog.md b/pure_changelog.md index 5d30508a9ed36bb396b988f4757777f712f65ab9..f91ff7409acd39614dd36db0df06160eacaa9c12 100644 --- a/pure_changelog.md +++ b/pure_changelog.md @@ -47,6 +47,7 @@ * Fixed scrollbar behavior in call log view * Fixed contacts imported from SIM do not show up in Mudita Center * Fixed broken events counter on main screen for more than 99 events +* Fixed for incorrect signal strength displayed in Center ### Added