From 0d89debbb4723214e0f5c2e5ed5695e440715cef Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 17 Sep 2021 14:50:48 +0100 Subject: [PATCH] UDP button receiver port to Config --- config.cc | 2 ++ config.json.sample | 5 +++++ inputudp.cc | 8 ++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config.cc b/config.cc index fe8a32f..0b46e14 100644 --- a/config.cc +++ b/config.cc @@ -49,6 +49,8 @@ void Config::applyDefaults() insertBool("input", "mod_udp_enabled", true); insertBool("input", "mod_lirc_enabled", false); + insertInt("input_udp", "port", 2000); + insertInt("server-discovery", "prefer-ipv", 6); // Not in config.json.sample - VDR login always sets this diff --git a/config.json.sample b/config.json.sample index 3b97e7f..235127b 100644 --- a/config.json.sample +++ b/config.json.sample @@ -48,6 +48,11 @@ "mod_lirc_enabled": true }, + "input_udp": + { + "port": 2000 + } + "input_lirc": { // input_lirc has no defaults diff --git a/inputudp.cc b/inputudp.cc index 35ea47d..b876512 100644 --- a/inputudp.cc +++ b/inputudp.cc @@ -23,6 +23,7 @@ #endif #include "log.h" +#include "config.h" #include "inputudp.h" @@ -35,9 +36,12 @@ bool InputUDP::init() if (initted) return false; initted = true; log = LogNT::getInstance(); - log->debug(TAG, "Starting InputUDP command server"); + int port = 2000; + Config::getInstance()->getInt("input_udp", "port", port); - if (!udp4.init(2000)) + log->debug(TAG, "Starting InputUDP command server on port {}", port); + + if (!udp4.init(static_cast(port))) { log->debug(TAG, "UDP4 init error"); initted = false; -- 2.39.5