stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
common.h
1 #pragma once
2 
3 namespace nx {
4 namespace sdk {
5 
6 struct DeviceInfo
7 {
8  DeviceInfo()
9  {
10  vendor[0] = 0;
11  model[0] = 0;
12  firmware[0] = 0;
13  uid[0] = 0;
14  sharedId[0] = 0;
15  url[0] = 0;
16  login[0] = 0;
17  password[0] = 0;
18  }
19 
20  static const int kStringParameterMaxLength = 256;
21  static const int kTextParameterMaxLength = 1024;
22 
23  char vendor[kStringParameterMaxLength];
24  char model[kStringParameterMaxLength];
25  char firmware[kStringParameterMaxLength];
26  char uid[kStringParameterMaxLength];
27  char sharedId[kStringParameterMaxLength];
28  char url[kTextParameterMaxLength];
29  char login[kStringParameterMaxLength];
30  char password[kStringParameterMaxLength];
31  int channel = 0;
32  int logicalId = 0;
33 };
34 
36 {
37  // Currently, CameraInfo has no specific fields.
38 };
39 
40 struct Ratio
41 {
42  int numerator;
43  int denominator;
44 };
45 
46 enum class AttributeType
47 {
48  undefined,
49  number,
50  boolean,
51  string,
52  // TODO: Consider adding other specific types like DateTime, Coordinates, Temperature.
53 };
54 
56 {
57 public:
58  virtual ~IAttribute() = default;
59 
60  virtual AttributeType type() const = 0;
61  virtual const char* name() const = 0;
62  virtual const char* value() const = 0;
63 };
64 
65 enum class Error
66 {
67  noError,
68  unknownError, //< TODO: Consider renaming to "genericError".
69  needMoreBufferSpace,
70  typeIsNotSupported,
71  networkError,
72 };
73 
75 {
76 public:
77  virtual ~IStringList() = default;
78  virtual int count() const = 0;
79  virtual const char* at(int index) const = 0;
80 };
81 
82 static inline const char* toString(Error error)
83 {
84  switch (error)
85  {
86  case Error::noError: return "noError";
87  case Error::unknownError: return "unknownError";
88  case Error::needMoreBufferSpace: return "needMoreBufferSpace";
89  case Error::typeIsNotSupported: return "typeIsNotSupported";
90  case Error::networkError: return "networkError";
91  default: return "<unsupported Error>";
92  }
93 }
94 
95 } // namespace sdk
96 } // namespace nx
Definition: common.h:6
Definition: common.h:35
Definition: common.h:40
Definition: common.h:74
Definition: common.h:55
Definition: debug.cpp:14