nx_server_plugin_sdk 1.0 Server Plugin SDK

i_engine.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <nx/sdk/i_active_setting_changed_action.h>
6 #include <nx/sdk/i_active_setting_changed_response.h>
7 #include <nx/sdk/i_device_info.h>
8 #include <nx/sdk/i_integration_diagnostic_event.h>
9 #include <nx/sdk/i_settings_response.h>
10 #include <nx/sdk/i_string.h>
11 #include <nx/sdk/interface.h>
12 #include <nx/sdk/result.h>
13
14 #include "i_action.h"
15 #include "i_device_agent.h"
16 #include "i_engine_info.h"
17
18 namespace nx::sdk::analytics {
19
20 class IIntegration; //< Forward declaration for the parent object.
21
22 class IEngine0: public Interface<IEngine0>
23 {
24 public:
25 static auto interfaceId() { return makeId("nx::sdk::analytics::IEngine"); }
26
27 class IHandler: public Interface<IHandler>
28 {
29 public:
30 static auto interfaceId() { return makeId("nx::sdk::analytics::IEngine::IHandler"); }
31
32 virtual ~IHandler() = default;
33 virtual void handleIntegrationDiagnosticEvent(IIntegrationDiagnosticEvent* event) = 0;
34
36 virtual void pushManifest(const IString* manifest) = 0;
37 };
38
43 virtual void setEngineInfo(const IEngineInfo* engineInfo) = 0;
44
46 protected: virtual void doSetSettings(
47 Result<const ISettingsResponse*>* outResult, const IStringMap* settings) = 0;
63 public: Result<const ISettingsResponse*> setSettings(const IStringMap* settings)
64 {
65 Result<const ISettingsResponse*> result;
66 doSetSettings(&result, settings);
67 return result;
68 }
69
71 protected: virtual void getIntegrationSideSettings(
72 Result<const ISettingsResponse*>* outResult) const = 0;
84 public: Result<const ISettingsResponse*> integrationSideSettings() const
85 {
86 Result<const ISettingsResponse*> result;
87 getIntegrationSideSettings(&result);
88 return result;
89 }
90
92 protected: virtual void getManifest(Result<const IString*>* outResult) const = 0;
105 public: Result<const IString*> manifest() const
106 {
107 Result<const IString*> result;
108 getManifest(&result);
109 return result;
110 }
111
116 virtual bool isCompatible(const IDeviceInfo* deviceInfo) const = 0;
117
119 protected: virtual void doObtainDeviceAgent(
120 Result<IDeviceAgent*>* outResult, const IDeviceInfo* deviceInfo) = 0;
131 public: Result<IDeviceAgent*> obtainDeviceAgent(const IDeviceInfo* deviceInfo)
132 {
133 Result<IDeviceAgent*> result;
134 doObtainDeviceAgent(&result, deviceInfo);
135 return result;
136 }
137
139 protected: virtual void doExecuteAction(
140 Result<IAction::Result>* outResult, const IAction* action) = 0;
148 public: Result<IAction::Result> executeAction(const IAction* action)
149 {
150 Result<IAction::Result> result;
151 doExecuteAction(&result, action);
152 return result;
153 }
154
159 virtual void setHandler(IHandler* handler) = 0;
160 };
161
175 class IEngine: public Interface<IEngine, IEngine0>
176 {
177 public:
178 static auto interfaceId() { return makeId("nx::sdk::analytics::IEngine1"); }
179
181 protected: virtual void doGetSettingsOnActiveSettingChange(
182 Result<const IActiveSettingChangedResponse*>* outResult,
183 const IActiveSettingChangedAction* activeSettingChangedAction) = 0;
195 public: Result<const IActiveSettingChangedResponse*> getSettingsOnActiveSettingChange(
196 const IActiveSettingChangedAction* activeSettingChangedAction)
197 {
198 Result<const IActiveSettingChangedResponse*> result;
199 doGetSettingsOnActiveSettingChange(&result, activeSettingChangedAction);
200 return result;
201 }
202 };
203 using IEngine1 = IEngine;
204
205 } // namespace nx::sdk::analytics
nx::sdk::analytics::IEngine0::executeAction
Result< IAction::Result > executeAction(const IAction *action)
Definition: i_engine.h:148
nx::sdk::analytics::IEngine0::setEngineInfo
virtual void setEngineInfo(const IEngineInfo *engineInfo)=0
nx::sdk::IStringMap
Definition: i_string_map.h:9
nx::sdk::analytics::IEngine0::doExecuteAction
virtual void doExecuteAction(Result< IAction::Result > *outResult, const IAction *action)=0
nx::sdk::IActiveSettingChangedAction
Definition: i_active_setting_changed_action.h:14
nx::sdk::analytics::IEngine0::IHandler::pushManifest
virtual void pushManifest(const IString *manifest)=0
nx::sdk::analytics::IEngine0::doSetSettings
virtual void doSetSettings(Result< const ISettingsResponse *> *outResult, const IStringMap *settings)=0
nx::sdk::Interface
Definition: interface.h:48
nx::sdk::analytics::IAction
Definition: i_action.h:17
nx::sdk::analytics::IEngine0::setSettings
Result< const ISettingsResponse * > setSettings(const IStringMap *settings)
Definition: i_engine.h:63
nx::sdk::analytics::IEngine0::getIntegrationSideSettings
virtual void getIntegrationSideSettings(Result< const ISettingsResponse *> *outResult) const =0
nx::sdk::analytics::IEngine0::manifest
Result< const IString * > manifest() const
Definition: i_engine.h:105
nx::sdk::analytics::IEngine0::IHandler
Definition: i_engine.h:27
nx::sdk::analytics::IEngine0::setHandler
virtual void setHandler(IHandler *handler)=0
nx::sdk::analytics::IEngine
Definition: i_engine.h:175
nx::sdk::analytics::IEngine0::integrationSideSettings
Result< const ISettingsResponse * > integrationSideSettings() const
Definition: i_engine.h:84
nx::sdk::analytics
Definition: consuming_device_agent.cpp:25
nx::sdk::IString
Definition: i_string.h:9
nx::sdk::IDeviceInfo
Definition: i_device_info.h:13
nx::sdk::Result
Definition: result.h:52
nx::sdk::analytics::IEngineInfo
Definition: i_engine_info.h:10
nx::sdk::analytics::IEngine::getSettingsOnActiveSettingChange
Result< const IActiveSettingChangedResponse * > getSettingsOnActiveSettingChange(const IActiveSettingChangedAction *activeSettingChangedAction)
Definition: i_engine.h:195
nx::sdk::IIntegrationDiagnosticEvent
Definition: i_integration_diagnostic_event.h:13
nx::sdk::analytics::IEngine0::doObtainDeviceAgent
virtual void doObtainDeviceAgent(Result< IDeviceAgent *> *outResult, const IDeviceInfo *deviceInfo)=0
nx::sdk::analytics::IEngine::doGetSettingsOnActiveSettingChange
virtual void doGetSettingsOnActiveSettingChange(Result< const IActiveSettingChangedResponse *> *outResult, const IActiveSettingChangedAction *activeSettingChangedAction)=0
nx::sdk::analytics::IEngine0::getManifest
virtual void getManifest(Result< const IString *> *outResult) const =0
nx::sdk::analytics::IEngine0::obtainDeviceAgent
Result< IDeviceAgent * > obtainDeviceAgent(const IDeviceInfo *deviceInfo)
Definition: i_engine.h:131
nx::sdk::analytics::IEngine0::isCompatible
virtual bool isCompatible(const IDeviceInfo *deviceInfo) const =0
nx::sdk::analytics::IEngine0
Definition: i_engine.h:22
nx::sdk::IRefCountable::makeId
static const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:77