Struct pn532::helper::autorelease_target
Defined in File helper.hpp
Inheritance Relationships
Base Type
public pn532::helper::scanned_target
(Struct pn532::helper::scanned_target)
Struct Documentation
-
struct autorelease_target : public pn532::helper::scanned_target
RAII helper to automatically call controller::initiator_release when the structure goes out of scope.
Public Functions
-
autorelease_target() = default
Default-constructs an invalid scanned target.
Constructs a scanned target from the
- Parameters:
ctrl_ – Controller to invoke controller::initiator_release on.
target_ – Scanned target.
Constructs a scanned target from the
- Template Parameters:
Type – Any target_type
- Parameters:
ctrl_ – Controller to invoke controller::initiator_release on.
index_ – Logical index of the target. This is only needed for poll_target_with_atr, otherwise the logical index passed inside
entry
will be used over the passed parameter.entry – Poll target entry, generated by controller::initiator_auto_poll
Constructs a scanned target from a
- Parameters:
ctrl_ – Controller to invoke controller::initiator_release on
index_ – Logical index of the target. This is only needed for poll_target_with_atr, otherwise the logical index passed inside
entry
will be used over the passed parameter.entry – Poll target entry, generated by controller::initiator_auto_poll
-
inline result<rf_status> release(ms timeout = default_timeout)
Calls controller::initiator_release on this target. This does nothing if autorelease_target::ctrl or scanned_target::index is invalid. It is possible to call this multiple times, after a successful call to controller::initiator_release the weak reference to controller is released.
- Parameters:
timeout – timeout to use for controller::initiator_release.
- Returns:
The result of controller::initiator_release. If the controller has been destroyed in the meanwhile, it returns channel_error::app_error. If the target is invalid, it returns channel_error::malformed.
-
inline ~autorelease_target()
Calls autorelease_target::release.
Public Members
-
std::weak_ptr<controller> ctrl = {}
Weak referece to the controller. This is automatically cleared when release is called.
-
autorelease_target() = default