1
0
Fork 0

Now have a valid response to the DX command :-)

ycs232-kbc
Jonathan Naylor 9 years ago
parent 64bf2108ee
commit b71c77a9b8

@ -134,15 +134,12 @@ void CNetwork::clock(unsigned int ms)
if (length <= 0) if (length <= 0)
return; return;
if (address.s_addr != m_address.s_addr || port != m_port) { if (address.s_addr != m_address.s_addr || port != m_port)
LogDebug("Addr: %u != %u || Port: %u != %u", address.s_addr, m_address.s_addr, port, m_port);
CUtils::dump("Data from unknown address/port", buffer, length);
return; return;
}
// Handle incoming polls // Handle incoming polls
if (::memcmp(buffer, "YSFP", 4U) == 0) { if (::memcmp(buffer, "YSFP", 4U) == 0) {
// XXX How to handle lost polls? writePoll();
return; return;
} }

@ -52,10 +52,14 @@ bool CReflectors::load()
std::vector<CYSFHost*>& hostList = hosts.list(); std::vector<CYSFHost*>& hostList = hosts.list();
for (std::vector<CYSFHost*>::const_iterator it = hostList.begin(); it != hostList.end(); ++it) { for (std::vector<CYSFHost*>::const_iterator it = hostList.begin(); it != hostList.end(); ++it) {
CYSFReflector* reflector = new CYSFReflector; in_addr address = CUDPSocket::lookup((*it)->m_address);
reflector->m_address = CUDPSocket::lookup((*it)->m_address);
reflector->m_port = (*it)->m_port; if (address.s_addr != INADDR_NONE) {
m_reflectors.push_back(reflector); CYSFReflector* reflector = new CYSFReflector;
reflector->m_address = address;
reflector->m_port = (*it)->m_port;
m_reflectors.push_back(reflector);
}
} }
m_it = m_reflectors.begin(); m_it = m_reflectors.begin();

@ -39,7 +39,7 @@ const unsigned char ALL_RESP[] = {0x5DU, 0x46U, 0x5FU, 0x26U};
const unsigned char DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U}; const unsigned char DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U};
const unsigned char NET_HEADER[] = "YSFDGATEWAY ALL "; const unsigned char NET_HEADER[] = "YSFDGATEWAY ALL ";
CWiresX::CWiresX(const std::string& callsign, CNetwork* network, const std::string& hostsFile, unsigned int statusPort) : CWiresX::CWiresX(const std::string& callsign, CNetwork* network, const std::string& hostsFile, unsigned int statusPort) :
m_callsign(callsign), m_callsign(callsign),
@ -52,6 +52,7 @@ m_txFrequency(0U),
m_rxFrequency(0U), m_rxFrequency(0U),
m_timer(1000U, 0U, 100U + 750U), m_timer(1000U, 0U, 100U + 750U),
m_seqNo(0U), m_seqNo(0U),
m_header(NULL),
m_source(NULL), m_source(NULL),
m_csd1(NULL), m_csd1(NULL),
m_csd2(NULL), m_csd2(NULL),
@ -63,6 +64,7 @@ m_status(WXSI_NONE)
m_callsign.resize(YSF_CALLSIGN_LENGTH, ' '); m_callsign.resize(YSF_CALLSIGN_LENGTH, ' ');
m_header = new unsigned char[34U];
m_source = new unsigned char[20U]; m_source = new unsigned char[20U];
m_csd1 = new unsigned char[20U]; m_csd1 = new unsigned char[20U];
m_csd2 = new unsigned char[20U]; m_csd2 = new unsigned char[20U];
@ -75,6 +77,7 @@ CWiresX::~CWiresX()
delete[] m_csd2; delete[] m_csd2;
delete[] m_csd1; delete[] m_csd1;
delete[] m_source; delete[] m_source;
delete[] m_header;
} }
void CWiresX::setInfo(const std::string& name, unsigned int txFrequency, unsigned int rxFrequency) void CWiresX::setInfo(const std::string& name, unsigned int txFrequency, unsigned int rxFrequency)
@ -121,6 +124,12 @@ void CWiresX::setInfo(const std::string& name, unsigned int txFrequency, unsigne
m_csd3[i + 0U] = m_id.at(i); m_csd3[i + 0U] = m_id.at(i);
m_csd3[i + 10U] = m_id.at(i); m_csd3[i + 10U] = m_id.at(i);
} }
for (unsigned int i = 0U; i < 34U; i++)
m_header[i] = NET_HEADER[i];
for (unsigned int i = 0U; i < 10U; i++)
m_header[i + 14U] = m_callsign.at(i);
} }
bool CWiresX::start() bool CWiresX::start()
@ -257,7 +266,7 @@ void CWiresX::createReply(const unsigned char* data, unsigned int length)
// Write the header // Write the header
unsigned char buffer[200U]; unsigned char buffer[200U];
::memcpy(buffer, NET_HEADER, 34U); ::memcpy(buffer, m_header, 34U);
buffer[34U] = 0x00U; buffer[34U] = 0x00U;
CSync::add(buffer + 35U); CSync::add(buffer + 35U);

@ -65,6 +65,7 @@ private:
unsigned int m_rxFrequency; unsigned int m_rxFrequency;
CTimer m_timer; CTimer m_timer;
unsigned char m_seqNo; unsigned char m_seqNo;
unsigned char* m_header;
unsigned char* m_source; unsigned char* m_source;
unsigned char* m_csd1; unsigned char* m_csd1;
unsigned char* m_csd2; unsigned char* m_csd2;

@ -211,8 +211,8 @@ void CYSFFICH::setBT(unsigned char bt)
void CYSFFICH::setFN(unsigned char fn) void CYSFFICH::setFN(unsigned char fn)
{ {
m_fich[0U] &= 0xC7U; m_fich[1U] &= 0xC7U;
m_fich[0U] |= (fn << 3) & 0x38U; m_fich[1U] |= (fn << 3) & 0x38U;
} }
void CYSFFICH::setFT(unsigned char ft) void CYSFFICH::setFT(unsigned char ft)

Loading…
Cancel
Save