Leosac  0.8.0
Open Source Access Control
Leosac::Module::Wiegand::WiegandReaderImpl Class Reference

An implementation class that represents a Wiegand Reader. More...

#include <WiegandReaderImpl.hpp>

+ Collaboration diagram for Leosac::Module::Wiegand::WiegandReaderImpl:

Public Member Functions

 WiegandReaderImpl (zmqpp::context &ctx, const std::string &reader_name, const std::string &data_high_pin, const std::string &data_low_pin, const std::string &green_led_name, const std::string &buzzer_name, std::unique_ptr< Strategy::WiegandStrategy > strategy)
 Create a new implementation of a Wiegand Reader. More...
 
 ~WiegandReaderImpl ()
 
 WiegandReaderImpl (const WiegandReaderImpl &)=delete
 
WiegandReaderImploperator= (const WiegandReaderImpl &)=delete
 
 WiegandReaderImpl (WiegandReaderImpl &&o)
 
void handle_bus_msg ()
 Something happened on the bus. More...
 
void handle_request ()
 Someone sent a request. More...
 
void timeout ()
 Timeout (no more data burst to handle). More...
 
void read_reset ()
 Reset the "read state" of the reader, effectively cleaning the wiegand-bit-buffer and resetting the counter to 0. More...
 
int counter () const
 Returns the number of bits read. More...
 
const unsigned char * buffer () const
 Return a pointer to internal buffer memory. More...
 
const std::string & name () const
 Returns the name of this reader. More...
 

Public Attributes

zmqpp::socket bus_sub_
 Socket that allows the reader to listen to the application BUS. More...
 
zmqpp::socket sock_
 REP socket to receive command on. More...
 

Private Attributes

zmqpp::socket bus_push_
 Socket to write to the message bus. More...
 
std::string topic_high_
 ZMQ topic-string for interrupt on HIGH gpio (high gpio's name) More...
 
std::string topic_low_
 ZMQ topic-string to interrupt on LOW gpio (low gpio's name) More...
 
std::array< uint8_t, 16 > buffer_
 Buffer to store incoming bits from high and low gpios. More...
 
int counter_
 Count the number of bits received from GPIOs. More...
 
std::string name_
 Name of the device (defined in configuration) More...
 
std::unique_ptr< Hardware::FLEDgreen_led_
 Facade to control the reader green led. More...
 
std::unique_ptr< Hardware::FBuzzerbuzzer_
 Facade to the buzzer object. More...
 
std::unique_ptr< Strategy::WiegandStrategystrategy_
 Concrete implementation of the reader mode. More...
 

Detailed Description

An implementation class that represents a Wiegand Reader.

It's solely for internal use by the Wiegand module.

Definition at line 41 of file WiegandReaderImpl.hpp.

Constructor & Destructor Documentation

◆ WiegandReaderImpl() [1/3]

WiegandReaderImpl::WiegandReaderImpl ( zmqpp::context &  ctx,
const std::string &  reader_name,
const std::string &  data_high_pin,
const std::string &  data_low_pin,
const std::string &  green_led_name,
const std::string &  buzzer_name,
std::unique_ptr< Strategy::WiegandStrategy strategy 
)

Create a new implementation of a Wiegand Reader.

Parameters
ctxZMQ context.
data_high_pinname of the GPIO connected to data high.
data_low_pinname of the GPIO connected to data low.
green_led_namename of the "green led" LED device.
buzzer_namename of the buzzer device. – no buzzer module yet.
strategystrategy (mode implementation) the reader is using

Definition at line 31 of file WiegandReaderImpl.cpp.

◆ ~WiegandReaderImpl()

WiegandReaderImpl::~WiegandReaderImpl ( )

Definition at line 67 of file WiegandReaderImpl.cpp.

◆ WiegandReaderImpl() [2/3]

Leosac::Module::Wiegand::WiegandReaderImpl::WiegandReaderImpl ( const WiegandReaderImpl )
delete

◆ WiegandReaderImpl() [3/3]

WiegandReaderImpl::WiegandReaderImpl ( WiegandReaderImpl &&  o)

Definition at line 71 of file WiegandReaderImpl.cpp.

Member Function Documentation

◆ buffer()

const unsigned char * WiegandReaderImpl::buffer ( ) const

Return a pointer to internal buffer memory.

You can use this to access the bits read by the reader. Do not read more bits than counter() returned.

Definition at line 198 of file WiegandReaderImpl.cpp.

◆ counter()

int WiegandReaderImpl::counter ( ) const

Returns the number of bits read.

This number of bits shall never be greater than the number of bits the buffer_ can hold.

Definition at line 203 of file WiegandReaderImpl.cpp.

◆ handle_bus_msg()

void WiegandReaderImpl::handle_bus_msg ( )

Something happened on the bus.

Definition at line 91 of file WiegandReaderImpl.cpp.

◆ handle_request()

void WiegandReaderImpl::handle_request ( )

Someone sent a request.

Definition at line 131 of file WiegandReaderImpl.cpp.

◆ name()

const std::string & WiegandReaderImpl::name ( ) const

Returns the name of this reader.

Definition at line 208 of file WiegandReaderImpl.cpp.

◆ operator=()

WiegandReaderImpl& Leosac::Module::Wiegand::WiegandReaderImpl::operator= ( const WiegandReaderImpl )
delete

◆ read_reset()

void WiegandReaderImpl::read_reset ( )

Reset the "read state" of the reader, effectively cleaning the wiegand-bit-buffer and resetting the counter to 0.

Definition at line 192 of file WiegandReaderImpl.cpp.

◆ timeout()

void WiegandReaderImpl::timeout ( )

Timeout (no more data burst to handle).

The WiegandModule call this when polling on any wiegand reader times out. The reader shall publish an event if it received any meaningful message since the last timeout.

Definition at line 117 of file WiegandReaderImpl.cpp.

Member Data Documentation

◆ buffer_

std::array<uint8_t, 16> Leosac::Module::Wiegand::WiegandReaderImpl::buffer_
private

Buffer to store incoming bits from high and low gpios.

Definition at line 141 of file WiegandReaderImpl.hpp.

◆ bus_push_

zmqpp::socket Leosac::Module::Wiegand::WiegandReaderImpl::bus_push_
private

Socket to write to the message bus.

Definition at line 126 of file WiegandReaderImpl.hpp.

◆ bus_sub_

zmqpp::socket Leosac::Module::Wiegand::WiegandReaderImpl::bus_sub_

Socket that allows the reader to listen to the application BUS.

Definition at line 71 of file WiegandReaderImpl.hpp.

◆ buzzer_

std::unique_ptr<Hardware::FBuzzer> Leosac::Module::Wiegand::WiegandReaderImpl::buzzer_
private

Facade to the buzzer object.

Definition at line 161 of file WiegandReaderImpl.hpp.

◆ counter_

int Leosac::Module::Wiegand::WiegandReaderImpl::counter_
private

Count the number of bits received from GPIOs.

Definition at line 146 of file WiegandReaderImpl.hpp.

◆ green_led_

std::unique_ptr<Hardware::FLED> Leosac::Module::Wiegand::WiegandReaderImpl::green_led_
private

Facade to control the reader green led.

Definition at line 156 of file WiegandReaderImpl.hpp.

◆ name_

std::string Leosac::Module::Wiegand::WiegandReaderImpl::name_
private

Name of the device (defined in configuration)

Definition at line 151 of file WiegandReaderImpl.hpp.

◆ sock_

zmqpp::socket Leosac::Module::Wiegand::WiegandReaderImpl::sock_

REP socket to receive command on.

Definition at line 76 of file WiegandReaderImpl.hpp.

◆ strategy_

std::unique_ptr<Strategy::WiegandStrategy> Leosac::Module::Wiegand::WiegandReaderImpl::strategy_
private

Concrete implementation of the reader mode.

Definition at line 166 of file WiegandReaderImpl.hpp.

◆ topic_high_

std::string Leosac::Module::Wiegand::WiegandReaderImpl::topic_high_
private

ZMQ topic-string for interrupt on HIGH gpio (high gpio's name)

Definition at line 131 of file WiegandReaderImpl.hpp.

◆ topic_low_

std::string Leosac::Module::Wiegand::WiegandReaderImpl::topic_low_
private

ZMQ topic-string to interrupt on LOW gpio (low gpio's name)

Definition at line 136 of file WiegandReaderImpl.hpp.


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