From 76211e05bea3de1f4803b0172a57f47ff2ddfc61 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Wed, 30 Jan 2019 17:40:20 +0000 Subject: [PATCH] Update YSFGateway.cpp Added an extra field to the logic for sorting out when WiresX is processed locally and when it's not. This is done to make sure that the correct state is always matched, and that WiresX can only ever make it to a YSF2xxx subordinate, and that WiresX connect is ONLY generated when WiresX Passthrough is on. Added Logging to show when WiresX Command is sent to WiresX enabled subordinate YSF2xxx Gateway --- YSFGateway/YSFGateway.cpp | 47 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/YSFGateway/YSFGateway.cpp b/YSFGateway/YSFGateway.cpp index fc470dc..4cd6eee 100644 --- a/YSFGateway/YSFGateway.cpp +++ b/YSFGateway/YSFGateway.cpp @@ -268,26 +268,24 @@ int CYSFGateway::run() unsigned char ft = fich.getFT(); CYSFReflector* reflector = m_wiresX->getReflector(); - if (m_ysfNetwork != NULL && m_linkType == LINK_YSF) { - // Connected to a YSF reflector, figure out what kind it is - if ( (wiresXCommandPassthrough) && (reflector->m_wiresX) ) { - // Pass Control Commands (WiresX capable reflector) - processDTMF(buffer, dt); - processWiresX(buffer, fi, dt, fn, ft, true); - } - else { - // Don't Pass Control Commands (Not a WiresX capable reflector) - m_exclude = (dt == YSF_DT_DATA_FR_MODE); - processDTMF(buffer, dt); - processWiresX(buffer, fi, dt, fn, ft, false); - } + if (m_ysfNetwork != NULL && m_linkType == LINK_YSF && wiresXCommandPassthrough) { + if (reflector->m_wiresX) { + processDTMF(buffer, dt); + processWiresX(buffer, fi, dt, fn, ft, true, wiresXCommandPassthrough); + } else { + m_exclude = (dt == YSF_DT_DATA_FR_MODE); + processDTMF(buffer, dt); + processWiresX(buffer, fi, dt, fn, ft, false, wiresXCommandPassthrough); + } + } else if (wiresXCommandPassthrough) { + m_exclude = (dt == YSF_DT_DATA_FR_MODE); + processDTMF(buffer, dt); + processWiresX(buffer, fi, dt, fn, ft, false, wiresXCommandPassthrough); + } else { + m_exclude = (dt == YSF_DT_DATA_FR_MODE); + processDTMF(buffer, dt); + processWiresX(buffer, fi, dt, fn, ft, false, wiresXCommandPassthrough); } - else { - // Don't Pass Control Commands (Not connected to a reflector) - m_exclude = (dt == YSF_DT_DATA_FR_MODE); - processDTMF(buffer, dt); - processWiresX(buffer, fi, dt, fn, ft, false); - } if (m_gps != NULL) m_gps->data(buffer + 14U, buffer + 35U, fi, dt, fn, ft); @@ -523,11 +521,11 @@ void CYSFGateway::createWiresX(CYSFNetwork* rptNetwork) m_wiresX->start(); } -void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough) +void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool dontProcessWiresXLocal, bool wiresXCommandPassthrough) { assert(buffer != NULL); - WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft, wiresXCommandPassthrough); + WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft, dontProcessWiresXLocal); switch (status) { case WXS_CONNECT_YSF: { if (m_linkType == LINK_YSF) @@ -550,9 +548,10 @@ void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, u m_linkType = LINK_YSF; // If we are linking to a YSF2xxx mode, send the YSF2xxx gateway the link command too - if ( (wiresXCommandPassthrough) && (reflector->m_wiresX) ) { - m_wiresX->sendConnect(m_ysfNetwork); - } + if (reflector->m_wiresX && wiresXCommandPassthrough) { + LogMessage("Forward WiresX Connect to \"%s\"", reflector->m_name.c_str()); + m_wiresX->sendConnect(m_ysfNetwork); + } } break; case WXS_CONNECT_FCS: {