Leosac  0.7.0
OpenSourceAccessControl
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 }
An implementation class that represents a Wiegand Reader.
This is the header file for a generated source file, GitSHA1.cpp.
virtual void timeout() override
This is called when the module detect a timeout.
std::unique_ptr< CardReading > CardReadingUPtr
Definition: CardReading.hpp:34
virtual void signal(zmqpp::socket &sock) override
Tells the strategy implementation to send a message to the application containing the received creden...
std::unique_ptr< PinReading > PinReadingUPtr
std::chrono::system_clock::time_point TimePoint
virtual void set_reader(WiegandReaderImpl *new_ptr) override
Update the pointer that points back to the associated reader.
The multiple modes available to wiegand reader are implemented through the strategy pattern...
Strategy for reading a card then a PIN code.
virtual bool completed() const override
Did the strategy gather needed data? If this function returns true, that means that the strategy impl...
WiegandCardAndPin(WiegandReaderImpl *reader, CardReadingUPtr read_card, PinReadingUPtr read_pin, std::chrono::milliseconds delay)
Create a strategy that read card and PIN code.