scanmode

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package scanmode resolves the scan mode that applies to a token: its own #tap or #hold trait, then the configured mode of the reader it came from, then the global readers.scan.mode.

It sits below both the service loop that acts on the answer and the API method that reports it, so a client is never told a policy other than the one removal will apply.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForToken

func ForToken(cfg *config.Instance, st *state.State, t *tokens.Token) string

ForToken returns the scan mode in force for t, always "tap" or "hold".

func ForTokenAfterRemoval

func ForTokenAfterRemoval(cfg *config.Instance, st *state.State, t *tokens.Token) string

ForTokenAfterRemoval resolves like ForToken, except that a reader which has since disconnected keeps the decision made while it was still present.

The exit timer is only armed when hold is enabled, and re-resolving when it fires is what catches the mode being turned off during the delay. A reader that disappeared in the meantime is lost information rather than a policy change: falling back to the global mode there would silently drop its per-reader override, so a hold reader on a tap device would arm the timer and then never exit the media it launched.

The API reports this same answer, so `readers` never claims tap for an owner whose removal will exit.

func HoldForToken

func HoldForToken(cfg *config.Instance, st *state.State, t *tokens.Token) bool

HoldForToken reports whether removing t should exit media.

func HoldForTokenAfterRemoval

func HoldForTokenAfterRemoval(cfg *config.Instance, st *state.State, t *tokens.Token) bool

HoldForTokenAfterRemoval reports whether an armed exit timer should still exit media when it fires.

Types

This section is empty.

Jump to

Keyboard shortcuts

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