nx_metadata_sdk 1.0 Metadata SDK

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 <vector>
6
7 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
8 #include <nx/sdk/analytics/i_object_metadata_packet.h>
9
10 #include "engine.h"
11
12 namespace nx::vms_server_plugins::analytics::stub::http_requests {
13
14 class DeviceAgent: public nx::sdk::analytics::ConsumingDeviceAgent
15 {
16 public:
17 DeviceAgent(Engine* engine, const nx::sdk::IDeviceInfo* deviceInfo);
18 virtual ~DeviceAgent() override;
19
20 protected:
21 virtual std::string manifestString() const override;
22
23 virtual bool pushCompressedVideoFrame(
24 const nx::sdk::analytics::ICompressedVideoPacket* videoFrame) override;
25
26 virtual void doSetNeededMetadataTypes(
27 nx::sdk::Result<void>* outValue,
28 const nx::sdk::analytics::IMetadataTypes* neededMetadataTypes) override;
29
30 virtual nx::sdk::Result<const nx::sdk::ISettingsResponse*> settingsReceived() override;
31
32 private:
33 struct HttpRequestContext
34 {
35 nx::sdk::IUtilityProvider4::HttpDomainName domain =
36 nx::sdk::IUtilityProvider4::HttpDomainName::vms;
37 std::string url = "/rest/v1/system/settings";
38 std::string httpMethod = "GET";
39 std::string mimeType;
40 std::string requestBody;
41 int64_t periodSeconds = 1;
42 };
43
44 private:
45 int64_t m_lastFrameTimestampUs = 0;
46 int64_t m_lastEventTimestampUs = 0;
47 HttpRequestContext m_requestContext;
48 Engine* const m_engine;
49 };
50
51 } // namespace nx::vms_server_plugins::analytics::stub::http_requests
nx::vms_server_plugins::analytics::stub::http_requests::Engine
Definition: engine.h:10
nx::sdk::analytics::ICompressedVideoPacket
Definition: i_compressed_video_packet.h:31
nx::sdk::analytics::ConsumingDeviceAgent
Definition: consuming_device_agent.h:36
nx::vms_server_plugins::analytics::stub::http_requests::DeviceAgent::settingsReceived
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > settingsReceived() override
Definition: device_agent.cpp:131
nx::sdk::analytics::IMetadataTypes
Definition: i_metadata_types.h:10
nx::vms_server_plugins::analytics::stub::http_requests
Definition: device_agent.cpp:19
nx::sdk::Result< void >
Definition: result.h:82
nx::sdk::IDeviceInfo
Definition: i_device_info.h:13
nx::vms_server_plugins::analytics::stub::http_requests::DeviceAgent::pushCompressedVideoFrame
virtual bool pushCompressedVideoFrame(const nx::sdk::analytics::ICompressedVideoPacket *videoFrame) override
Definition: device_agent.cpp:96
nx::vms_server_plugins::analytics::stub::http_requests::DeviceAgent
Definition: device_agent.h:14
nx::sdk::Result
Definition: result.h:48