From f4a6dc8f26f51b6f4a5b119743b0c5c99ee0fa83 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Sun, 16 Mar 2025 18:27:22 +0000 Subject: [PATCH 01/17] Draft Changes to Test This builds, need to Test. #2 #9 --- vSMR/Constant.hpp | 5 +++-- vSMR/SMRPlugin.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/vSMR/Constant.hpp b/vSMR/Constant.hpp index d0267e1cb..4e9ae03ae 100644 --- a/vSMR/Constant.hpp +++ b/vSMR/Constant.hpp @@ -21,8 +21,9 @@ const int TAG_FUNC_DATALINK_MENU = 544; const int TAG_FUNC_DATALINK_CONFIRM = 545; const int TAG_FUNC_DATALINK_STBY = 546; const int TAG_FUNC_DATALINK_VOICE = 547; -const int TAG_FUNC_DATALINK_RESET = 548; -const int TAG_FUNC_DATALINK_MESSAGE = 549; +const int TAG_FUNC_DATALINK_NOFPL = 548; +const int TAG_FUNC_DATALINK_RESET = 549; +const int TAG_FUNC_DATALINK_MESSAGE = 550; diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 4779838b7..4a6c4b896 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -173,7 +173,7 @@ void pollMessages(void * arg) { AircraftDemandingClearance.push_back(message.from); } } - else if (message.message.find("WILCO") != std::string::npos || message.message.find("ROGER") != std::string::npos || message.message.find("RGR") != std::string::npos) { + else if (message.message.find("WILCO") != std::string::npos || message.message.find("ROGER") != std::string::npos || message.message.find("RGR") != std::string::npos || message.message.find("ACCEPT") != std::string::npos) { if (std::find(AircraftMessageSent.begin(), AircraftMessageSent.end(), message.from) != AircraftMessageSent.end()) { AircraftWilco.push_back(message.from); } @@ -436,6 +436,7 @@ void CSMRPlugin::OnFunctionCall(int FunctionId, const char * sItemString, POINT AddPopupListElement("Message", "", TAG_FUNC_DATALINK_MESSAGE, false, 2, false, true); AddPopupListElement("Standby", "", TAG_FUNC_DATALINK_STBY, false, 2, menu_is_datalink); AddPopupListElement("Voice", "", TAG_FUNC_DATALINK_VOICE, false, 2, menu_is_datalink); + AddPopupListElement("NoFPL", "", TAG_FUNC_DATALINK_NOFPL, false, 2, menu_is_datalink); AddPopupListElement("Reset", "", TAG_FUNC_DATALINK_RESET, false, 2, false, true); AddPopupListElement("Close", "", EuroScopePlugIn::TAG_ITEM_FUNCTION_NO, false, 2, false, true); } @@ -525,6 +526,27 @@ void CSMRPlugin::OnFunctionCall(int FunctionId, const char * sItemString, POINT } + if (FunctionId == TAG_FUNC_DATALINK_NOFPL) { + CFlightPlan FlightPlan = FlightPlanSelectASEL(); + + if (FlightPlan.GetFlightPlanData().GetRoute() == NULL) { + tmessage = "FLIGHT PLAN NOT HELD @REVERT TO VOICE PROCEDURES"; + ttype = "CPDLC"; + tdest = FlightPlan.GetCallsign(); + + if (std::find(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), DatalinkToSend.callsign.c_str()) != AircraftDemandingClearance.end()) { + AircraftDemandingClearance.erase(std::remove(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); + } + if (std::find(AircraftStandby.begin(), AircraftStandby.end(), DatalinkToSend.callsign.c_str()) != AircraftStandby.end()) { + AircraftStandby.erase(std::remove(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); + } + PendingMessages.erase(DatalinkToSend.callsign); + + _beginthread(sendDatalinkMessage, 0, NULL); + } + + } + if (FunctionId == TAG_FUNC_DATALINK_CONFIRM) { CFlightPlan FlightPlan = FlightPlanSelectASEL(); @@ -627,7 +649,7 @@ void CSMRPlugin::OnTimer(int Counter) HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > 10 && HoppieConnected) { + if (((clock() - timer) / CLOCKS_PER_SEC) > 40 && HoppieConnected) { _beginthread(pollMessages, 0, NULL); timer = clock(); } From 3efee1bd3449af561de8fec482b0422115f91e6b Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Sun, 16 Mar 2025 18:34:40 +0000 Subject: [PATCH 02/17] Update my GitIgnore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 157f32bd6..61bb8a7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -206,3 +206,4 @@ package/ /vSMR/euroscope_sector_providers.txt vSMR/vSMR.vcxproj /lib/include/boost_1_85_0/ +vSMR/vSMR.vcxproj From 59026c05d77af67e60f92c431d9a3a6f4a9bfd66 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 17:17:56 +0000 Subject: [PATCH 03/17] Added Auto Connect function Added Auto Connect Function and settings option set to auto connect after 10 seconds of being connected as a controller S1+ by default it is disabled. Also modified the connection failed function and will attempt to reconnect after 2 minutes and will continue until connected Partially connected to issue #7 --- vSMR/CPDLCSettingsDialog.cpp | 2 ++ vSMR/CPDLCSettingsDialog.hpp | 1 + vSMR/SMRPlugin.cpp | 44 ++++++++++++++++++++++++++++++++++- vSMR/resource.h | Bin 3380 -> 3472 bytes vSMR/vSMR.rc | 7 +++--- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/vSMR/CPDLCSettingsDialog.cpp b/vSMR/CPDLCSettingsDialog.cpp index d06970911..a8e6f28e3 100644 --- a/vSMR/CPDLCSettingsDialog.cpp +++ b/vSMR/CPDLCSettingsDialog.cpp @@ -15,6 +15,7 @@ CCPDLCSettingsDialog::CCPDLCSettingsDialog(CWnd* pParent /*=NULL*/) , m_Logon(_T("EGKK")) , m_Password(_T("PASSWORD")) , m_Sound(1) + , m_Auto(0) { } @@ -29,6 +30,7 @@ void CCPDLCSettingsDialog::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_LOGON, m_Logon); DDX_Text(pDX, IDC_PASSWORD, m_Password); DDX_Check(pDX, IDC_SOUND, m_Sound); + DDX_Check(pDX, IDC_AUTO, m_Auto); } diff --git a/vSMR/CPDLCSettingsDialog.hpp b/vSMR/CPDLCSettingsDialog.hpp index 44fd6b507..fee3b27ff 100644 --- a/vSMR/CPDLCSettingsDialog.hpp +++ b/vSMR/CPDLCSettingsDialog.hpp @@ -15,6 +15,7 @@ class CCPDLCSettingsDialog : public CDialogEx CString m_Logon; CString m_Password; int m_Sound; + int m_Auto; // Dialog Data enum { IDD = IDD_DIALOG2 }; diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 4a6c4b896..9f20fe8aa 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -16,6 +16,11 @@ HttpHelper * httpHelper = NULL; bool BLINK = false; bool PlaySoundClr = false; +bool AutoConnect = false; + +clock_t retryTimer = 0; +clock_t connectTimer = 0; +bool isConnecting = false; struct DatalinkPacket { string callsign; @@ -288,6 +293,8 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL logonCode = p_value; if ((p_value = GetDataFromSettings("cpdlc_sound")) != NULL) PlaySoundClr = bool(!!atoi(p_value)); + if ((p_value = GetDataFromSettings("cpdlc_auto")) != NULL) + AutoConnect = bool(!!atoi(p_value)); char DllPathFile[_MAX_PATH]; string DllPath; @@ -307,6 +314,10 @@ CSMRPlugin::~CSMRPlugin() if (PlaySoundClr) temp = 1; SaveDataToSettings("cpdlc_sound", "Play sound on clearance request", std::to_string(temp).c_str()); + int temp2 = 0; + if (AutoConnect) + temp2 = 1; + SaveDataToSettings("cpdlc_auto", "Automatically Connect and Retry if in use", std::to_string(temp).c_str()); try { @@ -354,6 +365,7 @@ bool CSMRPlugin::OnCompileCommand(const char * sCommandLine) { dia.m_Logon = logonCallsign.c_str(); dia.m_Password = logonCode.c_str(); dia.m_Sound = int(PlaySoundClr); + dia.m_Auto = int(AutoConnect); if (dia.DoModal() != IDOK) return true; @@ -361,12 +373,17 @@ bool CSMRPlugin::OnCompileCommand(const char * sCommandLine) { logonCallsign = dia.m_Logon; logonCode = dia.m_Password; PlaySoundClr = bool(!!dia.m_Sound); + AutoConnect = bool(!!dia.m_Auto); SaveDataToSettings("cpdlc_logon", "The CPDLC logon callsign", logonCallsign.c_str()); SaveDataToSettings("cpdlc_password", "The CPDLC logon password", logonCode.c_str()); int temp = 0; if (PlaySoundClr) temp = 1; SaveDataToSettings("cpdlc_sound", "Play sound on clearance request", std::to_string(temp).c_str()); + int temp2 = 0; + if (AutoConnect) + temp2 = 1; + SaveDataToSettings("cpdlc_auto", "Automatically Connect and Retry if in use", std::to_string(temp).c_str()); return true; } @@ -637,6 +654,8 @@ void CSMRPlugin::OnTimer(int Counter) if (HoppieConnected && ConnectionMessage) { DisplayUserMessage("CPDLC", "Server", "Logged in!", true, true, false, true, false); ConnectionMessage = false; + // Reset the retry timer once connected + retryTimer = 0; } if (FailedToConnectMessage) { @@ -644,12 +663,35 @@ void CSMRPlugin::OnTimer(int Counter) FailedToConnectMessage = false; } + if (!HoppieConnected && GetConnectionType() && FailedToConnectMessage == true != CONNECTION_TYPE_NO && ControllerMyself().IsController() && FailedToConnectMessage == false) { + // Attempt to connect every 2 minutes (120 seconds) + if (((clock() - retryTimer) / CLOCKS_PER_SEC) > 120) { + _beginthread(datalinkLogin, 0, NULL); + retryTimer = clock(); + } + } + + if (!HoppieConnected && GetConnectionType() != CONNECTION_TYPE_NO && ControllerMyself().IsController() && AutoConnect == true) { + if (!isConnecting) { + // Start the connect timer + connectTimer = clock(); + isConnecting = true; + } + else { + // Check if 10 seconds have passed since connecting + if (((clock() - connectTimer) / CLOCKS_PER_SEC) > 10) { + _beginthread(datalinkLogin, 0, NULL); + isConnecting = false; + } + } + } + if (HoppieConnected && GetConnectionType() == CONNECTION_TYPE_NO) { DisplayUserMessage("CPDLC", "Server", "Automatically logged off!", true, true, false, true, false); HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > 40 && HoppieConnected) { + if (((clock() - timer) / CLOCKS_PER_SEC) > 55 && HoppieConnected) { _beginthread(pollMessages, 0, NULL); timer = clock(); } diff --git a/vSMR/resource.h b/vSMR/resource.h index 48b49b13ce53791739db64a80db607445cd5e462..6d339b0b911cf3c38a41cd7eca836f2376b439af 100644 GIT binary patch delta 34 qcmdlYH9>mA8Lr7U*d*8;8A2IC82l#(vKvl5z{SRBxcN9&E)xL6Mha~J delta 12 TcmbOry+vxn8LrJ5+!;&&AV~yJ diff --git a/vSMR/vSMR.rc b/vSMR/vSMR.rc index 4fddda0d4..a02413eb0 100644 --- a/vSMR/vSMR.rc +++ b/vSMR/vSMR.rc @@ -176,18 +176,19 @@ BEGIN EDITTEXT IDC_CLB,141,52,29,14,ES_CENTER | ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED END -IDD_DIALOG2 DIALOGEX 0, 0, 142, 105 +IDD_DIALOG2 DIALOGEX 0, 0, 142, 125 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "CPDLC Settings" FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,85,84,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,84,50,14 + DEFPUSHBUTTON "OK",IDOK,85,104,50,14 + PUSHBUTTON "Cancel",IDCANCEL,7,104,50,14 EDITTEXT IDC_LOGON,61,15,74,14,ES_AUTOHSCROLL LTEXT "Logon Callsign",IDC_STATIC,7,18,46,8 EDITTEXT IDC_PASSWORD,61,43,74,14,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "Logon Password",IDC_STATIC,7,46,52,8 CONTROL "Play sound on clearance request",IDC_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,65,128,10 + CONTROL "Auto Connect and Retry", IDC_AUTO, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 80, 128, 20 END From 2ed5a3492c66dc86b9020a64d832308979b6283e Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 17:32:01 +0000 Subject: [PATCH 04/17] Rename appveyor.yml to .appveyor.yml --- appveyor.yml => .appveyor.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename appveyor.yml => .appveyor.yml (100%) diff --git a/appveyor.yml b/.appveyor.yml similarity index 100% rename from appveyor.yml rename to .appveyor.yml From b04cb76c2017dba5c7c072e95c2512616a04e160 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 17:34:16 +0000 Subject: [PATCH 05/17] Update .appveyor.yml --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 861a6c21e..0c76032f3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,7 +15,7 @@ version: 1.5.{build} branches: # whitelist only: - - master + - dev # blacklist except: From 3072e5297d4f106c2960e6a8cef96783a54c534e Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 17:37:31 +0000 Subject: [PATCH 06/17] Update .appveyor.yml --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0c76032f3..e5f1cb05c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,7 +29,7 @@ max_jobs: 1 #---------------------------------# # Build worker image (VM template) -os: Visual Studio 2019 +os: Visual Studio 2022 #---------------------------------# # build configuration # From f018ff7afb4dca7a69018d1a17330b4e2b2f4cdc Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 17:56:23 +0000 Subject: [PATCH 07/17] Update .appveyor.yml --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index e5f1cb05c..d5a531666 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,7 +9,7 @@ #---------------------------------# # version format -version: 1.5.{build} +version: 1.6.{build} # branches to build branches: From c678701bcd24b4006d895f7cd1f9bf19f62be850 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Tue, 18 Mar 2025 18:07:16 +0000 Subject: [PATCH 08/17] Update .appveyor.yml --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index d5a531666..ca43212c4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,7 +15,7 @@ version: 1.6.{build} branches: # whitelist only: - - dev + - master # blacklist except: From 3aa550c1770724d4d49475695df08bf6d8121f63 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 24 Mar 2025 16:30:53 +0000 Subject: [PATCH 09/17] Change No FlightPlan Message Changed Flight Plan Not held message to be shorter --- vSMR/SMRPlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 568f89758..d1ff1701d 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -547,7 +547,7 @@ void CSMRPlugin::OnFunctionCall(int FunctionId, const char * sItemString, POINT CFlightPlan FlightPlan = FlightPlanSelectASEL(); if (FlightPlan.GetFlightPlanData().GetRoute() == NULL) { - tmessage = "FLIGHT PLAN NOT HELD @REVERT TO VOICE PROCEDURES"; + tmessage = "FLIGHT PLAN NOT HELD"; ttype = "CPDLC"; tdest = FlightPlan.GetCallsign(); From 659eaa823427e3ed4284402e3cc6586f9cee738c Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Wed, 26 Mar 2025 19:17:23 +0000 Subject: [PATCH 10/17] Update SMRPlugin.cpp Possible working Auto CPDLC message if Flight Plan Not Held --- vSMR/SMRPlugin.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index d1ff1701d..45333d9a5 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -264,6 +264,24 @@ void sendDatalinkClearance(void * arg) { } }; +void checkAndSendCPDLCMessage(CFlightPlan FlightPlan) { + if (FlightPlan.GetFlightPlanData().GetRoute() == NULL) { + string tmessage = "FLIGHT PLAN NOT HELD"; + string ttype = "CPDLC"; + string tdest = FlightPlan.GetCallsign(); + + if (std::find(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()) != AircraftDemandingClearance.end()) { + AircraftDemandingClearance.erase(std::remove(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); + } + if (std::find(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()) != AircraftStandby.end()) { + AircraftStandby.erase(std::remove(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()), AircraftStandby.end()); + } + PendingMessages.erase(FlightPlan.GetCallsign()); + + _beginthread(sendDatalinkMessage, 0, NULL); + } +} + CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PLUGIN_NAME, MY_PLUGIN_VERSION, MY_PLUGIN_DEVELOPER, MY_PLUGIN_COPYRIGHT) { From e26ec2cbe698d29a70e5cbd50a8e019a65f1fd99 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 12:52:12 +0100 Subject: [PATCH 11/17] Update SMRPlugin.cpp --- vSMR/SMRPlugin.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 061efb0cc..70ef74d6b 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -52,6 +52,7 @@ string tdest; string ttype; int messageId = 0; +int randomInterval = 0; clock_t timer; @@ -66,6 +67,11 @@ char recv_buf[1024]; vector RadarScreensOpened; + +void initializeRandomInterval() { + randomInterval = 45 + rand() % 31; // 45 to 75 seconds +} + void datalinkLogin(void * arg) { string raw; string url = baseUrlDatalink; @@ -274,7 +280,10 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL RegisterTagItemFunction("Datalink menu", TAG_FUNC_DATALINK_MENU); messageId = rand() % 10000 + 1789; - + + srand(time(NULL)); // Seed the RNG once at the start + initializeRandomInterval(); + timer = clock(); if (httpHelper == NULL) @@ -627,10 +636,11 @@ void CSMRPlugin::OnTimer(int Counter) HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > 10 && HoppieConnected) { - _beginthread(pollMessages, 0, NULL); - timer = clock(); - } + if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { + _beginthread(pollMessages, 0, NULL); + timer = clock(); + initializeRandomInterval(); // Generate a new interval for the next check + } for (auto &ac : AircraftWilco) { From 60148a645420ce07b84e056b89b219bef71787fc Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 15:05:45 +0100 Subject: [PATCH 12/17] Revert "Merge branch 'development-branch' into polling-rate" This reverts commit 298ef627c11170670eaa34dd4b5b5644bfe9a5c8, reversing changes made to e26ec2cbe698d29a70e5cbd50a8e019a65f1fd99. --- .gitignore | 1 - .appveyor.yml => appveyor.yml | 4 +- vSMR/CPDLCSettingsDialog.cpp | 2 - vSMR/CPDLCSettingsDialog.hpp | 1 - vSMR/Constant.hpp | 5 +- vSMR/SMRPlugin.cpp | 93 ++-------------------------------- vSMR/resource.h | Bin 3472 -> 3380 bytes vSMR/vSMR.rc | 7 ++- 8 files changed, 12 insertions(+), 101 deletions(-) rename .appveyor.yml => appveyor.yml (97%) diff --git a/.gitignore b/.gitignore index 61bb8a7d3..157f32bd6 100644 --- a/.gitignore +++ b/.gitignore @@ -206,4 +206,3 @@ package/ /vSMR/euroscope_sector_providers.txt vSMR/vSMR.vcxproj /lib/include/boost_1_85_0/ -vSMR/vSMR.vcxproj diff --git a/.appveyor.yml b/appveyor.yml similarity index 97% rename from .appveyor.yml rename to appveyor.yml index ca43212c4..861a6c21e 100644 --- a/.appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ #---------------------------------# # version format -version: 1.6.{build} +version: 1.5.{build} # branches to build branches: @@ -29,7 +29,7 @@ max_jobs: 1 #---------------------------------# # Build worker image (VM template) -os: Visual Studio 2022 +os: Visual Studio 2019 #---------------------------------# # build configuration # diff --git a/vSMR/CPDLCSettingsDialog.cpp b/vSMR/CPDLCSettingsDialog.cpp index a8e6f28e3..d06970911 100644 --- a/vSMR/CPDLCSettingsDialog.cpp +++ b/vSMR/CPDLCSettingsDialog.cpp @@ -15,7 +15,6 @@ CCPDLCSettingsDialog::CCPDLCSettingsDialog(CWnd* pParent /*=NULL*/) , m_Logon(_T("EGKK")) , m_Password(_T("PASSWORD")) , m_Sound(1) - , m_Auto(0) { } @@ -30,7 +29,6 @@ void CCPDLCSettingsDialog::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_LOGON, m_Logon); DDX_Text(pDX, IDC_PASSWORD, m_Password); DDX_Check(pDX, IDC_SOUND, m_Sound); - DDX_Check(pDX, IDC_AUTO, m_Auto); } diff --git a/vSMR/CPDLCSettingsDialog.hpp b/vSMR/CPDLCSettingsDialog.hpp index fee3b27ff..44fd6b507 100644 --- a/vSMR/CPDLCSettingsDialog.hpp +++ b/vSMR/CPDLCSettingsDialog.hpp @@ -15,7 +15,6 @@ class CCPDLCSettingsDialog : public CDialogEx CString m_Logon; CString m_Password; int m_Sound; - int m_Auto; // Dialog Data enum { IDD = IDD_DIALOG2 }; diff --git a/vSMR/Constant.hpp b/vSMR/Constant.hpp index b33a1c5df..2bfc7ed80 100644 --- a/vSMR/Constant.hpp +++ b/vSMR/Constant.hpp @@ -21,9 +21,8 @@ const int TAG_FUNC_DATALINK_MENU = 544; const int TAG_FUNC_DATALINK_CONFIRM = 545; const int TAG_FUNC_DATALINK_STBY = 546; const int TAG_FUNC_DATALINK_VOICE = 547; -const int TAG_FUNC_DATALINK_NOFPL = 548; -const int TAG_FUNC_DATALINK_RESET = 549; -const int TAG_FUNC_DATALINK_MESSAGE = 550; +const int TAG_FUNC_DATALINK_RESET = 548; +const int TAG_FUNC_DATALINK_MESSAGE = 549; diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 385bc9b4d..70ef74d6b 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -16,11 +16,6 @@ HttpHelper * httpHelper = NULL; bool BLINK = false; bool PlaySoundClr = false; -bool AutoConnect = false; - -clock_t retryTimer = 0; -clock_t connectTimer = 0; -bool isConnecting = false; struct DatalinkPacket { string callsign; @@ -270,24 +265,6 @@ void sendDatalinkClearance(void * arg) { } }; -void checkAndSendCPDLCMessage(CFlightPlan FlightPlan) { - if (FlightPlan.GetFlightPlanData().GetRoute() == NULL) { - string tmessage = "FLIGHT PLAN NOT HELD"; - string ttype = "CPDLC"; - string tdest = FlightPlan.GetCallsign(); - - if (std::find(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()) != AircraftDemandingClearance.end()) { - AircraftDemandingClearance.erase(std::remove(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); - } - if (std::find(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()) != AircraftStandby.end()) { - AircraftStandby.erase(std::remove(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()), AircraftStandby.end()); - } - PendingMessages.erase(FlightPlan.GetCallsign()); - - _beginthread(sendDatalinkMessage, 0, NULL); - } -} - CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PLUGIN_NAME, MY_PLUGIN_VERSION, MY_PLUGIN_DEVELOPER, MY_PLUGIN_COPYRIGHT) { @@ -320,8 +297,6 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL logonCode = p_value; if ((p_value = GetDataFromSettings("cpdlc_sound")) != NULL) PlaySoundClr = bool(!!atoi(p_value)); - if ((p_value = GetDataFromSettings("cpdlc_auto")) != NULL) - AutoConnect = bool(!!atoi(p_value)); char DllPathFile[_MAX_PATH]; string DllPath; @@ -341,10 +316,6 @@ CSMRPlugin::~CSMRPlugin() if (PlaySoundClr) temp = 1; SaveDataToSettings("cpdlc_sound", "Play sound on clearance request", std::to_string(temp).c_str()); - int temp2 = 0; - if (AutoConnect) - temp2 = 1; - SaveDataToSettings("cpdlc_auto", "Automatically Connect and Retry if in use", std::to_string(temp).c_str()); try { @@ -392,7 +363,6 @@ bool CSMRPlugin::OnCompileCommand(const char * sCommandLine) { dia.m_Logon = logonCallsign.c_str(); dia.m_Password = logonCode.c_str(); dia.m_Sound = int(PlaySoundClr); - dia.m_Auto = int(AutoConnect); if (dia.DoModal() != IDOK) return true; @@ -400,17 +370,12 @@ bool CSMRPlugin::OnCompileCommand(const char * sCommandLine) { logonCallsign = dia.m_Logon; logonCode = dia.m_Password; PlaySoundClr = bool(!!dia.m_Sound); - AutoConnect = bool(!!dia.m_Auto); SaveDataToSettings("cpdlc_logon", "The CPDLC logon callsign", logonCallsign.c_str()); SaveDataToSettings("cpdlc_password", "The CPDLC logon password", logonCode.c_str()); int temp = 0; if (PlaySoundClr) temp = 1; SaveDataToSettings("cpdlc_sound", "Play sound on clearance request", std::to_string(temp).c_str()); - int temp2 = 0; - if (AutoConnect) - temp2 = 1; - SaveDataToSettings("cpdlc_auto", "Automatically Connect and Retry if in use", std::to_string(temp).c_str()); return true; } @@ -480,7 +445,6 @@ void CSMRPlugin::OnFunctionCall(int FunctionId, const char * sItemString, POINT AddPopupListElement("Message", "", TAG_FUNC_DATALINK_MESSAGE, false, 2, false, true); AddPopupListElement("Standby", "", TAG_FUNC_DATALINK_STBY, false, 2, menu_is_datalink); AddPopupListElement("Voice", "", TAG_FUNC_DATALINK_VOICE, false, 2, menu_is_datalink); - AddPopupListElement("NoFPL", "", TAG_FUNC_DATALINK_NOFPL, false, 2, menu_is_datalink); AddPopupListElement("Reset", "", TAG_FUNC_DATALINK_RESET, false, 2, false, true); AddPopupListElement("Close", "", EuroScopePlugIn::TAG_ITEM_FUNCTION_NO, false, 2, false, true); } @@ -570,27 +534,6 @@ void CSMRPlugin::OnFunctionCall(int FunctionId, const char * sItemString, POINT } - if (FunctionId == TAG_FUNC_DATALINK_NOFPL) { - CFlightPlan FlightPlan = FlightPlanSelectASEL(); - - if (FlightPlan.GetFlightPlanData().GetRoute() == NULL) { - tmessage = "FLIGHT PLAN NOT HELD"; - ttype = "CPDLC"; - tdest = FlightPlan.GetCallsign(); - - if (std::find(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), DatalinkToSend.callsign.c_str()) != AircraftDemandingClearance.end()) { - AircraftDemandingClearance.erase(std::remove(AircraftDemandingClearance.begin(), AircraftDemandingClearance.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); - } - if (std::find(AircraftStandby.begin(), AircraftStandby.end(), DatalinkToSend.callsign.c_str()) != AircraftStandby.end()) { - AircraftStandby.erase(std::remove(AircraftStandby.begin(), AircraftStandby.end(), FlightPlan.GetCallsign()), AircraftDemandingClearance.end()); - } - PendingMessages.erase(DatalinkToSend.callsign); - - _beginthread(sendDatalinkMessage, 0, NULL); - } - - } - if (FunctionId == TAG_FUNC_DATALINK_CONFIRM) { CFlightPlan FlightPlan = FlightPlanSelectASEL(); @@ -681,8 +624,6 @@ void CSMRPlugin::OnTimer(int Counter) if (HoppieConnected && ConnectionMessage) { DisplayUserMessage("CPDLC", "Server", "Logged in!", true, true, false, true, false); ConnectionMessage = false; - // Reset the retry timer once connected - retryTimer = 0; } if (FailedToConnectMessage) { @@ -690,40 +631,16 @@ void CSMRPlugin::OnTimer(int Counter) FailedToConnectMessage = false; } - if (!HoppieConnected && GetConnectionType() && FailedToConnectMessage == true != CONNECTION_TYPE_NO && ControllerMyself().IsController() && FailedToConnectMessage == false) { - // Attempt to connect every 2 minutes (120 seconds) - if (((clock() - retryTimer) / CLOCKS_PER_SEC) > 120) { - _beginthread(datalinkLogin, 0, NULL); - retryTimer = clock(); - } - } - - if (!HoppieConnected && GetConnectionType() != CONNECTION_TYPE_NO && ControllerMyself().IsController() && AutoConnect == true) { - if (!isConnecting) { - // Start the connect timer - connectTimer = clock(); - isConnecting = true; - } - else { - // Check if 10 seconds have passed since connecting - if (((clock() - connectTimer) / CLOCKS_PER_SEC) > 10) { - _beginthread(datalinkLogin, 0, NULL); - isConnecting = false; - } - } - } - if (HoppieConnected && GetConnectionType() == CONNECTION_TYPE_NO) { DisplayUserMessage("CPDLC", "Server", "Automatically logged off!", true, true, false, true, false); HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { - _beginthread(pollMessages, 0, NULL); - timer = clock(); - initializeRandomInterval(); // Generate a new interval for the next check - } - + if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { + _beginthread(pollMessages, 0, NULL); + timer = clock(); + initializeRandomInterval(); // Generate a new interval for the next check + } for (auto &ac : AircraftWilco) { diff --git a/vSMR/resource.h b/vSMR/resource.h index 6d339b0b911cf3c38a41cd7eca836f2376b439af..48b49b13ce53791739db64a80db607445cd5e462 100644 GIT binary patch delta 12 TcmbOry+vxn8LrJ5+!;&&AV~yJ delta 34 qcmdlYH9>mA8Lr7U*d*8;8A2IC82l#(vKvl5z{SRBxcN9&E)xL6Mha~J diff --git a/vSMR/vSMR.rc b/vSMR/vSMR.rc index a02413eb0..4fddda0d4 100644 --- a/vSMR/vSMR.rc +++ b/vSMR/vSMR.rc @@ -176,19 +176,18 @@ BEGIN EDITTEXT IDC_CLB,141,52,29,14,ES_CENTER | ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED END -IDD_DIALOG2 DIALOGEX 0, 0, 142, 125 +IDD_DIALOG2 DIALOGEX 0, 0, 142, 105 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "CPDLC Settings" FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,85,104,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,104,50,14 + DEFPUSHBUTTON "OK",IDOK,85,84,50,14 + PUSHBUTTON "Cancel",IDCANCEL,7,84,50,14 EDITTEXT IDC_LOGON,61,15,74,14,ES_AUTOHSCROLL LTEXT "Logon Callsign",IDC_STATIC,7,18,46,8 EDITTEXT IDC_PASSWORD,61,43,74,14,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "Logon Password",IDC_STATIC,7,46,52,8 CONTROL "Play sound on clearance request",IDC_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,65,128,10 - CONTROL "Auto Connect and Retry", IDC_AUTO, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 80, 128, 20 END From a68d09ec9c77d286d2362685adad556664d0d935 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 15:21:06 +0100 Subject: [PATCH 13/17] Update and rename appveyor.yml to .appveyor.yml --- appveyor.yml => .appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename appveyor.yml => .appveyor.yml (96%) diff --git a/appveyor.yml b/.appveyor.yml similarity index 96% rename from appveyor.yml rename to .appveyor.yml index 861a6c21e..6f8f0b9e6 100644 --- a/appveyor.yml +++ b/.appveyor.yml @@ -9,13 +9,13 @@ #---------------------------------# # version format -version: 1.5.{build} +version: 1.7.{build} # branches to build branches: # whitelist only: - - master + - main # blacklist except: @@ -29,7 +29,7 @@ max_jobs: 1 #---------------------------------# # Build worker image (VM template) -os: Visual Studio 2019 +os: Visual Studio 2022 #---------------------------------# # build configuration # From 0a3347b1c4912d28114ceb46fbb8685900738ccb Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 15:24:45 +0100 Subject: [PATCH 14/17] Update SMRPlugin.cpp --- vSMR/SMRPlugin.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index 70ef74d6b..fe289c4d3 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -636,11 +636,11 @@ void CSMRPlugin::OnTimer(int Counter) HoppieConnected = false; } - if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { - _beginthread(pollMessages, 0, NULL); - timer = clock(); - initializeRandomInterval(); // Generate a new interval for the next check - } + if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) { + _beginthread(pollMessages, 0, NULL); + timer = clock(); + initializeRandomInterval(); // Generate a new interval for the next check + } for (auto &ac : AircraftWilco) { From eef1e2a2fadb385d2c65fdd7ed498090ab4c75c3 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 16:15:08 +0100 Subject: [PATCH 15/17] Update .appveyor.yml --- .appveyor.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6f8f0b9e6..22a306fcf 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,17 +9,7 @@ #---------------------------------# # version format -version: 1.7.{build} - -# branches to build -branches: - # whitelist - only: - - main - - # blacklist - except: - - gh-pages +version: 1.6.{build} # Maximum number of concurrent jobs for the project max_jobs: 1 @@ -59,3 +49,5 @@ after_build: artifacts: - path: vSMR-nightly.zip + + From 03c4048ad0d1c1b82b2bf3b692a150cd16d64f55 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 16:23:37 +0100 Subject: [PATCH 16/17] Indentation fixes Fix Indentations hopefully fixes it --- vSMR/SMRPlugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index fe289c4d3..dd8a9bbc5 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -69,7 +69,7 @@ vector RadarScreensOpened; void initializeRandomInterval() { - randomInterval = 45 + rand() % 31; // 45 to 75 seconds + randomInterval = 45 + rand() % 31; // 45 to 75 seconds } void datalinkLogin(void * arg) { @@ -281,8 +281,8 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL messageId = rand() % 10000 + 1789; - srand(time(NULL)); // Seed the RNG once at the start - initializeRandomInterval(); + srand(time(NULL)); // Seed the RNG once at the start + initializeRandomInterval(); timer = clock(); From cc99fcd290ab75804245ebb677cb3b4bbdd35416 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 26 May 2025 16:55:09 +0100 Subject: [PATCH 17/17] Update vSMR/SMRPlugin.cpp Co-authored-by: Patrick Winters <61561933+19wintersp@users.noreply.github.com> --- vSMR/SMRPlugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vSMR/SMRPlugin.cpp b/vSMR/SMRPlugin.cpp index dd8a9bbc5..8ace590ca 100644 --- a/vSMR/SMRPlugin.cpp +++ b/vSMR/SMRPlugin.cpp @@ -281,8 +281,8 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL messageId = rand() % 10000 + 1789; - srand(time(NULL)); // Seed the RNG once at the start - initializeRandomInterval(); + srand(time(NULL)); // Seed the RNG once at the start + initializeRandomInterval(); timer = clock();