1
0
Fork 0

Add the Options to the YSF network in the DG-Id Gateway.

ycs232-kbc
Jonathan Naylor 4 years ago
parent 241c76e606
commit a20dec80ca

@ -242,10 +242,11 @@ int CDGIdGateway::run()
} else if (type == "YSF") {
std::string name = (*it)->m_name;
unsigned int local = (*it)->m_local;
std::string options = (*it)->m_options;
CYSFReflector* reflector = reflectors->findByName(name);
if (reflector != NULL) {
dgIdNetwork[dgid] = new CYSFNetwork(local, reflector->m_name, reflector->m_addr, reflector->m_addrLen, m_callsign, debug);;
dgIdNetwork[dgid] = new CYSFNetwork(local, reflector->m_name, reflector->m_addr, reflector->m_addrLen, m_callsign, options, debug);;
dgIdNetwork[dgid]->m_modes = DT_VD_MODE1 | DT_VD_MODE2 | DT_VOICE_FR_MODE | DT_DATA_FR_MODE;
dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -285,7 +286,7 @@ int CDGIdGateway::run()
sockaddr_storage addr;
unsigned int addrLen;
if (CUDPSocket::lookup((*it)->m_address, (*it)->m_port, addr, addrLen) == 0) {
dgIdNetwork[dgid] = new CYSFNetwork(local, "PARROT", addr, addrLen, m_callsign, debug);
dgIdNetwork[dgid] = new CYSFNetwork(local, "PARROT", addr, addrLen, m_callsign, "", debug);
dgIdNetwork[dgid]->m_modes = DT_VD_MODE1 | DT_VD_MODE2 | DT_VOICE_FR_MODE | DT_DATA_FR_MODE;
dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -299,7 +300,7 @@ int CDGIdGateway::run()
sockaddr_storage addr;
unsigned int addrLen;
if (CUDPSocket::lookup((*it)->m_address, (*it)->m_port, addr, addrLen) == 0) {
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2DMR", addr, addrLen, m_callsign, debug);
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2DMR", addr, addrLen, m_callsign, "", debug);
dgIdNetwork[dgid]->m_modes = DT_VD_MODE1 | DT_VD_MODE2;
dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -313,7 +314,7 @@ int CDGIdGateway::run()
sockaddr_storage addr;
unsigned int addrLen;
if (CUDPSocket::lookup((*it)->m_address, (*it)->m_port, addr, addrLen) == 0) {
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2NXDN", addr, addrLen, m_callsign, debug);
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2NXDN", addr, addrLen, m_callsign, "", debug);
dgIdNetwork[dgid]->m_modes = DT_VD_MODE1 | DT_VD_MODE2;
dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -327,7 +328,7 @@ int CDGIdGateway::run()
sockaddr_storage addr;
unsigned int addrLen;
if (CUDPSocket::lookup((*it)->m_address, (*it)->m_port, addr, addrLen) == 0) {
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2P25", addr, addrLen, m_callsign, debug);
dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2P25", addr, addrLen, m_callsign, "", debug);
dgIdNetwork[dgid]->m_modes = DT_VOICE_FR_MODE;
dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;

@ -108,6 +108,7 @@ Type=YSF
Static=0
Name=0-0-CQ-UK-ROOM
Local=42023
#Options=20;21;
#RFHangTime=120
#NetHangTime=60
Debug=0

@ -33,6 +33,7 @@ m_debug(debug),
m_addr(addr),
m_addrLen(addrLen),
m_poll(NULL),
m_options(NULL),
m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U),
@ -54,12 +55,13 @@ m_linked(true)
}
}
CYSFNetwork::CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, bool debug) :
CYSFNetwork::CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, const std::string& options, bool debug) :
m_socket(localPort),
m_debug(debug),
m_addr(addr),
m_addrLen(addrLen),
m_poll(NULL),
m_options(NULL),
m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U),
@ -79,11 +81,27 @@ m_linked(false)
m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i);
}
std::string opt = options;
if (!opt.empty()) {
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++)
m_options[i + 4U] = node.at(i);
opt.resize(50, ' ');
for (unsigned int i = 0U; i < (50U - 4U - YSF_CALLSIGN_LENGTH); i++)
m_options[i + 4U + YSF_CALLSIGN_LENGTH] = opt.at(i);
}
}
CYSFNetwork::~CYSFNetwork()
{
delete[] m_poll;
delete[] m_unlink;
delete[] m_options;
}
std::string CYSFNetwork::getDesc(unsigned int dgId)
@ -126,6 +144,9 @@ void CYSFNetwork::writePoll()
m_pollTimer.start();
m_socket.write(m_poll, 14U, m_addr, m_addrLen);
if (m_options != NULL)
m_socket.write(m_options, 50U, m_addr, m_addrLen);
}
void CYSFNetwork::unlink()
@ -163,6 +184,9 @@ void CYSFNetwork::clock(unsigned int ms)
LogMessage("Linked to %s", m_name.c_str());
m_linked = true;
if (m_options != NULL)
m_socket.write(m_options, 50U, m_addr, m_addrLen);
}
if (m_debug)

@ -31,9 +31,11 @@
class CYSFNetwork : public CDGIdNetwork {
public:
CYSFNetwork(const std::string& localAddress, unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, bool debug);
CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, bool debug);
CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, const std::string& options, bool debug);
virtual ~CYSFNetwork();
void setOptions(const std::string& options);
virtual std::string getDesc(unsigned int dgId);
virtual bool open();
@ -56,6 +58,7 @@ private:
sockaddr_storage m_addr;
unsigned int m_addrLen;
unsigned char* m_poll;
unsigned char* m_options;
unsigned char* m_unlink;
CRingBuffer<unsigned char> m_buffer;
CTimer m_pollTimer;

Loading…
Cancel
Save