Documentation
¶
Index ¶
- type FrameValidationResult
- type Transport
- func (t *Transport) ClearTransportState() error
- func (t *Transport) Close() error
- func (*Transport) HasCapability(capability pn532.TransportCapability) bool
- func (t *Transport) IsConnected() bool
- func (t *Transport) Reconnect() error
- func (t *Transport) SendCommand(ctx context.Context, cmd byte, args []byte) ([]byte, error)
- func (t *Transport) SetTimeout(timeout time.Duration) error
- func (*Transport) Type() pn532.TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameValidationResult ¶
type FrameValidationResult struct {
Err error // 8 bytes (interface)
NewOff int // 8 bytes (on 64-bit)
FrameLen int // 8 bytes (on 64-bit)
Retry bool // 1 byte
}
FrameValidationResult represents the result of frame length validation
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements the pn532.Transport interface for UART communication.
func (*Transport) ClearTransportState ¶ added in v0.8.1
ClearTransportState resets transport state after protocol failures This is critical for preventing firmware lockup when switching between InCommunicateThru and InDataExchange operations after frame corruption
func (*Transport) Close ¶
Close closes the transport connection This method uses a separate mutex (closeMu) to close the port without waiting for the main mutex (mu). This allows closing the port while SendCommand is blocking on a read. Closing the port causes any blocking reads to fail immediately with an I/O error, allowing SendCommand to return promptly.
func (*Transport) HasCapability ¶
func (*Transport) HasCapability(capability pn532.TransportCapability) bool
HasCapability implements the TransportCapabilityChecker interface UART transport supports native InAutoPoll for reduced CPU usage
func (*Transport) IsConnected ¶
IsConnected returns true if the transport is connected
func (*Transport) Reconnect ¶ added in v0.17.0
Reconnect closes and reopens the serial port connection. This is used for "nuclear" recovery when the PN532 firmware enters a complete lockup state where it stops ACKing any commands.
func (*Transport) SendCommand ¶
SendCommand sends a command to the PN532 with context support. Context is checked at key points during the operation to allow cancellation.
func (*Transport) SetTimeout ¶
SetTimeout sets the read timeout for the transport
func (*Transport) Type ¶
func (*Transport) Type() pn532.TransportType
Type returns the transport type