Leosac
0.8.0
Open Source Access Control
|
Strategy for reading a card then a PIN code. More...
#include <WiegandCardAndPin.hpp>
Public Member Functions | |
WiegandCardAndPin (WiegandReaderImpl *reader, CardReadingUPtr read_card, PinReadingUPtr read_pin, std::chrono::milliseconds delay) | |
Create a strategy that read card and PIN code. More... | |
virtual void | timeout () override |
This is called when the module detect a timeout. More... | |
virtual bool | completed () const override |
Did the strategy gather needed data? If this function returns true, that means that the strategy implementation successfully retrieve data from wiegand bits. More... | |
virtual void | signal (zmqpp::socket &sock) override |
Tells the strategy implementation to send a message to the application containing the received credentials. More... | |
virtual void | set_reader (WiegandReaderImpl *new_ptr) override |
Update the pointer that points back to the associated reader. More... | |
Public Member Functions inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy | |
WiegandStrategy (WiegandReaderImpl *reader) | |
virtual | ~WiegandStrategy ()=default |
Private Types | |
using | TimePoint = std::chrono::system_clock::time_point |
Private Member Functions | |
void | reset () override |
Reset self. More... | |
Private Attributes | |
CardReadingUPtr | read_card_strategy_ |
PinReadingUPtr | read_pin_strategy_ |
std::chrono::milliseconds | delay_ |
TimePoint | time_card_read_ |
bool | reading_card_ |
bool | ready_ |
Additional Inherited Members | |
Protected Attributes inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy | |
WiegandReaderImpl * | reader_ |
Strategy for reading a card then a PIN code.
We reuse existing strategy.
Definition at line 38 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 73 of file WiegandCardAndPin.hpp.
WiegandCardAndPin::WiegandCardAndPin | ( | WiegandReaderImpl * | reader, |
CardReadingUPtr | read_card, | ||
PinReadingUPtr | read_pin, | ||
std::chrono::milliseconds | delay | ||
) |
Create a strategy that read card and PIN code.
reader | the reader object we provide the strategy for. |
read_card | strategy object that will read a card number. |
read_pin | strategy object that will read a PIN code. |
delay | max nb of msec between reading the card and receiving pin code data. |
Definition at line 27 of file WiegandCardAndPin.cpp.
|
overridevirtual |
Did the strategy gather needed data? If this function returns true, that means that the strategy implementation successfully retrieve data from wiegand bits.
It successfully build a card_id, or a PIN code, etc. The reader implementation will call signal()
if completed()
returns true.
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 77 of file WiegandCardAndPin.cpp.
|
overrideprivatevirtual |
Reset self.
We create new strategy instance, reset the boolean flag to defaults and reset the underlying reader buffer.
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 102 of file WiegandCardAndPin.cpp.
|
overridevirtual |
Update the pointer that points back to the associated reader.
Reimplemented from Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 95 of file WiegandCardAndPin.cpp.
|
overridevirtual |
Tells the strategy implementation to send a message to the application containing the received credentials.
It is up to the strategy to format a correct message. This is required because only the strategy knows what kind of credential it can generate.
sock | the socket where we write the message containing credentials. |
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 82 of file WiegandCardAndPin.cpp.
|
overridevirtual |
This is called when the module detect a timeout.
(2 ms of inactivity).
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 41 of file WiegandCardAndPin.cpp.
|
private |
Definition at line 72 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 69 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 70 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 76 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 77 of file WiegandCardAndPin.hpp.
|
private |
Definition at line 74 of file WiegandCardAndPin.hpp.