12 #pragma warning(disable : 4251)
16 #define DLL_EXPORT __declspec(dllexport)
21 #define DEFAULT_AUTO_DESCOVER_PORT 22226
22 #define WAIT_FOR_DATA_TIMEOUT 5000000 // 5 s
28 static const unsigned int cComponent3d = 0x000001;
29 static const unsigned int cComponent3dNoLabels = 0x000002;
30 static const unsigned int cComponentAnalog = 0x000004;
31 static const unsigned int cComponentForce = 0x000008;
32 static const unsigned int cComponent6d = 0x000010;
33 static const unsigned int cComponent6dEuler = 0x000020;
34 static const unsigned int cComponent2d = 0x000040;
35 static const unsigned int cComponent2dLin = 0x000080;
36 static const unsigned int cComponent3dRes = 0x000100;
37 static const unsigned int cComponent3dNoLabelsRes = 0x000200;
38 static const unsigned int cComponent6dRes = 0x000400;
39 static const unsigned int cComponent6dEulerRes = 0x000800;
40 static const unsigned int cComponentAnalogSingle = 0x001000;
41 static const unsigned int cComponentImage = 0x002000;
42 static const unsigned int cComponentForceSingle = 0x004000;
43 static const unsigned int cComponentGazeVector = 0x008000;
44 static const unsigned int cComponentTimecode = 0x010000;
45 static const unsigned int cComponentSkeleton = 0x020000;
49 : mAnalogChannels(nullptr), mSkeletonGlobalData(false) {}
58 RateFrequencyDivisor = 3
63 ModelProReflex120 = 1,
64 ModelProReflex240 = 2,
65 ModelProReflex500 = 3,
66 ModelProReflex1000 = 4,
73 ModelOqus500Plus = 11,
75 ModelOqus700Plus = 13,
76 ModelOqus600Plus = 14,
80 ModelMiqusSyncUnit = 18,
82 ModelMiqusVideoColor = 20
87 enum ECameraMode { ModeMarker = 0, ModeMarkerIntensity = 1, ModeVideo = 2 };
90 VideoResolution1080p = 0,
91 VideoResolution720p = 1,
92 VideoResolution540p = 2,
93 VideoResolution480p = 3,
94 VideoResolutionNone = 4
98 VideoAspectRatio16x9 = 0,
99 VideoAspectRatio4x3 = 1,
100 VideoAspectRatio1x1 = 2,
101 VideoAspectRatioNone = 3
114 SourceControlPort = 0,
115 SourceIRReceiver = 1,
121 enum EAxis { XPos = 0, XNeg = 1, YPos = 2, YNeg = 3, ZPos = 4, ZNeg = 5 };
124 ProcessingNone = 0x0000,
125 ProcessingTracking2D = 0x0001,
126 ProcessingTracking3D = 0x0002,
127 ProcessingTwinSystemMerge = 0x0004,
128 ProcessingSplineFill = 0x0008,
129 ProcessingAIM = 0x0010,
130 Processing6DOFTracking = 0x0020,
131 ProcessingForceData = 0x0040,
132 ProcessingGazeVector = 0x0080,
133 ProcessingExportTSV = 0x0100,
134 ProcessingExportC3D = 0x0200,
135 ProcessingExportMatlabFile = 0x0800,
136 ProcessingExportAviFile = 0x1000,
137 ProcessingPreProcess2D = 0x2000
153 struct SSettingsGeneralCamera {
157 bool bSupportsHwSync;
158 unsigned int nSerial;
162 unsigned int nVideoFrequency;
163 unsigned int nVideoExposure;
164 unsigned int nVideoExposureMin;
165 unsigned int nVideoExposureMax;
166 unsigned int nVideoFlashTime;
167 unsigned int nVideoFlashTimeMin;
168 unsigned int nVideoFlashTimeMax;
169 unsigned int nMarkerExposure;
170 unsigned int nMarkerExposureMin;
171 unsigned int nMarkerExposureMax;
172 unsigned int nMarkerThreshold;
173 unsigned int nMarkerThresholdMin;
174 unsigned int nMarkerThresholdMax;
178 float fPositionRotMatrix[3][3];
179 unsigned int nOrientation;
180 unsigned int nMarkerResolutionWidth;
181 unsigned int nMarkerResolutionHeight;
182 unsigned int nVideoResolutionWidth;
183 unsigned int nVideoResolutionHeight;
184 unsigned int nMarkerFOVLeft;
185 unsigned int nMarkerFOVTop;
186 unsigned int nMarkerFOVRight;
187 unsigned int nMarkerFOVBottom;
188 unsigned int nVideoFOVLeft;
189 unsigned int nVideoFOVTop;
190 unsigned int nVideoFOVRight;
191 unsigned int nVideoFOVBottom;
193 unsigned int nSyncOutValue[2];
194 float fSyncOutDutyCycle[2];
195 bool bSyncOutNegativePolarity[3];
198 bool autoExposureEnabled;
199 float autoExposureCompensation;
200 int autoWhiteBalance;
203 struct SSettingsGeneralCameraSystem {
204 ECameraSystemType eType;
207 struct SSettingsGeneralExternalTimebase {
208 SSettingsGeneralExternalTimebase()
210 eSignalSource(SourceControlPort),
211 bSignalModePeriodic(false),
215 fNominalFrequency(0.0f),
216 bNegativeEdge(false),
217 nSignalShutterDelay(0),
218 fNonPeriodicTimeout(0.0f) {}
221 ESignalSource eSignalSource;
222 bool bSignalModePeriodic;
223 unsigned int nFreqMultiplier;
224 unsigned int nFreqDivisor;
225 unsigned int nFreqTolerance;
226 float fNominalFrequency;
228 unsigned int nSignalShutterDelay;
229 float fNonPeriodicTimeout;
232 struct SSettingsGeneral {
234 : nCaptureFrequency(0),
236 bStartOnExternalTrigger(false),
237 bStartOnTrigNO(false),
238 bStartOnTrigNC(false),
239 bStartOnTrigSoftware(false),
240 eProcessingActions(EProcessingActions::ProcessingNone),
241 eRtProcessingActions(EProcessingActions::ProcessingNone),
242 eReprocessingActions(EProcessingActions::ProcessingNone) {
243 sExternalTimebase = {};
244 sCameraSystem = {Unknown};
247 unsigned int nCaptureFrequency;
249 bool bStartOnExternalTrigger;
252 bool bStartOnTrigSoftware;
253 SSettingsGeneralCameraSystem sCameraSystem;
254 SSettingsGeneralExternalTimebase sExternalTimebase;
255 EProcessingActions eProcessingActions;
256 EProcessingActions eRtProcessingActions;
257 EProcessingActions eReprocessingActions;
258 std::vector<SSettingsGeneralCamera> vsCameras;
261 struct SSettings3DLabel {
263 unsigned int nRGBColor;
266 struct SSettingsBone {
267 std::string fromName;
274 char pCalibrationTime[32];
275 std::vector<SSettings3DLabel> s3DLabels;
276 std::vector<SSettingsBone> sBones;
279 struct SSettings6DOFBody {
281 unsigned int nRGBColor;
282 std::vector<SPoint> vsPoints;
285 struct SSettings6DOF {
286 std::vector<SSettings6DOFBody> bodySettings;
287 std::string eulerFirst;
288 std::string eulerSecond;
289 std::string eulerThird;
297 struct SAnalogDevice {
298 unsigned int nDeviceID;
299 unsigned int nChannels;
301 std::vector<std::string> voLabels;
302 unsigned int nFrequency;
306 std::vector<std::string> voUnits;
309 struct SForceChannel {
310 unsigned int nChannelNumber;
311 float fConversionFactor;
316 unsigned int nAnalogDeviceID;
319 unsigned int nFrequency;
324 std::vector<SForceChannel> vChannels;
325 bool bValidCalibrationMatrix;
326 float afCalibrationMatrix[12][12];
327 unsigned int nCalibrationMatrixRows;
328 unsigned int nCalibrationMatrixColumns;
331 struct SSettingsForce {
332 std::string oUnitLength;
333 std::string oUnitForce;
334 std::vector<SForcePlate> vsForcePlates;
337 struct SImageCamera {
342 unsigned int nHeight;
365 bool Connect(
const char* pServerAddr,
unsigned short nPort,
366 unsigned short* pnUDPServerPort =
nullptr,
369 unsigned short GetUdpServerPort();
371 bool Connected()
const;
372 bool SetVersion(
int nMajorVersion,
int nMinorVersion);
373 bool GetVersion(
unsigned int& nMajorVersion,
unsigned int& nMinorVersion);
374 bool GetQTMVersion(
char* pVersion,
unsigned int nVersionLen);
375 bool GetByteOrder(
bool& bBigEndian);
376 bool CheckLicense(
const char* pLicenseCode);
377 bool DiscoverRTServer(
378 unsigned short nServerPort,
bool bNoLocalResponses,
380 int GetNumberOfDiscoverResponses();
381 bool GetDiscoverResponse(
unsigned int nIndex,
unsigned int& nAddr,
382 unsigned short& nBasePort, std::string& message);
384 bool GetCurrentFrame(
unsigned int nComponentType,
386 bool StreamFrames(EStreamRate eRate,
unsigned int nRateArg,
387 unsigned short nUDPPort,
const char* pUDPAddr,
388 unsigned int nComponentType,
389 const SComponentOptions& componentOptions = {});
390 bool StreamFramesStop();
393 bool GetCapture(
const char* pFileName,
bool bC3D);
395 bool SetQTMEvent(
const char* pLabel);
396 bool TakeControl(
const char* pPassword =
nullptr);
397 bool ReleaseControl();
398 bool IsControlling();
399 bool NewMeasurement();
400 bool CloseMeasurement();
402 bool StartRTOnFile();
404 bool LoadCapture(
const char* pFileName);
405 bool SaveCapture(
const char* pFileName,
bool bOverwrite,
406 char* pNewFileName =
nullptr,
int nSizeOfNewFileName = 0);
407 bool LoadProject(
const char* pFileName);
411 static bool ConvertRateString(
const char* pRate, EStreamRate& eRate,
412 unsigned int& nRateArg);
413 static unsigned int ConvertComponentString(
const char* pComponentType);
414 static bool GetComponentString(
415 char* pComponentStr,
unsigned int nComponentType,
416 const SComponentOptions& options = SComponentOptions());
423 bool ReadXmlBool(
CMarkup* xml,
const std::string& element,
bool&
value)
const;
424 bool ReadCameraSystemSettings();
425 bool Read3DSettings(
bool& bDataAvailable);
426 bool Read6DOFSettings(
bool& bDataAvailable);
427 bool ReadGazeVectorSettings(
bool& bDataAvailable);
428 bool ReadAnalogSettings(
bool& bDataAvailable);
429 bool ReadForceSettings(
bool& bDataAvailable);
430 bool ReadImageSettings(
bool& bDataAvailable);
431 bool ReadSkeletonSettings(
bool& bDataAvailable,
432 bool skeletonGlobalData =
false);
434 void GetSystemSettings(
unsigned int& nCaptureFrequency,
float& fCaptureTime,
435 bool& bStartOnExtTrig,
bool& trigNO,
bool& trigNC,
437 EProcessingActions& eProcessingActions,
438 EProcessingActions& eRtProcessingActions,
439 EProcessingActions& eReprocessingActions)
const;
441 void GetExtTimeBaseSettings(
bool& bEnabled, ESignalSource& eSignalSource,
442 bool& bSignalModePeriodic,
443 unsigned int& nFreqMultiplier,
444 unsigned int& nFreqDivisor,
445 unsigned int& nFreqTolerance,
446 float& fNominalFrequency,
bool& bNegativeEdge,
447 unsigned int& nSignalShutterDelay,
448 float& fNonPeriodicTimeout)
const;
450 unsigned int GetCameraCount()
const;
452 bool GetCameraSettings(
unsigned int nCameraIndex,
unsigned int& nID,
453 ECameraModel& eModel,
bool& bUnderwater,
454 bool& bSupportsHwSync,
unsigned int& nSerial,
455 ECameraMode& eMode)
const;
457 bool GetCameraMarkerSettings(
unsigned int nCameraIndex,
458 unsigned int& nCurrentExposure,
459 unsigned int& nMinExposure,
460 unsigned int& nMaxExposure,
461 unsigned int& nCurrentThreshold,
462 unsigned int& nMinThreshold,
463 unsigned int& nMaxThreshold)
const;
465 bool GetCameraVideoSettings(
466 unsigned int nCameraIndex, EVideoResolution& eVideoResolution,
467 EVideoAspectRatio& eVideoAspectRatio,
unsigned int& nVideoFrequency,
468 unsigned int& nCurrentExposure,
unsigned int& nMinExposure,
469 unsigned int& nMaxExposure,
unsigned int& nCurrentFlashTime,
470 unsigned int& nMinFlashTime,
unsigned int& nMaxFlashTime)
const;
472 bool GetCameraSyncOutSettings(
unsigned int nCameraIndex,
473 unsigned int portNumber,
474 ESyncOutFreqMode& eSyncOutMode,
475 unsigned int& nSyncOutValue,
476 float& fSyncOutDutyCycle,
477 bool& bSyncOutNegativePolarity)
const;
479 bool GetCameraPosition(
unsigned int nCameraIndex, SPoint& sPoint,
480 float fvRotationMatrix[3][3])
const;
482 bool GetCameraOrientation(
unsigned int nCameraIndex,
int& nOrientation)
const;
484 bool GetCameraResolution(
unsigned int nCameraIndex,
485 unsigned int& nMarkerWidth,
486 unsigned int& nMarkerHeight,
487 unsigned int& nVideoWidth,
488 unsigned int& nVideoHeight)
const;
490 bool GetCameraFOV(
unsigned int nCameraIndex,
unsigned int& nMarkerLeft,
491 unsigned int& nMarkerTop,
unsigned int& nMarkerRight,
492 unsigned int& nMarkerBottom,
unsigned int& nVideoLeft,
493 unsigned int& nVideoTop,
unsigned int& nVideoRight,
494 unsigned int& nVideoBottom)
const;
496 bool GetCameraLensControlSettings(
const unsigned int nCameraIndex,
497 float* focus,
float* aperture)
const;
498 bool GetCameraAutoExposureSettings(
const unsigned int nCameraIndex,
499 bool* autoExposureEnabled,
500 float* autoExposureCompensation)
const;
501 bool GetCameraAutoWhiteBalance(
const unsigned int nCameraIndex,
502 bool* autoWhiteBalanceEnabled)
const;
504 EAxis Get3DUpwardAxis()
const;
505 const char* Get3DCalibrated()
const;
506 unsigned int Get3DLabeledMarkerCount()
const;
507 const char* Get3DLabelName(
unsigned int nMarkerIndex)
const;
508 unsigned int Get3DLabelColor(
unsigned int nMarkerIndex)
const;
510 unsigned int Get3DBoneCount()
const;
511 const char* Get3DBoneFromName(
unsigned int boneIndex)
const;
512 const char* Get3DBoneToName(
unsigned int boneIndex)
const;
514 void Get6DOFEulerNames(std::string& first, std::string& second,
515 std::string& third)
const;
516 unsigned int Get6DOFBodyCount()
const;
517 const char* Get6DOFBodyName(
unsigned int nBodyIndex)
const;
518 unsigned int Get6DOFBodyColor(
unsigned int nBodyIndex)
const;
519 unsigned int Get6DOFBodyPointCount(
unsigned int nBodyIndex)
const;
520 bool Get6DOFBodyPoint(
unsigned int nBodyIndex,
unsigned int nMarkerIndex,
521 SPoint& sPoint)
const;
523 unsigned int GetGazeVectorCount()
const;
524 const char* GetGazeVectorName(
unsigned int nGazeVectorIndex)
const;
525 float GetGazeVectorFrequency(
unsigned int nGazeVectorIndex)
const;
527 unsigned int GetAnalogDeviceCount()
const;
528 bool GetAnalogDevice(
unsigned int nDeviceIndex,
unsigned int& nDeviceID,
529 unsigned int& nChannels,
char*& pName,
530 unsigned int& nFrequency,
char*& pUnit,
float& fMinRange,
531 float& fMaxRange)
const;
532 const char* GetAnalogLabel(
unsigned int nDeviceIndex,
533 unsigned int nChannelIndex)
const;
534 const char* GetAnalogUnit(
unsigned int nDeviceIndex,
535 unsigned int nChannelIndex)
const;
537 void GetForceUnits(
char*& pLength,
char*& pForce)
const;
538 unsigned int GetForcePlateCount()
const;
539 bool GetForcePlate(
unsigned int nPlateIndex,
unsigned int& nID,
540 unsigned int& nAnalogDeviceID,
unsigned int& nFrequency,
541 char*& pType,
char*& pName,
float& fLength,
542 float& fWidth)
const;
543 bool GetForcePlateLocation(
unsigned int nPlateIndex, SPoint sCorner[4])
const;
544 bool GetForcePlateOrigin(
unsigned int nPlateIndex, SPoint& sOrigin)
const;
545 unsigned int GetForcePlateChannelCount(
unsigned int nPlateIndex)
const;
546 bool GetForcePlateChannel(
unsigned int nPlateIndex,
547 unsigned int nChannelIndex,
548 unsigned int& nChannelNumber,
549 float& fConversionFactor)
const;
550 bool GetForcePlateCalibrationMatrix(
unsigned int nPlateIndex,
551 float fvCalMatrix[12][12],
553 unsigned int* columns)
const;
555 unsigned int GetImageCameraCount()
const;
556 bool GetImageCamera(
unsigned int nCameraIndex,
unsigned int& nCameraID,
558 unsigned int& nWidth,
unsigned int& nHeight,
559 float& fCropLeft,
float& fCropTop,
float& fCropRight,
560 float& fCropBottom)
const;
562 unsigned int GetSkeletonCount()
const;
563 const char* GetSkeletonName(
unsigned int skeletonIndex);
564 unsigned int GetSkeletonSegmentCount(
unsigned int skeletonIndex);
565 bool GetSkeleton(
unsigned int skeletonIndex, SSettingsSkeleton* skeleton);
566 bool GetSkeletonSegment(
567 unsigned int skeletonIndex,
unsigned int segmentIndex,
568 SSettingsSkeletonSegment* segment);
570 ECameraSystemType GetCameraSystemType()
const;
572 bool SetSystemSettings(
const unsigned int* pnCaptureFrequency,
573 const float* pfCaptureTime,
574 const bool* pbStartOnExtTrig,
const bool* trigNO,
575 const bool* trigNC,
const bool* trigSoftware,
576 const EProcessingActions* peProcessingActions,
577 const EProcessingActions* peRtProcessingActions,
578 const EProcessingActions* peReprocessingActions);
580 bool SetExtTimeBaseSettings(
581 const bool* pbEnabled,
const ESignalSource* peSignalSource,
582 const bool* pbSignalModePeriodic,
const unsigned int* pnFreqMultiplier,
583 const unsigned int* pnFreqDivisor,
const unsigned int* pnFreqTolerance,
584 const float* pfNominalFrequency,
const bool* pbNegativeEdge,
585 const unsigned int* pnSignalShutterDelay,
586 const float* pfNonPeriodicTimeout);
588 bool SetCameraSettings(
const unsigned int nCameraID,
589 const ECameraMode* peMode,
590 const float* pfMarkerExposure,
591 const float* pfMarkerThreshold,
592 const int* pnOrientation);
594 bool SetCameraVideoSettings(
const unsigned int nCameraID,
595 const EVideoResolution* eVideoResolution,
596 const EVideoAspectRatio* eVideoAspectRatio,
597 const unsigned int* pnVideoFrequency,
598 const float* pfVideoExposure,
599 const float* pfVideoFlashTime);
601 bool SetCameraSyncOutSettings(
const unsigned int nCameraID,
602 const unsigned int portNumber,
603 const ESyncOutFreqMode* peSyncOutMode,
604 const unsigned int* pnSyncOutValue,
605 const float* pfSyncOutDutyCycle,
606 const bool* pbSyncOutNegativePolarity);
608 bool SetCameraLensControlSettings(
const unsigned int nCameraID,
609 const float focus,
const float aperture);
610 bool SetCameraAutoExposureSettings(
const unsigned int nCameraID,
611 const bool autoExposure,
612 const float compensation);
613 bool SetCameraAutoWhiteBalance(
const unsigned int nCameraID,
616 bool SetImageSettings(
const unsigned int nCameraID,
const bool* pbEnable,
618 const unsigned int* pnWidth,
619 const unsigned int* pnHeight,
const float* pfLeftCrop,
620 const float* pfTopCrop,
const float* pfRightCrop,
621 const float* pfBottomCrop);
623 bool SetForceSettings(
const unsigned int nPlateID,
const SPoint* psCorner1,
624 const SPoint* psCorner2,
const SPoint* psCorner3,
625 const SPoint* psCorner4);
627 char* GetErrorString();
630 bool SendString(
const char* pCmdStr,
int nType);
631 bool SendCommand(
const char* pCmdStr);
632 bool SendCommand(
const char* pCmdStr,
char* pCommandResponseStr,
634 bool SendXML(
const char* pCmdStr);
635 void AddXMLElementBool(
CMarkup* oXML,
const char* tTag,
const bool* pbValue,
636 const char* tTrue =
"True",
637 const char* tFalse =
"False");
638 void AddXMLElementBool(
CMarkup* oXML,
const char* tTag,
const bool bValue,
639 const char* tTrue =
"True",
640 const char* tFalse =
"False");
641 void AddXMLElementInt(
CMarkup* oXML,
const char* tTag,
const int* pnValue);
642 void AddXMLElementUnsignedInt(
CMarkup* oXML,
const char* tTag,
643 const unsigned int* pnValue);
644 void AddXMLElementFloat(
CMarkup* oXML,
const char* tTag,
const float* pfValue,
645 unsigned int pnDecimals = 6);
646 bool CompareNoCase(std::string tStr1,
const char* tStr2)
const;
652 unsigned int mDataBuffSize;
660 SSettingsGeneral msGeneralSettings;
661 SSettings3D ms3DSettings;
662 SSettings6DOF mvs6DOFSettings;
663 std::vector<SGazeVector> mvsGazeVectorSettings;
664 std::vector<SAnalogDevice> mvsAnalogDeviceSettings;
665 SSettingsForce msForceSettings;
666 std::vector<SImageCamera> mvsImageSettings;
667 std::vector<SSettingsSkeleton> mSkeletonSettings;
668 char maErrorStr[1024];
669 unsigned short mnBroadcastPort;
671 std::vector<SDiscoverResponse> mvsDiscoverResponseList;
674 #endif // RTPROTOCOL_H