Commit 8397d4e1 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 02c62f1a
......@@ -38,8 +38,23 @@ static ASN_RRC_UL_CCCH_Message *ConstructSetupRequest(ASN_RRC_InitialUE_Identity
return pdu;
}
void UeRrcTask::startConnectionSetup(OctetString &&nasPdu)
void UeRrcTask::startConnectionEstablishment(OctetString &&nasPdu)
{
if (m_state != ERrcState::RRC_IDLE)
{
m_logger->err("RRC establishment could not start, UE not in RRC-IDLE state");
handleEstablishmentFailure();
return;
}
int activeCell = m_base->shCtx.currentCell.get<int>([](auto &item) { return item.cellId; });
if (activeCell == 0)
{
m_logger->err("RRC establishment could not start, no active cell");
handleEstablishmentFailure();
return;
}
// TODO: if it's already in progress
if (m_initialId.present == ASN_RRC_InitialUE_Identity_PR_NOTHING)
......@@ -50,8 +65,6 @@ void UeRrcTask::startConnectionSetup(OctetString &&nasPdu)
m_initialNasPdu = std::move(nasPdu);
int activeCell = m_base->shCtx.currentCell.get<int>([](auto &item) { return item.cellId; });
m_logger->debug("Sending RRC Setup Request");
auto *rrcSetupRequest = ConstructSetupRequest(m_initialId, ASN_RRC_EstablishmentCause_mo_Data);
......@@ -97,7 +110,8 @@ void UeRrcTask::receiveRrcReject(int cellId, const ASN_RRC_RRCReject &msg)
return;
m_logger->err("RRC Reject received");
m_base->nasTask->push(new NwUeRrcToNas(NwUeRrcToNas::RRC_ESTABLISHMENT_FAILURE));
handleEstablishmentFailure();
}
void UeRrcTask::receiveRrcRelease(const ASN_RRC_RRCRelease &msg)
......@@ -107,4 +121,9 @@ void UeRrcTask::receiveRrcRelease(const ASN_RRC_RRCRelease &msg)
m_base->nasTask->push(new NwUeRrcToNas(NwUeRrcToNas::RRC_CONNECTION_RELEASE));
}
void UeRrcTask::handleEstablishmentFailure()
{
m_base->nasTask->push(new NwUeRrcToNas(NwUeRrcToNas::RRC_ESTABLISHMENT_FAILURE));
}
} // namespace nr::ue
......@@ -33,7 +33,7 @@ void UeRrcTask::deliverUplinkNas(uint32_t pduId, OctetString &&nasPdu)
if (m_state == ERrcState::RRC_IDLE)
{
startConnectionSetup(std::move(nasPdu));
startConnectionEstablishment(std::move(nasPdu));
return;
}
else if (m_state == ERrcState::RRC_INACTIVE)
......
......@@ -119,7 +119,8 @@ class UeRrcTask : public NtsTask
void receiveDownlinkInformationTransfer(const ASN_RRC_DLInformationTransfer &msg);
/* Connection Control */
void startConnectionSetup(OctetString &&nasPdu);
void startConnectionEstablishment(OctetString &&nasPdu);
void handleEstablishmentFailure();
void receiveRrcSetup(int cellId, const ASN_RRC_RRCSetup &msg);
void receiveRrcReject(int cellId, const ASN_RRC_RRCReject &msg);
void receiveRrcRelease(const ASN_RRC_RRCRelease &msg);
......
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