Leosac
0.8.0
Open Source Access Control
|
Implementation class, for use by the LED module only. More...
#include <LedBuzzerImpl.hpp>
Public Member Functions | |
LedBuzzerImpl (zmqpp::context &ctx, const std::string &led_name, const std::string &gpio_name, int blink_duration, int blink_speed) | |
zmqpp::socket & | frontend () |
Return the frontend_ socket. More... | |
void | handle_message () |
Message received on the rep_ socket. More... | |
std::chrono::system_clock::time_point | next_update () |
Time point of the next wanted update. More... | |
void | update () |
Update the object. More... | |
Private Member Functions | |
zmqpp::message | send_to_backend (zmqpp::message &msg) |
Send a message to the backend object (used for ON, OFF, TOGGLE). More... | |
void | send_state () |
Write the current state of the LED device (according to specs) to the frontend_ socket. More... | |
bool | start_blink (zmqpp::message *msg) |
Start blinking, this stores the blink_end timepoint and send commands for blinking to happen. More... | |
Private Attributes | |
zmqpp::context & | ctx_ |
zmqpp::socket | frontend_ |
REP socket to receive LED command. More... | |
zmqpp::socket | backend_ |
REQ socket to the backend GPIO. More... | |
Hardware::FGPIO | gpio_ |
Facade to the GPIO we use with this LED. More... | |
int64_t | default_blink_duration_ |
int64_t | default_blink_speed_ |
LedBuzzerSM | stmachine_ |
Our state machine that handle blinking, blinking in pattern or doing nothing. More... | |
Implementation class, for use by the LED module only.
Definition at line 37 of file LedBuzzerImpl.hpp.
LedBuzzerImpl::LedBuzzerImpl | ( | zmqpp::context & | ctx, |
const std::string & | led_name, | ||
const std::string & | gpio_name, | ||
int | blink_duration, | ||
int | blink_speed | ||
) |
ctx | ZMQ context |
led_name | name of the led object |
gpio_name | name of the gpio we use to drive this led. |
Definition at line 25 of file LedBuzzerImpl.cpp.
zmqpp::socket & LedBuzzerImpl::frontend | ( | ) |
Return the frontend_
socket.
Definition at line 42 of file LedBuzzerImpl.cpp.
void LedBuzzerImpl::handle_message | ( | ) |
Message received on the rep_
socket.
Definition at line 47 of file LedBuzzerImpl.cpp.
std::chrono::system_clock::time_point LedBuzzerImpl::next_update | ( | ) |
Time point of the next wanted update.
Set to time_point::max() if not wanted.
Definition at line 89 of file LedBuzzerImpl.cpp.
|
private |
Write the current state of the LED device (according to specs) to the frontend_
socket.
Definition at line 125 of file LedBuzzerImpl.cpp.
|
private |
Send a message to the backend object (used for ON, OFF, TOGGLE).
Return the response message.
Definition at line 94 of file LedBuzzerImpl.cpp.
|
private |
Start blinking, this stores the blink_end timepoint and send commands for blinking to happen.
Register update()
.
Definition at line 103 of file LedBuzzerImpl.cpp.
void LedBuzzerImpl::update | ( | ) |
Update the object.
Only use case is blinking which simplifies code (ON
with delay is fully handled by GPIO).
Definition at line 83 of file LedBuzzerImpl.cpp.
|
private |
REQ socket to the backend GPIO.
Definition at line 101 of file LedBuzzerImpl.hpp.
|
private |
Definition at line 91 of file LedBuzzerImpl.hpp.
|
private |
Definition at line 110 of file LedBuzzerImpl.hpp.
|
private |
Definition at line 111 of file LedBuzzerImpl.hpp.
|
private |
REP socket to receive LED command.
Definition at line 96 of file LedBuzzerImpl.hpp.
|
private |
Facade to the GPIO we use with this LED.
While we send command directly most of the time (through the backend socket), this can be used too.
Definition at line 108 of file LedBuzzerImpl.hpp.
|
private |
Our state machine that handle blinking, blinking in pattern or doing nothing.
Definition at line 117 of file LedBuzzerImpl.hpp.