Updating to add the extra user configurable fields

This commit is contained in:
root 2020-06-05 11:34:16 +01:00
parent 4bdbbee4de
commit 8d7854999b
11 changed files with 352 additions and 126 deletions

View File

@ -107,6 +107,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++;
@ -132,6 +134,40 @@ bool CConf::read()
m_daemon = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0)
m_debug = ::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 (section == SECTION_DMR_NETWORK) {
if (::strcmp(key, "Id") == 0)
m_dmrId = (unsigned int)::atoi(value);
@ -213,6 +249,61 @@ bool CConf::getDebug() const
return m_debug;
}
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;
}
unsigned int CConf::getDMRId() const
{
return m_dmrId;

View File

@ -40,6 +40,17 @@ public:
std::string getFCSFile() const;
bool getDaemon() const;
bool getDebug() 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();
// The DMR Network section
unsigned int getDMRId() const;
@ -91,6 +102,17 @@ private:
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[10];
unsigned char m_ysfDT2[10];
char m_ysfRadioID[5];
};
#endif

View File

@ -33,9 +33,6 @@
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};
// Added by AD8DP for FICH FT=6 transmissions
const uint8_t dt1[10] = {0x01, 0x22, 0x61, 0x5f, 0x2b, 0x03, 0x11, 0x00, 0x00, 0x00};
const unsigned char CONN_RESP[] = {0x5DU, 0x41U, 0x5FU, 0x26U};
#define DMR_FRAME_PER 55U
@ -652,23 +649,24 @@ int CDMR2YSF::run()
// Set the FICH
CYSFFICH fich;
fich.setFI(YSF_FI_HEADER);
fich.setCS(2U);
fich.setCM(1U);
fich.setBN(0U);
fich.setBT(0U);
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);
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);
@ -676,7 +674,7 @@ int CDMR2YSF::run()
payload.writeHeader(m_ysfFrame + 35U, csd1, csd2);
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -693,23 +691,23 @@ int CDMR2YSF::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.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);
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);
@ -724,7 +722,7 @@ int CDMR2YSF::run()
CYSFPayload ysfPayload;
unsigned char dch[10U];
unsigned int fn = (ysf_cnt - 1U) % 7U;
unsigned int fn = (ysf_cnt - 1U) % (m_conf.getFICHFrameTotal() + 1);
::memcpy(m_ysfFrame + 0U, "YSFD", 4U);
::memcpy(m_ysfFrame + 4U, m_ysfNetwork->getCallsign().c_str(), YSF_CALLSIGN_LENGTH);
@ -737,8 +735,8 @@ int CDMR2YSF::run()
switch (fn) {
case 0:
memset(dch, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dch);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, m_conf.getYsfRadioID(), YSF_CALLSIGN_LENGTH/2);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dch);
break;
case 1:
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, (const unsigned char*)m_netSrc.c_str());
@ -748,33 +746,33 @@ int CDMR2YSF::run()
break;
case 5:
memset(dch, ' ', YSF_CALLSIGN_LENGTH/2);
memcpy(dch + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
ysfPayload.writeVDMode2Data(m_ysfFrame + 35U, dch); // Rem3/4
break;
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.setBN(0U);
fich.setBT(0U);
fich.setFN(fn);
fich.setFT(6U);
fich.setCS(m_conf.getFICHCallSign());
fich.setCM(m_conf.getFICHCallMode());
fich.setBN(0U);
fich.setBT(0U);
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
@ -782,7 +780,7 @@ int CDMR2YSF::run()
// Send data
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -901,7 +899,7 @@ unsigned int CDMR2YSF::findYSFID(std::string cs, bool showdst)
int mid1 = cs.find_last_of('-');
int mid2 = cs.find_last_of('/');
int last = cs.find_last_not_of(' ');
if (mid1 == -1 && mid2 == -1 && first == -1 && last == -1)
cstrim = "N0CALL";
else if (mid1 == -1 && mid2 == -1)
@ -943,10 +941,10 @@ std::string CDMR2YSF::getSrcYSF(const unsigned char* buffer)
::memcpy(temp, buffer + 14U, YSF_CALLSIGN_LENGTH);
temp[YSF_CALLSIGN_LENGTH] = 0U;
std::string trimmed = reinterpret_cast<char const*>(temp);
trimmed.erase(std::find_if(trimmed.rbegin(), trimmed.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), trimmed.end());
return trimmed;
}

View File

@ -5,6 +5,18 @@ GatewayPort=4200
LocalAddress=127.0.0.1
LocalPort=3200
FCSRooms=FCSRooms.txt
#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

View File

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

View File

@ -238,6 +238,12 @@ void CYSFFICH::setCM(unsigned char cm)
m_fich[0U] |= (cm << 2) & 0x0CU;
}
void CYSFFICH::setCM(unsigned char cm)
{
m_fich[0U] &= 0xF3U;
m_fich[0U] |= (cm << 2) & 0x0CU;
}
void CYSFFICH::setFN(unsigned char fn)
{
m_fich[1U] &= 0xC7U;

View File

@ -142,6 +142,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++;
@ -176,6 +178,40 @@ bool CConf::read()
m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::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 (section == SECTION_INFO) {
if (::strcmp(key, "TXFrequency") == 0)
m_txFrequency = (unsigned int)::atoi(value);
@ -334,6 +370,61 @@ bool CConf::getDaemon() const
return m_daemon;
}
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;
}
unsigned int CConf::getRxFrequency() const
{
return m_rxFrequency;

View File

@ -44,6 +44,17 @@ public:
unsigned int getHangTime() const;
bool getWiresXMakeUpper() const;
bool getDaemon() 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();
// The Info section
unsigned int getRxFrequency() const;
@ -148,7 +159,7 @@ private:
unsigned int m_logFileLevel;
std::string m_logFilePath;
std::string m_logFileRoot;
bool m_aprsEnabled;
std::string m_aprsServer;
unsigned int m_aprsPort;
@ -158,6 +169,17 @@ private:
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[10];
unsigned char m_ysfDT2[10];
char m_ysfRadioID[5];
};
#endif

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 DMR_FRAME_PER 55U
#define YSF_FRAME_PER 90U
@ -943,32 +942,23 @@ int CYSF2DMR::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.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VD_MODE2);
fich.setSQL(false);
fich.setSQ(0U);
if (m_remoteGateway) {
fich.setVoIP(false);
fich.setMR(YSF_MR_DIRECT);
} else {
fich.setVoIP(true);
fich.setMR(YSF_MR_BUSY);
}
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);
@ -976,7 +966,7 @@ int CYSF2DMR::run()
payload.writeHeader(m_ysfFrame + 35U, csd1, csd2);
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}
@ -992,32 +982,23 @@ int CYSF2DMR::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_VD_MODE2);
fich.setSQL(false);
fich.setSQ(0U);
if (m_remoteGateway) {
fich.setVoIP(false);
fich.setMR(YSF_MR_DIRECT);
} else {
fich.setVoIP(true);
fich.setMR(YSF_MR_BUSY);
}
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);
@ -1031,7 +1012,7 @@ int CYSF2DMR::run()
CYSFPayload ysfPayload;
unsigned char dch[10U];
unsigned int fn = (ysf_cnt - 1U) % 7U;
unsigned int fn = (ysf_cnt - 1U) % (m_conf.getFICHFrameTotal() + 1);
::memcpy(m_ysfFrame + 0U, "YSFD", 4U);
::memcpy(m_ysfFrame + 4U, m_ysfNetwork->getCallsign().c_str(), YSF_CALLSIGN_LENGTH);
@ -1044,7 +1025,7 @@ int CYSF2DMR::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);
break;
case 1:
@ -1054,51 +1035,42 @@ int CYSF2DMR::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.setDev(0U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VD_MODE2);
fich.setSQL(false);
fich.setSQ(0U);
if (m_remoteGateway) {
fich.setVoIP(false);
fich.setMR(YSF_MR_DIRECT);
} else {
fich.setVoIP(true);
fich.setMR(YSF_MR_BUSY);
}
fich.encode(m_ysfFrame + 35U);
fich.setFN(fn);
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);
// Net frame counter
m_ysfFrame[34U] = (ysf_cnt & 0x7FU) << 1;
// Send data to MMDVMHost
m_ysfNetwork->write(m_ysfFrame);
ysf_cnt++;
ysfWatch.start();
}

View File

@ -21,6 +21,18 @@ EnableWiresX=1
RemoteGateway=0
HangTime=1000
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
[DMR Network]