Static class granting access to SDK wide configuration and utility functions.
More...
#include <Sdk.h>
|
| using | LogCallback = void(OTC_SDK_C_CALL*)(int verbosityLevel, const char* message) |
| | Callback function type for receiving SDK log messages.
|
| |
|
|
| Sdk ()=delete |
| | No constructor.
|
| |
|
| static OTC_SDK_API void | init (Verbosity logScreen, Verbosity logFile, std::string logFilenamePrefix="", std::string customDataDirectory="") |
| | Initializes the SDK.
|
| |
| static OTC_SDK_API void | configureLogger (Verbosity logScreen, Verbosity logFile, std::string logFilenamePrefix="") |
| | Configures the SDK internal logger.
|
| |
| static OTC_SDK_API void | setLogCallback (LogCallback callback, bool exclusive=false) |
| | Sets a callback that receives SDK log messages.
|
| |
| static OTC_SDK_API void | setCustomDataDirectory (const std::string &customDataDirectory) |
| | Sets a custom data directory for the SDK to use.
|
| |
| static OTC_SDK_API void | clearCustomDataDirectory () |
| | Clears a previously set custom data directory for the SDK.
|
| |
| static OTC_SDK_API bool | setCalibrationFileSources (CalibrationFileSource first, CalibrationFileSource second, CalibrationFileSource third) |
| | Sets the priority of the calibration file sources.
|
| |
| static OTC_SDK_API void | setCalibrationFileSourceDirectory (const std::string &sourceDirectory) |
| | Sets the source directory from which calibration files can be copied.
|
| |
| static OTC_SDK_API void | clearCalibrationFileSourceDirectory () |
| | Clears a previously set source directory for calibration files.
|
| |
| static OTC_SDK_API VersionInfo | getVersionInfo () |
| | Returns an object holding version and build information about the SDK.
|
| |
| static OTC_SDK_API void | loadPalettes () |
| | Loads palettes from the SDK and user palette directories.
|
| |
| static OTC_SDK_API void | loadPalettes (const std::string &directory) |
| | Loads palettes from a custom directory.
|
| |
| static OTC_SDK_API std::vector< std::string > | getPaletteNames () |
| | Returns the names of all currently loaded palettes in sorted order.
|
| |
| static OTC_SDK_API std::vector< std::array< uint8_t, 3 > > | getPaletteColors (const std::string &name) |
| | Returns the 240 RGB color entries of the named palette.
|
| |
| static OTC_SDK_API void | registerPalette (const std::string &name, const std::vector< std::array< uint8_t, 3 > > &colors) |
| | Registers a palette at runtime without persisting it to disk.
|
| |
| static OTC_SDK_API void | savePalette (const std::string &name) |
| | Saves a registered palette as a CSV file in the user palette directory.
|
| |
Static class granting access to SDK wide configuration and utility functions.
◆ LogCallback
Callback function type for receiving SDK log messages.
- Parameters
-
| verbosityLevel | 0=Error, 1=Warning, 2=Info, 3=Debug, 4=Trace. |
| message | the log message text. |
◆ clearCalibrationFileSourceDirectory()
| static OTC_SDK_API void optris::Sdk::clearCalibrationFileSourceDirectory |
( |
| ) |
|
|
static |
Clears a previously set source directory for calibration files.
When cleared, the SDK will skip the CalibrationFileSource::Filesystem option when acquiring calibration files.
◆ clearCustomDataDirectory()
| static OTC_SDK_API void optris::Sdk::clearCustomDataDirectory |
( |
| ) |
|
|
static |
Clears a previously set custom data directory for the SDK.
Once cleared the SDK reverts to the default user data directory:
- Linux
~/.config/optris/
- Windows
<User AppData>/Roaming/Imager/
- Exceptions
-
| SDKException | if there is an active device connection or if the default user data directory path could not be determined. |
◆ configureLogger()
Configures the SDK internal logger.
If you change the logFilenamePrefix from the one used in Sdk::init() or in a previous call to Sdk::configure(), the current log file will be closed and new one will be created.
- Parameters
-
| [in] | logScreen | defines the minimum verbosity level of log messages displayed on the standard output and error. |
| [in] | logFile | defines the minimum verbosity level of log messages out to the logfile. |
| [in] | logFilenamePrefix | for the log file <logFilenamePrefix>_<YYYY_MM_DDThh-mm-ss>.log. If empty, it defaults to "OtcSDK". |
◆ getPaletteColors()
| static OTC_SDK_API std::vector< std::array< uint8_t, 3 > > optris::Sdk::getPaletteColors |
( |
const std::string & | name | ) |
|
|
static |
Returns the 240 RGB color entries of the named palette.
Each entry is an array of three bytes: { R, G, B }.
- Parameters
-
| [in] | name | palette name (case-sensitive). |
- Returns
- vector of 240 RGB triples.
- Exceptions
-
◆ getPaletteNames()
| static OTC_SDK_API std::vector< std::string > optris::Sdk::getPaletteNames |
( |
| ) |
|
|
static |
Returns the names of all currently loaded palettes in sorted order.
- Returns
- sorted list of palette name strings.
◆ getVersionInfo()
Returns an object holding version and build information about the SDK.
- Returns
- object holding version and build information about the SDK.
◆ init()
| static OTC_SDK_API void optris::Sdk::init |
( |
Verbosity | logScreen, |
|
|
Verbosity | logFile, |
|
|
std::string | logFilenamePrefix = "", |
|
|
std::string | customDataDirectory = "" ) |
|
static |
Initializes the SDK.
It sets the verbosity levels of the internal logger of the SDK, starts the EnumerationManager in a dedicated thread to monitor the availability of devices, and loads color palettes from the SDK, working, and user palette directories.
- Parameters
-
| [in] | logScreen | defines the minimum verbosity level of log messages displayed on the standard output and error. |
| [in] | logFile | defines the minimum verbosity level of log messages out to the logfile. |
| [in] | logFilenamePrefix | for the log file <logFilenamePrefix>_<YYYY_MM_DDThh-mm-ss>.log. If empty, it defaults to "OtcSDK". |
| [in] | customDataDirectory | for the SDK to use. An empty string will have no effect. The SDK requires read and write access to this directory. For detail on how specify it see Sdk::setCustomDataDirectory(). |
◆ loadPalettes() [1/2]
Loads palettes from the SDK and user palette directories.
Scans the SDK data directory first, then the user data directory so that user-supplied palettes with the same name override the built-in ones. Missing directories are silently skipped.
This method is idempotent — calling it more than once reloads all palettes from disk, replacing any previously registered entries.
◆ loadPalettes() [2/2]
| static OTC_SDK_API void optris::Sdk::loadPalettes |
( |
const std::string & | directory | ) |
|
|
static |
Loads palettes from a custom directory.
Adds or overwrites palette entries in the registry without clearing previously loaded palettes.
When specifying the directory path the following symbols/variables are supported:
~, %USERPROFILE% refer to ~/ on Linux and <User Home>/ on Windows.
%APPDATA% refers to ~/.config/ on Linux and <User AppData>/Roaming/ on Windows.
Relative paths are not supported. You can either use / as system independet directory separator or utilize system dependent ones like / for Linux and \ on Windows.
- Parameters
-
| [in] | directory | path to scan for .csv palette files. |
- Exceptions
-
| SDKException | if directory does not exist or is not a directory. |
◆ registerPalette()
| static OTC_SDK_API void optris::Sdk::registerPalette |
( |
const std::string & | name, |
|
|
const std::vector< std::array< uint8_t, 3 > > & | colors ) |
|
static |
Registers a palette at runtime without persisting it to disk.
An existing palette with the same name is overwritten.
- Parameters
-
| [in] | name | unique palette name. |
| [in] | colors | exactly 240 RGB triples { R, G, B }. |
- Exceptions
-
◆ savePalette()
| static OTC_SDK_API void optris::Sdk::savePalette |
( |
const std::string & | name | ) |
|
|
static |
Saves a registered palette as a CSV file in the user palette directory.
The output filename is <name>.csv. The user palette directory is created automatically if it does not exist.
- Parameters
-
| [in] | name | palette name to save (case-sensitive). |
- Exceptions
-
| SDKException | if the palette is not found or the file cannot be written. |
◆ setCalibrationFileSourceDirectory()
| static OTC_SDK_API void optris::Sdk::setCalibrationFileSourceDirectory |
( |
const std::string & | sourceDirectory | ) |
|
|
static |
Sets the source directory from which calibration files can be copied.
When specifying the directory path the following symbols/variables are supported:
~, %USERPROFILE% refer to ~/ on Linux and <User Home>/ on Windows.
%APPDATA% refers to ~/.config/ on Linux and <User AppData>/Roaming/ on Windows.
Relative paths are not supported. You can either use / as system independet directory separator or utilize system dependent ones like / for Linux and \ on Windows.
- Parameters
-
| [in] | sourceDirectory | from which calibration files can be copied. An empty string will have no effect. |
- Exceptions
-
| SDKException | if the given path does not exist or is not a directory. |
◆ setCalibrationFileSources()
Sets the priority of the calibration file sources.
The priority of the sources needs to be set prior to connecting to a device. If you want to use less than three potential calibration file source, set the one you do not require to Empty. The different sources have individual requirements for them to work:
- Device. Not all types of Optris cameras have their calibration files stored on-device.
- Filesystem. The source directory should be accessible and the SDK should have the rights to copy the calibration files from it to their target destination. The source directory needs to be specified via the Sdk::setCalibrationFileSourceDirectory() method.
- Internet. Access to the internet is required.
- Note
- The SDK does not yet feature the ability to download the calibration from the device.
- Parameters
-
| [in] | first | source with the highest priority. |
| [in] | second | source with a medium priority. |
| [in] | third | source with the lowest priority. |
- Returns
- true, if priority was successfully set. False, otherwise.
◆ setCustomDataDirectory()
| static OTC_SDK_API void optris::Sdk::setCustomDataDirectory |
( |
const std::string & | customDataDirectory | ) |
|
|
static |
Sets a custom data directory for the SDK to use.
- Attention
- A custom data directory can only be set when there are no active device connections.
If the given directory does not exist, the SDK will try to create it (recursively).
When specifying the directory path the following symbols/variables are supported:
~, %USERPROFILE% refer to ~/ on Linux and <User Home>/ on Windows.
%APPDATA% refers to ~/.config/ on Linux and <User AppData>/Roaming/ on Windows.
Relative paths are not supported. You can either use / as system independet directory separator or utilize system dependent ones like / for Linux and \ on Windows.
- Parameters
-
| [in] | customDataDirectory | for the SDK to use. An empty string will have no effect. The SDK requires read and write permission to this directory. |
- Exceptions
-
| SDKException | if
- there is an active device connection.
- the given path is not a directory.
- the SDK can not access the directory
- the SDK failed to create the directory.
|
◆ setLogCallback()
Sets a callback that receives SDK log messages.
- Parameters
-
| [in] | callback | function pointer to invoke on each log message, or nullptr to remove. |
| [in] | exclusive | when true, disables file and screen output while the callback is active. |
The documentation for this class was generated from the following file: