1
0
Fork 0

Add explicit support for YCS reflectors.

ycs232-kbc
Jonathan Naylor 4 years ago
parent 5a44d85c0f
commit 977a344da3

@ -58,7 +58,6 @@ m_power(0U),
m_latitude(0.0F),
m_longitude(0.0F),
m_height(0),
m_name(),
m_description(),
m_logDisplayLevel(0U),
m_logFileLevel(0U),
@ -197,8 +196,6 @@ bool CConf::read()
m_longitude = float(::atof(value));
else if (::strcmp(key, "Height") == 0)
m_height = ::atoi(value);
else if (::strcmp(key, "Name") == 0)
m_name = value;
else if (::strcmp(key, "Description") == 0)
m_description = value;
} else if (section == SECTION_LOG) {
@ -374,11 +371,6 @@ int CConf::getHeight() const
return m_height;
}
std::string CConf::getName() const
{
return m_name;
}
std::string CConf::getDescription() const
{
return m_description;

@ -68,7 +68,6 @@ public:
float getLatitude() const;
float getLongitude() const;
int getHeight() const;
std::string getName() const;
std::string getDescription() const;
// The Log section
@ -115,7 +114,6 @@ private:
float m_latitude;
float m_longitude;
int m_height;
std::string m_name;
std::string m_description;
unsigned int m_logDisplayLevel;

@ -261,12 +261,17 @@ int CDGIdGateway::run()
LogWarning("Unknown YSF reflector: %s", name.c_str());
}
} else if (type == "YCS") {
std::string name = (*it)->m_name;
unsigned int local = (*it)->m_local;
std::string name = (*it)->m_name;
unsigned int local = (*it)->m_local;
unsigned int txFrequency = m_conf.getTxFrequency();
unsigned int rxFrequency = m_conf.getRxFrequency();
std::string locator = calculateLocator();
std::string description = m_conf.getDescription();
unsigned int id = m_conf.getId();
CYSFReflector* reflector = reflectors->findByName(name);
if (reflector != NULL) {
dgIdNetwork[dgid] = new CYSFNetwork(local, reflector->m_name, reflector->m_addr, reflector->m_addrLen, m_callsign, (*it)->m_netDGId, debug);
dgIdNetwork[dgid] = new CYSFNetwork(local, reflector->m_name, reflector->m_addr, reflector->m_addrLen, m_callsign, rxFrequency, txFrequency, locator, description, id, (*it)->m_netDGId, 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;
@ -520,7 +525,7 @@ int CDGIdGateway::run()
state = DS_NOTLINKED;
currentDGId = 0U;
inactivityTimer.stop();
nPips = 2U;
sendPips(2U);
}
if (dgIdNetwork[currentDGId] != NULL) {

@ -16,11 +16,10 @@ Daemon=0
RXFrequency=430475000
TXFrequency=439475000
Power=1
Latitude=0.0
Longitude=0.0
Latitude=50.9
Longitude=-0.5
Height=0
Name=Nowhere
Description=Multi-Mode Repeater
Description=Nowhere
[Log]
# Logging levels, 0=No logging
@ -50,7 +49,7 @@ Debug=0
[DGId=1]
# YSF Local Parrot
Type=Parrot
Static=1
Static=0
Address=127.0.0.1
Port=42012
Local=42013
@ -61,7 +60,7 @@ Debug=0
[DGId=10]
# Local YSF2DMR TG23590
Type=YSF2DMR
Static=1
Static=0
Address=127.0.0.1
Port=42014
Local=42015
@ -72,7 +71,7 @@ Debug=0
[DGId=11]
# Local YSF2DMR TG23510
Type=YSF2DMR
Static=1
Static=0
Address=127.0.0.1
Port=42016
Local=42017
@ -83,7 +82,7 @@ Debug=0
[DGId=20]
# Local YSF2NXDN TG65000
Type=YSF2NXDN
Static=1
Static=0
Address=127.0.0.1
Port=42018
Local=42019
@ -94,7 +93,7 @@ Debug=0
[DGId=30]
# Local YSF2P25 TG10200
Type=YSF2P25
Static=1
Static=0
Address=127.0.0.1
Port=42020
Local=42021
@ -105,9 +104,9 @@ Debug=0
[DGId=40]
# YSF Reflector CQ-UK
Type=YSF
Static=0
Name=0-0-CQ-UK-ROOM
Local=42023
Static=1
Name=0-0-CQ-UK-C4FM
Local=42022
#RFHangTime=120
#NetHangTime=60
Debug=0
@ -117,7 +116,7 @@ Debug=0
Type=YSF
Static=0
Name=Alabama-Link
Local=42024
Local=42023
#RFHangTime=120
#NetHangTime=60
Debug=0
@ -127,18 +126,18 @@ Debug=0
Type=FCS
Static=0
Name=FCS00420
Local=42001
Local=42024
#RFHangTime=120
#NetHangTime=60
Debug=0
[DGId=55]
# YCS Reflector YCS310 (DG-ID 2)
# YCS Reflector YCS310 (DG-ID 80)
Type=YCS
Static=1
Name=US-C4FM-NA
Local=42002
DGId=2
Local=42025
DGId=80
#RFHangTime=120
#NetHangTime=60
Debug=0

@ -34,6 +34,7 @@ m_addr(addr),
m_addrLen(addrLen),
m_poll(NULL),
m_options(NULL),
m_info(NULL),
m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U),
@ -52,6 +53,9 @@ m_dgId(0U)
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
m_info = new unsigned char[80U];
::memcpy(m_info + 0U, "YSFI", 4U);
std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' ');
@ -59,6 +63,7 @@ m_dgId(0U)
m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i);
m_options[i + 4U] = node.at(i);
m_info[i + 4U] = node.at(i);
}
}
@ -69,6 +74,7 @@ m_addr(addr),
m_addrLen(addrLen),
m_poll(NULL),
m_options(NULL),
m_info(NULL),
m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U),
@ -87,6 +93,9 @@ m_dgId(0U)
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
m_info = new unsigned char[80U];
::memcpy(m_info + 0U, "YSFI", 4U);
std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' ');
@ -94,16 +103,18 @@ m_dgId(0U)
m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i);
m_options[i + 4U] = node.at(i);
m_info[i + 4U] = node.at(i);
}
}
CYSFNetwork::CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, unsigned int dgId, bool debug) :
CYSFNetwork::CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, const std::string& locator, const std::string& description, unsigned int id, unsigned int dgId, bool debug) :
m_socket(localPort),
m_debug(debug),
m_addr(addr),
m_addrLen(addrLen),
m_poll(NULL),
m_options(NULL),
m_info(NULL),
m_unlink(NULL),
m_buffer(1000U, "YCS Network Buffer"),
m_pollTimer(1000U, 5U),
@ -122,20 +133,31 @@ m_dgId(dgId)
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
m_info = new unsigned char[80U];
::memcpy(m_info + 0U, "YSFI", 4U);
std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' ');
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) {
m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i);
m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i);
m_options[i + 4U] = node.at(i);
m_info[i + 4U] = node.at(i);
}
char text[101U];
::sprintf(text, "Options=%u ", dgId);
::sprintf(text, "%u ", dgId);
for (unsigned int i = 0U; i < (50U - 4U - YSF_CALLSIGN_LENGTH); i++)
m_options[i + 4U + YSF_CALLSIGN_LENGTH] = text[i];
std::string desc = description;
desc.resize(20U, ' ');
sprintf(text, "%9u%9u%.6s%sMMDVM %07u ", rxFrequency, txFrequency, locator.c_str(), desc.c_str(), id);
for (unsigned int i = 0U; i < (80U - 4U - YSF_CALLSIGN_LENGTH); i++)
m_info[i + 4U + YSF_CALLSIGN_LENGTH] = text[i];
}
CYSFNetwork::~CYSFNetwork()
@ -143,6 +165,7 @@ CYSFNetwork::~CYSFNetwork()
delete[] m_poll;
delete[] m_unlink;
delete[] m_options;
delete[] m_info;
}
std::string CYSFNetwork::getDesc(unsigned int dgId)
@ -223,6 +246,11 @@ void CYSFNetwork::writePoll()
CUtils::dump(1U, "YSF Network Data Sent", m_options, 50U);
m_socket.write(m_options, 50U, m_addr, m_addrLen);
if (m_debug)
CUtils::dump(1U, "YSF Network Data Sent", m_info, 80U);
m_socket.write(m_info, 80U, m_addr, m_addrLen);
}
m_pollCount++;
@ -276,6 +304,10 @@ void CYSFNetwork::clock(unsigned int ms)
if (::memcmp(buffer, "YSFO", 4U) == 0)
return;
// Throw away any info messages
if (::memcmp(buffer, "YSFI", 4U) == 0)
return;
if (::memcmp(buffer, "YSFP", 4U) == 0 && m_state == DS_LINKING) {
if (strcmp(m_name.c_str(),"MMDVM")== 0)
LogMessage("Link successful to %s", m_name.c_str());

@ -31,7 +31,7 @@
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, unsigned int dgId, bool debug);
CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, const std::string& locator, const std::string& description, unsigned int id, unsigned int dgId, bool debug);
CYSFNetwork(unsigned int localPort, const std::string& name, const sockaddr_storage& addr, unsigned int addrLen, const std::string& callsign, bool debug);
virtual ~CYSFNetwork();
@ -62,6 +62,7 @@ private:
unsigned int m_addrLen;
unsigned char* m_poll;
unsigned char* m_options;
unsigned char* m_info;
unsigned char* m_unlink;
CRingBuffer<unsigned char> m_buffer;
CTimer m_pollTimer;

Loading…
Cancel
Save