Leosac  0.8.0
Open Source Access Control
FWiegandReader.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 <string>
23 #include <zmqpp/zmqpp.hpp>
24 
25 namespace Leosac
26 {
27 namespace Hardware
28 {
29 
39 {
40  public:
46  FWiegandReader(zmqpp::context &ctx, const std::string &reader_name);
47 
48  FWiegandReader(const FWiegandReader &) = delete;
49 
50  FWiegandReader &operator=(const FWiegandReader &) = delete;
51 
52  ~FWiegandReader() = default;
53 
57  bool greenLedOn();
58 
62  bool greenLedOff();
63 
67  bool greenLedBlink(int64_t duration = 1000, int64_t speed = 300);
68 
72  bool beep(int64_t duration = 1000);
73 
77  bool buzzerOn();
78 
82  bool buzzerOff();
83 
87  const std::string &name() const;
88 
89  private:
94  bool send_to_backend(zmqpp::message &m);
95 
99  zmqpp::socket backend_;
100 
101  std::string name_;
102 };
103 }
104 }
Leosac::Hardware::FWiegandReader::backend_
zmqpp::socket backend_
A socket to talk to the backend wiegand reader.
Definition: FWiegandReader.hpp:99
Leosac::Hardware::FWiegandReader::operator=
FWiegandReader & operator=(const FWiegandReader &)=delete
Leosac::Hardware::FWiegandReader::name
const std::string & name() const
Returns the device's name.
Definition: FWiegandReader.cpp:94
Leosac::Hardware::FWiegandReader::send_to_backend
bool send_to_backend(zmqpp::message &m)
Send a message to the backend_ wiegand reader and wait for a response.
Definition: FWiegandReader.cpp:58
Leosac::Hardware::FWiegandReader
Facade object for a Wiegand Reader device.
Definition: FWiegandReader.hpp:38
Leosac::Hardware::FWiegandReader::beep
bool beep(int64_t duration=1000)
Beep for a given duration.
Definition: FWiegandReader.cpp:70
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Hardware::FWiegandReader::buzzerOn
bool buzzerOn()
Turn the buzzer on.
Definition: FWiegandReader.cpp:78
Leosac::Hardware::FWiegandReader::~FWiegandReader
~FWiegandReader()=default
Leosac::Hardware::FWiegandReader::buzzerOff
bool buzzerOff()
Turn the buzzer off.
Definition: FWiegandReader.cpp:86
Leosac::Hardware::FWiegandReader::name_
std::string name_
Definition: FWiegandReader.hpp:101
Leosac::Hardware::FWiegandReader::greenLedOff
bool greenLedOff()
Turn the reader's green led off.
Definition: FWiegandReader.cpp:40
Leosac::Hardware::FWiegandReader::FWiegandReader
FWiegandReader(zmqpp::context &ctx, const std::string &reader_name)
Construct a facade to a wiegand reader; this facade will connect to the reader.
Definition: FWiegandReader.cpp:24
Leosac::Hardware::FWiegandReader::greenLedOn
bool greenLedOn()
Turn the reader's green led on.
Definition: FWiegandReader.cpp:31
Leosac::Hardware::FWiegandReader::greenLedBlink
bool greenLedBlink(int64_t duration=1000, int64_t speed=300)
Make the reader's green led blink.
Definition: FWiegandReader.cpp:49