mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
SdrCard calls LocalSdrControls through radio store actions instead of DOM listeners, and renders its gain options from the receiver's own R820T gain steps with page-language labels. The display and radio stores share one owner list (createOwners): the newest connected owner with an action answers it.
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
import { createOwners } from './owners.js';
|
|
|
|
/**
|
|
* The Radio panel as its view renders it. RadioControls presents the
|
|
* directory row, station card, transport, volume and playback line and the
|
|
* Cockpit's compact radio controls (`renderRadioState()`), which Cockpit
|
|
* utility popover is open, and the directory tuner, and publishes them here;
|
|
* it keeps its listeners. LocalSdrControls publishes the local RTL-SDR card
|
|
* beside it, and the card's controls reach it through act().
|
|
*/
|
|
export const useRadioStore = defineStore('gev-radio', () => {
|
|
/** The presented panel; null until the controls first render. */
|
|
const view = shallowRef(null);
|
|
|
|
/** @param {object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
view.value = markRaw(next);
|
|
}
|
|
|
|
/** The local RTL-SDR card; null until its controls first render. */
|
|
const sdr = shallowRef(null);
|
|
|
|
/** @param {object} next A fresh presentation of the RTL-SDR card. */
|
|
function publishSdr(next) {
|
|
sdr.value = markRaw(next);
|
|
}
|
|
|
|
/** The open Cockpit utility popover; null until one first opens or closes. */
|
|
const utility = shallowRef(null);
|
|
|
|
/** @param {{display: boolean, radio: boolean}} next */
|
|
function publishUtility(next) {
|
|
utility.value = markRaw(next);
|
|
}
|
|
|
|
/** The directory tuner; null until the controls first present it. */
|
|
const tuner = shallowRef(null);
|
|
|
|
/** @param {object} next A fresh presentation of the tuner. */
|
|
function publishTuner(next) {
|
|
tuner.value = markRaw(next);
|
|
}
|
|
|
|
// LocalSdrControls answers the RTL-SDR card's controls.
|
|
const { connect, detach, act } = createOwners();
|
|
|
|
return {
|
|
view,
|
|
publish,
|
|
sdr,
|
|
publishSdr,
|
|
utility,
|
|
publishUtility,
|
|
tuner,
|
|
publishTuner,
|
|
connect,
|
|
detach,
|
|
act,
|
|
};
|
|
});
|