From 3f7d297fbe64c4075369ea017c158973e50c632d Mon Sep 17 00:00:00 2001 From: KingfuChan-MacPD Date: Wed, 1 Mar 2023 20:08:40 +0800 Subject: [PATCH] configurations by command line --- RDFPlugin.sln | 6 --- RDFPlugin/CRDFPlugin.cpp | 84 +++++++++++++++++++++++++++++++++++++--- RDFPlugin/CRDFPlugin.h | 4 +- 3 files changed, 81 insertions(+), 13 deletions(-) diff --git a/RDFPlugin.sln b/RDFPlugin.sln index e912c1f..8eff6be 100644 --- a/RDFPlugin.sln +++ b/RDFPlugin.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.5.33318.248 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RDFPlugin", "RDFPlugin\RDFPlugin.vcxproj", "{E824C656-49CA-4816-92E1-EFA3EFBBBE5D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RDFTester", "RDFTester\RDFTester.vcxproj", "{CBD135B9-058B-4242-A5D7-0163227460F2}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 @@ -17,10 +15,6 @@ Global {E824C656-49CA-4816-92E1-EFA3EFBBBE5D}.Debug|x86.Build.0 = Debug|Win32 {E824C656-49CA-4816-92E1-EFA3EFBBBE5D}.Release|x86.ActiveCfg = Release|Win32 {E824C656-49CA-4816-92E1-EFA3EFBBBE5D}.Release|x86.Build.0 = Release|Win32 - {CBD135B9-058B-4242-A5D7-0163227460F2}.Debug|x86.ActiveCfg = Debug|Win32 - {CBD135B9-058B-4242-A5D7-0163227460F2}.Debug|x86.Build.0 = Debug|Win32 - {CBD135B9-058B-4242-A5D7-0163227460F2}.Release|x86.ActiveCfg = Release|Win32 - {CBD135B9-058B-4242-A5D7-0163227460F2}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RDFPlugin/CRDFPlugin.cpp b/RDFPlugin/CRDFPlugin.cpp index b69c05d..df002da 100644 --- a/RDFPlugin/CRDFPlugin.cpp +++ b/RDFPlugin/CRDFPlugin.cpp @@ -222,7 +222,7 @@ void CRDFPlugin::LoadSettings(void) if (cstrTimeout != NULL) { int parsedTimeout = atoi(cstrTimeout); - if (parsedTimeout > 0 && parsedTimeout < 1000) { + if (parsedTimeout > 100 && parsedTimeout < 1000) { connectionTimeout = parsedTimeout; DisplayEuroScopeDebugMessage(string("Timeout: ") + to_string(connectionTimeout)); } @@ -232,7 +232,7 @@ void CRDFPlugin::LoadSettings(void) if (cstrInterval != NULL) { int parsedInterval = atoi(cstrInterval); - if (parsedInterval > 0 && parsedInterval < 1000) { + if (parsedInterval > 1) { retryInterval = parsedInterval; DisplayEuroScopeDebugMessage(string("Interval: ") + to_string(retryInterval)); } @@ -331,9 +331,83 @@ bool CRDFPlugin::OnCompileCommand(const char* sCommandLine) for (auto& c : cmd) { c += c >= 'a' && c <= 'z' ? 'A' - 'a' : 0; // make upper } - if (cmd == ".RDF RELOAD") { - LoadSettings(); - return true; + try + { + + if (cmd == ".RDF RELOAD") { + LoadSettings(); + return true; + } + + char bufferAddr[128] = { 0 }; + if (sscanf_s(cmd.c_str(), ".RDF ADDRESS %s", bufferAddr, sizeof(bufferAddr))) { + addressVectorAudio = string(bufferAddr); + DisplayEuroScopeDebugMessage(string("Address: ") + addressVectorAudio); + return true; + } + + int bufferTimeout; + if (sscanf_s(cmd.c_str(), ".RDF TIMEOUT %d", &bufferTimeout)) { + if (bufferTimeout > 100 && bufferTimeout < 1000) { + connectionTimeout = bufferTimeout; + DisplayEuroScopeDebugMessage(string("Timeout: ") + to_string(connectionTimeout)); + return true; + } + } + + int bufferInterval; + if (sscanf_s(cmd.c_str(), ".RDF INTERVAL %d", &bufferInterval)) { + if (bufferInterval > 1) { + retryInterval = bufferInterval; + DisplayEuroScopeDebugMessage(string("Interval: ") + to_string(retryInterval)); + return true; + } + } + + char bufferRGB[15] = { 0 }; + if (sscanf_s(cmd.c_str(), ".RDF RGB %s", bufferRGB, sizeof(bufferRGB))) { + GetRGB(rdfRGB, bufferRGB); + return true; + } + else if (sscanf_s(cmd.c_str(), ".RDF CTRGB %s", bufferRGB, sizeof(bufferRGB))) { + GetRGB(rdfConcurrentTransmissionRGB, bufferRGB); + return true; + } + + int bufferRadius; + if (sscanf_s(cmd.c_str(), ".RDF RADIUS %d", &bufferRadius)) { + if (bufferRadius > 0) { + circleRadius = bufferRadius; + DisplayEuroScopeDebugMessage(string("Radius: ") + to_string(circleRadius)); + return true; + } + } + + if (sscanf_s(cmd.c_str(), ".RDF THRESHOLD %d", &circleThreshold)) { + DisplayEuroScopeDebugMessage(string("Threshold: ") + to_string(circleThreshold)); + return true; + } + + int bufferPrecision; + if (sscanf_s(cmd.c_str(), ".RDF PRECISION %d", &bufferPrecision)) { + if (bufferPrecision > 0) { + circlePrecision = bufferPrecision; + DisplayEuroScopeDebugMessage(string("Precision: ") + to_string(circlePrecision)); + return true; + } + } + + int bufferCtrl; + if (sscanf_s(cmd.c_str(), ".RDF CONTROLLER %d", &bufferCtrl)) { + DisplayEuroScopeDebugMessage(string("Draw controllers and observers: ") + to_string(drawController)); + drawController = bufferCtrl; + return true; + } + + } + catch (const std::exception& e) + { + DisplayEuroScopeDebugMessage(e.what()); } return false; } diff --git a/RDFPlugin/CRDFPlugin.h b/RDFPlugin/CRDFPlugin.h index 85d645e..a87debf 100644 --- a/RDFPlugin/CRDFPlugin.h +++ b/RDFPlugin/CRDFPlugin.h @@ -18,8 +18,8 @@ using namespace std; using namespace EuroScopePlugIn; const string MY_PLUGIN_NAME = "RDF Plugin for Euroscope"; -const string MY_PLUGIN_VERSION = "1.3.0"; -const string MY_PLUGIN_DEVELOPER = "Claus Hemberg Joergensen, Kingfu Chan"; +const string MY_PLUGIN_VERSION = "1.3.1"; +const string MY_PLUGIN_DEVELOPER = "Kingfu Chan, Claus Hemberg Joergensen"; const string MY_PLUGIN_COPYRIGHT = "Free to be distributed as source code"; typedef map callsign_position;