|
|
@ -80,11 +80,14 @@ m_suffix(),
|
|
|
|
m_conf(configFile),
|
|
|
|
m_conf(configFile),
|
|
|
|
m_gps(NULL),
|
|
|
|
m_gps(NULL),
|
|
|
|
m_wiresX(NULL),
|
|
|
|
m_wiresX(NULL),
|
|
|
|
m_dtmf(NULL),
|
|
|
|
m_dtmf(),
|
|
|
|
m_ysfNetwork(NULL),
|
|
|
|
m_ysfNetwork(NULL),
|
|
|
|
m_fcsNetwork(NULL),
|
|
|
|
m_fcsNetwork(NULL),
|
|
|
|
m_linked(false),
|
|
|
|
m_linkType(LINK_NONE),
|
|
|
|
m_exclude(false)
|
|
|
|
m_exclude(false),
|
|
|
|
|
|
|
|
m_inactivityTimer(1000U),
|
|
|
|
|
|
|
|
m_lostTimer(1000U, 120U),
|
|
|
|
|
|
|
|
m_ysfPollTimer(1000U, 5U)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -205,20 +208,18 @@ int CYSFGateway::run()
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CTimer inactivityTimer(1000U, m_conf.getYSFNetworkInactivityTimeout() * 60U);
|
|
|
|
m_inactivityTimer.setTimeout(m_conf.getYSFNetworkInactivityTimeout() * 60U);
|
|
|
|
CTimer lostTimer(1000U, 120U);
|
|
|
|
|
|
|
|
CTimer pollTimer(1000U, 5U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool revert = m_conf.getYSFNetworkRevert();
|
|
|
|
bool revert = m_conf.getYSFNetworkRevert();
|
|
|
|
std::string startup = m_conf.getYSFNetworkStartup();
|
|
|
|
std::string startup = m_conf.getYSFNetworkStartup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool fcsNetworkEnabled = m_conf.getFCSNetworkEnabled();
|
|
|
|
bool ysfNetworkEnabled = m_conf.getYSFNetworkEnabled();
|
|
|
|
bool ysfNetworkEnabled = m_conf.getYSFNetworkEnabled();
|
|
|
|
if (ysfNetworkEnabled) {
|
|
|
|
if (ysfNetworkEnabled) {
|
|
|
|
std::string fileName = m_conf.getYSFNetworkHosts();
|
|
|
|
std::string fileName = m_conf.getYSFNetworkHosts();
|
|
|
|
unsigned int reloadTime = m_conf.getYSFNetworkReloadTime();
|
|
|
|
unsigned int reloadTime = m_conf.getYSFNetworkReloadTime();
|
|
|
|
|
|
|
|
|
|
|
|
m_wiresX = new CWiresX(m_callsign, m_suffix, &rptNetwork, fileName, reloadTime);
|
|
|
|
m_wiresX = new CWiresX(m_callsign, m_suffix, &rptNetwork, fileName, reloadTime);
|
|
|
|
m_dtmf = new CDTMF;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string name = m_conf.getName();
|
|
|
|
std::string name = m_conf.getName();
|
|
|
|
unsigned int txFrequency = m_conf.getTxFrequency();
|
|
|
|
unsigned int txFrequency = m_conf.getTxFrequency();
|
|
|
@ -251,12 +252,12 @@ int CYSFGateway::run()
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
if (!revert)
|
|
|
|
if (!revert)
|
|
|
|
inactivityTimer.start();
|
|
|
|
m_inactivityTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
lostTimer.start();
|
|
|
|
m_lostTimer.start();
|
|
|
|
pollTimer.start();
|
|
|
|
m_ysfPollTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = true;
|
|
|
|
m_linkType = LINK_YSF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,133 +284,52 @@ int CYSFGateway::run()
|
|
|
|
// Don't send out control data
|
|
|
|
// Don't send out control data
|
|
|
|
m_exclude = (dt == YSF_DT_DATA_FR_MODE);
|
|
|
|
m_exclude = (dt == YSF_DT_DATA_FR_MODE);
|
|
|
|
|
|
|
|
|
|
|
|
if (m_wiresX != NULL) {
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft);
|
|
|
|
processWiresX(buffer, fi, dt, fn, ft);
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case WXS_CONNECT: {
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CYSFReflector* reflector = m_wiresX->getReflector();
|
|
|
|
|
|
|
|
LogMessage("Connect to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.start();
|
|
|
|
|
|
|
|
lostTimer.start();
|
|
|
|
|
|
|
|
pollTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXS_DISCONNECT:
|
|
|
|
|
|
|
|
LogMessage("Disconnect has been requested by %10.10s", buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.stop();
|
|
|
|
|
|
|
|
lostTimer.stop();
|
|
|
|
|
|
|
|
pollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = WXS_NONE;
|
|
|
|
|
|
|
|
switch (dt) {
|
|
|
|
|
|
|
|
case YSF_DT_VD_MODE2:
|
|
|
|
|
|
|
|
status = m_dtmf->decodeVDMode2(buffer + 35U, (buffer[34U] & 0x01U) == 0x01U);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case WXS_CONNECT: {
|
|
|
|
|
|
|
|
std::string id = m_dtmf->getReflector();
|
|
|
|
|
|
|
|
CYSFReflector* reflector = m_wiresX->getReflector(id);
|
|
|
|
|
|
|
|
if (reflector != NULL) {
|
|
|
|
|
|
|
|
m_wiresX->processConnect(reflector);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_linked) {
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogMessage("Connect via DTMF to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.start();
|
|
|
|
|
|
|
|
lostTimer.start();
|
|
|
|
|
|
|
|
pollTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXS_DISCONNECT:
|
|
|
|
|
|
|
|
if (m_linked) {
|
|
|
|
|
|
|
|
m_wiresX->processDisconnect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogMessage("Disconnect via DTMF has been requested by %10.10s", buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.stop();
|
|
|
|
|
|
|
|
lostTimer.stop();
|
|
|
|
|
|
|
|
pollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = false;
|
|
|
|
processDTMF(buffer, dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_gps != NULL)
|
|
|
|
if (m_gps != NULL)
|
|
|
|
m_gps->data(buffer + 14U, buffer + 35U, fi, dt, fn, ft);
|
|
|
|
m_gps->data(buffer + 14U, buffer + 35U, fi, dt, fn, ft);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ysfNetworkEnabled && m_linked && !m_exclude) {
|
|
|
|
if (ysfNetworkEnabled && m_linkType == LINK_YSF && !m_exclude) {
|
|
|
|
m_ysfNetwork->write(buffer);
|
|
|
|
m_ysfNetwork->write(buffer);
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
inactivityTimer.start();
|
|
|
|
m_inactivityTimer.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fcsNetworkEnabled && m_linkType == LINK_FCS && !m_exclude) {
|
|
|
|
|
|
|
|
m_fcsNetwork->write(buffer);
|
|
|
|
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
|
|
|
|
m_inactivityTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 (m_dtmf != NULL)
|
|
|
|
m_dtmf.reset();
|
|
|
|
m_dtmf->reset();
|
|
|
|
|
|
|
|
m_exclude = false;
|
|
|
|
m_exclude = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while (m_ysfNetwork->read(buffer) > 0U) {
|
|
|
|
while (m_ysfNetwork->read(buffer) > 0U) {
|
|
|
|
if (ysfNetworkEnabled && m_linked) {
|
|
|
|
if (ysfNetworkEnabled && m_linkType == LINK_YSF) {
|
|
|
|
|
|
|
|
// Only pass through YSF data packets
|
|
|
|
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
|
|
|
|
rptNetwork.write(buffer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_lostTimer.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (m_fcsNetwork->read(buffer) > 0U) {
|
|
|
|
|
|
|
|
if (fcsNetworkEnabled && m_linkType == LINK_FCS) {
|
|
|
|
// Only pass through YSF data packets
|
|
|
|
// Only pass through YSF data packets
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
|
|
|
rptNetwork.write(buffer);
|
|
|
|
rptNetwork.write(buffer);
|
|
|
|
|
|
|
|
|
|
|
|
lostTimer.start();
|
|
|
|
m_lostTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -424,9 +344,9 @@ int CYSFGateway::run()
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
m_wiresX->clock(ms);
|
|
|
|
m_wiresX->clock(ms);
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.clock(ms);
|
|
|
|
m_inactivityTimer.clock(ms);
|
|
|
|
if (inactivityTimer.isRunning() && inactivityTimer.hasExpired()) {
|
|
|
|
if (m_inactivityTimer.isRunning() && m_inactivityTimer.hasExpired()) {
|
|
|
|
if (m_linked) {
|
|
|
|
if (m_linkType == LINK_YSF) {
|
|
|
|
CYSFReflector* reflector = NULL;
|
|
|
|
CYSFReflector* reflector = NULL;
|
|
|
|
if (revert && !startup.empty() && m_wiresX != NULL)
|
|
|
|
if (revert && !startup.empty() && m_wiresX != NULL)
|
|
|
|
reflector = m_wiresX->getReflector(startup);
|
|
|
|
reflector = m_wiresX->getReflector(startup);
|
|
|
@ -434,6 +354,7 @@ int CYSFGateway::run()
|
|
|
|
if (reflector != NULL) {
|
|
|
|
if (reflector != NULL) {
|
|
|
|
LogMessage("Reverting connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str());
|
|
|
|
LogMessage("Reverting connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
m_wiresX->processConnect(reflector);
|
|
|
|
m_wiresX->processConnect(reflector);
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
@ -445,8 +366,8 @@ int CYSFGateway::run()
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
lostTimer.start();
|
|
|
|
m_lostTimer.start();
|
|
|
|
pollTimer.start();
|
|
|
|
m_ysfPollTimer.start();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LogMessage("Disconnecting due to inactivity");
|
|
|
|
LogMessage("Disconnecting due to inactivity");
|
|
|
|
|
|
|
|
|
|
|
@ -458,36 +379,37 @@ int CYSFGateway::run()
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
lostTimer.stop();
|
|
|
|
m_lostTimer.stop();
|
|
|
|
pollTimer.stop();
|
|
|
|
m_ysfPollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = false;
|
|
|
|
m_linkType = LINK_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.stop();
|
|
|
|
m_inactivityTimer.stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lostTimer.clock(ms);
|
|
|
|
m_lostTimer.clock(ms);
|
|
|
|
if (lostTimer.isRunning() && lostTimer.hasExpired()) {
|
|
|
|
if (m_lostTimer.isRunning() && m_lostTimer.hasExpired()) {
|
|
|
|
LogWarning("Link has failed, polls lost");
|
|
|
|
LogWarning("Link has failed, polls lost");
|
|
|
|
|
|
|
|
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
m_wiresX->processDisconnect();
|
|
|
|
m_wiresX->processDisconnect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_ysfNetwork != NULL)
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
inactivityTimer.stop();
|
|
|
|
m_inactivityTimer.stop();
|
|
|
|
lostTimer.stop();
|
|
|
|
m_lostTimer.stop();
|
|
|
|
pollTimer.stop();
|
|
|
|
m_ysfPollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
m_linked = false;
|
|
|
|
m_linkType = LINK_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pollTimer.clock(ms);
|
|
|
|
m_ysfPollTimer.clock(ms);
|
|
|
|
if (pollTimer.isRunning() && pollTimer.hasExpired()) {
|
|
|
|
if (m_ysfPollTimer.isRunning() && m_ysfPollTimer.hasExpired()) {
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
pollTimer.start();
|
|
|
|
m_ysfPollTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ms < 5U)
|
|
|
|
if (ms < 5U)
|
|
|
@ -506,7 +428,6 @@ int CYSFGateway::run()
|
|
|
|
delete m_ysfNetwork;
|
|
|
|
delete m_ysfNetwork;
|
|
|
|
delete m_fcsNetwork;
|
|
|
|
delete m_fcsNetwork;
|
|
|
|
delete m_wiresX;
|
|
|
|
delete m_wiresX;
|
|
|
|
delete m_dtmf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::LogFinalise();
|
|
|
|
::LogFinalise();
|
|
|
|
|
|
|
|
|
|
|
@ -539,3 +460,114 @@ void CYSFGateway::createGPS()
|
|
|
|
m_gps = NULL;
|
|
|
|
m_gps = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
assert(buffer != NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft);
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case WXS_CONNECT_YSF: {
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CYSFReflector* reflector = m_wiresX->getReflector();
|
|
|
|
|
|
|
|
LogMessage("Connect to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_inactivityTimer.start();
|
|
|
|
|
|
|
|
m_lostTimer.start();
|
|
|
|
|
|
|
|
m_ysfPollTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linkType = LINK_YSF;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXS_DISCONNECT:
|
|
|
|
|
|
|
|
LogMessage("Disconnect has been requested by %10.10s", buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_inactivityTimer.stop();
|
|
|
|
|
|
|
|
m_lostTimer.stop();
|
|
|
|
|
|
|
|
m_ysfPollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linkType = LINK_NONE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CYSFGateway::processDTMF(const unsigned char* buffer, unsigned char dt)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
assert(buffer != NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WX_STATUS status = WXS_NONE;
|
|
|
|
|
|
|
|
switch (dt) {
|
|
|
|
|
|
|
|
case YSF_DT_VD_MODE2:
|
|
|
|
|
|
|
|
status = m_dtmf.decodeVDMode2(buffer + 35U, (buffer[34U] & 0x01U) == 0x01U);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case WXS_CONNECT_YSF: {
|
|
|
|
|
|
|
|
std::string id = m_dtmf.getReflector();
|
|
|
|
|
|
|
|
CYSFReflector* reflector = m_wiresX->getReflector(id);
|
|
|
|
|
|
|
|
if (reflector != NULL) {
|
|
|
|
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
|
|
|
|
m_wiresX->processConnect(reflector);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_linkType == LINK_YSF) {
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogMessage("Connect via DTMF to %5.5s - \"%s\" has been requested by %10.10s", reflector->m_id.c_str(), reflector->m_name.c_str(), buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->setDestination(reflector->m_address, reflector->m_port);
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
m_ysfNetwork->writePoll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_inactivityTimer.start();
|
|
|
|
|
|
|
|
m_lostTimer.start();
|
|
|
|
|
|
|
|
m_ysfPollTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linkType = LINK_YSF;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXS_DISCONNECT:
|
|
|
|
|
|
|
|
if (m_linkType == LINK_YSF) {
|
|
|
|
|
|
|
|
if (m_wiresX != NULL)
|
|
|
|
|
|
|
|
m_wiresX->processDisconnect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogMessage("Disconnect via DTMF has been requested by %10.10s", buffer + 14U);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->writeUnlink();
|
|
|
|
|
|
|
|
m_ysfNetwork->clearDestination();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_inactivityTimer.stop();
|
|
|
|
|
|
|
|
m_lostTimer.stop();
|
|
|
|
|
|
|
|
m_ysfPollTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_linkType = LINK_NONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|