feat: Winkeyer

This commit is contained in:
2026-06-02 01:17:26 +02:00
parent 2eb77370e4
commit 2b4326b553
26 changed files with 3125 additions and 645 deletions
+113 -51
View File
@@ -19,6 +19,7 @@ export namespace adif {
export class ImportResult {
total: number;
imported: number;
updated: number;
skipped: number;
duplicates: number;
duplicate_samples: string[];
@@ -32,6 +33,7 @@ export namespace adif {
if ('string' === typeof source) source = JSON.parse(source);
this.total = source["total"];
this.imported = source["imported"];
this.updated = source["updated"];
this.skipped = source["skipped"];
this.duplicates = source["duplicates"];
this.duplicate_samples = source["duplicate_samples"];
@@ -520,6 +522,7 @@ export namespace main {
clublog_status: string;
hrdlog_status: string;
qrzcom_status: string;
qrzcom_confirmed: string;
static createFrom(source: any = {}) {
return new QSLDefaults(source);
@@ -536,6 +539,7 @@ export namespace main {
this.clublog_status = source["clublog_status"];
this.hrdlog_status = source["hrdlog_status"];
this.qrzcom_status = source["qrzcom_status"];
this.qrzcom_confirmed = source["qrzcom_confirmed"];
}
}
export class RotatorHeading {
@@ -674,6 +678,86 @@ export namespace main {
this.my_pota_ref = source["my_pota_ref"];
}
}
export class WKMacro {
label: string;
text: string;
static createFrom(source: any = {}) {
return new WKMacro(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.label = source["label"];
this.text = source["text"];
}
}
export class WinkeyerSettings {
enabled: boolean;
port: string;
baud: number;
wpm: number;
weight: number;
lead_in_ms: number;
tail_ms: number;
ratio: number;
farnsworth: number;
sidetone_hz: number;
mode: string;
swap: boolean;
autospace: boolean;
use_ptt: boolean;
serial_echo: boolean;
engine: string;
esc_clears_call: boolean;
send_on_type: boolean;
macros: WKMacro[];
static createFrom(source: any = {}) {
return new WinkeyerSettings(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.enabled = source["enabled"];
this.port = source["port"];
this.baud = source["baud"];
this.wpm = source["wpm"];
this.weight = source["weight"];
this.lead_in_ms = source["lead_in_ms"];
this.tail_ms = source["tail_ms"];
this.ratio = source["ratio"];
this.farnsworth = source["farnsworth"];
this.sidetone_hz = source["sidetone_hz"];
this.mode = source["mode"];
this.swap = source["swap"];
this.autospace = source["autospace"];
this.use_ptt = source["use_ptt"];
this.serial_echo = source["serial_echo"];
this.engine = source["engine"];
this.esc_clears_call = source["esc_clears_call"];
this.send_on_type = source["send_on_type"];
this.macros = this.convertValues(source["macros"], WKMacro);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
@@ -1188,55 +1272,6 @@ export namespace qso {
this.status = source["status"];
}
}
export class WorkedEntry {
id: number;
// Go type: time
qso_date: any;
band: string;
mode: string;
rst_sent?: string;
rst_rcvd?: string;
qsl_sent?: string;
qsl_rcvd?: string;
lotw_sent?: string;
lotw_rcvd?: string;
static createFrom(source: any = {}) {
return new WorkedEntry(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.qso_date = this.convertValues(source["qso_date"], null);
this.band = source["band"];
this.mode = source["mode"];
this.rst_sent = source["rst_sent"];
this.rst_rcvd = source["rst_rcvd"];
this.qsl_sent = source["qsl_sent"];
this.qsl_rcvd = source["qsl_rcvd"];
this.lotw_sent = source["lotw_sent"];
this.lotw_rcvd = source["lotw_rcvd"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class WorkedBefore {
callsign: string;
count: number;
@@ -1247,7 +1282,7 @@ export namespace qso {
bands: string[];
modes: string[];
band_modes: BandMode[];
entries: WorkedEntry[];
entries: QSO[];
dxcc?: number;
dxcc_name?: string;
dxcc_count: number;
@@ -1273,7 +1308,7 @@ export namespace qso {
this.bands = source["bands"];
this.modes = source["modes"];
this.band_modes = this.convertValues(source["band_modes"], BandMode);
this.entries = this.convertValues(source["entries"], WorkedEntry);
this.entries = this.convertValues(source["entries"], QSO);
this.dxcc = source["dxcc"];
this.dxcc_name = source["dxcc_name"];
this.dxcc_count = source["dxcc_count"];
@@ -1341,3 +1376,30 @@ export namespace udp {
}
export namespace winkeyer {
export class Status {
connected: boolean;
busy: boolean;
wpm: number;
version: number;
port: string;
error?: string;
static createFrom(source: any = {}) {
return new Status(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.connected = source["connected"];
this.busy = source["busy"];
this.wpm = source["wpm"];
this.version = source["version"];
this.port = source["port"];
this.error = source["error"];
}
}
}