state

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package state holds the SharedState struct and PanelKind enum so the root tui package and panels sub-package can both import it without an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioReq

type AudioReq struct {
	Volume    *float32
	Muted     *bool
	Recording *bool
}

AudioReq sets one or more knobs on the audio cockpit. Nil fields are left unchanged.

type EndCallReq

type EndCallReq struct {
	DeviceSerial string
	Reason       string // optional; "" means "manual"
}

EndCallReq forces the engine to release the active call held on the given device.

type HuntCaptureReq added in v0.5.9

type HuntCaptureReq struct {
	FreqHz uint32
	Target string // "siglab" | "cryptolab"
}

HuntCaptureReq is the payload for WriteKindHuntCapture — record one signal from the survey inventory and route it to SigLab/CryptoLab.

type HuntStartReq added in v0.3.5

type HuntStartReq struct {
	Bands      []string  // "low:high" MHz
	Candidates []float64 // MHz
	Survey     bool      // classify+decode every carrier, not just trunking CCs
	Name       string
	Serial     string
	Protocol   string
}

HuntStartReq is the payload for WriteKindHuntStart — a live system-discovery run started from the TUI. Frequencies are in MHz (matching the operator's input); the client converts to the wire shape.

type PanelKind

type PanelKind int

PanelKind enumerates the visible panels. The root model owns the active selection; panels themselves don't know their index.

const (
	PanelDashboard PanelKind = iota
	PanelSystems
	PanelTalkgroups
	PanelActive
	PanelHistory
	PanelEvents
	PanelTones
	PanelMetrics
	PanelDevices
	PanelScanner
	PanelHunt
	PanelSettings
	PanelImport
	PanelCount
)

func (PanelKind) Key added in v0.2.8

func (p PanelKind) Key() string

Key returns the stable config key for this panel — the same key the web SPA uses (route path minus its leading slash) so a single web.tabs entry hides the tab in both UIs. Keep in sync with config.KnownUITabs and web/src/App.tsx.

func (PanelKind) String

func (p PanelKind) String() string

type ResetToneReq

type ResetToneReq struct {
	DeviceSerial string
}

ResetToneReq clears tone-out match progress on the given device.

type RingReader

type RingReader[T any] interface {
	Len() int
	Snapshot() []T
	Latest(n int) []T
}

RingReader is the read-side interface RingBuf satisfies. Panels only need read access to the event/tone buffers.

type ScannerConvReq

type ScannerConvReq struct{ Index int }

ScannerConvReq is shared by hold / resume / dwell-on-index for the conventional scanner. Index is ignored for hold/resume.

type ScannerHuntReq

type ScannerHuntReq struct{ System string }

ScannerHuntReq targets a single trunked system for hold / resume / force-retune. The WriteKind discriminates the operation.

type ScannerManualTuneReq

type ScannerManualTuneReq struct {
	FrequencyHz uint32
	Label       string
	Mode        string
}

ScannerManualTuneReq adds a temp VFO channel and forces dwell.

type ScannerModeReq

type ScannerModeReq struct{ Mode string }

ScannerModeReq sets the engine's global scan_mode at runtime.

type SettingsReq added in v0.1.5

type SettingsReq struct {
	Field string
	Value string
}

SettingsReq carries a single settings-panel edit. Field is the dotted YAML path (e.g. "audio.volume", "log.level") and Value is the operator's typed input; the dispatcher converts to the right SettingsPatch shape per field.

type SharedState

type SharedState struct {
	Health      client.Health
	HealthErr   error
	Version     string
	Systems     []client.SystemDTO
	Talkgroups  []client.TalkgroupDTO
	ActiveCalls []client.ActiveCallDTO
	History     []client.CallRow
	HistoryErr  error
	Metrics     map[string]float64
	Devices     []client.SDRStatus
	DevicesErr  error
	Scanner     client.ScannerStatusDTO
	ScannerErr  error
	Hunt        client.HuntStatusDTO
	HuntErr     error
	Audio       client.AudioStatusDTO
	AudioErr    error
	Runtime     client.RuntimeDTO
	RuntimeErr  error

	EventLog   RingReader[client.Event]
	ToneAlerts RingReader[client.Event]

	LastPoll time.Time
	Toast    string
	Server   string

	// Write capability — populated at startup from the daemon's
	// /api/v1/mutations endpoint AND-ed with the TUI's --write
	// flag. Panels read this to decide whether write keybindings
	// should fire actions or show a "mutations disabled" toast.
	WriteEnabled bool
	// Mutations exposes per-subsystem capability so panels can
	// show finer-grained tooltips (e.g. "tone-out detector not
	// wired" vs "mutations disabled at daemon").
	Mutations client.MutationStatus
}

SharedState is the snapshot of daemon-derived data that all panels read from. The root model owns it and passes a pointer into each panel's Update.

type SweepRetentionReq

type SweepRetentionReq struct{}

SweepRetentionReq runs one immediate retention sweep.

type UpdateTalkgroupReq

type UpdateTalkgroupReq struct {
	ID       uint32
	Priority *int
	Lockout  *bool
	Scan     *bool
}

UpdateTalkgroupReq mutates priority and/or lockout and/or scan on a talkgroup. Pointer fields allow "leave unchanged" semantics.

type WriteKind

type WriteKind int

WriteKind discriminates a WriteRequest's payload.

const (
	WriteKindUnknown WriteKind = iota
	WriteKindEndCall
	WriteKindUpdateTalkgroup
	WriteKindSweepRetention
	WriteKindResetTone
	WriteKindScannerMode
	WriteKindScannerHuntHold
	WriteKindScannerHuntResume
	WriteKindScannerHuntRetune
	WriteKindScannerConvHold
	WriteKindScannerConvResume
	WriteKindScannerConvDwell
	WriteKindScannerConvLockout
	WriteKindScannerConvUnlockout
	WriteKindAudio
	WriteKindScannerManualTune
	WriteKindSettings
	WriteKindHuntStop
	WriteKindHuntStart
	WriteKindHuntCapture
)

type WriteRequest

type WriteRequest struct {
	Confirm string
	Label   string
	Kind    WriteKind

	EndCall           *EndCallReq
	UpdateTalkgroup   *UpdateTalkgroupReq
	SweepRetention    *SweepRetentionReq
	ResetTone         *ResetToneReq
	ScannerMode       *ScannerModeReq
	ScannerHunt       *ScannerHuntReq
	ScannerConv       *ScannerConvReq
	ScannerManualTune *ScannerManualTuneReq
	Audio             *AudioReq
	Settings          *SettingsReq
	Hunt              *HuntStartReq
	HuntCapture       *HuntCaptureReq
}

WriteRequest is a plain-value command emitted by panels when the operator presses a mutation keybinding. The root model unwraps the embedded request type, optionally pops a confirmation modal, and dispatches the matching client method.

Panels can't build the write Cmds themselves (they don't hold a client.Client), so the request shape is a typed value the root resolves. Each request kind has its own struct so the root's type switch is exhaustive.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL