Leosac  0.8.0
Open Source Access Control
init.cpp
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 distrsrc/hardware/HardwareService.hppibuted in the hope that it will be
12  useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Affero General Public License for more details.
16 
17  You should have received a copy of the GNU Affero General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "PFDigitalModule.hpp"
22 #include "tools/log.hpp"
23 #include <boost/property_tree/ptree.hpp>
24 #include <zmqpp/zmqpp.hpp>
25 
26 extern "C" {
27 const char *get_module_name()
28 {
29  return "PIFACEDIGITAL_GPIO";
30 }
31 }
32 
33 using namespace Leosac::Module::Piface;
34 
39 extern "C" __attribute__((visibility("default"))) bool
40 start_module(zmqpp::socket *pipe, boost::property_tree::ptree cfg,
41  zmqpp::context &zmq_ctx, Leosac::CoreUtilsPtr utils)
42 {
43  // this thread need realtime priority so it doesn't miss interrupt.
44  struct sched_param p;
45  p.sched_priority = 90;
46  int ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, &p);
47 
48  if (ret != 0)
49  {
50  WARN("Setting realtime priority for "
51  << get_module_name() << " module failed. "
52  << "The program will keep running but could encounter issues like "
53  "missing some Wiegand bits.");
54  }
55 
56  return Leosac::Module::start_module_helper<PFDigitalModule>(pipe, cfg, zmq_ctx,
57  utils);
58 }
WARN
@ WARN
Definition: log.hpp:33
zmqpp
Definition: CoreUtils.hpp:27
get_module_name
const char * get_module_name()
Definition: init.cpp:26
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::Piface
Provide support for the piface digital device.
Definition: CRUDHandler.cpp:34
PFDigitalModule.hpp
__attribute__
__attribute__((visibility("default"))) bool start_module(zmqpp
Entry point for the auth-db module.
Definition: init.cpp:35
log.hpp
Leosac::CoreUtilsPtr
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35