Leosac  0.8.0
Open Source Access Control
SysFsGpioConfig.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 "SysFSGPIOPin.hpp"
23 #include <boost/property_tree/ptree_fwd.hpp>
24 #include <map>
25 #include <string>
26 
27 namespace Leosac
28 {
29 namespace Module
30 {
31 
32 namespace SysFsGpio
33 {
41 {
42  public:
47  SysFsGpioConfig(const boost::property_tree::ptree &cfg);
48 
52  const std::string &export_path() const;
53 
57  const std::string &unexport_path() const;
58 
62  std::string value_path(int pin_no) const;
63 
67  std::string edge_path(int pin_no) const;
68 
72  std::string direction_path(int pin_no) const;
73 
74  private:
78  std::map<int, std::string> pin_aliases_;
79 
83  std::string default_aliases_;
84 
88  std::string cfg_export_path_;
89 
93  std::string cfg_unexport_path_;
94 
101  std::string cfg_value_path_;
102 
106  std::string cfg_edge_path_;
107 
111  std::string cfg_direction_path_;
112 };
113 }
114 }
115 }
Leosac::Module::SysFsGpio::SysFsGpioConfig::direction_path
std::string direction_path(int pin_no) const
Compute the absolute path the "direction" file for pin_no.
Definition: SysFsGpioConfig.cpp:93
Leosac::Module::SysFsGpio::SysFsGpioConfig::default_aliases_
std::string default_aliases_
Default aliases rule, as defined in configuration.
Definition: SysFsGpioConfig.hpp:83
Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_edge_path_
std::string cfg_edge_path_
Absolute path to the "edge" file.
Definition: SysFsGpioConfig.hpp:106
Leosac::Module::SysFsGpio::SysFsGpioConfig::pin_aliases_
std::map< int, std::string > pin_aliases_
Maps pin number to file identifier.
Definition: SysFsGpioConfig.hpp:78
Leosac::Module::SysFsGpio::SysFsGpioConfig
Internal configuration helper for sysfsgpio module.
Definition: SysFsGpioConfig.hpp:40
Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_export_path_
std::string cfg_export_path_
Absolute path of the "export" sysfs file.
Definition: SysFsGpioConfig.hpp:88
Leosac::Module::SysFsGpio::SysFsGpioConfig::value_path
std::string value_path(int pin_no) const
Compute the absolute path the "value" file for pin_no.
Definition: SysFsGpioConfig.cpp:73
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::SysFsGpio::SysFsGpioConfig::SysFsGpioConfig
SysFsGpioConfig(const boost::property_tree::ptree &cfg)
Construct the general config object from the configuration tree.
Definition: SysFsGpioConfig.cpp:28
SysFSGPIOPin.hpp
Leosac::Module::SysFsGpio::SysFsGpioConfig::edge_path
std::string edge_path(int pin_no) const
Compute the absolute path the "edge" file for pin_no.
Definition: SysFsGpioConfig.cpp:83
Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_direction_path_
std::string cfg_direction_path_
Absolute path to the "direction" file.
Definition: SysFsGpioConfig.hpp:111
Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_value_path_
std::string cfg_value_path_
Absolute path of the "value file" sysfs file: use __PLACEHOLDER__ as a placeholder for the PIN identi...
Definition: SysFsGpioConfig.hpp:101
Leosac::Module::SysFsGpio::SysFsGpioConfig::cfg_unexport_path_
std::string cfg_unexport_path_
Absolute path of the "unexport" sysfs file.
Definition: SysFsGpioConfig.hpp:93
Leosac::Module::SysFsGpio::SysFsGpioConfig::export_path
const std::string & export_path() const
Returns the absolute path to the "export" sysfs file.
Definition: SysFsGpioConfig.cpp:63
Leosac::Module::SysFsGpio::SysFsGpioConfig::unexport_path
const std::string & unexport_path() const
Returns the absolute path to the "unexport" sysfs file.
Definition: SysFsGpioConfig.cpp:68