70 lines
1.9 KiB
JavaScript
70 lines
1.9 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.)
|
|
*/
|
|
|
|
import { CandidateFilterBase } from './CandidateFilterBase.js';
|
|
import { NonRejectedOnlyFilter } from './WsprMessageCandidate.js';
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
// Candidate Filter - HighResLocation
|
|
//
|
|
// Reject HighResLocation messages whose Reference field is not an
|
|
// established value.
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
export class CandidateFilterHighResLocation
|
|
extends CandidateFilterBase
|
|
{
|
|
constructor(t)
|
|
{
|
|
super("HighResLocation", t);
|
|
}
|
|
|
|
OnFilterStart()
|
|
{
|
|
this.t.Event(`CandidateFilterHighResLocation Start`);
|
|
}
|
|
|
|
OnFilterEnd()
|
|
{
|
|
this.t.Event(`CandidateFilterHighResLocation End`);
|
|
}
|
|
|
|
FilterWindowAlgorithm(msgListList)
|
|
{
|
|
for (let slot = 0; slot < 5; ++slot)
|
|
{
|
|
for (let msg of NonRejectedOnlyFilter(msgListList[slot]))
|
|
{
|
|
if (!msg.IsTelemetryExtended())
|
|
{
|
|
continue;
|
|
}
|
|
|
|
let codec = msg.GetCodec();
|
|
if (codec.GetHdrTypeEnum() != 3)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (slot == 0)
|
|
{
|
|
msg.Reject(this.type, `HighResLocation is not supported in Slot 0.`);
|
|
continue;
|
|
}
|
|
|
|
let referenceEnum = codec.GetReferenceEnum();
|
|
if (referenceEnum != 1)
|
|
{
|
|
msg.Reject(this.type, `HighResLocation Reference (${referenceEnum}) is not an established value.`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|