sot-talos-balance  1.6.0
RTPacket.cpp
Go to the documentation of this file.
1 #define _CRT_SECURE_NO_WARNINGS
2 #define NOMINMAX
3 
4 #include <memory.h>
5 #include <float.h>
6 #include <stdint.h>
7 #include <math.h>
8 
9 #ifdef _WIN32
10 #include <Winsock2.h>
11 #else
12 #include <arpa/inet.h>
13 #endif
14 
16 
17 CRTPacket::CRTPacket(int nMajorVersion, int nMinorVersion, bool bBigEndian)
18 {
19  mnMajorVersion = nMajorVersion;
20  mnMinorVersion = nMinorVersion;
21  mbBigEndian = bBigEndian;
22 
23  ClearData();
24 }
25 
26 void CRTPacket::GetVersion(unsigned int &nMajorVersion, unsigned int &nMinorVersion)
27 {
28  nMajorVersion = mnMajorVersion;
29  nMinorVersion = mnMinorVersion;
30 }
31 
32 void CRTPacket::SetVersion(unsigned int nMajorVersion, unsigned int nMinorVersion)
33 {
34  mnMajorVersion = nMajorVersion;
35  mnMinorVersion = nMinorVersion;
36 }
37 
39 {
40  return mbBigEndian;
41 }
42 
43 void CRTPacket::SetEndianness(bool bBigEndian)
44 {
45  mbBigEndian = bBigEndian;
46 }
47 
49 {
50  mpData = nullptr;
51  mnComponentCount = 0;
52  mn2DCameraCount = 0;
53  mn2DLinCameraCount = 0;
54  mnImageCameraCount = 0;
55  mnAnalogDeviceCount = 0;
56  mnAnalogSingleDeviceCount = 0;
57  mnForcePlateCount = 0;
58  mnForceSinglePlateCount = 0;
59  mnGazeVectorCount = 0;
60  mnTimecodeCount = 0;
61  mSkeletonCount = 0;
62  memset(mpComponentData, 0, ComponentNone * 4);
63  memset(mp2DData, 0, MAX_CAMERA_COUNT * 4);
64  memset(mp2DLinData, 0, MAX_CAMERA_COUNT * 4);
65  memset(mpImageData, 0, MAX_CAMERA_COUNT * 4);
66  memset(mpAnalogData, 0, MAX_ANALOG_DEVICE_COUNT * 4);
67  memset(mpAnalogSingleData, 0, MAX_ANALOG_DEVICE_COUNT * 4);
68  memset(mpForceData, 0, MAX_FORCE_PLATE_COUNT * 4);
69  memset(mpForceSingleData, 0, MAX_FORCE_PLATE_COUNT * 4);
70  memset(mpGazeVectorData, 0, MAX_GAZE_VECTOR_COUNT * 4);
71  memset(mpSkeletonData, 0, MAX_SKELETON_COUNT * 4);
72 }
73 
74 void CRTPacket::SetData(char* ptr)
75 {
76  unsigned int nComponent;
77  unsigned int nCamera, nDevice;
78 
79  mpData = ptr;
80 
81  mnComponentCount = 0;
82  mn2DCameraCount = 0;
83  mn2DLinCameraCount = 0;
84  mnImageCameraCount = 0;
85  mnAnalogDeviceCount = 0;
86  mnAnalogSingleDeviceCount = 0;
87  mnForcePlateCount = 0;
88  mnForceSinglePlateCount = 0;
89  mnGazeVectorCount = 0;
90  mnTimecodeCount = 0;
91  mSkeletonCount = 0;
92 
93  // Check if it's a data packet
94  if (GetType() == PacketData)
95  {
96  // Reset all component data pointers
97  for (nComponent = 1; nComponent < ComponentNone; nComponent++)
98  {
99  mpComponentData[nComponent - 1] = nullptr;
100  }
101 
102  char* pCurrentComponent = mpData + 24;
103  unsigned int nComponentType = SetByteOrder((unsigned int*)(pCurrentComponent + 4));
104 
105  mnComponentCount = SetByteOrder((unsigned int*)(mpData + 20));
106 
107  for (nComponent = 1; nComponent <= mnComponentCount && nComponentType > 0 && nComponentType < ComponentNone; nComponent++)
108  {
109  mpComponentData[nComponentType - 1] = pCurrentComponent;
110 
111  if (nComponentType == Component2d)
112  {
113  mn2DCameraCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
114 
115  mp2DData[0] = pCurrentComponent + 16;
116  for (nCamera = 1; nCamera < mn2DCameraCount; nCamera++)
117  {
118  if (mnMajorVersion > 1 || mnMinorVersion > 7)
119  {
120  mp2DData[nCamera] = mp2DData[nCamera - 1] + 5 + Get2DMarkerCount(nCamera - 1) * 12;
121  }
122  else
123  {
124  mp2DData[nCamera] = mp2DData[nCamera - 1] + 4 + Get2DMarkerCount(nCamera - 1) * 12;
125  }
126  }
127  }
128  if (nComponentType == Component2dLin)
129  {
130  mn2DLinCameraCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
131 
132  mp2DLinData[0] = pCurrentComponent + 16;
133  for (nCamera = 1; nCamera < mn2DLinCameraCount; nCamera++)
134  {
135  if (mnMajorVersion > 1 || mnMinorVersion > 7)
136  {
137  mp2DLinData[nCamera] = mp2DLinData[nCamera - 1] + 5 + Get2DLinMarkerCount(nCamera - 1) * 12;
138  }
139  else
140  {
141  mp2DLinData[nCamera] = mp2DLinData[nCamera - 1] + 4 + Get2DLinMarkerCount(nCamera - 1) * 12;
142  }
143  }
144  }
145  if (nComponentType == ComponentImage)
146  {
147  mnImageCameraCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
148 
149  mpImageData[0] = pCurrentComponent + 12;
150  for (nCamera = 1; nCamera < mnImageCameraCount; nCamera++)
151  {
152  mpImageData[nCamera] = mpImageData[nCamera - 1] + 36 + SetByteOrder((unsigned int*)(mpImageData[nCamera - 1] + 32));
153  }
154  }
155  if (nComponentType == ComponentAnalog)
156  {
157  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
158  {
159  mnAnalogDeviceCount = 1;
160  }
161  else
162  {
163  mnAnalogDeviceCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
164  }
165 
166  if ((mnMajorVersion > 1) || (mnMinorVersion > 7))
167  {
168  mpAnalogData[0] = pCurrentComponent + 12;
169  }
170  else
171  {
172  mpAnalogData[0] = pCurrentComponent + 16;
173  }
174  for (nDevice = 1; nDevice < mnAnalogDeviceCount; nDevice++)
175  {
176  mpAnalogData[nDevice] = mpAnalogData[nDevice - 1] + 16 +
177  (SetByteOrder((unsigned int*)(mpAnalogData[nDevice - 1] + 4)) *
178  SetByteOrder((unsigned int*)(mpAnalogData[nDevice - 1] + 8)) * 4);
179  }
180  }
181  if (nComponentType == ComponentAnalogSingle)
182  {
183  mnAnalogSingleDeviceCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
184 
185  if (mnMajorVersion > 1 || mnMinorVersion > 7)
186  {
187  mpAnalogSingleData[0] = pCurrentComponent + 12;
188  }
189  else
190  {
191  mpAnalogSingleData[0] = pCurrentComponent + 16;
192  }
193 
194  for (nDevice = 1; nDevice < mnAnalogSingleDeviceCount; nDevice++)
195  {
196  mpAnalogSingleData[nDevice] = mpAnalogSingleData[nDevice - 1] + 8 +
197  SetByteOrder((unsigned int*)(mpAnalogSingleData[nDevice - 1] + 4)) * 4;
198  }
199  }
200  if (nComponentType == ComponentForce)
201  {
202  mnForcePlateCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
203 
204  if (mnMajorVersion > 1 || mnMinorVersion > 7)
205  {
206  mpForceData[0] = pCurrentComponent + 12;
207  }
208  else
209  {
210  mpForceData[0] = pCurrentComponent + 16;
211  }
212  for (nDevice = 1; nDevice < mnForcePlateCount; nDevice++)
213  {
214  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
215  {
216  mpForceData[nDevice] = mpForceData[nDevice - 1] + 72;
217  }
218  else
219  {
220  mpForceData[nDevice] = mpForceData[nDevice - 1] + 12 +
221  SetByteOrder((unsigned int*)(mpForceData[nDevice - 1] + 4)) * 36;
222  }
223  }
224  }
225  if (nComponentType == ComponentForceSingle)
226  {
227  mnForceSinglePlateCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
228 
229  mpForceSingleData[0] = pCurrentComponent + 12;
230 
231  for (nDevice = 1; nDevice < mnForceSinglePlateCount; nDevice++)
232  {
233  mpForceSingleData[nDevice] = mpForceSingleData[nDevice - 1] + 4 + 36;
234  }
235  }
236  if (nComponentType == ComponentGazeVector)
237  {
238  mnGazeVectorCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
239 
240  mpGazeVectorData[0] = pCurrentComponent + 12;
241 
242  for (nDevice = 1; nDevice < mnGazeVectorCount; nDevice++)
243  {
244  unsigned int nPrevSampleCount = SetByteOrder((unsigned int*)(mpGazeVectorData[nDevice - 1]));
245  mpGazeVectorData[nDevice] = mpGazeVectorData[nDevice - 1] + 4 + ((nPrevSampleCount == 0) ? 0 : 4) +
246  nPrevSampleCount * 24;
247  }
248  }
249  if (nComponentType == ComponentTimecode)
250  {
251  mnTimecodeCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
252 
253  mpTimecodeData[0] = pCurrentComponent + 12;
254 
255  for (nDevice = 1; nDevice < mnTimecodeCount; nDevice++)
256  {
257  mpTimecodeData[nDevice] = mpTimecodeData[nDevice - 1] + 12;
258  }
259  }
260  if (nComponentType == ComponentSkeleton)
261  {
262  mSkeletonCount = SetByteOrder((unsigned int*)(pCurrentComponent + 8));
263 
264  mpSkeletonData[0] = pCurrentComponent + 12;
265 
266  for (nDevice = 1; nDevice < mSkeletonCount; nDevice++)
267  {
268  unsigned int prevSegmentCount = SetByteOrder((unsigned int*)(mpSkeletonData[nDevice - 1]));
269  mpSkeletonData[nDevice] = mpSkeletonData[nDevice - 1] + 4 + prevSegmentCount * 32;
270  }
271  }
272  pCurrentComponent += SetByteOrder((int*)pCurrentComponent);
273  nComponentType = SetByteOrder((unsigned int*)(pCurrentComponent + 4));
274  }
275  }
276 } // SetData
277 
278 
279 void CRTPacket::GetData(char* &ptr, unsigned int &nSize)
280 {
281  if (mpData == nullptr)
282  {
283  nSize = 0;
284  }
285  else
286  {
287  ptr = mpData;
288  nSize = *((int*)mpData);
289  }
290 }
291 
292 unsigned int CRTPacket::GetSize()
293 {
294  if (mpData == nullptr)
295  {
296  return 0;
297  }
298  if (mbBigEndian || ((mnMajorVersion == 1) && (mnMinorVersion == 0)))
299  {
300  return ntohl(*((unsigned int*)mpData));
301  }
302  return *((unsigned int*)mpData);
303 }
304 
306 {
307  if (GetSize() < 8)
308  {
309  return PacketNone;
310  }
311  if (mbBigEndian || ((mnMajorVersion == 1) && (mnMinorVersion == 0)))
312  {
313  return (EPacketType)ntohl(*(unsigned int*)(mpData + 4));
314  }
315  return (EPacketType)*((unsigned int*)(mpData + 4));
316 }
317 
318 unsigned long long CRTPacket::GetTimeStamp()
319 {
320  if (GetType() == PacketData)
321  {
322  return SetByteOrder((long long*)(mpData + 8));
323  }
324  return 0;
325 }
326 
328 {
329  if (GetType() == PacketData)
330  {
331  return SetByteOrder((unsigned int*)(mpData + 16));
332  }
333  return 0;
334 }
335 
336 unsigned int CRTPacket::GetSize(char* pData, bool bBigEndian)
337 {
338  if (bBigEndian)
339  {
340  return ntohl(*((unsigned int*)pData));
341  }
342  return *((unsigned int*)pData);
343 }
344 
345 CRTPacket::EPacketType CRTPacket::GetType(char* pData, bool bBigEndian)
346 {
347  if (GetSize(pData, bBigEndian) < 8)
348  {
349  return PacketNone;
350  }
351  if (bBigEndian)
352  {
353  return (EPacketType)ntohl(*(unsigned int*)(pData + 4));
354  }
355  return (EPacketType)*((unsigned int*)(pData + 4));
356 }
357 
358 unsigned long long CRTPacket::GetTimeStamp(char* pData, bool bBigEndian)
359 {
360  if (GetType(pData, bBigEndian) == PacketData)
361  {
362  if (bBigEndian)
363  {
364  return ((unsigned long long)(ntohl((long)*((long long*)(pData + 8)))) << 32) + ntohl(*((long long*)(pData + 8)) >> 32);
365  }
366  return *((long long*)(pData + 8));
367  }
368  return 0;
369 }
370 
371 unsigned int CRTPacket::GetFrameNumber(char* pData, bool bBigEndian)
372 {
373  if (GetType(pData, bBigEndian) == PacketData)
374  {
375  if (bBigEndian)
376  {
377  return ntohl(*((unsigned int*)(pData + 16)));
378  }
379  return *((unsigned int*)(pData + 16));
380  }
381  return 0;
382 }
383 
385 {
386  return mnComponentCount;
387 }
388 
390 {
391  if (eComponent < Component3d || eComponent >= ComponentNone)
392  {
393  return 0;
394  }
395  if (mpComponentData[eComponent - 1] == nullptr)
396  {
397  return 0;
398  }
399  return SetByteOrder((unsigned int*)(mpComponentData[eComponent - 1]));
400 }
401 
403 {
404  if (GetType() == PacketError)
405  {
406  return mpData + 8;
407  }
408  return nullptr;
409 }
410 
411 
413 {
414  if (GetType() == PacketCommand)
415  {
416  return mpData + 8;
417  }
418  return nullptr;
419 }
420 
421 
422 char* CRTPacket::GetCommandString(char* pData, bool bBigEndian)
423 {
424  if (GetType(pData, bBigEndian) == PacketCommand)
425  {
426  return pData + 8;
427  }
428  return nullptr;
429 }
430 
431 
433 {
434  if (GetType() == PacketXML)
435  {
436  return mpData + 8;
437  }
438  return nullptr;
439 }
440 
441 
443 {
444  if (GetType() == PacketCommand)
445  {
446  if (GetSize() == (8 + strlen(mpData + 8) + 1 + 2))
447  {
448  return ntohs(*((short*)(mpData + 8 + strlen(mpData + 8) + 1)));
449  }
450  }
451  return 0;
452 }
453 
454 short CRTPacket::GetDiscoverResponseBasePort(char* pData, bool bBigEndian)
455 {
456  if (GetType(pData, bBigEndian) == PacketCommand)
457  {
458  if (GetSize(pData, bBigEndian) == (8 + strlen(pData + 8) + 1 + 2))
459  {
460  return ntohs(*((short*)(pData + 8 + strlen(pData + 8) + 1)));
461  }
462  }
463  return 0;
464 }
465 
467 {
468  if (GetType() == PacketEvent)
469  {
470  eEvent = (EEvent)*(mpData + 8);
471  return true;
472  }
473  return false;
474 }
475 
476 bool CRTPacket::GetEvent(EEvent &eEvent, char* pData, bool bBigEndian)
477 {
478  if (GetType(pData, bBigEndian) == PacketEvent)
479  {
480  eEvent = (EEvent)*(pData + 8);
481  return true;
482  }
483  return false;
484 }
485 
486 unsigned short CRTPacket::GetDropRate()
487 {
488  for (int i = 0; i <= 1; i++)
489  {
490  if (mpComponentData[i] != nullptr)
491  {
492  return SetByteOrder((unsigned short*)(mpComponentData[i] + 12));
493  }
494  }
495  for (int i = 4; i <= 11; i++)
496  {
497  if (mpComponentData[i] != nullptr)
498  {
499  return SetByteOrder((unsigned short*)(mpComponentData[i] + 12));
500  }
501  }
502  return 0;
503 }
504 
506 {
507  for (int i = 0; i <= 1; i++)
508  {
509  if (mpComponentData[i] != nullptr)
510  {
511  return SetByteOrder((unsigned short*)(mpComponentData[i] + 14));
512  }
513  }
514  for (int i = 4; i <= 11; i++)
515  {
516  if (mpComponentData[i] != nullptr)
517  {
518  return SetByteOrder((unsigned short*)(mpComponentData[i] + 14));
519  }
520  }
521  return 0;
522 }
523 
524 
525 
526 //-----------------------------------------------------------
527 // 2D
528 //-----------------------------------------------------------
530 {
531  return mn2DCameraCount;
532 }
533 
534 unsigned int CRTPacket::Get2DMarkerCount(unsigned int nCameraIndex)
535 {
536  if (mn2DCameraCount <= nCameraIndex)
537  {
538  return 0;
539  }
540  return SetByteOrder((unsigned int*)(mp2DData[nCameraIndex]));
541 }
542 
543 unsigned char CRTPacket::Get2DStatusFlags(unsigned int nCameraIndex)
544 {
545  if (mn2DCameraCount > nCameraIndex && ((mnMajorVersion > 1) || (mnMinorVersion > 7)))
546  {
547  return *((unsigned char*)(mp2DData[nCameraIndex] + 4));
548  }
549  return 0;
550 }
551 
552 bool CRTPacket::Get2DMarker(unsigned int nCameraIndex, unsigned int nMarkerIndex, unsigned int &nX, unsigned int &nY,
553  unsigned short &nXDiameter, unsigned short &nYDiameter)
554 {
555  int nOffset;
556 
557  if (mn2DCameraCount <= nCameraIndex || Get2DMarkerCount(nCameraIndex) <= nMarkerIndex)
558  {
559  return false;
560  }
561 
562  if (mnMajorVersion > 1 || mnMinorVersion > 7)
563  {
564  nOffset = 5;
565  }
566  else
567  {
568  nOffset = 4;
569  }
570  nX = SetByteOrder((unsigned int*)(mp2DData[nCameraIndex] + nOffset + nMarkerIndex * 12));
571  nY = SetByteOrder((unsigned int*)(mp2DData[nCameraIndex] + nOffset + 4 + nMarkerIndex * 12));
572  nXDiameter = SetByteOrder((unsigned short*)(mp2DData[nCameraIndex] + nOffset + 8 + nMarkerIndex * 12));
573  nYDiameter = SetByteOrder((unsigned short*)(mp2DData[nCameraIndex] + nOffset + 10 + nMarkerIndex * 12));
574 
575  return true;
576 }
577 
578 
579 //-----------------------------------------------------------
580 // 2D Linearized
581 //-----------------------------------------------------------
583 {
584  return mn2DLinCameraCount;
585 }
586 
587 unsigned int CRTPacket::Get2DLinMarkerCount(unsigned int nCameraIndex)
588 {
589  if (mn2DLinCameraCount <= nCameraIndex)
590  {
591  return 0;
592  }
593  return SetByteOrder((unsigned int*)(mp2DLinData[nCameraIndex]));
594 }
595 
596 unsigned char CRTPacket::Get2DLinStatusFlags(unsigned int nCameraIndex)
597 {
598  if (mn2DLinCameraCount > nCameraIndex && ((mnMajorVersion > 1) || (mnMinorVersion > 7)))
599  {
600  return *((unsigned char*)(mp2DLinData[nCameraIndex] + 4));
601  }
602  return 0;
603 }
604 
605 bool CRTPacket::Get2DLinMarker(unsigned int nCameraIndex, unsigned int nMarkerIndex, unsigned int &nX, unsigned int &nY,
606  unsigned short &nXDiameter, unsigned short &nYDiameter)
607 {
608  int nOffset;
609 
610  if (mn2DLinCameraCount <= nCameraIndex || Get2DLinMarkerCount(nCameraIndex) <= nMarkerIndex)
611  {
612  return false;
613  }
614 
615  if (mnMajorVersion > 1 || mnMinorVersion > 7)
616  {
617  nOffset = 5;
618  }
619  else
620  {
621  nOffset = 4;
622  }
623  nX = SetByteOrder((unsigned int*)(mp2DLinData[nCameraIndex] + nOffset + nMarkerIndex * 12));
624  nY = SetByteOrder((unsigned int*)(mp2DLinData[nCameraIndex] + nOffset + 4 + nMarkerIndex * 12));
625  nXDiameter = SetByteOrder((unsigned short*)(mp2DLinData[nCameraIndex] + nOffset + 8 + nMarkerIndex * 12));
626  nYDiameter = SetByteOrder((unsigned short*)(mp2DLinData[nCameraIndex] + nOffset + 10 + nMarkerIndex * 12));
627 
628  return true;
629 }
630 
631 
632 //-----------------------------------------------------------
633 // 3D
634 //-----------------------------------------------------------
636 {
638  {
639  return 0;
640  }
641 
642  char* pData = mpComponentData[Component3d - 1];
643 
644  if (pData == nullptr)
645  {
646  return 0;
647  }
648  return SetByteOrder((unsigned int*)(pData + 8));
649 }
650 
651 bool CRTPacket::Get3DMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ)
652 {
653  char* pData = mpComponentData[Component3d - 1];
654 
655  if (Get3DMarkerCount() <= nMarkerIndex)
656  {
657  return false;
658  }
659 
660  if (mnMajorVersion > 1 || mnMinorVersion > 7)
661  {
662  fX = SetByteOrder((float*)(pData + 16 + nMarkerIndex * 12));
663  fY = SetByteOrder((float*)(pData + 20 + nMarkerIndex * 12));
664  fZ = SetByteOrder((float*)(pData + 24 + nMarkerIndex * 12));
665  }
666  else
667  {
668  fX = (float)SetByteOrder((double*)(pData + 16 + nMarkerIndex * 24));
669  fY = (float)SetByteOrder((double*)(pData + 24 + nMarkerIndex * 24));
670  fZ = (float)SetByteOrder((double*)(pData + 32 + nMarkerIndex * 24));
671  }
672  return (isnan(fX) == 0);
673 }
674 
675 
676 //-----------------------------------------------------------
677 // 3D Residual
678 //-----------------------------------------------------------
680 {
681  char* pData = mpComponentData[Component3dRes - 1];
682 
683  if (pData == nullptr)
684  {
685  return 0;
686  }
687  return SetByteOrder((unsigned int*)(pData + 8));
688 }
689 
690 bool CRTPacket::Get3DResidualMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ, float &fResidual)
691 {
692  char* pData = mpComponentData[Component3dRes - 1];
693 
694  if (Get3DResidualMarkerCount() <= nMarkerIndex)
695  {
696  return false;
697  }
698 
699  if (mnMajorVersion > 1 || mnMinorVersion > 7)
700  {
701  fX = SetByteOrder((float*)(pData + 16 + nMarkerIndex * 16));
702  fY = SetByteOrder((float*)(pData + 20 + nMarkerIndex * 16));
703  fZ = SetByteOrder((float*)(pData + 24 + nMarkerIndex * 16));
704  fResidual = SetByteOrder((float*)(pData + 28 + nMarkerIndex * 16));
705  }
706  else
707  {
708  fX = (float)SetByteOrder((double*)(pData + 16 + nMarkerIndex * 32));
709  fY = (float)SetByteOrder((double*)(pData + 24 + nMarkerIndex * 32));
710  fZ = (float)SetByteOrder((double*)(pData + 32 + nMarkerIndex * 32));
711  fResidual = SetByteOrder((float*) (pData + 40 + nMarkerIndex * 32));
712  }
713  return (isnan(fX) == 0);
714 }
715 
716 
717 //-----------------------------------------------------------
718 // 3D No Labels
719 //-----------------------------------------------------------
721 {
722  char* pData = mpComponentData[Component3dNoLabels - 1];
723 
724  if (pData == nullptr)
725  {
726  return 0;
727  }
728  return SetByteOrder((unsigned int*)(pData + 8));
729 }
730 
731 bool CRTPacket::Get3DNoLabelsMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ, unsigned int &nId)
732 {
733  char* pData = mpComponentData[Component3dNoLabels - 1];
734 
735  if (Get3DNoLabelsMarkerCount() <= nMarkerIndex)
736  {
737  return false;
738  }
739 
740  if (mnMajorVersion > 1 || mnMinorVersion > 7)
741  {
742  fX = SetByteOrder((float*)(pData + 16 + nMarkerIndex * 16));
743  fY = SetByteOrder((float*)(pData + 20 + nMarkerIndex * 16));
744  fZ = SetByteOrder((float*)(pData + 24 + nMarkerIndex * 16));
745  nId = SetByteOrder((unsigned int*)(pData + 28 + nMarkerIndex * 16));
746  }
747  else
748  {
749  fX = (float)SetByteOrder((double*)(pData + 16 + nMarkerIndex * 32));
750  fY = (float)SetByteOrder((double*)(pData + 24 + nMarkerIndex * 32));
751  fZ = (float)SetByteOrder((double*)(pData + 32 + nMarkerIndex * 32));
752  nId = SetByteOrder((unsigned int*)(pData + 40 + nMarkerIndex * 32));
753  }
754  return true;
755 }
756 
757 
758 //-----------------------------------------------------------
759 // 3D No Labels Residual
760 //-----------------------------------------------------------
762 {
763  char* pData = mpComponentData[Component3dNoLabelsRes - 1];
764 
765  if (pData == nullptr)
766  {
767  return 0;
768  }
769  return SetByteOrder((unsigned int*)(pData + 8));
770 }
771 
772 bool CRTPacket::Get3DNoLabelsResidualMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ,
773  unsigned int &nId, float &fResidual)
774 {
775  char* pData = mpComponentData[Component3dNoLabelsRes - 1];
776 
777  if (Get3DNoLabelsResidualMarkerCount() <= nMarkerIndex)
778  {
779  return false;
780  }
781 
782  if (mnMajorVersion > 1 || mnMinorVersion > 7)
783  {
784  fX = SetByteOrder((float*)(pData + 16 + nMarkerIndex * 20));
785  fY = SetByteOrder((float*)(pData + 20 + nMarkerIndex * 20));
786  fZ = SetByteOrder((float*)(pData + 24 + nMarkerIndex * 20));
787  nId = SetByteOrder((unsigned int*)(pData + 28 + nMarkerIndex * 20));
788  fResidual = SetByteOrder((float*)(pData + 32 + nMarkerIndex * 20));
789  }
790  else
791  {
792  fX = (float)SetByteOrder((double*)(pData + 16 + nMarkerIndex * 32));
793  fY = (float)SetByteOrder((double*)(pData + 24 + nMarkerIndex * 32));
794  fZ = (float)SetByteOrder((double*)(pData + 32 + nMarkerIndex * 32));
795  nId = SetByteOrder((unsigned int*)(pData + 40 + nMarkerIndex * 32));
796  fResidual = SetByteOrder((float*) (pData + 44 + nMarkerIndex * 32));
797  }
798  return true;
799 }
800 
801 
802 //-----------------------------------------------------------
803 // 6DOF
804 //-----------------------------------------------------------
806 {
807  char* pData = mpComponentData[Component6d - 1];
808 
809  if (pData == nullptr)
810  {
811  return 0;
812  }
813  return SetByteOrder((unsigned int*)(pData + 8));
814 }
815 
816 bool CRTPacket::Get6DOFBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ, float afRotMatrix[9])
817 {
818  char* pData = mpComponentData[Component6d - 1];
819 
820  if (Get6DOFBodyCount() <= nBodyIndex)
821  {
822  return false;
823  }
824 
825  if (mnMajorVersion > 1 || mnMinorVersion > 7)
826  {
827  fX = SetByteOrder((float*)(pData + 16 + nBodyIndex * 48));
828  fY = SetByteOrder((float*)(pData + 20 + nBodyIndex * 48));
829  fZ = SetByteOrder((float*)(pData + 24 + nBodyIndex * 48));
830  for (int i = 0; i < 9; i++)
831  {
832  afRotMatrix[i] = SetByteOrder((float*)(pData + 28 + (i * 4) + nBodyIndex * 48));
833  }
834  }
835  else
836  {
837  fX = (float)SetByteOrder((double*)(pData + 16 + nBodyIndex * 96));
838  fY = (float)SetByteOrder((double*)(pData + 24 + nBodyIndex * 96));
839  fZ = (float)SetByteOrder((double*)(pData + 32 + nBodyIndex * 96));
840  for (int i = 0; i < 9; i++)
841  {
842  afRotMatrix[i] = (float)SetByteOrder((double*)(pData + 40 + (i * 4) + nBodyIndex * 96));
843  }
844  }
845  return true;
846 }
847 
848 
849 //-----------------------------------------------------------
850 // 6DOF Residual
851 //-----------------------------------------------------------
853 {
854  char* pData = mpComponentData[Component6dRes - 1];
855 
856  if (pData == nullptr)
857  {
858  return 0;
859  }
860  return SetByteOrder((unsigned int*)(pData + 8));
861 }
862 
863 bool CRTPacket::Get6DOFResidualBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ,
864  float afRotMatrix[9], float &fResidual)
865 {
866  char* pData = mpComponentData[Component6dRes - 1];
867 
868  if (Get6DOFResidualBodyCount() <= nBodyIndex)
869  {
870  return false;
871  }
872 
873  if (mnMajorVersion > 1 || mnMinorVersion > 7)
874  {
875  fX = SetByteOrder((float*)(pData + 16 + nBodyIndex * 52));
876  fY = SetByteOrder((float*)(pData + 20 + nBodyIndex * 52));
877  fZ = SetByteOrder((float*)(pData + 24 + nBodyIndex * 52));
878  for (int i = 0; i < 9; i++)
879  {
880  afRotMatrix[i] = SetByteOrder((float*)(pData + 28 + (i * 4) + nBodyIndex * 52));
881  }
882  fResidual = SetByteOrder((float*)(pData + 64 + nBodyIndex * 52));
883  }
884  else
885  {
886  fX = (float)SetByteOrder((double*)(pData + 16 + nBodyIndex * 104));
887  fY = (float)SetByteOrder((double*)(pData + 24 + nBodyIndex * 104));
888  fZ = (float)SetByteOrder((double*)(pData + 32 + nBodyIndex * 104));
889  for (int i = 0; i < 9; i++)
890  {
891  afRotMatrix[i] = (float)SetByteOrder((double*)(pData + 40 + (i * 8) + nBodyIndex * 104));
892  }
893  fResidual = SetByteOrder((float*)(pData + 112 + nBodyIndex * 104));
894  }
895  return true;
896 }
897 
898 
899 //-----------------------------------------------------------
900 // 6DOF Euler
901 //-----------------------------------------------------------
903 {
904  char* pData = mpComponentData[Component6dEuler - 1];
905 
906  if (pData == nullptr)
907  {
908  return 0;
909  }
910  return SetByteOrder((unsigned int*)(pData + 8));
911 }
912 
913 bool CRTPacket::Get6DOFEulerBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ,
914  float &fAng1, float &fAng2, float &fAng3)
915 {
916  char* pData = mpComponentData[Component6dEuler - 1];
917 
918  if (Get6DOFEulerBodyCount() <= nBodyIndex)
919  {
920  return false;
921  }
922 
923  if (mnMajorVersion > 1 || mnMinorVersion > 7)
924  {
925  fX = SetByteOrder((float*)(pData + 16 + nBodyIndex * 24));
926  fY = SetByteOrder((float*)(pData + 20 + nBodyIndex * 24));
927  fZ = SetByteOrder((float*)(pData + 24 + nBodyIndex * 24));
928  fAng1 = SetByteOrder((float*)(pData + 28 + nBodyIndex * 24));
929  fAng2 = SetByteOrder((float*)(pData + 32 + nBodyIndex * 24));
930  fAng3 = SetByteOrder((float*)(pData + 36 + nBodyIndex * 24));
931  }
932  else
933  {
934  fX = (float)SetByteOrder((double*)(pData + 16 + nBodyIndex * 48));
935  fY = (float)SetByteOrder((double*)(pData + 24 + nBodyIndex * 48));
936  fZ = (float)SetByteOrder((double*)(pData + 32 + nBodyIndex * 48));
937  fAng1 = (float)SetByteOrder((double*)(pData + 40 + nBodyIndex * 48));
938  fAng2 = (float)SetByteOrder((double*)(pData + 48 + nBodyIndex * 48));
939  fAng3 = (float)SetByteOrder((double*)(pData + 56 + nBodyIndex * 48));
940  }
941  return true;
942 }
943 
944 
945 //-----------------------------------------------------------
946 // 6DOF Euler Residual
947 //-----------------------------------------------------------
949 {
950  char* pData = mpComponentData[Component6dEulerRes - 1];
951 
952  if (pData == nullptr)
953  {
954  return 0;
955  }
956  return SetByteOrder((unsigned int*)(pData + 8));
957 }
958 
959 bool CRTPacket::Get6DOFEulerResidualBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ,
960  float &fAng1, float &fAng2, float &fAng3, float &fResidual)
961 {
962  char* pData = mpComponentData[Component6dEulerRes - 1];
963 
964  if (Get6DOFEulerResidualBodyCount() <= nBodyIndex)
965  {
966  return false;
967  }
968 
969  if (mnMajorVersion > 1 || mnMinorVersion > 7)
970  {
971  fX = SetByteOrder((float*)(pData + 16 + nBodyIndex * 28));
972  fY = SetByteOrder((float*)(pData + 20 + nBodyIndex * 28));
973  fZ = SetByteOrder((float*)(pData + 24 + nBodyIndex * 28));
974  fAng1 = SetByteOrder((float*)(pData + 28 + nBodyIndex * 28));
975  fAng2 = SetByteOrder((float*)(pData + 32 + nBodyIndex * 28));
976  fAng3 = SetByteOrder((float*)(pData + 36 + nBodyIndex * 28));
977  fResidual = SetByteOrder((float*)(pData + 40 + nBodyIndex * 28));
978  }
979  else
980  {
981  fX = (float)SetByteOrder((double*)(pData + 16 + nBodyIndex * 56));
982  fY = (float)SetByteOrder((double*)(pData + 24 + nBodyIndex * 56));
983  fZ = (float)SetByteOrder((double*)(pData + 32 + nBodyIndex * 56));
984  fAng1 = (float)SetByteOrder((double*)(pData + 40 + nBodyIndex * 56));
985  fAng2 = (float)SetByteOrder((double*)(pData + 48 + nBodyIndex * 56));
986  fAng3 = (float)SetByteOrder((double*)(pData + 56 + nBodyIndex * 56));
987  fResidual = SetByteOrder( (float*)(pData + 64 + nBodyIndex * 56));
988  }
989  return true;
990 }
991 
992 
993 //-----------------------------------------------------------
994 // Gaze Vector
995 //-----------------------------------------------------------
997 {
998  return mnGazeVectorCount;
999 }
1000 
1001 unsigned int CRTPacket::GetGazeVectorSampleCount(unsigned int nVectorIndex)
1002 {
1003  if (mnGazeVectorCount <= nVectorIndex)
1004  {
1005  return 0;
1006  }
1007  return SetByteOrder((unsigned int*)(mpGazeVectorData[nVectorIndex]));
1008 }
1009 
1010 unsigned int CRTPacket::GetGazeVectorSampleNumber(unsigned int nVectorIndex)
1011 {
1012  unsigned int nSampleCount = GetGazeVectorSampleCount(nVectorIndex);
1013 
1014  if (nSampleCount == 0)
1015  {
1016  return 0;
1017  }
1018  return SetByteOrder((unsigned int*)(mpGazeVectorData[nVectorIndex] + 4));
1019 }
1020 
1021 bool CRTPacket::GetGazeVector(unsigned int nVectorIndex, unsigned int nSampleIndex, SGazeVector &sGazeVector)
1022 {
1023  unsigned int nSampleCount = GetGazeVectorSampleCount(nVectorIndex);
1024 
1025  if (nSampleCount == 0 || nSampleIndex >= nSampleCount)
1026  {
1027  return false;
1028  }
1029 
1030  for (unsigned int k = 0; k < 6; k++)
1031  {
1032  *(((float*)&sGazeVector) + k) =
1033  (float)SetByteOrder((float*)(mpGazeVectorData[nVectorIndex] + 8 + k * sizeof(float) + nSampleIndex * 24));
1034  }
1035 
1036  return (isnan(sGazeVector.fPosX) == 0);
1037 }
1038 
1039 bool CRTPacket::GetGazeVector(unsigned int nVectorIndex, SGazeVector* pGazeVectorBuf, unsigned int nBufSize)
1040 {
1041  unsigned int nSampleCount = GetGazeVectorSampleCount(nVectorIndex);
1042 
1043  if (nSampleCount == 0 || (nBufSize < nSampleCount * sizeof(SGazeVector)))
1044  {
1045  return false;
1046  }
1047 
1048  for (unsigned int nSample = 0; nSample < nSampleCount; nSample++)
1049  {
1050  for (unsigned int k = 0; k < 6; k++)
1051  {
1052  *(((float*)pGazeVectorBuf) + k + (nSample * sizeof(SGazeVector))) =
1053  (float)SetByteOrder((float*)(mpGazeVectorData[nVectorIndex] + 8 + k * sizeof(float) + nSample * 24));
1054  }
1055  }
1056 
1057  return true;
1058 }
1059 
1060 
1061 //-----------------------------------------------------------
1062 // Timecode
1063 //-----------------------------------------------------------
1065 {
1066  return mnTimecodeCount;
1067 }
1068 
1069 bool CRTPacket::GetTimecodeType(unsigned int nTimecodeIndex, CRTPacket::ETimecodeType &timecodeType)
1070 {
1071  if (mnTimecodeCount <= nTimecodeIndex)
1072  {
1073  return false;
1074  }
1075  timecodeType = (CRTPacket::ETimecodeType)SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex]));
1076  return true;
1077 }
1078 
1079 bool CRTPacket::GetTimecodeSMPTE(unsigned int nTimecodeIndex, int &hours, int &minutes, int &seconds, int &frame)
1080 {
1081  if (mnTimecodeCount <= nTimecodeIndex)
1082  {
1083  return false;
1084  }
1085  CRTPacket::ETimecodeType timecodeType;
1086  if (GetTimecodeType(nTimecodeIndex, timecodeType))
1087  {
1088  if (timecodeType == TimecodeSMPTE)
1089  {
1090  hours = 0x1f & SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8));
1091  minutes = 0x3f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 5);
1092  seconds = 0x3f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 11);
1093  frame = 0x1f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 17);
1094  return true;
1095  }
1096  }
1097  return false;
1098 }
1099 
1100 bool CRTPacket::GetTimecodeIRIG(unsigned int nTimecodeIndex, int &year, int &day, int &hours, int &minutes, int &seconds, int &tenths)
1101 {
1102  if (mnTimecodeCount <= nTimecodeIndex)
1103  {
1104  return false;
1105  }
1106  CRTPacket::ETimecodeType timecodeType;
1107  if (GetTimecodeType(nTimecodeIndex, timecodeType))
1108  {
1109  if (timecodeType == TimecodeIRIG)
1110  {
1111  year = 0x007f & SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 4));
1112  day = 0x01ff & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 4)) >> 7);
1113  hours = 0x001f & SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8));
1114  minutes = 0x003f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 5);
1115  seconds = 0x003f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 11);
1116  tenths = 0x000f & (SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8)) >> 17);
1117  return true;
1118  }
1119  }
1120  return false;
1121 }
1122 
1123 bool CRTPacket::GetTimecodeCameraTime(unsigned int nTimecodeIndex, unsigned long long &cameraTime)
1124 {
1125  if (mnTimecodeCount <= nTimecodeIndex)
1126  {
1127  return false;
1128  }
1129  CRTPacket::ETimecodeType timecodeType;
1130  if (GetTimecodeType(nTimecodeIndex, timecodeType))
1131  {
1132  if (timecodeType == TimecodeCamerTime)
1133  {
1134  cameraTime = ((long long)SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 4))) << 32 |
1135  (long long)SetByteOrder((unsigned int*)(mpTimecodeData[nTimecodeIndex] + 8));
1136  return true;
1137  }
1138  }
1139  return false;
1140 }
1141 
1142 
1143 //-----------------------------------------------------------
1144 // Image
1145 //-----------------------------------------------------------
1147 {
1148  return mnImageCameraCount;
1149 }
1150 
1151 unsigned int CRTPacket::GetImageCameraId(unsigned int nCameraIndex)
1152 {
1153  if (mnImageCameraCount <= nCameraIndex)
1154  {
1155  return 0;
1156  }
1157  return SetByteOrder((unsigned int*)(mpImageData[nCameraIndex]));
1158 }
1159 
1160 bool CRTPacket::GetImageFormat(unsigned int nCameraIndex, EImageFormat &eImageFormat)
1161 {
1162  if (mnImageCameraCount <= nCameraIndex)
1163  {
1164  return false;
1165  }
1166  eImageFormat = (EImageFormat)SetByteOrder((unsigned int*)(mpImageData[nCameraIndex] + 4));
1167 
1168  return true;
1169 }
1170 
1171 bool CRTPacket::GetImageSize(unsigned int nCameraIndex, unsigned int &nWidth, unsigned int &nHeight)
1172 {
1173  if (mnImageCameraCount <= nCameraIndex)
1174  {
1175  return false;
1176  }
1177  nWidth = SetByteOrder((unsigned int*)(mpImageData[nCameraIndex] + 8));
1178  nHeight = SetByteOrder((unsigned int*)(mpImageData[nCameraIndex] + 12));
1179 
1180  return true;
1181 }
1182 
1183 bool CRTPacket::GetImageCrop(unsigned int nCameraIndex, float &fCropLeft, float &fCropTop,
1184  float &fCropRight, float &fCropBottom)
1185 {
1186  if (mnImageCameraCount <= nCameraIndex)
1187  {
1188  return false;
1189  }
1190  fCropLeft = SetByteOrder((float*)(mpImageData[nCameraIndex] + 16));
1191  fCropTop = SetByteOrder((float*)(mpImageData[nCameraIndex] + 20));
1192  fCropRight = SetByteOrder((float*)(mpImageData[nCameraIndex] + 24));
1193  fCropBottom = SetByteOrder((float*)(mpImageData[nCameraIndex] + 28));
1194 
1195  return true;
1196 }
1197 
1198 unsigned int CRTPacket::GetImageSize(unsigned int nCameraIndex)
1199 {
1200  if (((mnMajorVersion == 1) && (mnMinorVersion < 8)) || mnImageCameraCount <= nCameraIndex)
1201  {
1202  return 0;
1203  }
1204 
1205  return SetByteOrder((unsigned int*)(mpImageData[nCameraIndex] + 32));
1206 }
1207 
1208 unsigned int CRTPacket::GetImage(unsigned int nCameraIndex, char* pDataBuf, unsigned int nBufSize)
1209 {
1210  if (((mnMajorVersion == 1) && (mnMinorVersion < 8)) || mnImageCameraCount <= nCameraIndex)
1211  {
1212  return 0;
1213  }
1214 
1215  unsigned int nSize = SetByteOrder((unsigned int*)(mpImageData[nCameraIndex] + 32));
1216 
1217  if (nBufSize < nSize)
1218  {
1219  return 0;
1220  }
1221  memcpy(pDataBuf, mpImageData[nCameraIndex] + 36, nSize);
1222 
1223  return nSize;
1224 }
1225 
1226 
1227 //-----------------------------------------------------------
1228 // Analog
1229 //-----------------------------------------------------------
1231 {
1232  return mnAnalogDeviceCount;
1233 }
1234 
1235 unsigned int CRTPacket::GetAnalogDeviceId(unsigned int nDeviceIndex)
1236 {
1237  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1238  {
1239  return 1;
1240  }
1241  if (mnAnalogDeviceCount <= nDeviceIndex)
1242  {
1243  return 0;
1244  }
1245  return SetByteOrder((unsigned int*)(mpAnalogData[nDeviceIndex]));
1246 }
1247 
1248 unsigned int CRTPacket::GetAnalogChannelCount(unsigned int nDeviceIndex)
1249 {
1250  char* pData = mpComponentData[ComponentAnalog - 1];
1251 
1252  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1253  {
1254  return SetByteOrder((unsigned int*)(pData + 8));
1255  }
1256  if (mnAnalogDeviceCount <= nDeviceIndex)
1257  {
1258  return 0;
1259  }
1260  return SetByteOrder((unsigned int*)(mpAnalogData[nDeviceIndex] + 4));
1261 }
1262 
1263 unsigned int CRTPacket::GetAnalogSampleCount(unsigned int nDeviceIndex)
1264 {
1265  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1266  {
1267  return 1;
1268  }
1269  if (mnAnalogDeviceCount <= nDeviceIndex)
1270  {
1271  return 0;
1272  }
1273  return SetByteOrder((unsigned int*)(mpAnalogData[nDeviceIndex] + 8));
1274 }
1275 
1276 unsigned int CRTPacket::GetAnalogSampleNumber(unsigned int nDeviceIndex)
1277 {
1278  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1279  {
1280  return GetFrameNumber();
1281  }
1282 
1283  if (mnAnalogDeviceCount <= nDeviceIndex)
1284  {
1285  return 0;
1286  }
1287  return SetByteOrder((unsigned int*)(mpAnalogData[nDeviceIndex] + 12));
1288 }
1289 
1290 unsigned int CRTPacket::GetAnalogData(unsigned int nDeviceIndex, float* pDataBuf, unsigned int nBufSize)
1291 {
1292  unsigned int nSize = 0;
1293 
1294  if (nDeviceIndex < mnAnalogDeviceCount)
1295  {
1296  unsigned int nChannelCount = GetAnalogChannelCount(nDeviceIndex);
1297 
1298  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1299  {
1300  nSize = nChannelCount;
1301  if (nBufSize < nSize || pDataBuf == nullptr)
1302  {
1303  nSize = 0;
1304  }
1305  for (unsigned int i = 0; i < nSize; i++)
1306  {
1307  pDataBuf[i] = (float)SetByteOrder((double*)(mpAnalogData[nDeviceIndex] + i * sizeof(double)));
1308  }
1309  }
1310  else
1311  {
1312  nSize = nChannelCount * GetAnalogSampleCount(nDeviceIndex);
1313  if (nBufSize < nSize || pDataBuf == nullptr)
1314  {
1315  nSize = 0;
1316  }
1317  for (unsigned int i = 0; i < nSize; i++)
1318  {
1319  pDataBuf[i] = (float)SetByteOrder((float*)(mpAnalogData[nDeviceIndex] + 16 + i * sizeof(float)));
1320  }
1321  }
1322  }
1323 
1324  return nSize;
1325 }
1326 
1327 unsigned int CRTPacket::GetAnalogData(unsigned int nDeviceIndex, unsigned int nChannelIndex, float* pDataBuf, unsigned int nBufSize)
1328 {
1329  unsigned int nSampleCount = 0;
1330  unsigned int nChannelCount = GetAnalogChannelCount(nDeviceIndex);
1331 
1332  if (nDeviceIndex < mnAnalogDeviceCount && nChannelIndex < nChannelCount)
1333  {
1334  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1335  {
1336  if (nBufSize == 0 || pDataBuf == nullptr)
1337  {
1338  nSampleCount = 0;
1339  }
1340  else
1341  {
1342  nSampleCount = 1;
1343  pDataBuf[0] = (float)SetByteOrder((double*)(mpAnalogData[nDeviceIndex] + nChannelIndex * sizeof(double)));
1344  }
1345  }
1346  else
1347  {
1348  nSampleCount = GetAnalogSampleCount(nDeviceIndex);
1349  if (nBufSize < nSampleCount || pDataBuf == nullptr)
1350  {
1351  nSampleCount = 0;
1352  }
1353  for (unsigned int i = 0; i < nSampleCount; i++)
1354  {
1355  pDataBuf[i] = (float)SetByteOrder((float*)(mpAnalogData[nDeviceIndex] + 16 +
1356  nChannelIndex * nSampleCount * sizeof(float) + i * sizeof(float)));
1357  }
1358  }
1359  }
1360 
1361  return nSampleCount;
1362 }
1363 
1364 bool CRTPacket::GetAnalogData(unsigned int nDeviceIndex, unsigned int nChannelIndex, unsigned int nSampleIndex,
1365  float &fAnalogValue)
1366 {
1367  if (nDeviceIndex < mnAnalogDeviceCount)
1368  {
1369  unsigned int nSampleCount = GetAnalogSampleCount(nDeviceIndex);
1370 
1371  if (GetAnalogChannelCount(nDeviceIndex) > nChannelIndex &&
1372  nSampleCount > nSampleIndex)
1373  {
1374  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1375  {
1376  fAnalogValue = (float)SetByteOrder((double*)(mpAnalogData[nDeviceIndex] + nChannelIndex * sizeof(double)));
1377  }
1378  else
1379  {
1380  fAnalogValue = SetByteOrder((float*)(mpAnalogData[nDeviceIndex] + 16 +
1381  (nChannelIndex * nSampleCount + nSampleIndex) * sizeof(float)));
1382  }
1383  if (isnan(fAnalogValue) == 0)
1384  {
1385  return true;
1386  }
1387  }
1388  }
1389  return false;
1390 }
1391 
1392 
1393 //-----------------------------------------------------------
1394 // Analog Single
1395 //-----------------------------------------------------------
1397 {
1398  return mnAnalogSingleDeviceCount;
1399 }
1400 
1401 unsigned int CRTPacket::GetAnalogSingleDeviceId(unsigned int nDeviceIndex)
1402 {
1403  if (mnAnalogSingleDeviceCount <= nDeviceIndex)
1404  {
1405  return 0;
1406  }
1407  return SetByteOrder((unsigned int*)(mpAnalogSingleData[nDeviceIndex]));
1408 }
1409 
1410 unsigned int CRTPacket::GetAnalogSingleChannelCount(unsigned int nDeviceIndex)
1411 {
1412  if (mnAnalogSingleDeviceCount <= nDeviceIndex)
1413  {
1414  return 0;
1415  }
1416  return SetByteOrder((unsigned int*)(mpAnalogSingleData[nDeviceIndex] + 4));
1417 }
1418 
1419 unsigned int CRTPacket::GetAnalogSingleData(unsigned int nDeviceIndex, float* pDataBuf, unsigned int nBufSize)
1420 {
1421  unsigned int nSize = 0;
1422 
1423  if (nDeviceIndex < mnAnalogSingleDeviceCount)
1424  {
1425  nSize = GetAnalogSingleChannelCount(nDeviceIndex);
1426  if (nBufSize < nSize || pDataBuf == nullptr)
1427  {
1428  nSize = 0;
1429  }
1430  for (unsigned int i = 0; i < nSize; i++)
1431  {
1432  pDataBuf[i] = SetByteOrder((float*)(mpAnalogSingleData[nDeviceIndex] + 8 + i * sizeof(float)));
1433  }
1434  }
1435 
1436  return nSize;
1437 }
1438 
1439 bool CRTPacket::GetAnalogSingleData(unsigned int nDeviceIndex, unsigned int nChannelIndex, float &fValue)
1440 {
1441  if (nDeviceIndex < mnAnalogSingleDeviceCount)
1442  {
1443  if (nChannelIndex < GetAnalogSingleChannelCount(nDeviceIndex))
1444  {
1445  fValue = SetByteOrder(((float*)(mpAnalogSingleData[nDeviceIndex] + 8 + nChannelIndex * sizeof(float))));
1446  return (isnan(fValue) == 0);
1447  }
1448  }
1449  return false;
1450 }
1451 
1452 
1453 //-----------------------------------------------------------
1454 // Force
1455 //-----------------------------------------------------------
1457 {
1458  return mnForcePlateCount;
1459 }
1460 
1461 unsigned int CRTPacket::GetForcePlateId(unsigned int nPlateIndex)
1462 {
1463  if ((mnMajorVersion == 1 && mnMinorVersion == 0) || mnForcePlateCount <= nPlateIndex)
1464  {
1465  return 0;
1466  }
1467  return SetByteOrder((unsigned int*)(mpForceData[nPlateIndex]));
1468 }
1469 
1470 unsigned int CRTPacket::GetForceCount(unsigned int nPlateIndex)
1471 {
1472  if (mnForcePlateCount <= nPlateIndex)
1473  {
1474  return 0;
1475  }
1476  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1477  {
1478  return 1;
1479  }
1480  return SetByteOrder((unsigned int*)(mpForceData[nPlateIndex] + 4));
1481 }
1482 
1483 unsigned int CRTPacket::GetForceNumber(unsigned int nPlateIndex)
1484 {
1485  if (mnForcePlateCount <= nPlateIndex)
1486  {
1487  return 0;
1488  }
1489  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1490  {
1491  return GetFrameNumber();
1492  }
1493  return SetByteOrder((unsigned int*)(mpForceData[nPlateIndex] + 8));
1494 }
1495 
1496 unsigned int CRTPacket::GetForceData(unsigned int nPlateIndex, SForce* pForceBuf, unsigned int nBufSize)
1497 {
1498  unsigned int nSize = 0;
1499 
1500  if (nPlateIndex < mnForcePlateCount)
1501  {
1502  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1503  {
1504  if (nPlateIndex == 0)
1505  {
1506  for (unsigned int k = 0; k < 9; k++)
1507  {
1508  *(((float*)pForceBuf) + k) =
1509  (float)SetByteOrder((double*)(mpForceData[nPlateIndex] + k * sizeof(double)));
1510  }
1511  nSize = 1;
1512  }
1513  }
1514  else
1515  {
1516  nSize = GetForceCount(nPlateIndex);
1517  if (nBufSize < nSize || pForceBuf == nullptr)
1518  {
1519  nSize = 0;
1520  }
1521  for (unsigned int i = 0; i < nSize; i++)
1522  {
1523  for (unsigned int k = 0; k < 9; k++)
1524  {
1525  *(((float*)&pForceBuf[i]) + k) =
1526  SetByteOrder((float*)(mpForceData[nPlateIndex] + 12 + (k * 4) + i * sizeof(SForce)));
1527  }
1528  }
1529  }
1530  }
1531  return nSize;
1532 }
1533 
1534 bool CRTPacket::GetForceData(unsigned int nPlateIndex, unsigned int nForceIndex, SForce &sForce)
1535 {
1536  if (nPlateIndex < mnForcePlateCount)
1537  {
1538  if ((mnMajorVersion == 1) && (mnMinorVersion == 0))
1539  {
1540  if (nPlateIndex == 0 && nForceIndex == 0)
1541  {
1542  for (unsigned int k = 0; k < 9; k++)
1543  {
1544  *(((float*)&sForce) + k) =
1545  (float)SetByteOrder((double*)(mpForceData[nPlateIndex] + k * sizeof(double)));
1546 
1547  // Not a valid force if one of the values is not a valid float.
1548  if (isnan(*(((float*)&sForce) + k)) != 0)
1549  {
1550  return false;
1551  }
1552  }
1553  return true;
1554  }
1555  }
1556  else
1557  {
1558  if (nForceIndex < GetForceCount(nPlateIndex))
1559  {
1560  for (unsigned int k = 0; k < 9; k++)
1561  {
1562  *(((float*)&sForce) + k) =
1563  SetByteOrder((float*)(mpForceData[nPlateIndex] + 12 + k * sizeof(float) + nForceIndex * sizeof(SForce)));
1564 
1565  // Not a valid force if one of the values is not a valid float.
1566  if (isnan(*(((float*)&sForce) + k)) != 0)
1567  {
1568  return false;
1569  }
1570  }
1571  return true;
1572  }
1573  }
1574  }
1575  return false;
1576 }
1577 
1578 
1579 //-----------------------------------------------------------
1580 // Skeleton
1581 //-----------------------------------------------------------
1583 {
1584  return mSkeletonCount;
1585 }
1586 
1587 unsigned int CRTPacket::GetSkeletonSegmentCount(unsigned int nSkeletonIndex)
1588 {
1589  if (mSkeletonCount <= nSkeletonIndex)
1590  {
1591  return 0;
1592  }
1593  return SetByteOrder((unsigned int*)(mpSkeletonData[nSkeletonIndex]));
1594 }
1595 
1596 bool CRTPacket::GetSkeletonSegments(unsigned int nSkeletonIndex, SSkeletonSegment* segmentBuffer, unsigned int nBufSize)
1597 {
1598  if (mSkeletonCount <= nSkeletonIndex)
1599  {
1600  return false;
1601  }
1602 
1603  unsigned int segmentCount = GetSkeletonSegmentCount(nSkeletonIndex);
1604  if (segmentCount == 0)
1605  {
1606  return false;
1607  }
1608 
1609  if (nBufSize < segmentCount * 32 || segmentBuffer == nullptr)
1610  {
1611  segmentCount = 0;
1612  return false;
1613  }
1614 
1615  if (mbBigEndian)
1616  {
1617  for (unsigned int i = 0; i < segmentCount; i++)
1618  {
1619  segmentBuffer[i].id = SetByteOrder((unsigned int*)(mpSkeletonData[nSkeletonIndex] + 4 + i * 32));
1620  segmentBuffer[i].positionX = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 8 + i * 32));
1621  segmentBuffer[i].positionY = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 12 + i * 32));
1622  segmentBuffer[i].positionZ = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 16 + i * 32));
1623  segmentBuffer[i].rotationX = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 20 + i * 32));
1624  segmentBuffer[i].rotationY = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 24 + i * 32));
1625  segmentBuffer[i].rotationZ = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 28 + i * 32));
1626  segmentBuffer[i].rotationW = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 32 + i * 32));
1627  }
1628  }
1629  else
1630  {
1631  memcpy(segmentBuffer, mpSkeletonData[nSkeletonIndex] + 4, sizeof(SSkeletonSegment) * segmentCount);
1632  }
1633  return true;
1634 }
1635 
1636 bool CRTPacket::GetSkeletonSegment(unsigned int nSkeletonIndex, unsigned segmentIndex, SSkeletonSegment &segment)
1637 {
1638  if (mSkeletonCount <= nSkeletonIndex)
1639  {
1640  return false;
1641  }
1642 
1643  unsigned int segmentCount = GetSkeletonSegmentCount(nSkeletonIndex);
1644  if (segmentCount == 0)
1645  {
1646  return false;
1647  }
1648 
1649  if (segmentIndex >= segmentCount)
1650  {
1651  return false;
1652  }
1653 
1654  if (mbBigEndian)
1655  {
1656  segment.id = SetByteOrder((unsigned int*)(mpSkeletonData[nSkeletonIndex] + 4 + 32 * segmentIndex));
1657  segment.positionX = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 8 + 32 * segmentIndex));
1658  segment.positionY = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 12 + 32 * segmentIndex));
1659  segment.positionZ = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 16 + 32 * segmentIndex));
1660  segment.rotationX = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 20 + 32 * segmentIndex));
1661  segment.rotationY = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 24 + 32 * segmentIndex));
1662  segment.rotationZ = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 28 + 32 * segmentIndex));
1663  segment.rotationW = SetByteOrder((float*)(mpSkeletonData[nSkeletonIndex] + 32 + 32 * segmentIndex));
1664  }
1665  else
1666  {
1667  memcpy(&segment, mpSkeletonData[nSkeletonIndex] + 4 + 32 * segmentIndex, sizeof(SSkeletonSegment));
1668  }
1669 
1670  return true;
1671 }
1672 
1673 
1674 //-----------------------------------------------------------
1675 // Force Single
1676 //-----------------------------------------------------------
1678 {
1679  return mnForceSinglePlateCount;
1680 }
1681 
1682 unsigned int CRTPacket::GetForceSinglePlateId(unsigned int nPlateIndex)
1683 {
1684  if ((mnMajorVersion == 1 && mnMinorVersion == 0) || mnForceSinglePlateCount <= nPlateIndex)
1685  {
1686  return 0;
1687  }
1688  return SetByteOrder((unsigned int*)(mpForceSingleData[nPlateIndex]));
1689 }
1690 
1691 bool CRTPacket::GetForceSingleData(unsigned int nPlateIndex, SForce &sForce)
1692 {
1693  if (nPlateIndex < mnForceSinglePlateCount)
1694  {
1695  for (unsigned int k = 0; k < 9; k++)
1696  {
1697  *(((float*)&sForce) + k) =
1698  SetByteOrder((float*)(mpForceSingleData[nPlateIndex] + 4 + k * sizeof(float)));
1699 
1700  // Not a valid force if one of the values is not a valid float.
1701  if (isnan(*(((float*)&sForce) + k)) != 0)
1702  {
1703  return false;
1704  }
1705  }
1706  return true;
1707  }
1708 
1709  return false;
1710 }
1711 
1712 float CRTPacket::SetByteOrder(float* pfData)
1713 {
1714  unsigned int nTmp;
1715 
1716  if (mbBigEndian)
1717  {
1718  nTmp = ntohl(*((unsigned int*)pfData));
1719  return *((float*)&nTmp);
1720  }
1721  return *pfData;
1722 } // SetByteOrder
1723 
1724 double CRTPacket::SetByteOrder(double* pfData)
1725 {
1726  unsigned long long nTmp;
1727 
1728  if (mbBigEndian)
1729  {
1730  nTmp = (((unsigned long long)(ntohl((long)*((unsigned long long*)pfData))) << 32) + ntohl(*((unsigned long long*)pfData) >> 32));
1731  return *((double*)&nTmp);
1732  }
1733  return *pfData;
1734 } // SetByteOrder
1735 
1736 short CRTPacket::SetByteOrder(short* pnData)
1737 {
1738  if (mbBigEndian)
1739  {
1740  return ntohs(*pnData);
1741  }
1742  return *pnData;
1743 } // SetByteOrder
1744 
1745 unsigned short CRTPacket::SetByteOrder(unsigned short* pnData)
1746 {
1747  if (mbBigEndian)
1748  {
1749  return ntohs(*pnData);
1750  }
1751  return *pnData;
1752 } // SetByteOrder
1753 
1754 long CRTPacket::SetByteOrder(long* pnData)
1755 {
1756  if (mbBigEndian)
1757  {
1758  return ntohl(*pnData);
1759  }
1760  return *pnData;
1761 } // SetByteOrder
1762 
1763 int CRTPacket::SetByteOrder(int* pnData)
1764 {
1765  if (mbBigEndian)
1766  {
1767  return ntohl(*pnData);
1768  }
1769  return *pnData;
1770 } // SetByteOrder
1771 
1772 unsigned int CRTPacket::SetByteOrder(unsigned int* pnData)
1773 {
1774  if (mbBigEndian)
1775  {
1776  return ntohl(*pnData);
1777  }
1778  return *pnData;
1779 } // SetByteOrder
1780 
1781 long long CRTPacket::SetByteOrder(long long* pnData)
1782 {
1783  if (mbBigEndian)
1784  {
1785  return ((unsigned long long)(ntohl((long)*pnData)) << 32) + ntohl(*pnData >> 32);
1786  }
1787  return *pnData;
1788 } // SetByteOrder
1789 
1790 unsigned long long CRTPacket::SetByteOrder(unsigned long long* pnData)
1791 {
1792  if (mbBigEndian)
1793  {
1794  return ((unsigned long long)(ntohl((long)*pnData)) << 32) + ntohl(*pnData >> 32);
1795  }
1796  return *pnData;
1797 } // SetByteOrder
unsigned int Get2DLinCameraCount()
Definition: RTPacket.cpp:582
unsigned int GetTimecodeCount()
Definition: RTPacket.cpp:1064
bool Get3DNoLabelsResidualMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ, unsigned int &nId, float &fResidual)
Definition: RTPacket.cpp:772
unsigned int GetAnalogChannelCount(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1248
unsigned char Get2DLinStatusFlags(unsigned int nCameraIndex)
Definition: RTPacket.cpp:596
unsigned int GetComponentSize(EComponentType eComponent)
Definition: RTPacket.cpp:389
bool GetSkeletonSegment(unsigned int nSkeletonIndex, unsigned segmentIndex, SSkeletonSegment &segment)
Definition: RTPacket.cpp:1636
unsigned int Get3DNoLabelsMarkerCount()
Definition: RTPacket.cpp:720
bool Get3DMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ)
Definition: RTPacket.cpp:651
bool GetTimecodeIRIG(unsigned int nTimecodeIndex, int &year, int &day, int &hours, int &minutes, int &seconds, int &tenths)
Definition: RTPacket.cpp:1100
unsigned int Get3DResidualMarkerCount()
Definition: RTPacket.cpp:679
unsigned int GetImage(unsigned int nCameraIndex, char *pDataBuf, unsigned int nBufSize)
Definition: RTPacket.cpp:1208
unsigned int GetAnalogSingleDeviceCount()
Definition: RTPacket.cpp:1396
#define MAX_SKELETON_COUNT
Definition: RTPacket.h:22
unsigned char Get2DStatusFlags(unsigned int nCameraIndex)
Definition: RTPacket.cpp:543
unsigned int Get2DCameraCount()
Definition: RTPacket.cpp:529
unsigned int GetSize()
Definition: RTPacket.cpp:292
void GetVersion(unsigned int &nMajorVersion, unsigned int &nMinorVersion)
Definition: RTPacket.cpp:26
char * GetXMLString()
Definition: RTPacket.cpp:432
unsigned int GetFrameNumber()
Definition: RTPacket.cpp:327
void SetEndianness(bool bBigEndian)
Definition: RTPacket.cpp:43
#define MAX_ANALOG_DEVICE_COUNT
Definition: RTPacket.h:18
unsigned int GetAnalogData(unsigned int nDeviceIndex, float *pDataBuf, unsigned int nBufSize)
Definition: RTPacket.cpp:1290
bool GetImageSize(unsigned int nCameraIndex, unsigned int &nWidth, unsigned int &nHeight)
Definition: RTPacket.cpp:1171
unsigned int GetSkeletonCount()
Definition: RTPacket.cpp:1582
unsigned short GetDropRate()
Definition: RTPacket.cpp:486
unsigned int GetAnalogSingleData(unsigned int nDeviceIndex, float *pDataBuf, unsigned int nBufSize)
Definition: RTPacket.cpp:1419
char * GetCommandString()
Definition: RTPacket.cpp:412
CRTPacket(int nMajorVersion=MAJOR_VERSION, int nMinorVersion=MINOR_VERSION, bool bBigEndian=false)
Definition: RTPacket.cpp:17
#define MAX_FORCE_PLATE_COUNT
Definition: RTPacket.h:19
unsigned short GetOutOfSyncRate()
Definition: RTPacket.cpp:505
unsigned int Get6DOFEulerBodyCount()
Definition: RTPacket.cpp:902
unsigned int Get6DOFResidualBodyCount()
Definition: RTPacket.cpp:852
unsigned int GetAnalogSampleCount(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1263
unsigned int Get3DNoLabelsResidualMarkerCount()
Definition: RTPacket.cpp:761
unsigned int GetForcePlateCount()
Definition: RTPacket.cpp:1456
bool Get6DOFResidualBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ, float afRotMatrix[9], float &fResidual)
Definition: RTPacket.cpp:863
bool Get6DOFEulerBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ, float &fAng1, float &fAng2, float &fAng3)
Definition: RTPacket.cpp:913
void SetData(char *ptr)
Definition: RTPacket.cpp:74
unsigned int GetForceNumber(unsigned int nPlateIndex)
Definition: RTPacket.cpp:1483
unsigned int GetForceSinglePlateId(unsigned int nPlateIndex)
Definition: RTPacket.cpp:1682
EComponentType
Definition: RTPacket.h:42
unsigned int GetAnalogSampleNumber(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1276
bool GetGazeVector(unsigned int nVectorIndex, unsigned int nSampleIndex, SGazeVector &nGazeVector)
Definition: RTPacket.cpp:1021
bool GetTimecodeSMPTE(unsigned int nTimecodeIndex, int &hours, int &minutes, int &seconds, int &frame)
Definition: RTPacket.cpp:1079
unsigned int GetAnalogDeviceId(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1235
bool Get6DOFBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ, float afRotMatrix[9])
Definition: RTPacket.cpp:816
unsigned int GetImageCameraCount()
Definition: RTPacket.cpp:1146
unsigned int GetAnalogSingleChannelCount(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1410
bool GetImageCrop(unsigned int nCameraIndex, float &fCropLeft, float &fCropTop, float &fCropRight, float &fCropBottom)
Definition: RTPacket.cpp:1183
unsigned int GetSkeletonSegmentCount(unsigned int nSkeletonIndex)
Definition: RTPacket.cpp:1587
bool GetSkeletonSegments(unsigned int nSkeletonIndex, SSkeletonSegment *segmentBuf, unsigned int nBufSize)
Definition: RTPacket.cpp:1596
unsigned int GetForceCount(unsigned int nPlateIndex)
Definition: RTPacket.cpp:1470
void ClearData()
Definition: RTPacket.cpp:48
unsigned int GetForceData(unsigned int nPlateIndex, SForce *pForceBuf, unsigned int nBufSize)
Definition: RTPacket.cpp:1496
unsigned int Get2DMarkerCount(unsigned int nCameraIndex)
Definition: RTPacket.cpp:534
unsigned int GetAnalogSingleDeviceId(unsigned int nDeviceIndex)
Definition: RTPacket.cpp:1401
bool GetForceSingleData(unsigned int nPlateIndex, SForce &pForce)
Definition: RTPacket.cpp:1691
unsigned int Get6DOFBodyCount()
Definition: RTPacket.cpp:805
bool Get6DOFEulerResidualBody(unsigned int nBodyIndex, float &fX, float &fY, float &fZ, float &fAng1, float &fAng2, float &fAng3, float &fResidual)
Definition: RTPacket.cpp:959
unsigned int GetAnalogDeviceCount()
Definition: RTPacket.cpp:1230
unsigned int GetForcePlateId(unsigned int nPlateIndex)
Definition: RTPacket.cpp:1461
unsigned int GetGazeVectorSampleNumber(unsigned int nVectorIndex)
Definition: RTPacket.cpp:1010
short GetDiscoverResponseBasePort()
Definition: RTPacket.cpp:442
bool Get3DNoLabelsMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ, unsigned int &nId)
Definition: RTPacket.cpp:731
unsigned int Get3DMarkerCount()
Definition: RTPacket.cpp:635
unsigned int GetImageCameraId(unsigned int nCameraIndex)
Definition: RTPacket.cpp:1151
unsigned int GetGazeVectorSampleCount(unsigned int nVectorIndex)
Definition: RTPacket.cpp:1001
EImageFormat
Definition: RTPacket.h:65
bool Get2DLinMarker(unsigned int nCameraIndex, unsigned int nMarkerIndex, unsigned int &nX, unsigned int &nY, unsigned short &nXDiameter, unsigned short &nYDiameter)
Definition: RTPacket.cpp:605
ETimecodeType
Definition: RTPacket.h:94
unsigned int GetForceSinglePlateCount()
Definition: RTPacket.cpp:1677
#define MAX_GAZE_VECTOR_COUNT
Definition: RTPacket.h:20
char * GetErrorString()
Definition: RTPacket.cpp:402
void SetVersion(unsigned int nMajorVersion, unsigned int nMinorVersion)
Definition: RTPacket.cpp:32
bool GetTimecodeType(unsigned int nTimecodeIndex, CRTPacket::ETimecodeType &timecodeType)
Definition: RTPacket.cpp:1069
void GetData(char *&ptr, unsigned int &nSize)
Definition: RTPacket.cpp:279
bool Get3DResidualMarker(unsigned int nMarkerIndex, float &fX, float &fY, float &fZ, float &fResidual)
Definition: RTPacket.cpp:690
unsigned int Get6DOFEulerResidualBodyCount()
Definition: RTPacket.cpp:948
bool GetTimecodeCameraTime(unsigned int nTimecodeIndex, unsigned long long &cameraTime)
Definition: RTPacket.cpp:1123
unsigned long long GetTimeStamp()
Definition: RTPacket.cpp:318
#define MAX_CAMERA_COUNT
Definition: RTPacket.h:17
bool GetEndianness()
Definition: RTPacket.cpp:38
unsigned int GetGazeVectorCount()
Definition: RTPacket.cpp:996
EPacketType GetType()
Definition: RTPacket.cpp:305
bool GetImageFormat(unsigned int nCameraIndex, EImageFormat &eImageFormat)
Definition: RTPacket.cpp:1160
bool Get2DMarker(unsigned int nCameraIndex, unsigned int nMarkerIndex, unsigned int &nX, unsigned int &nY, unsigned short &nXDiameter, unsigned short &nYDiameter)
Definition: RTPacket.cpp:552
unsigned int GetComponentCount()
Definition: RTPacket.cpp:384
bool GetEvent(EEvent &eEvent)
Definition: RTPacket.cpp:466
unsigned int Get2DLinMarkerCount(unsigned int nCameraIndex)
Definition: RTPacket.cpp:587