1
0
Fork 0

Merge pull request #126 from AndyTaylorTweet/master

WiresX Selective Passthrough
ycs232-kbc
Jonathan Naylor 6 years ago committed by GitHub
commit 713e63b898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,6 +48,7 @@ m_rptPort(0U),
m_myAddress(), m_myAddress(),
m_myPort(0U), m_myPort(0U),
m_wiresXMakeUpper(true), m_wiresXMakeUpper(true),
m_wiresXCommandPassthrough(false),
m_daemon(false), m_daemon(false),
m_rxFrequency(0U), m_rxFrequency(0U),
m_txFrequency(0U), m_txFrequency(0U),
@ -162,6 +163,8 @@ bool CConf::read()
m_myPort = (unsigned int)::atoi(value); m_myPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "WiresXMakeUpper") == 0) else if (::strcmp(key, "WiresXMakeUpper") == 0)
m_wiresXMakeUpper = ::atoi(value) == 1; m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "WiresXCommandPassthrough") == 0)
m_wiresXCommandPassthrough = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0) else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1; m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_INFO) { } else if (section == SECTION_INFO) {
@ -299,6 +302,11 @@ bool CConf::getWiresXMakeUpper() const
return m_wiresXMakeUpper; return m_wiresXMakeUpper;
} }
bool CConf::getWiresXCommandPassthrough() const
{
return m_wiresXCommandPassthrough;
}
bool CConf::getDaemon() const bool CConf::getDaemon() const
{ {
return m_daemon; return m_daemon;

@ -38,6 +38,7 @@ public:
std::string getMyAddress() const; std::string getMyAddress() const;
unsigned int getMyPort() const; unsigned int getMyPort() const;
bool getWiresXMakeUpper() const; bool getWiresXMakeUpper() const;
bool getWiresXCommandPassthrough() const;
bool getDaemon() const; bool getDaemon() const;
// The Info section // The Info section
@ -104,6 +105,7 @@ private:
std::string m_myAddress; std::string m_myAddress;
unsigned int m_myPort; unsigned int m_myPort;
bool m_wiresXMakeUpper; bool m_wiresXMakeUpper;
bool m_wiresXCommandPassthrough;
bool m_daemon; bool m_daemon;
unsigned int m_rxFrequency; unsigned int m_rxFrequency;

@ -180,7 +180,7 @@ bool CWiresX::start()
return true; return true;
} }
WX_STATUS CWiresX::process(const unsigned char* data, const unsigned char* source, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft) WX_STATUS CWiresX::process(const unsigned char* data, const unsigned char* source, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough)
{ {
assert(data != NULL); assert(data != NULL);
assert(source != NULL); assert(source != NULL);
@ -227,23 +227,44 @@ WX_STATUS CWiresX::process(const unsigned char* data, const unsigned char* sourc
if (!valid) if (!valid)
return WXS_NONE; return WXS_NONE;
if (::memcmp(m_command + 1U, DX_REQ, 3U) == 0) { // If we are using WiresX Passthrough (we already know we are on a YSF2xxx room from YSFGateway
processDX(source); if (wiresXCommandPassthrough) {
return WXS_NONE; if (::memcmp(m_command + 1U, DX_REQ, 3U) == 0) {
} else if (::memcmp(m_command + 1U, ALL_REQ, 3U) == 0) { return WXS_NONE;
processAll(source, m_command + 5U); } else if (::memcmp(m_command + 1U, ALL_REQ, 3U) == 0) {
return WXS_NONE; return WXS_NONE;
} else if (::memcmp(m_command + 1U, CONN_REQ, 3U) == 0) { } else if (::memcmp(m_command + 1U, CONN_REQ, 3U) == 0) {
return processConnect(source, m_command + 5U); return WXS_NONE;
} else if (::memcmp(m_command + 1U, DISC_REQ, 3U) == 0) { } else if (::memcmp(m_command + 1U, DISC_REQ, 3U) == 0) {
processDisconnect(source); processDisconnect(source);
return WXS_DISCONNECT; return WXS_DISCONNECT;
} else if (::memcmp(m_command + 1U, CAT_REQ, 3U) == 0) { } else if (::memcmp(m_command + 1U, CAT_REQ, 3U) == 0) {
processCategory(source, m_command + 5U); return WXS_NONE;
return WXS_NONE; } else {
} else { CUtils::dump("Unknown Wires-X command", m_command, cmd_len);
CUtils::dump("Unknown Wires-X command", m_command, cmd_len); return WXS_NONE;
return WXS_NONE; }
}
// Origional Code Here
else {
if (::memcmp(m_command + 1U, DX_REQ, 3U) == 0) {
processDX(source);
return WXS_NONE;
} else if (::memcmp(m_command + 1U, ALL_REQ, 3U) == 0) {
processAll(source, m_command + 5U);
return WXS_NONE;
} else if (::memcmp(m_command + 1U, CONN_REQ, 3U) == 0) {
return processConnect(source, m_command + 5U);
} else if (::memcmp(m_command + 1U, DISC_REQ, 3U) == 0) {
processDisconnect(source);
return WXS_DISCONNECT;
} else if (::memcmp(m_command + 1U, CAT_REQ, 3U) == 0) {
processCategory(source, m_command + 5U);
return WXS_NONE;
} else {
CUtils::dump("Unknown Wires-X command", m_command, cmd_len);
return WXS_NONE;
}
} }
} }

@ -56,7 +56,7 @@ public:
bool start(); bool start();
WX_STATUS process(const unsigned char* data, const unsigned char* source, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft); WX_STATUS process(const unsigned char* data, const unsigned char* source, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough);
CYSFReflector* getReflector() const; CYSFReflector* getReflector() const;
void setReflector(CYSFReflector* reflector); void setReflector(CYSFReflector* reflector);
@ -87,6 +87,7 @@ private:
unsigned int m_start; unsigned int m_start;
std::string m_search; std::string m_search;
std::vector<CYSFReflector*> m_category; std::vector<CYSFReflector*> m_category;
bool m_wiresXCommandPassthrough;
WX_STATUS processConnect(const unsigned char* source, const unsigned char* data); WX_STATUS processConnect(const unsigned char* source, const unsigned char* data);
void processDX(const unsigned char* source); void processDX(const unsigned char* source);

@ -244,6 +244,7 @@ int CYSFGateway::run()
m_startup = m_conf.getNetworkStartup(); m_startup = m_conf.getNetworkStartup();
bool revert = m_conf.getNetworkRevert(); bool revert = m_conf.getNetworkRevert();
bool wiresXCommandPassthrough = m_conf.getWiresXCommandPassthrough();
startupLinking(); startupLinking();
@ -266,12 +267,18 @@ int CYSFGateway::run()
unsigned char fn = fich.getFN(); unsigned char fn = fich.getFN();
unsigned char ft = fich.getFT(); unsigned char ft = fich.getFT();
// Don't send out control data CYSFReflector* reflector = m_wiresX->getReflector();
m_exclude = (dt == YSF_DT_DATA_FR_MODE); if ( (wiresXCommandPassthrough) && (m_linkType == LINK_YSF) && (reflector->m_name.rfind("YSF2DMR", 0) == 0 || reflector->m_name.rfind("YSF2P25", 0) == 0 || reflector->m_name.rfind("YSF2NXDN", 0) == 0) ) {
// Allow WiresX to Pass Through
processWiresX(buffer, fi, dt, fn, ft); processDTMF(buffer, dt);
processWiresX(buffer, fi, dt, fn, ft, true);
processDTMF(buffer, dt); }
else {
// Don't Pass Control Commands
m_exclude = (dt == YSF_DT_DATA_FR_MODE);
processDTMF(buffer, dt);
processWiresX(buffer, fi, dt, fn, ft, false);
}
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);
@ -507,11 +514,11 @@ void CYSFGateway::createWiresX(CYSFNetwork* rptNetwork)
m_wiresX->start(); m_wiresX->start();
} }
void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft) void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough)
{ {
assert(buffer != NULL); assert(buffer != NULL);
WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft); WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft, wiresXCommandPassthrough);
switch (status) { switch (status) {
case WXS_CONNECT_YSF: { case WXS_CONNECT_YSF: {
if (m_linkType == LINK_YSF) if (m_linkType == LINK_YSF)
@ -567,6 +574,10 @@ void CYSFGateway::processWiresX(const unsigned char* buffer, unsigned char fi, u
case WXS_DISCONNECT: case WXS_DISCONNECT:
if (m_linkType == LINK_YSF) { if (m_linkType == LINK_YSF) {
LogMessage("Disconnect has been requested by %10.10s", buffer + 14U); LogMessage("Disconnect has been requested by %10.10s", buffer + 14U);
if ( (wiresXCommandPassthrough) && (::memcmp(buffer + 0U, "YSFD", 4U) == 0) ) {
// Send the disconnect to the YSF2xxx gateway too
m_ysfNetwork->write(buffer);
}
m_ysfNetwork->writeUnlink(3U); m_ysfNetwork->writeUnlink(3U);
m_ysfNetwork->clearDestination(); m_ysfNetwork->clearDestination();

@ -66,7 +66,7 @@ private:
void startupLinking(); void startupLinking();
std::string calculateLocator(); std::string calculateLocator();
void processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft); void processWiresX(const unsigned char* buffer, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough);
void processDTMF(unsigned char* buffer, unsigned char dt); void processDTMF(unsigned char* buffer, unsigned char dt);
void createWiresX(CYSFNetwork* rptNetwork); void createWiresX(CYSFNetwork* rptNetwork);
void createGPS(); void createGPS();

@ -8,6 +8,7 @@ RptPort=3200
LocalAddress=127.0.0.1 LocalAddress=127.0.0.1
LocalPort=4200 LocalPort=4200
WiresXMakeUpper=1 WiresXMakeUpper=1
WiresXCommandPassthrough=0
Daemon=0 Daemon=0
[Info] [Info]

Loading…
Cancel
Save