Leosac
0.8.0
Open Source Access Control
|
The multiple modes available to wiegand reader are implemented through the strategy pattern. More...
#include <WiegandStrategy.hpp>
Public Member Functions | |
WiegandStrategy (WiegandReaderImpl *reader) | |
virtual | ~WiegandStrategy ()=default |
virtual void | timeout ()=0 |
This is called when the module detect a timeout. More... | |
virtual bool | completed () const =0 |
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)=0 |
Tells the strategy implementation to send a message to the application containing the received credentials. More... | |
virtual void | reset ()=0 |
Reset the strategy, meaning that the next time timeout() is called the behavior should be the same than the first time. More... | |
virtual void | set_reader (WiegandReaderImpl *new_ptr) |
Update the pointer that points back to the associated reader. More... | |
Protected Attributes | |
WiegandReaderImpl * | reader_ |
Friends | |
class | WiegandReaderImpl |
The multiple modes available to wiegand reader are implemented through the strategy pattern.
This class defines the interface.
Definition at line 50 of file WiegandStrategy.hpp.
|
inline |
Definition at line 53 of file WiegandStrategy.hpp.
|
virtualdefault |
|
pure virtual |
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.
Implemented in Leosac::Module::Wiegand::Strategy::Autodetect, Leosac::Module::Wiegand::Strategy::WiegandCardAndPin, Leosac::Module::Wiegand::Strategy::WiegandPinNBitsOnly< NbBits >, Leosac::Module::Wiegand::Strategy::WiegandPinBuffered, and Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy.
|
pure virtual |
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).
Implemented in Leosac::Module::Wiegand::Strategy::Autodetect, Leosac::Module::Wiegand::Strategy::WiegandCardAndPin, Leosac::Module::Wiegand::Strategy::WiegandPinNBitsOnly< NbBits >, Leosac::Module::Wiegand::Strategy::WiegandPinBuffered, and Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy.
|
inlinevirtual |
Update the pointer that points back to the associated reader.
Reimplemented in Leosac::Module::Wiegand::Strategy::Autodetect, and Leosac::Module::Wiegand::Strategy::WiegandCardAndPin.
Definition at line 99 of file WiegandStrategy.hpp.
|
pure virtual |
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. |
Implemented in Leosac::Module::Wiegand::Strategy::Autodetect, Leosac::Module::Wiegand::Strategy::WiegandCardAndPin, Leosac::Module::Wiegand::Strategy::WiegandPinNBitsOnly< NbBits >, Leosac::Module::Wiegand::Strategy::WiegandPinBuffered, and Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy.
|
pure virtual |
This is called when the module detect a timeout.
(2 ms of inactivity).
Implemented in Leosac::Module::Wiegand::Strategy::Autodetect, Leosac::Module::Wiegand::Strategy::WiegandCardAndPin, Leosac::Module::Wiegand::Strategy::WiegandPinNBitsOnly< NbBits >, Leosac::Module::Wiegand::Strategy::WiegandPinBuffered, and Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy.
|
friend |
Definition at line 107 of file WiegandStrategy.hpp.
|
protected |
Definition at line 110 of file WiegandStrategy.hpp.