Add remote command capability.

This commit is contained in:
Jonathan Naylor 2020-04-05 14:58:35 +01:00
parent b058539a71
commit adade2ebe2
6 changed files with 164 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +35,8 @@ enum SECTION {
SECTION_NETWORK,
SECTION_YSF_NETWORK,
SECTION_FCS_NETWORK,
SECTION_MOBILE_GPS
SECTION_MOBILE_GPS,
SECTION_REMOTE_COMMANDS
};
CConf::CConf(const std::string& file) :
@ -89,7 +90,9 @@ m_fcsNetworkFile(),
m_fcsNetworkPort(0U),
m_mobileGPSEnabled(false),
m_mobileGPSAddress(),
m_mobileGPSPort(0U)
m_mobileGPSPort(0U),
m_remoteCommandsEnabled(false),
m_remoteCommandsPort(6073U)
{
}
@ -129,6 +132,8 @@ bool CConf::read()
section = SECTION_FCS_NETWORK;
else if (::strncmp(buffer, "[Mobile GPS]", 12U) == 0)
section = SECTION_MOBILE_GPS;
else if (::strncmp(buffer, "[Remote Commands]", 17U) == 0)
section = SECTION_REMOTE_COMMANDS;
else
section = SECTION_NONE;
@ -254,6 +259,11 @@ bool CConf::read()
m_mobileGPSAddress = value;
else if (::strcmp(key, "Port") == 0)
m_mobileGPSPort = (unsigned int)::atoi(value);
} else if (section == SECTION_REMOTE_COMMANDS) {
if (::strcmp(key, "Enable") == 0)
m_remoteCommandsEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Port") == 0)
m_remoteCommandsPort = (unsigned int)::atoi(value);
}
}
@ -512,3 +522,13 @@ unsigned int CConf::getMobileGPSPort() const
{
return m_mobileGPSPort;
}
bool CConf::getRemoteCommandsEnabled() const
{
return m_remoteCommandsEnabled;
}
unsigned int CConf::getRemoteCommandsPort() const
{
return m_remoteCommandsPort;
}