Add support for GPSD.

This commit is contained in:
Jonathan Naylor 2020-06-03 12:41:00 +01:00
parent 7759575bbb
commit aa0ba6ec46
9 changed files with 110 additions and 125 deletions

View file

@ -35,7 +35,7 @@ enum SECTION {
SECTION_NETWORK,
SECTION_YSF_NETWORK,
SECTION_FCS_NETWORK,
SECTION_MOBILE_GPS,
SECTION_GPSD,
SECTION_REMOTE_COMMANDS
};
@ -87,9 +87,9 @@ m_ysfNetworkYSF2P25Port(0U),
m_fcsNetworkEnabled(false),
m_fcsNetworkFile(),
m_fcsNetworkPort(0U),
m_mobileGPSEnabled(false),
m_mobileGPSAddress(),
m_mobileGPSPort(0U),
m_gpsdEnabled(false),
m_gpsdAddress(),
m_gpsdPort(),
m_remoteCommandsEnabled(false),
m_remoteCommandsPort(6073U)
{
@ -129,8 +129,8 @@ bool CConf::read()
section = SECTION_YSF_NETWORK;
else if (::strncmp(buffer, "[FCS Network]", 13U) == 0)
section = SECTION_FCS_NETWORK;
else if (::strncmp(buffer, "[Mobile GPS]", 12U) == 0)
section = SECTION_MOBILE_GPS;
else if (::strncmp(buffer, "[GPSD]", 6U) == 0)
section = SECTION_GPSD;
else if (::strncmp(buffer, "[Remote Commands]", 17U) == 0)
section = SECTION_REMOTE_COMMANDS;
else
@ -249,13 +249,13 @@ bool CConf::read()
m_fcsNetworkFile = value;
else if (::strcmp(key, "Port") == 0)
m_fcsNetworkPort = (unsigned int)::atoi(value);
} else if (section == SECTION_MOBILE_GPS) {
} else if (section == SECTION_GPSD) {
if (::strcmp(key, "Enable") == 0)
m_mobileGPSEnabled = ::atoi(value) == 1;
m_gpsdEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0)
m_mobileGPSAddress = value;
m_gpsdAddress = value;
else if (::strcmp(key, "Port") == 0)
m_mobileGPSPort = (unsigned int)::atoi(value);
m_gpsdPort = value;
} else if (section == SECTION_REMOTE_COMMANDS) {
if (::strcmp(key, "Enable") == 0)
m_remoteCommandsEnabled = ::atoi(value) == 1;
@ -500,19 +500,19 @@ unsigned int CConf::getFCSNetworkPort() const
return m_fcsNetworkPort;
}
bool CConf::getMobileGPSEnabled() const
bool CConf::getGPSDEnabled() const
{
return m_mobileGPSEnabled;
return m_gpsdEnabled;
}
std::string CConf::getMobileGPSAddress() const
std::string CConf::getGPSDAddress() const
{
return m_mobileGPSAddress;
return m_gpsdAddress;
}
unsigned int CConf::getMobileGPSPort() const
std::string CConf::getGPSDPort() const
{
return m_mobileGPSPort;
return m_gpsdPort;
}
bool CConf::getRemoteCommandsEnabled() const