Fill with silence YSF frames for short YSF transmissions

This commit is contained in:
Andy CA6JAU 2018-07-28 22:09:51 -04:00
parent 5ba28e4771
commit 3acd89fe9d
7 changed files with 34 additions and 12 deletions

View File

@ -48,6 +48,7 @@ m_localAddress(),
m_localPort(0U), m_localPort(0U),
m_enableWiresX(false), m_enableWiresX(false),
m_remoteGateway(false), m_remoteGateway(false),
m_hangTime(1000U),
m_daemon(false), m_daemon(false),
m_rxFrequency(0U), m_rxFrequency(0U),
m_txFrequency(0U), m_txFrequency(0U),
@ -72,7 +73,6 @@ m_dmrNetworkOptions(),
m_dmrNetworkDebug(false), m_dmrNetworkDebug(false),
m_dmrNetworkJitterEnabled(true), m_dmrNetworkJitterEnabled(true),
m_dmrNetworkJitter(500U), m_dmrNetworkJitter(500U),
m_dmrHangTime(1000U),
m_dmrNetworkEnableUnlink(true), m_dmrNetworkEnableUnlink(true),
m_dmrNetworkIDUnlink(4000U), m_dmrNetworkIDUnlink(4000U),
m_dmrNetworkPCUnlink(false), m_dmrNetworkPCUnlink(false),
@ -168,6 +168,8 @@ bool CConf::read()
m_enableWiresX = ::atoi(value) == 1; m_enableWiresX = ::atoi(value) == 1;
else if (::strcmp(key, "RemoteGateway") == 0) else if (::strcmp(key, "RemoteGateway") == 0)
m_remoteGateway = ::atoi(value) == 1; m_remoteGateway = ::atoi(value) == 1;
else if (::strcmp(key, "HangTime") == 0)
m_hangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "Daemon") == 0) else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1; m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_INFO) { } else if (section == SECTION_INFO) {
@ -221,8 +223,6 @@ bool CConf::read()
m_dmrNetworkJitterEnabled = ::atoi(value) == 1; m_dmrNetworkJitterEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Jitter") == 0) else if (::strcmp(key, "Jitter") == 0)
m_dmrNetworkJitter = (unsigned int)::atoi(value); m_dmrNetworkJitter = (unsigned int)::atoi(value);
else if (::strcmp(key, "HangTime") == 0)
m_dmrHangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "EnableUnlink") == 0) else if (::strcmp(key, "EnableUnlink") == 0)
m_dmrNetworkEnableUnlink = ::atoi(value) == 1; m_dmrNetworkEnableUnlink = ::atoi(value) == 1;
else if (::strcmp(key, "TGUnlink") == 0) else if (::strcmp(key, "TGUnlink") == 0)
@ -308,6 +308,11 @@ bool CConf::getRemoteGateway() const
return m_remoteGateway; return m_remoteGateway;
} }
unsigned int CConf::getHangTime() const
{
return m_hangTime;
}
bool CConf::getDaemon() const bool CConf::getDaemon() const
{ {
return m_daemon; return m_daemon;
@ -463,11 +468,6 @@ unsigned int CConf::getDMRNetworkJitter() const
return m_dmrNetworkJitter; return m_dmrNetworkJitter;
} }
unsigned int CConf::getDMRHangTime() const
{
return m_dmrHangTime;
}
bool CConf::getDMRNetworkEnableUnlink() const bool CConf::getDMRNetworkEnableUnlink() const
{ {
return m_dmrNetworkEnableUnlink; return m_dmrNetworkEnableUnlink;

View File

@ -41,6 +41,7 @@ public:
unsigned int getLocalPort() const; unsigned int getLocalPort() const;
bool getEnableWiresX() const; bool getEnableWiresX() const;
bool getRemoteGateway() const; bool getRemoteGateway() const;
unsigned int getHangTime() const;
bool getDaemon() const; bool getDaemon() const;
// The Info section // The Info section
@ -69,7 +70,6 @@ public:
bool getDMRNetworkDebug() const; bool getDMRNetworkDebug() const;
bool getDMRNetworkJitterEnabled() const; bool getDMRNetworkJitterEnabled() const;
unsigned int getDMRNetworkJitter() const; unsigned int getDMRNetworkJitter() const;
unsigned int getDMRHangTime() const;
bool getDMRNetworkEnableUnlink() const; bool getDMRNetworkEnableUnlink() const;
unsigned int getDMRNetworkIDUnlink() const; unsigned int getDMRNetworkIDUnlink() const;
bool getDMRNetworkPCUnlink() const; bool getDMRNetworkPCUnlink() const;
@ -104,6 +104,7 @@ private:
unsigned int m_localPort; unsigned int m_localPort;
bool m_enableWiresX; bool m_enableWiresX;
bool m_remoteGateway; bool m_remoteGateway;
unsigned int m_hangTime;
bool m_daemon; bool m_daemon;
unsigned int m_rxFrequency; unsigned int m_rxFrequency;
@ -130,7 +131,6 @@ private:
bool m_dmrNetworkDebug; bool m_dmrNetworkDebug;
bool m_dmrNetworkJitterEnabled; bool m_dmrNetworkJitterEnabled;
unsigned int m_dmrNetworkJitter; unsigned int m_dmrNetworkJitter;
unsigned int m_dmrHangTime;
bool m_dmrNetworkEnableUnlink; bool m_dmrNetworkEnableUnlink;
unsigned int m_dmrNetworkIDUnlink; unsigned int m_dmrNetworkIDUnlink;
bool m_dmrNetworkPCUnlink; bool m_dmrNetworkPCUnlink;

View File

@ -687,6 +687,17 @@ void CModeConv::putAMBE2DMR(unsigned int dat_a, unsigned int dat_b, unsigned int
m_dmrN += 1U; m_dmrN += 1U;
} }
void CModeConv::putDummyYSF()
{
// We have a total of 5 VCH sections
for (unsigned int j = 0U; j < 5U; j++) {
m_DMR.addData(&TAG_DATA, 1U);
m_DMR.addData(DMR_SILENCE, 9U);
m_dmrN += 1U;
}
}
void CModeConv::putDMRHeader() void CModeConv::putDMRHeader()
{ {
unsigned char vch[13U]; unsigned char vch[13U];

View File

@ -34,6 +34,7 @@ public:
void putDMREOT(); void putDMREOT();
void putYSF(unsigned char* bytes); void putYSF(unsigned char* bytes);
void putDummyYSF();
void putYSFHeader(); void putYSFHeader();
void putYSFEOT(); void putYSFEOT();

View File

@ -115,7 +115,8 @@ m_dmrinfo(false),
m_idUnlink(4000U), m_idUnlink(4000U),
m_flcoUnlink(FLCO_GROUP), m_flcoUnlink(FLCO_GROUP),
m_enableWiresX(false), m_enableWiresX(false),
m_remoteGateway(false) m_remoteGateway(false),
m_hangTime(1000U)
{ {
::memset(m_ysfFrame, 0U, 200U); ::memset(m_ysfFrame, 0U, 200U);
::memset(m_dmrFrame, 0U, 50U); ::memset(m_dmrFrame, 0U, 50U);
@ -214,6 +215,7 @@ int CYSF2DMR::run()
m_suffix = m_conf.getSuffix(); m_suffix = m_conf.getSuffix();
m_remoteGateway = m_conf.getRemoteGateway(); m_remoteGateway = m_conf.getRemoteGateway();
m_hangTime = m_conf.getHangTime();
bool debug = m_conf.getDMRNetworkDebug(); bool debug = m_conf.getDMRNetworkDebug();
in_addr dstAddress = CUDPSocket::lookup(m_conf.getDstAddress()); in_addr dstAddress = CUDPSocket::lookup(m_conf.getDstAddress());
@ -228,6 +230,10 @@ int CYSF2DMR::run()
m_ysfNetwork = new CYSFNetwork(localAddress, localPort, m_callsign, debug); m_ysfNetwork = new CYSFNetwork(localAddress, localPort, m_callsign, debug);
m_ysfNetwork->setDestination(dstAddress, dstPort); m_ysfNetwork->setDestination(dstAddress, dstPort);
LogInfo("General Parameters");
LogInfo(" Remote Gateway: %s", m_remoteGateway ? "yes" : "no");
LogInfo(" Hang Time: %u ms", m_hangTime);
ret = m_ysfNetwork->open(); ret = m_ysfNetwork->open();
if (!ret) { if (!ret) {
::LogError("Cannot open the YSF network port"); ::LogError("Cannot open the YSF network port");
@ -529,6 +535,9 @@ int CYSF2DMR::run()
m_ysfFrames = 0U; m_ysfFrames = 0U;
} }
} else if (fi == YSF_FI_TERMINATOR) { } else if (fi == YSF_FI_TERMINATOR) {
int extraFrames = (m_hangTime / 100U) - m_ysfFrames - 2U;
for (int i = 0U; i < extraFrames; i++)
m_conv.putDummyYSF();
LogMessage("YSF received end of voice transmission, %.1f seconds", float(m_ysfFrames) / 10.0F); LogMessage("YSF received end of voice transmission, %.1f seconds", float(m_ysfFrames) / 10.0F);
m_conv.putYSFEOT(); m_conv.putYSFEOT();
m_ysfFrames = 0U; m_ysfFrames = 0U;

View File

@ -105,6 +105,7 @@ private:
CReflectors* m_xlxReflectors; CReflectors* m_xlxReflectors;
unsigned int m_xlxrefl; unsigned int m_xlxrefl;
bool m_remoteGateway; bool m_remoteGateway;
unsigned int m_hangTime;
bool createDMRNetwork(); bool createDMRNetwork();
void createGPS(); void createGPS();

View File

@ -19,6 +19,7 @@ LocalAddress=127.0.0.1
LocalPort=42013 LocalPort=42013
EnableWiresX=1 EnableWiresX=1
RemoteGateway=0 RemoteGateway=0
HangTime=1000
Daemon=0 Daemon=0
[DMR Network] [DMR Network]
@ -32,7 +33,6 @@ StartupPC=1
Address=44.131.4.1 Address=44.131.4.1
Port=62031 Port=62031
Jitter=500 Jitter=500
HangTime=1000
EnableUnlink=1 EnableUnlink=1
TGUnlink=4000 TGUnlink=4000
PCUnlink=0 PCUnlink=0