~aleteoryx/muditaos

94a825af64017345b90f92cf8a496dc98e12eabe — Marcin Zieliński 3 years ago 5dfa6d9
[MOS-810] Fixed call state timer termination

Fixed the problem that the call state polling
timer wasn't terminated in some cases, so the
modem command AT+CLCC had still been issued
until e.g. another call was made. In such cases,
this lead to inability for the modem to go to
a power-down state due to constant activity and
thus lead to battery power waste.

Additionally, fixed a hidden bug that TimerRing
hadn't got a virtual destructor.

Also thrown out some dead code.
M module-services/service-cellular/CellularServiceAPI.cpp => module-services/service-cellular/CellularServiceAPI.cpp +0 -7
@@ 47,13 47,6 @@ bool CellularServiceAPI::HangupCall(sys::Service *serv)
    return true;
}

bool CellularServiceAPI::DismissCall(sys::Service *serv)
{
    auto msg = std::make_shared<cellular::DismissCallMessage>();
    serv->bus.sendMulticast(std::move(msg), sys::BusChannel::ServiceCellularNotifications);
    return true;
}

std::string CellularServiceAPI::GetIMSI(sys::Service *serv, bool getFullIMSINumber)
{


M module-services/service-cellular/ServiceCellular.cpp => module-services/service-cellular/ServiceCellular.cpp +1 -20
@@ 458,11 458,6 @@ void ServiceCellular::registerMessageHandlers()
        return sys::MessageNone{};
    });

    connect(typeid(cellular::DismissCallMessage), [&](sys::Message *request) -> sys::MessagePointer {
        handleCellularDismissCallMessage(request);
        return sys::MessageNone{};
    });

    connect(typeid(db::QueryResponse), [&](sys::Message *request) -> sys::MessagePointer {
        auto msg = static_cast<db::QueryResponse *>(request);
        return handleDBQueryResponseMessage(msg);


@@ 590,6 585,7 @@ void ServiceCellular::registerMessageHandlers()
    /// 2. from here from handle cellular hangup
    connect(typeid(cellular::CallAbortedNotification), [&](sys::Message * /*request*/) -> sys::MessagePointer {
        ongoingCall->handle(call::event::Ended{});
        callStateTimer.stop();
        return sys::MessageNone{};
    });



@@ 1859,12 1855,6 @@ void ServiceCellular::handleCellularHangupCallMessage(cellular::HangupCallMessag
    callEndedRecentlyTimer.start();
}

void ServiceCellular::handleCellularDismissCallMessage(sys::Message *msg)
{
    LOG_INFO("%s", __PRETTY_FUNCTION__);
    hangUpCall();
}

auto ServiceCellular::handleDBQueryResponseMessage(db::QueryResponse *msg) -> std::shared_ptr<sys::ResponseMessage>
{
    bool responseHandled = false;


@@ 2204,15 2194,6 @@ auto ServiceCellular::handleCellularSetConnectionFrequencyMessage(sys::Message *
    return std::make_shared<cellular::ResponseMessage>(true);
}

auto ServiceCellular::hangUpCall() -> bool
{
    auto ret = ongoingCall->handle(call::event::Ended{});
    if (!ret) {
        LOG_ERROR("Failed to hang up call");
    }
    return ret;
}

auto ServiceCellular::hangUpCallBusy() -> bool
{
    auto channel = cmux->get(CellularMux::Channel::Commands);

M module-services/service-cellular/call/CellularCall.cpp => module-services/service-cellular/call/CellularCall.cpp +1 -3
@@ 12,6 12,7 @@

namespace call
{
    Call::~Call() = default;

    Call::Call()
    {}


@@ 32,9 33,6 @@ namespace call
                                                              std::move(sentinel)});
    }

    Call::~Call()
    {}

    Call &Call::operator=(Call &&other) noexcept
    {
        if (not other.machine) {

M module-services/service-cellular/call/api/CallTimer.hpp => module-services/service-cellular/call/api/CallTimer.hpp +1 -0
@@ 19,6 19,7 @@ namespace call::api
    struct TimerRing
    {
        virtual void start() = 0;
        virtual ~TimerRing() = default;
    };
}; // namespace call::api


M module-services/service-cellular/service-cellular/CellularServiceAPI.hpp => module-services/service-cellular/service-cellular/CellularServiceAPI.hpp +0 -1
@@ 28,7 28,6 @@ namespace CellularServiceAPI

    bool AnswerIncomingCall(sys::Service *serv);
    bool HangupCall(sys::Service *serv);
    bool DismissCall(sys::Service *serv);
    /*
     * @brief Its calls sercive-cellular for selected SIM IMSI number.
     * @param serv pointer to caller service.

M module-services/service-cellular/service-cellular/ServiceCellular.hpp => module-services/service-cellular/service-cellular/ServiceCellular.hpp +0 -1
@@ 302,7 302,6 @@ class ServiceCellular : public sys::Service

    auto receiveSMS(std::string messageNumber) -> bool;

    auto hangUpCall() -> bool;
    auto hangUpCallBusy() -> bool;

    auto tetheringTurnOffURC() -> bool;

M module-services/service-cellular/src/ModemResetHandler.cpp => module-services/service-cellular/src/ModemResetHandler.cpp +5 -1
@@ 15,6 15,7 @@ namespace cellular::service
        }

        procedureInProgress = ProcedureInProgress::SoftReset;
        onAnyReset();
        onCellularStateSet(State::ST::PowerDownWaiting);
        return onSoftReset();
    }


@@ 27,6 28,7 @@ namespace cellular::service
        }

        procedureInProgress = ProcedureInProgress::HardReset;
        onAnyReset();
        onCellularStateSet(State::ST::PowerDownWaiting);
        onHardReset();
        return false;


@@ 40,6 42,7 @@ namespace cellular::service
        }

        procedureInProgress = ProcedureInProgress::Reboot;
        onAnyReset();
        onCellularStateSet(State::ST::PowerDownWaiting);
        onTurnModemOff();
        return false;


@@ 79,7 82,6 @@ namespace cellular::service
    auto ModemResetHandler::handleSwitchToActive() -> bool
    {
        if (procedureInProgress == ProcedureInProgress::None) {

            return false;
        }



@@ 90,6 92,8 @@ namespace cellular::service

    auto ModemResetHandler::performFunctionalityReset() -> bool
    {
        onAnyReset();

        if (onFunctionalityReset) {
            return onFunctionalityReset();
        }

M module-services/service-cellular/src/ModemResetHandler.hpp => module-services/service-cellular/src/ModemResetHandler.hpp +1 -0
@@ 54,6 54,7 @@ namespace cellular::service
        std::function<bool()> onSoftReset;
        std::function<void()> onHardReset;
        std::function<bool()> onFunctionalityReset;
        std::function<void()> onAnyReset;

      private:
        enum class ProcedureInProgress

M module-services/service-cellular/src/ServiceCellularPriv.cpp => module-services/service-cellular/src/ServiceCellularPriv.cpp +2 -0
@@ 455,6 455,8 @@ namespace cellular::internal
            }
            return succeed;
        };

        modemResetHandler->onAnyReset = [this]() { owner->callStateTimer.stop(); };
    }

    void ServiceCellularPriv::initCSQHandler()

M module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp => module-services/service-cellular/src/volte/VolteCapabilityHandler.cpp +0 -1
@@ 3,7 3,6 @@

#include "VolteCapabilityHandler.hpp"
#include <modem/BaseChannel.hpp>
#include <modem/mux/CellularMux.h>
#include <log/log.hpp>

namespace cellular::service

M pure_changelog.md => pure_changelog.md +1 -0
@@ 43,6 43,7 @@
* Fixed looping on the SIM card selection screen
* Fixed screen lock during onboarding
* Fixed displayed device name when connected to Windows
* Fixed redundant modem polling for call states

### Added
* Added a popup for changing the SIM card