1
0
Fork 0

Get the DGId Gateway working for YSF at least.

ycs232-kbc
Jonathan Naylor 4 years ago
parent be1e3aa4fa
commit 0a4260a23c

@ -201,6 +201,8 @@ int CDGIdGateway::run()
return 1; return 1;
} }
rptNetwork.link();
std::string fileName = m_conf.getYSFNetHosts(); std::string fileName = m_conf.getYSFNetHosts();
CYSFReflectors* reflectors = new CYSFReflectors(fileName); CYSFReflectors* reflectors = new CYSFReflectors(fileName);
reflectors->load(); reflectors->load();
@ -381,6 +383,7 @@ int CDGIdGateway::run()
LogMessage("Starting DGIdGateway-%s", VERSION); LogMessage("Starting DGIdGateway-%s", VERSION);
DGID_STATUS state = DS_NOTLINKED; DGID_STATUS state = DS_NOTLINKED;
unsigned int nPips = 0U;
for (;;) { for (;;) {
unsigned char buffer[200U]; unsigned char buffer[200U];
@ -411,7 +414,7 @@ int CDGIdGateway::run()
} }
std::string desc = dgIdNetwork[dgId]->getDesc(dgId); std::string desc = dgIdNetwork[dgId]->getDesc(dgId);
LogDebug("DG-ID set to %u (%s) via RF", dgId, desc.c_str()); LogMessage("DG-ID set to %u (%s) via RF", dgId, desc.c_str());
currentDGId = dgId; currentDGId = dgId;
state = DS_NOTLINKED; state = DS_NOTLINKED;
} }
@ -440,6 +443,10 @@ int CDGIdGateway::run()
if ((buffer[34U] & 0x01U) == 0x01U) { if ((buffer[34U] & 0x01U) == 0x01U) {
if (m_gps != NULL) if (m_gps != NULL)
m_gps->reset(); m_gps->reset();
if (nPips > 0U) {
sendPips(nPips);
nPips = 0U;
}
} }
} }
} }
@ -462,7 +469,7 @@ int CDGIdGateway::run()
if (currentDGId == 0U) { if (currentDGId == 0U) {
std::string desc = dgIdNetwork[i]->getDesc(i); std::string desc = dgIdNetwork[i]->getDesc(i);
LogDebug("DG-ID set to %u (%s) via Network", i, desc.c_str()); LogMessage("DG-ID set to %u (%s) via Network", i, desc.c_str());
currentDGId = i; currentDGId = i;
state = DS_LINKED; state = DS_LINKED;
} }
@ -493,20 +500,20 @@ int CDGIdGateway::run()
dgIdNetwork[currentDGId]->unlink(); dgIdNetwork[currentDGId]->unlink();
} }
LogDebug("DG-ID set to 0 (None) via timeout"); LogMessage("DG-ID set to 0 (None) via timeout");
state = DS_NOTLINKED; state = DS_NOTLINKED;
currentDGId = 0U; currentDGId = 0U;
inactivityTimer.stop(); inactivityTimer.stop();
sendPips(2U); nPips = 2U;
} }
if (dgIdNetwork[currentDGId] != NULL) { if (dgIdNetwork[currentDGId] != NULL) {
DGID_STATUS netState = dgIdNetwork[currentDGId]->getStatus(); DGID_STATUS netState = dgIdNetwork[currentDGId]->getStatus();
if (state != DS_LINKED && netState == DS_LINKED) if (state != DS_LINKED && netState == DS_LINKED)
sendPips(1U); nPips = 1U;
else if (state == DS_LINKED && netState != DS_LINKED) else if (state == DS_LINKED && netState != DS_LINKED)
sendPips(3U); nPips = 3U;
state = netState; state = netState;
} }
@ -514,6 +521,7 @@ int CDGIdGateway::run()
CThread::sleep(5U); CThread::sleep(5U);
} }
rptNetwork.unlink();
rptNetwork.close(); rptNetwork.close();
if (m_gps != NULL) { if (m_gps != NULL) {

@ -86,7 +86,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_LOG_H;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
@ -101,7 +101,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_LOG_H;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
@ -116,7 +116,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_LOG_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
@ -131,7 +131,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_LOG_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>

@ -147,6 +147,8 @@ void CFCSNetwork::unlink()
m_pingTimer.stop(); m_pingTimer.stop();
LogMessage("Unlinked from %s", m_print.c_str());
m_state = DS_NOTLINKED; m_state = DS_NOTLINKED;
} }

@ -189,6 +189,8 @@ void CYSFNetwork::unlink()
m_socket.write(m_unlink, 14U, m_addr, m_addrLen); m_socket.write(m_unlink, 14U, m_addr, m_addrLen);
LogMessage("Unlinked from %s", m_name.c_str());
m_state = DS_NOTLINKED; m_state = DS_NOTLINKED;
} }

Loading…
Cancel
Save