feat: Added Net control
This commit is contained in:
@@ -2004,6 +2004,126 @@ export namespace main {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class netActiveEntry {
|
||||
callsign: string;
|
||||
name: string;
|
||||
qth: string;
|
||||
country: string;
|
||||
rst_sent: string;
|
||||
rst_rcvd: string;
|
||||
comment: string;
|
||||
// Go type: time
|
||||
time_on: any;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new netActiveEntry(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.callsign = source["callsign"];
|
||||
this.name = source["name"];
|
||||
this.qth = source["qth"];
|
||||
this.country = source["country"];
|
||||
this.rst_sent = source["rst_sent"];
|
||||
this.rst_rcvd = source["rst_rcvd"];
|
||||
this.comment = source["comment"];
|
||||
this.time_on = this.convertValues(source["time_on"], null);
|
||||
}
|
||||
|
||||
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 namespace netctl {
|
||||
|
||||
export class Station {
|
||||
callsign: string;
|
||||
name?: string;
|
||||
qth?: string;
|
||||
country?: string;
|
||||
dxcc?: number;
|
||||
itu?: number;
|
||||
cq?: number;
|
||||
groups?: string;
|
||||
sig?: string;
|
||||
sig_info?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Station(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.callsign = source["callsign"];
|
||||
this.name = source["name"];
|
||||
this.qth = source["qth"];
|
||||
this.country = source["country"];
|
||||
this.dxcc = source["dxcc"];
|
||||
this.itu = source["itu"];
|
||||
this.cq = source["cq"];
|
||||
this.groups = source["groups"];
|
||||
this.sig = source["sig"];
|
||||
this.sig_info = source["sig_info"];
|
||||
}
|
||||
}
|
||||
export class Net {
|
||||
id: string;
|
||||
name: string;
|
||||
default_rst_sent?: string;
|
||||
default_rst_rcvd?: string;
|
||||
default_comment?: string;
|
||||
stations?: Station[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Net(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.name = source["name"];
|
||||
this.default_rst_sent = source["default_rst_sent"];
|
||||
this.default_rst_rcvd = source["default_rst_rcvd"];
|
||||
this.default_comment = source["default_comment"];
|
||||
this.stations = this.convertValues(source["stations"], Station);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user