frequency-recognition: explicit frequencdies out of the name field will be copied to the qrg field and trigger the used band spot of a station to fit for this qrg. Airscout will then use this band explicitely for the calculation

This commit is contained in:
Marc Froehlich
2026-08-12 00:23:17 +02:00
parent 663f724c98
commit 15f585c938
11 changed files with 845 additions and 40 deletions
@@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.nio.charset.StandardCharsets;
import kst4contest.logic.FrequencyTextParser;
@@ -1490,6 +1490,38 @@ private ObservableList<String>
);
}
/**
* Uses one unambiguous explicit QRG from the current station name as the
* initial compatibility frequency.
*
* <p>Multiple explicit QRGs are valid band evidence, but there is no safe
* assumption which one is the current run frequency. Therefore the legacy
* frequency property is initialized only when exactly one explicit QRG exists.</p>
*/
private void initializeFrequencyFromStationNameIfUnambiguous(
ChatMember member
) {
if (member == null) {
return;
}
List<FrequencyTextParser.DetectedFrequency> detectedFrequencies =
FrequencyTextParser.findExplicitFrequencies(
member.getName()
);
if (detectedFrequencies.size() != 1) {
return;
}
member.initializeFrequencyIfEmpty(
detectedFrequencies
.get(0)
.getFrequencyMHz()
);
}
/**
* Adds or replaces an active chat member in the worker-thread model and mirrors
* that change to the JavaFX list. This is the only supported path for ON4KST
@@ -1501,6 +1533,8 @@ private ObservableList<String>
return;
}
initializeFrequencyFromStationNameIfUnambiguous(member);
activeChatMembersByCallAndCategory.put(key, member);
runOnFxThread(() -> {
@@ -1683,6 +1717,9 @@ private ObservableList<String>
}
activeMember.setName(updatedMember.getName());
initializeFrequencyFromStationNameIfUnambiguous(
activeMember
);
activeMember.setQra(updatedMember.getQra());
activeMember.setState(updatedMember.getState());
activeMember.setLastActivity(updatedMember.getLastActivity());