srsLTE/lib/include/srsran/radio/radio_null.h

129 lines
3.7 KiB
C
Raw Normal View History

/**
2022-04-29 00:28:44 -07:00
* Copyright 2013-2022 Software Radio Systems Limited
2020-06-16 04:08:34 -07:00
*
2021-04-22 01:59:40 -07:00
* This file is part of srsRAN.
2020-06-16 04:08:34 -07:00
*
2021-04-22 01:59:40 -07:00
* srsRAN is free software: you can redistribute it and/or modify
2021-03-28 14:12:42 -07:00
* 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.
*
2021-04-22 01:59:40 -07:00
* srsRAN is distributed in the hope that it will be useful,
2021-03-28 14:12:42 -07:00
* 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.
2020-06-16 04:08:34 -07:00
*
2021-03-28 14:12:42 -07:00
* 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/.
2020-06-16 04:08:34 -07:00
*
*/
2020-06-18 03:30:11 -07:00
/**
* @file radio_null.h
* @brief Dummy radio class
*/
2020-06-16 04:08:34 -07:00
2021-03-19 03:45:56 -07:00
#ifndef SRSRAN_RADIO_NULL_H
#define SRSRAN_RADIO_NULL_H
2020-06-16 04:08:34 -07:00
#include "radio_base.h"
2021-03-19 03:45:56 -07:00
#include "srsran/interfaces/radio_interfaces.h"
#include "srsran/phy/rf/rf.h"
#include "srsran/radio/radio.h"
#include "srsran/radio/radio_metrics.h"
2020-06-16 04:08:34 -07:00
2021-03-19 03:45:56 -07:00
namespace srsran {
2020-06-16 04:08:34 -07:00
2020-06-18 03:30:11 -07:00
class radio_null final : public radio_base, public radio_interface_phy
2020-06-16 04:08:34 -07:00
{
public:
2020-06-18 03:30:11 -07:00
~radio_null() final = default;
2020-06-16 04:08:34 -07:00
std::string get_type() override { return "null"; }
int init(const rf_args_t& args_, phy_interface_radio* phy_) override
{
logger.set_level(srslog::str_to_basic_level(args.log_level));
2020-06-16 04:08:34 -07:00
running = true;
2021-03-19 03:45:56 -07:00
return SRSRAN_SUCCESS;
2020-06-16 04:08:34 -07:00
}
void stop() override { running = false; }
bool get_metrics(rf_metrics_t* metrics) override
{
// do nothing
return true;
}
// radio_interface_phy
bool is_init() override { return running; }
void reset() override {}
bool is_continuous_tx() override { return false; }
bool tx(rf_buffer_interface& buffer, const rf_timestamp_interface& tx_time) override
{
logger.info("%s", __PRETTY_FUNCTION__);
2020-06-16 04:08:34 -07:00
return true;
}
void tx_end() override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
bool rx_now(rf_buffer_interface& buffer, rf_timestamp_interface& rxd_time) override
{
logger.info("%s", __PRETTY_FUNCTION__);
2020-06-16 04:08:34 -07:00
return true;
}
void set_rx_gain(const float& gain) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
void set_rx_gain_th(const float& gain) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
float get_rx_gain() override
{
logger.info("%s", __PRETTY_FUNCTION__);
2020-06-16 04:08:34 -07:00
return 0.0;
}
void set_tx_gain(const float& gain) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
void set_tx_freq(const uint32_t& channel_idx, const double& freq) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
void set_rx_freq(const uint32_t& channel_idx, const double& freq) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
double get_freq_offset() override
{
logger.info("%s", __PRETTY_FUNCTION__);
2020-06-16 04:08:34 -07:00
return 0.0;
}
void set_tx_srate(const double& srate) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-18 03:30:11 -07:00
void set_rx_srate(const double& srate) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
void set_channel_rx_offset(uint32_t ch, int32_t offset_samples) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
2021-03-19 03:45:56 -07:00
srsran_rf_info_t* get_info() override
2020-06-16 04:08:34 -07:00
{
logger.info("%s", __PRETTY_FUNCTION__);
2020-06-16 04:08:34 -07:00
return nullptr;
}
bool get_is_start_of_burst() override { return true; }
void release_freq(const uint32_t& carrier_idx) override { logger.info("%s", __PRETTY_FUNCTION__); }
2020-06-16 04:08:34 -07:00
protected:
rf_args_t args = {};
srslog::basic_logger& logger = srslog::fetch_basic_logger("RF", false);
bool running = false;
2020-06-16 04:08:34 -07:00
2021-03-19 03:45:56 -07:00
srsran::rf_metrics_t rf_metrics = {};
2020-06-16 04:08:34 -07:00
phy_interface_radio* phy = nullptr;
};
2021-03-19 03:45:56 -07:00
} // namespace srsran
2020-06-16 04:08:34 -07:00
2021-03-19 03:45:56 -07:00
#endif // SRSRAN_RADIO_NULL_H