~aleteoryx/muditaos

3a244f25760fc61cf4f241bebee8959728da31ec — Artur Śleszyński 4 years ago ee2c085
[CP-265] Extend cellular logging

Log:
* phone call state
* VoLTE setting state
M module-services/service-cellular/CellularCall.cpp => module-services/service-cellular/CellularCall.cpp +9 -3
@@ 20,8 20,10 @@ namespace CellularCall
{
    bool CellularCall::startCall(const utils::PhoneNumber::View &number, const CallType type)
    {
        LOG_INFO("starting call");

        if (isValid()) {
            LOG_ERROR("call already set");
            LOG_ERROR("call already established");
            return false;
        }



@@ 33,14 35,16 @@ namespace CellularCall
        CalllogRecord callRec{type, number};
        call                = startCallAction ? startCallAction(callRec) : CalllogRecord();
        if (!call.isValid()) {
            LOG_ERROR("startCallAction failed");
            LOG_ERROR("failed to obtain a call log record");
            clear();
            if (cpuSentinel) {
                cpuSentinel->ReleaseMinimumFrequency();
            }
            LOG_INFO("failed to start call");
            return false;
        }

        LOG_INFO("call started");
        return true;
    }



@@ 56,8 60,9 @@ namespace CellularCall

    bool CellularCall::endCall(Forced forced)
    {
        LOG_INFO("ending call");
        if (!isValid()) {
            LOG_ERROR("Trying to update invalid call");
            LOG_ERROR("no call to end");
            return false;
        }



@@ 100,6 105,7 @@ namespace CellularCall
        // Calllog entry was updated, ongoingCall can be cleared
        clear();

        LOG_INFO("call ended");
        return true;
    }


M module-services/service-cellular/ServiceCellular.cpp => module-services/service-cellular/ServiceCellular.cpp +8 -2
@@ 1853,14 1853,15 @@ std::shared_ptr<CellularSetOperatorResponse> ServiceCellular::handleCellularSetO
void ServiceCellular::volteChanged(const std::string &value)
{
    if (!value.empty()) {
        LOG_INFO("VoLTE setting state changed to '%s'.", value.c_str());
        volteOn = utils::getNumericValue<bool>(value);
    }
}

void ServiceCellular::apnListChanged(const std::string &value)
{
    LOG_DEBUG("apnListChanged");
    if (!value.empty()) {
        LOG_INFO("apn_list setting state changed to '%s'.", value.c_str());
        packetData->loadAPNSettings(value);
    }
}


@@ 1868,6 1869,7 @@ void ServiceCellular::apnListChanged(const std::string &value)
auto ServiceCellular::handleCellularAnswerIncomingCallMessage(CellularMessage *msg)
    -> std::shared_ptr<CellularResponseMessage>
{
    LOG_INFO(__PRETTY_FUNCTION__);
    if (ongoingCall.getType() != CallType::CT_INCOMING) {
        return std::make_shared<CellularResponseMessage>(true);
    }


@@ 1891,6 1893,7 @@ auto ServiceCellular::handleCellularAnswerIncomingCallMessage(CellularMessage *m
auto ServiceCellular::handleCellularCallRequestMessage(CellularCallRequestMessage *msg)
    -> std::shared_ptr<CellularResponseMessage>
{
    LOG_INFO(__PRETTY_FUNCTION__);
    auto channel = cmux->get(CellularMux::Channel::Commands);
    if (channel == nullptr) {
        return std::make_shared<CellularResponseMessage>(false);


@@ 1909,8 1912,8 @@ auto ServiceCellular::handleCellularCallRequestMessage(CellularCallRequestMessag

void ServiceCellular::handleCellularHangupCallMessage(CellularHangupCallMessage *msg)
{
    LOG_INFO(__PRETTY_FUNCTION__);
    auto channel = cmux->get(CellularMux::Channel::Commands);
    LOG_INFO("CellularHangupCall");
    if (channel) {
        if (channel->cmd(at::AT::ATH)) {
            callManager.hangUp();


@@ 2003,6 2006,7 @@ auto ServiceCellular::handleCellularRingingMessage(CellularRingingMessage *msg) 

auto ServiceCellular::handleCellularIncominCallMessage(sys::Message *msg) -> std::shared_ptr<sys::ResponseMessage>
{
    LOG_INFO(__PRETTY_FUNCTION__);
    auto ret     = true;
    auto message = static_cast<CellularIncominCallMessage *>(msg);
    if (!ongoingCall.isValid()) {


@@ 2275,6 2279,8 @@ auto ServiceCellular::handleCellularSendSMSMessage(sys::Message *msg) -> std::sh

auto ServiceCellular::handleCellularRingNotification(sys::Message *msg) -> std::shared_ptr<sys::ResponseMessage>
{
    LOG_INFO(__PRETTY_FUNCTION__);

    if (phoneModeObserver->isTetheringOn())
        return std::make_shared<CellularResponseMessage>(hangUpCall());