| 
    Leosac
    0.7.0
    
   OpenSourceAccessControl 
   | 
 
This class provide a base implementation -designed to be extended by subclass- so that non-boost-asio based module can "easily" make use of the WebSockAPI module. More...
#include <WSHelperThread.hpp>
 Collaboration diagram for Leosac::Module::WebSockAPI::BaseModuleSupportThread< ParameterT >:Public Member Functions | |
| BaseModuleSupportThread (const CoreUtilsPtr &core_utils, const ParameterT ¶m) | |
| virtual | ~BaseModuleSupportThread () | 
| void | start_running () | 
| Effectively starts an helper thread and run its io_service.  More... | |
| void | set_parameter (const ParameterT &p) | 
| virtual void | unregister_ws_handlers (Service &ws_service)=0 | 
Protected Attributes | |
| CoreUtilsPtr | core_utils_ | 
| bs2::scoped_connection | service_event_listener_ | 
| std::unique_ptr< std::thread > | thread_ | 
| boost::asio::io_service | io_ | 
| std::unique_ptr< boost::asio::io_service::work > | work_ | 
| ParameterT | parameters_ | 
| std::mutex | mutex_ | 
| std::shared_ptr< WebSockAPI::Service > | service_ptr_ | 
Private Member Functions | |
| void | run_io_service () | 
| void | on_service_event (const service_event::Event &e) | 
| virtual void | register_ws_handlers (Service &ws_service)=0 | 
| Called when websocket handler registration is possible.  More... | |
This class provide a base implementation -designed to be extended by subclass- so that non-boost-asio based module can "easily" make use of the WebSockAPI module.
When this object is created and its internal io_service runs, (after start_running() is called), it will attempt to locate a WS service object. If available, register_ws_handler() will be called. Otherwise, it will be called when (if) a WS Service object becomes registered.
The class provide extensions points that are called to register and unregister websocket handler. The function register_ws_handlers() is called when a WSService is available. The user is responsible for calling unregister_ws_handler().
Parameter template that allows the user to pass custom parameters to the support thread.Definition at line 61 of file WSHelperThread.hpp.
      
  | 
  inlineexplicit | 
Definition at line 64 of file WSHelperThread.hpp.
      
  | 
  inlinevirtual | 
Definition at line 71 of file WSHelperThread.hpp.
      
  | 
  inlineprivate | 
Definition at line 126 of file WSHelperThread.hpp.
      
  | 
  privatepure virtual | 
Called when websocket handler registration is possible.
This function is called with the internal mutex locked, to prevent conflict with a call to set_parameters(). 
Implemented in Leosac::Module::Piface::WSHelperThread, Leosac::Module::LedBuzzer::WSHelperThread, and Leosac::Module::Wiegand::WSHelperThread.
      
  | 
  inlineprivate | 
Definition at line 106 of file WSHelperThread.hpp.
      
  | 
  inline | 
Definition at line 97 of file WSHelperThread.hpp.
      
  | 
  inline | 
Effectively starts an helper thread and run its io_service.
Using this function is required because it wasn't possible to safely start running from the constructor (risk of calling virtual method on a not-yet fully initialised object).
Definition at line 92 of file WSHelperThread.hpp.
      
  | 
  pure virtual | 
      
  | 
  protected | 
Definition at line 160 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 163 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 166 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 165 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 161 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 172 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 162 of file WSHelperThread.hpp.
      
  | 
  protected | 
Definition at line 164 of file WSHelperThread.hpp.