Leosac  0.8.0
Open Source Access Control
Leosac::Module::Wiegand::Strategy::WiegandPinBuffered Class Reference

Strategy for PIN only, when up to 5 keys are buffered and sent as 26 bits. More...

#include <WiegandPinBuffered.hpp>

+ Inheritance diagram for Leosac::Module::Wiegand::Strategy::WiegandPinBuffered:
+ Collaboration diagram for Leosac::Module::Wiegand::Strategy::WiegandPinBuffered:

Public Member Functions

 WiegandPinBuffered (WiegandReaderImpl *reader)
 Create a strategy that read 4bits-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 Attributes

bool ready_
 
std::string pin_
 

Additional Inherited Members

- Protected Attributes inherited from Leosac::Module::Wiegand::Strategy::WiegandStrategy
WiegandReaderImplreader_
 

Detailed Description

Strategy for PIN only, when up to 5 keys are buffered and sent as 26 bits.

See HID documentation about keypad buffered mode.

Definition at line 36 of file WiegandPinBuffered.hpp.

Constructor & Destructor Documentation

◆ WiegandPinBuffered()

WiegandPinBuffered::WiegandPinBuffered ( WiegandReaderImpl reader)

Create a strategy that read 4bits-per-key PIN code.

Parameters
readerthe reader object we provide the strategy for.

Definition at line 27 of file WiegandPinBuffered.cpp.

Member Function Documentation

◆ completed()

bool WiegandPinBuffered::completed ( ) const
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 66 of file WiegandPinBuffered.cpp.

◆ get_pin()

const std::string & WiegandPinBuffered::get_pin ( ) const
overridevirtual

Retrieve the pin code that was read from the reader.

Implements Leosac::Module::Wiegand::Strategy::PinReading.

Definition at line 82 of file WiegandPinBuffered.cpp.

◆ reset()

void WiegandPinBuffered::reset ( )
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 87 of file WiegandPinBuffered.cpp.

◆ signal()

void WiegandPinBuffered::signal ( zmqpp::socket &  sock)
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.

Parameters
sockthe socket where we write the message containing credentials.

Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.

Definition at line 71 of file WiegandPinBuffered.cpp.

◆ timeout()

void WiegandPinBuffered::timeout ( )
overridevirtual

This is called when the module detect a timeout.

(2 ms of inactivity).

Implements Leosac::Module::Wiegand::Strategy::WiegandStrategy.

Definition at line 33 of file WiegandPinBuffered.cpp.

Member Data Documentation

◆ pin_

std::string Leosac::Module::Wiegand::Strategy::WiegandPinBuffered::pin_
private

Definition at line 58 of file WiegandPinBuffered.hpp.

◆ ready_

bool Leosac::Module::Wiegand::Strategy::WiegandPinBuffered::ready_
private

Definition at line 57 of file WiegandPinBuffered.hpp.


The documentation for this class was generated from the following files: