diff --git a/include/l2/upper_mac.hpp b/include/l2/upper_mac.hpp index 2b856df..887e895 100644 --- a/include/l2/upper_mac.hpp +++ b/include/l2/upper_mac.hpp @@ -24,9 +24,10 @@ class UpperMac { public: - UpperMac(std::shared_ptr reporter) + UpperMac() = delete; + UpperMac(std::shared_ptr reporter, bool is_downlink) : reporter_(std::move(reporter)) - , mobile_link_entity_(std::make_shared(reporter_)) + , mobile_link_entity_(std::make_shared(reporter_, is_downlink)) , logical_link_control_(std::make_unique(reporter_, mobile_link_entity_)){}; ~UpperMac() noexcept = default; diff --git a/include/l3/mobile_link_entity.hpp b/include/l3/mobile_link_entity.hpp index 2f2ac9e..fe446cd 100644 --- a/include/l3/mobile_link_entity.hpp +++ b/include/l3/mobile_link_entity.hpp @@ -20,10 +20,12 @@ class MobileLinkEntity { public: - explicit MobileLinkEntity(std::shared_ptr reporter) + MobileLinkEntity() = delete; + MobileLinkEntity(std::shared_ptr reporter, bool is_downlink) : reporter_(std::move(reporter)) , cmce_(std::make_unique(reporter_)) - , mm_(std::make_unique()){}; + , mm_(std::make_unique()) + , is_downlink_(is_downlink){}; ~MobileLinkEntity() noexcept = default; void service_DMle_system_info(BitVector& vec); @@ -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_{}; std::unique_ptr cmce_{}; std::unique_ptr 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&; \ No newline at end of file diff --git a/src/l2/lower_mac.cpp b/src/l2/lower_mac.cpp index faf8c3e..9f29073 100644 --- a/src/l2/lower_mac.cpp +++ b/src/l2/lower_mac.cpp @@ -10,11 +10,6 @@ LowerMac::LowerMac(std::shared_ptr reporter, std::shared_ptr scrambling_code) : reporter_(reporter) { viter_bi_codec_1614_ = std::make_shared(); - upper_mac_ = std::make_shared(reporter_); - - if (prometheus_exporter) { - metrics_ = std::make_unique(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 @@ -22,6 +17,12 @@ LowerMac::LowerMac(std::shared_ptr reporter, std::shared_ptrscrambling_code = *scrambling_code; } + + upper_mac_ = std::make_shared(reporter_, /*is_downlink=*/!scrambling_code.has_value()); + + if (prometheus_exporter) { + metrics_ = std::make_unique(prometheus_exporter); + } } static auto vectorAppend(const std::vector& vec, std::vector& res, std::size_t pos,