sot-talos-balance  1.7.0
RTProtocol.h
Go to the documentation of this file.
1 #ifndef RTPROTOCOL_H
2 #define RTPROTOCOL_H
3 
4 
5 #include "RTPacket.h"
6 #include "Network.h"
7 #include <vector>
8 #include <string>
9 #include <map>
10 
11 #ifdef _WIN32
12 #pragma warning (disable : 4251)
13 #endif
14 
15 
16 #ifdef EXPORT_DLL
17 #define DLL_EXPORT __declspec(dllexport)
18 #else
19 #define DLL_EXPORT
20 #endif
21 
22 
23 #define DEFAULT_AUTO_DESCOVER_PORT 22226
24 #define WAIT_FOR_DATA_TIMEOUT 5000000 // 5 s
25 
26 class CMarkup;
27 
29 {
30 public:
31  static const unsigned int cComponent3d = 0x000001;
32  static const unsigned int cComponent3dNoLabels = 0x000002;
33  static const unsigned int cComponentAnalog = 0x000004;
34  static const unsigned int cComponentForce = 0x000008;
35  static const unsigned int cComponent6d = 0x000010;
36  static const unsigned int cComponent6dEuler = 0x000020;
37  static const unsigned int cComponent2d = 0x000040;
38  static const unsigned int cComponent2dLin = 0x000080;
39  static const unsigned int cComponent3dRes = 0x000100;
40  static const unsigned int cComponent3dNoLabelsRes = 0x000200;
41  static const unsigned int cComponent6dRes = 0x000400;
42  static const unsigned int cComponent6dEulerRes = 0x000800;
43  static const unsigned int cComponentAnalogSingle = 0x001000;
44  static const unsigned int cComponentImage = 0x002000;
45  static const unsigned int cComponentForceSingle = 0x004000;
46  static const unsigned int cComponentGazeVector = 0x008000;
47  static const unsigned int cComponentTimecode = 0x010000;
48  static const unsigned int cComponentSkeleton = 0x020000;
49 
51  {
53  mAnalogChannels(nullptr),
54  mSkeletonGlobalData(false)
55  {
56  }
59  };
60 
62  {
63  RateNone = 0,
64  RateAllFrames = 1,
65  RateFrequency = 2,
66  RateFrequencyDivisor = 3
67  };
68 
70  {
71  ModelMacReflex = 0,
72  ModelProReflex120 = 1,
73  ModelProReflex240 = 2,
74  ModelProReflex500 = 3,
75  ModelProReflex1000 = 4,
76  ModelOqus100 = 5,
77  ModelOqus300 = 6,
78  ModelOqus300Plus = 7,
79  ModelOqus400 = 8,
80  ModelOqus500 = 9,
81  ModelOqus200C = 10,
82  ModelOqus500Plus = 11,
83  ModelOqus700 = 12,
84  ModelOqus700Plus = 13,
85  ModelOqus600Plus = 14,
86  ModelMiqusM1 = 15,
87  ModelMiqusM3 = 16,
88  ModelMiqusM5 = 17,
89  ModelMiqusSyncUnit = 18,
90  ModelMiqusVideo = 19,
91  ModelMiqusVideoColor = 20
92  };
93 
95  {
96  Unknown = 0,
97  Oqus = 1,
98  Miqus = 2
99  };
100 
102  {
103  ModeMarker = 0,
104  ModeMarkerIntensity = 1,
105  ModeVideo = 2
106  };
107 
109  {
110  VideoResolution1080p = 0,
111  VideoResolution720p = 1,
112  VideoResolution540p = 2,
113  VideoResolution480p = 3,
114  VideoResolutionNone = 4
115  };
116 
118  {
119  VideoAspectRatio16x9 = 0,
120  VideoAspectRatio4x3 = 1,
121  VideoAspectRatio1x1 = 2,
122  VideoAspectRatioNone = 3
123  };
124 
126  {
127  ModeShutterOut = 1, // A pulse per frame is sent
132  ModeFixed100Hz
133  };
134 
136  {
137  SourceControlPort = 0,
138  SourceIRReceiver = 1,
139  SourceSMPTE = 2,
140  SourceVideoSync = 3,
141  SourceIRIG = 4
142  };
143 
144  enum EAxis
145  {
146  XPos = 0,
147  XNeg = 1,
148  YPos = 2,
149  YNeg = 3,
150  ZPos = 4,
151  ZNeg = 5
152  };
153 
155  {
156  ProcessingNone = 0x0000,
157  ProcessingTracking2D = 0x0001,
158  ProcessingTracking3D = 0x0002,
159  ProcessingTwinSystemMerge = 0x0004,
160  ProcessingSplineFill = 0x0008,
161  ProcessingAIM = 0x0010,
162  Processing6DOFTracking = 0x0020,
163  ProcessingForceData = 0x0040,
164  ProcessingGazeVector = 0x0080,
165  ProcessingExportTSV = 0x0100,
166  ProcessingExportC3D = 0x0200,
167  ProcessingExportMatlabFile = 0x0800,
168  ProcessingExportAviFile = 0x1000,
169  ProcessingPreProcess2D = 0x2000
170  };
171 
172  struct SPoint
173  {
174  float fX;
175  float fY;
176  float fZ;
177  };
178 
180  {
181  char message[128];
182  unsigned int nAddr;
183  unsigned short nBasePort;
184  };
185 
186 
187 private:
188  struct SSettingsGeneralCamera
189  {
190  unsigned int nID;
191  ECameraModel eModel;
192  bool bUnderwater;
193  bool bSupportsHwSync;
194  unsigned int nSerial;
195  ECameraMode eMode;
196  EVideoResolution eVideoResolution;
197  EVideoAspectRatio eVideoAspectRatio;
198  unsigned int nVideoFrequency;
199  unsigned int nVideoExposure; // Micro seconds
200  unsigned int nVideoExposureMin; // Micro seconds
201  unsigned int nVideoExposureMax; // Micro seconds
202  unsigned int nVideoFlashTime; // Micro seconds
203  unsigned int nVideoFlashTimeMin; // Micro seconds
204  unsigned int nVideoFlashTimeMax; // Micro seconds
205  unsigned int nMarkerExposure; // Micro seconds
206  unsigned int nMarkerExposureMin; // Micro seconds
207  unsigned int nMarkerExposureMax; // Micro seconds
208  unsigned int nMarkerThreshold;
209  unsigned int nMarkerThresholdMin;
210  unsigned int nMarkerThresholdMax;
211  float fPositionX;
212  float fPositionY;
213  float fPositionZ;
214  float fPositionRotMatrix[3][3];
215  unsigned int nOrientation; // Degrees
216  unsigned int nMarkerResolutionWidth; // Sub pixels
217  unsigned int nMarkerResolutionHeight; // Sub pixels
218  unsigned int nVideoResolutionWidth; // Pixels
219  unsigned int nVideoResolutionHeight; // Pixels
220  unsigned int nMarkerFOVLeft; // Pixels
221  unsigned int nMarkerFOVTop; // Pixels
222  unsigned int nMarkerFOVRight; // Pixels
223  unsigned int nMarkerFOVBottom; // Pixels
224  unsigned int nVideoFOVLeft; // Pixels
225  unsigned int nVideoFOVTop; // Pixels
226  unsigned int nVideoFOVRight; // Pixels
227  unsigned int nVideoFOVBottom; // Pixels
228  ESyncOutFreqMode eSyncOutMode[2];
229  unsigned int nSyncOutValue[2];
230  float fSyncOutDutyCycle[2]; // Percent
231  bool bSyncOutNegativePolarity[3];
232  float fFocus;
233  float fAperture;
234  bool autoExposureEnabled;
235  float autoExposureCompensation;
236  int autoWhiteBalance;
237  };
238 
239  struct SSettingsGeneralCameraSystem
240  {
241  ECameraSystemType eType;
242  };
243 
244  struct SSettingsGeneralExternalTimebase
245  {
246  SSettingsGeneralExternalTimebase():
247  bEnabled(false),
248  eSignalSource(SourceControlPort),
249  bSignalModePeriodic(false),
250  nFreqMultiplier(0),
251  nFreqDivisor(0),
252  nFreqTolerance(0),
253  fNominalFrequency(0.0f),
254  bNegativeEdge(false),
255  nSignalShutterDelay(0),
256  fNonPeriodicTimeout(0.0f)
257  {
258  }
259 
260  bool bEnabled;
261  ESignalSource eSignalSource;
262  bool bSignalModePeriodic;
263  unsigned int nFreqMultiplier;
264  unsigned int nFreqDivisor;
265  unsigned int nFreqTolerance;
266  float fNominalFrequency;
267  bool bNegativeEdge;
268  unsigned int nSignalShutterDelay;
269  float fNonPeriodicTimeout;
270  };
271 
272  struct SSettingsGeneral
273  {
274  SSettingsGeneral():
275  nCaptureFrequency(0),
276  fCaptureTime(0.0f),
277  bStartOnExternalTrigger(false),
278  bStartOnTrigNO(false),
279  bStartOnTrigNC(false),
280  bStartOnTrigSoftware(false),
281  eProcessingActions(EProcessingActions::ProcessingNone),
282  eRtProcessingActions(EProcessingActions::ProcessingNone),
283  eReprocessingActions(EProcessingActions::ProcessingNone)
284  {
285  sExternalTimebase = { };
286  sCameraSystem = { Unknown };
287  }
288 
289  unsigned int nCaptureFrequency;
290  float fCaptureTime;
291  bool bStartOnExternalTrigger;
292  bool bStartOnTrigNO;
293  bool bStartOnTrigNC;
294  bool bStartOnTrigSoftware;
295  SSettingsGeneralCameraSystem sCameraSystem;
296  SSettingsGeneralExternalTimebase sExternalTimebase;
297  EProcessingActions eProcessingActions; // Binary flags.
298  EProcessingActions eRtProcessingActions; // Binary flags.
299  EProcessingActions eReprocessingActions; // Binary flags.
300  std::vector< SSettingsGeneralCamera > vsCameras;
301  };
302 
303  struct SSettings3DLabel
304  {
305  std::string oName;
306  unsigned int nRGBColor;
307  };
308 
309  struct SSettingsBone
310  {
311  std::string fromName;
312  std::string toName;
313  unsigned int color;
314  };
315 
316  struct SSettings3D
317  {
318  EAxis eAxisUpwards;
319  char pCalibrationTime[32];
320  std::vector< SSettings3DLabel > s3DLabels;
321  std::vector< SSettingsBone > sBones;
322  };
323 
324  struct SSettings6DOFBody
325  {
326  std::string oName;
327  unsigned int nRGBColor;
328  std::vector< SPoint > vsPoints;
329  };
330 
331  struct SSettings6DOF
332  {
333  std::vector<SSettings6DOFBody> bodySettings;
334  std::string eulerFirst;
335  std::string eulerSecond;
336  std::string eulerThird;
337  };
338 
339  struct SGazeVector
340  {
341  std::string name;
342  float frequency;
343  };
344 
345  struct SAnalogDevice
346  {
347  unsigned int nDeviceID;
348  unsigned int nChannels;
349  std::string oName;
350  std::vector< std::string > voLabels;
351  unsigned int nFrequency;
352  std::string oUnit;
353  float fMinRange;
354  float fMaxRange;
355  std::vector< std::string > voUnits;
356  };
357 
358  struct SForceChannel
359  {
360  unsigned int nChannelNumber;
361  float fConversionFactor;
362  };
363 
364  struct SForcePlate
365  {
366  unsigned int nID;
367  unsigned int nAnalogDeviceID;
368  std::string oType;
369  std::string oName;
370  unsigned int nFrequency;
371  float fLength;
372  float fWidth;
373  SPoint asCorner[4];
374  SPoint sOrigin;
375  std::vector< SForceChannel > vChannels;
376  bool bValidCalibrationMatrix;
377  float afCalibrationMatrix[12][12];
378  unsigned int nCalibrationMatrixRows;
379  unsigned int nCalibrationMatrixColumns;
380  };
381 
382  struct SSettingsForce
383  {
384  std::string oUnitLength;
385  std::string oUnitForce;
386  std::vector< SForcePlate > vsForcePlates;
387  };
388 
389  struct SImageCamera
390  {
391  unsigned int nID;
392  bool bEnabled;
393  CRTPacket::EImageFormat eFormat;
394  unsigned int nWidth;
395  unsigned int nHeight;
396  float fCropLeft;
397  float fCropTop;
398  float fCropRight;
399  float fCropBottom;
400  };
401 
402 public:
404  {
405  std::string name;
406  int parentId;
408  };
409 
411  {
412  std::string name;
413  std::vector<SSettingsSkeletonSegment> segments;
414  };
415 
416 
417 public:
418  CRTProtocol();
419  ~CRTProtocol();
420 
421  bool Connect(const char* pServerAddr, unsigned short nPort, unsigned short* pnUDPServerPort = nullptr, int nMajorVersion = MAJOR_VERSION, int nMinorVersion = MINOR_VERSION, bool bBigEndian = false);
422  unsigned short GetUdpServerPort();
423  void Disconnect();
424  bool Connected() const;
425  bool SetVersion(int nMajorVersion, int nMinorVersion);
426  bool GetVersion(unsigned int &nMajorVersion, unsigned int &nMinorVersion);
427  bool GetQTMVersion(char* pVersion, unsigned int nVersionLen);
428  bool GetByteOrder(bool &bBigEndian);
429  bool CheckLicense(const char* pLicenseCode);
430  bool DiscoverRTServer(unsigned short nServerPort, bool bNoLocalResponses, unsigned short nDiscoverPort = DEFAULT_AUTO_DESCOVER_PORT);
431  int GetNumberOfDiscoverResponses();
432  bool GetDiscoverResponse(unsigned int nIndex, unsigned int &nAddr, unsigned short &nBasePort, std::string& message);
433 
434  bool GetCurrentFrame(unsigned int nComponentType, const SComponentOptions& componentOptions = { });
435  bool StreamFrames(EStreamRate eRate, unsigned int nRateArg, unsigned short nUDPPort, const char* pUDPAddr,
436  unsigned int nComponentType, const SComponentOptions& componentOptions = { });
437  bool StreamFramesStop();
438  bool GetState(CRTPacket::EEvent &eEvent, bool bUpdate = true, int nTimeout = WAIT_FOR_DATA_TIMEOUT);
439  bool GetCapture(const char* pFileName, bool bC3D);
440  bool SendTrig();
441  bool SetQTMEvent(const char* pLabel);
442  bool TakeControl(const char* pPassword = nullptr);
443  bool ReleaseControl();
444  bool IsControlling();
445  bool NewMeasurement();
446  bool CloseMeasurement();
447  bool StartCapture();
448  bool StartRTOnFile();
449  bool StopCapture();
450  bool LoadCapture(const char* pFileName);
451  bool SaveCapture(const char* pFileName, bool bOverwrite, char* pNewFileName = nullptr, int nSizeOfNewFileName = 0);
452  bool LoadProject(const char* pFileName);
453  bool Reprocess();
454 
455  static bool GetEventString(CRTPacket::EEvent eEvent, char* pStr);
456  static bool ConvertRateString(const char* pRate, EStreamRate &eRate, unsigned int &nRateArg);
457  static unsigned int ConvertComponentString(const char* pComponentType);
458  static bool GetComponentString(char* pComponentStr, unsigned int nComponentType, const SComponentOptions& options = SComponentOptions());
459 
460  int ReceiveRTPacket(CRTPacket::EPacketType &eType, bool bSkipEvents = true, int nTimeout = WAIT_FOR_DATA_TIMEOUT); // nTimeout < 0 : Blocking receive
461  CRTPacket* GetRTPacket();
462 
463  bool ReadXmlBool(CMarkup* xml, const std::string& element, bool& value) const;
464  bool ReadCameraSystemSettings();
465  bool Read3DSettings(bool &bDataAvailable);
466  bool Read6DOFSettings(bool &bDataAvailable);
467  bool ReadGazeVectorSettings(bool &bDataAvailable);
468  bool ReadAnalogSettings(bool &bDataAvailable);
469  bool ReadForceSettings(bool &bDataAvailable);
470  bool ReadImageSettings(bool &bDataAvailable);
471  bool ReadSkeletonSettings(bool &bDataAvailable, bool skeletonGlobalData = false);
472 
473  void GetSystemSettings(
474  unsigned int &nCaptureFrequency, float &fCaptureTime,
475  bool& bStartOnExtTrig, bool& trigNO, bool& trigNC, bool& trigSoftware,
476  EProcessingActions &eProcessingActions, EProcessingActions &eRtProcessingActions, EProcessingActions &eReprocessingActions) const;
477 
478  void GetExtTimeBaseSettings(
479  bool &bEnabled, ESignalSource &eSignalSource,
480  bool &bSignalModePeriodic, unsigned int &nFreqMultiplier,
481  unsigned int &nFreqDivisor, unsigned int &nFreqTolerance,
482  float &fNominalFrequency, bool &bNegativeEdge,
483  unsigned int &nSignalShutterDelay, float &fNonPeriodicTimeout) const;
484 
485  unsigned int GetCameraCount() const;
486 
487  bool GetCameraSettings(
488  unsigned int nCameraIndex, unsigned int &nID, ECameraModel &eModel,
489  bool &bUnderwater, bool &bSupportsHwSync, unsigned int &nSerial, ECameraMode &eMode) const;
490 
491  bool GetCameraMarkerSettings(
492  unsigned int nCameraIndex, unsigned int &nCurrentExposure,
493  unsigned int &nMinExposure, unsigned int &nMaxExposure,
494  unsigned int &nCurrentThreshold, unsigned int &nMinThreshold,
495  unsigned int &nMaxThreshold) const;
496 
497  bool GetCameraVideoSettings(
498  unsigned int nCameraIndex, EVideoResolution &eVideoResolution,
499  EVideoAspectRatio &eVideoAspectRatio, unsigned int &nVideoFrequency,
500  unsigned int &nCurrentExposure, unsigned int &nMinExposure,
501  unsigned int &nMaxExposure, unsigned int &nCurrentFlashTime,
502  unsigned int &nMinFlashTime, unsigned int &nMaxFlashTime) const;
503 
504  bool GetCameraSyncOutSettings(
505  unsigned int nCameraIndex, unsigned int portNumber, ESyncOutFreqMode &eSyncOutMode,
506  unsigned int &nSyncOutValue, float &fSyncOutDutyCycle,
507  bool &bSyncOutNegativePolarity) const;
508 
509  bool GetCameraPosition(
510  unsigned int nCameraIndex, SPoint &sPoint, float fvRotationMatrix[3][3]) const;
511 
512  bool GetCameraOrientation(
513  unsigned int nCameraIndex, int &nOrientation) const;
514 
515  bool GetCameraResolution(
516  unsigned int nCameraIndex, unsigned int &nMarkerWidth,
517  unsigned int &nMarkerHeight, unsigned int &nVideoWidth,
518  unsigned int &nVideoHeight) const;
519 
520  bool GetCameraFOV(
521  unsigned int nCameraIndex, unsigned int &nMarkerLeft, unsigned int &nMarkerTop,
522  unsigned int &nMarkerRight, unsigned int &nMarkerBottom,
523  unsigned int &nVideoLeft, unsigned int &nVideoTop,
524  unsigned int &nVideoRight, unsigned int &nVideoBottom) const;
525 
526  bool GetCameraLensControlSettings(const unsigned int nCameraIndex, float* focus, float* aperture) const;
527  bool GetCameraAutoExposureSettings(const unsigned int nCameraIndex, bool* autoExposureEnabled, float* autoExposureCompensation) const;
528  bool GetCameraAutoWhiteBalance(const unsigned int nCameraIndex, bool* autoWhiteBalanceEnabled) const;
529 
530  EAxis Get3DUpwardAxis() const;
531  const char* Get3DCalibrated() const;
532  unsigned int Get3DLabeledMarkerCount() const;
533  const char* Get3DLabelName(unsigned int nMarkerIndex) const;
534  unsigned int Get3DLabelColor(unsigned int nMarkerIndex) const;
535 
536  unsigned int Get3DBoneCount() const;
537  const char* Get3DBoneFromName(unsigned int boneIndex) const;
538  const char* Get3DBoneToName(unsigned int boneIndex) const;
539 
540  void Get6DOFEulerNames(std::string &first, std::string &second, std::string &third) const;
541  unsigned int Get6DOFBodyCount() const;
542  const char* Get6DOFBodyName(unsigned int nBodyIndex) const;
543  unsigned int Get6DOFBodyColor(unsigned int nBodyIndex) const;
544  unsigned int Get6DOFBodyPointCount(unsigned int nBodyIndex) const;
545  bool Get6DOFBodyPoint(unsigned int nBodyIndex, unsigned int nMarkerIndex, SPoint &sPoint) const;
546 
547  unsigned int GetGazeVectorCount() const;
548  const char* GetGazeVectorName(unsigned int nGazeVectorIndex) const;
549  float GetGazeVectorFrequency(unsigned int nGazeVectorIndex) const;
550 
551  unsigned int GetAnalogDeviceCount() const;
552  bool GetAnalogDevice(unsigned int nDeviceIndex, unsigned int &nDeviceID, unsigned int &nChannels,
553  char* &pName, unsigned int &nFrequency, char* &pUnit,
554  float &fMinRange, float &fMaxRange) const;
555  const char* GetAnalogLabel(unsigned int nDeviceIndex, unsigned int nChannelIndex) const;
556  const char* GetAnalogUnit(unsigned int nDeviceIndex, unsigned int nChannelIndex) const;
557 
558  void GetForceUnits(char* &pLength, char* &pForce) const;
559  unsigned int GetForcePlateCount() const;
560  bool GetForcePlate(unsigned int nPlateIndex, unsigned int &nID, unsigned int &nAnalogDeviceID,
561  unsigned int &nFrequency, char* &pType, char* &pName, float &fLength, float &fWidth) const;
562  bool GetForcePlateLocation(unsigned int nPlateIndex, SPoint sCorner[4]) const;
563  bool GetForcePlateOrigin(unsigned int nPlateIndex, SPoint &sOrigin) const;
564  unsigned int GetForcePlateChannelCount(unsigned int nPlateIndex) const;
565  bool GetForcePlateChannel(unsigned int nPlateIndex, unsigned int nChannelIndex,
566  unsigned int &nChannelNumber, float &fConversionFactor) const;
567  bool GetForcePlateCalibrationMatrix(unsigned int nPlateIndex, float fvCalMatrix[12][12], unsigned int* rows, unsigned int* columns) const;
568 
569  unsigned int GetImageCameraCount() const;
570  bool GetImageCamera(unsigned int nCameraIndex, unsigned int &nCameraID, bool &bEnabled,
571  CRTPacket::EImageFormat &eFormat, unsigned int &nWidth, unsigned int &nHeight,
572  float &fCropLeft, float &fCropTop, float &fCropRight, float &fCropBottom) const;
573 
574  unsigned int GetSkeletonCount() const;
575  const char* GetSkeletonName(unsigned int skeletonIndex);
576  unsigned int GetSkeletonSegmentCount(unsigned int skeletonIndex);
577  bool GetSkeleton(unsigned int skeletonIndex, SSettingsSkeleton* skeleton);
578  bool GetSkeletonSegment(unsigned int skeletonIndex, unsigned int segmentIndex, SSettingsSkeletonSegment* segment);// parentIndex = -1 => No parent.
579 
580  ECameraSystemType GetCameraSystemType() const;
581 
582 
583  bool SetSystemSettings(
584  const unsigned int* pnCaptureFrequency, const float* pfCaptureTime,
585  const bool* pbStartOnExtTrig, const bool* trigNO, const bool* trigNC, const bool* trigSoftware,
586  const EProcessingActions* peProcessingActions, const EProcessingActions* peRtProcessingActions, const EProcessingActions* peReprocessingActions);
587 
588  bool SetExtTimeBaseSettings(
589  const bool* pbEnabled, const ESignalSource* peSignalSource,
590  const bool* pbSignalModePeriodic, const unsigned int* pnFreqMultiplier,
591  const unsigned int* pnFreqDivisor, const unsigned int* pnFreqTolerance,
592  const float* pfNominalFrequency, const bool* pbNegativeEdge,
593  const unsigned int* pnSignalShutterDelay, const float* pfNonPeriodicTimeout);
594 
595  bool SetCameraSettings(
596  const unsigned int nCameraID, const ECameraMode* peMode,
597  const float* pfMarkerExposure, const float* pfMarkerThreshold,
598  const int* pnOrientation);
599 
600  bool SetCameraVideoSettings(
601  const unsigned int nCameraID, const EVideoResolution* eVideoResolution,
602  const EVideoAspectRatio* eVideoAspectRatio, const unsigned int* pnVideoFrequency,
603  const float* pfVideoExposure, const float* pfVideoFlashTime);
604 
605  bool SetCameraSyncOutSettings(
606  const unsigned int nCameraID, const unsigned int portNumber, const ESyncOutFreqMode* peSyncOutMode,
607  const unsigned int* pnSyncOutValue, const float* pfSyncOutDutyCycle,
608  const bool* pbSyncOutNegativePolarity);
609 
610  bool SetCameraLensControlSettings(const unsigned int nCameraID, const float focus, const float aperture);
611  bool SetCameraAutoExposureSettings(const unsigned int nCameraID, const bool autoExposure, const float compensation);
612  bool SetCameraAutoWhiteBalance(const unsigned int nCameraID, const bool enable);
613 
614  bool SetImageSettings(
615  const unsigned int nCameraID, const bool* pbEnable, const CRTPacket::EImageFormat* peFormat,
616  const unsigned int* pnWidth, const unsigned int* pnHeight, const float* pfLeftCrop,
617  const float* pfTopCrop, const float* pfRightCrop, const float* pfBottomCrop);
618 
619  bool SetForceSettings(
620  const unsigned int nPlateID, const SPoint* psCorner1, const SPoint* psCorner2,
621  const SPoint* psCorner3, const SPoint* psCorner4);
622 
623  char* GetErrorString();
624 
625 
626 private:
627  bool SendString(const char* pCmdStr, int nType);
628  bool SendCommand(const char* pCmdStr);
629  bool SendCommand(const char* pCmdStr, char* pCommandResponseStr, unsigned int timeout = WAIT_FOR_DATA_TIMEOUT);
630  bool SendXML(const char* pCmdStr);
631  void AddXMLElementBool(CMarkup* oXML, const char* tTag, const bool* pbValue, const char* tTrue = "True", const char* tFalse = "False");
632  void AddXMLElementBool(CMarkup* oXML, const char* tTag, const bool bValue, const char* tTrue = "True", const char* tFalse = "False");
633  void AddXMLElementInt(CMarkup* oXML, const char* tTag, const int* pnValue);
634  void AddXMLElementUnsignedInt(CMarkup* oXML, const char* tTag, const unsigned int* pnValue);
635  void AddXMLElementFloat(CMarkup* oXML, const char* tTag, const float* pfValue, unsigned int pnDecimals = 6);
636  bool CompareNoCase(std::string tStr1, const char* tStr2) const;
637 
638 private:
639  CNetwork* mpoNetwork;
640  CRTPacket* mpoRTPacket;
641  char* maDataBuff;
642  unsigned int mDataBuffSize;
643  CRTPacket::EEvent meLastEvent;
644  CRTPacket::EEvent meState; // Same as meLastEvent but without EventCameraSettingsChanged
645  int mnMinorVersion;
646  int mnMajorVersion;
647  bool mbBigEndian;
648  bool mbIsMaster;
649  SSettingsGeneral msGeneralSettings;
650  SSettings3D ms3DSettings;
651  SSettings6DOF mvs6DOFSettings;
652  std::vector<SGazeVector> mvsGazeVectorSettings;
653  std::vector<SAnalogDevice> mvsAnalogDeviceSettings;
654  SSettingsForce msForceSettings;
655  std::vector<SImageCamera> mvsImageSettings;
656  std::vector<SSettingsSkeleton> mSkeletonSettings;
657  char maErrorStr[1024];
658  unsigned short mnBroadcastPort;
659  FILE* mpFileBuffer;
660  std::vector< SDiscoverResponse > mvsDiscoverResponseList;
661 };
662 
663 
664 #endif // RTPROTOCOL_H
std::vector< SSettingsSkeletonSegment > segments
Definition: RTProtocol.h:413
#define DEFAULT_AUTO_DESCOVER_PORT
Definition: RTProtocol.h:23
Definition: Markup.h:23
#define MAJOR_VERSION
Definition: RTPacket.h:14
#define WAIT_FOR_DATA_TIMEOUT
Definition: RTProtocol.h:24
EImageFormat
Definition: RTPacket.h:65
#define DLL_EXPORT
Definition: RTProtocol.h:19
#define MINOR_VERSION
Definition: RTPacket.h:15