Struct pn532::scanner_responder

Inheritance Relationships

Derived Type

Struct Documentation

struct scanner_responder

Abstract class that reacts and controls a scanner routine.

Subclassed by desfire::tag_responder

Public Functions

inline virtual void on_activation(scanner &scanner, scanned_target const &target)

Called before interaction with target begins. The target has been activated and was not rejected.

Note

Rejected targets will not trigger this call.

Parameters:
  • scanner – Scanner object

  • target – Scanned target

inline virtual void on_release(scanner &scanner, scanned_target const &target)

Called immediately before the release of target. The target has been interacted with, and now it about to be released.

Note

Targets that have been not interacted with (e.g. because rejected) will not trigger this call.

Parameters:
  • scanner – Scanner object

  • target – Scanned target

inline virtual void on_leaving_rf(scanner &scanner, scanned_target const &target)

Called when target has provably left the RF field. This happens e.g. because it was not present in another scan, or the scan timed out.

Note

Stopping with scanner::stop the loop might cause this call to be skipped.

Parameters:
  • scanner – Scanner object

  • target – Scanned target

inline virtual void on_failed_scan(scanner &scanner, channel_error err)

Called when controller::initiator_auto_poll fails, e.g. due to timeout. This is a normal condition as a scan with no tags will time out.

Parameters:
  • scanner – Scanner object

  • err – Error returned by the polling routine

inline virtual std::vector<target_type> get_scan_target_types(scanner &scanner) const

Selects which targets the scanner should check. The default implementation returns controller::poll_all_targets.

Warning

The implementor should return least one target type, otherwise the loop will exit.

Parameters:

scanner – Scanner object.

Returns:

A non-empty list of scanning targets.

inline virtual bool should_interact(scanner &scanner, scanned_target const &target) const

Filter deciding whether a given target should be interacted with or not. All rejected targets are automatically marked as “should not interact” until when they leave the RF field. This is used e.g. to mark blocklisted tokens. The default implementation returns true. Returning false prevents any of the calls to on_activation, interact and on_release from occurring.

Parameters:
  • scanner – Scanner object

  • target – Tentative target to test before the interaction start

Returns:

True for allowing interaction, false otherwise.

inline virtual post_interaction interact(scanner &scanner, scanned_target const &target)

Core routine that interacts with the target. The default implementation, rejects further interaction with this target until it leaves the RF field.

Parameters:
  • scanner – Scanner object

  • target – Scanned target

Returns:

One post_interaction return codes.

virtual ~scanner_responder() = default