Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
139f62f57e
10 changed files with 81 additions and 61 deletions
36
Conf.cpp
36
Conf.cpp
|
@ -111,8 +111,10 @@ m_dmrNetworkDebug(false),
|
||||||
m_dmrNetworkSlot1(true),
|
m_dmrNetworkSlot1(true),
|
||||||
m_dmrNetworkSlot2(true),
|
m_dmrNetworkSlot2(true),
|
||||||
m_fusionNetworkEnabled(false),
|
m_fusionNetworkEnabled(false),
|
||||||
m_fusionNetworkAddress(),
|
m_fusionNetworkMyAddress(),
|
||||||
m_fusionNetworkPort(0U),
|
m_fusionNetworkMyPort(0U),
|
||||||
|
m_fusionNetworkGwyAddress(),
|
||||||
|
m_fusionNetworkGwyPort(0U),
|
||||||
m_fusionNetworkDebug(false),
|
m_fusionNetworkDebug(false),
|
||||||
m_tftSerialPort("/dev/ttyAMA0"),
|
m_tftSerialPort("/dev/ttyAMA0"),
|
||||||
m_tftSerialBrightness(50U),
|
m_tftSerialBrightness(50U),
|
||||||
|
@ -386,10 +388,14 @@ bool CConf::read()
|
||||||
} else if (section == SECTION_FUSION_NETWORK) {
|
} else if (section == SECTION_FUSION_NETWORK) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_fusionNetworkEnabled = ::atoi(value) == 1;
|
m_fusionNetworkEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Address") == 0)
|
else if (::strcmp(key, "LocalAddress") == 0)
|
||||||
m_fusionNetworkAddress = value;
|
m_fusionNetworkMyAddress = value;
|
||||||
else if (::strcmp(key, "Port") == 0)
|
else if (::strcmp(key, "LocalPort") == 0)
|
||||||
m_fusionNetworkPort = (unsigned int)::atoi(value);
|
m_fusionNetworkMyPort = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "GwyAddress") == 0)
|
||||||
|
m_fusionNetworkGwyAddress = value;
|
||||||
|
else if (::strcmp(key, "GwyPort") == 0)
|
||||||
|
m_fusionNetworkGwyPort = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "Debug") == 0)
|
else if (::strcmp(key, "Debug") == 0)
|
||||||
m_fusionNetworkDebug = ::atoi(value) == 1;
|
m_fusionNetworkDebug = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_TFTSERIAL) {
|
} else if (section == SECTION_TFTSERIAL) {
|
||||||
|
@ -756,14 +762,24 @@ bool CConf::getFusionNetworkEnabled() const
|
||||||
return m_fusionNetworkEnabled;
|
return m_fusionNetworkEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConf::getFusionNetworkAddress() const
|
std::string CConf::getFusionNetworkMyAddress() const
|
||||||
{
|
{
|
||||||
return m_fusionNetworkAddress;
|
return m_fusionNetworkMyAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CConf::getFusionNetworkPort() const
|
unsigned int CConf::getFusionNetworkMyPort() const
|
||||||
{
|
{
|
||||||
return m_fusionNetworkPort;
|
return m_fusionNetworkMyPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConf::getFusionNetworkGwyAddress() const
|
||||||
|
{
|
||||||
|
return m_fusionNetworkGwyAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getFusionNetworkGwyPort() const
|
||||||
|
{
|
||||||
|
return m_fusionNetworkGwyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getFusionNetworkDebug() const
|
bool CConf::getFusionNetworkDebug() const
|
||||||
|
|
12
Conf.h
12
Conf.h
|
@ -114,8 +114,10 @@ public:
|
||||||
|
|
||||||
// The System Fusion Network section
|
// The System Fusion Network section
|
||||||
bool getFusionNetworkEnabled() const;
|
bool getFusionNetworkEnabled() const;
|
||||||
std::string getFusionNetworkAddress() const;
|
std::string getFusionNetworkMyAddress() const;
|
||||||
unsigned int getFusionNetworkPort() const;
|
unsigned int getFusionNetworkMyPort() const;
|
||||||
|
std::string getFusionNetworkGwyAddress() const;
|
||||||
|
unsigned int getFusionNetworkGwyPort() const;
|
||||||
bool getFusionNetworkDebug() const;
|
bool getFusionNetworkDebug() const;
|
||||||
|
|
||||||
// The TFTSERIAL section
|
// The TFTSERIAL section
|
||||||
|
@ -219,8 +221,10 @@ private:
|
||||||
bool m_dmrNetworkSlot2;
|
bool m_dmrNetworkSlot2;
|
||||||
|
|
||||||
bool m_fusionNetworkEnabled;
|
bool m_fusionNetworkEnabled;
|
||||||
std::string m_fusionNetworkAddress;
|
std::string m_fusionNetworkMyAddress;
|
||||||
unsigned int m_fusionNetworkPort;
|
unsigned int m_fusionNetworkMyPort;
|
||||||
|
std::string m_fusionNetworkGwyAddress;
|
||||||
|
unsigned int m_fusionNetworkGwyPort;
|
||||||
bool m_fusionNetworkDebug;
|
bool m_fusionNetworkDebug;
|
||||||
|
|
||||||
std::string m_tftSerialPort;
|
std::string m_tftSerialPort;
|
||||||
|
|
|
@ -84,8 +84,10 @@ Debug=0
|
||||||
|
|
||||||
[System Fusion Network]
|
[System Fusion Network]
|
||||||
Enable=1
|
Enable=1
|
||||||
Address=c4fm.duckdns.org
|
LocalAddress=127.0.0.1
|
||||||
Port=42000
|
LocalPort=3200
|
||||||
|
GwyAddress=c4fm.duckdns.org
|
||||||
|
GwyPort=4200
|
||||||
Debug=0
|
Debug=0
|
||||||
|
|
||||||
[TFT Serial]
|
[TFT Serial]
|
||||||
|
|
|
@ -751,15 +751,19 @@ bool CMMDVMHost::createDMRNetwork()
|
||||||
|
|
||||||
bool CMMDVMHost::createYSFNetwork()
|
bool CMMDVMHost::createYSFNetwork()
|
||||||
{
|
{
|
||||||
std::string address = m_conf.getFusionNetworkAddress();
|
std::string myAddress = m_conf.getFusionNetworkMyAddress();
|
||||||
unsigned int port = m_conf.getFusionNetworkPort();
|
unsigned int myPort = m_conf.getFusionNetworkMyPort();
|
||||||
bool debug = m_conf.getFusionNetworkDebug();
|
std::string gwyAddress = m_conf.getFusionNetworkGwyAddress();
|
||||||
|
unsigned int gwyPort = m_conf.getFusionNetworkGwyPort();
|
||||||
|
bool debug = m_conf.getFusionNetworkDebug();
|
||||||
|
|
||||||
LogInfo("System Fusion Network Parameters");
|
LogInfo("System Fusion Network Parameters");
|
||||||
LogInfo(" Reflector Address: %s", address.c_str());
|
LogInfo(" Local Address: %s", myAddress.c_str());
|
||||||
LogInfo(" Reflector Port: %u", port);
|
LogInfo(" Local Port: %u", myPort);
|
||||||
|
LogInfo(" Gateway Address: %s", gwyAddress.c_str());
|
||||||
|
LogInfo(" Gateway Port: %u", gwyPort);
|
||||||
|
|
||||||
m_ysfNetwork = new CYSFNetwork(address, port, m_callsign, debug);
|
m_ysfNetwork = new CYSFNetwork(myAddress, myPort, gwyAddress, gwyPort, m_callsign, debug);
|
||||||
|
|
||||||
bool ret = m_ysfNetwork->open();
|
bool ret = m_ysfNetwork->open();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
26
Modem.cpp
26
Modem.cpp
|
@ -197,18 +197,10 @@ void CModem::clock(unsigned int ms)
|
||||||
LogError("No reply from the modem for some time, resetting it");
|
LogError("No reply from the modem for some time, resetting it");
|
||||||
m_error = true;
|
m_error = true;
|
||||||
close();
|
close();
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
::Sleep(2000UL); // 2s
|
CThread::sleep(2000U); // 2s
|
||||||
#else
|
while (!open())
|
||||||
::sleep(2UL); // 2s
|
CThread::sleep(5000U); // 5s
|
||||||
#endif
|
|
||||||
while (!open()) {
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
::Sleep(5000UL); // 5s
|
|
||||||
#else
|
|
||||||
::sleep(5UL); // 5s
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RESP_TYPE_MMDVM type = getResponse();
|
RESP_TYPE_MMDVM type = getResponse();
|
||||||
|
@ -376,6 +368,10 @@ void CModem::clock(unsigned int ms)
|
||||||
|
|
||||||
m_lockout = (m_buffer[5U] & 0x10U) == 0x10U;
|
m_lockout = (m_buffer[5U] & 0x10U) == 0x10U;
|
||||||
|
|
||||||
|
bool dacOverflow = (m_buffer[5U] & 0x20U) == 0x20U;
|
||||||
|
if (dacOverflow)
|
||||||
|
LogError("MMDVM DAC levels have overflowed");
|
||||||
|
|
||||||
m_dstarSpace = m_buffer[6U];
|
m_dstarSpace = m_buffer[6U];
|
||||||
m_dmrSpace1 = m_buffer[7U];
|
m_dmrSpace1 = m_buffer[7U];
|
||||||
m_dmrSpace2 = m_buffer[8U];
|
m_dmrSpace2 = m_buffer[8U];
|
||||||
|
@ -698,11 +694,7 @@ bool CModem::writeYSFData(const unsigned char* data, unsigned int length)
|
||||||
|
|
||||||
bool CModem::readVersion()
|
bool CModem::readVersion()
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
CThread::sleep(2000U); // 2s
|
||||||
::Sleep(2000UL); // 2s
|
|
||||||
#else
|
|
||||||
::sleep(2); // 2s
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < 6U; i++) {
|
for (unsigned int i = 0U; i < 6U; i++) {
|
||||||
unsigned char buffer[3U];
|
unsigned char buffer[3U];
|
||||||
|
|
|
@ -362,6 +362,8 @@ void CYSFControl::writeNetwork()
|
||||||
|
|
||||||
m_networkWatchdog.start();
|
m_networkWatchdog.start();
|
||||||
|
|
||||||
|
bool gateway = ::memcmp(data + 4U, "GATEWAY ", YSF_CALLSIGN_LENGTH) == 0;
|
||||||
|
|
||||||
if (!m_netTimeoutTimer.isRunning()) {
|
if (!m_netTimeoutTimer.isRunning()) {
|
||||||
if (::memcmp(data + 14U, " ", YSF_CALLSIGN_LENGTH) != 0)
|
if (::memcmp(data + 14U, " ", YSF_CALLSIGN_LENGTH) != 0)
|
||||||
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
|
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
|
||||||
|
@ -403,7 +405,7 @@ void CYSFControl::writeNetwork()
|
||||||
|
|
||||||
m_netFrames++;
|
m_netFrames++;
|
||||||
|
|
||||||
bool end = data[34U] == 0x01U;
|
bool end = (data[34U] & 0x01U) == 0x01U;
|
||||||
|
|
||||||
data[33U] = end ? TAG_EOT : TAG_DATA;
|
data[33U] = end ? TAG_EOT : TAG_DATA;
|
||||||
data[34U] = 0x00U;
|
data[34U] = 0x00U;
|
||||||
|
@ -426,19 +428,19 @@ void CYSFControl::writeNetwork()
|
||||||
case YSF_FI_COMMUNICATIONS:
|
case YSF_FI_COMMUNICATIONS:
|
||||||
switch (dt) {
|
switch (dt) {
|
||||||
case YSF_DT_VD_MODE1:
|
case YSF_DT_VD_MODE1:
|
||||||
m_netPayload.processVDMode1Data(data + 35U, fn);
|
m_netPayload.processVDMode1Data(data + 35U, fn, gateway);
|
||||||
m_netErrs += m_netPayload.processVDMode1Audio(data + 35U);
|
m_netErrs += m_netPayload.processVDMode1Audio(data + 35U);
|
||||||
m_netBits += 235U;
|
m_netBits += 235U;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YSF_DT_VD_MODE2:
|
case YSF_DT_VD_MODE2:
|
||||||
m_netPayload.processVDMode2Data(data + 35U, fn);
|
m_netPayload.processVDMode2Data(data + 35U, fn, gateway);
|
||||||
m_netErrs += m_netPayload.processVDMode2Audio(data + 35U);
|
m_netErrs += m_netPayload.processVDMode2Audio(data + 35U);
|
||||||
m_netBits += 135U;
|
m_netBits += 135U;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YSF_DT_DATA_FR_MODE:
|
case YSF_DT_DATA_FR_MODE:
|
||||||
m_netPayload.processDataFRModeData(data + 35U, fn);
|
m_netPayload.processDataFRModeData(data + 35U, fn, gateway);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YSF_DT_VOICE_FR_MODE:
|
case YSF_DT_VOICE_FR_MODE:
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
|
|
||||||
const unsigned int BUFFER_LENGTH = 200U;
|
const unsigned int BUFFER_LENGTH = 200U;
|
||||||
|
|
||||||
CYSFNetwork::CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug) :
|
CYSFNetwork::CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gwyAddress, unsigned int gwyPort, const std::string& callsign, bool debug) :
|
||||||
m_socket(),
|
m_socket(myAddress, myPort),
|
||||||
m_address(),
|
m_address(),
|
||||||
m_port(port),
|
m_port(gwyPort),
|
||||||
m_callsign(),
|
m_callsign(),
|
||||||
m_debug(debug),
|
m_debug(debug),
|
||||||
m_enabled(false),
|
m_enabled(false),
|
||||||
|
@ -42,7 +42,7 @@ m_tag(NULL)
|
||||||
m_callsign = callsign;
|
m_callsign = callsign;
|
||||||
m_callsign.resize(YSF_CALLSIGN_LENGTH, ' ');
|
m_callsign.resize(YSF_CALLSIGN_LENGTH, ' ');
|
||||||
|
|
||||||
m_address = CUDPSocket::lookup(address);
|
m_address = CUDPSocket::lookup(gwyAddress);
|
||||||
|
|
||||||
m_tag = new unsigned char[YSF_CALLSIGN_LENGTH];
|
m_tag = new unsigned char[YSF_CALLSIGN_LENGTH];
|
||||||
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);
|
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);
|
||||||
|
@ -160,7 +160,7 @@ void CYSFNetwork::clock(unsigned int ms)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end = buffer[34U] == 0x01U;
|
bool end = (buffer[34U] & 0x01U) == 0x01U;
|
||||||
if (end)
|
if (end)
|
||||||
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);
|
::memset(m_tag, ' ', YSF_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
class CYSFNetwork {
|
class CYSFNetwork {
|
||||||
public:
|
public:
|
||||||
CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug);
|
CYSFNetwork(const std::string& myAddress, unsigned int myPort, const std::string& gwyAddress, unsigned int gwyPort, const std::string& callsign, bool debug);
|
||||||
~CYSFNetwork();
|
~CYSFNetwork();
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
|
|
|
@ -268,7 +268,7 @@ unsigned int CYSFPayload::processVDMode1Audio(unsigned char* data)
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CYSFPayload::processVDMode1Data(unsigned char* data, unsigned char fn)
|
bool CYSFPayload::processVDMode1Data(unsigned char* data, unsigned char fn, bool gateway)
|
||||||
{
|
{
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
|
|
||||||
|
@ -319,10 +319,10 @@ bool CYSFPayload::processVDMode1Data(unsigned char* data, unsigned char fn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1U:
|
case 1U:
|
||||||
if (m_downlink != NULL)
|
if (m_downlink != NULL && !gateway)
|
||||||
::memcpy(output + 0U, m_downlink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output + 0U, m_downlink, YSF_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
if (m_uplink != NULL)
|
if (m_uplink != NULL && !gateway)
|
||||||
::memcpy(output + YSF_CALLSIGN_LENGTH, m_uplink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output + YSF_CALLSIGN_LENGTH, m_uplink, YSF_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -450,7 +450,7 @@ unsigned int CYSFPayload::processVDMode2Audio(unsigned char* data)
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CYSFPayload::processVDMode2Data(unsigned char* data, unsigned char fn)
|
bool CYSFPayload::processVDMode2Data(unsigned char* data, unsigned char fn, bool gateway)
|
||||||
{
|
{
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
|
|
||||||
|
@ -502,12 +502,12 @@ bool CYSFPayload::processVDMode2Data(unsigned char* data, unsigned char fn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2U:
|
case 2U:
|
||||||
if (m_downlink != NULL)
|
if (m_downlink != NULL && !gateway)
|
||||||
::memcpy(output, m_downlink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output, m_downlink, YSF_CALLSIGN_LENGTH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3U:
|
case 3U:
|
||||||
if (m_uplink != NULL)
|
if (m_uplink != NULL && !gateway)
|
||||||
::memcpy(output, m_uplink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output, m_uplink, YSF_CALLSIGN_LENGTH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ bool CYSFPayload::processVDMode2Data(unsigned char* data, unsigned char fn)
|
||||||
return ret && (fn == 0U || fn == 1U);
|
return ret && (fn == 0U || fn == 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CYSFPayload::processDataFRModeData(unsigned char* data, unsigned char fn)
|
bool CYSFPayload::processDataFRModeData(unsigned char* data, unsigned char fn, bool gateway)
|
||||||
{
|
{
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
|
|
||||||
|
@ -708,10 +708,10 @@ bool CYSFPayload::processDataFRModeData(unsigned char* data, unsigned char fn)
|
||||||
case 0U:
|
case 0U:
|
||||||
CUtils::dump(1U, "FR Mode Data, CSD2", output, 20U);
|
CUtils::dump(1U, "FR Mode Data, CSD2", output, 20U);
|
||||||
|
|
||||||
if (m_downlink != NULL)
|
if (m_downlink != NULL && !gateway)
|
||||||
::memcpy(output + 0U, m_downlink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output + 0U, m_downlink, YSF_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
if (m_uplink != NULL)
|
if (m_uplink != NULL && !gateway)
|
||||||
::memcpy(output + YSF_CALLSIGN_LENGTH, m_uplink, YSF_CALLSIGN_LENGTH);
|
::memcpy(output + YSF_CALLSIGN_LENGTH, m_uplink, YSF_CALLSIGN_LENGTH);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,13 +30,13 @@ public:
|
||||||
|
|
||||||
bool processHeaderData(unsigned char* bytes);
|
bool processHeaderData(unsigned char* bytes);
|
||||||
|
|
||||||
bool processVDMode1Data(unsigned char* bytes, unsigned char fn);
|
bool processVDMode1Data(unsigned char* bytes, unsigned char fn, bool gateway = false);
|
||||||
unsigned int processVDMode1Audio(unsigned char* bytes);
|
unsigned int processVDMode1Audio(unsigned char* bytes);
|
||||||
|
|
||||||
bool processVDMode2Data(unsigned char* bytes, unsigned char fn);
|
bool processVDMode2Data(unsigned char* bytes, unsigned char fn, bool gateway = false);
|
||||||
unsigned int processVDMode2Audio(unsigned char* bytes);
|
unsigned int processVDMode2Audio(unsigned char* bytes);
|
||||||
|
|
||||||
bool processDataFRModeData(unsigned char* bytes, unsigned char fn);
|
bool processDataFRModeData(unsigned char* bytes, unsigned char fn, bool gateway = false);
|
||||||
|
|
||||||
unsigned int processVoiceFRModeAudio(unsigned char* bytes);
|
unsigned int processVoiceFRModeAudio(unsigned char* bytes);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue