1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Merge pull request #1013 from srcejon/apt_worker_fixes

APT demod fixes.
This commit is contained in:
Edouard Griffiths 2021-10-13 14:41:23 +02:00 committed by GitHub
commit 669ab13d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 6 deletions

View File

@ -72,6 +72,8 @@ APTDemod::APTDemod(DeviceAPI *deviceAPI) :
m_networkManager = new QNetworkAccessManager(); m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
startImageWorker();
} }
APTDemod::~APTDemod() APTDemod::~APTDemod()
@ -109,7 +111,6 @@ void APTDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
void APTDemod::start() void APTDemod::start()
{ {
startBasebandSink(); startBasebandSink();
startImageWorker();
} }
void APTDemod::startBasebandSink() void APTDemod::startBasebandSink()
@ -141,7 +142,6 @@ void APTDemod::startImageWorker()
void APTDemod::stop() void APTDemod::stop()
{ {
stopImageWorker();
stopBasebandSink(); stopBasebandSink();
} }
@ -594,7 +594,7 @@ int APTDemod::webapiActionsPost(
m_basebandSink->getInputMessageQueue()->push(APTDemod::MsgResetDecoder::create()); m_basebandSink->getInputMessageQueue()->push(APTDemod::MsgResetDecoder::create());
// Save satellite name // Save satellite name
m_satelliteName = *satelliteName; m_imageWorker->getInputMessageQueue()->push(APTDemodImageWorker::MsgSetSatelliteName::create(*satelliteName));
// Enable decoder and set direction of pass // Enable decoder and set direction of pass
APTDemodSettings settings = m_settings; APTDemodSettings settings = m_settings;

View File

@ -250,8 +250,6 @@ private:
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;
QString m_satelliteName;
void applySettings(const APTDemodSettings& settings, bool force = false); void applySettings(const APTDemodSettings& settings, bool force = false);
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const APTDemodSettings& settings, bool force); void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const APTDemodSettings& settings, bool force);
void webapiFormatChannelSettings( void webapiFormatChannelSettings(

View File

@ -26,6 +26,7 @@
MESSAGE_CLASS_DEFINITION(APTDemodImageWorker::MsgConfigureAPTDemodImageWorker, Message) MESSAGE_CLASS_DEFINITION(APTDemodImageWorker::MsgConfigureAPTDemodImageWorker, Message)
MESSAGE_CLASS_DEFINITION(APTDemodImageWorker::MsgSaveImageToDisk, Message) MESSAGE_CLASS_DEFINITION(APTDemodImageWorker::MsgSaveImageToDisk, Message)
MESSAGE_CLASS_DEFINITION(APTDemodImageWorker::MsgSetSatelliteName, Message)
APTDemodImageWorker::APTDemodImageWorker() : APTDemodImageWorker::APTDemodImageWorker() :
m_messageQueueToGUI(nullptr), m_messageQueueToGUI(nullptr),
@ -99,6 +100,12 @@ bool APTDemodImageWorker::handleMessage(const Message& cmd)
saveImageToDisk(); saveImageToDisk();
return true; return true;
} }
else if (MsgSetSatelliteName::match(cmd))
{
MsgSetSatelliteName& msg = (MsgSetSatelliteName&) cmd;
m_satelliteName = msg.getSatelliteName();
return true;
}
else if (APTDemod::MsgPixels::match(cmd)) else if (APTDemod::MsgPixels::match(cmd))
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
@ -336,7 +343,7 @@ void APTDemodImageWorker::saveImageToDisk()
{ {
QString filename; QString filename;
QDateTime datetime = QDateTime::currentDateTime(); QDateTime datetime = QDateTime::currentDateTime();
filename = QString("apt_%1_%2.png").arg(m_satelliteName).arg(datetime.toString("yyyyMMdd_hhmm")); filename = QString("apt_%1_%2.png").arg(m_satelliteName.replace(" ", "_")).arg(datetime.toString("yyyyMMdd_hhmm"));
if (!m_settings.m_autoSavePath.isEmpty()) if (!m_settings.m_autoSavePath.isEmpty())
{ {

View File

@ -74,6 +74,27 @@ public:
} }
}; };
class MsgSetSatelliteName : public Message {
MESSAGE_CLASS_DECLARATION
public:
QString getSatelliteName() const { return m_satelliteName; }
static MsgSetSatelliteName* create(const QString &satelliteName)
{
return new MsgSetSatelliteName(satelliteName);
}
private:
QString m_satelliteName;
MsgSetSatelliteName(const QString &satelliteName) :
Message(),
m_satelliteName(satelliteName)
{
}
};
APTDemodImageWorker(); APTDemodImageWorker();
~APTDemodImageWorker(); ~APTDemodImageWorker();
void reset(); void reset();