kopia lustrzana https://github.com/f4exb/sdrangel
SDRdaemon: pass FEC blocks and tx delay from the command line
rodzic
9046b379ac
commit
3021181564
|
@ -130,6 +130,8 @@ SDRDaemonMain::SDRDaemonMain(qtwebapp::LoggerWithFile *logger, const SDRDaemonPa
|
|||
info.noquote();
|
||||
info << msg;
|
||||
m_channelSink = new SDRDaemonChannelSink(m_deviceSourceAPI);
|
||||
m_channelSink->setNbBlocksFEC(parser.getNbBlocksFEC());
|
||||
m_channelSink->setTxDelay(parser.getTxDelay());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -54,8 +54,15 @@ SDRDaemonParser::SDRDaemonParser() :
|
|||
"serial"),
|
||||
m_sequenceOption(QStringList() << "i" << "sequence",
|
||||
"Device sequence index in enumeration for the same device type.",
|
||||
"sequence")
|
||||
|
||||
"sequence"),
|
||||
m_txDelayOption(QStringList() << "d" << "tx-delay",
|
||||
"delay between transmission of UDP blocks (ms).",
|
||||
"txDelay",
|
||||
"100"),
|
||||
m_nbBlocksFECOption(QStringList() << "f" << "fec-blocks",
|
||||
"Number of FEC blocks per frame.",
|
||||
"nbBlocksFEC",
|
||||
"8")
|
||||
{
|
||||
m_serverAddress = "127.0.0.1";
|
||||
m_serverPort = 9091;
|
||||
|
@ -64,6 +71,8 @@ SDRDaemonParser::SDRDaemonParser() :
|
|||
m_deviceType = "TestSource";
|
||||
m_tx = false;
|
||||
m_sequence = 0;
|
||||
m_txDelay = 100;
|
||||
m_nbBlocksFEC = 8;
|
||||
m_hasSequence = false;
|
||||
m_hasSerial = false;
|
||||
|
||||
|
@ -79,6 +88,8 @@ SDRDaemonParser::SDRDaemonParser() :
|
|||
m_parser.addOption(m_txOption);
|
||||
m_parser.addOption(m_serialOption);
|
||||
m_parser.addOption(m_sequenceOption);
|
||||
m_parser.addOption(m_txDelayOption);
|
||||
m_parser.addOption(m_nbBlocksFECOption);
|
||||
}
|
||||
|
||||
SDRDaemonParser::~SDRDaemonParser()
|
||||
|
@ -195,6 +206,32 @@ void SDRDaemonParser::parse(const QCoreApplication& app)
|
|||
qWarning() << "SDRDaemonParser::parse: sequence invalid. Defaulting to " << m_sequence;
|
||||
}
|
||||
}
|
||||
|
||||
// Tx delay
|
||||
if (m_parser.isSet(m_txDelayOption))
|
||||
{
|
||||
QString txDelayStr = m_parser.value(m_txDelayOption);
|
||||
int txDelay = txDelayStr.toInt(&ok);
|
||||
|
||||
if (ok && (txDelay > 0)) {
|
||||
m_txDelay = txDelay;
|
||||
} else {
|
||||
qWarning() << "SDRDaemonParser::parse: Tx delay invalid. Defaulting to " << m_txDelay;
|
||||
}
|
||||
}
|
||||
|
||||
// nb FEC blocks
|
||||
if (m_parser.isSet(m_nbBlocksFECOption))
|
||||
{
|
||||
QString nbBlocksFECStr = m_parser.value(m_nbBlocksFECOption);
|
||||
int nbBlocksFEC = nbBlocksFECStr.toInt(&ok);
|
||||
|
||||
if (ok && (nbBlocksFEC >= 0) && (nbBlocksFEC < 128)) {
|
||||
m_nbBlocksFEC = nbBlocksFEC;
|
||||
} else {
|
||||
qWarning() << "SDRDaemonParser::parse: Tx number of FEC blocks invalid. Defaulting to " << m_nbBlocksFEC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ public:
|
|||
bool getTx() const { return m_tx; }
|
||||
const QString& getSerial() const { return m_serial; }
|
||||
uint16_t getSequence() const { return m_sequence; }
|
||||
int getTxDelay() const { return m_txDelay; }
|
||||
int getNbBlocksFEC() const { return m_nbBlocksFEC; }
|
||||
|
||||
bool hasSequence() const { return m_hasSequence; }
|
||||
bool hasSerial() const { return m_hasSerial; }
|
||||
|
@ -55,6 +57,8 @@ private:
|
|||
bool m_tx; //!< True for Tx
|
||||
QString m_serial; //!< Serial number of the device
|
||||
uint16_t m_sequence; //!< Sequence of the device for the same type of device in enumeration process
|
||||
int m_txDelay; //!< Initial delay between transmission of UDP blocks in milliseconds
|
||||
int m_nbBlocksFEC; //!< Number of FEC blocks per frame;
|
||||
bool m_hasSerial; //!< True if serial was specified
|
||||
bool m_hasSequence; //!< True if sequence was specified
|
||||
|
||||
|
@ -67,6 +71,8 @@ private:
|
|||
QCommandLineOption m_txOption;
|
||||
QCommandLineOption m_serialOption;
|
||||
QCommandLineOption m_sequenceOption;
|
||||
QCommandLineOption m_txDelayOption;
|
||||
QCommandLineOption m_nbBlocksFECOption;
|
||||
};
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue