scanner

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package scanner is used to communicate with an RFID badge scanners.

Index

Constants

View Source
const (
	// ErrUnsupportedTagType is returned when a tag with an unsupported tag type was read from the scanner.
	ErrUnsupportedTagType = "read a device, but could not cast it to the proper tag type"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HidScanner

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

HidScanner implements the scanner interface for HID based scanning devices.

func NewDefaultHidScanner

func NewDefaultHidScanner(ids chan string, errs chan error) (*HidScanner, error)

NewDefaultHidScanner provides an instantiated hid scanner device.

func (*HidScanner) Done

func (hid *HidScanner) Done() error

Done closes down the scanner.

func (*HidScanner) Scan

func (hid *HidScanner) Scan()

Scan starts the scanner

type LibNFCDevice

type LibNFCDevice interface {
	InitiatorInit() error
	Close() error
	InitiatorListPassiveTargets(mod nfc.Modulation) ([]nfc.Target, error)
}

LibNFCDevice is an interface used to generate a mock for nfc.Device.

type LibNFCScanner

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

LibNFCScanner implements the scanner interface for a libnfc compatible device.

func NewDefaultLibNFCScanner

func NewDefaultLibNFCScanner(ids chan string, errs chan error) (*LibNFCScanner, error)

NewDefaultLibNFCScanner provides an initialized libnfc scanner. The provided channels can be read off of in order to get a stream of id strings or errors from the device. The id and error channel should be buffered, otherwise the scanner will block until ids/errors are read off of the respective channel. Be sure to call Close when you are done with the scanner to clean up.

func NewLibNFCScanner

func NewLibNFCScanner(device LibNFCDevice, ids chan string, errs chan error) (*LibNFCScanner, error)

NewLibNFCScanner provides an initialized libnfc scanner with the provided LibNFCDevice. The provided channels can be read off of in order to get a stream of id strings or errors from the device. The id and error channel should be buffered, otherwise the scanner will block until ids/errors are read off of the respective channel. Be sure to call Close when you are done with the scanner to clean up.

func (*LibNFCScanner) Done

func (s *LibNFCScanner) Done() error

Done will stop all goroutines and close the LibNFCDevice.

func (*LibNFCScanner) Scan

func (s *LibNFCScanner) Scan()

Scan starts the scanner if it has not already been started.

type Scanner

type Scanner interface {
	Scan()
	Done() error
}

Scanner is an interface used to start and stop an RFID badge scanner.

Jump to

Keyboard shortcuts

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