mirror of
https://github.com/oe7drt/YSFClients.git
synced 2025-12-06 05:32:02 +01:00
Change the YSFGateway a little bit to auto-reconnect current timed-out reflector if WiresX DX command is received. That means if your hotspot lost the connection to the network reflector, just re-press the X button on your Yaesu device and everything will be back online again.
This commit is contained in:
parent
e61d856c6b
commit
b7260b4bf8
|
|
@ -260,7 +260,7 @@ WX_STATUS CWiresX::process(const unsigned char* data, const unsigned char* sourc
|
|||
else {
|
||||
if (::memcmp(m_command + 1U, DX_REQ, 3U) == 0) {
|
||||
processDX(source);
|
||||
return WX_STATUS::NONE;
|
||||
return WX_STATUS::RECONNECT_CURRENT;
|
||||
} else if (::memcmp(m_command + 1U, ALL_REQ, 3U) == 0) {
|
||||
processAll(source, m_command + 5U);
|
||||
return WX_STATUS::NONE;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ enum class WX_STATUS {
|
|||
NONE,
|
||||
CONNECT_YSF,
|
||||
CONNECT_FCS,
|
||||
DISCONNECT
|
||||
DISCONNECT,
|
||||
RECONNECT_CURRENT
|
||||
};
|
||||
|
||||
enum class WXSI_STATUS {
|
||||
|
|
|
|||
|
|
@ -433,7 +433,6 @@ int CYSFGateway::run()
|
|||
m_fcsNetwork->clearDestination();
|
||||
}
|
||||
|
||||
m_current.clear();
|
||||
m_lostTimer.stop();
|
||||
m_linkType = LINK_TYPE::NONE;
|
||||
}
|
||||
|
|
@ -454,7 +453,6 @@ int CYSFGateway::run()
|
|||
m_fcsNetwork->clearDestination();
|
||||
}
|
||||
|
||||
m_current.clear();
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.stop();
|
||||
m_linkType = LINK_TYPE::NONE;
|
||||
|
|
@ -669,6 +667,45 @@ void CYSFGateway::processWiresX(const unsigned char* buffer, const CYSFFICH& fic
|
|||
m_linkType = LINK_TYPE::NONE;
|
||||
}
|
||||
break;
|
||||
case WX_STATUS::RECONNECT_CURRENT: {
|
||||
if (m_wiresX->getReflector() == nullptr && !m_current.empty()) {
|
||||
// trying to reconnect
|
||||
if (m_current.substr(0U, 3U) == "FCS" && m_fcsNetwork != nullptr) {
|
||||
m_inactivityTimer.stop();
|
||||
m_lostTimer.stop();
|
||||
|
||||
bool ok = m_fcsNetwork->writeLink(m_current);
|
||||
m_fcsNetwork->setOptions(m_options);
|
||||
|
||||
if (ok) {
|
||||
LogMessage("Automatic (re-)connection to %s", m_current.c_str());
|
||||
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
m_linkType = LINK_TYPE::FCS;;
|
||||
}
|
||||
} else if (m_ysfNetwork != nullptr) {
|
||||
m_inactivityTimer.stop();
|
||||
m_lostTimer.stop();
|
||||
|
||||
CYSFReflector* reflector = m_reflectors->findByName(m_current);
|
||||
if (reflector != nullptr) {
|
||||
LogMessage("Automatic (re-)connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str());
|
||||
|
||||
m_wiresX->setReflector(reflector);
|
||||
|
||||
m_ysfNetwork->setDestination(reflector->m_name, reflector->m_addr, reflector->m_addrLen);
|
||||
m_ysfNetwork->setOptions(m_options);
|
||||
m_ysfNetwork->writePoll(3U);
|
||||
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
m_linkType = LINK_TYPE::YSF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue