Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
optris::EnumerationManager Class Reference

Detects and monitors available devices. More...

#include <EnumerationManager.h>

Collaboration diagram for optris::EnumerationManager:
Collaboration graph

Public Member Functions

OTC_SDK_API EnumerationManager (const EnumerationManager &)=delete
 No copy constructor.
 
OTC_SDK_API EnumerationManageroperator= (const EnumerationManager &)=delete
 No copy assignment.
 
OTC_SDK_API EnumerationManager (EnumerationManager &&)=delete
 No move constructor.
 
OTC_SDK_API EnumerationManageroperator= (EnumerationManager &&)=delete
 No move assignment.
 
virtual OTC_SDK_API ~EnumerationManager ()
 Destructor.
 
OTC_SDK_API std::vector< DeviceInfogetDetectedDevices (int seconds=0)
 Returns information about the currently detected devices.
 
OTC_SDK_API void addClient (EnumerationClient *client)
 Adds an observer/client that will be updated if a device detection status changes.
 
OTC_SDK_API bool removeClient (EnumerationClient *client)
 Removes the given observer/client.
 
OTC_SDK_API void run ()
 Runs the connection event detection continuously.
 
OTC_SDK_API bool runAsync ()
 Runs the connection event detection continuously in a dedicated thread.
 
OTC_SDK_API void stopRunning ()
 Stops the continuous connection event detection.
 
OTC_SDK_API bool isRunning () const noexcept
 Returns whether the connection event detection is running.
 
OTC_SDK_API void setDetectionPeriod (int period) noexcept
 Sets the minimum period in milliseconds for a single connection event detection run.
 
OTC_SDK_API int getDetectionPeriod () const noexcept
 Returns the minimum period in milliseconds for a single connection event detection run.
 
OTC_SDK_API void registerDetector (const std::string &name, std::shared_ptr< EnumerationDetector > detector)
 Registers a new detector for connected devices.
 
OTC_SDK_API std::shared_ptr< EnumerationDetectorgetDetector (const std::string &name)
 Return the detector registered under the given name.
 

Static Public Member Functions

static OTC_SDK_API EnumerationManagergetInstance () noexcept
 Returns an instance of the EnumerationManager.
 

Detailed Description

Detects and monitors available devices.

It detects devices that the SDK can potentially connect to.

This class is implemented with the help of the Singleton design pattern. As a consequence, you have to use the EnumerationManager::getInstance() method to interact with it.

Furthermore, allows the registration of observers aka. EnumerationClient that want be informed if the detection status of a device changes.

Member Function Documentation

◆ addClient()

OTC_SDK_API void optris::EnumerationManager::addClient ( EnumerationClient * client)

Adds an observer/client that will be updated if a device detection status changes.

Parameters
[in]clientcallback client.

◆ getDetectedDevices()

OTC_SDK_API std::vector< DeviceInfo > optris::EnumerationManager::getDetectedDevices ( int seconds = 0)

Returns information about the currently detected devices.

Parameters
[in]seconds< 0 the method waits indefintfly for the first detection pass to complete. == 0 the method will not wait. > 0 the method waits the given amount of seconds for th first detection pass to complete.
Returns
a vector holding the current detected devices.

◆ getDetectionPeriod()

int optris::EnumerationManager::getDetectionPeriod ( ) const
inlinenoexcept

Returns the minimum period in milliseconds for a single connection event detection run.

Returns
minimum period in milliseconds for a single connection event detection run.

◆ getDetector()

OTC_SDK_API std::shared_ptr< EnumerationDetector > optris::EnumerationManager::getDetector ( const std::string & name)

Return the detector registered under the given name.

Parameters
[in]nameof the desired detector.
Returns
shared pointer to the detector or a nullptr if a detector with the given name is not registered.

◆ getInstance()

static OTC_SDK_API EnumerationManager & optris::EnumerationManager::getInstance ( )
staticnoexcept

Returns an instance of the EnumerationManager.

Only one instance per program is available (Singleton).

Returns
EnumerationManager instance.

◆ isRunning()

OTC_SDK_API bool optris::EnumerationManager::isRunning ( ) const
noexcept

Returns whether the connection event detection is running.

Returns
whether the connection event detection is running.

◆ registerDetector()

OTC_SDK_API void optris::EnumerationManager::registerDetector ( const std::string & name,
std::shared_ptr< EnumerationDetector > detector )

Registers a new detector for connected devices.

Existing detectors with the same name will be overriden.

Parameters
[in]nameunder which to register the detector.
[in]detectorto register.

◆ removeClient()

OTC_SDK_API bool optris::EnumerationManager::removeClient ( EnumerationClient * client)

Removes the given observer/client.

Parameters
[in]clientto remove.

◆ run()

OTC_SDK_API void optris::EnumerationManager::run ( )

Runs the connection event detection continuously.

This method blocks until stopRunning() is called from a different thread or until the program terminates.

See also
stopRunning()

◆ runAsync()

OTC_SDK_API bool optris::EnumerationManager::runAsync ( )

Runs the connection event detection continuously in a dedicated thread.

This method runs until stopRunning() is called from a different thread or until the program terminates.

Note
All callback methods of a registered EnumerationClient are called from this detection thread.
Returns
true if the thread started within a second. False otherwise.
See also
stopRunning()

◆ setDetectionPeriod()

void optris::EnumerationManager::setDetectionPeriod ( int period)
inlinenoexcept

Sets the minimum period in milliseconds for a single connection event detection run.

Parameters
[in]periodin milliseconds to set.

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