Commit f8f15b20 authored by aligungr's avatar aligungr

SRA dev.

parent 2b737b43
......@@ -114,6 +114,8 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
{"rm-state", ToJson(m_base->nasTask->mm->m_rmState)},
{"mm-state", ToJson(m_base->nasTask->mm->m_mmSubState)},
{"5u-state", ToJson(m_base->nasTask->mm->m_usim->m_uState)},
{"camped-cell",
::ToJson(m_base->sraTask->m_servingCell.has_value() ? m_base->sraTask->m_servingCell->gnbName : "")},
{"sim-inserted", m_base->nasTask->mm->m_usim->isValid()},
{"stored-suci", ToJson(m_base->nasTask->mm->m_usim->m_storedSuci)},
{"stored-guti", ToJson(m_base->nasTask->mm->m_usim->m_storedGuti)},
......
......@@ -70,10 +70,14 @@ void NasMm::performMmCycle()
if (m_mmSubState == EMmSubState::MM_DEREGISTERED_PLMN_SEARCH ||
m_mmSubState == EMmSubState::MM_DEREGISTERED_NO_CELL_AVAILABLE ||
m_mmSubState == EMmSubState::MM_REGISTERED_PLMN_SEARCH ||
m_mmSubState == EMmSubState::MM_REGISTERED_NO_CELL_AVAILABLE)
{
int64_t current = utils::CurrentTimeMillis();
int64_t backoff = m_mmSubState == EMmSubState::MM_DEREGISTERED_PLMN_SEARCH ? -1 : 1500;
int64_t backoff = (m_mmSubState == EMmSubState::MM_DEREGISTERED_PLMN_SEARCH ||
m_mmSubState == EMmSubState::MM_REGISTERED_PLMN_SEARCH)
? -1
: 1500;
if (current - m_lastPlmnSearchTrigger > backoff)
{
......@@ -145,6 +149,9 @@ void NasMm::switchCmState(ECmState state)
ECmState oldState = m_cmState;
m_cmState = state;
if (state != oldState)
m_logger->info("UE switches to state [%s]", ToJson(state).str().c_str());
onSwitchCmState(oldState, m_cmState);
if (m_base->nodeListener)
......@@ -153,9 +160,6 @@ void NasMm::switchCmState(ECmState state)
ToJson(oldState).str(), ToJson(m_cmState).str());
}
if (state != oldState)
m_logger->info("UE switches to state [%s]", ToJson(state).str().c_str());
triggerMmCycle();
}
......@@ -242,6 +246,14 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState)
switchRmState(ERmState::RM_DEREGISTERED);
}
else if (m_mmState == EMmState::MM_REGISTERED)
{
switchMmState(EMmState::MM_REGISTERED, EMmSubState::MM_REGISTERED_PLMN_SEARCH);
}
else if (m_mmState == EMmState::MM_DEREGISTERED)
{
switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_PLMN_SEARCH);
}
}
}
......
......@@ -10,8 +10,8 @@
#include <algorithm>
#include <nas/utils.hpp>
#include <ue/app/task.hpp>
#include <ue/rrc/task.hpp>
#include <ue/nas/sm/sm.hpp>
#include <ue/rrc/task.hpp>
namespace nr::ue
{
......@@ -199,7 +199,14 @@ void NasMm::handleRrcConnectionRelease()
void NasMm::handleRadioLinkFailure()
{
m_logger->debug("Radio link failure detected");
if (m_cmState == ECmState::CM_CONNECTED)
{
m_logger->err("Radio link failure detected");
}
m_usim->m_servingCell = std::nullopt;
m_usim->m_currentPlmn = std::nullopt;
handleRrcConnectionRelease();
}
......
......@@ -138,7 +138,8 @@ struct NwUeSraToRrc : NtsMessage
{
PLMN_SEARCH_RESPONSE,
SERVING_CELL_CHANGE,
RRC_PDU_DELIVERY
RRC_PDU_DELIVERY,
RADIO_LINK_FAILURE
} present;
// PLMN_SEARCH_RESPONSE
......
......@@ -44,17 +44,6 @@ void UeRrcTask::onLoop()
switch (msg->msgType)
{
//case NtsMessageType::UE_MR_TO_RRC: {
// auto *w = dynamic_cast<NwUeMrToRrc *>(msg);
// switch (w->present)
// {
// case NwUeMrToRrc::RADIO_LINK_FAILURE: {
// handleRadioLinkFailure();
// break;
// }
// }
// break;
//}
case NtsMessageType::UE_NAS_TO_RRC: {
auto *w = dynamic_cast<NwUeNasToRrc *>(msg);
switch (w->present)
......@@ -106,6 +95,10 @@ void UeRrcTask::onLoop()
handleDownlinkRrc(w->channel, w->pdu);
break;
}
case NwUeSraToRrc::RADIO_LINK_FAILURE: {
handleRadioLinkFailure();
break;
}
}
break;
}
......
......@@ -63,6 +63,16 @@ void UeSraTask::onCoverageChange(const std::vector<GlobalNci> &entered, const st
{
m_logger->debug("Coverage change detected. [%d] cell entered, [%d] cell exited", static_cast<int>(entered.size()),
static_cast<int>(exited.size()));
bool campedCellLost = m_servingCell.has_value() && std::any_of(exited.begin(), exited.end(), [this](auto &i) {
return i == m_servingCell->cellId;
});
if (campedCellLost)
{
m_logger->warn("Signal lost from camped cell");
m_servingCell = std::nullopt;
m_base->rrcTask->push(new NwUeSraToRrc(NwUeSraToRrc::RADIO_LINK_FAILURE));
}
}
void UeSraTask::plmnSearchRequested()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment