1
0
Fork 0

updated YSFGateway

Remote control management compatible with pistar uk.

If the requested room does not exist, the gw remains on the previously set one
master
Antonio Matraia 1 year ago
parent daef16c145
commit 2e303e55e6

@ -373,7 +373,11 @@ WX_STATUS CWiresX::processConnect(const unsigned char* source, const unsigned ch
std::string id = std::string((char*)data, 5U); std::string id = std::string((char*)data, 5U);
m_reflector = m_reflectors.findById(id); CYSFReflector* reflector_tmp;
reflector_tmp = m_reflectors.findById(id);
if (reflector_tmp != NULL)
m_reflector = reflector_tmp;
if (m_reflector == NULL) if (m_reflector == NULL)
return WXS_NONE; return WXS_NONE;

@ -892,10 +892,11 @@ void CYSFGateway::processRemoteCommands()
int res = m_remoteSocket->read(buffer, 200U, addr, addrLen); int res = m_remoteSocket->read(buffer, 200U, addr, addrLen);
if (res > 0) { if (res > 0) {
buffer[res] = '\0'; buffer[res] = '\0';
if ((::memcmp(buffer + 0U, "LinkYSF", 7U) == 0) && (strlen((char*)buffer + 0U) > 8)) { if ((::memcmp(buffer + 0U, "LinkYSF", 7U) == 0) && (strlen((char*)buffer + 0U) > 8) && (m_ysfNetwork != NULL)) {
std::string id = std::string((char*)(buffer + 8U)); std::string id = std::string((char*)(buffer + 7U));
// Left trim // Left trim
id.erase(id.begin(), std::find_if(id.begin(), id.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); // id.erase(id.begin(), std::find_if(id.begin(), id.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
id.erase(std::remove_if(id.begin(), id.end(), [](char c) { return !std::isalnum(c); }), id.end());
CYSFReflector* reflector = m_reflectors->findById(id); CYSFReflector* reflector = m_reflectors->findById(id);
if (reflector == NULL) if (reflector == NULL)
reflector = m_reflectors->findByName(id); reflector = m_reflectors->findByName(id);
@ -923,10 +924,11 @@ void CYSFGateway::processRemoteCommands()
LogWarning("Invalid YSF reflector id/name - \"%s\"", id.c_str()); LogWarning("Invalid YSF reflector id/name - \"%s\"", id.c_str());
return; return;
} }
} else if ((::memcmp(buffer + 0U, "LinkFCS", 7U) == 0) && (strlen((char*)buffer + 0U) > 8)) { } else if ((::memcmp(buffer + 0U, "LinkFCS", 7U) == 0) && (strlen((char*)buffer + 0U) > 8) && (m_fcsNetwork != NULL)) {
std::string raw = std::string((char*)(buffer + 8U)); std::string raw = std::string((char*)(buffer + 7U));
// Left trim // Left trim
raw.erase(raw.begin(), std::find_if(raw.begin(), raw.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); // raw.erase(raw.begin(), std::find_if(raw.begin(), raw.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
raw.erase(std::remove_if(raw.begin(), raw.end(), [](char c) { return !std::isalnum(c); }), raw.end());
std::string id = "FCS00"; std::string id = "FCS00";
std::string idShort = "FCS"; std::string idShort = "FCS";
if (raw.length() == 3U) { if (raw.length() == 3U) {

Loading…
Cancel
Save