Leosac  0.8.0
Open Source Access Control
Leosac::Module::LedBuzzer::LedBuzzerImpl Class Reference

Implementation class, for use by the LED module only. More...

#include <LedBuzzerImpl.hpp>

+ Collaboration diagram for Leosac::Module::LedBuzzer::LedBuzzerImpl:

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...
 

Detailed Description

Implementation class, for use by the LED module only.

Definition at line 37 of file LedBuzzerImpl.hpp.

Constructor & Destructor Documentation

◆ LedBuzzerImpl()

LedBuzzerImpl::LedBuzzerImpl ( zmqpp::context &  ctx,
const std::string &  led_name,
const std::string &  gpio_name,
int  blink_duration,
int  blink_speed 
)
Parameters
ctxZMQ context
led_namename of the led object
gpio_namename of the gpio we use to drive this led.

Definition at line 25 of file LedBuzzerImpl.cpp.

Member Function Documentation

◆ frontend()

zmqpp::socket & LedBuzzerImpl::frontend ( )

Return the frontend_ socket.

Definition at line 42 of file LedBuzzerImpl.cpp.

◆ handle_message()

void LedBuzzerImpl::handle_message ( )

Message received on the rep_ socket.

Definition at line 47 of file LedBuzzerImpl.cpp.

◆ next_update()

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.

◆ send_state()

void LedBuzzerImpl::send_state ( )
private

Write the current state of the LED device (according to specs) to the frontend_ socket.

Definition at line 125 of file LedBuzzerImpl.cpp.

◆ send_to_backend()

zmqpp::message LedBuzzerImpl::send_to_backend ( zmqpp::message &  msg)
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.

◆ start_blink()

bool LedBuzzerImpl::start_blink ( zmqpp::message *  msg)
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.

◆ update()

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.

Member Data Documentation

◆ backend_

zmqpp::socket Leosac::Module::LedBuzzer::LedBuzzerImpl::backend_
private

REQ socket to the backend GPIO.

Definition at line 101 of file LedBuzzerImpl.hpp.

◆ ctx_

zmqpp::context& Leosac::Module::LedBuzzer::LedBuzzerImpl::ctx_
private

Definition at line 91 of file LedBuzzerImpl.hpp.

◆ default_blink_duration_

int64_t Leosac::Module::LedBuzzer::LedBuzzerImpl::default_blink_duration_
private

Definition at line 110 of file LedBuzzerImpl.hpp.

◆ default_blink_speed_

int64_t Leosac::Module::LedBuzzer::LedBuzzerImpl::default_blink_speed_
private

Definition at line 111 of file LedBuzzerImpl.hpp.

◆ frontend_

zmqpp::socket Leosac::Module::LedBuzzer::LedBuzzerImpl::frontend_
private

REP socket to receive LED command.

Definition at line 96 of file LedBuzzerImpl.hpp.

◆ gpio_

Hardware::FGPIO Leosac::Module::LedBuzzer::LedBuzzerImpl::gpio_
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.

◆ stmachine_

LedBuzzerSM Leosac::Module::LedBuzzer::LedBuzzerImpl::stmachine_
private

Our state machine that handle blinking, blinking in pattern or doing nothing.

Definition at line 117 of file LedBuzzerImpl.hpp.


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