Nuitrack  1.11.2
3D Skeleton Tracking Middleware
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events Groups Pages
NuitrackDevice.h
1 #ifndef NUITRACK_NUITRAKDEVICE_H_
2 #define NUITRACK_NUITRAKDEVICE_H_
3 #include <vector>
4 
5 #include "nuitrack/capi/NuitrackDevice_CAPI.h"
6 #include "nuitrack/utils/ExceptionTranslator.h"
7 
8 namespace tdv
9 {
10 namespace nuitrack
11 {
12 namespace device
13 {
14 
20 {
21 public:
22  typedef std::shared_ptr<NuitrackDevice> Ptr;
23 
27  NuitrackDevice(NuitrackDeviceData* pimpl)
28  {
29  _pimpl = pimpl;
30  }
31 
33  {
34  nuitrack_deleteNuitrackDeviceImpl(_pimpl);
35  }
36 
43  std::string getInfo(DeviceInfoType info_type)
44  {
45  int string_buffer_size = 0;
46  nuitrack_nuitrackDevice_getStringBufferSizeConst(string_buffer_size);
47  std::string result;
48  result.resize(string_buffer_size);
49 
50  nuitrack_nuitrackDevice_getInfo(_pimpl, info_type, (char *)result.c_str());
51  result.resize(strlen(result.c_str()));
52 
53  return result;
54  }
55 
62  std::vector<VideoMode> getAvailableVideoModes(StreamType stream_type)
63  {
64  std::vector<VideoMode> res;
65 
66  int buf_size = 0;
67  nuitrack_nuitrackDevice_getVideoModeListSize(_pimpl, stream_type, buf_size);
68 
69  for(int i = 0; i < buf_size; i++)
70  {
71  VideoMode tmp;
72  nuitrack_nuitrackDevice_getVideoModeList(_pimpl, stream_type, i, tmp);
73  res.push_back(tmp);
74  }
75 
76  return res;
77  }
78 
86  {
87  VideoMode tmp;
88  nuitrack_nuitrackDevice_getSelectedVideoMode(_pimpl, stream_type, tmp);
89  return tmp;
90  }
91 
98  void setVideoMode(StreamType stream_type, VideoMode video_mode)
99  {
100  nuitrack_nuitrackDevice_setVideoMode(_pimpl, stream_type, video_mode);
101  }
102 
109  {
110  int res = ActivationStatus::NONE;
111  nuitrack_nuitrackDevice_getActivationStatus(_pimpl, res);
112  return (ActivationStatus)res;
113  }
114 
121  void activate(std::string activation_key)
122  {
123  nuitrack_error* e = nullptr;
124  nuitrack_nuitrackDevice_activate(_pimpl, activation_key.c_str(), &e);
125  tdv::nuitrack::ExceptionTranslator::handle(e);
126  }
127 
128 private:
129  friend class tdv::nuitrack::Nuitrack;
130 
131  NuitrackDeviceData* _pimpl;
132 };
133 
134 }
135 }
136 }
137 
138 #endif /* NUITRACK_USERFRAME_H_ */
VideoMode getSelectedVideoMode(StreamType stream_type)
Provides selected video mode for a current StreamType.
Definition: NuitrackDevice.h:85
Type
Definition: NuitrackDeviceCommon.h:32
Contains parameters for a stream.
Definition: NuitrackDeviceCommon.h:61
Status
Definition: NuitrackDeviceCommon.h:17
NuitrackDevice(NuitrackDeviceData *pimpl)
For internal use only.
Definition: NuitrackDevice.h:27
no valid license
Definition: Error.h:174
ActivationStatus getActivationStatus()
Get license activation status.
Definition: NuitrackDevice.h:108
std::string getInfo(DeviceInfoType info_type)
Provides device info by type.
Definition: NuitrackDevice.h:43
void setVideoMode(StreamType stream_type, VideoMode video_mode)
Sets video mode for a current StreamType.
Definition: NuitrackDevice.h:98
void activate(std::string activation_key)
Activate the current device.
Definition: NuitrackDevice.h:121
Central class for common Nuitrack operations.
Definition: Nuitrack.h:47
Contains information and settings for a device.
Definition: NuitrackDevice.h:19
Type
Definition: NuitrackDeviceCommon.h:48
std::vector< VideoMode > getAvailableVideoModes(StreamType stream_type)
Provides all available video modes for a current StreamType.
Definition: NuitrackDevice.h:62