Compare incoming YSF packets with callsign instead of GATEWAY.

This commit is contained in:
Jonathan Naylor 2016-09-22 22:38:59 +01:00
parent 64ee6e56af
commit ffa5f47be2
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,7 @@
// #define DUMP_YSF
CYSFControl::CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, int rssiMultiplier, int rssiOffset) :
m_callsign(NULL),
m_network(network),
m_display(display),
m_duplex(duplex),
@ -68,6 +69,14 @@ m_fp(NULL)
m_netDest = new unsigned char[YSF_CALLSIGN_LENGTH];
m_lastFrame = new unsigned char[YSF_FRAME_LENGTH_BYTES + 2U];
m_callsign = new unsigned char[YSF_CALLSIGN_LENGTH];
std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' ');
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++)
m_callsign[i] = node.at(i);
}
CYSFControl::~CYSFControl()
@ -75,6 +84,7 @@ CYSFControl::~CYSFControl()
delete[] m_netSource;
delete[] m_netDest;
delete[] m_lastFrame;
delete[] m_callsign;
}
bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
@ -390,7 +400,7 @@ void CYSFControl::writeNetwork()
m_networkWatchdog.start();
bool gateway = ::memcmp(data + 4U, "GATEWAY ", YSF_CALLSIGN_LENGTH) == 0;
bool gateway = ::memcmp(data + 4U, m_callsign, YSF_CALLSIGN_LENGTH) == 0;
unsigned char n = (data[34U] & 0xFEU) >> 1;
bool end = (data[34U] & 0x01U) == 0x01U;

View file

@ -43,6 +43,7 @@ public:
void clock(unsigned int ms);
private:
unsigned char* m_callsign;
CYSFNetwork* m_network;
CDisplay* m_display;
bool m_duplex;