nx_metadata_sdk  1.0
Metadata 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:
nx::sdk::RefCountable< IEngine > nx::vms_server_plugins::analytics::sample::Engine nx::vms_server_plugins::analytics::stub::best_shots::Engine nx::vms_server_plugins::analytics::stub::custom_metadata::Engine nx::vms_server_plugins::analytics::stub::diagnostic_events::Engine nx::vms_server_plugins::analytics::stub::events::Engine nx::vms_server_plugins::analytics::stub::motion_metadata::Engine nx::vms_server_plugins::analytics::stub::object_actions::Engine nx::vms_server_plugins::analytics::stub::object_detection::Engine nx::vms_server_plugins::analytics::stub::object_streamer::Engine nx::vms_server_plugins::analytics::stub::roi::Engine nx::vms_server_plugins::analytics::stub::sdk_features::Engine nx::vms_server_plugins::analytics::stub::settings::Engine nx::vms_server_plugins::analytics::stub::special_objects::Engine nx::vms_server_plugins::analytics::stub::taxonomy_features::Engine nx::vms_server_plugins::analytics::stub::video_frames::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
 
RefCountableoperator= (const RefCountable &)=delete
 
RefCountableoperator= (RefCountable &&)=delete
 
virtual int addRef () const override
 
virtual int releaseRef () const override
 
int refCount () const
 

Protected Member Functions

 Engine (bool enableOutput, const std::string &pluginInstanceId="")
 
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::ResultexecuteAction (const std::string &actionId, Uuid objectTrackId, Uuid deviceId, int64_t timestampUs, Ptr< IObjectTrackInfo > trackInfo, const std::map< std::string, std::string > &params)
 
void pushPluginDiagnosticEvent (IPluginDiagnosticEvent::Level level, std::string caption, std::string description) const
 
IHandler * handler () const
 
virtual void doGetSettingsOnActiveSettingChange (Result< const IActiveSettingChangedResponse *> *outResult, const IActiveSettingChangedAction *activeSettingChangedAction) override
 
virtual void doSetSettings (Result< const ISettingsResponse *> *outResult, const IStringMap *settings) override
 
virtual void getPluginSideSettings (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 Analytics Plugin 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:


    #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 &  pluginInstanceId = "" 
)
protected
Parameters
enableOutputEnables NX_OUTPUT. Typically, use NX_DEBUG_ENABLE_OUTPUT as a value.
instanceIdMust be non-empty only for Plugins from multi-IPlugin 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
actionIdId of the Action being triggered.
objectTrackIdId of an Object Track for which the Action has been triggered.
deviceIdId of a Device (e.g. a camera) from which the Action has been triggered.
timestampUsTimestamp of the object metadata for which the Action has been triggered.
paramsIf 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.

◆ pushPluginDiagnosticEvent()

void nx::sdk::analytics::Engine::pushPluginDiagnosticEvent ( IPluginDiagnosticEvent::Level  level,
std::string  caption,
std::string  description 
) const
protected

Sends a PluginDiagnosticEvent 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::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: