nx_server_plugin_sdk 1.0 Server Plugin SDK

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

`#include <consuming_device_agent.h>`

Inheritance diagram for nx::sdk::analytics::ConsumingDeviceAgent:

## Public Member Functions
virtual void | setHandler (IHandler *handler) override
Public Member Functions inherited from nx::sdk::RefCountable< IConsumingDeviceAgent >
| 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
| ConsumingDeviceAgent (const IDeviceInfo *deviceInfo, bool enableOutput, const std::string &integrationInstanceId="")
virtual std::string | manifestString () const =0
virtual bool | pushCompressedVideoFrame (Ptr< const ICompressedVideoPacket >)
virtual bool | pushUncompressedVideoFrame (Ptr< const IUncompressedVideoFrame >)
virtual bool | pushCustomMetadataPacket (Ptr< const ICustomMetadataPacket >)
virtual bool | pullMetadataPackets (std::vector< Ptr< IMetadataPacket >> *)
void | pushMetadataPacket (Ptr< IMetadataPacket > metadataPacket)
void | pushIntegrationDiagnosticEvent (IIntegrationDiagnosticEvent::Level level, std::string caption, std::string description) const
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > | settingsReceived ()
std::string | settingValue (const std::string &settingName) const
std::map< std::string, std::string > | currentSettings () const
void | pushManifest (const std::string &pushManifest)
virtual void | finalize () override
virtual void | doGetSettingsOnActiveSettingChange (Result< const IActiveSettingChangedResponse *> *, const IActiveSettingChangedAction *) override
virtual void | doPushDataPacket (Result< void > *outResult, IDataPacket *dataPacket) override
virtual void | doSetSettings (Result< const ISettingsResponse *> *outResult, const IStringMap *settings) override
virtual void | getIntegrationSideSettings (Result< const ISettingsResponse *> *) const override
virtual void | getManifest (Result< const IString *> *outResult) const override
virtual void | doSetNeededMetadataTypes (Result< void > *, const IMetadataTypes *) override

## Protected Attributes
const LogUtils | logUtils

## Detailed Description

Base class for a typical implementation of DeviceAgent which receives a stream and sends back constructed metadata packets. Hides many technical details of Analytics SDK, but may limit DeviceAgent 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

## ◆ ConsumingDeviceAgent()

nx::sdk::analytics::ConsumingDeviceAgent::ConsumingDeviceAgent | ( | const IDeviceInfo * | deviceInfo,
|  | bool | enableOutput,
|  | const std::string & | integrationInstanceId = `""`
| ) |  |
| protected

Parameters

  enableOutput | Specifies whether NX_OUTPUT macros called from the implementation of this class will produce the actual output. It is recommended to specify NX_DEBUG_ENABLE_OUTPUT as a value of this argument, which will take the actual value from the plugin's .ini file.
  integrationInstanceId | Must be non-empty only for Plugins from multi-IIntegration libraries.

## Member Function Documentation

## ◆ pullMetadataPackets()

virtual bool nx::sdk::analytics::ConsumingDeviceAgent::pullMetadataPackets | ( | std::vector< Ptr< IMetadataPacket >> * |  | ) |
| inline protected virtual

Override to send the newly constructed metadata packets to Server - add the packets to the provided list. Called after pushVideoFrame() to retrieve any metadata packets available to the moment (not necessarily referring to that frame). As an alternative, send metadata to Server by calling pushMetadataPacket() instead of implementing this method.

## ◆ pushCompressedVideoFrame()

virtual bool nx::sdk::analytics::ConsumingDeviceAgent::pushCompressedVideoFrame | ( | Ptr< const ICompressedVideoPacket > |  | ) |
| inline protected virtual

Override to accept next compressed video frame for processing. Should not block the caller thread for long.

Parameters

  videoFrame | Contains a pointer to the compressed video frame raw bytes.

Reimplemented in nx::vms_server_plugins::analytics::stub::special_objects::DeviceAgent, nx::vms_server_plugins::analytics::stub::video_frames::DeviceAgent, nx::vms_server_plugins::analytics::stub::motion_metadata::DeviceAgent, nx::vms_server_plugins::analytics::stub::object_detection::DeviceAgent, nx::vms_server_plugins::analytics::stub::best_shots::DeviceAgent, nx::vms_server_plugins::analytics::stub::object_streamer::DeviceAgent, nx::vms_server_plugins::analytics::stub::error_reporting::DeviceAgent, nx::vms_server_plugins::analytics::stub::taxonomy_features::DeviceAgent, nx::vms_server_plugins::analytics::sample::DeviceAgent, nx::vms_server_plugins::analytics::stub::http_requests::DeviceAgent, and nx::vms_server_plugins::analytics::stub::object_actions::DeviceAgent.

## ◆ pushCustomMetadataPacket()

virtual bool nx::sdk::analytics::ConsumingDeviceAgent::pushCustomMetadataPacket | ( | Ptr< const ICustomMetadataPacket > |  | ) |
| inline protected virtual

Override to accept next custom metadata for processing.

Parameters

  customMetadataPacket | Contains a pointer to the custom metadata packet.

Reimplemented in nx::vms_server_plugins::analytics::stub::custom_metadata::DeviceAgent.

## ◆ pushIntegrationDiagnosticEvent()

void nx::sdk::analytics::ConsumingDeviceAgent::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.

## ◆ pushMetadataPacket()

void nx::sdk::analytics::ConsumingDeviceAgent::pushMetadataPacket | ( | Ptr< IMetadataPacket > | metadataPacket | ) |
| protected

Sends a newly constructed metadata packet to Server. Can be called at any time, from any thread. As an alternative, send metadata to Server by implementing pullMetadataPackets().

## ◆ pushUncompressedVideoFrame()

virtual bool nx::sdk::analytics::ConsumingDeviceAgent::pushUncompressedVideoFrame | ( | Ptr< const IUncompressedVideoFrame > |  | ) |
| inline protected virtual

Override to accept next uncompressed video frame for processing.

Parameters

  videoFrame | Contains a pointer to the uncompressed video frame raw bytes.

Reimplemented in nx::vms_server_plugins::analytics::stub::video_frames::DeviceAgent.

## ◆ settingsReceived()

virtual nx::sdk::Result<const nx::sdk::ISettingsResponse*> nx::sdk::analytics::ConsumingDeviceAgent::settingsReceived | ( |  | ) |
| inline protected virtual

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 IDeviceAgent::setSettings().

Reimplemented in nx::vms_server_plugins::analytics::stub::special_objects::DeviceAgent, nx::vms_server_plugins::analytics::stub::error_reporting::DeviceAgent, nx::vms_server_plugins::analytics::stub::events::DeviceAgent, nx::vms_server_plugins::analytics::stub::video_frames::DeviceAgent, nx::vms_server_plugins::analytics::stub::diagnostic_events::DeviceAgent, nx::vms_server_plugins::analytics::stub::object_detection::DeviceAgent, nx::vms_server_plugins::analytics::stub::motion_metadata::DeviceAgent, nx::vms_server_plugins::analytics::stub::settings::DeviceAgent, nx::vms_server_plugins::analytics::stub::best_shots::DeviceAgent, nx::vms_server_plugins::analytics::stub::object_streamer::DeviceAgent, nx::vms_server_plugins::analytics::stub::taxonomy_features::DeviceAgent, and nx::vms_server_plugins::analytics::stub::http_requests::DeviceAgent.

## ◆ settingValue()

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

Provides access to the DeviceAgent settings stored by the Server for the particular Device.

ATTENTION: If settingsReceived() has not been called yet, it means that the DeviceAgent 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/consuming_device_agent.h
- src/nx/sdk/analytics/helpers/consuming_device_agent.cpp