[fix](trx-frontend-http): show aprs and ais bookmarks in background decode
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
+6
-1
@@ -111,11 +111,16 @@
|
|||||||
|
|
||||||
function bookmarkDecoderKinds(bookmark) {
|
function bookmarkDecoderKinds(bookmark) {
|
||||||
const decoders = Array.isArray(bookmark && bookmark.decoders) ? bookmark.decoders : [];
|
const decoders = Array.isArray(bookmark && bookmark.decoders) ? bookmark.decoders : [];
|
||||||
return decoders
|
const supported = decoders
|
||||||
.map(function (item) { return String(item || "").trim().toLowerCase(); })
|
.map(function (item) { return String(item || "").trim().toLowerCase(); })
|
||||||
.filter(function (item, index, arr) {
|
.filter(function (item, index, arr) {
|
||||||
return SUPPORTED_DECODERS.includes(item) && arr.indexOf(item) === index;
|
return SUPPORTED_DECODERS.includes(item) && arr.indexOf(item) === index;
|
||||||
});
|
});
|
||||||
|
if (supported.length > 0) return supported;
|
||||||
|
const mode = String(bookmark && bookmark.mode || "").trim().toUpperCase();
|
||||||
|
if (mode === "AIS") return ["ais"];
|
||||||
|
if (mode === "PKT") return ["aprs"];
|
||||||
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderBookmarkPick() {
|
function renderBookmarkPick() {
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ impl BackgroundDecodeManager {
|
|||||||
freq_hz: bookmark.map(|item| item.freq_hz),
|
freq_hz: bookmark.map(|item| item.freq_hz),
|
||||||
mode: bookmark.map(|item| item.mode.clone()),
|
mode: bookmark.map(|item| item.mode.clone()),
|
||||||
decoder_kinds: bookmark
|
decoder_kinds: bookmark
|
||||||
.map(|item| supported_decoder_kinds(&item.decoders))
|
.map(bookmark_supported_decoder_kinds)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
state: "inactive".to_string(),
|
state: "inactive".to_string(),
|
||||||
channel_kind: None,
|
channel_kind: None,
|
||||||
@@ -345,7 +345,7 @@ impl BackgroundDecodeManager {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let decoder_kinds = supported_decoder_kinds(&bookmark.decoders);
|
let decoder_kinds = bookmark_supported_decoder_kinds(bookmark);
|
||||||
let mut status = BackgroundDecodeBookmarkStatus {
|
let mut status = BackgroundDecodeBookmarkStatus {
|
||||||
bookmark_id: bookmark.id.clone(),
|
bookmark_id: bookmark.id.clone(),
|
||||||
bookmark_name: Some(bookmark.name.clone()),
|
bookmark_name: Some(bookmark.name.clone()),
|
||||||
@@ -525,6 +525,19 @@ fn supported_decoder_kinds(decoders: &[String]) -> Vec<String> {
|
|||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn bookmark_supported_decoder_kinds(bookmark: &Bookmark) -> Vec<String> {
|
||||||
|
let explicit = supported_decoder_kinds(&bookmark.decoders);
|
||||||
|
if !explicit.is_empty() {
|
||||||
|
return explicit;
|
||||||
|
}
|
||||||
|
|
||||||
|
match bookmark.mode.trim().to_ascii_uppercase().as_str() {
|
||||||
|
"AIS" => vec!["ais".to_string()],
|
||||||
|
"PKT" => vec!["aprs".to_string()],
|
||||||
|
_ => Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn channel_matches_bookmark(channel: &ClientChannel, bookmark: &Bookmark) -> bool {
|
fn channel_matches_bookmark(channel: &ClientChannel, bookmark: &Bookmark) -> bool {
|
||||||
channel.freq_hz == bookmark.freq_hz && normalized_mode(&channel.mode) == normalized_mode(&bookmark.mode)
|
channel.freq_hz == bookmark.freq_hz && normalized_mode(&channel.mode) == normalized_mode(&bookmark.mode)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user