readers

package
v2.6.0-beta8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: GPL-3.0 Imports: 3 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability string
const (
	CapabilityWrite   Capability = "write"
	CapabilityDisplay Capability = "display"
)

type DriverMetadata

type DriverMetadata struct {
	ID                string
	Description       string
	DefaultEnabled    bool
	DefaultAutoDetect bool
}

type Reader

type Reader interface {
	// Metadata returns static configuration for this driver.
	Metadata() DriverMetadata
	// IDs returns the device string prefixes supported by this reader.
	IDs() []string
	// Open any necessary connections to the device and start polling.
	// Takes a device connection string and a channel to send scanned tokens.
	Open(config.ReadersConnect, chan<- Scan) error
	// Close any open connections to the device and stop polling.
	Close() error
	// Detect attempts to search for a connected device and returns the device
	// connection string. If no device is found, an empty string is returned.
	// Takes a list of currently connected device strings.
	Detect([]string) string
	// Device returns the device connection string.
	Device() string
	// Connected returns true if the device is connected and active.
	Connected() bool
	// Info returns a string with information about the connected device.
	Info() string
	// Write sends a string to the device to be written to a token, if
	// that device supports writing. Blocks until completion or timeout.
	Write(string) (*tokens.Token, error)
	// CancelWrite sends a request to cancel an active write request.
	CancelWrite()
	// Capabilities returns the list of capabilities supported by this reader.
	Capabilities() []Capability
	// OnMediaChange is called when the active media changes.
	OnMediaChange(*models.ActiveMedia) error
}

type Scan

type Scan struct {
	Error  error
	Token  *tokens.Token
	Source string
}

Directories

Path Synopsis
shared

Jump to

Keyboard shortcuts

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