nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nx::sdk::analytics::Engine Class Referenceabstract

`#include <engine.h>`

Inheritance diagram for nx::sdk::analytics::Engine:

## Public Member Functions
virtual void | setEngineInfo (const IEngineInfo *engineInfo) override
virtual void | setHandler (IEngine::IHandler *handler) override
virtual bool | isCompatible (const IDeviceInfo *deviceInfo) const override
Public Member Functions inherited from nx::sdk::RefCountable< IEngine >
| RefCountable (const RefCountable &)=delete
| RefCountable (RefCountable &&)=delete
RefCountable & | operator= (const RefCountable &)=delete
RefCountable & | operator= (RefCountable &&)=delete
virtual int | addRef () const override
virtual int | releaseRef () const override
int | refCount () const

## Protected Member Functions
| Engine (bool enableOutput, const std::string &integrationInstanceId="")
virtual std::string | manifestString () const =0
virtual Result< const ISettingsResponse * > | settingsReceived ()
std::string | settingValue (const std::string &settingName) const
std::map< std::string, std::string > | currentSettings () const
virtual Result< IAction::Result > | executeAction (const std::string &actionId, Uuid objectTrackId, Uuid deviceId, int64_t timestampUs, Ptr< IObjectTrackInfo > trackInfo, const std::map< std::string, std::string > &params)
void | pushIntegrationDiagnosticEvent (IIntegrationDiagnosticEvent::Level level, std::string caption, std::string description) const
IHandler * | handler () const
virtual void | doGetSettingsOnActiveSettingChange (Result< const IActiveSettingChangedResponse *> *outResult, const IActiveSettingChangedAction *activeSettingChangedAction) override
void | pushManifest (const std::string &manifest)
virtual void | doSetSettings (Result< const ISettingsResponse *> *outResult, const IStringMap *settings) override
virtual void | getIntegrationSideSettings (Result< const ISettingsResponse *> *outResult) const override
virtual void | getManifest (Result< const IString *> *outResult) const override
virtual void | doExecuteAction (Result< IAction::Result > *outResult, const IAction *action) override

## Protected Attributes
LogUtils | logUtils

## Detailed Description

Base class for a typical implementation of an Analytics Engine. Hides many technical details of the SDK, but may limit plugin capabilities - use only when suitable.

To use NX_PRINT/NX_OUTPUT in a derived class with the prefix defined by this class, add the following to the derived class .cpp:

        #undef NX_PRINT_PREFIX
        #define NX_PRINT_PREFIX (this->logUtils.printPrefix)
        #include <nx/kit/debug.h>

## Constructor & Destructor Documentation

## ◆ Engine()

nx::sdk::analytics::Engine::Engine | ( | bool | enableOutput,
|  | const std::string & | integrationInstanceId = `""`
| ) |  |
| protected

Parameters

  enableOutput | Enables NX_OUTPUT. Typically, use NX_DEBUG_ENABLE_OUTPUT as a value.
  integrationInstanceId | Must be non-empty only for Plugins from multi-IIntegration libraries.

## Member Function Documentation

## ◆ currentSettings()

std::map< std::string, std::string > nx::sdk::analytics::Engine::currentSettings | ( |  | ) | const
| protected

Provides access to the Engine global settings stored by the Server.

ATTENTION: If settingsReceived() has not been called yet, it means that the Engine has not received its settings from the Server yet, and thus this method will yield empty values.

Returns
  Current settings.

## ◆ executeAction()

Result< IAction::Result > nx::sdk::analytics::Engine::executeAction | ( | const std::string & | actionId,
|  | Uuid | objectTrackId,
|  | Uuid | deviceId,
|  | int64_t | timestampUs,
|  | Ptr< IObjectTrackInfo > | trackInfo,
|  | const std::map< std::string, std::string > & | params
| ) |  |
| protectedvirtual

Action handler. Called when some Action defined by this Engine is triggered by the Server.

Parameters

  actionId | Id of the Action being triggered.
  objectTrackId | Id of an Object Track for which the Action has been triggered.
  deviceId | Id of a Device (e.g. a camera) from which the Action has been triggered.
  timestampUs | Timestamp of the object metadata for which the Action has been triggered.
  params | If the Engine manifest defines params for the Action being triggered, contains their values after they are filled by the user via the Client form. Otherwise, empty.

Reimplemented in nx::vms_server_plugins::analytics::stub::special_objects::Engine, and nx::vms_server_plugins::analytics::stub::object_actions::Engine.

## ◆ pushIntegrationDiagnosticEvent()

void nx::sdk::analytics::Engine::pushIntegrationDiagnosticEvent | ( | IIntegrationDiagnosticEvent::Level | level,
|  | std::string | caption,
|  | std::string | description
| ) |  | const
| protected

Sends an IntegrationDiagnosticEvent to the Server. Can be called from any thread, but if called before settingsReceived() was called, will be ignored in case setHandler() was not called yet.

## ◆ settingsReceived()

virtual Result<const ISettingsResponse*> nx::sdk::analytics::Engine::settingsReceived | ( |  | ) |
| inlineprotectedvirtual

Called when the settings are received from the Server, even if the values are not changed. Should perform any required (re)initialization. Called even if the settings model is empty.

Returns
  Error messages per setting (if any), as in IEngine::setSettings().

Reimplemented in nx::vms_server_plugins::analytics::stub::error_reporting::Engine, nx::vms_server_plugins::analytics::stub::diagnostic_events::Engine, and nx::vms_server_plugins::analytics::stub::settings::Engine.

## ◆ settingValue()

std::string nx::sdk::analytics::Engine::settingValue | ( | const std::string & | settingName | ) | const
| protected

Provides access to the Engine global settings stored by the Server.

ATTENTION: If settingsReceived() has not been called yet, it means that the Engine has not received its settings from the Server yet, and thus this method will yield empty values.

Returns
  Setting value, or an empty string if such setting does not exist, having logged the error.

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

- src/nx/sdk/analytics/helpers/engine.h
- src/nx/sdk/analytics/helpers/engine.cpp