~aleteoryx/muditaos

561e4e7a0d60f8aea184e77979e67310159298c1 — Lefucjusz 2 years ago 389ce03
[MOS-599] Fix undefined phone mode in simulator

Fix of the issue that on simulator phone mode
was in 'undefined' state, what resulted in
no phone mode selected in settings.
M module-apps/apps-common/notifications/policies/CallNotificationPolicy.cpp => module-apps/apps-common/notifications/policies/CallNotificationPolicy.cpp +1 -2
@@ 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 "CallNotificationPolicy.hpp"


@@ 13,7 13,6 @@ void CallNotificationPolicy::updateCurrentCall(sys::phone_modes::PhoneMode phone

    switch (phoneMode) {
    case sys::phone_modes::PhoneMode::Uninitialized:
        [[fallthrough]];
    case sys::phone_modes::PhoneMode::Connected:
        popupOn    = true;
        ringtoneOn = true;

M module-apps/apps-common/notifications/policies/NotificationsListPolicy.cpp => module-apps/apps-common/notifications/policies/NotificationsListPolicy.cpp +1 -3
@@ 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 "NotificationsListPolicy.hpp"


@@ 18,9 18,7 @@ void NotificationsListPolicy::updateCurrentList(sys::phone_modes::PhoneMode phon
        updateAllowed  = (isLocked && lockedScreenNotificationSetting) || (!isLocked);
        break;
    case sys::phone_modes::PhoneMode::Uninitialized:
        [[fallthrough]];
    case sys::phone_modes::PhoneMode::Connected:
        [[fallthrough]];
    case sys::phone_modes::PhoneMode::Offline:
        updateAllowed  = true;
        showWhenLocked = true;

M module-apps/apps-common/notifications/policies/SMSNotificationPolicy.cpp => module-apps/apps-common/notifications/policies/SMSNotificationPolicy.cpp +1 -3
@@ 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 "SMSNotificationPolicy.hpp"


@@ 13,9 13,7 @@ void SMSNotificationPolicy::updateCurrentSMS(sys::phone_modes::PhoneMode phoneMo
        ringtoneOn = false;
        break;
    case sys::phone_modes::PhoneMode::Uninitialized:
        [[fallthrough]];
    case sys::phone_modes::PhoneMode::Connected:
        [[fallthrough]];
    case sys::phone_modes::PhoneMode::Offline:
        ringtoneOn = true;
        break;

M module-bsp/board/linux/magnetometer/magnetometer.cpp => module-bsp/board/linux/magnetometer/magnetometer.cpp +33 -31
@@ 1,44 1,46 @@
// 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 "bsp/magnetometer/magnetometer.hpp"

static xQueueHandle qHandleIrq = NULL;

namespace bsp
namespace
{
    constexpr auto offlineSliderPosition = bsp::KeyCodes::SSwitchDown;
    xQueueHandle qHandleIrq              = nullptr;

    namespace magnetometer
    void requestReadout()
    {

        int32_t init(xQueueHandle qHandle)
        {

            qHandleIrq = qHandle;
            return 1;
        if (qHandleIrq == nullptr) {
            return;
        }

        void deinit()
        {}
        std::uint8_t val = 0x01;
        xQueueSend(qHandleIrq, &val, 0);
    }
} // namespace

        bool isPresent(void)
        {
            return false;
        }
namespace bsp::magnetometer
{
    std::int32_t init(xQueueHandle qHandle)
    {
        qHandleIrq = qHandle;
        requestReadout();
        return 0;
    }

        bsp::Board GetBoard(void)
        {
            return bsp::Board::Linux;
        }
    void deinit()
    {}

        std::optional<bsp::KeyCodes> WorkerEventHandler()
        {
            return std::nullopt;
        }
    bool isPresent()
    {
        return false;
    }

    std::optional<bsp::KeyCodes> WorkerEventHandler()
    {
        return offlineSliderPosition;
    }

        void enableIRQ()
        {}
        void resetCurrentParsedValue()
        {}
    } // namespace magnetometer
} // namespace bsp
    void resetCurrentParsedValue()
    {}
} // namespace bsp::magnetometer

M module-bsp/bsp/magnetometer/magnetometer.hpp => module-bsp/bsp/magnetometer/magnetometer.hpp +0 -3
@@ 5,12 5,9 @@
#include <cstdint>
#include <optional>

extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
}

#include "../common.hpp"


M module-gui/gui/widgets/status-bar/PhoneMode.cpp => module-gui/gui/widgets/status-bar/PhoneMode.cpp +1 -3
@@ 1,9 1,8 @@
// 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 "PhoneMode.hpp"

#include <log/log.hpp>
#include <i18n/i18n.hpp>

#include "Item.hpp"


@@ 32,7 31,6 @@ namespace gui::status_bar
            break;

        case sys::phone_modes::PhoneMode::Uninitialized:
            [[fallthrough]];
        case sys::phone_modes::PhoneMode::Connected:
            setText("");
            break;