Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
psen_scan_v2_standalone::ScannerV2 Class Reference

This is the implementation of the Scanner API defined by IScanner. More...

#include <scanner_v2.h>

Inheritance diagram for psen_scan_v2_standalone::ScannerV2:
Inheritance graph
[legend]

Public Member Functions

 ScannerV2 (const ScannerConfiguration &scanner_config, const LaserScanCallback &laser_scan_callback)
 
std::future< void > start () override
 An exception is set in the returned future if the scanner start was not successful. More...
 
std::future< void > stop () override
 An exception is set in the returned future if the scanner stop was not successful. More...
 
 ~ScannerV2 () override
 
- Public Member Functions inherited from psen_scan_v2_standalone::IScanner
 IScanner (const ScannerConfiguration &scanner_config, const LaserScanCallback &laser_scan_callback)
 
virtual ~IScanner ()=default
 

Private Types

using OptionalPromise = boost::optional< std::promise< void > >
 

Private Member Functions

void scannerStartedCallback ()
 
void scannerStartErrorCallback (const std::string &error_msg)
 
void scannerStopErrorCallback (const std::string &error_msg)
 
void scannerStoppedCallback ()
 
template<class T >
void triggerEvent ()
 
template<class T >
void triggerEventWithParam (const T &event)
 

Private Attributes

std::mutex member_mutex_
 This Mutex protects ALL members of the Scanner against concurrent access. So far there exist at least the following threads, potentially causing concurrent access to the members: More...
 
OptionalPromise scanner_has_started_ { boost::none }
 
OptionalPromise scanner_has_stopped_ { boost::none }
 
std::unique_ptr< ScannerStateMachinesm_
 

Additional Inherited Members

- Public Types inherited from psen_scan_v2_standalone::IScanner
using LaserScanCallback = std::function< void(const LaserScan &)>
 Represents the user-provided callback for processing incoming scan data. More...
 
- Protected Member Functions inherited from psen_scan_v2_standalone::IScanner
const ScannerConfigurationconfig () const
 
const ScannerConfigurationgetConfig () const
 
const LaserScanCallbackgetLaserScanCallback () const
 
const LaserScanCallbacklaserScanCallback () const
 

Detailed Description

This is the implementation of the Scanner API defined by IScanner.

The class ScannerV2 is responsible for the initialization of:

It uses the passed ScannerConfiguration for all configurable parts of this process.

The class creates two UdpClientImpl, a WatchdogFactory and passes them together with the LaserScanCallback to the scanner_protocol::ScannerStateMachine via scanner_protocol::StateMachineArgs.

See also
IScanner
communication_layer::UdpClientImpl
protocol_layer::ScannerStateMachine
ScannerConfiguration

Definition at line 60 of file scanner_v2.h.

Member Typedef Documentation

◆ OptionalPromise

using psen_scan_v2_standalone::ScannerV2::OptionalPromise = boost::optional<std::promise<void> >
private

Definition at line 86 of file scanner_v2.h.

Constructor & Destructor Documentation

◆ ScannerV2()

psen_scan_v2_standalone::ScannerV2::ScannerV2 ( const ScannerConfiguration scanner_config,
const LaserScanCallback laser_scan_callback 
)

Definition at line 41 of file scanner_v2.cpp.

◆ ~ScannerV2()

psen_scan_v2_standalone::ScannerV2::~ScannerV2 ( )
override

Definition at line 64 of file scanner_v2.cpp.

Member Function Documentation

◆ scannerStartedCallback()

void psen_scan_v2_standalone::ScannerV2::scannerStartedCallback ( )
private

Definition at line 111 of file scanner_v2.cpp.

◆ scannerStartErrorCallback()

void psen_scan_v2_standalone::ScannerV2::scannerStartErrorCallback ( const std::string &  error_msg)
private

Definition at line 128 of file scanner_v2.cpp.

◆ scannerStopErrorCallback()

void psen_scan_v2_standalone::ScannerV2::scannerStopErrorCallback ( const std::string &  error_msg)
private

Definition at line 135 of file scanner_v2.cpp.

◆ scannerStoppedCallback()

void psen_scan_v2_standalone::ScannerV2::scannerStoppedCallback ( )
private

Definition at line 121 of file scanner_v2.cpp.

◆ start()

std::future< void > psen_scan_v2_standalone::ScannerV2::start ( )
overridevirtual

An exception is set in the returned future if the scanner start was not successful.

Implements psen_scan_v2_standalone::IScanner.

Definition at line 72 of file scanner_v2.cpp.

◆ stop()

std::future< void > psen_scan_v2_standalone::ScannerV2::stop ( )
overridevirtual

An exception is set in the returned future if the scanner stop was not successful.

Implements psen_scan_v2_standalone::IScanner.

Definition at line 90 of file scanner_v2.cpp.

◆ triggerEvent()

template<class T >
void psen_scan_v2_standalone::ScannerV2::triggerEvent
private

Definition at line 110 of file scanner_v2.h.

◆ triggerEventWithParam()

template<class T >
void psen_scan_v2_standalone::ScannerV2::triggerEventWithParam ( const T &  event)
private

Definition at line 103 of file scanner_v2.h.

Member Data Documentation

◆ member_mutex_

std::mutex psen_scan_v2_standalone::ScannerV2::member_mutex_
private

This Mutex protects ALL members of the Scanner against concurrent access. So far there exist at least the following threads, potentially causing concurrent access to the members:

  • user-main-thread
  • io_service thread of UDPClient
  • watchdog threads

Definition at line 97 of file scanner_v2.h.

◆ scanner_has_started_

OptionalPromise psen_scan_v2_standalone::ScannerV2::scanner_has_started_ { boost::none }
private

Definition at line 89 of file scanner_v2.h.

◆ scanner_has_stopped_

OptionalPromise psen_scan_v2_standalone::ScannerV2::scanner_has_stopped_ { boost::none }
private

Definition at line 90 of file scanner_v2.h.

◆ sm_

std::unique_ptr<ScannerStateMachine> psen_scan_v2_standalone::ScannerV2::sm_
private

Definition at line 99 of file scanner_v2.h.


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


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:12