Leosac
0.8.0
Open Source Access Control
|
This is a implementation class. More...
#include <PFDigitalPin.hpp>
Public Types | |
using | Direction = Leosac::Hardware::GPIO::Direction |
Public Member Functions | |
PFDigitalPin (zmqpp::context &ctx, const std::string &name, int gpio_no, Direction direction, bool value, uint8_t hardware_address) | |
Create a new GPIO pin. More... | |
~PFDigitalPin () | |
PFDigitalPin (const PFDigitalPin &)=delete | |
PFDigitalPin & | operator= (const PFDigitalPin &)=delete |
PFDigitalPin (PFDigitalPin &&o) | |
PFDigitalPin & | operator= (PFDigitalPin &&)=delete |
void | publish_state () |
void | update () |
Let the GPIO pin perform internal task. More... | |
std::chrono::system_clock::time_point | next_update () const |
This method shall returns the time point at which we want to be updated. More... | |
bool | turn_on (zmqpp::message *msg=nullptr) |
Write to PFDigital to turn the gpio on. More... | |
bool | turn_off () |
Write to PFDigital turn the gpio off. More... | |
bool | toggle () |
void | handle_message () |
The PFGpioModule will register this method so its called when a message is ready on the pin socket. More... | |
void | send_state () |
Send the current GPIO state on the socket. More... | |
bool | read_value () |
Ask the PiFace device for this pin's value and return it. More... | |
Public Attributes | |
uint8_t | gpio_no_ |
zmqpp::socket | sock_ |
listen to command from other component. More... | |
zmqpp::socket * | bus_push_ |
PUSH socket to write to the bus. More... | |
std::string | name_ |
const Direction | direction_ |
This is the direction of the GPIO pin. More... | |
bool | default_value_ |
The default value of the pin, it is only relevant is the pin is output. More... | |
std::chrono::system_clock::time_point | next_update_time_ |
Time point of next wished update. More... | |
uint8_t | hardware_address_ |
bool | want_update_ |
Does this object wants to be update() d ? More... | |
This is a implementation class.
It's not exposed to the user and is for this module internal code only.
It abstract a GPIO pin driven by the PifaceDigital card.
Definition at line 33 of file PFDigitalPin.hpp.
Definition at line 35 of file PFDigitalPin.hpp.
PFDigitalPin::PFDigitalPin | ( | zmqpp::context & | ctx, |
const std::string & | name, | ||
int | gpio_no, | ||
Direction | direction, | ||
bool | value, | ||
uint8_t | hardware_address | ||
) |
Create a new GPIO pin.
ctx | The ZeroMQ context |
name | the name we defined for the PIN |
gpio_no | The number of this GPIO |
direction | Whether this an input or output pin. |
value | the initial value of the pin. This only make sense if the pin is an output pin. |
Definition at line 24 of file PFDigitalPin.cpp.
PFDigitalPin::~PFDigitalPin | ( | ) |
Definition at line 43 of file PFDigitalPin.cpp.
|
delete |
PFDigitalPin::PFDigitalPin | ( | PFDigitalPin && | o | ) |
Definition at line 50 of file PFDigitalPin.cpp.
void PFDigitalPin::handle_message | ( | ) |
The PFGpioModule will register this method so its called when a message is ready on the pin socket.
Definition at line 64 of file PFDigitalPin.cpp.
std::chrono::system_clock::time_point PFDigitalPin::next_update | ( | ) | const |
This method shall returns the time point at which we want to be updated.
If you do not want to be updated, return time_point::max() basically making sure we wont be called.
Definition at line 146 of file PFDigitalPin.cpp.
|
delete |
|
delete |
void PFDigitalPin::publish_state | ( | ) |
Definition at line 153 of file PFDigitalPin.cpp.
bool PFDigitalPin::read_value | ( | ) |
Ask the PiFace device for this pin's value and return it.
Definition at line 132 of file PFDigitalPin.cpp.
void PFDigitalPin::send_state | ( | ) |
Send the current GPIO state on the socket.
Definition at line 160 of file PFDigitalPin.cpp.
bool PFDigitalPin::toggle | ( | ) |
Definition at line 116 of file PFDigitalPin.cpp.
bool PFDigitalPin::turn_off | ( | ) |
Write to PFDigital turn the gpio off.
Definition at line 106 of file PFDigitalPin.cpp.
bool PFDigitalPin::turn_on | ( | zmqpp::message * | msg = nullptr | ) |
Write to PFDigital to turn the gpio on.
msg | optional pointer to the source message. We can extract optional parameter, if any |
Definition at line 86 of file PFDigitalPin.cpp.
void PFDigitalPin::update | ( | ) |
Let the GPIO pin perform internal task.
This is called by the PFDigitalModule in the main loop.
duration
parameter. Definition at line 139 of file PFDigitalPin.cpp.
zmqpp::socket* PFDigitalPin::bus_push_ |
PUSH socket to write to the bus.
Definition at line 113 of file PFDigitalPin.hpp.
bool PFDigitalPin::default_value_ |
The default value of the pin, it is only relevant is the pin is output.
We store this to reset the pin its initial state upon unloading the module.
Definition at line 132 of file PFDigitalPin.hpp.
const Direction PFDigitalPin::direction_ |
This is the direction of the GPIO pin.
This cannot be modified once the GPIO has been created.
Definition at line 126 of file PFDigitalPin.hpp.
uint8_t PFDigitalPin::gpio_no_ |
Definition at line 103 of file PFDigitalPin.hpp.
uint8_t PFDigitalPin::hardware_address_ |
Definition at line 139 of file PFDigitalPin.hpp.
std::string PFDigitalPin::name_ |
Definition at line 115 of file PFDigitalPin.hpp.
std::chrono::system_clock::time_point PFDigitalPin::next_update_time_ |
Time point of next wished update.
Definition at line 137 of file PFDigitalPin.hpp.
zmqpp::socket PFDigitalPin::sock_ |
listen to command from other component.
Definition at line 108 of file PFDigitalPin.hpp.
bool PFDigitalPin::want_update_ |
Does this object wants to be update()
d ?
Definition at line 144 of file PFDigitalPin.hpp.