nx_metadata_sdk 1.0 Metadata 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/interface.h>
6 #include <nx/sdk/result.h>
7
8 #include <nx/sdk/i_string_map.h>
9 #include <nx/sdk/i_string.h>
10 #include <nx/sdk/i_plugin_diagnostic_event.h>
11 #include <nx/sdk/i_settings_response.h>
12
13 #include <nx/sdk/analytics/i_metadata_types.h>
14 #include <nx/sdk/analytics/i_metadata_packet.h>
15
16 namespace nx {
17 namespace sdk {
18 namespace analytics {
19
20 class IEngine; //< Forward declaration for the parent object.
21
33 class IDeviceAgent: public Interface<IDeviceAgent>
34 {
35 public:
36 static auto interfaceId() { return makeId("nx::sdk::analytics::IDeviceAgent"); }
37
38 class IHandler: public Interface<IHandler>
39 {
40 public:
41 static auto interfaceId() { return makeId("nx::sdk::analytics::IDeviceAgent::IHandler"); }
42
43 virtual ~IHandler() = default;
44 virtual void handleMetadata(IMetadataPacket* metadataPacket) = 0;
45 virtual void handlePluginDiagnosticEvent(IPluginDiagnosticEvent* event) = 0;
46 };
47
62 protected: virtual void doSetSettings(
63 Result<const IStringMap*>* outResult, const IStringMap* settings) = 0;
64 public: Result<const IStringMap*> setSettings(const IStringMap* settings)
65 {
66 Result<const IStringMap*> result;
67 doSetSettings(&result, settings);
68 return result;
69 }
70
84 protected: virtual void getPluginSideSettings(
85 Result<const ISettingsResponse*>* outResult) const = 0;
86 public: Result<const ISettingsResponse*> pluginSideSettings() const
87 {
88 Result<const ISettingsResponse*> result;
89 getPluginSideSettings(&result);
90 return result;
91 }
92
98 protected: virtual void getManifest(Result<const IString*>* outResult) const = 0;
99 public: Result<const IString*> manifest() const
100 {
101 Result<const IString*> result;
102 getManifest(&result);
103 return result;
104 }
105
112 virtual void setHandler(IHandler* handler) = 0;
113
120 protected: virtual void doSetNeededMetadataTypes(
121 Result<void>* outResult, const IMetadataTypes* neededMetadataTypes) = 0;
122 public: Result<void> setNeededMetadataTypes(const IMetadataTypes* neededMetadataTypes)
123 {
124 Result<void> result;
125 doSetNeededMetadataTypes(&result, neededMetadataTypes);
126 return result;
127 }
128 };
129
130 } // namespace analytics
131 } // namespace sdk
132 } // namespace nx
nx::sdk::IPluginDiagnosticEvent
Definition: i_plugin_diagnostic_event.h:14
nx::sdk::analytics::IDeviceAgent::doSetSettings
virtual void doSetSettings(Result< const IStringMap *> *outResult, const IStringMap *settings)=0
nx::sdk::IStringMap
Definition: i_string_map.h:10
nx::sdk::analytics::IMetadataPacket
Definition: i_metadata_packet.h:16
nx::sdk::Interface
Definition: interface.h:28
nx::sdk::analytics::IDeviceAgent::IHandler
Definition: i_device_agent.h:38
nx::sdk::analytics::IDeviceAgent::setHandler
virtual void setHandler(IHandler *handler)=0
nx::sdk::analytics::IDeviceAgent::doSetNeededMetadataTypes
virtual void doSetNeededMetadataTypes(Result< void > *outResult, const IMetadataTypes *neededMetadataTypes)=0
nx::sdk::Result
Definition: result.h:47
nx::sdk::analytics::IDeviceAgent::getManifest
virtual void getManifest(Result< const IString *> *outResult) const =0
nx
Definition: apple_utils.h:6
nx::sdk::analytics::IDeviceAgent
Definition: i_device_agent.h:33
nx::sdk::analytics::IDeviceAgent::getPluginSideSettings
virtual void getPluginSideSettings(Result< const ISettingsResponse *> *outResult) const =0
nx::sdk::IRefCountable::makeId
static constexpr const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:78