Leosac
0.8.0
Open Source Access Control
|
Implementation of a wiegand card only strategy. More...
#include <SimpleWiegandStrategy.hpp>
Public Member Functions | |
SimpleWiegandStrategy (WiegandReaderImpl *reader) | |
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_card_id () const override |
Returns the card id that was read. More... | |
virtual int | get_nb_bits () const override |
Returns the number of bits in the card. 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::CardReading | |
CardReading (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 Attributes | |
bool | ready_ |
int | nb_bits_ |
std::string | card_id_ |
Additional Inherited Members | |
Protected Attributes inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy | |
WiegandReaderImpl * | reader_ |
Implementation of a wiegand card only strategy.
Definition at line 35 of file SimpleWiegandStrategy.hpp.
SimpleWiegandStrategy::SimpleWiegandStrategy | ( | WiegandReaderImpl * | reader | ) |
Definition at line 29 of file SimpleWiegandStrategy.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 59 of file SimpleWiegandStrategy.cpp.
|
overridevirtual |
Returns the card id that was read.
Implements Leosac::Module::Wiegand::Strategy::CardReading.
Definition at line 75 of file SimpleWiegandStrategy.cpp.
|
overridevirtual |
Returns the number of bits in the card.
Implements Leosac::Module::Wiegand::Strategy::CardReading.
Definition at line 80 of file SimpleWiegandStrategy.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 85 of file SimpleWiegandStrategy.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 64 of file SimpleWiegandStrategy.cpp.
|
overridevirtual |
This is called when the module detect a timeout.
(2 ms of inactivity).
Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.
Definition at line 36 of file SimpleWiegandStrategy.cpp.
|
private |
Definition at line 55 of file SimpleWiegandStrategy.hpp.
|
private |
Definition at line 54 of file SimpleWiegandStrategy.hpp.
|
private |
Definition at line 53 of file SimpleWiegandStrategy.hpp.