Export WAE QTC traffic to ADIF, and read it back
ADIF has no record for QTC traffic, which is why N1MM leaves it out and why a WAE log cannot be moved between databases as ADIF. The plain export now writes the contacts alone, as N1MM does: it used to write the QTC rows as contacts, with the time of the traffic in RST_SENT and the reported callsign in RST_RCVD. File > Export > Export ADIF with QTC traffic writes the whole log instead. A QTC row goes out with the station, time, band and mode, and the traffic in application-defined fields — APP_NONEMM_QTC and friends, the prefix the ADIF specification keeps for a program's own data — with the line in the comment as well so the file can be read without this program. The report columns are left off that record, because on a QTC row they hold the time and callsign of the contact being reported. Reading such a file back rebuilds the rows, so a WAE log survives the round trip whole. The item is only in the menu for a contest with traffic. Another program reading that file sees each QTC row as an ordinary contact with the station the traffic was exchanged with and ignores the extra fields. There is no way around that in ADIF, which is why the plain export is still the one to hand over. Contacts now also carry their row kind in APP_NONEMM_EXCHANGE1. Without it a WAE log read back holds contacts with no kind at all, which N1MM's own queries do not find. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
This commit is contained in:
@@ -132,25 +132,44 @@ public sealed partial class EntryWindow
|
||||
Status($"{Logging.Log.Qsos.Count} contacts written to {Path.GetFileName(path)}");
|
||||
}
|
||||
|
||||
private async void OnExportAdif(object? sender, RoutedEventArgs e)
|
||||
/// The contacts alone, which is the file to hand to another program. ADIF
|
||||
/// has no QTC record, and N1MM leaves the traffic out for that reason.
|
||||
private void OnExportAdif(object? sender, RoutedEventArgs e) =>
|
||||
_ = ExportAdif(withQtcTraffic: false);
|
||||
|
||||
/// The whole log, traffic included, which is the file to read back into
|
||||
/// this program. The QTC rows carry their traffic in fields of our own;
|
||||
/// another program reads each of them as a contact with the station the
|
||||
/// traffic was exchanged with.
|
||||
private void OnExportAdifWithQtcs(object? sender, RoutedEventArgs e) =>
|
||||
_ = ExportAdif(withQtcTraffic: true);
|
||||
|
||||
private async Task ExportAdif(bool withQtcTraffic)
|
||||
{
|
||||
if (Logging is null)
|
||||
{
|
||||
Status("no contest is open");
|
||||
return;
|
||||
}
|
||||
string suffix = withQtcTraffic ? "-with-qtcs" : "";
|
||||
IStorageFile? file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Title = "Export ADIF",
|
||||
SuggestedFileName = $"{session.Settings.Station.Callsign}.adi",
|
||||
Title = withQtcTraffic ? "Export ADIF with QTC traffic" : "Export ADIF",
|
||||
SuggestedFileName = $"{session.Settings.Station.Callsign}{suffix}.adi",
|
||||
SuggestedStartLocation = await Folder(session.Paths.ExportFiles),
|
||||
});
|
||||
if (file?.TryGetLocalPath() is not { } path)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await File.WriteAllTextAsync(path, new AdifWriter(Logging.Me).Write(Logging.Log.Qsos));
|
||||
Status($"{Logging.Log.Qsos.Count} contacts written to {Path.GetFileName(path)}");
|
||||
List<Qso> written = [.. withQtcTraffic ? Logging.Log.Qsos : Logging.Log.Contacts];
|
||||
await File.WriteAllTextAsync(
|
||||
path, new AdifWriter(Logging.Me).Write(written, withQtcTraffic));
|
||||
int traffic = written.Count(q => !Logging.Contest.IsContact(q));
|
||||
string what = traffic > 0
|
||||
? $"{written.Count - traffic} contacts and {traffic} QTCs"
|
||||
: $"{written.Count} contacts";
|
||||
Status($"{what} written to {Path.GetFileName(path)}");
|
||||
}
|
||||
|
||||
private async void OnImportAdif(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user