mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-19 23:12:44 -04:00
Radioastronomy and StarTracker: implement new message pipes. Part of #1154
This commit is contained in:
parent
920d160f13
commit
1819ca6e94
plugins
channelrx/radioastronomy
feature/startracker
sdrbase
@ -40,6 +40,7 @@
|
|||||||
#include "device/deviceapi.h"
|
#include "device/deviceapi.h"
|
||||||
#include "feature/feature.h"
|
#include "feature/feature.h"
|
||||||
#include "channel/channelwebapiutils.h"
|
#include "channel/channelwebapiutils.h"
|
||||||
|
#include "feature/featureset.h"
|
||||||
#include "util/astronomy.h"
|
#include "util/astronomy.h"
|
||||||
#include "util/db.h"
|
#include "util/db.h"
|
||||||
#include "maincore.h"
|
#include "maincore.h"
|
||||||
@ -58,6 +59,7 @@ MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgStartSweep, Message)
|
|||||||
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgStopSweep, Message)
|
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgStopSweep, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgSweepComplete, Message)
|
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgSweepComplete, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgSweepStatus, Message)
|
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgSweepStatus, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(RadioAstronomy::MsgReportAvailableFeatures, Message)
|
||||||
|
|
||||||
const char * const RadioAstronomy::m_channelIdURI = "sdrangel.channel.radioastronomy";
|
const char * const RadioAstronomy::m_channelIdURI = "sdrangel.channel.radioastronomy";
|
||||||
const char * const RadioAstronomy::m_channelId = "RadioAstronomy";
|
const char * const RadioAstronomy::m_channelId = "RadioAstronomy";
|
||||||
@ -68,6 +70,7 @@ RadioAstronomy::RadioAstronomy(DeviceAPI *deviceAPI) :
|
|||||||
m_basebandSampleRate(0),
|
m_basebandSampleRate(0),
|
||||||
m_sweeping(false)
|
m_sweeping(false)
|
||||||
{
|
{
|
||||||
|
qDebug("RadioAstronomy::RadioAstronomy");
|
||||||
setObjectName(m_channelId);
|
setObjectName(m_channelId);
|
||||||
|
|
||||||
m_basebandSink = new RadioAstronomyBaseband(this);
|
m_basebandSink = new RadioAstronomyBaseband(this);
|
||||||
@ -85,8 +88,6 @@ RadioAstronomy::RadioAstronomy(DeviceAPI *deviceAPI) :
|
|||||||
m_deviceAPI->addChannelSinkAPI(this);
|
m_deviceAPI->addChannelSinkAPI(this);
|
||||||
|
|
||||||
m_selectedPipe = nullptr;
|
m_selectedPipe = nullptr;
|
||||||
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
|
|
||||||
m_updatePipesTimer.start(1000);
|
|
||||||
|
|
||||||
m_networkManager = new QNetworkAccessManager();
|
m_networkManager = new QNetworkAccessManager();
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
@ -101,6 +102,12 @@ RadioAstronomy::RadioAstronomy(DeviceAPI *deviceAPI) :
|
|||||||
this,
|
this,
|
||||||
&RadioAstronomy::handleIndexInDeviceSetChanged
|
&RadioAstronomy::handleIndexInDeviceSetChanged
|
||||||
);
|
);
|
||||||
|
QObject::connect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::featureAdded,
|
||||||
|
this,
|
||||||
|
&RadioAstronomy::handleFeatureAdded
|
||||||
|
);
|
||||||
|
|
||||||
m_sweepTimer.setSingleShot(true);
|
m_sweepTimer.setSingleShot(true);
|
||||||
}
|
}
|
||||||
@ -108,6 +115,12 @@ RadioAstronomy::RadioAstronomy(DeviceAPI *deviceAPI) :
|
|||||||
RadioAstronomy::~RadioAstronomy()
|
RadioAstronomy::~RadioAstronomy()
|
||||||
{
|
{
|
||||||
qDebug("RadioAstronomy::~RadioAstronomy");
|
qDebug("RadioAstronomy::~RadioAstronomy");
|
||||||
|
QObject::disconnect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::featureAdded,
|
||||||
|
this,
|
||||||
|
&RadioAstronomy::handleFeatureAdded
|
||||||
|
);
|
||||||
QObject::disconnect(
|
QObject::disconnect(
|
||||||
m_networkManager,
|
m_networkManager,
|
||||||
&QNetworkAccessManager::finished,
|
&QNetworkAccessManager::finished,
|
||||||
@ -153,10 +166,10 @@ void RadioAstronomy::start()
|
|||||||
m_workerThread.start();
|
m_workerThread.start();
|
||||||
|
|
||||||
m_basebandSink->getInputMessageQueue()->push(new DSPSignalNotification(m_basebandSampleRate, m_centerFrequency));
|
m_basebandSink->getInputMessageQueue()->push(new DSPSignalNotification(m_basebandSampleRate, m_centerFrequency));
|
||||||
|
|
||||||
m_basebandSink->getInputMessageQueue()->push(RadioAstronomyBaseband::MsgConfigureRadioAstronomyBaseband::create(m_settings, true));
|
m_basebandSink->getInputMessageQueue()->push(RadioAstronomyBaseband::MsgConfigureRadioAstronomyBaseband::create(m_settings, true));
|
||||||
|
|
||||||
m_worker->getInputMessageQueue()->push(RadioAstronomyWorker::MsgConfigureRadioAstronomyWorker::create(m_settings, true));
|
m_worker->getInputMessageQueue()->push(RadioAstronomyWorker::MsgConfigureRadioAstronomyWorker::create(m_settings, true));
|
||||||
|
|
||||||
|
scanAvailableFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioAstronomy::stop()
|
void RadioAstronomy::stop()
|
||||||
@ -631,23 +644,6 @@ void RadioAstronomy::sweepComplete()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioAstronomy::updatePipes()
|
|
||||||
{
|
|
||||||
QList<AvailablePipeSource> availablePipes = updateAvailablePipeSources("startracker.target", RadioAstronomySettings::m_pipeTypes, RadioAstronomySettings::m_pipeURIs, this);
|
|
||||||
|
|
||||||
if (availablePipes != m_availablePipes)
|
|
||||||
{
|
|
||||||
m_availablePipes = availablePipes;
|
|
||||||
if (getMessageQueueToGUI())
|
|
||||||
{
|
|
||||||
MsgReportPipes *msgToGUI = MsgReportPipes::create();
|
|
||||||
QList<AvailablePipeSource>& msgAvailablePipes = msgToGUI->getAvailablePipes();
|
|
||||||
msgAvailablePipes.append(availablePipes);
|
|
||||||
getMessageQueueToGUI()->push(msgToGUI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadioAstronomy::applySettings(const RadioAstronomySettings& settings, bool force)
|
void RadioAstronomy::applySettings(const RadioAstronomySettings& settings, bool force)
|
||||||
{
|
{
|
||||||
qDebug() << "RadioAstronomy::applySettings:"
|
qDebug() << "RadioAstronomy::applySettings:"
|
||||||
@ -733,8 +729,22 @@ void RadioAstronomy::applySettings(const RadioAstronomySettings& settings, bool
|
|||||||
{
|
{
|
||||||
if (!settings.m_starTracker.isEmpty())
|
if (!settings.m_starTracker.isEmpty())
|
||||||
{
|
{
|
||||||
m_selectedPipe = getPipeEndPoint(settings.m_starTracker, m_availablePipes);
|
Feature *feature = nullptr;
|
||||||
if (m_selectedPipe == nullptr) {
|
|
||||||
|
for (const auto& fval : m_availableFeatures)
|
||||||
|
{
|
||||||
|
QString starTrackerText = tr("F1:%2 %3").arg(fval.m_deviceSetIndex).arg(fval.m_featureIndex).arg(fval.m_type);
|
||||||
|
|
||||||
|
if (settings.m_starTracker == starTrackerText)
|
||||||
|
{
|
||||||
|
feature = m_availableFeatures.key(fval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (feature) {
|
||||||
|
m_selectedPipe = feature;
|
||||||
|
} else {
|
||||||
qDebug() << "RadioAstronomy::applySettings: No plugin corresponding to target " << settings.m_starTracker;
|
qDebug() << "RadioAstronomy::applySettings: No plugin corresponding to target " << settings.m_starTracker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1200,3 +1210,109 @@ void RadioAstronomy::handleIndexInDeviceSetChanged(int index)
|
|||||||
.arg(index);
|
.arg(index);
|
||||||
m_basebandSink->setFifoLabel(fifoLabel);
|
m_basebandSink->setFifoLabel(fifoLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadioAstronomy::scanAvailableFeatures()
|
||||||
|
{
|
||||||
|
qDebug("RadioAstronomy::scanAvailableFeatures");
|
||||||
|
MainCore *mainCore = MainCore::instance();
|
||||||
|
MessagePipes& messagePipes = mainCore->getMessagePipes();
|
||||||
|
std::vector<FeatureSet*>& featureSets = mainCore->getFeatureeSets();
|
||||||
|
m_availableFeatures.clear();
|
||||||
|
|
||||||
|
for (const auto& featureSet : featureSets)
|
||||||
|
{
|
||||||
|
for (int fei = 0; fei < featureSet->getNumberOfFeatures(); fei++)
|
||||||
|
{
|
||||||
|
Feature *feature = featureSet->getFeatureAt(fei);
|
||||||
|
|
||||||
|
if (RadioAstronomySettings::m_pipeURIs.contains(feature->getURI()) && !m_availableFeatures.contains(feature))
|
||||||
|
{
|
||||||
|
qDebug("RadioAstronomy::scanAvailableFeatures: register %d:%d %s (%p)",
|
||||||
|
featureSet->getIndex(), fei, qPrintable(feature->getURI()), feature);
|
||||||
|
ObjectPipe *pipe = messagePipes.registerProducerToConsumer(feature, this, "startracker.target");
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
QObject::connect(
|
||||||
|
messageQueue,
|
||||||
|
&MessageQueue::messageEnqueued,
|
||||||
|
this,
|
||||||
|
[=](){ this->handleFeatureMessageQueue(messageQueue); },
|
||||||
|
Qt::QueuedConnection
|
||||||
|
);
|
||||||
|
connect(pipe, SIGNAL(toBeDeleted(int, QObject*)), this, SLOT(handleMessagePipeToBeDeleted(int, QObject*)));
|
||||||
|
RadioAstronomySettings::AvailableFeature availableFeature =
|
||||||
|
RadioAstronomySettings::AvailableFeature{featureSet->getIndex(), fei, feature->getIdentifier()};
|
||||||
|
m_availableFeatures[feature] = availableFeature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyUpdateFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioAstronomy::notifyUpdateFeatures()
|
||||||
|
{
|
||||||
|
if (getMessageQueueToGUI())
|
||||||
|
{
|
||||||
|
MsgReportAvailableFeatures *msg = MsgReportAvailableFeatures::create();
|
||||||
|
msg->getFeatures() = m_availableFeatures.values();
|
||||||
|
getMessageQueueToGUI()->push(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioAstronomy::handleFeatureAdded(int featureSetIndex, Feature *feature)
|
||||||
|
{
|
||||||
|
qDebug("RadioAstronomy::handleFeatureAdded: featureSetIndex: %d:%d feature: %s (%p)",
|
||||||
|
featureSetIndex, feature->getIndexInFeatureSet(), qPrintable(feature->getURI()), feature);
|
||||||
|
FeatureSet *featureSet = MainCore::instance()->getFeatureeSets()[featureSetIndex];
|
||||||
|
|
||||||
|
if (RadioAstronomySettings::m_pipeURIs.contains(feature->getURI()))
|
||||||
|
{
|
||||||
|
int fei = feature->getIndexInFeatureSet();
|
||||||
|
|
||||||
|
if (!m_availableFeatures.contains(feature))
|
||||||
|
{
|
||||||
|
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
|
||||||
|
ObjectPipe *pipe = messagePipes.registerProducerToConsumer(feature, this, "startracker.target");
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
QObject::connect(
|
||||||
|
messageQueue,
|
||||||
|
&MessageQueue::messageEnqueued,
|
||||||
|
this,
|
||||||
|
[=](){ this->handleFeatureMessageQueue(messageQueue); },
|
||||||
|
Qt::QueuedConnection
|
||||||
|
);
|
||||||
|
connect(pipe, SIGNAL(toBeDeleted(int, QObject*)), this, SLOT(handleMessagePipeToBeDeleted(int, QObject*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioAstronomySettings::AvailableFeature availableFeature =
|
||||||
|
RadioAstronomySettings::AvailableFeature{featureSet->getIndex(), fei, feature->getIdentifier()};
|
||||||
|
m_availableFeatures[feature] = availableFeature;
|
||||||
|
|
||||||
|
notifyUpdateFeatures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioAstronomy::handleMessagePipeToBeDeleted(int reason, QObject* object)
|
||||||
|
{
|
||||||
|
if (reason == 0) // producer (channel)
|
||||||
|
{
|
||||||
|
if (m_availableFeatures.contains((Feature*) object))
|
||||||
|
{
|
||||||
|
qDebug("RadioAstronomy::handleMessagePipeToBeDeleted: removing feature at (%p)", object);
|
||||||
|
m_availableFeatures.remove((Feature*) object);
|
||||||
|
notifyUpdateFeatures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioAstronomy::handleFeatureMessageQueue(MessageQueue* messageQueue)
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = messageQueue->pop()) != nullptr)
|
||||||
|
{
|
||||||
|
if (handleMessage(*message)) {
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
#include <QUdpSocket>
|
#include <QUdpSocket>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QHash>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "dsp/basebandsamplesink.h"
|
#include "dsp/basebandsamplesink.h"
|
||||||
#include "channel/channelapi.h"
|
#include "channel/channelapi.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
#include "pipes/pipeendpoint.h"
|
|
||||||
|
|
||||||
#include "radioastronomybaseband.h"
|
#include "radioastronomybaseband.h"
|
||||||
#include "radioastronomysettings.h"
|
#include "radioastronomysettings.h"
|
||||||
@ -306,6 +306,23 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgReportAvailableFeatures : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
QList<RadioAstronomySettings::AvailableFeature>& getFeatures() { return m_availableFeatures; }
|
||||||
|
|
||||||
|
static MsgReportAvailableFeatures* create() {
|
||||||
|
return new MsgReportAvailableFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<RadioAstronomySettings::AvailableFeature> m_availableFeatures;
|
||||||
|
|
||||||
|
MsgReportAvailableFeatures() :
|
||||||
|
Message()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
RadioAstronomy(DeviceAPI *deviceAPI);
|
RadioAstronomy(DeviceAPI *deviceAPI);
|
||||||
virtual ~RadioAstronomy();
|
virtual ~RadioAstronomy();
|
||||||
@ -387,9 +404,8 @@ private:
|
|||||||
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
|
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
|
||||||
qint64 m_centerFrequency;
|
qint64 m_centerFrequency;
|
||||||
|
|
||||||
QList<AvailablePipeSource> m_availablePipes;
|
QHash<Feature*, RadioAstronomySettings::AvailableFeature> m_availableFeatures;
|
||||||
PipeEndPoint *m_selectedPipe;
|
QObject *m_selectedPipe;
|
||||||
QTimer m_updatePipesTimer;
|
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
@ -422,10 +438,11 @@ private:
|
|||||||
void sweepStart();
|
void sweepStart();
|
||||||
void startCal(bool hot);
|
void startCal(bool hot);
|
||||||
void calComplete(MsgCalComplete* report);
|
void calComplete(MsgCalComplete* report);
|
||||||
|
void scanAvailableFeatures();
|
||||||
|
void notifyUpdateFeatures();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply);
|
||||||
void updatePipes();
|
|
||||||
void startMeasurement();
|
void startMeasurement();
|
||||||
void sweepStartMeasurement();
|
void sweepStartMeasurement();
|
||||||
void sweep1();
|
void sweep1();
|
||||||
@ -434,6 +451,9 @@ private slots:
|
|||||||
void sweepNext();
|
void sweepNext();
|
||||||
void sweepComplete();
|
void sweepComplete();
|
||||||
void handleIndexInDeviceSetChanged(int index);
|
void handleIndexInDeviceSetChanged(int index);
|
||||||
|
void handleFeatureAdded(int deviceSetIndex, Feature *feature);
|
||||||
|
void handleMessagePipeToBeDeleted(int reason, QObject* object);
|
||||||
|
void handleFeatureMessageQueue(MessageQueue* messageQueue);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_RADIOASTRONOMY_H
|
#endif // INCLUDE_RADIOASTRONOMY_H
|
||||||
|
@ -935,20 +935,19 @@ bool RadioAstronomyGUI::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioAstronomyGUI::updatePipeList()
|
void RadioAstronomyGUI::updateAvailableFeatures()
|
||||||
{
|
{
|
||||||
QString currentText = ui->starTracker->currentText();
|
QString currentText = ui->starTracker->currentText();
|
||||||
ui->starTracker->blockSignals(true);
|
ui->starTracker->blockSignals(true);
|
||||||
ui->starTracker->clear();
|
ui->starTracker->clear();
|
||||||
QList<PipeEndPoint::AvailablePipeSource>::const_iterator it = m_availablePipes.begin();
|
|
||||||
|
|
||||||
for (int i = 0; it != m_availablePipes.end(); ++it, i++) {
|
for (const auto& feature : m_availableFeatures) {
|
||||||
ui->starTracker->addItem(it->getName());
|
ui->starTracker->addItem(tr("F%1:%2 %3").arg(feature.m_deviceSetIndex).arg(feature.m_featureIndex).arg(feature.m_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentText.isEmpty())
|
if (currentText.isEmpty())
|
||||||
{
|
{
|
||||||
if (m_availablePipes.size() > 0) {
|
if (m_availableFeatures.size() > 0) {
|
||||||
ui->starTracker->setCurrentIndex(0);
|
ui->starTracker->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -956,9 +955,10 @@ void RadioAstronomyGUI::updatePipeList()
|
|||||||
{
|
{
|
||||||
ui->starTracker->setCurrentIndex(ui->starTracker->findText(currentText));
|
ui->starTracker->setCurrentIndex(ui->starTracker->findText(currentText));
|
||||||
}
|
}
|
||||||
ui->starTracker->blockSignals(false);
|
|
||||||
|
|
||||||
|
ui->starTracker->blockSignals(false);
|
||||||
QString newText = ui->starTracker->currentText();
|
QString newText = ui->starTracker->currentText();
|
||||||
|
|
||||||
if (currentText != newText)
|
if (currentText != newText)
|
||||||
{
|
{
|
||||||
m_settings.m_starTracker = newText;
|
m_settings.m_starTracker = newText;
|
||||||
@ -979,11 +979,12 @@ bool RadioAstronomyGUI::handleMessage(const Message& message)
|
|||||||
updateTSys0();
|
updateTSys0();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (PipeEndPoint::MsgReportPipes::match(message))
|
else if (RadioAstronomy::MsgReportAvailableFeatures::match(message))
|
||||||
{
|
{
|
||||||
PipeEndPoint::MsgReportPipes& report = (PipeEndPoint::MsgReportPipes&) message;
|
qDebug("RadioAstronomyGUI::handleMessage: MsgReportAvailableFeatures");
|
||||||
m_availablePipes = report.getAvailablePipes();
|
RadioAstronomy::MsgReportAvailableFeatures& report = (RadioAstronomy::MsgReportAvailableFeatures&) message;
|
||||||
updatePipeList();
|
m_availableFeatures = report.getFeatures();
|
||||||
|
updateAvailableFeatures();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MainCore::MsgStarTrackerTarget::match(message))
|
else if (MainCore::MsgStarTrackerTarget::match(message))
|
||||||
@ -1908,22 +1909,19 @@ void RadioAstronomyGUI::on_powerTable_cellDoubleClicked(int row, int column)
|
|||||||
if ((column >= POWER_COL_RA) && (column >= POWER_COL_EL))
|
if ((column >= POWER_COL_RA) && (column >= POWER_COL_EL))
|
||||||
{
|
{
|
||||||
// Display target in Star Tracker
|
// Display target in Star Tracker
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> starTrackerPipes;
|
||||||
QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "startracker.display", starTrackerPipes);
|
||||||
if (messageQueues)
|
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = messageQueues->begin();
|
|
||||||
|
|
||||||
for (; it != messageQueues->end(); ++it)
|
for (const auto& pipe : starTrackerPipes)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGStarTrackerDisplaySettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplaySettings();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
QDateTime dt(ui->powerTable->item(row, POWER_COL_DATE)->data(Qt::DisplayRole).toDate(),
|
SWGSDRangel::SWGStarTrackerDisplaySettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplaySettings();
|
||||||
ui->powerTable->item(row, POWER_COL_TIME)->data(Qt::DisplayRole).toTime());
|
QDateTime dt(ui->powerTable->item(row, POWER_COL_DATE)->data(Qt::DisplayRole).toDate(),
|
||||||
swgSettings->setDateTime(new QString(dt.toString(Qt::ISODateWithMs)));
|
ui->powerTable->item(row, POWER_COL_TIME)->data(Qt::DisplayRole).toTime());
|
||||||
swgSettings->setAzimuth(ui->powerTable->item(row, POWER_COL_AZ)->data(Qt::DisplayRole).toFloat());
|
swgSettings->setDateTime(new QString(dt.toString(Qt::ISODateWithMs)));
|
||||||
swgSettings->setElevation(ui->powerTable->item(row, POWER_COL_EL)->data(Qt::DisplayRole).toFloat());
|
swgSettings->setAzimuth(ui->powerTable->item(row, POWER_COL_AZ)->data(Qt::DisplayRole).toFloat());
|
||||||
(*it)->push(MainCore::MsgStarTrackerDisplaySettings::create(m_radioAstronomy, swgSettings));
|
swgSettings->setElevation(ui->powerTable->item(row, POWER_COL_EL)->data(Qt::DisplayRole).toFloat());
|
||||||
}
|
messageQueue->push(MainCore::MsgStarTrackerDisplaySettings::create(m_radioAstronomy, swgSettings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2047,6 +2045,7 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
|
|||||||
m_bLAB(0.0f),
|
m_bLAB(0.0f),
|
||||||
m_downloadingLAB(false)
|
m_downloadingLAB(false)
|
||||||
{
|
{
|
||||||
|
qDebug("RadioAstronomyGUI::RadioAstronomyGUI");
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -4281,21 +4280,18 @@ void RadioAstronomyGUI::showLoSMarker(int row)
|
|||||||
void RadioAstronomyGUI::updateLoSMarker(const QString& name, float l, float b, float d)
|
void RadioAstronomyGUI::updateLoSMarker(const QString& name, float l, float b, float d)
|
||||||
{
|
{
|
||||||
// Send to Star Tracker
|
// Send to Star Tracker
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> starTrackerPipes;
|
||||||
QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "startracker.display", starTrackerPipes);
|
||||||
if (messageQueues)
|
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = messageQueues->begin();
|
|
||||||
|
|
||||||
for (; it != messageQueues->end(); ++it)
|
for (const auto& pipe : starTrackerPipes)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGStarTrackerDisplayLoSSettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplayLoSSettings();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
swgSettings->setName(new QString(name));
|
SWGSDRangel::SWGStarTrackerDisplayLoSSettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplayLoSSettings();
|
||||||
swgSettings->setL(l);
|
swgSettings->setName(new QString(name));
|
||||||
swgSettings->setB(b);
|
swgSettings->setL(l);
|
||||||
swgSettings->setD(d);
|
swgSettings->setB(b);
|
||||||
(*it)->push(MainCore::MsgStarTrackerDisplayLoSSettings::create(m_radioAstronomy, swgSettings));
|
swgSettings->setD(d);
|
||||||
}
|
messageQueue->push(MainCore::MsgStarTrackerDisplayLoSSettings::create(m_radioAstronomy, swgSettings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4682,21 +4678,19 @@ void RadioAstronomyGUI::on_spectrumIndex_valueChanged(int value)
|
|||||||
ui->powerTable->selectRow(value);
|
ui->powerTable->selectRow(value);
|
||||||
ui->powerTable->scrollTo(ui->powerTable->model()->index(value, 0));
|
ui->powerTable->scrollTo(ui->powerTable->model()->index(value, 0));
|
||||||
ui->spectrumDateTime->setDateTime(m_fftMeasurements[value]->m_dateTime);
|
ui->spectrumDateTime->setDateTime(m_fftMeasurements[value]->m_dateTime);
|
||||||
// Display target in Star Tracker
|
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
|
||||||
QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
|
|
||||||
if (messageQueues)
|
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = messageQueues->begin();
|
|
||||||
|
|
||||||
for (; it != messageQueues->end(); ++it)
|
// Display target in Star Tracker
|
||||||
{
|
QList<ObjectPipe*> starTrackerPipes;
|
||||||
SWGSDRangel::SWGStarTrackerDisplaySettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplaySettings();
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "startracker.display", starTrackerPipes);
|
||||||
swgSettings->setDateTime(new QString(m_fftMeasurements[value]->m_dateTime.toString(Qt::ISODateWithMs)));
|
|
||||||
swgSettings->setAzimuth(m_fftMeasurements[value]->m_azimuth);
|
for (const auto& pipe : starTrackerPipes)
|
||||||
swgSettings->setElevation(m_fftMeasurements[value]->m_elevation);
|
{
|
||||||
(*it)->push(MainCore::MsgStarTrackerDisplaySettings::create(m_radioAstronomy, swgSettings));
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
}
|
SWGSDRangel::SWGStarTrackerDisplaySettings *swgSettings = new SWGSDRangel::SWGStarTrackerDisplaySettings();
|
||||||
|
swgSettings->setDateTime(new QString(m_fftMeasurements[value]->m_dateTime.toString(Qt::ISODateWithMs)));
|
||||||
|
swgSettings->setAzimuth(m_fftMeasurements[value]->m_azimuth);
|
||||||
|
swgSettings->setElevation(m_fftMeasurements[value]->m_elevation);
|
||||||
|
messageQueue->push(MainCore::MsgStarTrackerDisplaySettings::create(m_radioAstronomy, swgSettings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
#include "util/httpdownloadmanager.h"
|
#include "util/httpdownloadmanager.h"
|
||||||
#include "settings/rollupstate.h"
|
#include "settings/rollupstate.h"
|
||||||
#include "pipes/pipeendpoint.h"
|
|
||||||
|
|
||||||
#include "radioastronomysettings.h"
|
#include "radioastronomysettings.h"
|
||||||
#include "radioastronomy.h"
|
#include "radioastronomy.h"
|
||||||
@ -212,7 +211,7 @@ private:
|
|||||||
RollupState m_rollupState;
|
RollupState m_rollupState;
|
||||||
RadioAstronomySettings m_settings;
|
RadioAstronomySettings m_settings;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
QList<PipeEndPoint::AvailablePipeSource> m_availablePipes;
|
QList<RadioAstronomySettings::AvailableFeature> m_availableFeatures;
|
||||||
|
|
||||||
int m_basebandSampleRate;
|
int m_basebandSampleRate;
|
||||||
quint64 m_centerFrequency;
|
quint64 m_centerFrequency;
|
||||||
@ -322,7 +321,7 @@ private:
|
|||||||
void displayStreamIndex();
|
void displayStreamIndex();
|
||||||
void displaySpectrumLineFrequency();
|
void displaySpectrumLineFrequency();
|
||||||
void displayRunModeSettings();
|
void displayRunModeSettings();
|
||||||
void updatePipeList();
|
void updateAvailableFeatures();
|
||||||
void updateRotatorList();
|
void updateRotatorList();
|
||||||
bool handleMessage(const Message& message);
|
bool handleMessage(const Message& message);
|
||||||
double degreesToSteradian(double deg) const;
|
double degreesToSteradian(double deg) const;
|
||||||
|
@ -35,6 +35,20 @@ class Serializable;
|
|||||||
|
|
||||||
struct RadioAstronomySettings
|
struct RadioAstronomySettings
|
||||||
{
|
{
|
||||||
|
struct AvailableFeature
|
||||||
|
{
|
||||||
|
int m_deviceSetIndex;
|
||||||
|
int m_featureIndex;
|
||||||
|
QString m_type;
|
||||||
|
|
||||||
|
AvailableFeature() = default;
|
||||||
|
AvailableFeature(const AvailableFeature&) = default;
|
||||||
|
AvailableFeature& operator=(const AvailableFeature&) = default;
|
||||||
|
bool operator==(const AvailableFeature& a) const {
|
||||||
|
return (m_deviceSetIndex == a.m_deviceSetIndex) && (m_featureIndex == a.m_featureIndex) && (m_type == a.m_type);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int m_inputFrequencyOffset;
|
int m_inputFrequencyOffset;
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
int m_rfBandwidth;
|
int m_rfBandwidth;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
#include <QSet>
|
||||||
|
|
||||||
#include "feature/feature.h"
|
#include "feature/feature.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
@ -160,6 +161,7 @@ private:
|
|||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
|
QSet<ChannelAPI*> m_availableChannels;
|
||||||
Weather *m_weather;
|
Weather *m_weather;
|
||||||
float m_solarFlux;
|
float m_solarFlux;
|
||||||
|
|
||||||
@ -172,10 +174,14 @@ private:
|
|||||||
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const StarTrackerSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const StarTrackerSettings& settings, bool force);
|
||||||
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
||||||
double applyBeam(const FITS *fits, double beamwidth, double ra, double dec, int& imgX, int& imgY) const;
|
double applyBeam(const FITS *fits, double beamwidth, double ra, double dec, int& imgX, int& imgY) const;
|
||||||
|
void scanAvailableChannels();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply);
|
||||||
void weatherUpdated(float temperature, float pressure, float humidity);
|
void weatherUpdated(float temperature, float pressure, float humidity);
|
||||||
|
void handleChannelAdded(int deviceSetIndex, ChannelAPI *channel);
|
||||||
|
void handleMessagePipeToBeDeleted(int reason, QObject* object);
|
||||||
|
void handleChannelMessageQueue(MessageQueue* messageQueue);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FEATURE_STARTRACKER_H_
|
#endif // INCLUDE_FEATURE_STARTRACKER_H_
|
||||||
|
@ -607,36 +607,34 @@ void StarTrackerWorker::update()
|
|||||||
// Unless we're receiving settings to display from a Radio Astronomy plugins
|
// Unless we're receiving settings to display from a Radio Astronomy plugins
|
||||||
if (!m_settings.m_link)
|
if (!m_settings.m_link)
|
||||||
{
|
{
|
||||||
messageQueues = messagePipes.getMessageQueues(m_starTracker, "startracker.target");
|
QList<ObjectPipe*> starTrackerPipes;
|
||||||
if (messageQueues)
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "startracker.target", starTrackerPipes);
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = messageQueues->begin();
|
|
||||||
|
|
||||||
for (; it != messageQueues->end(); ++it)
|
for (const auto& pipe : starTrackerPipes)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGStarTrackerTarget *swgTarget = new SWGSDRangel::SWGStarTrackerTarget();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
swgTarget->setName(new QString(m_settings.m_target));
|
SWGSDRangel::SWGStarTrackerTarget *swgTarget = new SWGSDRangel::SWGStarTrackerTarget();
|
||||||
swgTarget->setAzimuth(aa.az);
|
swgTarget->setName(new QString(m_settings.m_target));
|
||||||
swgTarget->setElevation(aa.alt);
|
swgTarget->setAzimuth(aa.az);
|
||||||
swgTarget->setRa(rd.ra);
|
swgTarget->setElevation(aa.alt);
|
||||||
swgTarget->setDec(rd.dec);
|
swgTarget->setRa(rd.ra);
|
||||||
swgTarget->setB(b);
|
swgTarget->setDec(rd.dec);
|
||||||
swgTarget->setL(l);
|
swgTarget->setB(b);
|
||||||
swgTarget->setSolarFlux(m_solarFlux);
|
swgTarget->setL(l);
|
||||||
swgTarget->setAirTemperature(m_settings.m_temperature);
|
swgTarget->setSolarFlux(m_solarFlux);
|
||||||
double temp;
|
swgTarget->setAirTemperature(m_settings.m_temperature);
|
||||||
m_starTracker->calcSkyTemperature(m_settings.m_frequency, m_settings.m_beamwidth, rd.ra, rd.dec, temp);
|
double temp;
|
||||||
swgTarget->setSkyTemperature(temp);
|
m_starTracker->calcSkyTemperature(m_settings.m_frequency, m_settings.m_beamwidth, rd.ra, rd.dec, temp);
|
||||||
swgTarget->setHpbw(m_settings.m_beamwidth);
|
swgTarget->setSkyTemperature(temp);
|
||||||
// Calculate velocities
|
swgTarget->setHpbw(m_settings.m_beamwidth);
|
||||||
double vRot = Astronomy::earthRotationVelocity(rd, m_settings.m_latitude, m_settings.m_longitude, dt);
|
// Calculate velocities
|
||||||
swgTarget->setEarthRotationVelocity(vRot);
|
double vRot = Astronomy::earthRotationVelocity(rd, m_settings.m_latitude, m_settings.m_longitude, dt);
|
||||||
double vOrbit = Astronomy::earthOrbitVelocityBCRS(rd,dt);
|
swgTarget->setEarthRotationVelocity(vRot);
|
||||||
swgTarget->setEarthOrbitVelocityBcrs(vOrbit);
|
double vOrbit = Astronomy::earthOrbitVelocityBCRS(rd,dt);
|
||||||
double vLSRK = Astronomy::sunVelocityLSRK(rd);
|
swgTarget->setEarthOrbitVelocityBcrs(vOrbit);
|
||||||
swgTarget->setSunVelocityLsr(vLSRK);
|
double vLSRK = Astronomy::sunVelocityLSRK(rd);
|
||||||
(*it)->push(MainCore::MsgStarTrackerTarget::create(m_starTracker, swgTarget));
|
swgTarget->setSunVelocityLsr(vLSRK);
|
||||||
}
|
messageQueue->push(MainCore::MsgStarTrackerTarget::create(m_starTracker, swgTarget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,19 +635,19 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const PipeEndPoint *getPipeSource() const { return m_pipeSource; }
|
const QObject *getPipeSource() const { return m_pipeSource; }
|
||||||
SWGSDRangel::SWGStarTrackerTarget *getSWGStarTrackerTarget() const { return m_swgStarTrackerTarget; }
|
SWGSDRangel::SWGStarTrackerTarget *getSWGStarTrackerTarget() const { return m_swgStarTrackerTarget; }
|
||||||
|
|
||||||
static MsgStarTrackerTarget* create(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget)
|
static MsgStarTrackerTarget* create(const QObject *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget)
|
||||||
{
|
{
|
||||||
return new MsgStarTrackerTarget(pipeSource, swgStarTrackerTarget);
|
return new MsgStarTrackerTarget(pipeSource, swgStarTrackerTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PipeEndPoint *m_pipeSource;
|
const QObject *m_pipeSource;
|
||||||
SWGSDRangel::SWGStarTrackerTarget *m_swgStarTrackerTarget;
|
SWGSDRangel::SWGStarTrackerTarget *m_swgStarTrackerTarget;
|
||||||
|
|
||||||
MsgStarTrackerTarget(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget) :
|
MsgStarTrackerTarget(const QObject *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget) :
|
||||||
Message(),
|
Message(),
|
||||||
m_pipeSource(pipeSource),
|
m_pipeSource(pipeSource),
|
||||||
m_swgStarTrackerTarget(swgStarTrackerTarget)
|
m_swgStarTrackerTarget(swgStarTrackerTarget)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user