Leosac  0.8.0
Open Source Access Control
Leosac::Module::TestAndReset::TestAndResetModule Class Reference

#include <TestAndResetModule.hpp>

+ Inheritance diagram for Leosac::Module::TestAndReset::TestAndResetModule:
+ Collaboration diagram for Leosac::Module::TestAndReset::TestAndResetModule:

Public Member Functions

 TestAndResetModule (zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
 
 TestAndResetModule (const TestAndResetModule &)=delete
 
 TestAndResetModule (TestAndResetModule &&)=delete
 
TestAndResetModuleoperator= (const TestAndResetModule &)=delete
 
TestAndResetModuleoperator= (TestAndResetModule &&)=delete
 
virtual ~TestAndResetModule ()
 
- 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
 
virtual void run ()
 This is the main loop of the module. More...
 

Private Member Functions

void process_config ()
 
void run_test_sequence ()
 Do some stuff to let the user known something happened. More...
 
void handle_bus_msg ()
 
void test_sequence ()
 Do some stuff to let the user known the test card was read. More...
 
bool has_reset_card (const std::string &card_id) const
 Search the device_reset_card_ map for an entry whose value is card_id;. More...
 

Private Attributes

zmqpp::socket kernel_sock_
 REQ socket to kernel. More...
 
zmqpp::socket sub_
 Sub socket on the BUS. More...
 
std::map< std::string, std::string > device_reset_card_
 Map a device name to the reset card, since one device can support one reset card currently. More...
 
std::map< std::string, std::string > device_test_card_
 Map a device name to the test card. More...
 
std::unique_ptr< Hardware::FLEDtest_led_
 Led device for test card. More...
 
std::unique_ptr< Hardware::FLEDtest_buzzer_
 Buzzer device for test card. More...
 
bool run_on_start_
 Play the sequence on module startup. More...
 
bool promisc_
 

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

Definition at line 38 of file TestAndResetModule.hpp.

Constructor & Destructor Documentation

◆ TestAndResetModule() [1/3]

TestAndResetModule::TestAndResetModule ( zmqpp::context &  ctx,
zmqpp::socket *  pipe,
const boost::property_tree::ptree &  cfg,
CoreUtilsPtr  utils 
)
explicit

Definition at line 31 of file TestAndResetModule.cpp.

◆ TestAndResetModule() [2/3]

Leosac::Module::TestAndReset::TestAndResetModule::TestAndResetModule ( const TestAndResetModule )
delete

◆ TestAndResetModule() [3/3]

Leosac::Module::TestAndReset::TestAndResetModule::TestAndResetModule ( TestAndResetModule &&  )
delete

◆ ~TestAndResetModule()

TestAndResetModule::~TestAndResetModule ( )
virtual

Definition at line 27 of file TestAndResetModule.cpp.

Member Function Documentation

◆ handle_bus_msg()

void TestAndResetModule::handle_bus_msg ( )
private

Definition at line 93 of file TestAndResetModule.cpp.

◆ has_reset_card()

bool TestAndResetModule::has_reset_card ( const std::string &  card_id) const
private

Search the device_reset_card_ map for an entry whose value is card_id;.

Definition at line 151 of file TestAndResetModule.cpp.

◆ operator=() [1/2]

TestAndResetModule& Leosac::Module::TestAndReset::TestAndResetModule::operator= ( const TestAndResetModule )
delete

◆ operator=() [2/2]

TestAndResetModule& Leosac::Module::TestAndReset::TestAndResetModule::operator= ( TestAndResetModule &&  )
delete

◆ process_config()

void TestAndResetModule::process_config ( )
private

Definition at line 51 of file TestAndResetModule.cpp.

◆ run_test_sequence()

void TestAndResetModule::run_test_sequence ( )
private

Do some stuff to let the user known something happened.

This may be trigger on module initialization, and will be called when test card is read.

Definition at line 134 of file TestAndResetModule.cpp.

◆ test_sequence()

void Leosac::Module::TestAndReset::TestAndResetModule::test_sequence ( )
private

Do some stuff to let the user known the test card was read.

Member Data Documentation

◆ device_reset_card_

std::map<std::string, std::string> Leosac::Module::TestAndReset::TestAndResetModule::device_reset_card_
private

Map a device name to the reset card, since one device can support one reset card currently.

Definition at line 89 of file TestAndResetModule.hpp.

◆ device_test_card_

std::map<std::string, std::string> Leosac::Module::TestAndReset::TestAndResetModule::device_test_card_
private

Map a device name to the test card.

Definition at line 94 of file TestAndResetModule.hpp.

◆ kernel_sock_

zmqpp::socket Leosac::Module::TestAndReset::TestAndResetModule::kernel_sock_
private

REQ socket to kernel.

Definition at line 78 of file TestAndResetModule.hpp.

◆ promisc_

bool Leosac::Module::TestAndReset::TestAndResetModule::promisc_
private

Definition at line 111 of file TestAndResetModule.hpp.

◆ run_on_start_

bool Leosac::Module::TestAndReset::TestAndResetModule::run_on_start_
private

Play the sequence on module startup.

Definition at line 109 of file TestAndResetModule.hpp.

◆ sub_

zmqpp::socket Leosac::Module::TestAndReset::TestAndResetModule::sub_
private

Sub socket on the BUS.

Definition at line 83 of file TestAndResetModule.hpp.

◆ test_buzzer_

std::unique_ptr<Hardware::FLED> Leosac::Module::TestAndReset::TestAndResetModule::test_buzzer_
private

Buzzer device for test card.

Definition at line 104 of file TestAndResetModule.hpp.

◆ test_led_

std::unique_ptr<Hardware::FLED> Leosac::Module::TestAndReset::TestAndResetModule::test_led_
private

Led device for test card.

Definition at line 99 of file TestAndResetModule.hpp.


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