Patch YSF2P25 for new Yaesu Radios

This commit is contained in:
root 2020-05-03 19:48:56 +01:00
parent 4cd34fab58
commit b2ee3e8e65
3 changed files with 34 additions and 10 deletions

View File

@ -92,6 +92,8 @@ 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
@ -105,6 +107,7 @@ 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>
@ -621,17 +624,22 @@ int CYSF2P25::run()
CYSFFICH fich;
fich.setFI(YSF_FI_HEADER);
fich.setCS(2U);
fich.setCM(1U);
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(7U);
fich.setFT(6U);
fich.setDev(0U);
fich.setMR(2U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH);
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
@ -656,17 +664,22 @@ int CYSF2P25::run()
CYSFFICH fich;
fich.setFI(YSF_FI_TERMINATOR);
fich.setCS(2U);
fich.setCM(1U);
fich.setBN(0U);
fich.setBT(0U);
fich.setFN(0U);
fich.setFT(7U);
fich.setFT(6U);
fich.setDev(0U);
fich.setMR(2U);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);
fich.encode(m_ysfFrame + 35U);
unsigned char csd1[20U], csd2[20U];
memset(csd1, '*', YSF_CALLSIGN_LENGTH);
memset(csd1, '*', YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH/2, ysf_radioid, YSF_CALLSIGN_LENGTH/2);
memcpy(csd1 + YSF_CALLSIGN_LENGTH, m_netSrc.c_str(), YSF_CALLSIGN_LENGTH);
memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
@ -679,8 +692,8 @@ int CYSF2P25::run()
else if (ysfFrameType == TAG_DATA) {
CYSFFICH fich;
CYSFPayload ysfPayload;
unsigned int fn = (ysf_cnt - 1U) % 1U;
//unsigned char dch[10U];
unsigned int fn = (ysf_cnt - 1U) % 7U;
::memcpy(m_ysfFrame + 0U, "YSFD", 4U);
::memcpy(m_ysfFrame + 4U, m_ysfNetwork->getCallsign().c_str(), YSF_CALLSIGN_LENGTH);
@ -693,10 +706,14 @@ int CYSF2P25::run()
// 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(7U);
fich.setFT(6U);
fich.setDev(0U);
fich.setMR(YSF_MR_BUSY);
fich.setMR(0U);
fich.setVoIP(false);
fich.setDT(YSF_DT_VOICE_FR_MODE);
fich.setSQL(0U);
fich.setSQ(0U);

View File

@ -232,6 +232,12 @@ void CYSFFICH::setCS(unsigned char cs)
m_fich[0U] |= (cs << 4) & 0x30U;
}
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

@ -44,6 +44,7 @@ public:
void setFI(unsigned char fi);
void setCS(unsigned char cs);
void setCM(unsigned char cm);
void setFN(unsigned char fn);
void setFT(unsigned char ft);
void setBN(unsigned char bn);