Leosac  0.7.0
OpenSourceAccessControl
wiegand.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 "WiegandReaderImpl.hpp"
23 #include "zmqpp/zmqpp.hpp"
24 #include <boost/property_tree/ptree.hpp>
25 #include <modules/BaseModule.hpp>
27 
28 namespace Leosac
29 {
30 namespace Module
31 {
32 
38 namespace Wiegand
39 {
40 class WiegandConfig;
41 class WiegandReaderConfig;
42 class WSHelperThread;
43 
48 {
49  public:
50  WiegandReaderModule(zmqpp::context &ctx, zmqpp::socket *pipe,
51  const boost::property_tree::ptree &cfg, CoreUtilsPtr utils);
52 
53  ~WiegandReaderModule() override;
54 
59  virtual void run() override;
60 
61  private:
65  void process_config();
66 
70  void load_db_config();
71 
76  void load_xml_config(const boost::property_tree::ptree &module_config);
77 
83  create_strategy(const WiegandReaderConfig &reader_config,
84  WiegandReaderImpl *reader);
85 
89  std::vector<WiegandReaderImpl> readers_;
90 
94  std::unique_ptr<WiegandConfig> wiegand_config_;
95 
96  std::unique_ptr<WSHelperThread> ws_helper_thread_;
97 };
98 }
99 }
100 }
WiegandReaderModule(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
Definition: wiegand.cpp:57
void load_xml_config(const boost::property_tree::ptree &module_config)
Load the module configuration from the XML configuration object.
Definition: wiegand.cpp:241
An instance of this class represents the configuration of one Wiegand reader.
std::unique_ptr< WiegandStrategy > WiegandStrategyUPtr
An implementation class that represents a Wiegand Reader.
This is the header file for a generated source file, GitSHA1.cpp.
std::unique_ptr< WiegandConfig > wiegand_config_
Configuration object for the module.
Definition: wiegand.hpp:94
void process_config()
Create wiegand reader instances based on configuration.
Definition: wiegand.cpp:81
Strategy::WiegandStrategyUPtr create_strategy(const WiegandReaderConfig &reader_config, WiegandReaderImpl *reader)
Internal factory that build a strategy object based upon a reader configuration.
Definition: wiegand.cpp:143
This simply is the main class for the Wiegand module.
Definition: wiegand.hpp:47
std::vector< WiegandReaderImpl > readers_
Vector of wiegand reader managed by this module.
Definition: wiegand.hpp:89
virtual void run() override
Module&#39;s main loop.
Definition: wiegand.cpp:122
Base class for module implementation.
Definition: BaseModule.hpp:110
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35
void load_db_config()
Load the module configuration from the database.
Definition: wiegand.cpp:197
std::unique_ptr< WSHelperThread > ws_helper_thread_
Definition: wiegand.hpp:96