Leosac  0.8.0
Open Source Access Control
Leosac::Hardware::FWiegandReader Class Reference

Facade object for a Wiegand Reader device. More...

#include <FWiegandReader.hpp>

+ Collaboration diagram for Leosac::Hardware::FWiegandReader:

Public Member Functions

 FWiegandReader (zmqpp::context &ctx, const std::string &reader_name)
 Construct a facade to a wiegand reader; this facade will connect to the reader. More...
 
 FWiegandReader (const FWiegandReader &)=delete
 
FWiegandReaderoperator= (const FWiegandReader &)=delete
 
 ~FWiegandReader ()=default
 
bool greenLedOn ()
 Turn the reader's green led on. More...
 
bool greenLedOff ()
 Turn the reader's green led off. More...
 
bool greenLedBlink (int64_t duration=1000, int64_t speed=300)
 Make the reader's green led blink. More...
 
bool beep (int64_t duration=1000)
 Beep for a given duration. More...
 
bool buzzerOn ()
 Turn the buzzer on. More...
 
bool buzzerOff ()
 Turn the buzzer off. More...
 
const std::string & name () const
 Returns the device's name. More...
 

Private Member Functions

bool send_to_backend (zmqpp::message &m)
 Send a message to the backend_ wiegand reader and wait for a response. More...
 

Private Attributes

zmqpp::socket backend_
 A socket to talk to the backend wiegand reader. More...
 
std::string name_
 

Detailed Description

Facade object for a Wiegand Reader device.

You can control a reader through this class by acting on its led and buzzer.

Note
This class implements the client code to [theses specifications](Specification for Wiegand module).

Definition at line 38 of file FWiegandReader.hpp.

Constructor & Destructor Documentation

◆ FWiegandReader() [1/2]

FWiegandReader::FWiegandReader ( zmqpp::context &  ctx,
const std::string &  reader_name 
)

Construct a facade to a wiegand reader; this facade will connect to the reader.

Parameters
ctxZMQ context
reader_namename of targeted wiegand device

Definition at line 24 of file FWiegandReader.cpp.

◆ FWiegandReader() [2/2]

Leosac::Hardware::FWiegandReader::FWiegandReader ( const FWiegandReader )
delete

◆ ~FWiegandReader()

Leosac::Hardware::FWiegandReader::~FWiegandReader ( )
default

Member Function Documentation

◆ beep()

bool FWiegandReader::beep ( int64_t  duration = 1000)

Beep for a given duration.

Definition at line 70 of file FWiegandReader.cpp.

◆ buzzerOff()

bool FWiegandReader::buzzerOff ( )

Turn the buzzer off.

Definition at line 86 of file FWiegandReader.cpp.

◆ buzzerOn()

bool FWiegandReader::buzzerOn ( )

Turn the buzzer on.

Definition at line 78 of file FWiegandReader.cpp.

◆ greenLedBlink()

bool FWiegandReader::greenLedBlink ( int64_t  duration = 1000,
int64_t  speed = 300 
)

Make the reader's green led blink.

Definition at line 49 of file FWiegandReader.cpp.

◆ greenLedOff()

bool FWiegandReader::greenLedOff ( )

Turn the reader's green led off.

Definition at line 40 of file FWiegandReader.cpp.

◆ greenLedOn()

bool FWiegandReader::greenLedOn ( )

Turn the reader's green led on.

Definition at line 31 of file FWiegandReader.cpp.

◆ name()

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

Returns the device's name.

Definition at line 94 of file FWiegandReader.cpp.

◆ operator=()

FWiegandReader& Leosac::Hardware::FWiegandReader::operator= ( const FWiegandReader )
delete

◆ send_to_backend()

bool FWiegandReader::send_to_backend ( zmqpp::message &  m)
private

Send a message to the backend_ wiegand reader and wait for a response.

The response shall be either "OK" or "KO"

Definition at line 58 of file FWiegandReader.cpp.

Member Data Documentation

◆ backend_

zmqpp::socket Leosac::Hardware::FWiegandReader::backend_
private

A socket to talk to the backend wiegand reader.

Definition at line 99 of file FWiegandReader.hpp.

◆ name_

std::string Leosac::Hardware::FWiegandReader::name_
private

Definition at line 101 of file FWiegandReader.hpp.


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