Skip to content

Commit

Permalink
configurations by command line
Browse files Browse the repository at this point in the history
  • Loading branch information
KingfuChan committed Mar 1, 2023
1 parent c4f48cd commit 3f7d297
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 13 deletions.
6 changes: 0 additions & 6 deletions RDFPlugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
84 changes: 79 additions & 5 deletions RDFPlugin/CRDFPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions RDFPlugin/CRDFPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, CPosition> callsign_position;
Expand Down

0 comments on commit 3f7d297

Please sign in to comment.