2017-03-05 21:39:34 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2019-11-14 19:04:24 -05:00
|
|
|
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
2017-03-05 21:39:34 -05:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
2019-04-11 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2017-03-05 21:39:34 -05:00
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <complex.h>
|
2017-03-05 21:39:34 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
#include <QTime>
|
2018-12-20 19:15:15 -05:00
|
|
|
#include <QDebug>
|
2019-11-14 19:04:24 -05:00
|
|
|
#include <QMutexLocker>
|
2018-12-20 19:15:15 -05:00
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QBuffer>
|
2019-11-14 19:04:24 -05:00
|
|
|
#include <QThread>
|
2018-12-20 19:15:15 -05:00
|
|
|
|
2018-04-14 18:52:39 -04:00
|
|
|
#include "SWGChannelSettings.h"
|
|
|
|
#include "SWGChannelReport.h"
|
|
|
|
#include "SWGATVModReport.h"
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
#include "dsp/dspengine.h"
|
2018-02-14 14:11:36 -05:00
|
|
|
#include "dsp/dspcommands.h"
|
2019-11-14 19:04:24 -05:00
|
|
|
#include "dsp/devicesamplemimo.h"
|
2019-05-08 16:11:53 -04:00
|
|
|
#include "device/deviceapi.h"
|
2020-10-22 18:11:18 -04:00
|
|
|
#include "feature/feature.h"
|
2018-04-14 18:52:39 -04:00
|
|
|
#include "util/db.h"
|
2020-10-22 18:11:18 -04:00
|
|
|
#include "maincore.h"
|
2017-10-21 19:49:27 -04:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
#include "atvmodbaseband.h"
|
2017-03-05 21:39:34 -05:00
|
|
|
#include "atvmod.h"
|
|
|
|
|
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureATVMod, Message)
|
2017-10-21 19:13:04 -04:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureChannelizer, Message)
|
2019-11-14 19:04:24 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureSourceCenterFrequency, Message)
|
2017-03-07 19:35:18 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureImageFileName, Message)
|
2017-03-08 20:09:31 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureVideoFileName, Message)
|
2017-03-09 17:17:14 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureVideoFileSourceSeek, Message)
|
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureVideoFileSourceStreamTiming, Message)
|
2017-03-10 13:06:51 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraIndex, Message)
|
2017-03-24 14:06:29 -04:00
|
|
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureCameraData, Message)
|
2017-03-05 21:39:34 -05:00
|
|
|
|
2020-11-21 14:24:18 -05:00
|
|
|
const char* const ATVMod::m_channelIdURI = "sdrangel.channeltx.modatv";
|
|
|
|
const char* const ATVMod::m_channelId = "ATVMod";
|
2017-03-05 21:39:34 -05:00
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
ATVMod::ATVMod(DeviceAPI *deviceAPI) :
|
2019-05-09 11:27:12 -04:00
|
|
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
|
2019-11-14 19:04:24 -05:00
|
|
|
m_deviceAPI(deviceAPI)
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
setObjectName(m_channelId);
|
2017-03-15 21:45:51 -04:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
m_thread = new QThread(this);
|
|
|
|
m_basebandSource = new ATVModBaseband();
|
|
|
|
m_basebandSource->moveToThread(m_thread);
|
2017-03-05 21:39:34 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
applySettings(m_settings, true);
|
2018-03-16 05:26:49 -04:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
m_deviceAPI->addChannelSource(this);
|
2019-05-08 16:11:53 -04:00
|
|
|
m_deviceAPI->addChannelSourceAPI(this);
|
2018-12-20 19:15:15 -05:00
|
|
|
|
|
|
|
m_networkManager = new QNetworkAccessManager();
|
|
|
|
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
ATVMod::~ATVMod()
|
|
|
|
{
|
2018-12-20 19:15:15 -05:00
|
|
|
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
|
|
|
delete m_networkManager;
|
2019-11-14 19:04:24 -05:00
|
|
|
m_deviceAPI->removeChannelSourceAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSource(this);
|
|
|
|
delete m_basebandSource;
|
|
|
|
delete m_thread;
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
uint32_t ATVMod::getNumberOfDeviceStreams() const
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
return m_deviceAPI->getNbSinkStreams();
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
void ATVMod::start()
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
qDebug("ATVMod::start");
|
|
|
|
m_basebandSource->reset();
|
|
|
|
m_thread->start();
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
void ATVMod::stop()
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
qDebug("ATVMod::stop");
|
|
|
|
m_thread->exit();
|
|
|
|
m_thread->wait();
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
void ATVMod::pull(SampleVector::iterator& begin, unsigned int nbSamples)
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
m_basebandSource->pull(begin, nbSamples);
|
2017-03-05 21:39:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ATVMod::handleMessage(const Message& cmd)
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
if (MsgConfigureChannelizer::match(cmd))
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
|
|
|
qDebug() << "ATVMod::handleMessage: MsgConfigureChannelizer:"
|
|
|
|
<< " getSourceSampleRate: " << cfg.getSourceSampleRate()
|
|
|
|
<< " getSourceCenterFrequency: " << cfg.getSourceCenterFrequency();
|
2017-12-29 05:42:33 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureChannelizer *msg
|
|
|
|
= ATVModBaseband::MsgConfigureChannelizer::create(cfg.getSourceSampleRate(), cfg.getSourceCenterFrequency());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
2017-03-05 21:39:34 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-11-14 19:04:24 -05:00
|
|
|
else if (MsgConfigureSourceCenterFrequency::match(cmd))
|
2017-10-21 19:49:27 -04:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureSourceCenterFrequency& cfg = (MsgConfigureSourceCenterFrequency&) cmd;
|
|
|
|
qDebug() << "ATVMod::handleMessage: MsgConfigureSourceCenterFrequency:"
|
|
|
|
<< " getSourceCenterFrequency: " << cfg.getSourceCenterFrequency();
|
2017-10-21 19:49:27 -04:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureChannelizer *msg
|
|
|
|
= ATVModBaseband::MsgConfigureChannelizer::create(m_basebandSource->getChannelSampleRate(), cfg.getSourceCenterFrequency());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
2017-10-21 19:49:27 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-21 19:36:18 -04:00
|
|
|
else if (MsgConfigureATVMod::match(cmd))
|
2017-03-05 21:39:34 -05:00
|
|
|
{
|
2017-10-21 19:36:18 -04:00
|
|
|
MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
|
2017-12-29 05:42:33 -05:00
|
|
|
qDebug() << "ATVMod::handleMessage: MsgConfigureATVMod";
|
2017-10-21 19:36:18 -04:00
|
|
|
|
2017-12-29 05:42:33 -05:00
|
|
|
applySettings(cfg.getSettings(), cfg.getForce());
|
2017-03-05 21:39:34 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-11-14 19:04:24 -05:00
|
|
|
else if (DSPSignalNotification::match(cmd))
|
|
|
|
{
|
|
|
|
// Forward to the source
|
|
|
|
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
|
|
|
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
|
|
|
qDebug() << "ATVMod::handleMessage: DSPSignalNotification";
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2017-03-07 19:35:18 -05:00
|
|
|
else if (MsgConfigureImageFileName::match(cmd))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureImageFileName& cfg = (MsgConfigureImageFileName&) cmd;
|
|
|
|
ATVModBaseband::MsgConfigureImageFileName *msg = ATVModBaseband::MsgConfigureImageFileName::create(
|
|
|
|
cfg.getFileName());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
|
|
|
|
2017-03-08 20:09:31 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (MsgConfigureVideoFileName::match(cmd))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureVideoFileName& cfg = (MsgConfigureVideoFileName&) cmd;
|
|
|
|
ATVModBaseband::MsgConfigureVideoFileName *msg = ATVModBaseband::MsgConfigureVideoFileName::create(
|
|
|
|
cfg.getFileName());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
|
|
|
|
2017-03-07 19:35:18 -05:00
|
|
|
return true;
|
|
|
|
}
|
2017-03-09 17:17:14 -05:00
|
|
|
else if (MsgConfigureVideoFileSourceSeek::match(cmd))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureVideoFileSourceSeek& cfg = (MsgConfigureVideoFileSourceSeek&) cmd;
|
|
|
|
ATVModBaseband::MsgConfigureVideoFileSourceSeek *rep = ATVModBaseband::MsgConfigureVideoFileSourceSeek::create(cfg.getPercentage());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
|
|
|
|
2017-03-09 17:17:14 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (MsgConfigureVideoFileSourceStreamTiming::match(cmd))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureVideoFileSourceStreamTiming *rep = ATVModBaseband::MsgConfigureVideoFileSourceStreamTiming::create();
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
2017-03-09 17:17:14 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2017-03-10 13:06:51 -05:00
|
|
|
else if (MsgConfigureCameraIndex::match(cmd))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureCameraIndex& cfg = (MsgConfigureCameraIndex&) cmd;
|
|
|
|
ATVModBaseband::MsgConfigureCameraIndex *rep = ATVModBaseband::MsgConfigureCameraIndex::create(cfg.getIndex());
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
2017-03-24 14:06:29 -04:00
|
|
|
|
2018-02-14 14:11:36 -05:00
|
|
|
return true;
|
|
|
|
}
|
2019-11-14 19:04:24 -05:00
|
|
|
else if (MsgConfigureCameraData::match(cmd))
|
2017-03-08 19:00:46 -05:00
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
MsgConfigureCameraData& cfg = (MsgConfigureCameraData&) cmd;
|
|
|
|
ATVModBaseband::MsgConfigureCameraData *rep = ATVModBaseband::MsgConfigureCameraData::create(
|
|
|
|
cfg.getIndex(), cfg.getManualFPS(), cfg.getManualFPSEnable()
|
|
|
|
);
|
2020-11-14 12:45:05 -05:00
|
|
|
m_basebandSource->getInputMessageQueue()->push(rep);
|
2017-03-09 13:07:45 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
return true;
|
2017-03-09 13:07:45 -05:00
|
|
|
}
|
2018-04-14 20:22:54 -04:00
|
|
|
else
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
return false;
|
2018-04-14 20:22:54 -04:00
|
|
|
}
|
2017-03-08 13:04:10 -05:00
|
|
|
}
|
2017-03-08 19:00:46 -05:00
|
|
|
|
2017-10-21 19:13:04 -04:00
|
|
|
void ATVMod::applySettings(const ATVModSettings& settings, bool force)
|
|
|
|
{
|
2017-12-29 05:42:33 -05:00
|
|
|
qDebug() << "ATVMod::applySettings:"
|
|
|
|
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
|
|
|
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
|
|
|
<< " m_rfOppBandwidth: " << settings.m_rfOppBandwidth
|
|
|
|
<< " m_atvStd: " << (int) settings.m_atvStd
|
|
|
|
<< " m_nbLines: " << settings.m_nbLines
|
|
|
|
<< " m_fps: " << settings.m_fps
|
|
|
|
<< " m_atvModInput: " << (int) settings.m_atvModInput
|
|
|
|
<< " m_uniformLevel: " << settings.m_uniformLevel
|
|
|
|
<< " m_atvModulation: " << (int) settings.m_atvModulation
|
|
|
|
<< " m_videoPlayLoop: " << settings.m_videoPlayLoop
|
|
|
|
<< " m_videoPlay: " << settings.m_videoPlay
|
|
|
|
<< " m_cameraPlay: " << settings.m_cameraPlay
|
|
|
|
<< " m_channelMute: " << settings.m_channelMute
|
|
|
|
<< " m_invertedVideo: " << settings.m_invertedVideo
|
|
|
|
<< " m_rfScalingFactor: " << settings.m_rfScalingFactor
|
|
|
|
<< " m_fmExcursion: " << settings.m_fmExcursion
|
|
|
|
<< " m_forceDecimator: " << settings.m_forceDecimator
|
2018-04-14 19:34:46 -04:00
|
|
|
<< " m_showOverlayText: " << settings.m_showOverlayText
|
2018-12-20 19:15:15 -05:00
|
|
|
<< " m_overlayText: " << settings.m_overlayText
|
2017-12-29 05:42:33 -05:00
|
|
|
<< " force: " << force;
|
|
|
|
|
2018-12-20 19:15:15 -05:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2019-11-18 19:22:55 -05:00
|
|
|
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
|
|
|
{
|
|
|
|
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
|
|
|
{
|
2019-12-23 17:41:35 -05:00
|
|
|
m_deviceAPI->removeChannelSourceAPI(this);
|
2019-11-18 19:22:55 -05:00
|
|
|
m_deviceAPI->removeChannelSource(this, m_settings.m_streamIndex);
|
|
|
|
m_deviceAPI->addChannelSource(this, settings.m_streamIndex);
|
2019-12-23 17:41:35 -05:00
|
|
|
m_deviceAPI->addChannelSourceAPI(this);
|
2019-11-18 19:22:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
reverseAPIKeys.append("streamIndex");
|
|
|
|
}
|
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureATVModBaseband *msg = ATVModBaseband::MsgConfigureATVModBaseband::create(settings, force);
|
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
2018-04-14 19:34:46 -04:00
|
|
|
|
2018-12-20 19:15:15 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-12-13 07:04:36 -05:00
|
|
|
QList<MessageQueue*> *messageQueues = MainCore::instance()->getMessagePipes().getMessageQueues(this, "settings");
|
|
|
|
|
|
|
|
if (messageQueues) {
|
|
|
|
sendChannelSettings(messageQueues, reverseAPIKeys, settings, force);
|
2020-10-22 18:11:18 -04:00
|
|
|
}
|
|
|
|
|
2017-10-21 19:13:04 -04:00
|
|
|
m_settings = settings;
|
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
|
|
|
QByteArray ATVMod::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ATVMod::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
if (m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
MsgConfigureATVMod *msg = MsgConfigureATVMod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
MsgConfigureATVMod *msg = MsgConfigureATVMod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2018-04-14 18:52:39 -04:00
|
|
|
|
|
|
|
int ATVMod::webapiSettingsGet(
|
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-04-14 18:52:39 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-04-14 18:52:39 -04:00
|
|
|
response.setAtvModSettings(new SWGSDRangel::SWGATVModSettings());
|
|
|
|
response.getAtvModSettings()->init();
|
|
|
|
webapiFormatChannelSettings(response, m_settings);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ATVMod::webapiSettingsPutPatch(
|
|
|
|
bool force,
|
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-04-14 18:52:39 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-08-08 03:17:25 -04:00
|
|
|
ATVModSettings settings = m_settings;
|
2019-08-12 07:21:00 -04:00
|
|
|
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
2018-04-14 18:52:39 -04:00
|
|
|
|
2019-08-12 07:21:00 -04:00
|
|
|
if (m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset)
|
2018-04-14 18:52:39 -04:00
|
|
|
{
|
2019-08-12 07:21:00 -04:00
|
|
|
ATVMod::MsgConfigureChannelizer *msgChan = ATVMod::MsgConfigureChannelizer::create(
|
2019-11-14 19:04:24 -05:00
|
|
|
m_basebandSource->getChannelSampleRate(), settings.m_inputFrequencyOffset);
|
2019-08-12 07:21:00 -04:00
|
|
|
m_inputMessageQueue.push(msgChan);
|
|
|
|
}
|
|
|
|
|
|
|
|
MsgConfigureATVMod *msg = MsgConfigureATVMod::create(settings, force);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureATVMod *msgToGUI = MsgConfigureATVMod::create(settings, force);
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channelSettingsKeys.contains("imageFileName"))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureImageFileName *msg = ATVModBaseband::MsgConfigureImageFileName::create(
|
2019-08-12 07:21:00 -04:00
|
|
|
*response.getAtvModSettings()->getImageFileName());
|
2019-11-14 19:04:24 -05:00
|
|
|
m_basebandSource->getInputMessageQueue()->push(msg);
|
2019-08-12 07:21:00 -04:00
|
|
|
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureImageFileName *msgToGUI = MsgConfigureImageFileName::create(
|
|
|
|
*response.getAtvModSettings()->getImageFileName());
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channelSettingsKeys.contains("videoFileName"))
|
|
|
|
{
|
2019-11-14 19:04:24 -05:00
|
|
|
ATVModBaseband::MsgConfigureVideoFileName *msg = ATVModBaseband::MsgConfigureVideoFileName::create(
|
2019-08-12 07:21:00 -04:00
|
|
|
*response.getAtvModSettings()->getVideoFileName());
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureVideoFileName *msgToGUI = MsgConfigureVideoFileName::create(
|
|
|
|
*response.getAtvModSettings()->getVideoFileName());
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
webapiFormatChannelSettings(response, settings);
|
|
|
|
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::webapiUpdateChannelSettings(
|
|
|
|
ATVModSettings& settings,
|
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response)
|
|
|
|
{
|
|
|
|
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
2018-04-14 18:52:39 -04:00
|
|
|
settings.m_inputFrequencyOffset = response.getAtvModSettings()->getInputFrequencyOffset();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rfBandwidth")) {
|
|
|
|
settings.m_rfBandwidth = response.getAtvModSettings()->getRfBandwidth();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rfOppBandwidth")) {
|
2018-12-20 19:15:15 -05:00
|
|
|
settings.m_rfOppBandwidth = response.getAtvModSettings()->getRfOppBandwidth();
|
2018-04-14 18:52:39 -04:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("atvStd")) {
|
|
|
|
settings.m_atvStd = (ATVModSettings::ATVStd) response.getAtvModSettings()->getAtvStd();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("nbLines")) {
|
|
|
|
settings.m_nbLines = response.getAtvModSettings()->getNbLines();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("fps")) {
|
|
|
|
settings.m_fps = response.getAtvModSettings()->getFps();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("atvModInput")) {
|
|
|
|
settings.m_atvModInput = (ATVModSettings::ATVModInput) response.getAtvModSettings()->getAtvModInput();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("uniformLevel")) {
|
|
|
|
settings.m_uniformLevel = response.getAtvModSettings()->getUniformLevel();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("atvModulation")) {
|
|
|
|
settings.m_atvModulation = (ATVModSettings::ATVModulation) response.getAtvModSettings()->getAtvModulation();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("videoPlayLoop")) {
|
|
|
|
settings.m_videoPlayLoop = response.getAtvModSettings()->getVideoPlayLoop() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("videoPlay")) {
|
|
|
|
settings.m_videoPlay = response.getAtvModSettings()->getVideoPlay() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("cameraPlay")) {
|
|
|
|
settings.m_cameraPlay = response.getAtvModSettings()->getCameraPlay() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("channelMute")) {
|
|
|
|
settings.m_channelMute = response.getAtvModSettings()->getChannelMute() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("invertedVideo")) {
|
|
|
|
settings.m_invertedVideo = response.getAtvModSettings()->getInvertedVideo() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rfScalingFactor")) {
|
|
|
|
settings.m_rfScalingFactor = response.getAtvModSettings()->getRfScalingFactor();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("fmExcursion")) {
|
|
|
|
settings.m_fmExcursion = response.getAtvModSettings()->getFmExcursion();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("forceDecimator")) {
|
|
|
|
settings.m_forceDecimator = response.getAtvModSettings()->getForceDecimator() != 0;
|
|
|
|
}
|
2018-04-14 20:22:54 -04:00
|
|
|
if (channelSettingsKeys.contains("showOverlayText")) {
|
|
|
|
settings.m_showOverlayText = response.getAtvModSettings()->getShowOverlayText() != 0;
|
|
|
|
}
|
2018-04-14 18:52:39 -04:00
|
|
|
if (channelSettingsKeys.contains("overlayText")) {
|
|
|
|
settings.m_overlayText = *response.getAtvModSettings()->getOverlayText();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rgbColor")) {
|
|
|
|
settings.m_rgbColor = response.getAtvModSettings()->getRgbColor();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("title")) {
|
|
|
|
settings.m_title = *response.getAtvModSettings()->getTitle();
|
|
|
|
}
|
2019-11-17 05:09:07 -05:00
|
|
|
if (channelSettingsKeys.contains("streamIndex")) {
|
|
|
|
settings.m_streamIndex = response.getAtvModSettings()->getStreamIndex();
|
|
|
|
}
|
2018-12-20 19:15:15 -05:00
|
|
|
if (channelSettingsKeys.contains("useReverseAPI")) {
|
|
|
|
settings.m_useReverseAPI = response.getAtvModSettings()->getUseReverseApi() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
2019-04-20 13:53:16 -04:00
|
|
|
settings.m_reverseAPIAddress = *response.getAtvModSettings()->getReverseApiAddress();
|
2018-12-20 19:15:15 -05:00
|
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
2018-04-14 18:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int ATVMod::webapiReportGet(
|
|
|
|
SWGSDRangel::SWGChannelReport& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-04-14 18:52:39 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-04-14 18:52:39 -04:00
|
|
|
response.setAtvModReport(new SWGSDRangel::SWGATVModReport());
|
|
|
|
response.getAtvModReport()->init();
|
|
|
|
webapiFormatChannelReport(response);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const ATVModSettings& settings)
|
|
|
|
{
|
|
|
|
response.getAtvModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
|
|
|
response.getAtvModSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
|
|
|
response.getAtvModSettings()->setRfOppBandwidth(settings.m_rfOppBandwidth);
|
|
|
|
response.getAtvModSettings()->setAtvStd(settings.m_atvStd);
|
|
|
|
response.getAtvModSettings()->setNbLines(settings.m_nbLines);
|
|
|
|
response.getAtvModSettings()->setFps(settings.m_fps);
|
|
|
|
response.getAtvModSettings()->setAtvModInput(settings.m_atvModInput);
|
|
|
|
response.getAtvModSettings()->setUniformLevel(settings.m_uniformLevel);
|
|
|
|
response.getAtvModSettings()->setAtvModulation(settings.m_atvModulation);
|
|
|
|
response.getAtvModSettings()->setVideoPlayLoop(settings.m_videoPlayLoop ? 1 : 0);
|
|
|
|
response.getAtvModSettings()->setVideoPlay(settings.m_videoPlay ? 1 : 0);
|
|
|
|
response.getAtvModSettings()->setCameraPlay(settings.m_cameraPlay ? 1 : 0);
|
|
|
|
response.getAtvModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
|
|
|
|
response.getAtvModSettings()->setInvertedVideo(settings.m_invertedVideo ? 1 : 0);
|
|
|
|
response.getAtvModSettings()->setRfScalingFactor(settings.m_rfScalingFactor);
|
|
|
|
response.getAtvModSettings()->setFmExcursion(settings.m_fmExcursion);
|
|
|
|
response.getAtvModSettings()->setForceDecimator(settings.m_forceDecimator ? 1 : 0);
|
2018-04-14 20:22:54 -04:00
|
|
|
response.getAtvModSettings()->setShowOverlayText(settings.m_showOverlayText ? 1 : 0);
|
2018-04-14 18:52:39 -04:00
|
|
|
|
|
|
|
if (response.getAtvModSettings()->getOverlayText()) {
|
|
|
|
*response.getAtvModSettings()->getOverlayText() = settings.m_overlayText;
|
|
|
|
} else {
|
|
|
|
response.getAtvModSettings()->setOverlayText(new QString(settings.m_overlayText));
|
|
|
|
}
|
|
|
|
|
|
|
|
response.getAtvModSettings()->setRgbColor(settings.m_rgbColor);
|
|
|
|
|
|
|
|
if (response.getAtvModSettings()->getTitle()) {
|
|
|
|
*response.getAtvModSettings()->getTitle() = settings.m_title;
|
|
|
|
} else {
|
|
|
|
response.getAtvModSettings()->setTitle(new QString(settings.m_title));
|
|
|
|
}
|
2018-04-14 20:22:54 -04:00
|
|
|
|
|
|
|
if (response.getAtvModSettings()->getImageFileName()) {
|
2019-08-01 17:21:57 -04:00
|
|
|
*response.getAtvModSettings()->getImageFileName() = settings.m_imageFileName;
|
2018-04-14 20:22:54 -04:00
|
|
|
} else {
|
2019-08-01 17:21:57 -04:00
|
|
|
response.getAtvModSettings()->setImageFileName(new QString(settings.m_imageFileName));
|
2018-04-14 20:22:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (response.getAtvModSettings()->getVideoFileName()) {
|
2019-08-01 17:21:57 -04:00
|
|
|
*response.getAtvModSettings()->getVideoFileName() = settings.m_videoFileName;
|
2018-04-14 20:22:54 -04:00
|
|
|
} else {
|
2019-08-01 17:21:57 -04:00
|
|
|
response.getAtvModSettings()->setVideoFileName(new QString(settings.m_videoFileName));
|
2018-04-14 20:22:54 -04:00
|
|
|
}
|
2018-12-20 19:15:15 -05:00
|
|
|
|
|
|
|
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);
|
2018-04-14 18:52:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
|
|
|
{
|
|
|
|
response.getAtvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
2019-11-14 19:04:24 -05:00
|
|
|
response.getAtvModReport()->setChannelSampleRate(m_basebandSource->getChannelSampleRate());
|
2018-04-14 18:52:39 -04:00
|
|
|
}
|
2018-12-20 19:15:15 -05:00
|
|
|
|
|
|
|
void ATVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ATVModSettings& settings, bool force)
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
2020-10-22 18:11:18 -04:00
|
|
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
|
|
|
|
|
|
|
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
|
|
|
|
QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
|
|
|
buffer->setParent(reply);
|
|
|
|
|
|
|
|
delete swgChannelSettings;
|
|
|
|
}
|
|
|
|
|
2020-12-13 07:04:36 -05:00
|
|
|
void ATVMod::sendChannelSettings(
|
|
|
|
QList<MessageQueue*> *messageQueues,
|
|
|
|
QList<QString>& channelSettingsKeys,
|
|
|
|
const ATVModSettings& settings,
|
|
|
|
bool force)
|
2020-10-22 18:11:18 -04:00
|
|
|
{
|
2020-12-13 07:04:36 -05:00
|
|
|
QList<MessageQueue*>::iterator it = messageQueues->begin();
|
2020-10-22 18:11:18 -04:00
|
|
|
|
2020-12-13 07:04:36 -05:00
|
|
|
for (; it != messageQueues->end(); ++it)
|
2020-10-22 18:11:18 -04:00
|
|
|
{
|
2020-12-13 07:04:36 -05:00
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
|
|
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
|
|
|
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
|
|
|
this,
|
|
|
|
channelSettingsKeys,
|
|
|
|
swgChannelSettings,
|
|
|
|
force
|
|
|
|
);
|
|
|
|
(*it)->push(msg);
|
2020-10-22 18:11:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::webapiFormatChannelSettings(
|
|
|
|
QList<QString>& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
|
|
|
const ATVModSettings& settings,
|
|
|
|
bool force
|
|
|
|
)
|
|
|
|
{
|
2019-05-07 08:43:38 -04:00
|
|
|
swgChannelSettings->setDirection(1); // single source (Tx)
|
2019-03-25 08:57:59 -04:00
|
|
|
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
|
|
|
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
|
2020-10-22 18:11:18 -04:00
|
|
|
swgChannelSettings->setChannelType(new QString(m_channelId));
|
2018-12-20 19:15:15 -05:00
|
|
|
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));
|
|
|
|
}
|
2019-11-17 05:09:07 -05:00
|
|
|
if (channelSettingsKeys.contains("streamIndex") || force) {
|
|
|
|
swgATVModSettings->setStreamIndex(settings.m_streamIndex);
|
|
|
|
}
|
2018-12-20 19:15:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::networkManagerFinished(QNetworkReply *reply)
|
|
|
|
{
|
|
|
|
QNetworkReply::NetworkError replyError = reply->error();
|
|
|
|
|
|
|
|
if (replyError)
|
|
|
|
{
|
|
|
|
qWarning() << "ATVMod::networkManagerFinished:"
|
|
|
|
<< " error(" << (int) replyError
|
|
|
|
<< "): " << replyError
|
|
|
|
<< ": " << reply->errorString();
|
|
|
|
}
|
2019-11-14 19:04:24 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
QString answer = reply->readAll();
|
|
|
|
answer.chop(1); // remove last \n
|
|
|
|
qDebug("AMMod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
reply->deleteLater();
|
|
|
|
}
|
|
|
|
|
|
|
|
double ATVMod::getMagSq() const
|
|
|
|
{
|
|
|
|
return m_basebandSource->getMagSq();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVMod::setLevelMeter(QObject *levelMeter)
|
|
|
|
{
|
|
|
|
connect(m_basebandSource, SIGNAL(levelChanged(qreal, qreal, int)), levelMeter, SLOT(levelChanged(qreal, qreal, int)));
|
|
|
|
}
|
2018-12-20 19:15:15 -05:00
|
|
|
|
2019-11-14 19:04:24 -05:00
|
|
|
int ATVMod::getEffectiveSampleRate() const
|
|
|
|
{
|
|
|
|
return m_basebandSource->getEffectiveSampleRate();
|
2018-12-20 19:15:15 -05:00
|
|
|
}
|
2019-11-14 19:04:24 -05:00
|
|
|
|
|
|
|
void ATVMod::getCameraNumbers(std::vector<int>& numbers)
|
|
|
|
{
|
|
|
|
m_basebandSource->getCameraNumbers(numbers);
|
|
|
|
}
|
|
|
|
|
2020-10-31 14:27:35 -04:00
|
|
|
void ATVMod::setMessageQueueToGUI(MessageQueue* queue) {
|
2021-02-08 15:52:47 -05:00
|
|
|
ChannelAPI::setMessageQueueToGUI(queue);
|
2020-10-31 14:27:35 -04:00
|
|
|
m_basebandSource->setMessageQueueToGUI(queue);
|
2020-10-22 18:11:18 -04:00
|
|
|
}
|