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 <nx/sdk/analytics/helpers/consuming_device_agent.h>
6 #include <nx/sdk/helpers/uuid_helper.h>
7
8 #include "engine.h"
9
10 namespace nx {
11 namespace vms_server_plugins {
12 namespace analytics {
13 namespace sample {
14
15 class DeviceAgent: public nx::sdk::analytics::ConsumingDeviceAgent
16 {
17 public:
18 DeviceAgent(const nx::sdk::IDeviceInfo* deviceInfo);
19 virtual ~DeviceAgent() override;
20
21 protected:
22 virtual std::string manifestString() const override;
23
24 virtual bool pushCompressedVideoFrame(
25 nx::sdk::Ptr<const nx::sdk::analytics::ICompressedVideoPacket> videoFrame) override;
26
27 virtual bool pullMetadataPackets(
28 std::vector<nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket>>* metadataPackets) override;
29
30 private:
31 nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket> generateEventMetadataPacket();
32 nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket> generateObjectMetadataPacket();
33
34 private:
35 const std::string kHelloWorldObjectType = "nx.sample.helloWorld";
36 const std::string kNewTrackEventType = "nx.sample.newTrack";
37
39 static constexpr int kTrackFrameCount = 256;
40
41 private:
42 nx::sdk::Uuid m_trackId = nx::sdk::UuidHelper::randomUuid();
43 int m_frameIndex = 0;
44 int m_trackIndex = 0;
47 int64_t m_lastVideoFrameTimestampUs = 0;
48 };
49
50 } // namespace sample
51 } // namespace analytics
52 } // namespace vms_server_plugins
53 } // namespace nx
nx::vms_server_plugins::analytics::sample::DeviceAgent::pushCompressedVideoFrame
virtual bool pushCompressedVideoFrame(nx::sdk::Ptr< const nx::sdk::analytics::ICompressedVideoPacket > videoFrame) override
Definition: device_agent.cpp:74
nx::vms_server_plugins::analytics::sample::DeviceAgent::manifestString
virtual std::string manifestString() const override
Definition: device_agent.cpp:38
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
Definition: apple_utils.h:6
nx::vms_server_plugins::analytics::sample::DeviceAgent
Definition: device_agent.h:15
nx::vms_server_plugins::analytics::sample::DeviceAgent::DeviceAgent
DeviceAgent(const nx::sdk::IDeviceInfo *deviceInfo)
Definition: device_agent.cpp:24