mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:27:09 +08:00
Remove the System Fusion parrot.
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -93,7 +93,6 @@ m_dmrBlackList(),
|
|||||||
m_dmrLookupFile(),
|
m_dmrLookupFile(),
|
||||||
m_dmrTXHang(4U),
|
m_dmrTXHang(4U),
|
||||||
m_fusionEnabled(true),
|
m_fusionEnabled(true),
|
||||||
m_fusionParrotEnabled(false),
|
|
||||||
m_dstarNetworkEnabled(true),
|
m_dstarNetworkEnabled(true),
|
||||||
m_dstarGatewayAddress(),
|
m_dstarGatewayAddress(),
|
||||||
m_dstarGatewayPort(0U),
|
m_dstarGatewayPort(0U),
|
||||||
@@ -317,8 +316,6 @@ bool CConf::read()
|
|||||||
} else if (section == SECTION_FUSION) {
|
} else if (section == SECTION_FUSION) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_fusionEnabled = ::atoi(value) == 1;
|
m_fusionEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Parrot") == 0)
|
|
||||||
m_fusionParrotEnabled = ::atoi(value) == 1;
|
|
||||||
} else if (section == SECTION_DSTAR_NETWORK) {
|
} else if (section == SECTION_DSTAR_NETWORK) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_dstarNetworkEnabled = ::atoi(value) == 1;
|
m_dstarNetworkEnabled = ::atoi(value) == 1;
|
||||||
@@ -630,11 +627,6 @@ bool CConf::getFusionEnabled() const
|
|||||||
return m_fusionEnabled;
|
return m_fusionEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConf::getFusionParrotEnabled() const
|
|
||||||
{
|
|
||||||
return m_fusionParrotEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CConf::getDStarNetworkEnabled() const
|
bool CConf::getDStarNetworkEnabled() const
|
||||||
{
|
{
|
||||||
return m_dstarNetworkEnabled;
|
return m_dstarNetworkEnabled;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -90,7 +90,6 @@ public:
|
|||||||
|
|
||||||
// The System Fusion section
|
// The System Fusion section
|
||||||
bool getFusionEnabled() const;
|
bool getFusionEnabled() const;
|
||||||
bool getFusionParrotEnabled() const;
|
|
||||||
|
|
||||||
// The D-Star Network section
|
// The D-Star Network section
|
||||||
bool getDStarNetworkEnabled() const;
|
bool getDStarNetworkEnabled() const;
|
||||||
@@ -192,7 +191,6 @@ private:
|
|||||||
unsigned int m_dmrTXHang;
|
unsigned int m_dmrTXHang;
|
||||||
|
|
||||||
bool m_fusionEnabled;
|
bool m_fusionEnabled;
|
||||||
bool m_fusionParrotEnabled;
|
|
||||||
|
|
||||||
bool m_dstarNetworkEnabled;
|
bool m_dstarNetworkEnabled;
|
||||||
std::string m_dstarGatewayAddress;
|
std::string m_dstarGatewayAddress;
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ TXHang=4
|
|||||||
|
|
||||||
[System Fusion]
|
[System Fusion]
|
||||||
Enable=1
|
Enable=1
|
||||||
Parrot=1
|
|
||||||
|
|
||||||
[D-Star Network]
|
[D-Star Network]
|
||||||
Enable=1
|
Enable=1
|
||||||
|
|||||||
@@ -304,14 +304,12 @@ int CMMDVMHost::run()
|
|||||||
CYSFControl* ysf = NULL;
|
CYSFControl* ysf = NULL;
|
||||||
if (m_ysfEnabled) {
|
if (m_ysfEnabled) {
|
||||||
unsigned int timeout = m_conf.getTimeout();
|
unsigned int timeout = m_conf.getTimeout();
|
||||||
bool parrot = m_conf.getFusionParrotEnabled();
|
|
||||||
|
|
||||||
LogInfo("System Fusion Parameters");
|
LogInfo("System Fusion Parameters");
|
||||||
LogInfo(" Callsign: %s", m_callsign.c_str());
|
LogInfo(" Callsign: %s", m_callsign.c_str());
|
||||||
LogInfo(" Timeout: %us", timeout);
|
LogInfo(" Timeout: %us", timeout);
|
||||||
LogInfo(" Parrot: %s", parrot ? "enabled" : "disabled");
|
|
||||||
|
|
||||||
ysf = new CYSFControl(m_callsign, m_display, timeout, m_duplex, parrot);
|
ysf = new CYSFControl(m_callsign, m_display, timeout, m_duplex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modeTimer.setTimeout(m_conf.getModeHang());
|
m_modeTimer.setTimeout(m_conf.getModeHang());
|
||||||
|
|||||||
@@ -195,7 +195,6 @@
|
|||||||
<ClInclude Include="YSFConvolution.h" />
|
<ClInclude Include="YSFConvolution.h" />
|
||||||
<ClInclude Include="YSFDefines.h" />
|
<ClInclude Include="YSFDefines.h" />
|
||||||
<ClInclude Include="YSFFICH.h" />
|
<ClInclude Include="YSFFICH.h" />
|
||||||
<ClInclude Include="YSFParrot.h" />
|
|
||||||
<ClInclude Include="YSFPayload.h" />
|
<ClInclude Include="YSFPayload.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -243,7 +242,6 @@
|
|||||||
<ClCompile Include="YSFControl.cpp" />
|
<ClCompile Include="YSFControl.cpp" />
|
||||||
<ClCompile Include="YSFConvolution.cpp" />
|
<ClCompile Include="YSFConvolution.cpp" />
|
||||||
<ClCompile Include="YSFFICH.cpp" />
|
<ClCompile Include="YSFFICH.cpp" />
|
||||||
<ClCompile Include="YSFParrot.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -152,9 +152,6 @@
|
|||||||
<ClInclude Include="YSFControl.h">
|
<ClInclude Include="YSFControl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="YSFParrot.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="YSFPayload.h">
|
<ClInclude Include="YSFPayload.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -289,9 +286,6 @@
|
|||||||
<ClCompile Include="YSFControl.cpp">
|
<ClCompile Include="YSFControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="YSFParrot.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="YSFPayload.cpp">
|
<ClCompile Include="YSFPayload.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ OBJECTS = \
|
|||||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
||||||
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o Log.o MMDVMHost.o Modem.o \
|
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o Log.o MMDVMHost.o Modem.o \
|
||||||
Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o YSFConvolution.o \
|
Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o YSFConvolution.o \
|
||||||
YSFFICH.o YSFParrot.o YSFPayload.o
|
YSFFICH.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ OBJECTS = \
|
|||||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
||||||
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o Log.o MMDVMHost.o \
|
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o Log.o MMDVMHost.o \
|
||||||
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
||||||
YSFConvolution.o YSFFICH.o YSFParrot.o YSFPayload.o
|
YSFConvolution.o YSFFICH.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ OBJECTS = \
|
|||||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
||||||
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o Log.o MMDVMHost.o \
|
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o Log.o MMDVMHost.o \
|
||||||
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
||||||
YSFConvolution.o YSFFICH.o YSFParrot.o YSFPayload.o
|
YSFConvolution.o YSFFICH.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ OBJECTS = \
|
|||||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
|
||||||
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o OLED.o Log.o MMDVMHost.o \
|
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o OLED.o Log.o MMDVMHost.o \
|
||||||
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFControl.o \
|
||||||
YSFConvolution.o YSFFICH.o YSFParrot.o YSFPayload.o
|
YSFConvolution.o YSFFICH.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|||||||
119
YSFControl.cpp
119
YSFControl.cpp
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
// #define DUMP_YSF
|
// #define DUMP_YSF
|
||||||
|
|
||||||
CYSFControl::CYSFControl(const std::string& callsign, CDisplay* display, unsigned int timeout, bool duplex, bool parrot) :
|
CYSFControl::CYSFControl(const std::string& callsign, CDisplay* display, unsigned int timeout, bool duplex) :
|
||||||
m_display(display),
|
m_display(display),
|
||||||
m_duplex(duplex),
|
m_duplex(duplex),
|
||||||
m_queue(5000U, "YSF Control"),
|
m_queue(5000U, "YSF Control"),
|
||||||
@@ -37,14 +37,10 @@ m_bits(0U),
|
|||||||
m_source(NULL),
|
m_source(NULL),
|
||||||
m_dest(NULL),
|
m_dest(NULL),
|
||||||
m_payload(),
|
m_payload(),
|
||||||
m_parrot(NULL),
|
|
||||||
m_fp(NULL)
|
m_fp(NULL)
|
||||||
{
|
{
|
||||||
assert(display != NULL);
|
assert(display != NULL);
|
||||||
|
|
||||||
if (parrot)
|
|
||||||
m_parrot = new CYSFParrot(timeout);
|
|
||||||
|
|
||||||
m_payload.setUplink(callsign);
|
m_payload.setUplink(callsign);
|
||||||
m_payload.setDownlink(callsign);
|
m_payload.setDownlink(callsign);
|
||||||
|
|
||||||
@@ -53,7 +49,6 @@ m_fp(NULL)
|
|||||||
|
|
||||||
CYSFControl::~CYSFControl()
|
CYSFControl::~CYSFControl()
|
||||||
{
|
{
|
||||||
delete m_parrot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CYSFControl::writeModem(unsigned char *data)
|
bool CYSFControl::writeModem(unsigned char *data)
|
||||||
@@ -64,10 +59,8 @@ bool CYSFControl::writeModem(unsigned char *data)
|
|||||||
|
|
||||||
if (type == TAG_LOST && m_state == RS_RF_AUDIO) {
|
if (type == TAG_LOST && m_state == RS_RF_AUDIO) {
|
||||||
LogMessage("YSF, transmission lost, %.1f seconds, BER: %.1f%%", float(m_frames) / 10.0F, float(m_errs * 100U) / float(m_bits));
|
LogMessage("YSF, transmission lost, %.1f seconds, BER: %.1f%%", float(m_frames) / 10.0F, float(m_errs * 100U) / float(m_bits));
|
||||||
|
// if (m_parrot != NULL)
|
||||||
if (m_parrot != NULL)
|
// m_parrot->end();
|
||||||
m_parrot->end();
|
|
||||||
|
|
||||||
writeEndOfTransmission();
|
writeEndOfTransmission();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -114,14 +107,14 @@ bool CYSFControl::writeModem(unsigned char *data)
|
|||||||
writeQueue(data);
|
writeQueue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parrot != NULL) {
|
// if (m_parrot != NULL) {
|
||||||
fich.setMR(YSF_MR_NOT_BUSY);
|
// fich.setMR(YSF_MR_NOT_BUSY);
|
||||||
fich.encode(data + 2U);
|
// fich.encode(data + 2U);
|
||||||
|
//
|
||||||
data[0U] = TAG_DATA;
|
// data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
// data[1U] = 0x00U;
|
||||||
writeParrot(data);
|
// writeParrot(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (valid)
|
if (valid)
|
||||||
m_source = m_payload.getSource();
|
m_source = m_payload.getSource();
|
||||||
@@ -162,14 +155,14 @@ bool CYSFControl::writeModem(unsigned char *data)
|
|||||||
writeQueue(data);
|
writeQueue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parrot != NULL) {
|
// if (m_parrot != NULL) {
|
||||||
fich.setMR(YSF_MR_NOT_BUSY);
|
// fich.setMR(YSF_MR_NOT_BUSY);
|
||||||
fich.encode(data + 2U);
|
// fich.encode(data + 2U);
|
||||||
|
//
|
||||||
data[0U] = TAG_EOT;
|
// data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
// data[1U] = 0x00U;
|
||||||
writeParrot(data);
|
// writeParrot(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#if defined(DUMP_YSF)
|
#if defined(DUMP_YSF)
|
||||||
writeFile(data + 2U);
|
writeFile(data + 2U);
|
||||||
@@ -262,14 +255,14 @@ bool CYSFControl::writeModem(unsigned char *data)
|
|||||||
writeQueue(data);
|
writeQueue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parrot != NULL) {
|
// if (m_parrot != NULL) {
|
||||||
fich.setMR(YSF_MR_NOT_BUSY);
|
// fich.setMR(YSF_MR_NOT_BUSY);
|
||||||
fich.encode(data + 2U);
|
// fich.encode(data + 2U);
|
||||||
|
//
|
||||||
data[0U] = TAG_DATA;
|
// data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
// data[1U] = 0x00U;
|
||||||
writeParrot(data);
|
// writeParrot(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#if defined(DUMP_YSF)
|
#if defined(DUMP_YSF)
|
||||||
writeFile(data + 2U);
|
writeFile(data + 2U);
|
||||||
@@ -285,11 +278,11 @@ bool CYSFControl::writeModem(unsigned char *data)
|
|||||||
writeQueue(data);
|
writeQueue(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parrot != NULL) {
|
// if (m_parrot != NULL) {
|
||||||
data[0U] = TAG_DATA;
|
// data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
// data[1U] = 0x00U;
|
||||||
writeParrot(data);
|
// writeParrot(data);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#if defined(DUMP_YSF)
|
#if defined(DUMP_YSF)
|
||||||
writeFile(data + 2U);
|
writeFile(data + 2U);
|
||||||
@@ -340,18 +333,18 @@ void CYSFControl::clock()
|
|||||||
|
|
||||||
m_timeoutTimer.clock(ms);
|
m_timeoutTimer.clock(ms);
|
||||||
|
|
||||||
if (m_parrot != NULL) {
|
// if (m_parrot != NULL) {
|
||||||
m_parrot->clock(ms);
|
// m_parrot->clock(ms);
|
||||||
|
//
|
||||||
unsigned int space = m_queue.freeSpace();
|
// unsigned int space = m_queue.freeSpace();
|
||||||
bool hasData = m_parrot->hasData();
|
// bool hasData = m_parrot->hasData();
|
||||||
|
//
|
||||||
if (space > (YSF_FRAME_LENGTH_BYTES + 2U) && hasData) {
|
// if (space > (YSF_FRAME_LENGTH_BYTES + 2U) && hasData) {
|
||||||
unsigned char data[YSF_FRAME_LENGTH_BYTES + 2U];
|
// unsigned char data[YSF_FRAME_LENGTH_BYTES + 2U];
|
||||||
m_parrot->read(data);
|
// m_parrot->read(data);
|
||||||
writeQueue(data);
|
// writeQueue(data);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CYSFControl::writeQueue(const unsigned char *data)
|
void CYSFControl::writeQueue(const unsigned char *data)
|
||||||
@@ -374,18 +367,18 @@ void CYSFControl::writeQueue(const unsigned char *data)
|
|||||||
m_queue.addData(data, len);
|
m_queue.addData(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CYSFControl::writeParrot(const unsigned char *data)
|
// void CYSFControl::writeParrot(const unsigned char *data)
|
||||||
{
|
// {
|
||||||
assert(data != NULL);
|
// assert(data != NULL);
|
||||||
|
//
|
||||||
if (m_timeoutTimer.isRunning() && m_timeoutTimer.hasExpired())
|
// if (m_timeoutTimer.isRunning() && m_timeoutTimer.hasExpired())
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
m_parrot->write(data);
|
// m_parrot->write(data);
|
||||||
|
//
|
||||||
if (data[0U] == TAG_EOT)
|
// if (data[0U] == TAG_EOT)
|
||||||
m_parrot->end();
|
// m_parrot->end();
|
||||||
}
|
// }
|
||||||
|
|
||||||
bool CYSFControl::openFile()
|
bool CYSFControl::openFile()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "YSFPayload.h"
|
#include "YSFPayload.h"
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "StopWatch.h"
|
#include "StopWatch.h"
|
||||||
#include "YSFParrot.h"
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
@@ -33,7 +32,7 @@
|
|||||||
|
|
||||||
class CYSFControl {
|
class CYSFControl {
|
||||||
public:
|
public:
|
||||||
CYSFControl(const std::string& callsign, CDisplay* display, unsigned int timeout, bool duplex, bool parrot);
|
CYSFControl(const std::string& callsign, CDisplay* display, unsigned int timeout, bool duplex);
|
||||||
~CYSFControl();
|
~CYSFControl();
|
||||||
|
|
||||||
bool writeModem(unsigned char* data);
|
bool writeModem(unsigned char* data);
|
||||||
@@ -55,11 +54,9 @@ private:
|
|||||||
unsigned char* m_source;
|
unsigned char* m_source;
|
||||||
unsigned char* m_dest;
|
unsigned char* m_dest;
|
||||||
CYSFPayload m_payload;
|
CYSFPayload m_payload;
|
||||||
CYSFParrot* m_parrot;
|
|
||||||
FILE* m_fp;
|
FILE* m_fp;
|
||||||
|
|
||||||
void writeQueue(const unsigned char* data);
|
void writeQueue(const unsigned char* data);
|
||||||
void writeParrot(const unsigned char* data);
|
|
||||||
|
|
||||||
void writeEndOfTransmission();
|
void writeEndOfTransmission();
|
||||||
|
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "YSFParrot.h"
|
|
||||||
#include "YSFDefines.h"
|
|
||||||
#include "Defines.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
CYSFParrot::CYSFParrot(unsigned int timeout) :
|
|
||||||
m_data(NULL),
|
|
||||||
m_length(timeout * 1220U + 1000U),
|
|
||||||
m_used(0U),
|
|
||||||
m_ptr(0U),
|
|
||||||
m_timer(1000U, 2U)
|
|
||||||
{
|
|
||||||
assert(timeout > 0U);
|
|
||||||
|
|
||||||
m_data = new unsigned char[m_length];
|
|
||||||
}
|
|
||||||
|
|
||||||
CYSFParrot::~CYSFParrot()
|
|
||||||
{
|
|
||||||
delete[] m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CYSFParrot::write(const unsigned char* data)
|
|
||||||
{
|
|
||||||
assert(data != NULL);
|
|
||||||
|
|
||||||
if ((m_length - m_used) < 1000U)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
::memcpy(m_data + m_used, data, YSF_FRAME_LENGTH_BYTES + 2U);
|
|
||||||
m_used += YSF_FRAME_LENGTH_BYTES + 2U;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CYSFParrot::end()
|
|
||||||
{
|
|
||||||
if (m_used > 0U)
|
|
||||||
m_timer.start();
|
|
||||||
|
|
||||||
m_ptr = 0U;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CYSFParrot::read(unsigned char* data)
|
|
||||||
{
|
|
||||||
assert(data != NULL);
|
|
||||||
|
|
||||||
if (m_used == 0U)
|
|
||||||
return;
|
|
||||||
|
|
||||||
::memcpy(data, m_data + m_ptr, YSF_FRAME_LENGTH_BYTES + 2U);
|
|
||||||
m_ptr += YSF_FRAME_LENGTH_BYTES + 2U;
|
|
||||||
|
|
||||||
if (m_ptr >= m_used) {
|
|
||||||
m_timer.stop();
|
|
||||||
m_used = 0U;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CYSFParrot::hasData()
|
|
||||||
{
|
|
||||||
if (m_timer.isRunning() && m_timer.hasExpired())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (m_used == 0U)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CYSFParrot::clock(unsigned int ms)
|
|
||||||
{
|
|
||||||
m_timer.clock(ms);
|
|
||||||
}
|
|
||||||
48
YSFParrot.h
48
YSFParrot.h
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(YAFParrot_H)
|
|
||||||
#define YSFParrot_H
|
|
||||||
|
|
||||||
#include "Timer.h"
|
|
||||||
|
|
||||||
class CYSFParrot
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CYSFParrot(unsigned int timeout);
|
|
||||||
~CYSFParrot();
|
|
||||||
|
|
||||||
bool write(const unsigned char* data);
|
|
||||||
|
|
||||||
void read(unsigned char* data);
|
|
||||||
|
|
||||||
void end();
|
|
||||||
|
|
||||||
bool hasData();
|
|
||||||
|
|
||||||
void clock(unsigned int ms);
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned char* m_data;
|
|
||||||
unsigned int m_length;
|
|
||||||
unsigned int m_used;
|
|
||||||
unsigned int m_ptr;
|
|
||||||
CTimer m_timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user