Better ADIF conformance for ARRL Field Day mode

This change may break N1MM Logger+ integration, notably the CLASS ADIF
field is  populated which may not  be recognized by N1MM  Logger+, nor
interfaces to it.

One exception to  ADIF conformance is that the ARRL_SECT  field may be
populated with  the value DX  despite it  not being a  valid ARRL_SECT
enumeration value. This is done for consistency with N1MM Logger+ ADIF
exports.
This commit is contained in:
Bill Somerville 2019-06-24 00:56:41 +01:00
parent c8fd0b0988
commit 91aa591a71
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
3 changed files with 52 additions and 41 deletions

View File

@ -32,7 +32,7 @@ void LogBook::match (QString const& call, QString const& mode, QString const& gr
bool& ITUZoneB4,
QString const& band) const
{
if (call.length() > 0)
if (call.size() > 0)
{
auto const& mode_to_check = (config_ && !config_->highlight_by_mode ()) ? QString {} : mode;
callB4 = worked_before_.call_worked (call, mode_to_check, band);
@ -77,30 +77,30 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
QString const& xSent, QString const& xRcvd)
{
QString t;
t = "<call:" + QString::number(hisCall.length()) + ">" + hisCall;
t += " <gridsquare:" + QString::number(hisGrid.length()) + ">" + hisGrid;
t = "<call:" + QString::number(hisCall.size()) + ">" + hisCall;
t += " <gridsquare:" + QString::number(hisGrid.size()) + ">" + hisGrid;
if (mode != "FT4")
{
t += " <mode:" + QString::number(mode.length()) + ">" + mode;
t += " <mode:" + QString::number(mode.size()) + ">" + mode;
}
else
{
t += " <mode:4>MFSK <submode:" + QString::number(mode.length()) + ">" + mode;
t += " <mode:4>MFSK <submode:" + QString::number(mode.size()) + ">" + mode;
}
t += " <rst_sent:" + QString::number(rptSent.length()) + ">" + rptSent;
t += " <rst_rcvd:" + QString::number(rptRcvd.length()) + ">" + rptRcvd;
t += " <rst_sent:" + QString::number(rptSent.size()) + ">" + rptSent;
t += " <rst_rcvd:" + QString::number(rptRcvd.size()) + ">" + rptRcvd;
t += " <qso_date:8>" + dateTimeOn.date().toString("yyyyMMdd");
t += " <time_on:6>" + dateTimeOn.time().toString("hhmmss");
t += " <qso_date_off:8>" + dateTimeOff.date().toString("yyyyMMdd");
t += " <time_off:6>" + dateTimeOff.time().toString("hhmmss");
t += " <band:" + QString::number(band.length()) + ">" + band;
t += " <freq:" + QString::number(strDialFreq.length()) + ">" + strDialFreq;
t += " <station_callsign:" + QString::number(myCall.length()) + ">" + myCall;
t += " <my_gridsquare:" + QString::number(myGrid.length()) + ">" + myGrid;
if(txPower!="") t += " <tx_pwr:" + QString::number(txPower.length()) + ">" + txPower;
if(comments!="") t += " <comment:" + QString::number(comments.length()) + ">" + comments;
if(name!="") t += " <name:" + QString::number(name.length()) + ">" + name;
if(operator_call!="") t+=" <operator:" + QString::number(operator_call.length()) + ">" + operator_call;
t += " <band:" + QString::number(band.size()) + ">" + band;
t += " <freq:" + QString::number(strDialFreq.size()) + ">" + strDialFreq;
t += " <station_callsign:" + QString::number(myCall.size()) + ">" + myCall;
t += " <my_gridsquare:" + QString::number(myGrid.size()) + ">" + myGrid;
if(txPower!="") t += " <tx_pwr:" + QString::number(txPower.size()) + ">" + txPower;
if(comments!="") t += " <comment:" + QString::number(comments.size()) + ">" + comments;
if(name!="") t += " <name:" + QString::number(name.size()) + ">" + name;
if(operator_call!="") t+=" <operator:" + QString::number(operator_call.size()) + ">" + operator_call;
if (xSent.size ())
{
auto words = xSent.split (' ', QString::SkipEmptyParts);
@ -131,16 +131,27 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
{
if (words.at (1).toUInt ())
{
t += " <srx:" + QString::number (words.at (1).length ()) + ">" + words.at (1);
t += " <srx:" + QString::number (words.at (1).size ()) + ">" + words.at (1);
}
else if (words.at (0).toUInt () && words.at (0).size () > 3) // EU VHF contest exchange
{
// strip report and set SRX to serial
t += " <srx:" + QString::number (words.at (0).mid (2).length ()) + ">" + words.at (0).mid (2);
t += " <srx:" + QString::number (words.at (0).mid (2).size ()) + ">" + words.at (0).mid (2);
}
else
{
t += " <state:" + QString::number (words.at (1).length ()) + ">" + words.at (1);
if (Configuration::SpecialOperatingActivity::FIELD_DAY == config_->special_op_id ())
{
// include DX as an ARRL_SECT value even though it is
// not in the ADIF spec ARRL_SECT enumeration, done
// because N1MM does the same
t += " <contest_id:14>ARRL-FIELD-DAY <class:" + QString::number (words.at (0).size ()) + '>'
+ words.at (0) + " <arrl_sect:" + QString::number (words.at (1).size ()) + '>' + words.at (1);
}
else if (Configuration::SpecialOperatingActivity::RTTY == config_->special_op_id ())
{
t += " <state:" + QString::number (words.at (1).size ()) + ">" + words.at (1);
}
}
}
}

View File

@ -39,12 +39,12 @@ public:
AD1CCty::Record const&, bool& callB4, bool& countryB4,
bool &gridB4, bool &continentB4, bool& CQZoneB4, bool& ITUZoneB4,
QString const& currentBand = QString {}) const;
static QByteArray QSOToADIF (QString const& hisCall, QString const& hisGrid, QString const& mode,
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
QString const& name, QString const& strDialFreq, QString const& myCall,
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
QString const& xSent, QString const& xRcvd);
QByteArray QSOToADIF (QString const& hisCall, QString const& hisGrid, QString const& mode,
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
QDateTime const& dateTimeOff, QString const& band, QString const& comments,
QString const& name, QString const& strDialFreq, QString const& myCall,
QString const& m_myGrid, QString const& m_txPower, QString const& operator_call,
QString const& xSent, QString const& xRcvd);
Q_SIGNAL void finished_loading (int worked_before_record_count, QString const& error) const;

View File

@ -202,23 +202,23 @@ void LogQSO::accept()
, m_myGrid
, xsent
, xrcvd
, LogBook::QSOToADIF (hisCall
, hisGrid
, mode
, rptSent
, rptRcvd
, dateTimeOn
, dateTimeOff
, band
, m_comments
, name
, strDialFreq
, m_myCall
, m_myGrid
, m_txPower
, operator_call
, xsent
, xrcvd));
, m_log->QSOToADIF (hisCall
, hisGrid
, mode
, rptSent
, rptRcvd
, dateTimeOn
, dateTimeOff
, band
, m_comments
, name
, strDialFreq
, m_myCall
, m_myGrid
, m_txPower
, operator_call
, xsent
, xrcvd));
QDialog::accept();
}