Documentation ¶
Overview ¶
Package scanner is used to communicate with an RFID badge scanners.
Index ¶
Constants ¶
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.
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.