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 #include <thread>
7
8 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
9 #include <nx/sdk/helpers/uuid_helper.h>
10
11 #include "engine.h"
12
13 namespace nx {
14 namespace vms_server_plugins {
15 namespace analytics {
16 namespace stub {
17 namespace object_detection {
18
19 class DeviceAgent: public nx::sdk::analytics::ConsumingDeviceAgent
20 {
21 public:
22 static const std::string kTimeShiftSetting;
23 static const std::string kSendAttributesSetting;
24 static const std::string kObjectTypeGenerationSettingPrefix;
25
26 public:
27 DeviceAgent(const nx::sdk::IDeviceInfo* deviceInfo);
28 virtual ~DeviceAgent() override;
29
30 protected:
31 virtual std::string manifestString() const override;
32
33 virtual bool pushCompressedVideoFrame(
34 nx::sdk::Ptr<const nx::sdk::analytics::ICompressedVideoPacket> videoFrame) override;
35
36 virtual nx::sdk::Result<const nx::sdk::ISettingsResponse*> settingsReceived() override;
37
38 private:
39 nx::sdk::Uuid trackIdByTrackType(const std::string& typeId);
40
41 nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket> generateObjectMetadataPacket(
42 int64_t frameTimestampUs);
43
44 private:
45 mutable std::mutex m_mutex;
46
47 int m_frameIndex = 0;
48 int m_timestampShiftMs = 0;
49 bool m_sendAttributes = true;
50 std::map<std::string, nx::sdk::Uuid> m_trackIds;
51 std::set<std::string> m_objectTypeIdsToGenerate;
52 };
53
54 } // namespace object_detection
55 } // namespace stub
56 } // namespace analytics
57 } // namespace vms_server_plugins
58 } // namespace nx
nx::vms_server_plugins::analytics::stub::object_detection::DeviceAgent::pushCompressedVideoFrame
virtual bool pushCompressedVideoFrame(nx::sdk::Ptr< const nx::sdk::analytics::ICompressedVideoPacket > videoFrame) override
Definition: device_agent.cpp:111
nx::sdk::Ptr
Definition: ptr.h:18
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::sdk::Result
Definition: result.h:52
nx::vms_server_plugins::analytics::stub::object_detection::DeviceAgent::settingsReceived
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > settingsReceived() override
Definition: device_agent.cpp:125
nx
Definition: apple_utils.h:6
nx::vms_server_plugins::analytics::stub::object_detection::DeviceAgent
Definition: device_agent.h:19