Update YSF2NXDN and YSF2P25 for new YSF code

This commit is contained in:
root 2020-06-05 16:43:13 +01:00
parent 00606bb544
commit 73f0829136
12 changed files with 363 additions and 123 deletions

View File

@ -38,8 +38,6 @@ public:
std::string getLocalAddress() const;
unsigned int getLocalPort() const;
std::string getFCSFile() const;
bool getDaemon() const;
bool getDebug() const;
unsigned char getFICHCallSign() const;
unsigned char getFICHCallMode() const;
unsigned char getFICHFrameTotal() const;
@ -50,7 +48,9 @@ public:
unsigned char getFICHSQLCode() const;
unsigned char* getYsfDT1();
unsigned char* getYsfDT2();
char* getYsfRadioID();
char* getYsfRadioID();
bool getDaemon() const;
bool getDebug() const;
// The DMR Network section
unsigned int getDMRId() const;
@ -81,6 +81,17 @@ private:
std::string m_localAddress;
unsigned int m_localPort;
std::string m_fcsFile;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10U];
unsigned char m_ysfDT2[10U];
char m_ysfRadioID[5];
bool m_daemon;
bool m_debug;
@ -101,18 +112,6 @@ private:
unsigned int m_logFileLevel;
std::string m_logFilePath;
std::string m_logFileRoot;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10U];
unsigned char m_ysfDT2[10U];
char m_ysfRadioID[5];
};
#endif

View File

@ -43,7 +43,6 @@ public:
bool getRemoteGateway() const;
unsigned int getHangTime() const;
bool getWiresXMakeUpper() const;
bool getDaemon() const;
unsigned char getFICHCallSign() const;
unsigned char getFICHCallMode() const;
unsigned char getFICHFrameTotal() const;
@ -54,7 +53,8 @@ public:
unsigned char getFICHSQLCode() const;
unsigned char* getYsfDT1();
unsigned char* getYsfDT2();
char* getYsfRadioID();
char* getYsfRadioID();
bool getDaemon() const;
// The Info section
unsigned int getRxFrequency() const;
@ -120,6 +120,17 @@ private:
bool m_remoteGateway;
unsigned int m_hangTime;
bool m_wiresXMakeUpper;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10U];
unsigned char m_ysfDT2[10U];
char m_ysfRadioID[5];
bool m_daemon;
unsigned int m_rxFrequency;
@ -168,18 +179,6 @@ private:
std::string m_aprsAPIKey;
unsigned int m_aprsRefresh;
std::string m_aprsDescription;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10U];
unsigned char m_ysfDT2[10U];
char m_ysfRadioID[5];
};
#endif

View File

@ -126,6 +126,8 @@ bool CConf::read()
// Remove quotes from the value
size_t len = ::strlen(value);
char *t;
unsigned char tokencnt = 0;
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
value[len - 1U] = '\0';
value++;
@ -167,6 +169,40 @@ bool CConf::read()
m_enableWiresX = ::atoi(value) == 1;
else if (::strcmp(key, "WiresXMakeUpper") == 0)
m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "RadioID") == 0)
::memcpy(m_ysfRadioID, value, 5);
else if (::strcmp(key, "FICHCallsign") == 0)
m_fichCallSign = ::atoi(value);
else if (::strcmp(key, "FICHCallMode") == 0)
m_fichCallMode = ::atoi(value);
else if (::strcmp(key, "FICHFrameTotal") == 0)
m_fichFrameTotal = ::atoi(value);
else if (::strcmp(key, "FICHMessageRoute") == 0)
m_fichMessageRoute = ::atoi(value);
else if (::strcmp(key, "FICHVOIP") == 0)
m_fichVOIP = ::atoi(value);
else if (::strcmp(key, "FICHDataType") == 0)
m_fichDataType = ::atoi(value);
else if (::strcmp(key, "FICHSQLType") == 0)
m_fichSQLType = ::atoi(value);
else if (::strcmp(key, "FICHSQLCode") == 0)
m_fichSQLCode = ::atoi(value);
else if (::strcmp(key, "DT1") == 0){
tokencnt = 0;
while((t = strtok_r(value, ",", &value)) != NULL){
if(tokencnt < 10){
m_ysfDT1[tokencnt++] = atoi(t);
}
}
}
else if (::strcmp(key, "DT2") == 0){
tokencnt = 0;
while((t = strtok_r(value, ",", &value)) != NULL){
if(tokencnt < 10){
m_ysfDT2[tokencnt++] = atoi(t);
}
}
}
else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_NXDN_NETWORK) {
@ -293,6 +329,61 @@ bool CConf::getWiresXMakeUpper() const
return m_wiresXMakeUpper;
}
unsigned char CConf::getFICHCallSign() const
{
return m_fichCallSign;
}
unsigned char CConf::getFICHCallMode() const
{
return m_fichCallMode;
}
unsigned char CConf::getFICHFrameTotal() const
{
return m_fichFrameTotal;
}
unsigned char CConf::getFICHMessageRoute() const
{
return m_fichMessageRoute;
}
unsigned char CConf::getFICHVOIP() const
{
return m_fichVOIP;
}
unsigned char CConf::getFICHDataType() const
{
return m_fichDataType;
}
unsigned char CConf::getFICHSQLType() const
{
return m_fichSQLType;
}
unsigned char CConf::getFICHSQLCode() const
{
return m_fichSQLCode;
}
unsigned char* CConf::getYsfDT1()
{
return m_ysfDT1;
}
unsigned char* CConf::getYsfDT2()
{
return m_ysfDT2;
}
char* CConf::getYsfRadioID()
{
return m_ysfRadioID;
}
bool CConf::getDaemon() const
{
return m_daemon;

View File

@ -48,6 +48,17 @@ public:
unsigned int getLocalPort() const;
bool getEnableWiresX() const;
bool getWiresXMakeUpper() const;
unsigned char getFICHCallSign() const;
unsigned char getFICHCallMode() const;
unsigned char getFICHFrameTotal() const;
unsigned char getFICHMessageRoute() const;
unsigned char getFICHVOIP() const;
unsigned char getFICHDataType() const;
unsigned char getFICHSQLType() const;
unsigned char getFICHSQLCode() const;
unsigned char* getYsfDT1();
unsigned char* getYsfDT2();
char* getYsfRadioID();
bool getDaemon() const;
// The NXDN Network section
@ -90,6 +101,17 @@ private:
unsigned int m_localPort;
bool m_enableWiresX;
bool m_wiresXMakeUpper;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10U];
unsigned char m_ysfDT2[10U];
char m_ysfRadioID[5];
bool m_daemon;
unsigned int m_rxFrequency;

View File

@ -20,6 +20,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200503";
const char* VERSION = "20200605";
#endif

View File

@ -33,7 +33,6 @@
// DT1 and DT2, suggested by Manuel EA7EE
const unsigned char dt1_temp[] = {0x31, 0x22, 0x62, 0x5F, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00};
const unsigned char dt2_temp[] = {0x00, 0x00, 0x00, 0x00, 0x6C, 0x20, 0x1C, 0x20, 0x03, 0x08};
const uint8_t dt1[10] = {0x01, 0x22, 0x61, 0x5f, 0x2b, 0x03, 0x11, 0x00, 0x00, 0x00};
#define NXDN_FRAME_PER 75U
#define YSF_FRAME_PER 90U
@ -48,7 +47,6 @@ const char* HEADER1 = "This software is for use on amateur radio networks only,"
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
const char* HEADER3 = "commercial networks is strictly prohibited.";
const char* HEADER4 = "Copyright(C) 2018,2019 by CA6JAU, G4KLX and others";
const char ysf_radioid[] = {'H', '5', '0', '0', '0'};
#include <functional>
#include <algorithm>
@ -397,7 +395,7 @@ int CYSF2NXDN::run()
if (m_gps != NULL)
m_gps->data(buffer + 14U, buffer + 35U, fi, dt, fn, ft);
}
if ((buffer[34U] & 0x01U) == 0x01U) {
@ -519,7 +517,7 @@ int CYSF2NXDN::run()
// Send data to MMDVMHost
m_nxdnNetwork->write(m_nxdnFrame, false);
nxdn_cnt++;
nxdnWatch.start();
}
@ -539,7 +537,7 @@ int CYSF2NXDN::run()
dstId = (m_nxdnFrame[10U] << 8) & 0xFF00U;
dstId |= (m_nxdnFrame[11U] << 0) & 0x00FFU;
if (grp && m_dstid == dstId) {
if (m_nxdnFrame[5U] == 0x01) {
// DT1 & DT2 without GPS info
@ -588,7 +586,7 @@ int CYSF2NXDN::run()
m_nxdnFrames++;
}
}
if (ysfWatch.elapsed() > YSF_FRAME_PER) {
unsigned int ysfFrameType = m_conv.getYSF(m_ysfFrame + 35U);
@ -606,24 +604,23 @@ int CYSF2NXDN::run()
// Set the FICH
CYSFFICH fich;
fich.setFI(YSF_FI_HEADER);
fich.setCS(2U);
fich.setCM(1U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(6U);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VD_MODE2);
fich.setSQL(0U);
fich.setSQ(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
//memset(csd1, '*', YSF_CALLSIGN_LENGTH);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
@ -646,27 +643,26 @@ int CYSF2NXDN::run()
// Set the FICH
CYSFFICH fich;
fich.setFI(YSF_FI_TERMINATOR);
fich.setCS(2U);
fich.setCM(1U);
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(6U);
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VD_MODE2);
fich.setSQL(0U);
fich.setSQ(0U);
fich.encode(m_ysfFrame + 35U);
fich.setFI(YSF_FI_HEADER);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
//memset(csd1, '*', YSF_CALLSIGN_LENGTH);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
CYSFPayload payload;
payload.writeHeader(m_ysfFrame + 35U, csd1, csd2);
@ -691,9 +687,8 @@ int CYSF2NXDN::run()
switch (fn) {
case 0:
memset(dch, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dch);
//ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, (const unsigned char*)"**********");
break;
case 1:
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, (const unsigned char*)m_netSrc.c_str());
@ -702,34 +697,34 @@ int CYSF2NXDN::run()
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, (const unsigned char*)m_netDst.c_str());
break;
case 5:
memset(dch, ' ', YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memset(dch, ' ', YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dch); // Rem3/4
break;
case 6:
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dt1);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, m_conf.getYsfDT1());
break;
case 7:
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dt2_temp);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, m_conf.getYsfDT2());
break;
default:
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, (const unsigned char*)" ");
}
// Set the FICH
fich.setFI(YSF_FI_COMMUNICATIONS);
fich.setCS(2U);
fich.setCM(1U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(fn);
fich.setFT(6U);
fich.setFN(fn);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VD_MODE2);
fich.setSQL(0U);
fich.setSQ(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
// Net frame counter
@ -737,7 +732,7 @@ int CYSF2NXDN::run()
// Send data to MMDVMHost
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -766,17 +761,17 @@ int CYSF2NXDN::run()
m_ysfNetwork->close();
m_nxdnNetwork->close();
if (m_APRS != NULL) {
m_APRS->stop();
delete m_APRS;
}
if (m_gps != NULL) {
m_gps->close();
delete m_gps;
}
delete m_nxdnNetwork;
delete m_ysfNetwork;

View File

@ -16,6 +16,18 @@ LocalAddress=127.0.0.1
LocalPort=42014
EnableWiresX=1
WiresXMakeUpper=1
RadioID=*****
FICHCallsign=2
FICHCallMode=0
FICHBlockTotal=0
FICHFrameTotal=7
FICHMessageRoute=0
FICHVOIP=0
FICHDataType=2
FICHSQLType=0
FICHSQLCode=0
DT1=49,34,98,95,41,0,0,0,0,0
DT2=0,0,0,0,108,32,28,32,3,8
Daemon=0
[NXDN Network]

View File

@ -114,6 +114,8 @@ bool CConf::read()
// Remove quotes from the value
size_t len = ::strlen(value);
char *t;
unsigned char tokencnt = 0;
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
value[len - 1U] = '\0';
value++;
@ -149,6 +151,40 @@ bool CConf::read()
m_enableWiresX = ::atoi(value) == 1;
else if (::strcmp(key, "WiresXMakeUpper") == 0)
m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "RadioID") == 0)
::memcpy(m_ysfRadioID, value, 5);
else if (::strcmp(key, "FICHCallsign") == 0)
m_fichCallSign = ::atoi(value);
else if (::strcmp(key, "FICHCallMode") == 0)
m_fichCallMode = ::atoi(value);
else if (::strcmp(key, "FICHFrameTotal") == 0)
m_fichFrameTotal = ::atoi(value);
else if (::strcmp(key, "FICHMessageRoute") == 0)
m_fichMessageRoute = ::atoi(value);
else if (::strcmp(key, "FICHVOIP") == 0)
m_fichVOIP = ::atoi(value);
else if (::strcmp(key, "FICHDataType") == 0)
m_fichDataType = ::atoi(value);
else if (::strcmp(key, "FICHSQLType") == 0)
m_fichSQLType = ::atoi(value);
else if (::strcmp(key, "FICHSQLCode") == 0)
m_fichSQLCode = ::atoi(value);
else if (::strcmp(key, "DT1") == 0){
tokencnt = 0;
while((t = strtok_r(value, ",", &value)) != NULL){
if(tokencnt < 10){
m_ysfDT1[tokencnt++] = atoi(t);
}
}
}
else if (::strcmp(key, "DT2") == 0){
tokencnt = 0;
while((t = strtok_r(value, ",", &value)) != NULL){
if(tokencnt < 10){
m_ysfDT2[tokencnt++] = atoi(t);
}
}
}
else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0)
@ -247,6 +283,61 @@ bool CConf::getWiresXMakeUpper() const
return m_wiresXMakeUpper;
}
unsigned char CConf::getFICHCallSign() const
{
return m_fichCallSign;
}
unsigned char CConf::getFICHCallMode() const
{
return m_fichCallMode;
}
unsigned char CConf::getFICHFrameTotal() const
{
return m_fichFrameTotal;
}
unsigned char CConf::getFICHMessageRoute() const
{
return m_fichMessageRoute;
}
unsigned char CConf::getFICHVOIP() const
{
return m_fichVOIP;
}
unsigned char CConf::getFICHDataType() const
{
return m_fichDataType;
}
unsigned char CConf::getFICHSQLType() const
{
return m_fichSQLType;
}
unsigned char CConf::getFICHSQLCode() const
{
return m_fichSQLCode;
}
unsigned char* CConf::getYsfDT1()
{
return m_ysfDT1;
}
unsigned char* CConf::getYsfDT2()
{
return m_ysfDT2;
}
char* CConf::getYsfRadioID()
{
return m_ysfRadioID;
}
bool CConf::getDaemon() const
{
return m_daemon;

View File

@ -45,6 +45,17 @@ public:
unsigned int getLocalPort() const;
bool getEnableWiresX() const;
bool getWiresXMakeUpper() const;
unsigned char getFICHCallSign() const;
unsigned char getFICHCallMode() const;
unsigned char getFICHFrameTotal() const;
unsigned char getFICHMessageRoute() const;
unsigned char getFICHVOIP() const;
unsigned char getFICHDataType() const;
unsigned char getFICHSQLType() const;
unsigned char getFICHSQLCode() const;
unsigned char* getYsfDT1();
unsigned char* getYsfDT2();
char* getYsfRadioID();
bool getDaemon() const;
bool getNetworkDebug() const;
@ -78,6 +89,17 @@ private:
unsigned int m_localPort;
bool m_enableWiresX;
bool m_wiresXMakeUpper;
unsigned char m_fichCallSign;
unsigned char m_fichCallMode;
unsigned char m_fichFrameTotal;
unsigned char m_fichMessageRoute;
unsigned char m_fichVOIP;
unsigned char m_fichDataType;
unsigned char m_fichSQLType;
unsigned char m_fichSQLCode;
unsigned char m_ysfDT1[10];
unsigned char m_ysfDT2[10];
char m_ysfRadioID[5];
bool m_daemon;
bool m_networkDebug;

View File

@ -20,6 +20,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200503";
const char* VERSION = "20200605";
#endif

View File

@ -92,8 +92,6 @@ const unsigned char REC73[] = {
const unsigned char REC80[] = {
0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U};
const uint8_t dt1[10] = {0x01, 0x22, 0x61, 0x5f, 0x2b, 0x03, 0x11, 0x00, 0x00, 0x00};
#define P25_FRAME_PER 15U
#define YSF_FRAME_PER 90U
@ -107,7 +105,6 @@ const char* HEADER1 = "This software is for use on amateur radio networks only,"
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
const char* HEADER3 = "commercial networks is strictly prohibited.";
const char* HEADER4 = "Copyright(C) 2018,2019 by CA6JAU, G4KLX and others";
const char ysf_radioid[] = {'H', '5', '0', '0', '0'};
#include <functional>
#include <algorithm>
@ -451,7 +448,7 @@ int CYSF2P25::run()
m_conv.putYSF(buffer + 35U);
m_ysfFrames++;
}
}
}
}
}
@ -623,23 +620,23 @@ int CYSF2P25::run()
// Set the FICH
CYSFFICH fich;
fich.setFI(YSF_FI_HEADER);
fich.setCS(2U);
fich.setCM(1U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(6U);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
@ -647,7 +644,7 @@ int CYSF2P25::run()
payload.writeHeader(m_ysfFrame + 35U, csd1, csd2);
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -663,23 +660,23 @@ int CYSF2P25::run()
// Set the FICH
CYSFFICH fich;
fich.setFI(YSF_FI_TERMINATOR);
fich.setCS(2U);
fich.setCM(1U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(6U);
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);
fich.setFN(0U);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
@ -705,18 +702,18 @@ int CYSF2P25::run()
// Set the FICH
fich.setFI(YSF_FI_COMMUNICATIONS);
fich.setCS(2U);
fich.setCM(1U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(fn);
fich.setFT(6U);
fich.setFN(fn);
fich.setFT(m_conf.getFICHFrameTotal());
fich.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);
fich.setMR(m_conf.getFICHMessageRoute());
fich.setVoIP(m_conf.getFICHVOIP());
fich.setDT(m_conf.getFICHDataType());
fich.setSQL(m_conf.getFICHSQLType());
fich.setSQ(m_conf.getFICHSQLCode());
fich.encode(m_ysfFrame + 35U);
// Net frame counter
@ -724,7 +721,7 @@ int CYSF2P25::run()
// Send data to MMDVMHost
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -749,7 +746,7 @@ int CYSF2P25::run()
m_ysfNetwork->close();
m_p25Network->close();
delete m_p25Network;
delete m_ysfNetwork;

View File

@ -13,6 +13,18 @@ LocalAddress=127.0.0.1
LocalPort=42015
EnableWiresX=1
WiresXMakeUpper=1
RadioID=*****
FICHCallsign=2
FICHCallMode=0
FICHBlockTotal=0
FICHFrameTotal=7
FICHMessageRoute=0
FICHVOIP=0
FICHDataType=2
FICHSQLType=0
FICHSQLCode=0
DT1=49,34,98,95,41,0,0,0,0,0
DT2=0,0,0,0,108,32,28,32,3,8
Daemon=0
Debug=0