Commit 80bf2caa authored by aligungr's avatar aligungr

RRC developments

parent 19e140bd
......@@ -9,11 +9,35 @@
#include "task.hpp"
#include <gnb/ngap/task.hpp>
#include <lib/asn/utils.hpp>
#include <lib/rrc/encode.hpp>
#include <asn/rrc/ASN_RRC_MIB.h>
namespace nr::gnb
{
static ASN_RRC_BCCH_BCH_Message *ConstructMibMessage(bool barred, bool intraFreqReselectAllowed)
{
auto *pdu = asn::New<ASN_RRC_BCCH_BCH_Message>();
pdu->message.present = ASN_RRC_BCCH_BCH_MessageType_PR_mib;
pdu->message.choice.mib = asn::New<ASN_RRC_MIB>();
auto &mib = *pdu->message.choice.mib;
asn::SetBitStringInt<6>(0, mib.systemFrameNumber);
mib.subCarrierSpacingCommon = ASN_RRC_MIB__subCarrierSpacingCommon_scs15or60;
mib.ssb_SubcarrierOffset = 0;
mib.dmrs_TypeA_Position = ASN_RRC_MIB__dmrs_TypeA_Position_pos2;
mib.cellBarred = barred ? ASN_RRC_MIB__cellBarred_barred : ASN_RRC_MIB__cellBarred_notBarred;
mib.intraFreqReselection = intraFreqReselectAllowed ? ASN_RRC_MIB__intraFreqReselection_allowed
: ASN_RRC_MIB__intraFreqReselection_notAllowed;
asn::SetBitStringInt<1>(0, mib.spare);
mib.pdcch_ConfigSIB1.controlResourceSetZero = 0;
mib.pdcch_ConfigSIB1.searchSpaceZero = 0;
return pdu;
}
void GnbRrcTask::onBroadcastTimerExpired()
{
triggerSysInfoBroadcast();
......@@ -21,7 +45,11 @@ void GnbRrcTask::onBroadcastTimerExpired()
void GnbRrcTask::triggerSysInfoBroadcast()
{
// TODO
ASN_RRC_BCCH_BCH_Message *msg = ConstructMibMessage(m_isBarred, m_intraFreqReselectAllowed);
sendRrcMessage(msg);
asn::Free(asn_DEF_ASN_RRC_BCCH_BCH_Message, msg);
}
} // namespace nr::gnb
\ No newline at end of file
......@@ -65,7 +65,7 @@ void GnbRrcTask::handleUplinkRrc(int ueId, rrc::RrcChannel channel, const OctetS
}
}
void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_BCCH_BCH_Message *msg)
void GnbRrcTask::sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg)
{
OctetString pdu = rrc::encode::EncodeS(asn_DEF_ASN_RRC_BCCH_BCH_Message, msg);
if (pdu.length() == 0)
......@@ -75,7 +75,7 @@ void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_BCCH_BCH_Message *msg)
}
auto *w = new NwGnbRrcToRls(NwGnbRrcToRls::RRC_PDU_DELIVERY);
w->ueId = ueId;
w->ueId = 0;
w->channel = rrc::RrcChannel::BCCH_BCH;
w->pdu = std::move(pdu);
m_base->rlsTask->push(w);
......
......@@ -46,6 +46,9 @@ class GnbRrcTask : public NtsTask
std::unordered_map<int, RrcUeContext *> m_ueCtx;
int m_tidCounter;
bool m_isBarred = false;
bool m_intraFreqReselectAllowed = false;
friend class GnbCmdHandler;
public:
......@@ -79,7 +82,7 @@ class GnbRrcTask : public NtsTask
void receiveRrcSetupComplete(int ueId, const ASN_RRC_RRCSetupComplete &msg);
/* RRC channel send message */
void sendRrcMessage(int ueId, ASN_RRC_BCCH_BCH_Message *msg);
void sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg);
void sendRrcMessage(int ueId, ASN_RRC_BCCH_DL_SCH_Message *msg);
void sendRrcMessage(int ueId, ASN_RRC_DL_CCCH_Message *msg);
void sendRrcMessage(int ueId, ASN_RRC_DL_DCCH_Message *msg);
......
......@@ -8,18 +8,22 @@
#pragma once
#include <lib/rrc/rrc.hpp>
#include <lib/udp/server_task.hpp>
#include <lib/rls/rls_pdu.hpp>
#include "ctl_task.hpp"
#include "udp_task.hpp"
#include <memory>
#include <optional>
#include <thread>
#include <ue/types.hpp>
#include <unordered_map>
#include <vector>
#include <lib/rls/rls_pdu.hpp>
#include <lib/rrc/rrc.hpp>
#include <lib/udp/server_task.hpp>
#include <ue/types.hpp>
#include <utils/common_types.hpp>
#include <utils/logger.hpp>
#include <utils/nts.hpp>
#include <vector>
namespace nr::ue
{
......@@ -29,16 +33,10 @@ class UeRlsTask : public NtsTask
private:
TaskBase *m_base;
std::unique_ptr<Logger> m_logger;
udp::UdpServerTask *m_udpTask;
std::vector<InetAddress> m_cellSearchSpace;
std::unordered_map<GlobalNci, UeCellMeasurement> m_pendingMeasurements;
std::unordered_map<GlobalNci, UeCellMeasurement> m_activeMeasurements;
bool m_pendingPlmnResponse;
int64_t m_measurementPeriod;
uint64_t m_sti;
std::optional<UeCellInfo> m_servingCell;
RlsUdpTask *m_udpTask;
RlsControlTask *m_ctlTask;
friend class UeCmdHandler;
......@@ -50,22 +48,6 @@ class UeRlsTask : public NtsTask
void onStart() override;
void onLoop() override;
void onQuit() override;
private: /* Base */
void slowDownMeasurements();
private: /* Transport */
void receiveRlsMessage(const InetAddress &address, rls::RlsMessage &msg);
void sendRlsMessage(const InetAddress &address, const rls::RlsMessage &msg);
void deliverUplinkPdu(rls::EPduType pduType, OctetString &&pdu, OctetString &&payload);
void deliverDownlinkPdu(rls::RlsPduDelivery &msg);
private: /* Measurement */
void onMeasurement();
void receiveCellInfoResponse(const rls::RlsCellInfoResponse &msg);
void onCoverageChange(const std::vector<GlobalNci> &entered, const std::vector<GlobalNci> &exited);
void plmnSearchRequested();
void handleCellSelectionCommand(const GlobalNci &cellId, bool isSuitable);
};
} // namespace nr::ue
\ No newline at end of file
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