From c90d04e4b69d8aa6a55b0629f83b0f5d1d570692 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 27 Feb 2022 19:26:18 +0100 Subject: [PATCH] AFC: more debug messages --- plugins/feature/afc/afc.cpp | 56 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/plugins/feature/afc/afc.cpp b/plugins/feature/afc/afc.cpp index 68ba2456f..e5a0d8679 100644 --- a/plugins/feature/afc/afc.cpp +++ b/plugins/feature/afc/afc.cpp @@ -637,14 +637,20 @@ void AFC::trackerDeviceChange(int deviceIndex) if (channel->getURI() == "sdrangel.channel.freqtracker") { - MessageQueue *messageQueue = mainCore->getMessagePipes().registerChannelToFeature(channel, this, "settings"); - QObject::connect( - messageQueue, - &MessageQueue::messageEnqueued, - this, - [=](){ this->handleChannelMessageQueue(messageQueue); }, - Qt::QueuedConnection - ); + ObjectPipe *pipe = mainCore->getMessagePipes2().registerProducerToConsumer(channel, this, "settings"); + MessageQueue *messageQueue = qobject_cast(pipe->m_element); + + if (messageQueue) + { + QObject::connect( + messageQueue, + &MessageQueue::messageEnqueued, + this, + [=](){ this->handleChannelMessageQueue(messageQueue); }, + Qt::QueuedConnection + ); + } + m_trackerChannelAPI = channel; break; } @@ -668,15 +674,20 @@ void AFC::trackedDeviceChange(int deviceIndex) if (channel->getURI() != "sdrangel.channel.freqtracker") { - MessageQueue *messageQueue = mainCore->getMessagePipes().registerChannelToFeature(channel, this, "settings"); - QObject::connect( - messageQueue, - &MessageQueue::messageEnqueued, - this, - [=](){ this->handleChannelMessageQueue(messageQueue); }, - Qt::QueuedConnection - ); - m_trackerIndexInDeviceSet = i; + ObjectPipe *pipe = mainCore->getMessagePipes2().registerProducerToConsumer(channel, this, "settings"); + MessageQueue *messageQueue = qobject_cast(pipe->m_element); + + if (messageQueue) + { + QObject::connect( + messageQueue, + &MessageQueue::messageEnqueued, + this, + [=](){ this->handleChannelMessageQueue(messageQueue); }, + Qt::QueuedConnection + ); + m_trackerIndexInDeviceSet = i; + } } } } @@ -688,9 +699,12 @@ void AFC::removeTrackerFeatureReference() if (MainCore::instance()->existsChannel(m_trackerChannelAPI)) { qDebug("AFC::removeTrackerFeatureReference: m_trackerChannelAPI: %s", qPrintable(m_trackerChannelAPI->objectName())); - MessageQueue *messageQueue - = MainCore::instance()->getMessagePipes().unregisterChannelToFeature(m_trackerChannelAPI, this, "settings"); - disconnect(messageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleChannelMessageQueue(MessageQueue*))); + ObjectPipe *pipe = MainCore::instance()->getMessagePipes2().unregisterProducerToConsumer(m_trackerChannelAPI, this, "settings"); + MessageQueue *messageQueue = qobject_cast(pipe->m_element); + + if (messageQueue) { + disconnect(messageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleChannelMessageQueue(MessageQueue*))); + } } } } @@ -704,7 +718,7 @@ void AFC::removeTrackedFeatureReferences() if (MainCore::instance()->existsChannel(channel)) { qDebug("AFC::removeTrackedFeatureReferences: channel: %s", qPrintable(channel->objectName())); - MainCore::instance()->getMessagePipes().unregisterChannelToFeature(channel, this, "settings"); + MainCore::instance()->getMessagePipes2().unregisterProducerToConsumer(channel, this, "settings"); } }