pn532uart

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAckTimeout   = errors.New("timeout waiting for ACK")
	ErrNoFrameFound = errors.New("no frame found")
)

Functions

func InDataExchange

func InDataExchange(port serial.Port, data []byte) ([]byte, error)

func SamConfiguration

func SamConfiguration(port serial.Port) error

Types

type ConnectFunc added in v2.7.0

type ConnectFunc func(name string) (SerialPort, error)

ConnectFunc creates and initializes a PN532 UART connection.

type DefaultPN532Commander added in v2.7.0

type DefaultPN532Commander struct{}

DefaultPN532Commander uses the real PN532 command functions.

func (DefaultPN532Commander) InDataExchange added in v2.7.0

func (DefaultPN532Commander) InDataExchange(port SerialPort, data []byte) ([]byte, error)

func (DefaultPN532Commander) InListPassiveTarget added in v2.7.0

func (DefaultPN532Commander) InListPassiveTarget(port SerialPort) (*Target, error)

type FirmwareVersion

type FirmwareVersion struct {
	Version          string
	SupportIso14443a bool
	SupportIso14443b bool
	SupportIso18092  bool
}

func GetFirmwareVersion

func GetFirmwareVersion(port serial.Port) (FirmwareVersion, error)

type GeneralStatus

type GeneralStatus struct {
	LastError    byte
	FieldPresent bool
}

func GetGeneralStatus

func GetGeneralStatus(port serial.Port) (GeneralStatus, error)

type PN532Commander added in v2.7.0

type PN532Commander interface {
	InListPassiveTarget(port SerialPort) (*Target, error)
	InDataExchange(port SerialPort, data []byte) ([]byte, error)
}

PN532Commander handles PN532 protocol commands.

type PN532UARTReader

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

func NewReader

func NewReader(cfg *config.Instance) *PN532UARTReader

func (*PN532UARTReader) CancelWrite

func (*PN532UARTReader) CancelWrite()

func (*PN532UARTReader) Capabilities

func (*PN532UARTReader) Capabilities() []readers.Capability

func (*PN532UARTReader) Close

func (r *PN532UARTReader) Close() error

func (*PN532UARTReader) Connected

func (r *PN532UARTReader) Connected() bool

func (*PN532UARTReader) Detect

func (*PN532UARTReader) Detect(connected []string) string

func (*PN532UARTReader) IDs

func (*PN532UARTReader) IDs() []string

func (*PN532UARTReader) Info

func (r *PN532UARTReader) Info() string

func (*PN532UARTReader) Metadata

func (*PN532UARTReader) OnMediaChange

func (*PN532UARTReader) OnMediaChange(*models.ActiveMedia) error

func (*PN532UARTReader) Open

func (r *PN532UARTReader) Open(device config.ReadersConnect, iq chan<- readers.Scan) error

func (*PN532UARTReader) Path added in v2.9.0

func (r *PN532UARTReader) Path() string

func (*PN532UARTReader) ReaderID added in v2.9.0

func (r *PN532UARTReader) ReaderID() string

func (*PN532UARTReader) Write

func (*PN532UARTReader) Write(_ string) (*tokens.Token, error)

type SerialPort added in v2.7.0

type SerialPort interface {
	Close() error
}

SerialPort defines the interface for serial port operations (for mocking in tests).

func DefaultConnectFunc added in v2.7.0

func DefaultConnectFunc(name string) (SerialPort, error)

DefaultConnectFunc wraps the package-level connect function.

type Target

type Target struct {
	Type     string
	UID      string
	UIDBytes []byte
}

func InListPassiveTarget

func InListPassiveTarget(port serial.Port) (*Target, error)

Jump to

Keyboard shortcuts

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