Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build DLL

on:
pull_request:
branches: [main]
branches: [main,master,dev,develop]
release:
types: [published]

Expand Down
4 changes: 4 additions & 0 deletions vSMR/Constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ const int RIMCAS_UPDATE_APP_TRAIL = 8032;
const int RIMCAS_UPDATE_PTL = 8033;
const int RIMCAS_UPDATE_RELEASE = 8034;
const int RIMCAS_UPDATE_ACQUIRE = 8035;
const int RIMCAS_TOGGLE_AIRCRAFT_TYPE = 8036;
const int RIMCAS_TOGGLE_SID = 8037;
const int RIMCAS_TOGGLE_WAKE_TURB = 8038;
const int RIMCAS_UPDATE_DETAILED = 8039;

const int RIMCAS_IAW = 7000;

Expand Down
4 changes: 2 additions & 2 deletions vSMR/InsetWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
// Drawing the tags, what a mess

// ----- Generating the replacing map -----
map<string, string> TagReplacingMap = CSMRRadar::GenerateTagData(rt, fp, radar_screen->IsCorrelated(fp, rt), radar_screen->CurrentConfig->getActiveProfile()["filters"]["pro_mode"]["enable"].GetBool(), radar_screen->GetPlugIn()->GetTransitionAltitude(), radar_screen->CurrentConfig->getActiveProfile()["labels"]["use_aspeed_for_gate"].GetBool(), icao);
map<string, string> TagReplacingMap = CSMRRadar::GenerateTagData(rt, fp, radar_screen->IsCorrelated(fp, rt), radar_screen->CurrentConfig->getActiveProfile()["filters"]["pro_mode"]["enable"].GetBool(), radar_screen->GetPlugIn()->GetTransitionAltitude(), radar_screen->CurrentConfig->getActiveProfile()["labels"]["use_aspeed_for_gate"].GetBool(), icao, radar_screen->showAircraftType, radar_screen->showSID, radar_screen->showWakeTurb);

// ----- Generating the clickable map -----
map<string, int> TagClickableMap;
Expand Down Expand Up @@ -688,7 +688,7 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN
bearings = bearings.substr(0, decimal_pos + 2);

string text = bearings;
text += "� / ";
text += "� / ";
text += distances;
text += "nm";
COLORREF old_color = dc.SetTextColor(RGB(0, 0, 0));
Expand Down
12 changes: 8 additions & 4 deletions vSMR/Rimcas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ void CRimcas::OnRefreshBegin(bool isLVP) {
this->IsLVP = isLVP;
}

void CRimcas::OnRefresh(CRadarTarget Rt, CRadarScreen *instance, bool isCorrelated) {
void CRimcas::OnRefresh(CRadarTarget Rt, CRadarScreen *instance, bool isCorrelated, string acType, string acStand) {
Logger::info(string(__FUNCSIG__));
GetAcInRunwayArea(Rt, instance);
GetAcInRunwayAreaSoon(Rt, instance, isCorrelated);
GetAcInRunwayAreaSoon(Rt, instance, isCorrelated, acType, acStand);
}

void CRimcas::AddRunwayArea(CRadarScreen *instance, string runway_name1, string runway_name2, vector<CPosition> Definition) {
Expand Down Expand Up @@ -79,7 +79,7 @@ string CRimcas::GetAcInRunwayArea(CRadarTarget Ac, CRadarScreen *instance) {
return string_false;
}

string CRimcas::GetAcInRunwayAreaSoon(CRadarTarget Ac, CRadarScreen *instance, bool isCorrelated) {
string CRimcas::GetAcInRunwayAreaSoon(CRadarTarget Ac, CRadarScreen *instance, bool isCorrelated, string acType, string acStand) {
Logger::info(string(__FUNCSIG__));
int AltitudeDif = Ac.GetPosition().GetFlightLevel() - Ac.GetPreviousPosition(Ac.GetPosition()).GetFlightLevel();
if (!Ac.GetPosition().GetTransponderC())
Expand Down Expand Up @@ -164,7 +164,11 @@ string CRimcas::GetAcInRunwayAreaSoon(CRadarTarget Ac, CRadarScreen *instance, b
}
if (t < PreviousTime && t >= Time)
{
TimeTable[it->first][Time] = Ac.GetCallsign();
AircraftInfo info;
info.callsign = Ac.GetCallsign();
info.type = acType;
info.stand = acStand;
TimeTable[it->first][Time] = info;
break;
}
}
Expand Down
12 changes: 9 additions & 3 deletions vSMR/Rimcas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ class CRimcas {

enum RimcasAlertTypes { NoAlert, StageOne, StageTwo };

struct AircraftInfo {
string callsign = "";
string type = "";
string stand = "";
};

map<string, RunwayAreaType> RunwayAreas;
multimap<string, string> AcOnRunway;
vector<int> CountdownDefinition;
vector<int> CountdownDefinitionLVP;
multimap<string, string> ApproachingAircrafts;
map<string, map<int, string>> TimeTable;
map<string, map<int, AircraftInfo>> TimeTable;
map<string, bool> MonitoredRunwayDep;
map<string, bool> MonitoredRunwayArr;
map<string, RimcasAlertTypes> AcColor;
Expand Down Expand Up @@ -104,7 +110,7 @@ class CRimcas {
}

string GetAcInRunwayArea(CRadarTarget Ac, CRadarScreen *instance);
string GetAcInRunwayAreaSoon(CRadarTarget Ac, CRadarScreen *instance, bool isCorrelated);
string GetAcInRunwayAreaSoon(CRadarTarget Ac, CRadarScreen *instance, bool isCorrelated, string acType = "", string acStand = "");
void AddRunwayArea(CRadarScreen *instance, string runway_name1, string runway_name2, vector<CPosition> Definition);
Color GetAircraftColor(string AcCallsign, Color StandardColor, Color OnRunwayColor, Color RimcasStageOne, Color RimcasStageTwo);
Color GetAircraftColor(string AcCallsign, Color StandardColor, Color OnRunwayColor);
Expand All @@ -114,7 +120,7 @@ class CRimcas {
vector<CPosition> GetRunwayArea(CPosition Left, CPosition Right, float hwidth = 92.5f);

void OnRefreshBegin(bool isLVP);
void OnRefresh(CRadarTarget Rt, CRadarScreen *instance, bool isCorrelated);
void OnRefresh(CRadarTarget Rt, CRadarScreen *instance, bool isCorrelated, string acType = "", string acStand = "");
void OnRefreshEnd(CRadarScreen *instance, int threshold);
void Reset();

Expand Down
33 changes: 32 additions & 1 deletion vSMR/SMRPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ string ttype;
int messageId = 0;

clock_t timer;
int pollInterval = 45 + rand() % 31; // Random interval between 45-75 seconds

string myfrequency;

Expand All @@ -66,6 +67,18 @@ char recv_buf[1024];

vector<CSMRRadar*> RadarScreensOpened;

static void formatNowTimeDate(string & timeStr, string &dateStr)
{
time_t now = time(NULL);
tm tmnow;
gmtime_s(&tmnow, &now); // use UTC
char buf[64];
strftime(buf, sizeof(buf), "%H%MZ", &tmnow);
timeStr = buf;
strftime(buf, sizeof(buf), "%d%m%y", &tmnow);
dateStr = buf;
}

void createPlainCpdlcMessage(const char *message, const char *responses) {
ttype = "CPDLC";
tmessage = "/data2/";
Expand Down Expand Up @@ -177,11 +190,28 @@ void pollMessages(void * arg) {
PlaySound(MAKEINTRESOURCE(IDR_WAVE1), AfxGetInstanceHandle(), SND_RESOURCE | SND_ASYNC);
}
AircraftDemandingClearance.push_back(message.from);
string timeS, dateS;
formatNowTimeDate(timeS, dateS);
// Send ack
string reqAck = "DEPART MESSAGE REQUEST RECEIVED ";
reqAck += timeS + " " + dateS;
reqAck += " REQUEST BEING PROCESSED";
createPlainCpdlcMessage(reqAck.c_str(), "NE");
tdest = message.from;
_beginthread(sendDatalinkMessage, 0, NULL);
}
}
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);
string timeS, dateS;
formatNowTimeDate(timeS, dateS);
// send ack
string clearanceAck = "DEPART MESSAGE ACK RECEIVED ";
clearanceAck += timeS + " " + dateS;
clearanceAck += " CLEARANCE CONFIRMED";
createPlainCpdlcMessage(clearanceAck.c_str(), "NE");
_beginthread(sendDatalinkMessage, 0, NULL);
}
}
else if (message.message.length() != 0 ){
Expand Down Expand Up @@ -634,9 +664,10 @@ void CSMRPlugin::OnTimer(int Counter)
HoppieConnected = false;
}

if (((clock() - timer) / CLOCKS_PER_SEC) > 10 && HoppieConnected) {
if (((clock() - timer) / CLOCKS_PER_SEC) > pollInterval && HoppieConnected) {
_beginthread(pollMessages, 0, NULL);
timer = clock();
pollInterval = 45 + rand() % 31; // Next random interval between 45-75 seconds
}

for (auto &ac : AircraftWilco)
Expand Down
Loading