1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-19 06:41:47 -05:00

SDRDaemon: Web API: check channel settings

This commit is contained in:
f4exb 2018-08-23 22:17:26 +02:00
parent 4f43e51178
commit 0b195947d8
2 changed files with 31 additions and 7 deletions

View File

@ -333,17 +333,41 @@ int SDRDaemonChannelSink::webapiSettingsPutPatch(
{ {
SDRDaemonChannelSinkSettings settings = m_settings; SDRDaemonChannelSinkSettings settings = m_settings;
if (channelSettingsKeys.contains("nbFECBlocks")) { if (channelSettingsKeys.contains("nbFECBlocks"))
{
int nbFECBlocks = response.getSdrDaemonChannelSinkSettings()->getNbFecBlocks();
if ((nbFECBlocks < 0) || (nbFECBlocks > 127)) {
settings.m_nbFECBlocks = 8;
} else {
settings.m_nbFECBlocks = response.getSdrDaemonChannelSinkSettings()->getNbFecBlocks(); settings.m_nbFECBlocks = response.getSdrDaemonChannelSinkSettings()->getNbFecBlocks();
} }
if (channelSettingsKeys.contains("txDelay")) {
settings.m_txDelay = response.getSdrDaemonChannelSinkSettings()->getTxDelay();
} }
if (channelSettingsKeys.contains("txDelay"))
{
int txDelay = response.getSdrDaemonChannelSinkSettings()->getTxDelay();
if (txDelay < 0) {
settings.m_txDelay = 100;
} else {
settings.m_txDelay = txDelay;
}
}
if (channelSettingsKeys.contains("dataAddress")) { if (channelSettingsKeys.contains("dataAddress")) {
settings.m_dataAddress = *response.getSdrDaemonChannelSinkSettings()->getDataAddress(); settings.m_dataAddress = *response.getSdrDaemonChannelSinkSettings()->getDataAddress();
} }
if (channelSettingsKeys.contains("dataPort")) {
settings.m_dataPort = response.getSdrDaemonChannelSinkSettings()->getDataPort(); if (channelSettingsKeys.contains("dataPort"))
{
int dataPort = response.getSdrDaemonChannelSinkSettings()->getDataPort();
if ((dataPort < 1024) || (dataPort > 65535)) {
settings.m_dataPort = 9090;
} else {
settings.m_dataPort = dataPort;
}
} }
MsgConfigureSDRDaemonChannelSink *msg = MsgConfigureSDRDaemonChannelSink::create(settings, force); MsgConfigureSDRDaemonChannelSink *msg = MsgConfigureSDRDaemonChannelSink::create(settings, force);

View File

@ -229,7 +229,7 @@ void SDRDaemonParser::parse(const QCoreApplication& app)
QString txDelayStr = m_parser.value(m_txDelayOption); QString txDelayStr = m_parser.value(m_txDelayOption);
int txDelay = txDelayStr.toInt(&ok); int txDelay = txDelayStr.toInt(&ok);
if (ok && (txDelay > 0)) if (ok && (txDelay >= 0))
{ {
m_txDelay = txDelay; m_txDelay = txDelay;
qDebug() << "SDRDaemonParser::parse: Tx delay: " << m_txDelay; qDebug() << "SDRDaemonParser::parse: Tx delay: " << m_txDelay;