5#ifndef PICOSCENES_PLATFORM_VIRTUALSDRFRONTEND_HXX
6#define PICOSCENES_PLATFORM_VIRTUALSDRFRONTEND_HXX
36 int32_t
transmitSignals(
const std::vector<const void*>& signals, int64_t bufferLength,
double postfixDuration)
override {
64 return std::tuple<double, double, double>();
83 int setChannelAndBandwidth(std::optional<double> control, std::optional<double> bw, std::optional<double> center)
override {
103 void applyPreset(
const std::string& presetName,
bool skipChangeRate)
override {
105 std::string upperPresetName = boost::to_upper_copy(presetName);
109 throw std::invalid_argument(fmt::format(
"Preset '{}' is not supported by the current USRP device type.", presetName));
113 const auto& preset = FrontEndModePreset::getPresetMap().at(upperPresetName);
116 if (preset->txCBW.has_value()) {
122 if (preset->rxCBW.has_value()) {
135 if (!carrierFreqsV.empty()) {
145 if (!carrierFreqsV.empty()) {
251 void setRxGain(
const double rxGainV, uint8_t channel)
override {
333 return std::chrono::system_clock::now().time_since_epoch().count();
395 ChannelBandwidthEnum
rxCBW = ChannelBandwidthEnum::CBW_20;
#define LoggingService_Frontend_info_printf(...)
std::string referredInterfaceName
the user specified frontend name
PicoScenesFrameTxParameters userSpecifiedTxParameters
user-specified Tx parameters
const std::string & getReferredInterfaceName() const
Get the user-specified frontend name.
The shared abstract frontend for SDR devices only.
void setRxChannelBandwidthMode(ChannelBandwidthEnum rxCbw) override
Set the channel bandwidth mode for Rx.
void setTxResampleRatio(double txResampleRatioV) override
Set the Tx resampling ratio.
double getSamplingRate() override
Get the baseband sampling rate.
void setRxResampleRatio(double rxResampleRatioV) override
Set the Rx resampling ratio.
uint8_t getRxChainMask() override
Get Rx chain mask.
uint8_t getTxChainMask() override
Get the Tx chain mask.
Interface class for the Virtual SDR Frontend.
void setTxSamplingRate(double txRate) override
Sets the transmit sampling rate for the virtual SDR.
uint16_t getChannelFlags() override
Gets the channel flags for the virtual SDR.
std::tuple< double, double, double > getChannelAndBandwidth() override
Gets the channel, bandwidth, and center frequency (returns an empty tuple).
void setRxGain(const double rxGainV) override
Sets the receive gain for the virtual SDR.
double rxGain
Receive gain (dB).
static std::shared_ptr< VirtualSDRFrontEnd > getInstance(const std::string &referredInterfaceName)
Gets the instance of VirtualSDRFrontEnd.
ChannelBandwidthEnum rxCBW
Receive channel bandwidth mode.
double getTxpower() override
Gets the transmit power for the virtual SDR.
void setTimeSource(const std::string &timeSourceV) override
Sets the time source for the virtual SDR.
double getRxSamplingRate() override
Gets the receive sampling rate for the virtual SDR.
bool supportAGC() override
Checks if the virtual SDR supports Automatic Gain Control (AGC).
void setFilterBandwidth(const double bw) override
Sets the filter bandwidth for the virtual SDR.
void setMasterClockRate(const double masterClockRateV) override
Sets the master clock rate for the virtual SDR.
double rxSamplingRate
Receive sampling rate (Hz).
void setRxAntennas(const std::vector< std::string > &rxAnts) override
Sets the receive antenna names for the virtual SDR.
void setRxGain(const double rxGainV, uint8_t channel) override
Sets the receive gain for a specific channel of the virtual SDR (only sets the global gain).
std::string getClockSource() override
Gets the clock source for the virtual SDR.
double txpower
Transmit power (dBm or linear unit, context-dependent).
void setClockSource(const std::string &clockSourceV) override
Sets the clock source for the virtual SDR.
double txSamplingRate
Transmit sampling rate (Hz).
bool isHardwareSupportedPreset(const std::string &presetName) override
Checks if the hardware supports the specified preset mode.
std::optional< double > rxCarrierFrequencyOffset
Receive carrier frequency offset (Hz).
void setAGC(bool enableAGC) override
Sets the Automatic Gain Control (AGC) for the virtual SDR (no actual operation).
double masterClockRate
Master clock rate (Hz).
void setControlChannelFrequency(const double controlFrequencyV) override
Sets the control channel frequency for the virtual SDR.
ExtraInfo buildExtraInfo() override
Builds extra information for the frontend (currently empty).
std::vector< std::string > txAntennas
List of transmit antenna names.
double getFilterBandwidth() override
Gets the filter bandwidth for the virtual SDR.
std::string clockSource
Clock source ("internal", "external", etc.).
uint16_t channelFlags
Channel flags (define channel mode, etc.).
std::vector< double > getTxCarrierFrequencies() override
Gets the transmit carrier frequencies for the virtual SDR (returns a single frequency).
void setRxCarrierFrequencies(std::vector< double > carrierFreqsV) override
Sets the receive carrier frequencies for the virtual SDR (only sets the first channel).
VirtualSDRFrontEnd(const std::string &referredInterfaceName)
Constructor (protected, get instance via getInstance).
double controlFrequency
Control channel frequency (Hz).
int32_t transmitSignals(const std::vector< const void * > &signals, int64_t bufferLength, double postfixDuration) override
Simulates signal transmission (no actual operation).
double getTxSamplingRate() override
Gets the transmit sampling rate for the virtual SDR.
double getMasterClockRate() override
Gets the master clock rate for the virtual SDR.
void setTxCarrierFrequencies(std::vector< double > carrierFreqsV) override
Sets the transmit carrier frequencies for the virtual SDR (only sets the first channel).
void setTxAntennas(const std::vector< std::string > &txAnts) override
Sets the transmit antenna names for the virtual SDR.
std::vector< double > getRxCarrierFrequencies() override
Gets the receive carrier frequencies for the virtual SDR (returns a single frequency).
double getControlChannelFrequency() override
Gets the control channel frequency for the virtual SDR.
double carrierFrequency
Carrier frequency (Hz).
std::vector< std::string > getTxAntennas() override
Gets the transmit antenna names for the virtual SDR.
std::vector< std::string > getRxAntennas() override
Gets the receive antenna names for the virtual SDR.
void setTxpower(const double txpowerV) override
Sets the transmit power for the virtual SDR.
void setRxSamplingRate(double rxRate) override
Sets the receive sampling rate for the virtual SDR.
double filterBandwidth
Hardware filter bandwidth (Hz).
int setChannelAndBandwidth(double center, double bw, double control) override
Sets the channel, bandwidth, and center frequency (no actual operation).
std::string timeSource
Time source ("internal", "gpsdo", etc.).
double getSDRFrontEndTime() override
Gets the current time of the virtual SDR (uses system clock).
int setChannelAndBandwidth(std::optional< double > control, std::optional< double > bw, std::optional< double > center) override
Optionally sets the channel, bandwidth, and center frequency (no actual operation).
void applyPreset(const std::string &presetName, bool skipChangeRate) override
Applies the specified preset mode to the virtual SDR.
double getRxGain() override
Gets the receive gain for the virtual SDR.
std::vector< std::string > rxAntennas
List of receive antenna names.
std::string getTimeSource() override
Gets the time source for the virtual SDR.
void printStatus() override
Prints the status information of the virtual SDR to the log.