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 <atomic>
6 #include <condition_variable>
7 #include <deque>
8 #include <memory>
9 #include <string>
10 #include <thread>
11 #include <vector>
12 
13 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
14 #include <nx/sdk/analytics/helpers/object_metadata_packet.h>
15 #include <nx/sdk/analytics/helpers/pixel_format.h>
16 
17 #include "engine.h"
18 #include "stub_analytics_integration_diagnostic_events_ini.h"
19 
20 namespace nx {
21 namespace vms_server_plugins {
22 namespace analytics {
23 namespace stub {
24 namespace diagnostic_events {
25 
26 const std::string kGenerateIntegrationDiagnosticEventsFromDeviceAgentSetting =
27  "generateIntegrationDiagnosticEventsFromDeviceAgent";
28 
30 {
31 public:
32  DeviceAgent(Engine* engine, const nx::sdk::IDeviceInfo* deviceInfo);
33  virtual ~DeviceAgent() override;
34 
35 protected:
36  virtual std::string manifestString() const override;
37 
39 
40 private:
41  void eventThreadLoop();
42  void startEventThread();
43  void stopEventThread();
44 
45  void processFrameMotion(
47 
48 private:
49  Engine* const m_engine;
50 
51  std::unique_ptr<std::thread> m_eventThread;
52  std::mutex m_eventThreadMutex;
53  std::condition_variable m_eventThreadCondition;
54  std::atomic<bool> m_stopping{false};
55  std::atomic<bool> m_terminated{false};
56 
57  struct DeviceAgentSettings
58  {
59  std::atomic<bool> generateEvents{true};
60  };
61 
62  DeviceAgentSettings m_deviceAgentSettings;
63 };
64 
65 } // namespace diagnostic_events
66 } // namespace stub
67 } // namespace analytics
68 } // namespace vms_server_plugins
69 } // namespace nx
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > settingsReceived() override
Definition: device_agent.cpp:62
Definition: ptr.h:18
Definition: consuming_device_agent.h:36
Definition: i_device_info.h:13
Definition: result.h:52
Definition: apple_utils.h:6
Definition: i_list.h:10