Leosac
0.8.0
Open Source Access Control
|
An implementation class that represents a Wiegand Reader. More...
#include <WiegandReaderImpl.hpp>
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 | |
WiegandReaderImpl & | operator= (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::FLED > | green_led_ |
Facade to control the reader green led. More... | |
std::unique_ptr< Hardware::FBuzzer > | buzzer_ |
Facade to the buzzer object. More... | |
std::unique_ptr< Strategy::WiegandStrategy > | strategy_ |
Concrete implementation of the reader mode. More... | |
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.
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.
ctx | ZMQ context. |
data_high_pin | name of the GPIO connected to data high. |
data_low_pin | name of the GPIO connected to data low. |
green_led_name | name of the "green led" LED device. |
buzzer_name | name of the buzzer device. – no buzzer module yet. |
strategy | strategy (mode implementation) the reader is using |
Definition at line 31 of file WiegandReaderImpl.cpp.
WiegandReaderImpl::~WiegandReaderImpl | ( | ) |
Definition at line 67 of file WiegandReaderImpl.cpp.
|
delete |
WiegandReaderImpl::WiegandReaderImpl | ( | WiegandReaderImpl && | o | ) |
Definition at line 71 of file WiegandReaderImpl.cpp.
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.
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.
void WiegandReaderImpl::handle_bus_msg | ( | ) |
Something happened on the bus.
Definition at line 91 of file WiegandReaderImpl.cpp.
void WiegandReaderImpl::handle_request | ( | ) |
Someone sent a request.
Definition at line 131 of file WiegandReaderImpl.cpp.
const std::string & WiegandReaderImpl::name | ( | ) | const |
Returns the name of this reader.
Definition at line 208 of file WiegandReaderImpl.cpp.
|
delete |
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.
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.
|
private |
Buffer to store incoming bits from high and low gpios.
Definition at line 141 of file WiegandReaderImpl.hpp.
|
private |
Socket to write to the message bus.
Definition at line 126 of file WiegandReaderImpl.hpp.
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.
|
private |
Facade to the buzzer object.
Definition at line 161 of file WiegandReaderImpl.hpp.
|
private |
Count the number of bits received from GPIOs.
Definition at line 146 of file WiegandReaderImpl.hpp.
|
private |
Facade to control the reader green led.
Definition at line 156 of file WiegandReaderImpl.hpp.
|
private |
Name of the device (defined in configuration)
Definition at line 151 of file WiegandReaderImpl.hpp.
zmqpp::socket Leosac::Module::Wiegand::WiegandReaderImpl::sock_ |
REP socket to receive command on.
Definition at line 76 of file WiegandReaderImpl.hpp.
|
private |
Concrete implementation of the reader mode.
Definition at line 166 of file WiegandReaderImpl.hpp.
|
private |
ZMQ topic-string for interrupt on HIGH gpio (high gpio's name)
Definition at line 131 of file WiegandReaderImpl.hpp.
|
private |
ZMQ topic-string to interrupt on LOW gpio (low gpio's name)
Definition at line 136 of file WiegandReaderImpl.hpp.