1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 08:24:43 -04:00

Add support for message pipes from features to channels

This commit is contained in:
Jon Beniston
2021-10-12 11:18:29 +01:00
parent cddc8c9b83
commit 05fce637bc
8 changed files with 95 additions and 42 deletions
+14 -7
View File
@@ -24,26 +24,33 @@
bool MessagePipesGCWorker::MessagePipesGC::existsProducer(const PipeEndPoint *pipeEndPoint)
{
// Not overly sure about casting to both types here, but currently safeish as the
// existing functions only use the pointer address - and I presume these
// may be pointers to deleted objects anyway?
return MainCore::instance()->existsChannel((const ChannelAPI *)pipeEndPoint)
|| MainCore::instance()->existsFeature((const Feature *)pipeEndPoint);
}
bool MessagePipesGCWorker::MessagePipesGC::existsConsumer(const Feature *feature)
bool MessagePipesGCWorker::MessagePipesGC::existsConsumer(const PipeEndPoint *pipeEndPoint)
{
return MainCore::instance()->existsFeature(feature);
return MainCore::instance()->existsChannel((const ChannelAPI *)pipeEndPoint)
|| MainCore::instance()->existsFeature((const Feature *)pipeEndPoint);
}
void MessagePipesGCWorker::MessagePipesGC::sendMessageToConsumer(
const MessageQueue *messageQueue,
MessagePipesCommon::ChannelRegistrationKey channelKey,
Feature *feature)
PipeEndPoint *pipeEndPoint)
{
MessagePipesCommon::MsgReportChannelDeleted *msg = MessagePipesCommon::MsgReportChannelDeleted::create(
messageQueue, channelKey);
feature->getInputMessageQueue()->push(msg);
if (MainCore::instance()->existsFeature((const Feature *)pipeEndPoint)) // Use RTTI instead?
{
Feature *feature = (Feature *)pipeEndPoint;
feature->getInputMessageQueue()->push(msg);
}
else
{
ChannelAPI *channel = (ChannelAPI *)pipeEndPoint;
channel->getChannelMessageQueue()->push(msg);
}
}
MessagePipesGCWorker::MessagePipesGCWorker() :