Commit 330ee886 authored by aligungr's avatar aligungr

UE SRA dev.

parent a583bd55
......@@ -26,7 +26,7 @@ static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos)
namespace nr::gnb
{
void GnbSraTask::handleCellInfoRequest(const InetAddress &addr, const sra::SraCellInfoRequest &msg)
void GnbSraTask::handleCellInfoRequest(int ueId,const sra::SraCellInfoRequest &msg)
{
int dbm = EstimateSimulatedDbm(m_base->config->phyLocation, msg.simPos);
if (dbm < MIN_ALLOWED_DBM)
......@@ -43,7 +43,12 @@ void GnbSraTask::handleCellInfoRequest(const InetAddress &addr, const sra::SraCe
resp.gnbName = m_base->config->name;
resp.linkIp = m_base->config->portalIp;
sendSraMessage(addr, resp);
sendSraMessage(ueId, resp);
}
void GnbSraTask::handleUplinkPduDelivery(int ueId, const sra::SraPduDelivery &msg)
{
}
} // namespace nr::gnb
......@@ -15,7 +15,7 @@ static const int64_t LAST_SEEN_THRESHOLD = 3000;
namespace nr::gnb
{
void GnbSraTask::updateUeInfo(const InetAddress &addr, uint64_t sti)
int GnbSraTask::updateUeInfo(const InetAddress &addr, uint64_t sti)
{
if (m_stiToUeId.count(sti))
{
......@@ -23,6 +23,7 @@ void GnbSraTask::updateUeInfo(const InetAddress &addr, uint64_t sti)
auto &ctx = m_ueCtx[ueId];
ctx->addr = addr;
ctx->lastSeen = utils::CurrentTimeMillis();
return ueId;
}
else
{
......@@ -35,6 +36,7 @@ void GnbSraTask::updateUeInfo(const InetAddress &addr, uint64_t sti)
m_ueCtx[ueId] = std::move(ctx);
m_logger->debug("New UE signal detected, total [%d] UEs in coverage", static_cast<int>(m_stiToUeId.size()));
return ueId;
}
}
......
......@@ -47,13 +47,14 @@ class GnbSraTask : public NtsTask
private: /* Transport */
void receiveSraMessage(const InetAddress &addr, const sra::SraMessage &msg);
void sendSraMessage(const InetAddress &addr, const sra::SraMessage &msg);
void sendSraMessage(int ueId, const sra::SraMessage &msg);
private: /* Handler */
void handleCellInfoRequest(const InetAddress &addr, const sra::SraCellInfoRequest &msg);
void handleCellInfoRequest(int ueId, const sra::SraCellInfoRequest &msg);
void handleUplinkPduDelivery(int ueId, const sra::SraPduDelivery &msg);
private: /* UE Management */
void updateUeInfo(const InetAddress &addr, uint64_t sti);
int updateUeInfo(const InetAddress &addr, uint64_t sti);
void onPeriodicLostControl();
};
......
......@@ -13,24 +13,35 @@ namespace nr::gnb
void GnbSraTask::receiveSraMessage(const InetAddress &addr, const sra::SraMessage &msg)
{
updateUeInfo(addr, msg.sti);
int ueId = updateUeInfo(addr, msg.sti);
switch (msg.msgType)
{
case sra::EMessageType::CELL_INFO_REQUEST:
handleCellInfoRequest(addr, (const sra::SraCellInfoRequest &)msg);
case sra::EMessageType::CELL_INFO_REQUEST: {
handleCellInfoRequest(ueId, (const sra::SraCellInfoRequest &)msg);
break;
}
case sra::EMessageType::PDU_DELIVERY: {
handleUplinkPduDelivery(ueId, (const sra::SraPduDelivery &)msg);
break;
}
default:
m_logger->err("Unhandled SRA message received with type[%d]", static_cast<int>(msg.msgType));
break;
}
}
void GnbSraTask::sendSraMessage(const InetAddress &addr, const sra::SraMessage &msg)
void GnbSraTask::sendSraMessage(int ueId, const sra::SraMessage &msg)
{
if (!m_ueCtx.count(ueId))
{
m_logger->err("SRA message sending failure, UE[%d] not exists", ueId);
return;
}
OctetString stream{};
sra::EncodeSraMessage(msg, stream);
m_udpTask->send(addr, stream);
m_udpTask->send(m_ueCtx[ueId]->addr, stream);
}
} // namespace nr::gnb
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