nx_server_plugin_sdk 1.0 Server Plugin SDK

i_device_agent.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/analytics/i_metadata_packet.h>
6 #include <nx/sdk/analytics/i_metadata_types.h>
7 #include <nx/sdk/i_integration_diagnostic_event.h>
8 #include <nx/sdk/i_settings_response.h>
9 #include <nx/sdk/i_string.h>
10 #include <nx/sdk/i_string_map.h>
11 #include <nx/sdk/interface.h>
12 #include <nx/sdk/result.h>
13
14 namespace nx::sdk::analytics {
15
16 class IEngine; //< Forward declaration for the parent object.
17
29 class IDeviceAgent: public Interface<IDeviceAgent>
30 {
31 public:
32 static auto interfaceId() { return makeId("nx::sdk::analytics::IDeviceAgent"); }
33
34 class IHandler0: public Interface<IHandler0>
35 {
36 public:
37 static auto interfaceId() { return makeId("nx::sdk::analytics::IDeviceAgent::IHandler"); }
38
39 virtual ~IHandler0() = default;
40
49 virtual void handleMetadata(IMetadataPacket* metadataPacket) = 0;
50
51 virtual void handleIntegrationDiagnosticEvent(IIntegrationDiagnosticEvent* event) = 0;
52 };
53
58 class IHandler: public Interface<IHandler, IHandler0>
59 {
60 public:
61 static auto interfaceId() { return makeId("nx::sdk::analytics::IDeviceAgent::IHandler1"); }
62
64 virtual void pushManifest(const IString* manifest) = 0;
65 };
66
68 protected: virtual void doSetSettings(
69 Result<const ISettingsResponse*>* outResult, const IStringMap* settings) = 0;
91 public: Result<const ISettingsResponse*> setSettings(const IStringMap* settings)
92 {
93 Result<const ISettingsResponse*> result;
94 doSetSettings(&result, settings);
95 return result;
96 }
97
99 protected: virtual void getIntegrationSideSettings(
100 Result<const ISettingsResponse*>* outResult) const = 0;
112 public: Result<const ISettingsResponse*> integrationSideSettings() const
113 {
114 Result<const ISettingsResponse*> result;
115 getIntegrationSideSettings(&result);
116 return result;
117 }
118
120 protected: virtual void getManifest(Result<const IString*>* outResult) const = 0;
128 public: Result<const IString*> manifest() const
129 {
130 Result<const IString*> result;
131 getManifest(&result);
132 return result;
133 }
134
141 virtual void setHandler(IHandler* handler) = 0;
142
144 protected: virtual void doSetNeededMetadataTypes(
145 Result<void>* outResult, const IMetadataTypes* neededMetadataTypes) = 0;
152 public: Result<void> setNeededMetadataTypes(const IMetadataTypes* neededMetadataTypes)
153 {
154 Result<void> result;
155 doSetNeededMetadataTypes(&result, neededMetadataTypes);
156 return result;
157 }
158 };
159 using IDeviceAgent0 = IDeviceAgent;
160
161 } // namespace nx::sdk::analytics
nx::sdk::analytics::IDeviceAgent::IHandler0::handleMetadata
virtual void handleMetadata(IMetadataPacket *metadataPacket)=0
nx::sdk::IStringMap
Definition: i_string_map.h:9
nx::sdk::analytics::IMetadataPacket
Definition: i_metadata_packet.h:13
nx::sdk::analytics::IDeviceAgent::IHandler0
Definition: i_device_agent.h:34
nx::sdk::Interface
Definition: interface.h:48
nx::sdk::analytics::IDeviceAgent::IHandler
Definition: i_device_agent.h:58
nx::sdk::analytics::IDeviceAgent::setHandler
virtual void setHandler(IHandler *handler)=0
nx::sdk::analytics
Definition: consuming_device_agent.cpp:25
nx::sdk::analytics::IMetadataTypes
Definition: i_metadata_types.h:10
nx::sdk::analytics::IDeviceAgent::getIntegrationSideSettings
virtual void getIntegrationSideSettings(Result< const ISettingsResponse *> *outResult) const =0
nx::sdk::Result< void >
Definition: result.h:86
nx::sdk::analytics::IDeviceAgent::doSetNeededMetadataTypes
virtual void doSetNeededMetadataTypes(Result< void > *outResult, const IMetadataTypes *neededMetadataTypes)=0
nx::sdk::IString
Definition: i_string.h:9
nx::sdk::analytics::IDeviceAgent::manifest
Result< const IString * > manifest() const
Definition: i_device_agent.h:128
nx::sdk::analytics::IDeviceAgent::IHandler::pushManifest
virtual void pushManifest(const IString *manifest)=0
nx::sdk::analytics::IDeviceAgent::setNeededMetadataTypes
Result< void > setNeededMetadataTypes(const IMetadataTypes *neededMetadataTypes)
Definition: i_device_agent.h:152
nx::sdk::Result
Definition: result.h:52
nx::sdk::analytics::IDeviceAgent::getManifest
virtual void getManifest(Result< const IString *> *outResult) const =0
nx::sdk::analytics::IDeviceAgent
Definition: i_device_agent.h:29
nx::sdk::analytics::IDeviceAgent::doSetSettings
virtual void doSetSettings(Result< const ISettingsResponse *> *outResult, const IStringMap *settings)=0
nx::sdk::IIntegrationDiagnosticEvent
Definition: i_integration_diagnostic_event.h:13
nx::sdk::analytics::IDeviceAgent::setSettings
Result< const ISettingsResponse * > setSettings(const IStringMap *settings)
Definition: i_device_agent.h:91
nx::sdk::analytics::IDeviceAgent::integrationSideSettings
Result< const ISettingsResponse * > integrationSideSettings() const
Definition: i_device_agent.h:112
nx::sdk::IRefCountable::makeId
static const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:77