mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
Reverse API: ATV mod
This commit is contained in:
parent
35702041a0
commit
ccad513947
@ -14,9 +14,13 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug>
|
||||
#include <time.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGATVModReport.h"
|
||||
@ -100,11 +104,20 @@ ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
ATVMod::~ATVMod()
|
||||
{
|
||||
if (m_video.isOpened()) m_video.release();
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
|
||||
if (m_video.isOpened()) {
|
||||
m_video.release();
|
||||
}
|
||||
|
||||
releaseCameras();
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||
@ -1090,8 +1103,72 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
|
||||
<< " m_fmExcursion: " << settings.m_fmExcursion
|
||||
<< " m_forceDecimator: " << settings.m_forceDecimator
|
||||
<< " m_showOverlayText: " << settings.m_showOverlayText
|
||||
<< " m_overlayText: " << settings.m_overlayText
|
||||
<< " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
||||
reverseAPIKeys.append("inputFrequencyOffset");
|
||||
}
|
||||
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
|
||||
reverseAPIKeys.append("rfBandwidth");
|
||||
}
|
||||
if ((settings.m_rfOppBandwidth != m_settings.m_rfOppBandwidth) || force) {
|
||||
reverseAPIKeys.append("rfOppBandwidth");
|
||||
}
|
||||
if ((settings.m_atvStd != m_settings.m_atvStd) || force) {
|
||||
reverseAPIKeys.append("atvStd");
|
||||
}
|
||||
if ((settings.m_nbLines != m_settings.m_nbLines) || force) {
|
||||
reverseAPIKeys.append("nbLines");
|
||||
}
|
||||
if ((settings.m_fps != m_settings.m_fps) || force) {
|
||||
reverseAPIKeys.append("fps");
|
||||
}
|
||||
if ((settings.m_atvModInput != m_settings.m_atvModInput) || force) {
|
||||
reverseAPIKeys.append("atvModInput");
|
||||
}
|
||||
if ((settings.m_uniformLevel != m_settings.m_uniformLevel) || force) {
|
||||
reverseAPIKeys.append("uniformLevel");
|
||||
}
|
||||
if ((settings.m_uniformLevel != m_settings.m_uniformLevel) || force) {
|
||||
reverseAPIKeys.append("uniformLevel");
|
||||
}
|
||||
if ((settings.m_atvModulation != m_settings.m_atvModulation) || force) {
|
||||
reverseAPIKeys.append("atvModulation");
|
||||
}
|
||||
if ((settings.m_videoPlayLoop != m_settings.m_videoPlayLoop) || force) {
|
||||
reverseAPIKeys.append("videoPlayLoop");
|
||||
}
|
||||
if ((settings.m_videoPlay != m_settings.m_videoPlay) || force) {
|
||||
reverseAPIKeys.append("videoPlay");
|
||||
}
|
||||
if ((settings.m_cameraPlay != m_settings.m_cameraPlay) || force) {
|
||||
reverseAPIKeys.append("cameraPlay");
|
||||
}
|
||||
if ((settings.m_channelMute != m_settings.m_channelMute) || force) {
|
||||
reverseAPIKeys.append("channelMute");
|
||||
}
|
||||
if ((settings.m_invertedVideo != m_settings.m_invertedVideo) || force) {
|
||||
reverseAPIKeys.append("invertedVideo");
|
||||
}
|
||||
if ((settings.m_rfScalingFactor != m_settings.m_rfScalingFactor) || force) {
|
||||
reverseAPIKeys.append("rfScalingFactor");
|
||||
}
|
||||
if ((settings.m_fmExcursion != m_settings.m_fmExcursion) || force) {
|
||||
reverseAPIKeys.append("fmExcursion");
|
||||
}
|
||||
if ((settings.m_forceDecimator != m_settings.m_forceDecimator) || force) {
|
||||
reverseAPIKeys.append("forceDecimator");
|
||||
}
|
||||
if ((settings.m_showOverlayText != m_settings.m_showOverlayText) || force) {
|
||||
reverseAPIKeys.append("showOverlayText");
|
||||
}
|
||||
if ((settings.m_overlayText != m_settings.m_overlayText) || force) {
|
||||
reverseAPIKeys.append("overlayText");
|
||||
}
|
||||
|
||||
if ((settings.m_atvStd != m_settings.m_atvStd)
|
||||
|| (settings.m_nbLines != m_settings.m_nbLines)
|
||||
|| (settings.m_fps != m_settings.m_fps)
|
||||
@ -1159,6 +1236,16 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
@ -1214,7 +1301,7 @@ int ATVMod::webapiSettingsPutPatch(
|
||||
settings.m_rfBandwidth = response.getAtvModSettings()->getRfBandwidth();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfOppBandwidth")) {
|
||||
settings.m_rfOppBandwidth = response.getAtvModSettings()->getRfBandwidth();
|
||||
settings.m_rfOppBandwidth = response.getAtvModSettings()->getRfOppBandwidth();
|
||||
}
|
||||
if (channelSettingsKeys.contains("atvStd")) {
|
||||
settings.m_atvStd = (ATVModSettings::ATVStd) response.getAtvModSettings()->getAtvStd();
|
||||
@ -1270,7 +1357,21 @@ int ATVMod::webapiSettingsPutPatch(
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getAtvModSettings()->getTitle();
|
||||
}
|
||||
|
||||
if (channelSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getAtvModSettings()->getUseReverseApi() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
||||
settings.m_reverseAPIAddress = *response.getAtvModSettings()->getReverseApiAddress() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||
settings.m_reverseAPIPort = response.getAtvModSettings()->getReverseApiPort();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getAtvModSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
settings.m_reverseAPIChannelIndex = response.getAtvModSettings()->getReverseApiChannelIndex();
|
||||
}
|
||||
if (frequencyOffsetChanged)
|
||||
{
|
||||
ATVMod::MsgConfigureChannelizer *msgChan = ATVMod::MsgConfigureChannelizer::create(
|
||||
@ -1377,6 +1478,18 @@ void ATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
} else {
|
||||
response.getAtvModSettings()->setVideoFileName(new QString(m_videoFileName));
|
||||
}
|
||||
|
||||
response.getAtvModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getAtvModSettings()->getReverseApiAddress()) {
|
||||
*response.getAtvModSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
||||
} else {
|
||||
response.getAtvModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
||||
}
|
||||
|
||||
response.getAtvModSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
||||
response.getAtvModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
response.getAtvModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
||||
}
|
||||
|
||||
void ATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
@ -1384,3 +1497,114 @@ void ATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
response.getAtvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
||||
response.getAtvModReport()->setChannelSampleRate(m_outputSampleRate);
|
||||
}
|
||||
|
||||
void ATVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ATVModSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
swgChannelSettings->setTx(1);
|
||||
swgChannelSettings->setChannelType(new QString("ATVMod"));
|
||||
swgChannelSettings->setAtvModSettings(new SWGSDRangel::SWGATVModSettings());
|
||||
SWGSDRangel::SWGATVModSettings *swgATVModSettings = swgChannelSettings->getAtvModSettings();
|
||||
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
||||
swgATVModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth") || force) {
|
||||
swgATVModSettings->setRfBandwidth(settings.m_rfBandwidth);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfOppBandwidth") || force) {
|
||||
swgATVModSettings->setRfOppBandwidth(settings.m_rfOppBandwidth);
|
||||
}
|
||||
if (channelSettingsKeys.contains("atvStd") || force) {
|
||||
swgATVModSettings->setAtvStd((int) settings.m_atvStd);
|
||||
}
|
||||
if (channelSettingsKeys.contains("nbLines") || force) {
|
||||
swgATVModSettings->setNbLines(settings.m_nbLines);
|
||||
}
|
||||
if (channelSettingsKeys.contains("fps") || force) {
|
||||
swgATVModSettings->setFps(settings.m_fps);
|
||||
}
|
||||
if (channelSettingsKeys.contains("atvModInput") || force) {
|
||||
swgATVModSettings->setAtvModInput((int) settings.m_atvModInput);
|
||||
}
|
||||
if (channelSettingsKeys.contains("uniformLevel") || force) {
|
||||
swgATVModSettings->setUniformLevel(settings.m_uniformLevel);
|
||||
}
|
||||
if (channelSettingsKeys.contains("atvModulation") || force) {
|
||||
swgATVModSettings->setAtvModulation((int) settings.m_atvModulation);
|
||||
}
|
||||
if (channelSettingsKeys.contains("videoPlayLoop") || force) {
|
||||
swgATVModSettings->setVideoPlayLoop(settings.m_videoPlayLoop ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("videoPlay") || force) {
|
||||
swgATVModSettings->setVideoPlay(settings.m_videoPlay ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("cameraPlay") || force) {
|
||||
swgATVModSettings->setCameraPlay(settings.m_cameraPlay ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("channelMute") || force) {
|
||||
swgATVModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("invertedVideo") || force) {
|
||||
swgATVModSettings->setInvertedVideo(settings.m_invertedVideo ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfScalingFactor") || force) {
|
||||
swgATVModSettings->setRfScalingFactor(settings.m_rfScalingFactor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("fmExcursion") || force) {
|
||||
swgATVModSettings->setFmExcursion(settings.m_fmExcursion);
|
||||
}
|
||||
if (channelSettingsKeys.contains("forceDecimator") || force) {
|
||||
swgATVModSettings->setForceDecimator(settings.m_forceDecimator ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("showOverlayText") || force) {
|
||||
swgATVModSettings->setShowOverlayText(settings.m_showOverlayText ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("overlayText") || force) {
|
||||
swgATVModSettings->setOverlayText(new QString(settings.m_overlayText));
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor") || force) {
|
||||
swgATVModSettings->setRgbColor(settings.m_rgbColor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("title") || force) {
|
||||
swgATVModSettings->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
||||
.arg(settings.m_reverseAPIAddress)
|
||||
.arg(settings.m_reverseAPIPort)
|
||||
.arg(settings.m_reverseAPIDeviceIndex)
|
||||
.arg(settings.m_reverseAPIChannelIndex);
|
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
QBuffer *buffer=new QBuffer();
|
||||
buffer->open((QBuffer::ReadWrite));
|
||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||
buffer->seek(0);
|
||||
|
||||
// Always use PATCH to avoid passing reverse API settings
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
||||
|
||||
delete swgChannelSettings;
|
||||
}
|
||||
|
||||
void ATVMod::networkManagerFinished(QNetworkReply *reply)
|
||||
{
|
||||
QNetworkReply::NetworkError replyError = reply->error();
|
||||
|
||||
if (replyError)
|
||||
{
|
||||
qWarning() << "ATVMod::networkManagerFinished:"
|
||||
<< " error(" << (int) replyError
|
||||
<< "): " << replyError
|
||||
<< ": " << reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
QString answer = reply->readAll();
|
||||
answer.chop(1); // remove last \n
|
||||
qDebug("ATVMod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
||||
}
|
||||
|
@ -17,10 +17,11 @@
|
||||
#ifndef PLUGINS_CHANNELTX_MODATV_ATVMOD_H_
|
||||
#define PLUGINS_CHANNELTX_MODATV_ATVMOD_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
|
||||
#include <vector>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
@ -37,6 +38,8 @@
|
||||
|
||||
#include "atvmodsettings.h"
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class DeviceSinkAPI;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class UpChannelizer;
|
||||
@ -400,6 +403,9 @@ signals:
|
||||
*/
|
||||
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
|
||||
|
||||
private slots:
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
struct ATVCamera
|
||||
{
|
||||
@ -524,8 +530,10 @@ private:
|
||||
Complex* m_DSBFilterBuffer;
|
||||
int m_DSBFilterBufferIndex;
|
||||
|
||||
static const int m_ssbFftLen;
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
static const int m_ssbFftLen;
|
||||
static const float m_blackLevel;
|
||||
static const float m_spanLevel;
|
||||
static const int m_levelNbSamples;
|
||||
@ -556,6 +564,7 @@ private:
|
||||
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const ATVModSettings& settings);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ATVModSettings& settings, bool force);
|
||||
|
||||
inline void pullImageLine(Real& sample, bool noHSync = false)
|
||||
{
|
||||
|
@ -207,8 +207,8 @@ void ATVModGUI::setRFFiltersSlidersRange(int sampleRate)
|
||||
ui->rfOppBW->setMaximum((sampleRate) / m_rfSliderDivisor);
|
||||
}
|
||||
|
||||
ui->rfBWText->setText(QString("%1k").arg((ui->rfBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((ui->rfOppBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
ui->rfBWText->setText(QString("%1k").arg((ui->rfBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((ui->rfOppBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
}
|
||||
|
||||
int ATVModGUI::getNbLines()
|
||||
@ -372,6 +372,7 @@ void ATVModGUI::handleSourceMessages()
|
||||
void ATVModGUI::on_deltaFrequency_changed(qint64 value)
|
||||
{
|
||||
m_channelMarker.setCenterFrequency(value);
|
||||
m_settings.m_inputFrequencyOffset = value;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -399,7 +400,7 @@ void ATVModGUI::on_fmExcursion_valueChanged(int value)
|
||||
|
||||
void ATVModGUI::on_rfBW_valueChanged(int value)
|
||||
{
|
||||
ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
ui->rfBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
m_settings.m_rfBandwidth = value * m_rfSliderDivisor * 1.0f;
|
||||
setChannelMarkerBandwidth();
|
||||
applySettings();
|
||||
@ -407,7 +408,7 @@ void ATVModGUI::on_rfBW_valueChanged(int value)
|
||||
|
||||
void ATVModGUI::on_rfOppBW_valueChanged(int value)
|
||||
{
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((value*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
m_settings.m_rfOppBandwidth = value * m_rfSliderDivisor * 1.0f;
|
||||
setChannelMarkerBandwidth();
|
||||
applySettings();
|
||||
@ -614,12 +615,23 @@ void ATVModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
void ATVModGUI::onMenuDialogCalled(const QPoint &p)
|
||||
{
|
||||
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
|
||||
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
|
||||
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
|
||||
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
|
||||
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
|
||||
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
|
||||
|
||||
dialog.move(p);
|
||||
dialog.exec();
|
||||
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
||||
m_settings.m_title = m_channelMarker.getTitle();
|
||||
m_settings.m_useReverseAPI = dialog.useReverseAPI();
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
|
||||
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
@ -737,11 +749,10 @@ void ATVModGUI::displaySettings()
|
||||
setRFFiltersSlidersRange(m_atvMod->getEffectiveSampleRate());
|
||||
|
||||
ui->rfBW->setValue(roundf(m_settings.m_rfBandwidth / m_rfSliderDivisor));
|
||||
ui->rfBWText->setText(QString("%1k").arg((ui->rfBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
ui->rfBWText->setText(QString("%1k").arg((ui->rfBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
|
||||
ui->rfOppBW->setValue(roundf(m_settings.m_rfOppBandwidth / m_rfSliderDivisor));
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((ui->rfOppBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
||||
|
||||
ui->rfOppBWText->setText(QString("%1k").arg((ui->rfOppBW->value()*m_rfSliderDivisor) / 1000.0, 0, 'f', 1));
|
||||
|
||||
ui->forceDecimator->setChecked(m_settings.m_forceDecimator);
|
||||
ui->channelMute->setChecked(m_settings.m_channelMute);
|
||||
|
@ -50,6 +50,11 @@ void ATVModSettings::resetToDefaults()
|
||||
m_overlayText = "ATV";
|
||||
m_rgbColor = QColor(255, 255, 255).rgb();
|
||||
m_title = "ATV Modulator";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
m_reverseAPIDeviceIndex = 0;
|
||||
m_reverseAPIChannelIndex = 0;
|
||||
}
|
||||
|
||||
QByteArray ATVModSettings::serialize() const
|
||||
@ -76,6 +81,11 @@ QByteArray ATVModSettings::serialize() const
|
||||
}
|
||||
|
||||
s.writeString(16, m_title);
|
||||
s.writeBool(17, m_useReverseAPI);
|
||||
s.writeString(18, m_reverseAPIAddress);
|
||||
s.writeU32(19, m_reverseAPIPort);
|
||||
s.writeU32(20, m_reverseAPIDeviceIndex);
|
||||
s.writeU32(21, m_reverseAPIChannelIndex);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -94,6 +104,7 @@ bool ATVModSettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
qint32 tmp;
|
||||
uint32_t utmp;
|
||||
|
||||
d.readS32(1, &tmp, 0);
|
||||
m_inputFrequencyOffset = tmp;
|
||||
@ -124,7 +135,20 @@ bool ATVModSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
|
||||
d.readString(16, &m_title, "ATV Modulator");
|
||||
d.readBool(17, &m_useReverseAPI, false);
|
||||
d.readString(18, &m_reverseAPIAddress, "127.0.0.1");
|
||||
d.readU32(19, &utmp, 0);
|
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) {
|
||||
m_reverseAPIPort = utmp;
|
||||
} else {
|
||||
m_reverseAPIPort = 8888;
|
||||
}
|
||||
|
||||
d.readU32(20, &utmp, 0);
|
||||
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readU32(21, &utmp, 0);
|
||||
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -79,6 +79,11 @@ struct ATVModSettings
|
||||
QString m_overlayText;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
uint16_t m_reverseAPIChannelIndex;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
|
||||
|
@ -948,6 +948,22 @@ margin-bottom: 20px;
|
||||
},
|
||||
"videoFileName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"useReverseAPI" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
|
||||
},
|
||||
"reverseAPIAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"reverseAPIPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIDeviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIChannelIndex" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "ATVMod"
|
||||
@ -23765,7 +23781,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-12-20T23:13:50.969+01:00
|
||||
Generated 2018-12-21T01:11:45.184+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,6 +53,17 @@ ATVModSettings:
|
||||
type: string
|
||||
videoFileName:
|
||||
type: string
|
||||
useReverseAPI:
|
||||
description: Synchronize with reverse API (1 for yes, 0 for no)
|
||||
type: integer
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIDeviceIndex:
|
||||
type: integer
|
||||
reverseAPIChannelIndex:
|
||||
type: integer
|
||||
|
||||
ATVModReport:
|
||||
description: ATVMod
|
||||
|
@ -53,6 +53,17 @@ ATVModSettings:
|
||||
type: string
|
||||
videoFileName:
|
||||
type: string
|
||||
useReverseAPI:
|
||||
description: Synchronize with reverse API (1 for yes, 0 for no)
|
||||
type: integer
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIDeviceIndex:
|
||||
type: integer
|
||||
reverseAPIChannelIndex:
|
||||
type: integer
|
||||
|
||||
ATVModReport:
|
||||
description: ATVMod
|
||||
|
@ -948,6 +948,22 @@ margin-bottom: 20px;
|
||||
},
|
||||
"videoFileName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"useReverseAPI" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
|
||||
},
|
||||
"reverseAPIAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"reverseAPIPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIDeviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIChannelIndex" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "ATVMod"
|
||||
@ -23765,7 +23781,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-12-20T23:13:50.969+01:00
|
||||
Generated 2018-12-21T01:11:45.184+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -74,6 +74,16 @@ SWGATVModSettings::SWGATVModSettings() {
|
||||
m_image_file_name_isSet = false;
|
||||
video_file_name = nullptr;
|
||||
m_video_file_name_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
m_use_reverse_api_isSet = false;
|
||||
reverse_api_address = nullptr;
|
||||
m_reverse_api_address_isSet = false;
|
||||
reverse_api_port = 0;
|
||||
m_reverse_api_port_isSet = false;
|
||||
reverse_api_device_index = 0;
|
||||
m_reverse_api_device_index_isSet = false;
|
||||
reverse_api_channel_index = 0;
|
||||
m_reverse_api_channel_index_isSet = false;
|
||||
}
|
||||
|
||||
SWGATVModSettings::~SWGATVModSettings() {
|
||||
@ -128,6 +138,16 @@ SWGATVModSettings::init() {
|
||||
m_image_file_name_isSet = false;
|
||||
video_file_name = new QString("");
|
||||
m_video_file_name_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
m_use_reverse_api_isSet = false;
|
||||
reverse_api_address = new QString("");
|
||||
m_reverse_api_address_isSet = false;
|
||||
reverse_api_port = 0;
|
||||
m_reverse_api_port_isSet = false;
|
||||
reverse_api_device_index = 0;
|
||||
m_reverse_api_device_index_isSet = false;
|
||||
reverse_api_channel_index = 0;
|
||||
m_reverse_api_channel_index_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -163,6 +183,13 @@ SWGATVModSettings::cleanup() {
|
||||
if(video_file_name != nullptr) {
|
||||
delete video_file_name;
|
||||
}
|
||||
|
||||
if(reverse_api_address != nullptr) {
|
||||
delete reverse_api_address;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGATVModSettings*
|
||||
@ -222,6 +249,16 @@ SWGATVModSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&video_file_name, pJson["videoFileName"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -307,6 +344,21 @@ SWGATVModSettings::asJsonObject() {
|
||||
if(video_file_name != nullptr && *video_file_name != QString("")){
|
||||
toJsonValue(QString("videoFileName"), video_file_name, obj, QString("QString"));
|
||||
}
|
||||
if(m_use_reverse_api_isSet){
|
||||
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
|
||||
}
|
||||
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
|
||||
toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
|
||||
}
|
||||
if(m_reverse_api_port_isSet){
|
||||
obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
|
||||
}
|
||||
if(m_reverse_api_device_index_isSet){
|
||||
obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
|
||||
}
|
||||
if(m_reverse_api_channel_index_isSet){
|
||||
obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -541,6 +593,56 @@ SWGATVModSettings::setVideoFileName(QString* video_file_name) {
|
||||
this->m_video_file_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGATVModSettings::getUseReverseApi() {
|
||||
return use_reverse_api;
|
||||
}
|
||||
void
|
||||
SWGATVModSettings::setUseReverseApi(qint32 use_reverse_api) {
|
||||
this->use_reverse_api = use_reverse_api;
|
||||
this->m_use_reverse_api_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGATVModSettings::getReverseApiAddress() {
|
||||
return reverse_api_address;
|
||||
}
|
||||
void
|
||||
SWGATVModSettings::setReverseApiAddress(QString* reverse_api_address) {
|
||||
this->reverse_api_address = reverse_api_address;
|
||||
this->m_reverse_api_address_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGATVModSettings::getReverseApiPort() {
|
||||
return reverse_api_port;
|
||||
}
|
||||
void
|
||||
SWGATVModSettings::setReverseApiPort(qint32 reverse_api_port) {
|
||||
this->reverse_api_port = reverse_api_port;
|
||||
this->m_reverse_api_port_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGATVModSettings::getReverseApiDeviceIndex() {
|
||||
return reverse_api_device_index;
|
||||
}
|
||||
void
|
||||
SWGATVModSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
|
||||
this->reverse_api_device_index = reverse_api_device_index;
|
||||
this->m_reverse_api_device_index_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGATVModSettings::getReverseApiChannelIndex() {
|
||||
return reverse_api_channel_index;
|
||||
}
|
||||
void
|
||||
SWGATVModSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) {
|
||||
this->reverse_api_channel_index = reverse_api_channel_index;
|
||||
this->m_reverse_api_channel_index_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGATVModSettings::isSet(){
|
||||
@ -569,6 +671,11 @@ SWGATVModSettings::isSet(){
|
||||
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
|
||||
if(image_file_name != nullptr && *image_file_name != QString("")){ isObjectUpdated = true; break;}
|
||||
if(video_file_name != nullptr && *video_file_name != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
|
||||
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -111,6 +111,21 @@ public:
|
||||
QString* getVideoFileName();
|
||||
void setVideoFileName(QString* video_file_name);
|
||||
|
||||
qint32 getUseReverseApi();
|
||||
void setUseReverseApi(qint32 use_reverse_api);
|
||||
|
||||
QString* getReverseApiAddress();
|
||||
void setReverseApiAddress(QString* reverse_api_address);
|
||||
|
||||
qint32 getReverseApiPort();
|
||||
void setReverseApiPort(qint32 reverse_api_port);
|
||||
|
||||
qint32 getReverseApiDeviceIndex();
|
||||
void setReverseApiDeviceIndex(qint32 reverse_api_device_index);
|
||||
|
||||
qint32 getReverseApiChannelIndex();
|
||||
void setReverseApiChannelIndex(qint32 reverse_api_channel_index);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -184,6 +199,21 @@ private:
|
||||
QString* video_file_name;
|
||||
bool m_video_file_name_isSet;
|
||||
|
||||
qint32 use_reverse_api;
|
||||
bool m_use_reverse_api_isSet;
|
||||
|
||||
QString* reverse_api_address;
|
||||
bool m_reverse_api_address_isSet;
|
||||
|
||||
qint32 reverse_api_port;
|
||||
bool m_reverse_api_port_isSet;
|
||||
|
||||
qint32 reverse_api_device_index;
|
||||
bool m_reverse_api_device_index_isSet;
|
||||
|
||||
qint32 reverse_api_channel_index;
|
||||
bool m_reverse_api_channel_index_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user