Leosac
0.8.0
Open Source Access Control
|
A Facade to a GPIO object. More...
#include <FGPIO.hpp>
Public Member Functions | |
FGPIO (zmqpp::context &ctx, const std::string &gpio_name) | |
FGPIO (const FGPIO &)=delete | |
Disabled copy-constructor. More... | |
~FGPIO ()=default | |
Default destructor, RAII does the job. More... | |
bool | turnOn (std::chrono::milliseconds duration) |
Turn the GPIO ON and turn it OFF duration milliseconds later. More... | |
bool | turnOn () |
Turn the GPIO ON by sending a message to the backend GPIO impl. More... | |
bool | turnOff () |
Turn the GPIO OFF by sending a message to the backend GPIO impl. More... | |
bool | toggle () |
Toggle the GPIO value by sending a message to the backend GPIO impl. More... | |
bool | isOn () |
Query the value of the GPIO and returns true if the LED is ON. More... | |
bool | isOff () |
Similar to isOn() . More... | |
const std::string & | name () const |
Name of the GPIO pin as defined in the configuration file. More... | |
Private Attributes | |
std::string | gpio_name_ |
zmqpp::socket | backend_ |
A socket to talk to the backend GPIO. More... | |
zmqpp::poller | poller_ |
A poller to not wait for infinity in case something went wrong. More... | |
A Facade to a GPIO object.
This facade does not care about the GPIO implementation. It uses message passing to interact with the application "gpio controller".
The backend GPIO object (implemented by the gpio module (either sysfs or piface)) MUST exist. All you need is the GPIO name defined in the configuration file to create a facade.
FGPIO::FGPIO | ( | zmqpp::context & | ctx, |
const std::string & | gpio_name | ||
) |
|
delete |
Disabled copy-constructor.
Manually create a new facade using the GPIO's name instead.
|
default |
Default destructor, RAII does the job.
bool FGPIO::isOn | ( | ) |
const std::string & FGPIO::name | ( | ) | const |
bool FGPIO::toggle | ( | ) |
bool FGPIO::turnOff | ( | ) |
bool FGPIO::turnOn | ( | ) |
bool FGPIO::turnOn | ( | std::chrono::milliseconds | duration | ) |
|
private |
|
private |