Struct pn532::helper::autorelease_target

Inheritance Relationships

Base Type

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.

inline autorelease_target(std::shared_ptr<controller> const &ctrl_, scanned_target target_)

Constructs a scanned target from the

Parameters:
template<target_type Type>
autorelease_target(std::shared_ptr<controller> const &ctrl_, std::uint8_t index_, poll_target<Type> const &entry)

Constructs a scanned target from the

Template Parameters:

Type – Any target_type

Parameters:
inline autorelease_target(std::shared_ptr<controller> const &ctrl_, std::uint8_t index_, any_poll_target const &entry)

Constructs a scanned target from a

Parameters:
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.