diff --git a/DMR2YSF/Conf.h b/DMR2YSF/Conf.h index d6a7f4e..cef1052 100644 --- a/DMR2YSF/Conf.h +++ b/DMR2YSF/Conf.h @@ -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 diff --git a/YSF2DMR/Conf.h b/YSF2DMR/Conf.h index 472141e..cac66bd 100644 --- a/YSF2DMR/Conf.h +++ b/YSF2DMR/Conf.h @@ -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 diff --git a/YSF2NXDN/Conf.cpp b/YSF2NXDN/Conf.cpp index 454a234..9619e35 100644 --- a/YSF2NXDN/Conf.cpp +++ b/YSF2NXDN/Conf.cpp @@ -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; diff --git a/YSF2NXDN/Conf.h b/YSF2NXDN/Conf.h index 5e4ad21..3e05096 100644 --- a/YSF2NXDN/Conf.h +++ b/YSF2NXDN/Conf.h @@ -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; diff --git a/YSF2NXDN/Version.h b/YSF2NXDN/Version.h index 673e6a0..36efd6b 100644 --- a/YSF2NXDN/Version.h +++ b/YSF2NXDN/Version.h @@ -20,6 +20,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200503"; +const char* VERSION = "20200605"; #endif diff --git a/YSF2NXDN/YSF2NXDN.cpp b/YSF2NXDN/YSF2NXDN.cpp index 59aebc8..9af99cc 100644 --- a/YSF2NXDN/YSF2NXDN.cpp +++ b/YSF2NXDN/YSF2NXDN.cpp @@ -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 #include @@ -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; diff --git a/YSF2NXDN/YSF2NXDN.ini b/YSF2NXDN/YSF2NXDN.ini index 0d9218f..702ee58 100644 --- a/YSF2NXDN/YSF2NXDN.ini +++ b/YSF2NXDN/YSF2NXDN.ini @@ -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] diff --git a/YSF2P25/Conf.cpp b/YSF2P25/Conf.cpp index 27ed043..208967b 100644 --- a/YSF2P25/Conf.cpp +++ b/YSF2P25/Conf.cpp @@ -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; diff --git a/YSF2P25/Conf.h b/YSF2P25/Conf.h index ff50c09..b0556c5 100644 --- a/YSF2P25/Conf.h +++ b/YSF2P25/Conf.h @@ -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; diff --git a/YSF2P25/Version.h b/YSF2P25/Version.h index 673e6a0..36efd6b 100644 --- a/YSF2P25/Version.h +++ b/YSF2P25/Version.h @@ -20,6 +20,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200503"; +const char* VERSION = "20200605"; #endif diff --git a/YSF2P25/YSF2P25.cpp b/YSF2P25/YSF2P25.cpp index 95bf2ee..2e2635b 100644 --- a/YSF2P25/YSF2P25.cpp +++ b/YSF2P25/YSF2P25.cpp @@ -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 #include @@ -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; diff --git a/YSF2P25/YSF2P25.ini b/YSF2P25/YSF2P25.ini index 63d3ae0..7cd5c60 100644 --- a/YSF2P25/YSF2P25.ini +++ b/YSF2P25/YSF2P25.ini @@ -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