Leosac  0.8.0
Open Source Access Control
Leosac::Module::Piface::PFDigitalModule Class Reference

Main class for the piface digital module. More...

#include <PFDigitalModule.hpp>

+ Inheritance diagram for Leosac::Module::Piface::PFDigitalModule:
+ Collaboration diagram for Leosac::Module::Piface::PFDigitalModule:

Public Member Functions

 PFDigitalModule (zmqpp::context &ctx, zmqpp::socket *module_manager_pipe, const boost::property_tree::ptree &config, CoreUtilsPtr utils)
 
 ~PFDigitalModule ()
 
virtual void run () override
 Module's main loop. More...
 
- Public Member Functions inherited from Leosac::Module::BaseModule
 BaseModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 Constructor of BaseModule. More...
 
virtual ~BaseModule ()=default
 

Private Member Functions

void handle_interrupt ()
 An interrupt was triggered. More...
 
void process_xml_config (const boost::property_tree::ptree &cfg)
 Process the XML configuration, preparing configured GPIO pin. More...
 
void process_config ()
 Process configuration. More...
 
void setup_database ()
 Create / update database schema for the module. More...
 
void load_config_from_database ()
 
bool get_input_pin_name (std::string &dest, int idx, uint8_t hw_addr)
 Retrieve the (user-given) name of the pin and store it in dest. More...
 

Private Attributes

zmqpp::socket bus_push_
 Socket to push event to the bus. More...
 
std::vector< PFDigitalPingpios_
 GPIO vector. More...
 
int interrupt_fd_
 File descriptor of the PIN that triggers interrupts. More...
 
WSHelperThread ws_helper_thread_
 Support thread for processing websocket requests. More...
 
bool degraded_mode_
 True if we are running in "degraded" mode (ie, not on a device that support the PifaceDigital). More...
 

Additional Inherited Members

- Protected Member Functions inherited from Leosac::Module::BaseModule
virtual void handle_pipe ()
 The base class register the pipe_ socket to its reactor_ so that this function is called when the pipe_ is available from reading. More...
 
virtual void handle_control ()
 Handle called when a message on the module's control socket arrives. More...
 
virtual void dump_additional_config (zmqpp::message *out) const
 Dump additional configuration (for example module specific config file). More...
 
void dump_config (ConfigManager::ConfigFormat fmt, zmqpp::message *out_msg) const
 Fills a message with the module's configuration information. More...
 
void config_check (const std::string &obj_name, Leosac::Hardware::DeviceClass type)
 An helper that checks configuration the existence of some objects. More...
 
void config_check (const std::string &obj_name)
 An helper that checks configuration the existence of some objects. More...
 
- Protected Attributes inherited from Leosac::Module::BaseModule
zmqpp::context & ctx_
 A reference to the ZeroMQ context in case you need it to create additional socket. More...
 
zmqpp::socket & pipe_
 A reference to the pair socket that link back to the module manager. More...
 
boost::property_tree::ptree config_
 The configuration tree passed to the start_module function. More...
 
CoreUtilsPtr utils_
 Pointer to the core utils, which gives access to scheduler and others. More...
 
bool is_running_
 Boolean indicating whether the main loop should run or not. More...
 
zmqpp::socket control_
 Control REP socket. More...
 
zmqpp::reactor reactor_
 The reactor object we poll() on in the main loop. More...
 
std::string name_
 

Detailed Description

Main class for the piface digital module.

Definition at line 82 of file PFDigitalModule.hpp.

Constructor & Destructor Documentation

◆ PFDigitalModule()

Leosac::Module::Piface::PFDigitalModule::PFDigitalModule ( zmqpp::context &  ctx,
zmqpp::socket *  module_manager_pipe,
const boost::property_tree::ptree &  config,
CoreUtilsPtr  utils 
)

Definition at line 54 of file PFDigitalModule.cpp.

◆ ~PFDigitalModule()

Leosac::Module::Piface::PFDigitalModule::~PFDigitalModule ( )

Definition at line 103 of file PFDigitalModule.cpp.

Member Function Documentation

◆ get_input_pin_name()

bool Leosac::Module::Piface::PFDigitalModule::get_input_pin_name ( std::string &  dest,
int  idx,
uint8_t  hw_addr 
)
private

Retrieve the (user-given) name of the pin and store it in dest.

Parameters
deststring to store the name into
idxThe ping number, starting at 0 for the first one.
hw_addrThe underlying hardware address of the pifacedigital.
Returns
True if we found the pin, false otherwise.

Definition at line 168 of file PFDigitalModule.cpp.

◆ handle_interrupt()

void Leosac::Module::Piface::PFDigitalModule::handle_interrupt ( )
private

An interrupt was triggered.

Lets handle it.

Definition at line 136 of file PFDigitalModule.cpp.

◆ load_config_from_database()

void Leosac::Module::Piface::PFDigitalModule::load_config_from_database ( )
private

Definition at line 270 of file PFDigitalModule.cpp.

◆ process_config()

void Leosac::Module::Piface::PFDigitalModule::process_config ( )
private

Process configuration.

Definition at line 213 of file PFDigitalModule.cpp.

◆ process_xml_config()

void Leosac::Module::Piface::PFDigitalModule::process_xml_config ( const boost::property_tree::ptree &  cfg)
private

Process the XML configuration, preparing configured GPIO pin.

Definition at line 182 of file PFDigitalModule.cpp.

◆ run()

void Leosac::Module::Piface::PFDigitalModule::run ( )
overridevirtual

Module's main loop.

Reimplemented from Leosac::Module::BaseModule.

Definition at line 111 of file PFDigitalModule.cpp.

◆ setup_database()

void Leosac::Module::Piface::PFDigitalModule::setup_database ( )
private

Create / update database schema for the module.

Definition at line 246 of file PFDigitalModule.cpp.

Member Data Documentation

◆ bus_push_

zmqpp::socket Leosac::Module::Piface::PFDigitalModule::bus_push_
private

Socket to push event to the bus.

Definition at line 122 of file PFDigitalModule.hpp.

◆ degraded_mode_

bool Leosac::Module::Piface::PFDigitalModule::degraded_mode_
private

True if we are running in "degraded" mode (ie, not on a device that support the PifaceDigital).

Definition at line 153 of file PFDigitalModule.hpp.

◆ gpios_

std::vector<PFDigitalPin> Leosac::Module::Piface::PFDigitalModule::gpios_
private

GPIO vector.

Definition at line 127 of file PFDigitalModule.hpp.

◆ interrupt_fd_

int Leosac::Module::Piface::PFDigitalModule::interrupt_fd_
private

File descriptor of the PIN that triggers interrupts.

This is card and will not change.

Definition at line 142 of file PFDigitalModule.hpp.

◆ ws_helper_thread_

WSHelperThread Leosac::Module::Piface::PFDigitalModule::ws_helper_thread_
private

Support thread for processing websocket requests.

Definition at line 147 of file PFDigitalModule.hpp.


The documentation for this class was generated from the following files: