nx_server_plugin_sdk 1.0 Server Plugin 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 <set>
6
7 #include <nx/kit/json.h>
8 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
9 #include <nx/sdk/analytics/i_object_metadata_packet.h>
10
11 #include "stream_parser.h"
12
13 namespace nx {
14 namespace vms_server_plugins {
15 namespace analytics {
16 namespace stub {
17 namespace object_streamer {
18
19 class DeviceAgent: public nx::sdk::analytics::ConsumingDeviceAgent
20 {
21 public:
22 DeviceAgent(const nx::sdk::IDeviceInfo* deviceInfo, std::string pluginHomeDir);
23 virtual ~DeviceAgent() override;
24
25 protected:
26 virtual std::string manifestString() const override;
27
28 virtual bool pushCompressedVideoFrame(
29 nx::sdk::Ptr<const nx::sdk::analytics::ICompressedVideoPacket> videoFrame) override;
30
31 virtual nx::sdk::Result<const nx::sdk::ISettingsResponse*> settingsReceived() override;
32
33 private:
34 std::vector<nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket>> generateMetadata(
35 int frameNumber,
36 int64_t frameTimestampUs,
37 int64_t durationUs);
38
39 nx::sdk::Uuid obtainObjectTrackIdFromRef(const std::string& objectTrackIdRef);
40
41 sdk::Ptr<sdk::ISettingsResponse> makeSettingsResponse(
42 const std::string& manifestFilePath,
43 const std::string& streamFilePath) const;
44
45 void reportIssues(const Issues& issues) const;
46
47 private:
48 StreamInfo m_streamInfo;
49 std::set<std::string> m_disabledObjectTypeIds;
50 std::set<std::string> m_disabledTracks;
51 int m_frameNumber = 0;
52 int m_maxFrameNumber = 0;
53 std::map<std::string, nx::sdk::Uuid> m_trackIdByRef;
54
55 int64_t m_lastFrameTimestampUs = -1;
56 std::string m_integrationHomeDir;
57 bool m_isInitialSettings = true;
58 };
59
60 } // namespace object_streamer
61 } // namespace stub
62 } // namespace analytics
63 } // namespace vms_server_plugins
64 } // namespace nx
nx::vms_server_plugins::analytics::stub::object_streamer::StreamInfo
Definition: stream_parser.h:73
nx::vms_server_plugins::analytics::stub::object_streamer::DeviceAgent::settingsReceived
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > settingsReceived() override
Definition: device_agent.cpp:221
nx::sdk::Ptr
Definition: ptr.h:18
nx::vms_server_plugins::analytics::stub::object_streamer::DeviceAgent
Definition: device_agent.h:19
json.h
nx::sdk::analytics::ConsumingDeviceAgent
Definition: consuming_device_agent.h:36
nx::sdk::Uuid
Definition: uuid.h:22
nx::sdk::IDeviceInfo
Definition: i_device_info.h:13
nx::vms_server_plugins::analytics::stub::object_streamer::Issues
Definition: stream_parser.h:67
nx::sdk::Result
Definition: result.h:52
nx
Definition: apple_utils.h:6
nx::vms_server_plugins::analytics::stub::object_streamer::DeviceAgent::pushCompressedVideoFrame
virtual bool pushCompressedVideoFrame(nx::sdk::Ptr< const nx::sdk::analytics::ICompressedVideoPacket > videoFrame) override
Definition: device_agent.cpp:53