nx_metadata_sdk 1.0 Metadata SDK

Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
nx::sdk::analytics::IEngine Class Referenceabstract

`#include <i_engine.h>`

Inheritance diagram for nx::sdk::analytics::IEngine:

## Classes
class | IHandler

## Public Member Functions
virtual void | setEngineInfo (const IEngineInfo *engineInfo)=0
Result< const IStringMap * > | setSettings (const IStringMap *settings)
Result< const ISettingsResponse * > | pluginSideSettings () const
Result< const IString * > | manifest () const
virtual bool | isCompatible (const IDeviceInfo *deviceInfo) const =0
Result< IDeviceAgent * > | obtainDeviceAgent (const IDeviceInfo *deviceInfo)
Result< IAction::Result > | executeAction (const IAction *action)
virtual void | setHandler (IHandler *handler)=0
Public Member Functions inherited from nx::sdk::Interface< IEngine >
virtual IRefCountable * | queryInterface (const InterfaceId *id)
Ptr< Interface > | queryInterface ()
Ptr< const Interface > | queryInterface () const
Public Member Functions inherited from nx::sdk::IRefCountable
virtual | ~IRefCountable ()=default
template<class Interface >
Ptr< Interface > | queryInterface ()
template<class Interface >
Ptr< const Interface > | queryInterface () const
virtual int | addRef () const =0
virtual int | releaseRef () const =0
int | refCountThreadUnsafe () const

## Static Public Member Functions
static auto | interfaceId ()
Static Public Member Functions inherited from nx::sdk::IRefCountable
static auto | interfaceId ()

## Protected Member Functions
virtual void | doSetSettings (Result< const IStringMap *> *outResult, const IStringMap *settings)=0
virtual void | getPluginSideSettings (Result< const ISettingsResponse *> *outResult) const =0
virtual void | getManifest (Result< const IString *> *outResult) const =0
virtual void | doObtainDeviceAgent (Result< IDeviceAgent *> *outResult, const IDeviceInfo *deviceInfo)=0
virtual void | doExecuteAction (Result< IAction::Result > *outResult, const IAction *action)=0
Protected Member Functions inherited from nx::sdk::Interface< IEngine >
virtual IRefCountable * | queryInterface (const IRefCountable::InterfaceId *id) override
IRefCountable * | queryInterfaceSupportingDeprecatedId (const IRefCountable::InterfaceId *id, const Uuid &deprecatedInterfaceId)

## Additional Inherited Members
Static Protected Member Functions inherited from nx::sdk::IRefCountable
template<int len>
static constexpr const InterfaceId * | makeId (const char(&charArray)[len])
template<class TemplateInstance , class TemplateArg , int len>
static const InterfaceId * | makeIdForTemplate (const char(&baseIdCharArray)[len])

## Detailed Description

Main interface for an Analytics Engine instance. The instances are created by a Mediaserver via calling analytics::IPlugin::createEngine() typically on Mediaserver start (or when a new Engine is created by the system administrator), and destroyed (via releaseRef()) on Mediaserver shutdown (or when an existing Engine is deleted by the system administrator).

For the VMS end user, each Engine instance is perceived as an independent Analytics Engine which has its own set of values of settings stored in the Mediaserver database.

All methods are guaranteed to be called without overlapping even if from different threads (i.e. with a guaranteed barrier between the calls), thus, no synchronization is required for the implementation.

## Member Function Documentation

## ◆ doExecuteAction()

virtual void nx::sdk::analytics::IEngine::doExecuteAction | ( | Result< IAction::Result > * | outResult,
|  | const IAction * | action
| ) |  |
| protected pure virtual

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

Parameters

  action | Provides data for the action such as metadata object for which the action has been triggered, and a means for reporting back action results to Server. This object should not be used after returning from this function.

## ◆ doObtainDeviceAgent()

virtual void nx::sdk::analytics::IEngine::doObtainDeviceAgent | ( | Result< IDeviceAgent *> * | outResult,
|  | const IDeviceInfo * | deviceInfo
| ) |  |
| protected pure virtual

Creates, or returns an already existing, a DeviceAgent instance intended to work with the given device.

Parameters

  deviceInfo | Information about the device for which a DeviceAgent should be created.

Returns
  Pointer to an object that implements IDeviceAgent interface or null if a DeviceAgent for this particular Device makes no sense (e.g. if the Device supports no Analytics Events and Objects).

## ◆ doSetSettings()

virtual void nx::sdk::analytics::IEngine::doSetSettings | ( | Result< const IStringMap *> * | outResult,
|  | const IStringMap * | settings
| ) |  |
| protected pure virtual

Called after `setEngineInfo()` and before all other methods. Server provides the set of settings stored in its database, combined with the values received from the plugin via pluginSideSettings() (if any), for this Engine instance.

Parameters

  settings | Values of settings declared in the manifest. Never null.

Returns
  Result containing a map of errors that occurred while applying each setting - the keys are the setting ids, and the values are human readable error strings in English. Even if some settings can't be applied or an error happens while applying them, this method must return a successful result with a corresponding map of errors. A faulty result containing error information instead of the map should be returned only in case of some general failure that affected the procedure of applying the settings. The result should contain null if no errors occurred.

## ◆ getManifest()

virtual void nx::sdk::analytics::IEngine::getManifest | ( | Result< const IString *> * | outResult | ) | const
| protected pure virtual

Provides a JSON manifest for this Engine instance. See the example of such manifest in stub_analytics_plugin. Can either be static (constant), or can be dynamically generated by this Engine based on its current state, including setting values received via setSettings(). After creation of this Engine instance, this method is called after setSettings(), but can be called again at any other moment to obtain the most actual manifest.

Returns
  JSON string in UTF-8.

## ◆ getPluginSideSettings()

virtual void nx::sdk::analytics::IEngine::getPluginSideSettings | ( | Result< const ISettingsResponse *> * | outResult | ) | const
| protected pure virtual

In addition to the settings stored in a Server database, an Engine can have some settings which are stored somewhere "under the hood" of the Engine, e.g. on a device acting as an Engine's backend. Such settings do not need to be explicitly marked in the Settings Model, but every time the Server offers the user to edit the values, it calls this method and merges the received values with the ones in its database.

Returns
  Result containing (in case of success) information about settings that are stored on the plugin side. Errors corresponding to the particular settings should be placed in the ISettingsResponse object. A faulty result must be returned only in case of a general failure that affects the settings retrieval procedure. The result should contain null if the Engine has no plugin-side settings.

## ◆ isCompatible()

virtual bool nx::sdk::analytics::IEngine::isCompatible | ( | const IDeviceInfo * | deviceInfo | ) | const
| pure virtual

Returns
  True if the Engine is able to create DeviceAgents for the provided device, false otherwise.

## ◆ setEngineInfo()

virtual void nx::sdk::analytics::IEngine::setEngineInfo | ( | const IEngineInfo * | engineInfo | ) |
| pure virtual

Called right after the Engine creation (before all other methods) or when some Engine-related change occurs on the Server side (e.g. Engine name is changed).

## ◆ setHandler()

virtual void nx::sdk::analytics::IEngine::setHandler | ( | IHandler * | handler | ) |
| pure virtual

Parameters

  handler | Generic Engine-related events (errors, warning, info messages) might be reported via this handler.

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

- src/nx/sdk/analytics/i_engine.h