diff --git a/srsue/hdr/phy/phy.h b/srsue/hdr/phy/phy.h index f81a78e88..1c53c96de 100644 --- a/srsue/hdr/phy/phy.h +++ b/srsue/hdr/phy/phy.h @@ -33,14 +33,14 @@ #include "srslte/interfaces/ue_interfaces.h" #include "srslte/radio/radio.h" #include "srslte/srslte.h" -#include "srsue/hdr/phy/ue_phy_base.h" +#include "srsue/hdr/phy/ue_lte_phy_base.h" #include "sync.h" namespace srsue { typedef _Complex float cf_t; -class phy : public ue_phy_base, public phy_interface_stack_lte, public phy_interface_radio, public thread +class phy : public ue_lte_phy_base, public thread { public: phy(); diff --git a/srsue/hdr/phy/ue_lte_phy_base.h b/srsue/hdr/phy/ue_lte_phy_base.h new file mode 100644 index 000000000..e2b775c30 --- /dev/null +++ b/srsue/hdr/phy/ue_lte_phy_base.h @@ -0,0 +1,60 @@ +/* + * Copyright 2013-2019 Software Radio Systems Limited + * + * This file is part of srsLTE. + * + * srsLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsLTE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * A copy of the GNU Affero General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +/****************************************************************************** + * File: ue_lte_phy_base.h + * Description: Base class for UE LTE PHYs. + *****************************************************************************/ + +#ifndef SRSUE_UE_LTE_PHY_BASE_H +#define SRSUE_UE_LTE_PHY_BASE_H + +#include "srsue/hdr/phy/ue_phy_base.h" + +namespace srsue { + +class ue_lte_phy_base : public ue_phy_base, public phy_interface_stack_lte, public phy_interface_radio +{ +public: + ue_lte_phy_base(){}; + virtual ~ue_lte_phy_base(){}; + + virtual std::string get_type() = 0; + + virtual int init(const phy_args_t& args_, srslte::logger* logger_) = 0; + virtual int init(const phy_args_t& args_, + srslte::logger* logger_, + stack_interface_phy_lte* stack_, + radio_interface_phy* radio_) = 0; + virtual void stop() = 0; + + virtual void set_earfcn(std::vector earfcns) = 0; + virtual void force_freq(float dl_freq, float ul_freq) = 0; + + virtual void wait_initialize() = 0; + virtual void start_plot() = 0; + + virtual void get_metrics(phy_metrics_t* m) = 0; +}; + +} // namespace srsue + +#endif // SRSUE_UE_LTE_PHY_BASE_H diff --git a/srsue/hdr/phy/ue_phy_base.h b/srsue/hdr/phy/ue_phy_base.h index 76bb27d95..57dc44740 100644 --- a/srsue/hdr/phy/ue_phy_base.h +++ b/srsue/hdr/phy/ue_phy_base.h @@ -43,7 +43,8 @@ public: virtual std::string get_type() = 0; - virtual int init(const phy_args_t& args_, srslte::logger* logger_) = 0; + virtual int init(const phy_args_t& args_, srslte::logger* logger_) = 0; + virtual void stop() = 0; virtual void set_earfcn(std::vector earfcns) = 0; diff --git a/srsue/hdr/ue.h b/srsue/hdr/ue.h index 54c68204f..adcc738b4 100644 --- a/srsue/hdr/ue.h +++ b/srsue/hdr/ue.h @@ -94,7 +94,7 @@ public: ue(); ~ue(); - int init(const all_args_t& args_); + int init(const all_args_t& args_, srslte::logger* logger_); void stop(); bool switch_on(); bool switch_off(); @@ -113,13 +113,11 @@ private: std::unique_ptr stack; // Generic logger members - srslte::logger_stdout logger_stdout; - srslte::logger_file logger_file; - srslte::logger *logger; + srslte::logger* logger = nullptr; srslte::log_filter log; // Own logger for UE all_args_t args; - srslte::byte_buffer_pool* pool; + srslte::byte_buffer_pool* pool = nullptr; // Helper functions int parse_args(const all_args_t& args); // parse and validate arguments diff --git a/srsue/src/CMakeLists.txt b/srsue/src/CMakeLists.txt index eb170077c..ff4404fb9 100644 --- a/srsue/src/CMakeLists.txt +++ b/srsue/src/CMakeLists.txt @@ -49,8 +49,6 @@ if (RPATH) set_target_properties(srsue PROPERTIES INSTALL_RPATH ".") endif (RPATH) -install(TARGETS srsue DESTINATION ${RUNTIME_DIR}) - ######################################################################## # Option to run command after build (useful for remote builds) ######################################################################## diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 821f54ca0..e63783a59 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -491,9 +491,21 @@ int main(int argc, char* argv[]) all_args_t args = {}; parse_args(&args, argc, argv); + srslte::logger_stdout logger_stdout; + srslte::logger_file logger_file; + + // Setup logging + srslte::logger* logger = nullptr; + if (!args.log.filename.compare("stdout")) { + logger = &logger_stdout; + } else { + logger_file.init(args.log.filename, args.log.file_max_size); + logger = &logger_file; + } + // Create UE instance srsue::ue ue; - if (ue.init(args)) { + if (ue.init(args, logger)) { ue.stop(); return SRSLTE_ERROR; } diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index c9cde56b8..9625645a4 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -55,21 +55,15 @@ ue::~ue() srslte_dft_exit(); } -int ue::init(const all_args_t& args_) +int ue::init(const all_args_t& args_, srslte::logger* logger_) { - // Setup logging - if (!args_.log.filename.compare("stdout")) { - logger = &logger_stdout; - } else { - logger_file.init(args_.log.filename, args_.log.file_max_size); - logger_file.log("\n\n"); - logger_file.log(get_build_string().c_str()); - logger = &logger_file; - } + logger = logger_; // Init UE log log.init("UE ", logger); log.set_level(srslte::LOG_LEVEL_INFO); + log.info("\n\n"); + log.info("%s\n", get_build_string().c_str()); // Validate arguments if (parse_args(args_)) {