Add Channel Power to Web API

This commit is contained in:
srcejon 2024-03-13 15:52:45 +00:00
parent ddcd08ba15
commit d45058d08f
5 changed files with 16 additions and 0 deletions

View File

@ -94,6 +94,7 @@ option(ENABLE_CHANNELRX_DEMODDSC "Enable channelrx demoddsc plugin" ON)
option(ENABLE_CHANNELRX_HEATMAP "Enable channelrx heatmap plugin" ON)
option(ENABLE_CHANNELRX_FREQSCANNER "Enable channelrx freqscanner plugin" ON)
option(ENABLE_CHANNELRX_ENDOFTRAIN "Enable channelrx end-of-train plugin" ON)
option(ENABLE_CHANNELRX_CHANNELPOWER "Enable channelrx channel power plugin" ON)
# Channel Tx enablers
option(ENABLE_CHANNELTX "Enable channeltx plugins" ON)

View File

@ -1,5 +1,9 @@
project(demod)
if (ENABLE_CHANNELRX_CHANNELPOWER)
add_subdirectory(channelpower)
endif()
if (ENABLE_CHANNELRX_ENDOFTRAIN)
add_subdirectory(demodendoftrain)
endif()

View File

@ -421,6 +421,7 @@ void ChannelPower::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& resp
response.getChannelPowerReport()->setChannelPowerDb(CalcDb::dbPower(magAvg));
response.getChannelPowerReport()->setChannelPowerMaxDb(CalcDb::dbPower(magMaxPeak));
response.getChannelPowerReport()->setChannelPowerMinDb(CalcDb::dbPower(magMinPeak));
response.getChannelPowerReport()->setChannelPowerPulseDb(CalcDb::dbPower(magPulseAvg));
response.getChannelPowerReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
}

View File

@ -4478,6 +4478,12 @@ bool WebAPIRequestMapper::getChannelSettings(
channelSettings->getChannelAnalyzerSettings()->init();
channelSettings->getChannelAnalyzerSettings()->fromJsonObject(settingsJsonObject);
}
else if (channelSettingsKey == "ChannelPowerSettings")
{
channelSettings->setChannelPowerSettings(new SWGSDRangel::SWGChannelPowerSettings());
channelSettings->setChannelPowerSettings()->init();
channelSettings->setChannelPowerSettings()->fromJsonObject(settingsJsonObject);
}
else if (channelSettingsKey == "ChirpChatDemodSettings")
{
channelSettings->setChirpChatDemodSettings(new SWGSDRangel::SWGChirpChatDemodSettings());
@ -5526,6 +5532,7 @@ void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings&
channelSettings.setAptDemodSettings(nullptr);
channelSettings.setAtvModSettings(nullptr);
channelSettings.setBfmDemodSettings(nullptr);
channelSettings.setChannelPowerSettings(nullptr);
channelSettings.setDatvModSettings(nullptr);
channelSettings.setDabDemodSettings(nullptr);
channelSettings.setDsdDemodSettings(nullptr);
@ -5572,6 +5579,7 @@ void WebAPIRequestMapper::resetChannelReport(SWGSDRangel::SWGChannelReport& chan
channelReport.setAmModReport(nullptr);
channelReport.setAtvModReport(nullptr);
channelReport.setBfmDemodReport(nullptr);
channelReport.setChannelPowerReport(nullptr);
channelReport.setDatvModReport(nullptr);
channelReport.setDsdDemodReport(nullptr);
channelReport.setEndOfTrainDemodReport(nullptr);

View File

@ -33,6 +33,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelURIToSettingsKey = {
{"sdrangel.channeltx.moddatv", "DATVModSettings"},
{"sdrangel.channel.bfm", "BFMDemodSettings"},
{"sdrangel.channel.chanalyzer", "ChannelAnalyzerSettings"},
{"sdrangel.channel.channelpower", "ChannelPowerSettings"},
{"sdrangel.channel.chanalyzerng", "ChannelAnalyzerSettings"}, // remap
{"org.f4exb.sdrangelove.channel.chanalyzer", "ChannelAnalyzerSettings"}, // remap
{"sdrangel.channel.chirpchatdemod", "ChirpChatDemodSettings"},
@ -160,6 +161,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelTypeToSettingsKey = {
{"ChannelAnalyzer", "ChannelAnalyzerSettings"},
{"ChirpChatDemod", "ChirpChatDemodSettings"},
{"ChirpChatMod", "ChirpChatModSettings"},
{"ChannelPower", "ChannelPowerSettings"},
{"DATVDemod", "DATVDemodSettings"},
{"DATVMod", "DATVModSettings"},
{"DABDemod", "DABDemodSettings"},