Thermal Camera SDK 10.1.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 std::string addUsbDetector ()
 Adds a detector for USB devices.
 
OTC_SDK_API bool removeUsbDetector ()
 Removes the detector for USB devices.
 
OTC_SDK_API std::string addEthernetDetector (const std::string &networkAddress)
 Adds a detector for Ethernet devices in the specified network.
 
OTC_SDK_API bool removeEthernetDetector (const std::string &networkAddress)
 Remove the Ethernet detector for the specified network.
 
OTC_SDK_API std::string addEthernetDetector (const IpAddress &networkAddress, int cidr)
 Adds a detector for Ethernet devices in the specified network.
 
OTC_SDK_API bool removeEthernetDetector (const IpAddress &networkAddress, int cidr)
 Remove the Ethernet detector for the specified network.
 
OTC_SDK_API std::string addDetector (const std::string &name, std::shared_ptr< EnumerationDetector > detector)
 Adds a new detector for connected devices.
 
OTC_SDK_API bool removeDetector (const std::string &name)
 Removes the detector with the given name.
 
OTC_SDK_API void clearDetectors ()
 Clears all added detectors.
 
OTC_SDK_API std::vector< std::string > getDetectorNames ()
 Returns the names of all added detectors.
 
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 ()
 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.

◆ addDetector()

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

Adds a new detector for connected devices.

Parameters
[in]nameunder which to register the detector. If an empty string is provided, no detector will be added.
[in]detectorto register.
Returns
name of the added detector or an empty string if adding the detector failed or if a detector with the same name was already added.

◆ addEthernetDetector() [1/2]

OTC_SDK_API std::string optris::EnumerationManager::addEthernetDetector ( const IpAddress & networkAddress,
int cidr )

Adds a detector for Ethernet devices in the specified network.

Parameters
[in]networkAddressIP address of the network. Its host portion will be ignored.
[in]cidrnumber of bits that constitute the network portion of the provided IP address. It is a shorthand for the subnet mask. Its value, typically, equals the number of 1 bits in the subnet mask.
Returns
name of the added detector. It is "<network address in CIDR notation>" (e.g. 192.168.0.0/24), if the detector was added successfully. An empty string, if adding the detector failed or if a detector for this network was already added.

◆ addEthernetDetector() [2/2]

OTC_SDK_API std::string optris::EnumerationManager::addEthernetDetector ( const std::string & networkAddress)

Adds a detector for Ethernet devices in the specified network.

Parameters
[in]networkAddressin CIDR notation: a.b.c.d/cider with a.b.c.d as the network IP address and cidr as the number of bits that constitute the network portion of the IP address. It is a shorthand for the subnet mask. Its value, typically, equals the number of 1 bits in the subnet mask.
Returns
name of the added detector. It is "<network address in CIDR notation>" (e.g. 192.168.0.0/24), if the detector was added successfully. An empty string, if the provided network address could not be parsed or if adding the detector failed or if a detector for this network was already added.

◆ addUsbDetector()

OTC_SDK_API std::string optris::EnumerationManager::addUsbDetector ( )

Adds a detector for USB devices.

Returns
name of the added detector. It is "usb", if the detector was added successfully. An empty string, if adding the detector failed or if a USB detector was already added.

◆ getDetectedDevices()

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

Returns information about the currently detected devices.

Note
This method will never wait, if the EnumerationManger is not running. In this way clients can not unexpectedly get stuck in this method.
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 currently 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.

◆ getDetectorNames()

OTC_SDK_API std::vector< std::string > optris::EnumerationManager::getDetectorNames ( )

Returns the names of all added detectors.

Returns
names of all added detectors.

◆ getInstance()

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

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.

◆ removeClient()

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

Removes the given observer/client.

Parameters
[in]clientto remove.

◆ removeDetector()

OTC_SDK_API bool optris::EnumerationManager::removeDetector ( const std::string & name)

Removes the detector with the given name.

Parameters
[in]nameof the detector to remove.
Returns
true, if a detector with the given name was removed. False otherwise.

◆ removeEthernetDetector() [1/2]

OTC_SDK_API bool optris::EnumerationManager::removeEthernetDetector ( const IpAddress & networkAddress,
int cidr )

Remove the Ethernet detector for the specified network.

Parameters
[in]networkAddressIP address of the network. Its host portion will be ignored.
[in]cidrnumber of bits that constitute the network portion of the provided IP address. It is a shorthand for the subnet mask. Its value, typically, equals the number of 1 bits in the subnet mask.
Returns
true, if an exiting detector was removed. False otherwise.

◆ removeEthernetDetector() [2/2]

OTC_SDK_API bool optris::EnumerationManager::removeEthernetDetector ( const std::string & networkAddress)

Remove the Ethernet detector for the specified network.

Parameters
[in]networkAddressin CIDR notation: a.b.c.d/cider with a.b.c.d as the network IP address and cidr as the number of bits that constitute the network portion of the IP address. It is a shorthand for the subnet mask. Its value, typically, equals the number of 1 bits in the subnet mask.
Returns
true, if an exiting detector was removed. False if no detector for the given network existed or if the provided network address could not be parsed.

◆ removeUsbDetector()

OTC_SDK_API bool optris::EnumerationManager::removeUsbDetector ( )

Removes the detector for USB devices.

Returns
true, if an existing detector was removed. False otherwise.

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

◆ stopRunning()

OTC_SDK_API void optris::EnumerationManager::stopRunning ( )

Stops the continuous connection event detection.

This does not clear the list of currently detected devices.


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