From 0e1e5f7a0b9a3ce0b83644ac889d1c2cc2916f62 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 24 Aug 2020 23:55:26 +0200 Subject: [PATCH] UDP Source multicast: REST API: implementation --- plugins/channeltx/udpsource/udpsource.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/channeltx/udpsource/udpsource.cpp b/plugins/channeltx/udpsource/udpsource.cpp index 73a99f532..8165c5b15 100644 --- a/plugins/channeltx/udpsource/udpsource.cpp +++ b/plugins/channeltx/udpsource/udpsource.cpp @@ -378,6 +378,12 @@ void UDPSource::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("udpPort")) { settings.m_udpPort = response.getUdpSourceSettings()->getUdpPort(); } + if (channelSettingsKeys.contains("multicastAddress")) { + settings.m_multicastAddress = *response.getUdpSourceSettings()->getMulticastAddress(); + } + if (channelSettingsKeys.contains("multicastJoin")) { + settings.m_multicastJoin = response.getUdpSourceSettings()->getMulticastJoin() != 0; + } if (channelSettingsKeys.contains("title")) { settings.m_title = *response.getUdpSourceSettings()->getTitle(); } @@ -439,6 +445,14 @@ void UDPSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res response.getUdpSourceSettings()->setUdpPort(settings.m_udpPort); + if (response.getUdpSourceSettings()->getMulticastAddress()) { + *response.getUdpSourceSettings()->getMulticastAddress() = settings.m_multicastAddress; + } else { + response.getUdpSourceSettings()->setMulticastAddress(new QString(settings.m_multicastAddress)); + } + + response.getUdpSourceSettings()->setMulticastJoin(settings.m_multicastJoin ? 1 : 0); + if (response.getUdpSourceSettings()->getTitle()) { *response.getUdpSourceSettings()->getTitle() = settings.m_title; } else { @@ -533,6 +547,12 @@ void UDPSource::webapiReverseSendSettings(QList& channelSettingsKeys, c if (channelSettingsKeys.contains("udpPort") || force) { swgUDPSourceSettings->setUdpPort(settings.m_udpPort); } + if (channelSettingsKeys.contains("multicastAddress") || force) { + swgUDPSourceSettings->setMulticastAddress(new QString(settings.m_multicastAddress)); + } + if (channelSettingsKeys.contains("multicastJoin") || force) { + swgUDPSourceSettings->setMulticastJoin(settings.m_multicastJoin ? 1 : 0); + } if (channelSettingsKeys.contains("title") || force) { swgUDPSourceSettings->setTitle(new QString(settings.m_title)); }