diff --git a/plugins/feature/gs232controller/gs232controller.cpp b/plugins/feature/gs232controller/gs232controller.cpp index b9e18fb94..9487561bd 100644 --- a/plugins/feature/gs232controller/gs232controller.cpp +++ b/plugins/feature/gs232controller/gs232controller.cpp @@ -142,7 +142,7 @@ void GS232Controller::start() qDebug("GS232Controller::start"); m_thread = new QThread(); - m_worker = new GS232ControllerWorker(); + m_worker = new GS232ControllerWorker(this); m_worker->moveToThread(m_thread); QObject::connect(m_thread, &QThread::started, m_worker, &GS232ControllerWorker::startWork); QObject::connect(m_thread, &QThread::finished, m_worker, &QObject::deleteLater); diff --git a/plugins/feature/gs232controller/gs232controllersettings.cpp b/plugins/feature/gs232controller/gs232controllersettings.cpp index 4f11472cf..8b3f9cfd2 100644 --- a/plugins/feature/gs232controller/gs232controllersettings.cpp +++ b/plugins/feature/gs232controller/gs232controllersettings.cpp @@ -29,6 +29,7 @@ const QStringList GS232ControllerSettings::m_pipeTypes = { QStringLiteral("ADSBDemod"), QStringLiteral("Map"), + QStringLiteral("SkyMap"), QStringLiteral("StarTracker"), QStringLiteral("SatelliteTracker") }; @@ -36,6 +37,7 @@ const QStringList GS232ControllerSettings::m_pipeTypes = { const QStringList GS232ControllerSettings::m_pipeURIs = { QStringLiteral("sdrangel.channel.adsbdemod"), QStringLiteral("sdrangel.feature.map"), + QStringLiteral("sdrangel.feature.skymap"), QStringLiteral("sdrangel.feature.startracker"), QStringLiteral("sdrangel.feature.satellitetracker") }; diff --git a/plugins/feature/gs232controller/gs232controllerworker.cpp b/plugins/feature/gs232controller/gs232controllerworker.cpp index c61c8a4db..10fb93d21 100644 --- a/plugins/feature/gs232controller/gs232controllerworker.cpp +++ b/plugins/feature/gs232controller/gs232controllerworker.cpp @@ -25,6 +25,11 @@ #include #include +#include "maincore.h" +#include "util/astronomy.h" + +#include "SWGTargetAzimuthElevation.h" + #include "gs232controller.h" #include "gs232controllerworker.h" #include "gs232controllerreport.h" @@ -32,7 +37,8 @@ MESSAGE_CLASS_DEFINITION(GS232ControllerWorker::MsgConfigureGS232ControllerWorker, Message) MESSAGE_CLASS_DEFINITION(GS232ControllerReport::MsgReportAzAl, Message) -GS232ControllerWorker::GS232ControllerWorker() : +GS232ControllerWorker::GS232ControllerWorker(GS232Controller *controller) : + m_controller(controller), m_msgQueueToFeature(nullptr), m_device(nullptr), m_serialPort(this), @@ -193,6 +199,8 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting { setAzimuth(azimuth); } + + sendToSkyMap(azimuth, elevation); } } @@ -280,3 +288,18 @@ void GS232ControllerWorker::update() } } +void GS232ControllerWorker::sendToSkyMap(float azimuth, float elevation) +{ + QList targetPipes; + MainCore::instance()->getMessagePipes().getMessagePipes(m_controller, "target", targetPipes); + + for (const auto& pipe : targetPipes) + { + MessageQueue *messageQueue = qobject_cast(pipe->m_element); + SWGSDRangel::SWGTargetAzimuthElevation *swgTarget = new SWGSDRangel::SWGTargetAzimuthElevation(); + swgTarget->setName(new QString("Rotator")); + swgTarget->setAzimuth(azimuth); + swgTarget->setElevation(elevation); + messageQueue->push(MainCore::MsgTargetAzimuthElevation::create(m_controller, swgTarget)); + } +} diff --git a/plugins/feature/gs232controller/gs232controllerworker.h b/plugins/feature/gs232controller/gs232controllerworker.h index 88987f2da..82a225cae 100644 --- a/plugins/feature/gs232controller/gs232controllerworker.h +++ b/plugins/feature/gs232controller/gs232controllerworker.h @@ -32,6 +32,8 @@ #include "gs232controllersettings.h" #include "controllerprotocol.h" +class GS232Controller; + class GS232ControllerWorker : public QObject { Q_OBJECT @@ -62,7 +64,7 @@ public: { } }; - GS232ControllerWorker(); + GS232ControllerWorker(GS232Controller *controller); ~GS232ControllerWorker(); void startWork(); void stopWork(); @@ -72,6 +74,7 @@ public: private: + GS232Controller *m_controller; MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue *m_msgQueueToFeature; //!< Queue to report channel change to main feature object GS232ControllerSettings m_settings; @@ -92,6 +95,7 @@ private: QIODevice *openSocket(const GS232ControllerSettings& settings); void setAzimuth(float azimuth); void setAzimuthElevation(float azimuth, float elevation); + void sendToSkyMap(float azimuth, float elevation); private slots: void handleInputMessages();