Leosac  0.8.0
Open Source Access Control
WiegandCardAndPin.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "Strategies.hpp"
23 #include "StrategiesFwd.hpp"
24 
25 namespace Leosac
26 {
27 namespace Module
28 {
29 
30 namespace Wiegand
31 {
32 namespace Strategy
33 {
39 {
40  public:
51  PinReadingUPtr read_pin, std::chrono::milliseconds delay);
52 
53  virtual void timeout() override;
54 
55  virtual bool completed() const override;
56 
57  virtual void signal(zmqpp::socket &sock) override;
58 
59  virtual void set_reader(WiegandReaderImpl *new_ptr) override;
60 
61  private:
67  void reset() override;
68 
71 
72  std::chrono::milliseconds delay_;
73  using TimePoint = std::chrono::system_clock::time_point;
75 
77  bool ready_;
78 };
79 }
80 }
81 }
82 }
Strategies.hpp
Leosac::Module::Wiegand::Strategy::CardReadingUPtr
std::unique_ptr< CardReading > CardReadingUPtr
Definition: CardReading.hpp:34
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::completed
virtual bool completed() const override
Did the strategy gather needed data? If this function returns true, that means that the strategy impl...
Definition: WiegandCardAndPin.cpp:77
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::reset
void reset() override
Reset self.
Definition: WiegandCardAndPin.cpp:102
Leosac::Module::Wiegand::WiegandReaderImpl
An implementation class that represents a Wiegand Reader.
Definition: WiegandReaderImpl.hpp:41
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin
Strategy for reading a card then a PIN code.
Definition: WiegandCardAndPin.hpp:38
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::reading_card_
bool reading_card_
Definition: WiegandCardAndPin.hpp:76
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::ready_
bool ready_
Definition: WiegandCardAndPin.hpp:77
StrategiesFwd.hpp
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::signal
virtual void signal(zmqpp::socket &sock) override
Tells the strategy implementation to send a message to the application containing the received creden...
Definition: WiegandCardAndPin.cpp:82
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::read_pin_strategy_
PinReadingUPtr read_pin_strategy_
Definition: WiegandCardAndPin.hpp:70
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::read_card_strategy_
CardReadingUPtr read_card_strategy_
Definition: WiegandCardAndPin.hpp:69
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::WiegandCardAndPin
WiegandCardAndPin(WiegandReaderImpl *reader, CardReadingUPtr read_card, PinReadingUPtr read_pin, std::chrono::milliseconds delay)
Create a strategy that read card and PIN code.
Definition: WiegandCardAndPin.cpp:27
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::TimePoint
std::chrono::system_clock::time_point TimePoint
Definition: WiegandCardAndPin.hpp:73
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::set_reader
virtual void set_reader(WiegandReaderImpl *new_ptr) override
Update the pointer that points back to the associated reader.
Definition: WiegandCardAndPin.cpp:95
Leosac::Module::Wiegand::Strategy::WiegandStrategy
The multiple modes available to wiegand reader are implemented through the strategy pattern.
Definition: WiegandStrategy.hpp:50
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::delay_
std::chrono::milliseconds delay_
Definition: WiegandCardAndPin.hpp:72
Leosac::Module::Wiegand::Strategy::PinReadingUPtr
std::unique_ptr< PinReading > PinReadingUPtr
Definition: StrategiesFwd.hpp:33
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::timeout
virtual void timeout() override
This is called when the module detect a timeout.
Definition: WiegandCardAndPin.cpp:41
Leosac::Module::Wiegand::Strategy::WiegandCardAndPin::time_card_read_
TimePoint time_card_read_
Definition: WiegandCardAndPin.hpp:74