kopia lustrzana https://github.com/f4exb/sdrangel
				
				
				
			Message pipes rework: renaming to legacy
							rodzic
							
								
									c90d04e4b6
								
							
						
					
					
						commit
						74f917682b
					
				| 
						 | 
				
			
			@ -756,7 +756,7 @@ void ADSBDemod::setTarget(const QString& name, float targetAzimuth, float target
 | 
			
		|||
    m_targetAzElValid = true;
 | 
			
		||||
 | 
			
		||||
    // Send to Rotator Controllers
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(this, "target");
 | 
			
		||||
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -711,7 +711,7 @@ bool ADSBDemodGUI::updateLocalPosition(Aircraft *aircraft, double latitude, doub
 | 
			
		|||
void ADSBDemodGUI::sendToMap(Aircraft *aircraft, QList<SWGSDRangel::SWGMapAnimation *> *animations)
 | 
			
		||||
{
 | 
			
		||||
    // Send to Map feature
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_adsbDemod, "mapitems");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -4044,7 +4044,7 @@ void ADSBDemodGUI::tick()
 | 
			
		|||
                // Remove aircraft from hash
 | 
			
		||||
                i = m_aircraft.erase(i);
 | 
			
		||||
                // Remove from map feature
 | 
			
		||||
                MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_adsbDemod, "mapitems");
 | 
			
		||||
                if (mapMessageQueues)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ bool AISDemod::handleMessage(const Message& cmd)
 | 
			
		|||
            getMessageQueueToGUI()->push(msg);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
 | 
			
		||||
        // Forward to AIS feature
 | 
			
		||||
        QList<MessageQueue*> *aisMessageQueues = messagePipes.getMessageQueues(this, "ais");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -702,7 +702,7 @@ void AISDemodGUI::on_logOpen_clicked()
 | 
			
		|||
                    bool cancelled = false;
 | 
			
		||||
                    QStringList cols;
 | 
			
		||||
 | 
			
		||||
                    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    QList<MessageQueue*> *aisMessageQueues = messagePipes.getMessageQueues(m_aisDemod, "ais");
 | 
			
		||||
 | 
			
		||||
                    while (!cancelled && CSV::readRow(in, &cols))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -867,7 +867,7 @@ void APTDemodGUI::on_deleteImageFromMap_clicked()
 | 
			
		|||
 | 
			
		||||
void APTDemodGUI::deleteImageFromMap(const QString &name)
 | 
			
		||||
{
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aptDemod, "mapitems");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -661,7 +661,7 @@ void APTDemodImageWorker::makeTransparent(QImage &image)
 | 
			
		|||
void APTDemodImageWorker::sendImageToMap(QImage image)
 | 
			
		||||
{
 | 
			
		||||
    // Send to Map feature
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aptDemod, "mapitems");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -220,7 +220,7 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
 | 
			
		|||
                }
 | 
			
		||||
 | 
			
		||||
                // Forward to APRS and other packet features
 | 
			
		||||
                MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                QList<MessageQueue*> *packetMessageQueues = messagePipes.getMessageQueues(this, "packets");
 | 
			
		||||
                if (packetMessageQueues)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -156,7 +156,7 @@ bool PacketDemod::handleMessage(const Message& cmd)
 | 
			
		|||
            getMessageQueueToGUI()->push(msg);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
 | 
			
		||||
        // Forward to APRS and other packet features
 | 
			
		||||
        QList<MessageQueue*> *packetMessageQueues = messagePipes.getMessageQueues(this, "packets");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1908,7 +1908,7 @@ void RadioAstronomyGUI::on_powerTable_cellDoubleClicked(int row, int column)
 | 
			
		|||
    if ((column >= POWER_COL_RA) && (column >= POWER_COL_EL))
 | 
			
		||||
    {
 | 
			
		||||
        // Display target in Star Tracker
 | 
			
		||||
        MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
 | 
			
		||||
        if (messageQueues)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -4276,7 +4276,7 @@ void RadioAstronomyGUI::showLoSMarker(int row)
 | 
			
		|||
void RadioAstronomyGUI::updateLoSMarker(const QString& name, float l, float b, float d)
 | 
			
		||||
{
 | 
			
		||||
    // Send to Star Tracker
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
 | 
			
		||||
    if (messageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -4678,7 +4678,7 @@ void RadioAstronomyGUI::on_spectrumIndex_valueChanged(int value)
 | 
			
		|||
        ui->powerTable->scrollTo(ui->powerTable->model()->index(value, 0));
 | 
			
		||||
        ui->spectrumDateTime->setDateTime(m_fftMeasurements[value]->m_dateTime);
 | 
			
		||||
        // Display target in Star Tracker
 | 
			
		||||
        MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
        QList<MessageQueue*> *messageQueues = messagePipes.getMessageQueues(m_radioAstronomy, "startracker.display");
 | 
			
		||||
        if (messageQueues)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,11 +138,11 @@ bool AFC::handleMessage(const Message& cmd)
 | 
			
		|||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    else if (MessagePipesCommon::MsgReportChannelDeleted::match(cmd))
 | 
			
		||||
    else if (MessagePipesLegacyCommon::MsgReportChannelDeleted::match(cmd))
 | 
			
		||||
    {
 | 
			
		||||
        qDebug() << "AFC::handleMessage: MessagePipesCommon::MsgReportChannelDeleted";
 | 
			
		||||
        MessagePipesCommon::MsgReportChannelDeleted& report = (MessagePipesCommon::MsgReportChannelDeleted&) cmd;
 | 
			
		||||
        const MessagePipesCommon::ChannelRegistrationKey& channelKey = report.getChannelRegistrationKey();
 | 
			
		||||
        qDebug() << "AFC::handleMessage: MessagePipesLegacyCommon::MsgReportChannelDeleted";
 | 
			
		||||
        MessagePipesLegacyCommon::MsgReportChannelDeleted& report = (MessagePipesLegacyCommon::MsgReportChannelDeleted&) cmd;
 | 
			
		||||
        const MessagePipesLegacyCommon::ChannelRegistrationKey& channelKey = report.getChannelRegistrationKey();
 | 
			
		||||
        MainCore::instance()->getMessagePipes().unregisterChannelToFeature(channelKey.m_key, this, "settings");
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -416,7 +416,7 @@ void AISGUI::sendToMap(const QString &name, const QString &label,
 | 
			
		|||
    float heading
 | 
			
		||||
    )
 | 
			
		||||
{
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_ais, "mapitems");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -337,7 +337,7 @@ bool APRSGUI::handleMessage(const Message& message)
 | 
			
		|||
                }
 | 
			
		||||
 | 
			
		||||
                // Forward to map
 | 
			
		||||
                MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aprs, "mapitems");
 | 
			
		||||
                if (mapMessageQueues)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -272,7 +272,7 @@ void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool fo
 | 
			
		|||
void DemodAnalyzer::updateChannels()
 | 
			
		||||
{
 | 
			
		||||
    MainCore *mainCore = MainCore::instance();
 | 
			
		||||
    // MessagePipes& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    // MessagePipesLegacy& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    std::vector<DeviceSet*>& deviceSets = mainCore->getDeviceSets();
 | 
			
		||||
    std::vector<DeviceSet*>::const_iterator it = deviceSets.begin();
 | 
			
		||||
    m_availableChannels.clear();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -203,7 +203,7 @@ void JogdialController::applySettings(const JogdialControllerSettings& settings,
 | 
			
		|||
void JogdialController::updateChannels()
 | 
			
		||||
{
 | 
			
		||||
    MainCore *mainCore = MainCore::instance();
 | 
			
		||||
    // MessagePipes& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    // MessagePipesLegacy& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    std::vector<DeviceSet*>& deviceSets = mainCore->getDeviceSets();
 | 
			
		||||
    std::vector<DeviceSet*>::const_iterator it = deviceSets.begin();
 | 
			
		||||
    m_availableChannels.clear();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@
 | 
			
		|||
#include <QGeoRectangle>
 | 
			
		||||
 | 
			
		||||
#include "channel/channelwebapiutils.h"
 | 
			
		||||
#include "pipes/messagepipes.h"
 | 
			
		||||
#include "pipes/messagepipeslegacy.h"
 | 
			
		||||
#include "maincore.h"
 | 
			
		||||
 | 
			
		||||
#include "mapmodel.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -358,7 +358,7 @@ void MapModel::updateTarget()
 | 
			
		|||
    azEl->calculate();
 | 
			
		||||
 | 
			
		||||
    // Send to Rotator Controllers
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_gui->getMap(), "target");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -234,7 +234,7 @@ void SatelliteTrackerWorker::applySettings(const SatelliteTrackerSettings& setti
 | 
			
		|||
 | 
			
		||||
void SatelliteTrackerWorker::removeFromMap(QString id)
 | 
			
		||||
{
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_satelliteTracker, "mapitems");
 | 
			
		||||
    if (mapMessageQueues)
 | 
			
		||||
        sendToMap(mapMessageQueues, id, "", "", "", 0.0f, 0.0, 0.0, 0.0, 0.0, nullptr, nullptr, nullptr, nullptr);
 | 
			
		||||
| 
						 | 
				
			
			@ -405,7 +405,7 @@ void SatelliteTrackerWorker::update()
 | 
			
		|||
                        azimuth = std::fmod(azimuth + 180.0, 360.0);
 | 
			
		||||
                        elevation = 180.0 - elevation;
 | 
			
		||||
                    }
 | 
			
		||||
                    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    QList<MessageQueue*> *rotatorMessageQueues = messagePipes.getMessageQueues(m_satelliteTracker, "target");
 | 
			
		||||
                    if (rotatorMessageQueues)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -425,7 +425,7 @@ void SatelliteTrackerWorker::update()
 | 
			
		|||
                // Send to Map
 | 
			
		||||
                if (m_settings.m_drawOnMap)
 | 
			
		||||
                {
 | 
			
		||||
                    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
                    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_satelliteTracker, "mapitems");
 | 
			
		||||
                    if (mapMessageQueues)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -407,7 +407,7 @@ void StarTrackerWorker::updateRaDec(RADec rd, QDateTime dt, bool lbTarget)
 | 
			
		|||
 | 
			
		||||
void StarTrackerWorker::removeFromMap(QString id)
 | 
			
		||||
{
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
 | 
			
		||||
    if (mapMessageQueues) {
 | 
			
		||||
        sendToMap(mapMessageQueues, id, "", "", 0.0, 0.0);
 | 
			
		||||
| 
						 | 
				
			
			@ -580,7 +580,7 @@ void StarTrackerWorker::update()
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipes();
 | 
			
		||||
    QList<MessageQueue*>* messageQueues;
 | 
			
		||||
 | 
			
		||||
    // Send Az/El to Rotator Controllers
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -170,10 +170,10 @@ set(sdrbase_SOURCES
 | 
			
		|||
    pipes/datafifostore.cpp
 | 
			
		||||
    pipes/datapipes.cpp
 | 
			
		||||
    pipes/datapipesgcworker.cpp
 | 
			
		||||
    pipes/messagepipes.cpp
 | 
			
		||||
    pipes/messagepipeslegacy.cpp
 | 
			
		||||
    pipes/messagepipes2.cpp
 | 
			
		||||
    pipes/messagepipescommon.cpp
 | 
			
		||||
    pipes/messagepipesgcworker.cpp
 | 
			
		||||
    pipes/messagepipeslegacycommon.cpp
 | 
			
		||||
    pipes/messagepipeslegacygcworker.cpp
 | 
			
		||||
    pipes/messagepipes2gcworker.cpp
 | 
			
		||||
    pipes/messagequeuestore.cpp
 | 
			
		||||
    pipes/pipeendpoint.cpp
 | 
			
		||||
| 
						 | 
				
			
			@ -381,10 +381,10 @@ set(sdrbase_HEADERS
 | 
			
		|||
    pipes/datapipesgcworker.h
 | 
			
		||||
    pipes/elementpipescommon.h
 | 
			
		||||
    pipes/elementpipesgc.h
 | 
			
		||||
    pipes/messagepipes.h
 | 
			
		||||
    pipes/messagepipeslegacy.h
 | 
			
		||||
    pipes/messagepipes2.h
 | 
			
		||||
    pipes/messagepipescommon.h
 | 
			
		||||
    pipes/messagepipesgcworker.h
 | 
			
		||||
    pipes/messagepipeslegacycommon.h
 | 
			
		||||
    pipes/messagepipeslegacygcworker.h
 | 
			
		||||
    pipes/messagepipes2gcworker.h
 | 
			
		||||
    pipes/messagequeuestore.h
 | 
			
		||||
    pipes/pipeendpoint.h
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@
 | 
			
		|||
#include "export.h"
 | 
			
		||||
#include "settings/mainsettings.h"
 | 
			
		||||
#include "util/message.h"
 | 
			
		||||
#include "pipes/messagepipes.h"
 | 
			
		||||
#include "pipes/messagepipeslegacy.h"
 | 
			
		||||
#include "pipes/messagepipes2.h"
 | 
			
		||||
#include "pipes/datapipes.h"
 | 
			
		||||
#include "channel/channelapi.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -731,7 +731,7 @@ public:
 | 
			
		|||
    void removeFeatureInstance(Feature *feature);
 | 
			
		||||
    void clearFeatures(FeatureSet *featureSet);
 | 
			
		||||
    // pipes
 | 
			
		||||
    MessagePipes& getMessagePipes() { return m_messagePipes; }
 | 
			
		||||
    MessagePipesLegacy& getMessagePipes() { return m_messagePipes; }
 | 
			
		||||
    MessagePipes2& getMessagePipes2() { return m_messagePipes2; }
 | 
			
		||||
    DataPipes& getDataPipes() { return m_dataPipes; }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -752,7 +752,7 @@ private:
 | 
			
		|||
    QMap<ChannelAPI*, DeviceSet*> m_channelsMap; //!< Channel to device set map
 | 
			
		||||
    QMap<Feature*, FeatureSet*> m_featuresMap;   //!< Feature to feature set map
 | 
			
		||||
    PluginManager* m_pluginManager;
 | 
			
		||||
    MessagePipes m_messagePipes;
 | 
			
		||||
    MessagePipesLegacy m_messagePipes;
 | 
			
		||||
    MessagePipes2 m_messagePipes2;
 | 
			
		||||
    DataPipes m_dataPipes;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,13 +19,13 @@
 | 
			
		|||
 | 
			
		||||
#include "util/messagequeue.h"
 | 
			
		||||
 | 
			
		||||
#include "messagepipesgcworker.h"
 | 
			
		||||
#include "messagepipes.h"
 | 
			
		||||
#include "messagepipeslegacygcworker.h"
 | 
			
		||||
#include "messagepipeslegacy.h"
 | 
			
		||||
#include "pipeendpoint.h"
 | 
			
		||||
 | 
			
		||||
MessagePipes::MessagePipes()
 | 
			
		||||
MessagePipesLegacy::MessagePipesLegacy()
 | 
			
		||||
{
 | 
			
		||||
	m_gcWorker = new MessagePipesGCWorker();
 | 
			
		||||
	m_gcWorker = new MessagePipesLegacyGCWorker();
 | 
			
		||||
	m_gcWorker->setC2FRegistrations(
 | 
			
		||||
		m_registrations.getMutex(),
 | 
			
		||||
		m_registrations.getElements(),
 | 
			
		||||
| 
						 | 
				
			
			@ -35,43 +35,43 @@ MessagePipes::MessagePipes()
 | 
			
		|||
	startGC();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MessagePipes::~MessagePipes()
 | 
			
		||||
MessagePipesLegacy::~MessagePipesLegacy()
 | 
			
		||||
{
 | 
			
		||||
	if (m_gcWorker->isRunning()) {
 | 
			
		||||
		stopGC();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MessageQueue *MessagePipes::registerChannelToFeature(const PipeEndPoint *source, PipeEndPoint *dest, const QString& type)
 | 
			
		||||
MessageQueue *MessagePipesLegacy::registerChannelToFeature(const PipeEndPoint *source, PipeEndPoint *dest, const QString& type)
 | 
			
		||||
{
 | 
			
		||||
	qDebug("MessagePipes::registerChannelToFeature: %p %p %s", source, dest, qPrintable(type));
 | 
			
		||||
	qDebug("MessagePipesLegacy::registerChannelToFeature: %p %p %s", source, dest, qPrintable(type));
 | 
			
		||||
	return m_registrations.registerProducerToConsumer(source, dest, type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MessageQueue *MessagePipes::unregisterChannelToFeature(const PipeEndPoint *source, PipeEndPoint *dest, const QString& type)
 | 
			
		||||
MessageQueue *MessagePipesLegacy::unregisterChannelToFeature(const PipeEndPoint *source, PipeEndPoint *dest, const QString& type)
 | 
			
		||||
{
 | 
			
		||||
	qDebug("MessagePipes::unregisterChannelToFeature: %p %p %s", source, dest, qPrintable(type));
 | 
			
		||||
	qDebug("MessagePipesLegacy::unregisterChannelToFeature: %p %p %s", source, dest, qPrintable(type));
 | 
			
		||||
	MessageQueue *messageQueue = m_registrations.unregisterProducerToConsumer(source, dest, type);
 | 
			
		||||
	m_gcWorker->addMessageQueueToDelete(messageQueue);
 | 
			
		||||
	return messageQueue;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<MessageQueue*>* MessagePipes::getMessageQueues(const PipeEndPoint *source, const QString& type)
 | 
			
		||||
QList<MessageQueue*>* MessagePipesLegacy::getMessageQueues(const PipeEndPoint *source, const QString& type)
 | 
			
		||||
{
 | 
			
		||||
	qDebug("MessagePipes::getMessageQueues: %p %s", source, qPrintable(type));
 | 
			
		||||
	qDebug("MessagePipesLegacy::getMessageQueues: %p %s", source, qPrintable(type));
 | 
			
		||||
	return m_registrations.getElements(source, type);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipes::startGC()
 | 
			
		||||
void MessagePipesLegacy::startGC()
 | 
			
		||||
{
 | 
			
		||||
	qDebug("MessagePipes::startGC");
 | 
			
		||||
	qDebug("MessagePipesLegacy::startGC");
 | 
			
		||||
    m_gcWorker->startWork();
 | 
			
		||||
    m_gcThread.start();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipes::stopGC()
 | 
			
		||||
void MessagePipesLegacy::stopGC()
 | 
			
		||||
{
 | 
			
		||||
    qDebug("MessagePipes::stopGC");
 | 
			
		||||
    qDebug("MessagePipesLegacy::stopGC");
 | 
			
		||||
	m_gcWorker->stopWork();
 | 
			
		||||
	m_gcThread.quit();
 | 
			
		||||
	m_gcThread.wait();
 | 
			
		||||
| 
						 | 
				
			
			@ -15,8 +15,8 @@
 | 
			
		|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPES_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPES_H_
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPESLEGACY_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPESLEGACY_H_
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QHash>
 | 
			
		||||
| 
						 | 
				
			
			@ -26,21 +26,21 @@
 | 
			
		|||
 | 
			
		||||
#include "export.h"
 | 
			
		||||
 | 
			
		||||
#include "messagepipescommon.h"
 | 
			
		||||
#include "messagepipeslegacycommon.h"
 | 
			
		||||
#include "elementpipesregistrations.h"
 | 
			
		||||
 | 
			
		||||
class PipeEndPoint;
 | 
			
		||||
class MessagePipesGCWorker;
 | 
			
		||||
class MessagePipesLegacyGCWorker;
 | 
			
		||||
class MessageQueue;
 | 
			
		||||
 | 
			
		||||
class SDRBASE_API MessagePipes : public QObject
 | 
			
		||||
class SDRBASE_API MessagePipesLegacy : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    MessagePipes();
 | 
			
		||||
    MessagePipes(const MessagePipes&) = delete;
 | 
			
		||||
    MessagePipes& operator=(const MessagePipes&) = delete;
 | 
			
		||||
    ~MessagePipes();
 | 
			
		||||
    MessagePipesLegacy();
 | 
			
		||||
    MessagePipesLegacy(const MessagePipesLegacy&) = delete;
 | 
			
		||||
    MessagePipesLegacy& operator=(const MessagePipesLegacy&) = delete;
 | 
			
		||||
    ~MessagePipesLegacy();
 | 
			
		||||
 | 
			
		||||
    // FIXME: Names of these functions should probably change, as we now support channel or feature at either end
 | 
			
		||||
    MessageQueue *registerChannelToFeature(const PipeEndPoint *source, PipeEndPoint *dest, const QString& type);
 | 
			
		||||
| 
						 | 
				
			
			@ -50,10 +50,10 @@ public:
 | 
			
		|||
private:
 | 
			
		||||
    ElementPipesRegistrations<PipeEndPoint, PipeEndPoint, MessageQueue> m_registrations;
 | 
			
		||||
    QThread m_gcThread; //!< Garbage collector thread
 | 
			
		||||
    MessagePipesGCWorker *m_gcWorker; //!< Garbage collector
 | 
			
		||||
    MessagePipesLegacyGCWorker *m_gcWorker; //!< Garbage collector
 | 
			
		||||
 | 
			
		||||
	void startGC(); //!< Start garbage collector
 | 
			
		||||
	void stopGC();  //!< Stop garbage collector
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SDRBASE_PIPES_MESSAGEPIPES_H_
 | 
			
		||||
#endif // SDRBASE_PIPES_MESSAGEPIPESLEGACY_H_
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,6 @@
 | 
			
		|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#include "messagepipescommon.h"
 | 
			
		||||
#include "messagepipeslegacycommon.h"
 | 
			
		||||
 | 
			
		||||
MESSAGE_CLASS_DEFINITION(MessagePipesCommon::MsgReportChannelDeleted, Message)
 | 
			
		||||
MESSAGE_CLASS_DEFINITION(MessagePipesLegacyCommon::MsgReportChannelDeleted, Message)
 | 
			
		||||
| 
						 | 
				
			
			@ -15,8 +15,8 @@
 | 
			
		|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPESCOMON_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPESCOMON_H_
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPESLEGACYCOMON_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPESLEGACYCOMON_H_
 | 
			
		||||
 | 
			
		||||
#include <QHash>
 | 
			
		||||
#include <QMap>
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
class PipeEndPoint;
 | 
			
		||||
class MessageQueue;
 | 
			
		||||
 | 
			
		||||
class SDRBASE_API MessagePipesCommon
 | 
			
		||||
class SDRBASE_API MessagePipesLegacyCommon
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    typedef ElementPipesCommon::RegistrationKey<PipeEndPoint> ChannelRegistrationKey;
 | 
			
		||||
| 
						 | 
				
			
			@ -58,4 +58,4 @@ public:
 | 
			
		|||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SDRBASE_PIPES_MESSAGEPIPESCOMON_H_
 | 
			
		||||
#endif // SDRBASE_PIPES_MESSAGEPIPESLEGACYCOMON_H_
 | 
			
		||||
| 
						 | 
				
			
			@ -19,50 +19,50 @@
 | 
			
		|||
#include "feature/feature.h"
 | 
			
		||||
#include "util/messagequeue.h"
 | 
			
		||||
#include "maincore.h"
 | 
			
		||||
#include "messagepipescommon.h"
 | 
			
		||||
#include "messagepipesgcworker.h"
 | 
			
		||||
#include "messagepipeslegacycommon.h"
 | 
			
		||||
#include "messagepipeslegacygcworker.h"
 | 
			
		||||
 | 
			
		||||
bool MessagePipesGCWorker::MessagePipesGC::existsProducer(const PipeEndPoint *pipeEndPoint)
 | 
			
		||||
bool MessagePipesLegacyGCWorker::MessagePipesGC::existsProducer(const PipeEndPoint *pipeEndPoint)
 | 
			
		||||
{
 | 
			
		||||
    return MainCore::instance()->existsChannel((const ChannelAPI *)pipeEndPoint)
 | 
			
		||||
        || MainCore::instance()->existsFeature((const Feature *)pipeEndPoint);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MessagePipesGCWorker::MessagePipesGC::existsConsumer(const PipeEndPoint *pipeEndPoint)
 | 
			
		||||
bool MessagePipesLegacyGCWorker::MessagePipesGC::existsConsumer(const PipeEndPoint *pipeEndPoint)
 | 
			
		||||
{
 | 
			
		||||
    return MainCore::instance()->existsChannel((const ChannelAPI *)pipeEndPoint)
 | 
			
		||||
        || MainCore::instance()->existsFeature((const Feature *)pipeEndPoint);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipesGCWorker::MessagePipesGC::sendMessageToConsumer(
 | 
			
		||||
void MessagePipesLegacyGCWorker::MessagePipesGC::sendMessageToConsumer(
 | 
			
		||||
    const MessageQueue *,
 | 
			
		||||
    MessagePipesCommon::ChannelRegistrationKey,
 | 
			
		||||
    MessagePipesLegacyCommon::ChannelRegistrationKey,
 | 
			
		||||
    PipeEndPoint *)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MessagePipesGCWorker::MessagePipesGCWorker() :
 | 
			
		||||
MessagePipesLegacyGCWorker::MessagePipesLegacyGCWorker() :
 | 
			
		||||
    m_running(false)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
MessagePipesGCWorker::~MessagePipesGCWorker()
 | 
			
		||||
MessagePipesLegacyGCWorker::~MessagePipesLegacyGCWorker()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void MessagePipesGCWorker::startWork()
 | 
			
		||||
void MessagePipesLegacyGCWorker::startWork()
 | 
			
		||||
{
 | 
			
		||||
    connect(&m_gcTimer, SIGNAL(timeout()), this, SLOT(processGC()));
 | 
			
		||||
    m_gcTimer.start(10000); // collect garbage every 10s
 | 
			
		||||
    m_running = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipesGCWorker::stopWork()
 | 
			
		||||
void MessagePipesLegacyGCWorker::stopWork()
 | 
			
		||||
{
 | 
			
		||||
    m_running = false;
 | 
			
		||||
    m_gcTimer.stop();
 | 
			
		||||
    disconnect(&m_gcTimer, SIGNAL(timeout()), this, SLOT(processGC()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipesGCWorker::addMessageQueueToDelete(MessageQueue *messageQueue)
 | 
			
		||||
void MessagePipesLegacyGCWorker::addMessageQueueToDelete(MessageQueue *messageQueue)
 | 
			
		||||
{
 | 
			
		||||
    if (messageQueue)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ void MessagePipesGCWorker::addMessageQueueToDelete(MessageQueue *messageQueue)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MessagePipesGCWorker::processGC()
 | 
			
		||||
void MessagePipesLegacyGCWorker::processGC()
 | 
			
		||||
{
 | 
			
		||||
    // qDebug("MessagePipesGCWorker::processGC");
 | 
			
		||||
    // qDebug("MessagePipesLegacyGCWorker::processGC");
 | 
			
		||||
    m_messagePipesGC.processGC();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -15,30 +15,30 @@
 | 
			
		|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPESGCWORKER_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPESGCWORKER_H_
 | 
			
		||||
#ifndef SDRBASE_PIPES_MESSAGEPIPESLEGACYGCWORKER_H_
 | 
			
		||||
#define SDRBASE_PIPES_MESSAGEPIPESLEGACYGCWORKER_H_
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
 | 
			
		||||
#include "export.h"
 | 
			
		||||
 | 
			
		||||
#include "messagepipescommon.h"
 | 
			
		||||
#include "messagepipeslegacycommon.h"
 | 
			
		||||
#include "elementpipesgc.h"
 | 
			
		||||
 | 
			
		||||
class QMutex;
 | 
			
		||||
 | 
			
		||||
class SDRBASE_API MessagePipesGCWorker : public QObject
 | 
			
		||||
class SDRBASE_API MessagePipesLegacyGCWorker : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    MessagePipesGCWorker();
 | 
			
		||||
    ~MessagePipesGCWorker();
 | 
			
		||||
    MessagePipesLegacyGCWorker();
 | 
			
		||||
    ~MessagePipesLegacyGCWorker();
 | 
			
		||||
 | 
			
		||||
    void setC2FRegistrations(
 | 
			
		||||
        QMutex *c2fMutex,
 | 
			
		||||
        QMap<MessagePipesCommon::ChannelRegistrationKey, QList<MessageQueue*>> *c2fQueues,
 | 
			
		||||
        QMap<MessagePipesCommon::ChannelRegistrationKey, QList<PipeEndPoint*>> *c2fPipeEndPoints
 | 
			
		||||
        QMap<MessagePipesLegacyCommon::ChannelRegistrationKey, QList<MessageQueue*>> *c2fQueues,
 | 
			
		||||
        QMap<MessagePipesLegacyCommon::ChannelRegistrationKey, QList<PipeEndPoint*>> *c2fPipeEndPoints
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        m_messagePipesGC.setRegistrations(c2fMutex, c2fQueues, c2fPipeEndPoints);
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ private:
 | 
			
		|||
    private:
 | 
			
		||||
        virtual bool existsProducer(const PipeEndPoint *pipeEndPoint);
 | 
			
		||||
        virtual bool existsConsumer(const PipeEndPoint *pipeEndPoint);
 | 
			
		||||
        virtual void sendMessageToConsumer(const MessageQueue *messageQueue, MessagePipesCommon::ChannelRegistrationKey key, PipeEndPoint *pipeEndPoint);
 | 
			
		||||
        virtual void sendMessageToConsumer(const MessageQueue *messageQueue, MessagePipesLegacyCommon::ChannelRegistrationKey key, PipeEndPoint *pipeEndPoint);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    MessagePipesGC m_messagePipesGC;
 | 
			
		||||
| 
						 | 
				
			
			@ -66,4 +66,4 @@ private slots:
 | 
			
		|||
    void processGC(); //!< Collect garbage
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
#endif // SDRBASE_PIPES_MESSAGEPIPESLEGACYGCWORKER_H_
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ MESSAGE_CLASS_DEFINITION(PipeEndPoint::MsgReportPipes, Message)
 | 
			
		|||
QList<PipeEndPoint::AvailablePipeSource> PipeEndPoint::updateAvailablePipeSources(QString pipeName, QStringList pipeTypes, QStringList pipeURIs, PipeEndPoint *destination)
 | 
			
		||||
{
 | 
			
		||||
    MainCore *mainCore = MainCore::instance();
 | 
			
		||||
    MessagePipes& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    MessagePipesLegacy& messagePipes = mainCore->getMessagePipes();
 | 
			
		||||
    std::vector<DeviceSet*>& deviceSets = mainCore->getDeviceSets();
 | 
			
		||||
    QHash<PipeEndPoint *, AvailablePipeSource> availablePipes;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue