Files
protoloon/js/WsprSearchResultDataTableColumnBuilderTelemetryExtendedUserOrVendorDefined.js
2026-04-02 17:39:02 -06:00

81 lines
2.0 KiB
JavaScript

/*
Copyright (c) 2023-forever Douglas Malnati. All rights reserved.
See the /faq/tos page for details.
(If this generated header is stamped on a file which is a 3rd party file or under a different license or copyright, then ignore this copyright statement and use that file's terms.)
*/
export class ColumnBuilderTelemetryExtendedUserOrVendorDefined
{
constructor(slot, codecMaker, type)
{
this.slot = slot;
this.codec = codecMaker.GetCodecInstance();
this.type = type;
this.colNameList = [];
this.colNameList.push(`slot${this.slot}.${this.type}.EncMsg`);
for (let field of this.codec.GetFieldList())
{
let colName = `slot${this.slot}.${this.type}.${field.name}${field.unit}`;
this.colNameList.push(colName);
}
}
Match(msg)
{
let typeCorrect = this.type == "ud" ?
msg.IsExtendedTelemetryUserDefined() :
msg.IsExtendedTelemetryVendorDefined();
let retVal = typeCorrect && msg.GetCodec().GetHdrSlotEnum() == this.slot;
return retVal;
}
GetColNameList()
{
return this.colNameList;
}
GetColMetaDataList()
{
let metaDataList = [];
metaDataList.push({});
for (let field of this.codec.GetFieldList())
{
let metaData = {
rangeMin: this.codec[`Get${field.name}${field.unit}LowValue`](),
rangeMax: this.codec[`Get${field.name}${field.unit}HighValue`](),
};
metaDataList.push(metaData);
}
return metaDataList;
}
GetValList(msg)
{
let codec = msg.GetCodec();
let valList = [];
valList.push(`${msg.fields.callsign} ${msg.fields.grid4} ${msg.fields.powerDbm}`);
for (let field of codec.GetFieldList())
{
let val = codec[`Get${field.name}${field.unit}`]();
valList.push(val);
}
return valList;
}
}