Leosac
0.8.0
Open Source Access Control
|
Strategy for ready PIN only. More...
#include <WiegandPinNBitsOnly.hpp>
Public Member Functions | |
WiegandPinNBitsOnly (WiegandReaderImpl *reader, std::chrono::milliseconds pin_timeout, char pin_end_key) | |
Create a strategy that read N bits-per-key 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 const std::string & | get_pin () const override |
Retrieve the pin code that was read from the reader. More... | |
virtual void | reset () override |
Reset the strategy, meaning that the next time timeout() is called the behavior should be the same than the first time. More... | |
Public Member Functions inherited from Leosac::Module::Wiegand::Strategy::PinReading | |
PinReading (WiegandReaderImpl *reader) | |
Public Member Functions inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy | |
WiegandStrategy (WiegandReaderImpl *reader) | |
virtual | ~WiegandStrategy ()=default |
virtual void | set_reader (WiegandReaderImpl *new_ptr) |
Update the pointer that points back to the associated reader. More... | |
Private Types | |
using | TimePoint = std::chrono::system_clock::time_point |
Private Member Functions | |
char | extract_from_raw (uint8_t input) const |
Extract the character that was pressed from raw data. More... | |
void | end_of_input () |
Timeout or pin_end_key read. More... | |
Private Attributes | |
std::string | inputs_ |
std::chrono::milliseconds | pin_timeout_ |
char | pin_end_key_ |
TimePoint | last_update_ |
bool | ready_ |
Are we ready to submit the PIN code ? More... | |
Additional Inherited Members | |
Protected Attributes inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy | |
WiegandReaderImpl * | reader_ |
Strategy for ready PIN only.
The number of bits sent by the reader per key pressed is NbBits.
Definition at line 38 of file WiegandPinNBitsOnly.hpp.
|
private |
Definition at line 80 of file WiegandPinNBitsOnly.hpp.
WiegandPinNBitsOnly::WiegandPinNBitsOnly | ( | WiegandReaderImpl * | reader, |
std::chrono::milliseconds | pin_timeout, | ||
char | pin_end_key | ||
) |
Create a strategy that read N bits-per-key PIN code.
reader | the reader object we provide the strategy for. |
pin_timeout | nb of msec before flushing user input to the system |
pin_end_key | key ('1', '*', '5') that will trigger user input flushing. |
Definition at line 28 of file WiegandPinNBitsOnly.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 115 of file WiegandPinNBitsOnly.cpp.
|
private |
Timeout or pin_end_key read.
If we have meaningful data, set ready to true.
Definition at line 106 of file WiegandPinNBitsOnly.cpp.
|
private |
Extract the character that was pressed from raw data.
Definition at line 40 of file WiegandPinNBitsOnly.cpp.
|
overridevirtual |
Retrieve the pin code that was read from the reader.
Implements Leosac::Module::Wiegand::Strategy::PinReading.
Definition at line 134 of file WiegandPinNBitsOnly.cpp.
|
overridevirtual |
Reset the strategy, meaning that the next time timeout() is called the behavior should be the same than the first time.
Basically, implementation should wipe its state (parts of PIN code read, card ID, etc).
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 140 of file WiegandPinNBitsOnly.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 121 of file WiegandPinNBitsOnly.cpp.
|
overridevirtual |
This is called when the module detect a timeout.
(2 ms of inactivity).
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 71 of file WiegandPinNBitsOnly.cpp.
|
private |
Definition at line 76 of file WiegandPinNBitsOnly.hpp.
|
private |
Definition at line 81 of file WiegandPinNBitsOnly.hpp.
|
private |
Definition at line 78 of file WiegandPinNBitsOnly.hpp.
|
private |
Definition at line 77 of file WiegandPinNBitsOnly.hpp.
|
private |
Are we ready to submit the PIN code ?
Definition at line 86 of file WiegandPinNBitsOnly.hpp.