Skip to content

Commit

Permalink
fix MLE uplink/downlink processing
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Jun 4, 2024
1 parent fc524f6 commit 45dfa2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions include/l2/upper_mac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@

class UpperMac {
public:
UpperMac(std::shared_ptr<Reporter> reporter)
UpperMac() = delete;
UpperMac(std::shared_ptr<Reporter> reporter, bool is_downlink)
: reporter_(std::move(reporter))
, mobile_link_entity_(std::make_shared<MobileLinkEntity>(reporter_))
, mobile_link_entity_(std::make_shared<MobileLinkEntity>(reporter_, is_downlink))
, logical_link_control_(std::make_unique<LogicalLinkControl>(reporter_, mobile_link_entity_)){};
~UpperMac() noexcept = default;

Expand Down
12 changes: 7 additions & 5 deletions include/l3/mobile_link_entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

class MobileLinkEntity {
public:
explicit MobileLinkEntity(std::shared_ptr<Reporter> reporter)
MobileLinkEntity() = delete;
MobileLinkEntity(std::shared_ptr<Reporter> reporter, bool is_downlink)
: reporter_(std::move(reporter))
, cmce_(std::make_unique<CircuitModeControlEntity>(reporter_))
, mm_(std::make_unique<MobileManagement>()){};
, mm_(std::make_unique<MobileManagement>())
, is_downlink_(is_downlink){};
~MobileLinkEntity() noexcept = default;

void service_DMle_system_info(BitVector& vec);
Expand Down Expand Up @@ -51,12 +53,12 @@ class MobileLinkEntity {
uint8_t air_interface_encryption_service_ = 0;
uint8_t advanced_link_supported_ = 0;

// this variable is set to true if sync is received. this is not available in uplink
bool is_downlink_ = false;

std::shared_ptr<Reporter> reporter_{};
std::unique_ptr<CircuitModeControlEntity> cmce_{};
std::unique_ptr<MobileManagement> mm_{};

// Wheather this MLE is for decoding downlink or uplink data
const bool is_downlink_;
};

auto operator<<(std::ostream& stream, const MobileLinkEntity& mle) -> std::ostream&;
11 changes: 6 additions & 5 deletions src/l2/lower_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ LowerMac::LowerMac(std::shared_ptr<Reporter> reporter, std::shared_ptr<Prometheu
std::optional<uint32_t> scrambling_code)
: reporter_(reporter) {
viter_bi_codec_1614_ = std::make_shared<ViterbiCodec>();
upper_mac_ = std::make_shared<UpperMac>(reporter_);

if (prometheus_exporter) {
metrics_ = std::make_unique<LowerMacPrometheusCounters>(prometheus_exporter);
}

// For decoupled uplink processing we need to inject a scrambling code. Inject it into the correct place that would
// normally be filled by a Synchronization Burst
if (scrambling_code.has_value()) {
sync_ = BroadcastSynchronizationChannel();
sync_->scrambling_code = *scrambling_code;
}

upper_mac_ = std::make_shared<UpperMac>(reporter_, /*is_downlink=*/!scrambling_code.has_value());

if (prometheus_exporter) {
metrics_ = std::make_unique<LowerMacPrometheusCounters>(prometheus_exporter);
}
}

static auto vectorAppend(const std::vector<uint8_t>& vec, std::vector<uint8_t>& res, std::size_t pos,
Expand Down

0 comments on commit 45dfa2b

Please sign in to comment.