Commit f8f15b20 authored by aligungr's avatar aligungr

SRA dev.

parent 2b737b43
...@@ -114,6 +114,8 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg) ...@@ -114,6 +114,8 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
{"rm-state", ToJson(m_base->nasTask->mm->m_rmState)}, {"rm-state", ToJson(m_base->nasTask->mm->m_rmState)},
{"mm-state", ToJson(m_base->nasTask->mm->m_mmSubState)}, {"mm-state", ToJson(m_base->nasTask->mm->m_mmSubState)},
{"5u-state", ToJson(m_base->nasTask->mm->m_usim->m_uState)}, {"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()}, {"sim-inserted", m_base->nasTask->mm->m_usim->isValid()},
{"stored-suci", ToJson(m_base->nasTask->mm->m_usim->m_storedSuci)}, {"stored-suci", ToJson(m_base->nasTask->mm->m_usim->m_storedSuci)},
{"stored-guti", ToJson(m_base->nasTask->mm->m_usim->m_storedGuti)}, {"stored-guti", ToJson(m_base->nasTask->mm->m_usim->m_storedGuti)},
......
...@@ -70,10 +70,14 @@ void NasMm::performMmCycle() ...@@ -70,10 +70,14 @@ void NasMm::performMmCycle()
if (m_mmSubState == EMmSubState::MM_DEREGISTERED_PLMN_SEARCH || if (m_mmSubState == EMmSubState::MM_DEREGISTERED_PLMN_SEARCH ||
m_mmSubState == EMmSubState::MM_DEREGISTERED_NO_CELL_AVAILABLE || m_mmSubState == EMmSubState::MM_DEREGISTERED_NO_CELL_AVAILABLE ||
m_mmSubState == EMmSubState::MM_REGISTERED_PLMN_SEARCH ||
m_mmSubState == EMmSubState::MM_REGISTERED_NO_CELL_AVAILABLE) m_mmSubState == EMmSubState::MM_REGISTERED_NO_CELL_AVAILABLE)
{ {
int64_t current = utils::CurrentTimeMillis(); 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) if (current - m_lastPlmnSearchTrigger > backoff)
{ {
...@@ -145,6 +149,9 @@ void NasMm::switchCmState(ECmState state) ...@@ -145,6 +149,9 @@ void NasMm::switchCmState(ECmState state)
ECmState oldState = m_cmState; ECmState oldState = m_cmState;
m_cmState = state; m_cmState = state;
if (state != oldState)
m_logger->info("UE switches to state [%s]", ToJson(state).str().c_str());
onSwitchCmState(oldState, m_cmState); onSwitchCmState(oldState, m_cmState);
if (m_base->nodeListener) if (m_base->nodeListener)
...@@ -153,9 +160,6 @@ void NasMm::switchCmState(ECmState state) ...@@ -153,9 +160,6 @@ void NasMm::switchCmState(ECmState state)
ToJson(oldState).str(), ToJson(m_cmState).str()); ToJson(oldState).str(), ToJson(m_cmState).str());
} }
if (state != oldState)
m_logger->info("UE switches to state [%s]", ToJson(state).str().c_str());
triggerMmCycle(); triggerMmCycle();
} }
...@@ -242,6 +246,14 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState) ...@@ -242,6 +246,14 @@ void NasMm::onSwitchCmState(ECmState oldState, ECmState newState)
switchRmState(ERmState::RM_DEREGISTERED); 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 @@ ...@@ -10,8 +10,8 @@
#include <algorithm> #include <algorithm>
#include <nas/utils.hpp> #include <nas/utils.hpp>
#include <ue/app/task.hpp> #include <ue/app/task.hpp>
#include <ue/rrc/task.hpp>
#include <ue/nas/sm/sm.hpp> #include <ue/nas/sm/sm.hpp>
#include <ue/rrc/task.hpp>
namespace nr::ue namespace nr::ue
{ {
...@@ -199,7 +199,14 @@ void NasMm::handleRrcConnectionRelease() ...@@ -199,7 +199,14 @@ void NasMm::handleRrcConnectionRelease()
void NasMm::handleRadioLinkFailure() 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(); handleRrcConnectionRelease();
} }
......
...@@ -138,7 +138,8 @@ struct NwUeSraToRrc : NtsMessage ...@@ -138,7 +138,8 @@ struct NwUeSraToRrc : NtsMessage
{ {
PLMN_SEARCH_RESPONSE, PLMN_SEARCH_RESPONSE,
SERVING_CELL_CHANGE, SERVING_CELL_CHANGE,
RRC_PDU_DELIVERY RRC_PDU_DELIVERY,
RADIO_LINK_FAILURE
} present; } present;
// PLMN_SEARCH_RESPONSE // PLMN_SEARCH_RESPONSE
......
...@@ -44,17 +44,6 @@ void UeRrcTask::onLoop() ...@@ -44,17 +44,6 @@ void UeRrcTask::onLoop()
switch (msg->msgType) 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: { case NtsMessageType::UE_NAS_TO_RRC: {
auto *w = dynamic_cast<NwUeNasToRrc *>(msg); auto *w = dynamic_cast<NwUeNasToRrc *>(msg);
switch (w->present) switch (w->present)
...@@ -106,6 +95,10 @@ void UeRrcTask::onLoop() ...@@ -106,6 +95,10 @@ void UeRrcTask::onLoop()
handleDownlinkRrc(w->channel, w->pdu); handleDownlinkRrc(w->channel, w->pdu);
break; break;
} }
case NwUeSraToRrc::RADIO_LINK_FAILURE: {
handleRadioLinkFailure();
break;
}
} }
break; break;
} }
......
...@@ -63,6 +63,16 @@ void UeSraTask::onCoverageChange(const std::vector<GlobalNci> &entered, const st ...@@ -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()), m_logger->debug("Coverage change detected. [%d] cell entered, [%d] cell exited", static_cast<int>(entered.size()),
static_cast<int>(exited.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() 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