Remove unused sample dumping code.

This commit is contained in:
Jonathan Naylor 2017-04-10 17:54:12 +01:00
parent 55cb3717f5
commit dd2db36409
6 changed files with 3 additions and 71 deletions

View file

@ -91,7 +91,6 @@ m_modemDMRTXLevel(50U),
m_modemYSFTXLevel(50U),
m_modemP25TXLevel(50U),
m_modemRSSIMappingFile(),
m_modemSamplesDir(),
m_modemDebug(false),
m_umpEnabled(false),
m_umpPort(),
@ -335,8 +334,6 @@ bool CConf::read()
m_modemP25TXLevel = (unsigned int)::atoi(value);
else if (::strcmp(key, "RSSIMappingFile") == 0)
m_modemRSSIMappingFile = value;
else if (::strcmp(key, "SamplesDir") == 0)
m_modemSamplesDir = value;
else if (::strcmp(key, "Debug") == 0)
m_modemDebug = ::atoi(value) == 1;
} else if (section == SECTION_UMP) {
@ -753,11 +750,6 @@ std::string CConf::getModemRSSIMappingFile () const
return m_modemRSSIMappingFile;
}
std::string CConf::getModemSamplesDir() const
{
return m_modemSamplesDir;
}
bool CConf::getModemDebug() const
{
return m_modemDebug;

2
Conf.h
View file

@ -78,7 +78,6 @@ public:
unsigned int getModemYSFTXLevel() const;
unsigned int getModemP25TXLevel() const;
std::string getModemRSSIMappingFile() const;
std::string getModemSamplesDir() const;
bool getModemDebug() const;
// The UMP section
@ -232,7 +231,6 @@ private:
unsigned int m_modemYSFTXLevel;
unsigned int m_modemP25TXLevel;
std::string m_modemRSSIMappingFile;
std::string m_modemSamplesDir;
bool m_modemDebug;
bool m_umpEnabled;

View file

@ -50,7 +50,6 @@ TXLevel=50
# YSFTXLevel=50
# P25TXLevel=50
RSSIMappingFile=RSSI.dat
SamplesDir=.
Debug=0
[UMP]

View file

@ -807,7 +807,6 @@ bool CMMDVMHost::createModem()
bool lowDeviation = m_conf.getFusionLowDeviation();
unsigned int rxFrequency = m_conf.getRxFrequency();
unsigned int txFrequency = m_conf.getTxFrequency();
std::string samplesDir = m_conf.getModemSamplesDir();
LogInfo("Modem Parameters");
LogInfo(" Port: %s", port.c_str());
@ -825,7 +824,7 @@ bool CMMDVMHost::createModem()
LogInfo(" RX Frequency: %uHz", rxFrequency);
LogInfo(" TX Frequency: %uHz", txFrequency);
m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, samplesDir, debug);
m_modem = new CModem(port, m_duplex, rxInvert, txInvert, pttInvert, txDelay, dmrDelay, debug);
m_modem->setModeParams(m_dstarEnabled, m_dmrEnabled, m_ysfEnabled, m_p25Enabled);
m_modem->setLevels(rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel);
m_modem->setRFParams(rxFrequency, txFrequency);

View file

@ -72,8 +72,6 @@ const unsigned char MMDVM_NAK = 0x7FU;
const unsigned char MMDVM_SERIAL = 0x80U;
const unsigned char MMDVM_SAMPLES = 0xF0U;
const unsigned char MMDVM_DEBUG1 = 0xF1U;
const unsigned char MMDVM_DEBUG2 = 0xF2U;
const unsigned char MMDVM_DEBUG3 = 0xF3U;
@ -85,7 +83,7 @@ const unsigned int MAX_RESPONSES = 30U;
const unsigned int BUFFER_LENGTH = 2000U;
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, const std::string& samplesDir, bool debug) :
CModem::CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool debug) :
m_port(port),
m_dmrColorCode(0U),
m_ysfLoDev(false),
@ -101,7 +99,6 @@ m_dstarTXLevel(0U),
m_dmrTXLevel(0U),
m_ysfTXLevel(0U),
m_p25TXLevel(0U),
m_samplesDir(samplesDir),
m_debug(debug),
m_rxFrequency(0U),
m_txFrequency(0U),
@ -480,10 +477,6 @@ void CModem::clock(unsigned int ms)
printDebug();
break;
case MMDVM_SAMPLES:
dumpSamples();
break;
default:
LogMessage("Unknown message, type: %02X", m_buffer[2U]);
CUtils::dump("Buffer dump", m_buffer, m_length);
@ -1301,50 +1294,3 @@ void CModem::printDebug()
LogMessage("Debug: %.*s %d %d %d %d", m_length - 11U, m_buffer + 3U, val1, val2, val3, val4);
}
}
void CModem::dumpSamples()
{
if (m_samplesDir.empty())
m_samplesDir = ".";
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
const char* mode = NULL;
switch (m_buffer[5U]) {
case MODE_DSTAR:
mode = "DStar";
break;
case MODE_DMR:
mode = "DMR";
break;
case MODE_P25:
mode = "P25";
break;
case MODE_YSF:
mode = "YSF";
break;
default:
LogWarning("Unknown protocol passed to samples dump - %u", m_buffer[5U]);
return;
}
char filename[150U];
#if defined(_WIN32) || defined(_WIN64)
::sprintf(filename, "%s\\Samples-%s-%04d%02d%02d.dat", m_samplesDir.c_str(), mode, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
#else
::sprintf(filename, "%s/Samples-%s-%04d%02d%02d.dat", m_samplesDir.c_str(), mode, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
#endif
FILE* fp = ::fopen(filename, "a+b");
if (fp == NULL) {
LogWarning("Unable to open samples file for writing - %s", filename);
return;
}
::fwrite(m_buffer + 6U, 1U, m_length - 6U, fp);
::fclose(fp);
}

View file

@ -34,7 +34,7 @@ enum RESP_TYPE_MMDVM {
class CModem {
public:
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, const std::string& samplesDir, bool debug = false);
CModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, unsigned int txDelay, unsigned int dmrDelay, bool debug = false);
~CModem();
void setRFParams(unsigned int rxFrequency, unsigned int txFrequency);
@ -103,7 +103,6 @@ private:
unsigned int m_dmrTXLevel;
unsigned int m_ysfTXLevel;
unsigned int m_p25TXLevel;
std::string m_samplesDir;
bool m_debug;
unsigned int m_rxFrequency;
unsigned int m_txFrequency;
@ -145,7 +144,6 @@ private:
bool setFrequency();
void printDebug();
void dumpSamples();
RESP_TYPE_MMDVM getResponse();
};