Leosac  0.8.0
Open Source Access Control
Leosac::Module::Wiegand::Strategy::WiegandStrategy Class Referenceabstract

The multiple modes available to wiegand reader are implemented through the strategy pattern. More...

#include <WiegandStrategy.hpp>

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

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

WiegandReaderImplreader_
 

Friends

class WiegandReaderImpl
 

Detailed Description

The multiple modes available to wiegand reader are implemented through the strategy pattern.

This class defines the interface.

Note
: Currently the strategy is only to handle wiegand timeout (2ms) not the reception of each GPIO tick.

Definition at line 50 of file WiegandStrategy.hpp.

Constructor & Destructor Documentation

◆ WiegandStrategy()

Leosac::Module::Wiegand::Strategy::WiegandStrategy::WiegandStrategy ( WiegandReaderImpl reader)
inline

Definition at line 53 of file WiegandStrategy.hpp.

◆ ~WiegandStrategy()

virtual Leosac::Module::Wiegand::Strategy::WiegandStrategy::~WiegandStrategy ( )
virtualdefault

Member Function Documentation

◆ completed()

virtual bool Leosac::Module::Wiegand::Strategy::WiegandStrategy::completed ( ) const
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.

◆ reset()

virtual void Leosac::Module::Wiegand::Strategy::WiegandStrategy::reset ( )
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.

◆ set_reader()

virtual void Leosac::Module::Wiegand::Strategy::WiegandStrategy::set_reader ( WiegandReaderImpl new_ptr)
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.

◆ signal()

virtual void Leosac::Module::Wiegand::Strategy::WiegandStrategy::signal ( zmqpp::socket &  sock)
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.

Parameters
sockthe 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.

◆ timeout()

virtual void Leosac::Module::Wiegand::Strategy::WiegandStrategy::timeout ( )
pure virtual

Friends And Related Function Documentation

◆ WiegandReaderImpl

friend class WiegandReaderImpl
friend

Definition at line 107 of file WiegandStrategy.hpp.

Member Data Documentation

◆ reader_

WiegandReaderImpl* Leosac::Module::Wiegand::Strategy::WiegandStrategy::reader_
protected

Definition at line 110 of file WiegandStrategy.hpp.


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