Leosac  0.8.0
Open Source Access Control
Leosac::Module::SysFsGpio::SysFsGpioConfig Class Reference

Internal configuration helper for sysfsgpio module. More...

#include <SysFsGpioConfig.hpp>

+ Collaboration diagram for Leosac::Module::SysFsGpio::SysFsGpioConfig:

Public Member Functions

 SysFsGpioConfig (const boost::property_tree::ptree &cfg)
 Construct the general config object from the configuration tree. More...
 
const std::string & export_path () const
 Returns the absolute path to the "export" sysfs file. More...
 
const std::string & unexport_path () const
 Returns the absolute path to the "unexport" sysfs file. More...
 
std::string value_path (int pin_no) const
 Compute the absolute path the "value" file for pin_no. More...
 
std::string edge_path (int pin_no) const
 Compute the absolute path the "edge" file for pin_no. More...
 
std::string direction_path (int pin_no) const
 Compute the absolute path the "direction" file for pin_no. More...
 

Private Attributes

std::map< int, std::string > pin_aliases_
 Maps pin number to file identifier. More...
 
std::string default_aliases_
 Default aliases rule, as defined in configuration. More...
 
std::string cfg_export_path_
 Absolute path of the "export" sysfs file. More...
 
std::string cfg_unexport_path_
 Absolute path of the "unexport" sysfs file. More...
 
std::string cfg_value_path_
 Absolute path of the "value file" sysfs file: use __PLACEHOLDER__ as a placeholder for the PIN identifier (likely its number, potentially – prefixed by "gpio" on raspberry pi). More...
 
std::string cfg_edge_path_
 Absolute path to the "edge" file. More...
 
std::string cfg_direction_path_
 Absolute path to the "direction" file. More...
 

Detailed Description

Internal configuration helper for sysfsgpio module.

This class provide a path resolution mechanism and aliases handling. It is implemented as an external object to ease testing.

Definition at line 40 of file SysFsGpioConfig.hpp.

Constructor & Destructor Documentation

◆ SysFsGpioConfig()

SysFsGpioConfig::SysFsGpioConfig ( const boost::property_tree::ptree &  cfg)

Construct the general config object from the configuration tree.

Definition at line 28 of file SysFsGpioConfig.cpp.

Member Function Documentation

◆ direction_path()

std::string SysFsGpioConfig::direction_path ( int  pin_no) const

Compute the absolute path the "direction" file for pin_no.

Definition at line 93 of file SysFsGpioConfig.cpp.

◆ edge_path()

std::string SysFsGpioConfig::edge_path ( int  pin_no) const

Compute the absolute path the "edge" file for pin_no.

Definition at line 83 of file SysFsGpioConfig.cpp.

◆ export_path()

const std::string & SysFsGpioConfig::export_path ( ) const

Returns the absolute path to the "export" sysfs file.

Definition at line 63 of file SysFsGpioConfig.cpp.

◆ unexport_path()

const std::string & SysFsGpioConfig::unexport_path ( ) const

Returns the absolute path to the "unexport" sysfs file.

Definition at line 68 of file SysFsGpioConfig.cpp.

◆ value_path()

std::string SysFsGpioConfig::value_path ( int  pin_no) const

Compute the absolute path the "value" file for pin_no.

Definition at line 73 of file SysFsGpioConfig.cpp.

Member Data Documentation

◆ cfg_direction_path_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_direction_path_
private

Absolute path to the "direction" file.

Definition at line 111 of file SysFsGpioConfig.hpp.

◆ cfg_edge_path_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_edge_path_
private

Absolute path to the "edge" file.

Definition at line 106 of file SysFsGpioConfig.hpp.

◆ cfg_export_path_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_export_path_
private

Absolute path of the "export" sysfs file.

Definition at line 88 of file SysFsGpioConfig.hpp.

◆ cfg_unexport_path_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_unexport_path_
private

Absolute path of the "unexport" sysfs file.

Definition at line 93 of file SysFsGpioConfig.hpp.

◆ cfg_value_path_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_value_path_
private

Absolute path of the "value file" sysfs file: use __PLACEHOLDER__ as a placeholder for the PIN identifier (likely its number, potentially – prefixed by "gpio" on raspberry pi).

Definition at line 101 of file SysFsGpioConfig.hpp.

◆ default_aliases_

std::string Leosac::Module::SysFsGpio::SysFsGpioConfig::default_aliases_
private

Default aliases rule, as defined in configuration.

Definition at line 83 of file SysFsGpioConfig.hpp.

◆ pin_aliases_

std::map<int, std::string> Leosac::Module::SysFsGpio::SysFsGpioConfig::pin_aliases_
private

Maps pin number to file identifier.

Definition at line 78 of file SysFsGpioConfig.hpp.


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