Commit 525599a4 authored by aligungr's avatar aligungr

RRC developments

parent c2cfdfe0
......@@ -9,14 +9,53 @@
#include "task.hpp"
#include <lib/rrc/encode.hpp>
#include <ue/nas/task.hpp>
#include <ue/nts.hpp>
namespace nr::ue
{
void UeRrcTask::handleCellSignalChange(int cellId, int dbm)
{
// TODO
bool considerLost = dbm < -120;
if (!m_cellDesc.count(cellId))
{
if (!considerLost)
notifyCellDetected(cellId, dbm);
}
else
{
if (considerLost)
notifyCellLost(cellId);
else
m_cellDesc[cellId].dbm = dbm;
}
}
void UeRrcTask::notifyCellDetected(int cellId, int dbm)
{
m_cellDesc[cellId] = {};
m_cellDesc[cellId].dbm = dbm;
m_logger->debug("New signal detected for cell[%d], total [%d] cells in coverage", cellId,
static_cast<int>(m_cellDesc.size()));
}
void UeRrcTask::notifyCellLost(int cellId)
{
if (!m_cellDesc.count(cellId))
return;
m_cellDesc.erase(cellId);
m_logger->debug("Signal lost for cell[%d], total [%d] cells in coverage", cellId,
static_cast<int>(m_cellDesc.size()));
// TODO: handle other operations
}
bool UeRrcTask::hasSignalToCell(int cellId)
{
return m_cellDesc.count(cellId);
}
} // namespace nr::ue
......@@ -21,6 +21,9 @@ namespace nr::ue
void UeRrcTask::handleDownlinkRrc(int cellId, rrc::RrcChannel channel, const OctetString &rrcPdu)
{
if (!hasSignalToCell(cellId))
return;
switch (channel)
{
case rrc::RrcChannel::BCCH_BCH: {
......
......@@ -10,7 +10,6 @@
#include <lib/rrc/encode.hpp>
#include <ue/nas/task.hpp>
#include <ue/nts.hpp>
#include <utils/common.hpp>
namespace nr::ue
{
......
......@@ -8,15 +8,17 @@
#pragma once
#include <asn/rrc/ASN_RRC_InitialUE-Identity.h>
#include <memory>
#include <thread>
#include <unordered_map>
#include <vector>
#include <ue/nts.hpp>
#include <ue/types.hpp>
#include <unordered_map>
#include <utils/logger.hpp>
#include <utils/nts.hpp>
#include <vector>
#include <asn/rrc/ASN_RRC_InitialUE-Identity.h>
extern "C"
{
......@@ -53,6 +55,8 @@ class UeRrcTask : public NtsTask
ASN_RRC_InitialUE_Identity_t m_initialId{};
OctetString m_initialNasPdu{};
std::unordered_map<int, UeCellDesc> m_cellDesc{};
friend class UeCmdHandler;
public:
......@@ -94,6 +98,9 @@ class UeRrcTask : public NtsTask
/* Cell Management */
void handleCellSignalChange(int cellId, int dbm);
void notifyCellDetected(int cellId, int dbm);
void notifyCellLost(int cellId);
bool hasSignalToCell(int cellId);
};
} // namespace nr::ue
......@@ -29,6 +29,11 @@ class UeRrcTask;
class UeRlsTask;
class UserEquipment;
struct UeCellDesc
{
int dbm{};
};
struct SupportedAlgs
{
bool nia1 = true;
......
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