input

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package input maps BUSY Bar physical controls to core-owned interaction state.

Index

Constants

View Source
const InputQueueCapacity = 64

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivationResult added in v0.2.0

type ActivationResult struct {
	Activated   bool
	InputTarget SessionTarget
}

ActivationResult binds optional activation input to the session actually promoted. An empty InputTarget preserves activation without forwarding the press.

type App

type App struct {
	ID          string
	DisplayName string
	Action      string
}

type BackAttempt

type BackAttempt struct {
	Consumed func(context.Context) error
	Fallback func(context.Context, string) error
}

BackAttempt binds the eventual callback result to the presentation context that existed when the physical Back press was accepted.

type BackHandling

type BackHandling struct {
	Publish SessionInputResultPublisher
	Begin   func() BackAttempt
}

BackHandling is a required dependency because Back has synchronous first-refusal semantics that ordinary input does not share.

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator is the single ordered decision point for physical input. Switch transitions are handled first; START then activates the exact rendered card before input falls back to the APPS menu or one foreground session token.

func NewCoordinator

func NewCoordinator(
	launcher *Router,
	activate ObservationActivator,
	sessions SessionController,
	publish SessionInputPublisher,
	back BackHandling,
	invalidate func(),
	reconcile func(context.Context) error,
	now func() time.Time,
) *Coordinator

func (*Coordinator) Handle

func (c *Coordinator) Handle(ctx context.Context, event *inputpb.InputEvent) error

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher isolates the device stream from all input-triggered core work. Submit is non-blocking; one Run call owns ordered handler execution.

func NewDispatcherWithClearCapture

func NewDispatcherWithClearCapture(handle func(context.Context, *inputpb.InputEvent) error, captureClear func() func(context.Context)) *Dispatcher

NewDispatcherWithClearCapture snapshots the exact foreground cleanup target at overflow time so delayed recovery cannot clear a later session.

func (*Dispatcher) InvalidateContext

func (d *Dispatcher) InvalidateContext()

InvalidateContext atomically retires every queued event accepted before the foreground transition. Inputs submitted after it returns use a fresh epoch.

func (*Dispatcher) Run

func (d *Dispatcher) Run(ctx context.Context) error

func (*Dispatcher) Status

func (d *Dispatcher) Status() DispatcherStatus

func (*Dispatcher) Submit

func (d *Dispatcher) Submit(event *inputpb.InputEvent) bool

type DispatcherStatus

type DispatcherStatus struct {
	QueueDepth    int    `json:"queue_depth"`
	Accepted      uint64 `json:"accepted"`
	Handled       uint64 `json:"handled"`
	Discarded     uint64 `json:"discarded"`
	Overruns      uint64 `json:"overruns"`
	LastErrorCode string `json:"last_error_code,omitempty"`
}

type Launcher

type Launcher interface {
	Apps() []App
	Launch(context.Context, string, string) error
}

type ObservationActivator

type ObservationActivator interface {
	ActivateSelected(context.Context, protocol.SessionInput) (ActivationResult, error)
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(launcher Launcher, publish func(protocol.Observation) error, withdraw func(), now func() time.Time) *Router

func (*Router) Active

func (r *Router) Active() bool

func (*Router) Close

func (r *Router) Close()

Close withdraws the launcher without changing any plugin session.

func (*Router) Handle

func (r *Router) Handle(ctx context.Context, event *inputpb.InputEvent) error

Handle mutates only core menu state under mu. Launcher and observation callbacks always run after unlocking so a slow plugin cannot stop input drain.

type SessionController

type SessionController interface {
	ForegroundSession() (instanceID, token string)
	ClearForegroundSessionContext(context.Context, string, string)
	BeginLauncherAdmission() (uint64, bool)
	LauncherAdmissionCurrent(uint64) bool
}

type SessionInputPublisher

type SessionInputPublisher func(instanceID, token string, payload protocol.SessionInput, occurredAt time.Time) error

type SessionTarget

type SessionTarget struct {
	InstanceID string
	Token      string
}

Jump to

Keyboard shortcuts

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