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

Implementation of a wiegand card only strategy. More...

#include <SimpleWiegandStrategy.hpp>

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

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
WiegandReaderImplreader_
 

Detailed Description

Implementation of a wiegand card only strategy.

Definition at line 35 of file SimpleWiegandStrategy.hpp.

Constructor & Destructor Documentation

◆ SimpleWiegandStrategy()

SimpleWiegandStrategy::SimpleWiegandStrategy ( WiegandReaderImpl reader)

Definition at line 29 of file SimpleWiegandStrategy.cpp.

Member Function Documentation

◆ completed()

bool SimpleWiegandStrategy::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 59 of file SimpleWiegandStrategy.cpp.

◆ get_card_id()

const std::string & SimpleWiegandStrategy::get_card_id ( ) const
overridevirtual

Returns the card id that was read.

Implements Leosac::Module::Wiegand::Strategy::CardReading.

Definition at line 75 of file SimpleWiegandStrategy.cpp.

◆ get_nb_bits()

int SimpleWiegandStrategy::get_nb_bits ( ) const
overridevirtual

Returns the number of bits in the card.

Implements Leosac::Module::Wiegand::Strategy::CardReading.

Definition at line 80 of file SimpleWiegandStrategy.cpp.

◆ reset()

void SimpleWiegandStrategy::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 85 of file SimpleWiegandStrategy.cpp.

◆ signal()

void SimpleWiegandStrategy::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 64 of file SimpleWiegandStrategy.cpp.

◆ timeout()

void SimpleWiegandStrategy::timeout ( )
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.

Member Data Documentation

◆ card_id_

std::string Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy::card_id_
private

Definition at line 55 of file SimpleWiegandStrategy.hpp.

◆ nb_bits_

int Leosac::Module::Wiegand::Strategy::SimpleWiegandStrategy::nb_bits_
private

Definition at line 54 of file SimpleWiegandStrategy.hpp.

◆ ready_

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

Definition at line 53 of file SimpleWiegandStrategy.hpp.


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