Main MRPT website > C++ reference for MRPT 1.5.9
legacydatapacket.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #include <xsens/xstypesconfig.h>
10 #include "legacydatapacket.h"
11 #include "packetfixeddata.h"
12 #include "mtwsdidata.h"
13 #include <xsens/xsgpspvtdata.h>
14 #include <xsens/xspressure.h>
15 #include <xsens/xscalibrateddata.h>
16 #include <xsens/xseuler.h>
17 #include <xsens/xsmatrix3x3.h>
18 #include <xsens/xsvector3.h>
19 #include <xsens/xsanalogindata.h>
20 #include <xsens/xsutctime.h>
21 
22 #ifdef LOG_PACKET
23 # include "xslog.h"
24 # define PACKETLOG XSENSLOG
25 #else
26 # define PACKETLOG(...) (void)0
27 #endif
28 
29 //////////////////////////////////////////////////////////////////////////////////////////
30 ////////////////////////////////////// Packet class //////////////////////////////////////
31 //////////////////////////////////////////////////////////////////////////////////////////
32 #define FORMAT_DOUBLE ((m_fixedData->m_formatList[index].m_outputSettings & XOS_Dataformat_Mask)|XOS_Dataformat_Double)
33 #define ISDOUBLE(a) (m_fixedData->m_infoList[index].a >= m_fixedData->m_infoList[index].m_doubleBoundary)
34 #define CHECKIFDOUBLE(a) ISDOUBLE(a)?FORMAT_DOUBLE:m_fixedData->m_formatList[index].m_outputSettings
35 
36 /*! \struct LegacyDataPacket
37  \brief Contains an MTData XsMessage and supports functions for extracting contained data.
38 */
39 
40 /*! \brief Construct a new %LegacyDataPacket without data. The %LegacyDataPacket will be invalid. */
42  : m_fixedData(new PacketFixedData)
43  , m_lastFoundId(0)
44  , m_lastFoundIndex(0)
45  , m_rtc(0)
46  , m_toa(0)
47  , m_packetId(0)
48  , m_triggerIn1(0)
49  , m_triggerIn2(0)
50 {
51  PACKETLOG("%s creating default %p\n", __FUNCTION__, this);
52 }
53 
54 /*! \brief Construct a new %LegacyDataPacket with room for data from \a count devices.
55  \param count The number of devices whose data is in the object
56  \param xbus Whether the message was sent by an Xbus Master or by a standalone MT. This matters
57  because the sample counter is in a different place.
58 */
60  : m_fixedData(new PacketFixedData(count))
61  , m_lastFoundId(0)
62  , m_lastFoundIndex(0)
63  , m_rtc(0)
64  , m_toa(0)
65  , m_packetId(0)
66  , m_triggerIn1(0)
67  , m_triggerIn2(0)
68 
69 {
70  PACKETLOG("%s creating %p with %d items and xbus option %d\n", __FUNCTION__, this, count, xbus);
71  m_fixedData->m_xm = xbus;
72 }
73 
74 /*! \brief Construct a LegacyDataPacket as a copy of \a other. */
76  : m_fixedData(0)
77  , m_lastFoundId(0)
78  , m_lastFoundIndex(0)
79  , m_rtc(0)
80  , m_toa(0)
81  , m_packetId(0)
82  , m_triggerIn1(0)
83  , m_triggerIn2(0)
84 
85 {
86  PACKETLOG("%s creating %p from %p\n", __FUNCTION__, this, &other);
87  *this = other;
88  PACKETLOG("%s creating %p from %p done\n", __FUNCTION__, this, &other);
89 }
90 
91 /*! \brief Assignment operator, copies the contents of \a pack into this
92 */
94 {
95  PACKETLOG("%s copying from %p to %p\n", __FUNCTION__, &pack, this);
96  if (this == &pack)
97  return *this;
98 
99  delete m_fixedData;
100  m_fixedData = NULL;
101 
102  if (pack.m_fixedData) // Can be empty
103  {
107  }
108 
109  m_toa = pack.m_toa;
110  m_rtc = pack.m_rtc;
111  m_msg = pack.m_msg;
112  m_packetId = pack.m_packetId;
113  m_triggerIn1 = pack.m_triggerIn1;
114  m_triggerIn2 = pack.m_triggerIn2;
115 
116  PACKETLOG("%s copying from %p to %p done\n", __FUNCTION__, &pack, this);
117  return *this;
118 }
119 
120 /*! \brief Destructor */
122 {
123  try {
124  PACKETLOG("%s destroying %p\n", __FUNCTION__, this);
125  delete m_fixedData;
126  m_fixedData = NULL;
127  PACKETLOG("%s destroyed %p\n", __FUNCTION__, this);
128  }
129  catch (...)
130  {}
131 }
132 
133 //lint -esym(613, LegacyDataPacket::m_fixedData) assert and dataSize take care of this
134 /*! \brief Returns the number of devices whose data is contained in the object
135 */
137 {
138  assert(m_fixedData);
139  return m_fixedData->m_itemCount;
140 }
141 
142 /*! \brief Set the number of devices whose data is contained in this object to \a count
143 */
145 {
146  assert(m_fixedData);
148 }
149 
150 /*! \brief Returns the Time Of Arrival value as stored in the object
151 */
153 {
154  return m_toa;
155 }
156 
157 /*! \brief Set the Time Of Arrival value to \a timeofarrival
158 */
160 {
161  m_toa = timeofarrival;
162 }
163 
164 /*! \brief Returns the Real Time Clock value as stored in the object
165 */
167 {
168  return m_rtc;
169 }
170 
171 /*! \brief Set the Real Time Clock value to \a realtimeclock
172 */
173 void LegacyDataPacket::setRtc(const XsTimeStamp realtimeclock)
174 {
175  m_rtc = realtimeclock;
176 }
177 
178 /*! \brief Return the 64-bit sample counter associated with this packet
179  \returns The 64-bit sample counter associated with this packet
180  \note This sample counter may differ a lot from the normal 16-bit sample counter
181 */
183 {
184  return m_packetId.msTime();
185 }
186 
187 /*! \brief Set the 64-bit sample counter associated with this packet
188 */
190 {
191  m_packetId = sc;
192 }
193 
194 /*! \brief Returns a copy of the %XsMessage contained by the object, including computed and added data. */
196 {
197  return m_msg;
198 }
199 
200 /*! \brief Returns the original message as it was received, without computed and added data (except for SDI interval reconstruction)
201 */
203 {
204  assert(m_fixedData);
205  uint16_t originalSize = 0;
206  for (uint16_t i = 0;i < m_fixedData->m_itemCount;++i)
207  if (m_fixedData->m_infoList[i].m_doubleBoundary > originalSize)
208  originalSize = m_fixedData->m_infoList[i].m_doubleBoundary;
209 
210  if (originalSize == m_msg.getDataSize())
211  return m_msg;
212 
213  XsMessage m = m_msg;
214  m.resizeData(originalSize);
215  m.setDataBuffer(m_msg.getDataBuffer(), originalSize);
216  m.recomputeChecksum();
217  return m;
218 }
219 
220 /*! \brief Set the source message to \a msg
221  \param msg The message to use
222  \note Call updateInfoList() to actually start using the new message
223 */
225 {
226  m_msg = msg;
227 }
228 
229 /*! \brief Returns the packet info for the \a index'th device in the packet.
230  \details This describes what data is contained by the object.
231  \param index The index of the device whose packet info should be returned
232  \returns The packet info for device \a index
233 */
235 {
236  assert(m_fixedData);
238  return PacketInfo();
239 
240  return m_fixedData->m_infoList[index];
241 }
242 
243 /*! \brief Return the frame counter (previously: sample counter) of the packet
244  \details For SDI data, this function will return the Last Frame Number in the SDI interval.
245  For other data, this function will return the plain Sample Counter.
246  \returns The frame counter of the packet or 0 if it isn't present in the packet (note that 0 is
247  a valid sample counter, so don't use it for an error check).
248 */
250 {
251  assert(m_fixedData);
252  if (containsPacketCounter(0))
253  return m_msg.getDataShort(m_fixedData->m_infoList[0].m_sc);
254  else if (containsMtwSdiData(0))
255  return m_msg.getDataShort(m_fixedData->m_infoList[0].m_wLastFrameNumber);
256  return 0;
257 }
258 
259 //////////////////////////////////////////////////////////////////////////////////////////
260 /*! \brief Returns the index of the fixed data with id \a dev
261  \details If the result is not -1, it can be used as the \a index parameter in other functions
262  that require it (see the list below).
263  \param dev The device ID to find
264  \returns The index of the fixed data
265  \sa deviceId \sa setDeviceId \sa dataFormat \sa setDataFormat(const XsDataFormat&, int32_t)
266  \sa setDataFormat(XsOutputMode, XsOutputSettings, int32_t)
267 */
269 {
270  assert(m_fixedData);
271  if (!dev.isValid())
272  return 0;
273  if (dev == m_lastFoundId)
274  return m_lastFoundIndex;
275  for (uint16_t i=0;i<m_fixedData->m_itemCount;++i)
276  {
277  if (m_fixedData->m_idList[i] == dev)
278  {
279  m_lastFoundId = dev;
280  m_lastFoundIndex = i;
281  return i;
282  }
283  }
284  return -1;
285 }
286 
287 /*! \brief Returns the device ID of the device with the given \a index
288  \param index The index of the device whose device ID should be returned
289  \returns The device ID of the device
290  \sa findDeviceId
291 */
293 {
294  assert(m_fixedData);
295  return m_fixedData->m_idList[index];
296 }
297 
298 /*! \brief Sets the device ID of the device with the given \a index to \a deviceid
299  \param deviceid The device ID to set
300  \param index The index of the device whose device ID should be updated
301  \returns true if the device ID was successfully updated
302  \sa findDeviceId
303 */
305 {
306  assert(m_fixedData);
307  m_fixedData->m_idList[index] = deviceid;
308 }
309 
310 //////////////////////////////////////////////////////////////////////////////////////////
311 /*! \brief Returns the data format of the device with the given \a index
312  \param index The index of the device whose data format should be returned
313  \returns The data format of the device
314  \sa findDeviceId
315 */
317 {
319  return XsDataFormat();
320 
321  return m_fixedData->m_formatList[index];
322 }
323 
324 //////////////////////////////////////////////////////////////////////////////////////////
325 /*! \brief Sets the data format of the device with the given \a index to \a format
326  \param format The data format of the device
327  \param index The index of the device whose data format should be updated
328  \returns true if the data format was successfully updated
329  \sa findDeviceId
330 */
332 {
333  assert(m_fixedData);
334 
335  if (index < m_fixedData->m_itemCount)
336  {
338  updateInfoList();
339  return true;
340  }
341  return false;
342 }
343 
344 //////////////////////////////////////////////////////////////////////////////////////////
345 /*! \brief Sets the data format of the device with the given \a index to \a outputMode and \a outputSettings
346  \param outputMode The output mode of the device (see low level communication documentation)
347  \param outputSettings The output settings of the device (see low level communication documentation)
348  \param index The index of the device whose data format should be updated
349  \returns true if the data format was successfully updated
350  \sa findDeviceId
351 */
353 {
354  assert(m_fixedData);
355 
356  if (index < m_fixedData->m_itemCount)
357  {
359  m_fixedData->m_formatList[index].m_outputSettings = outputSettings;
360  updateInfoList();
361  return true;
362  }
363  return false;
364 }
365 
366 //////////////////////////////////////////////////////////////////////////////////////////
367 /*! \brief Returns whether the xbus flag is set or not
368  \returns trur if the xbus flag is set or not
369  \sa setXbusSystem
370 */
372 {
373  assert(m_fixedData);
374  return m_fixedData->m_xm;
375 }
376 
377 //////////////////////////////////////////////////////////////////////////////////////////
378 /*! \brief Sets the xbus flag
379  \details The xbus flag determines where the packet counter is stored in the message. Setting
380  this value incorrectly can lead to corrupted data reads.
381  \param xbus The desired setting
382  \param convert When set to true, the sample counter will be moved from its old place to the new
383  place.
384 */
385 void LegacyDataPacket::setXbusSystem(bool xbus, bool convert)
386 {
387  assert(m_fixedData);
388 
389  if (xbus != m_fixedData->m_xm)
390  {
391  if (convert)
392  {
393  XsMtTimeStamp stamp = packetCounter(0);
394 
395  // move the time stamp value(s) around
396  if (xbus)
397  {
398  // new version is Xbus, so old version is regular format -> place timestamp at start of packet and remove from all individual data units
399  // remove the timestamp from all data units
400 
401  // insert timestamp at the start
402  m_msg.insertData(2,0);
403  m_msg.setDataShort(stamp,0);
404  }
405  else
406  {
407  // new version is regular, so old version is Xbus format -> place timestamp at end of all individual data units and remove from start of packet
408  // append the timestamp to all data units
409 
410  // remove timestamp from the start
411  m_msg.deleteData(2,0);
412  }
413  }
414  // update the state cache
415  m_fixedData->m_xm = xbus;
416  updateInfoList();
417  }
418 }
419 
420 /*! \brief Returns the floating/fixed point value size in bytes
421  \param index The index of the item whose fp size should be returned.
422  \returns The floating/fixed point value size in bytes
423 */
425 {
426  assert(m_fixedData);
427  uint16_t ds = 4;
429  {
431  ds = 4;
432  break;
433 
435  ds = 8;
436  break;
437 
439  ds = 6;
440  break;
441 
443  ds = 4;
444  break;
445  default:
446  break;
447  }
448  return ds;
449 }
450 
451 /*! \brief Returns the size of the data
452  \param index The index of the item of which the size should be returned.
453  \returns The size of the data
454 */
456 {
457  if (m_fixedData && index < m_fixedData->m_itemCount)
459  return 0;
460 }
461 
462 /*! \brief Update the internal info list by analyzing the known XsDataFormat for each device.
463 */
465 {
466  assert(m_fixedData);
467  if (m_fixedData->m_infoList != NULL)
468  {
469  delete[] m_fixedData->m_infoList;
470  m_fixedData->m_infoList = NULL;
471  }
472 
473  assert(m_fixedData->m_itemCount);
474  // allocate list
476  uint16_t totalOffset;
477  if (m_fixedData->m_xm)
478  totalOffset = 2;
479  else
480  totalOffset = 0;
481 
482  // fill lists
483  for (uint16_t i = 0;i < m_fixedData->m_itemCount;++i)
484  {
485  m_fixedData->m_infoList[i].m_offset = totalOffset;
486  m_fixedData->m_infoList[i].m_size = 0;
487 
488  uint16_t ds = getFPValueSize(i);
489 
491  {
492  m_fixedData->m_infoList[i].m_rawData = totalOffset;
493  m_fixedData->m_infoList[i].m_rawAcc = totalOffset;
494  m_fixedData->m_infoList[i].m_rawGyr = totalOffset+6;
495  m_fixedData->m_infoList[i].m_rawMag = totalOffset+12;
496  m_fixedData->m_infoList[i].m_rawTemp[0] = totalOffset+18;
497 
498  m_fixedData->m_infoList[i].m_size += 20;
499  totalOffset += 20;
500 
502  {
503  for(int j = 0; j < XS_EXTRA_TEMPERATURE_CHANNELS; j++)
504  {
505  m_fixedData->m_infoList[i].m_rawTemp[j + 1] = totalOffset;
506  m_fixedData->m_infoList[i].m_size += 2;
507  totalOffset += 2;
508  }
509  } else
510  {
511  for(int j = 0; j < XS_EXTRA_TEMPERATURE_CHANNELS; j++)
512  {
514  }
515  }
516 
517  }
518  else
519  {
524  for(int j = 0; j < XS_MAX_TEMPERATURE_CHANNELS; j++)
526  }
527 
529  {
530  m_fixedData->m_infoList[i].m_mtwSdiData = totalOffset;
531  m_fixedData->m_infoList[i].m_wClientId = totalOffset;
532  m_fixedData->m_infoList[i].m_wTimeSync = totalOffset + 4;
533  m_fixedData->m_infoList[i].m_wFirstFrameNumber = totalOffset + 5;
534  m_fixedData->m_infoList[i].m_wLastFrameNumber = totalOffset + 7;
535  m_fixedData->m_infoList[i].m_wCurrentBias = totalOffset + 9;
536  m_fixedData->m_infoList[i].m_wOrientationIncrement = totalOffset + 9+3*ds;
537  m_fixedData->m_infoList[i].m_wVelocityIncrement = totalOffset + 9+7*ds;
538  m_fixedData->m_infoList[i].m_wAidingData = totalOffset + 9+10*ds;
539  m_fixedData->m_infoList[i].m_wBaroMeter = totalOffset + 10+10*ds;
540  m_fixedData->m_infoList[i].m_wMagnetoMeter = totalOffset + 12+10*ds;
541  m_fixedData->m_infoList[i].m_wRssi = totalOffset + 12+13*ds;
542  m_fixedData->m_infoList[i].m_size += 13+13*ds;
543  totalOffset += 13+13*ds;
544  }
545  else
546  {
559  }
560 
561 
563  {
564  m_fixedData->m_infoList[i].m_gpsPvtData = totalOffset;
565  m_fixedData->m_infoList[i].m_gpsPvtPressure = totalOffset;
566  m_fixedData->m_infoList[i].m_gpsPvtPressureAge = totalOffset + 2;
567  m_fixedData->m_infoList[i].m_size += 3;
568  totalOffset += 3;
569 
571  {
572  m_fixedData->m_infoList[i].m_gpsPvtGpsData = totalOffset;
573  m_fixedData->m_infoList[i].m_gpsPvtItow = totalOffset;
574  m_fixedData->m_infoList[i].m_gpsPvtLatitude = totalOffset + 4;
575  m_fixedData->m_infoList[i].m_gpsPvtLongitude = totalOffset + 8;
576  m_fixedData->m_infoList[i].m_gpsPvtHeight = totalOffset + 12;
577  m_fixedData->m_infoList[i].m_gpsPvtVeln = totalOffset + 16;
578  m_fixedData->m_infoList[i].m_gpsPvtVele = totalOffset + 20;
579  m_fixedData->m_infoList[i].m_gpsPvtVeld = totalOffset + 24;
580  m_fixedData->m_infoList[i].m_gpsPvtHacc = totalOffset + 28;
581  m_fixedData->m_infoList[i].m_gpsPvtVacc = totalOffset + 32;
582  m_fixedData->m_infoList[i].m_gpsPvtSacc = totalOffset + 36;
583  m_fixedData->m_infoList[i].m_gpsPvtGpsAge = totalOffset + 40;
584  m_fixedData->m_infoList[i].m_size += 41;
585  totalOffset += 41;
586  }
587  else
588  {
601  }
602  }
603  else
604  {
608 
621  }
622 
623  for(int j = 0; j < XS_MAX_TEMPERATURE_CHANNELS; j++)
625 
627  {
629  for(int j = 0; j < tCount; j++)
630  {
631  m_fixedData->m_infoList[i].m_temp[j] = totalOffset;
632  m_fixedData->m_infoList[i].m_size += ds;
633  totalOffset += ds;
634  }
635  }
636 
638  {
639  m_fixedData->m_infoList[i].m_calData = totalOffset;
641  {
642  m_fixedData->m_infoList[i].m_calAcc = totalOffset;
643  m_fixedData->m_infoList[i].m_size += 3*ds;
644  totalOffset += 3*ds;
645  }
646  else
648 
650  {
651  m_fixedData->m_infoList[i].m_calGyr = totalOffset;
652  m_fixedData->m_infoList[i].m_size += 3*ds;
653  totalOffset += 3*ds;
654  }
655  else
657 
659  {
660  m_fixedData->m_infoList[i].m_calMag = totalOffset;
661  m_fixedData->m_infoList[i].m_size += 3*ds;
662  totalOffset += 3*ds;
663  }
664  else
666 
669  }
670  else
671  {
676  }
677 
681 
683  {
685  {
687  m_fixedData->m_infoList[i].m_oriEul = totalOffset;
688  m_fixedData->m_infoList[i].m_size += 3*ds;
689  totalOffset += 3*ds;
690  break;
692  m_fixedData->m_infoList[i].m_oriQuat = totalOffset;
693  m_fixedData->m_infoList[i].m_size += 4*ds;
694  totalOffset += 4*ds;
695  break;
697  m_fixedData->m_infoList[i].m_oriMat = totalOffset;
698  m_fixedData->m_infoList[i].m_size += 9*ds;
699  totalOffset += 9*ds;
700  break;
701  default:
702  break;
703  }
704  }
705 
709  {
711  {
712  m_fixedData->m_infoList[i].m_analogIn1 = totalOffset;
713  m_fixedData->m_infoList[i].m_size += 2;
714  totalOffset += 2;
715  }
716  else
718 
720  {
721  m_fixedData->m_infoList[i].m_analogIn2 = totalOffset;
722  m_fixedData->m_infoList[i].m_size += 2;
723  totalOffset += 2;
724  }
725  else
727  }
728 
731  {
733  {
734  m_fixedData->m_infoList[i].m_posLLA = totalOffset;
735  m_fixedData->m_infoList[i].m_size += 3*ds;
736  totalOffset += 3*ds;
737  }
738  }
739 
742  {
744  {
745  m_fixedData->m_infoList[i].m_velNEDorNWU = totalOffset;
746  m_fixedData->m_infoList[i].m_size += 3*ds;
747  totalOffset += 3*ds;
748  }
749  }
750 
752  {
753  m_fixedData->m_infoList[i].m_status = totalOffset;
754 
756  {
757  m_fixedData->m_infoList[i].m_detailedStatus = totalOffset;
758  m_fixedData->m_infoList[i].m_size += 4;
759  totalOffset += 4;
760  }
761  else
762  {
764  m_fixedData->m_infoList[i].m_size += 1;
765  totalOffset += 1;
766  }
767  }
768  else
769  {
772  }
773 
775  if (m_fixedData->m_xm)
776  m_fixedData->m_infoList[i].m_sc = 0;
778  {
779  if (!m_fixedData->m_xm)
780  m_fixedData->m_infoList[i].m_sc = totalOffset;
781  m_fixedData->m_infoList[i].m_size += 2;
782  totalOffset += 2;
783  }
784 
786  {
787  m_fixedData->m_infoList[i].m_utcTime = totalOffset;
788  m_fixedData->m_infoList[i].m_utcNano = totalOffset;
789  m_fixedData->m_infoList[i].m_utcYear = totalOffset + 4;
790  m_fixedData->m_infoList[i].m_utcMonth = totalOffset + 6;
791  m_fixedData->m_infoList[i].m_utcDay = totalOffset + 7;
792  m_fixedData->m_infoList[i].m_utcHour = totalOffset + 8;
793  m_fixedData->m_infoList[i].m_utcMinute = totalOffset + 9;
794  m_fixedData->m_infoList[i].m_utcSecond = totalOffset + 10;
795  m_fixedData->m_infoList[i].m_utcValid = totalOffset + 11;
796  m_fixedData->m_infoList[i].m_size += 12;
797  totalOffset += 12;
798  }
799  else {
809  }
810 
811  // post-processing data is never available at this point
813  m_fixedData->m_infoList[i].m_doubleBoundary = totalOffset;
814 
817  }
818 }
819 
820 #if 0
821 /*! \brief Take packet fixed data out of this packet
822  \details The packet fixed data can usually be shared across several other packets. When
823  implementing caching, the fixed packet data can cause a huge overhead. By removing it from the
824  packet, the amount of memory usage is significantly reduced.
825 */
826 PacketFixedData LegacyDataPacket::takePacketFixedData()
827 {
828  if (m_fixedData == NULL)
829  return PacketFixedData();
830 
832  CHKDELNUL(m_fixedData);
833  return data;
834 }
835 
836 
837 /*! \brief Put packet fixed data back into this packet
838  \see takePacketFixedData
839 */
840 void LegacyDataPacket::putPacketFixedData(const PacketFixedData& data)
841 {
842  CHKDELNUL(m_fixedData);
844 }
845 #endif
846 
847 /*! \brief The Raw Accelerometer component of a data item.
848 
849  \param index The index of the item of which the data should be returned.
850 
851  \returns A XsUShortVector containing the x, y and z axis values in that order
852 */
854 {
857  for (uint16_t i=0;i<3;++i)
858  buffer[i] = m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawAcc + (2*i));
859 
860  return buffer;
861 }
862 
863 /*! \brief Check if data item contains Raw Accelerometer data
864 
865  \param index The index of the item of which the data should be returned
866 
867  \returns true if this packet contains raw acceleration data
868 */
870 {
871  if (dataSize(index) == 0)
872  return false;
874  return false;
875  return true;
876 }
877 
878 /*! \brief Add/update Raw Accelerometer data for the item */
880 {
881  if (dataSize(index) == 0)
882  return false;
884  {
885  // add
886  m_fixedData->m_infoList[index].m_rawAcc = (uint16_t) m_msg.getDataSize();
887  m_msg.resizeData(m_msg.getDataSize() + 3*2);
889  }
890  // update
891  for (uint16_t i=0;i<3;++i)
892  m_msg.setDataShort(vec[i], m_fixedData->m_infoList[index].m_rawAcc + (2*i));
893  return true;
894 }
895 
896 //////////////////////////////////////////////////////////////////////////////////////////
897 // Return the Raw Gyroscope component of a data item.
899 {
902  for (uint16_t i=0;i<3;++i)
903  buffer[i] = m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawGyr + (2*i));
904 
905  return buffer;
906 }
908 {
909  if (dataSize(index) == 0)
910  return false;
912  return false;
913  return true;
914 }
916 {
917  if (dataSize(index) == 0)
918  return false;
920  {
921  // add
922  m_fixedData->m_infoList[index].m_rawGyr = (uint16_t) m_msg.getDataSize();
923  m_msg.resizeData(m_msg.getDataSize() + 3*2);
925  }
926  // update
927  for (uint16_t i=0;i<3;++i)
928  m_msg.setDataShort(vec[i], m_fixedData->m_infoList[index].m_rawGyr + (2*i));
929  return true;
930 }
931 
932 //////////////////////////////////////////////////////////////////////////////////////////
933 // Return the Raw Magnetometer component of a data item.
935 {
938  for (uint16_t i=0;i<3;++i)
939  buffer[i] = m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawMag + (2*i));
940 
941  return buffer;
942 }
944 {
945  if (dataSize(index) == 0)
946  return false;
948  return false;
949  return true;
950 }
952 {
953  if (dataSize(index) == 0)
954  return false;
956  {
957  // add
958  m_fixedData->m_infoList[index].m_rawMag = (uint16_t) m_msg.getDataSize();
959  m_msg.resizeData(m_msg.getDataSize() + 3*2);
961  }
962  // update
963  for (uint16_t i=0;i<3;++i)
964  m_msg.setDataShort(vec[i], m_fixedData->m_infoList[index].m_rawMag + (2*i));
965  return true;
966 }
967 
968 //////////////////////////////////////////////////////////////////////////////////////////
969 // Return the Raw Temperature component of a data item.
971 {
972  if (!containsRawTemperature(index, channel))
973  return 0;
974 
975  return m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawTemp[channel]);
976 }
978 {
979  if (dataSize(index) == 0)
980  return false;
981  if (channel >= XS_MAX_TEMPERATURE_CHANNELS)
982  return false;
984  return false;
985  return true;
986 }
988 {
989  if (dataSize(index) == 0)
990  return false;
991  if (channel >= XS_MAX_TEMPERATURE_CHANNELS)
992  return false;
994  {
996  for(int i = c; i <= channel; i++) //Add (also add missing intermediate channels)
997  {
998  m_fixedData->m_infoList[index].m_rawTemp[i] = (uint16_t) m_msg.getDataSize();
999  m_msg.resizeData(m_msg.getDataSize() + 2);
1001  }
1002  }
1003  // update
1004  m_msg.setDataShort(temp, m_fixedData->m_infoList[index].m_rawTemp[channel]);
1005  return true;
1006 }
1008 {
1009  for(int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1010  {
1012  return i;
1013  }
1015 }
1016 
1017 //////////////////////////////////////////////////////////////////////////////////////////
1018 // Return the Raw Data component of a data item.
1020 {
1021  XsScrData buffer;
1022  if (containsRawData(index))
1023  {
1024  const uint8_t* tmp = m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_rawData);
1025  const uint16_t* sh = (const uint16_t*) tmp;
1026  uint16_t* bare = (uint16_t*) &buffer;
1027 
1028  for (uint16_t i=0;i<(9+rawTemperatureChannelCount(index));++i, ++sh, ++bare)
1029  *bare = swapEndian16(*sh);// m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawData + (2*i));
1030  }
1031  return buffer;
1032 }
1034 {
1035  if (dataSize(index) == 0)
1036  return false;
1038 }
1040 {
1041  if (dataSize(index) == 0)
1042  return false;
1044  {
1045  // add
1046  m_fixedData->m_infoList[index].m_rawData = (uint16_t) m_msg.getDataSize();
1047  m_msg.resizeData(m_msg.getDataSize() + 3* 3*2 + 2);
1051  for(int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1052  {
1054  }
1056  }
1057  // update
1058  int16_t* bare = (int16_t*) &data;
1059  for (uint16_t i=0;i<(9+rawTemperatureChannelCount(index));++i)
1060  m_msg.setDataShort(bare[i], m_fixedData->m_infoList[index].m_rawData + (2*i));
1061  return true;
1062 }
1063 
1064 //////////////////////////////////////////////////////////////////////////////////////////
1065 // Return the Gps PVT Data component of a data item.
1067 {
1070  {
1071  //const uint8_t* tmp = m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_gpsPvtData);
1072  //const uint16_t* sh = (const uint16_t*) tmp;
1073  //uint16_t* bare = (uint16_t*) &buffer;
1074 
1075  // pressure data
1076  buffer.m_pressure = m_msg.getDataShort(m_fixedData->m_infoList[index].m_gpsPvtPressure);
1077  // pressAge
1078  buffer.m_pressureAge = m_msg.getDataByte(m_fixedData->m_infoList[index].m_gpsPvtPressureAge);
1079 
1080  // lon,lat,height,hacc,vacc,veln,vele,veld
1081  //tmp = m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_gpsPvtGpsData);
1082  //const uint32_t* ln = (const uint32_t*) tmp;
1083  uint32_t *bareln = (uint32_t*) &buffer.m_itow;
1084  for (uint16_t i=0; i < 10; ++i)
1085  {
1086  //lint --e{662, 661}
1088  {
1089  bareln[i] = m_msg.getDataLong(m_fixedData->m_infoList[index].m_gpsPvtGpsData + (4*i)); //lint !e661 !e662
1090  }
1091  else
1092  {
1093  bareln[i] = 0;
1094  }
1095  }
1096 
1097  // gpsAge
1099  {
1100  buffer.m_gpsAge = m_msg.getDataByte(m_fixedData->m_infoList[index].m_gpsPvtGpsAge);
1101  }
1102  else
1103  {
1104  buffer.m_gpsAge = 0;
1105  }
1106  }
1107  else
1108  buffer.clear();
1109  return buffer;
1110 }
1112 {
1113  if (dataSize(index) == 0)
1114  return false;
1116  return false;
1117  return true;
1118 }
1120 {
1121  if (dataSize(index) == 0)
1122  return false;
1124  {
1125  // add
1126  m_fixedData->m_infoList[index].m_gpsPvtData = (uint16_t) m_msg.getDataSize();
1127  m_msg.resizeData(m_msg.getDataSize() + (2+1) + (40 + 1));
1130 
1143 
1144  m_fixedData->m_infoList[index].m_size += (2+1) + (40 + 1);
1145  }
1146  // update
1147  m_msg.setDataShort(data.m_pressure, m_fixedData->m_infoList[index].m_gpsPvtPressure);
1148  m_msg.setDataByte(data.m_pressureAge, m_fixedData->m_infoList[index].m_gpsPvtPressureAge);
1149 
1150  // lon,lat,height,hacc,vacc,veln,vele,veld
1151  int32_t* bareln = (int32_t*)&data.m_itow;
1152  for (uint16_t i=0; i<10;++i)
1153  m_msg.setDataLong(bareln[i],m_fixedData->m_infoList[index].m_gpsPvtGpsData + (4*i)); //lint !e661 !e662
1154 
1155  // gpsAge
1156  m_msg.setDataByte(data.m_gpsAge, m_fixedData->m_infoList[index].m_gpsPvtGpsAge);
1157  return true;
1158 }
1159 
1160 /*! \brief Return the pressure data component of a data item.
1161  \param index The index of the item of which the data should be returned.
1162  \returns The pressure data component of a data item.
1163 */
1165 {
1167  if (containsPressure(index))
1168  {
1169  // pressure data
1170  // MH; \todo need a conversion factor here to go from short to double?
1171  buffer.m_pressure = (double)m_msg.getDataShort(m_fixedData->m_infoList[index].m_gpsPvtPressure);
1172  // pressAge
1173  buffer.m_pressureAge = m_msg.getDataByte(m_fixedData->m_infoList[index].m_gpsPvtPressureAge);
1174  }
1175  else if (containsMtwSdiData(index))
1176  {
1177  // pressure data
1178  buffer.m_pressure = (double)m_msg.getDataShort(m_fixedData->m_infoList[index].m_wBaroMeter);
1179  // pressAge
1180  buffer.m_pressureAge = (m_msg.getDataByte(m_fixedData->m_infoList[index].m_wAidingData)?0:255);
1181  }
1182  else
1183  buffer = XsPressure();
1184  return buffer;
1185 }
1186 
1187 /*! \brief Return true if the packet contains pressure data
1188 */
1190 {
1191  if (dataSize(index) == 0)
1192  return false;
1195  return false;
1196  return true;
1197 }
1198 
1199 /*! \brief Add/update pressure data for the item
1200 */
1202 {
1203  if (dataSize(index) == 0)
1204  return false;
1206  {
1207  // add
1208  m_fixedData->m_infoList[index].m_gpsPvtData = (uint16_t) m_msg.getDataSize();
1209  m_msg.resizeData(m_msg.getDataSize() + (2+1));
1212 
1213  m_fixedData->m_infoList[index].m_size += (2+1);
1214  }
1215  // update
1216  m_msg.setDataShort((uint16_t) data.m_pressure, m_fixedData->m_infoList[index].m_gpsPvtPressure);
1217  m_msg.setDataByte(data.m_pressureAge, m_fixedData->m_infoList[index].m_gpsPvtPressureAge);
1218 
1219  return true;
1220 }
1221 
1222 /*! \brief Return the strapdown integration (SDI) data component of a data item.
1223  \param index The index of the item of which the data should be returned.
1224  \returns The SDI data component of a data item.
1225 */
1227 {
1230  {
1231  buffer.m_deviceId = m_msg.getDataLong(m_fixedData->m_infoList[index].m_wClientId);
1232  buffer.m_timeSync = m_msg.getDataByte(m_fixedData->m_infoList[index].m_wTimeSync);
1233  buffer.m_firstFrameNumber = m_msg.getDataShort(m_fixedData->m_infoList[index].m_wFirstFrameNumber);
1234  buffer.m_lastFrameNumber = m_msg.getDataShort(m_fixedData->m_infoList[index].m_wLastFrameNumber);
1235  m_msg.getDataFPValue(CHECKIFDOUBLE(m_wCurrentBias), &buffer.m_currentBias[0], m_fixedData->m_infoList[index].m_wCurrentBias, 3);
1236  buffer.m_aidingData = (m_msg.getDataByte(m_fixedData->m_infoList[index].m_wAidingData)==1)?true:false;
1237  buffer.m_barometer = m_msg.getDataShort(m_fixedData->m_infoList[index].m_wBaroMeter) / 50.0;
1238  buffer.m_rssi = (int8_t) m_msg.getDataByte(m_fixedData->m_infoList[index].m_wRssi);
1239 
1240  m_msg.getDataFPValue(CHECKIFDOUBLE(m_wOrientationIncrement), &buffer.m_orientationIncrement[0], m_fixedData->m_infoList[index].m_wOrientationIncrement, 4);
1241  m_msg.getDataFPValue(CHECKIFDOUBLE(m_wVelocityIncrement), &buffer.m_velocityIncrement[0], m_fixedData->m_infoList[index].m_wVelocityIncrement, 3);
1242  m_msg.getDataFPValue(CHECKIFDOUBLE(m_wMagnetoMeter), &buffer.m_magnetoMeter[0], m_fixedData->m_infoList[index].m_wMagnetoMeter, 3);
1243  }
1244  else
1245  {
1246  buffer.m_deviceId = 0;
1247  buffer.m_timeSync = 0;
1248  buffer.m_firstFrameNumber = 0;
1249  buffer.m_lastFrameNumber = 0;
1250  buffer.m_currentBias.zero();
1251  buffer.m_aidingData = 0;
1252  buffer.m_barometer = 0;
1253  buffer.m_rssi = 0;
1254 
1255  buffer.m_orientationIncrement = XsQuaternion::identity();
1256  buffer.m_velocityIncrement.zero();
1257  buffer.m_magnetoMeter.zero();
1258  }
1259  return buffer;
1260 }
1261 
1262 /*! \brief Check if data item contains strapdown integration data
1263  \param index The index of the item of which the data should be returned.
1264  \returns true if the packet contains MTw SDI data
1265 */
1267 {
1268  if (dataSize(index) == 0)
1269  return false;
1271  return false;
1272  return true;
1273 }
1274 
1275 /*! \brief Add/update strapdown integration data for the item
1276  \param data The updated data
1277  \param index The index of the item of which the data should be returned.
1278  \returns true if the data was successfully updated
1279 */
1281 {
1283  {
1284  // add
1285  m_fixedData->m_infoList[index].m_mtwSdiData = (uint16_t) m_msg.getDataSize();
1286  XsSize ds = 8; // add as doubles
1287  m_msg.resizeData(m_msg.getDataSize() + 13 + 13*ds);
1288 
1300  m_fixedData->m_infoList[index].m_size += (uint16_t) (13 + 13*ds);
1301  }
1302  // update
1303  m_msg.setDataLong(data.m_deviceId.toInt(), m_fixedData->m_infoList[index].m_wClientId);
1304  m_msg.setDataByte(data.m_timeSync, m_fixedData->m_infoList[index].m_wTimeSync);
1305  m_msg.setDataShort(data.m_firstFrameNumber, m_fixedData->m_infoList[index].m_wFirstFrameNumber);
1306  m_msg.setDataShort(data.m_lastFrameNumber, m_fixedData->m_infoList[index].m_wLastFrameNumber);
1307  m_msg.setDataFPValue(CHECKIFDOUBLE(m_wCurrentBias), data.m_currentBias.data(), m_fixedData->m_infoList[index].m_wCurrentBias, 3);
1308  m_msg.setDataFPValue(CHECKIFDOUBLE(m_wOrientationIncrement), data.m_orientationIncrement.data(), m_fixedData->m_infoList[index].m_wOrientationIncrement, 4);
1309  m_msg.setDataFPValue(CHECKIFDOUBLE(m_wVelocityIncrement), data.m_velocityIncrement.data(), m_fixedData->m_infoList[index].m_wVelocityIncrement, 3);
1310  m_msg.setDataByte((data.m_aidingData==true)?1:0, m_fixedData->m_infoList[index].m_wAidingData);
1311  m_msg.setDataShort((uint16_t)(XsMath_doubleToLong(data.m_barometer * 50)), m_fixedData->m_infoList[index].m_wBaroMeter);
1312  m_msg.setDataFPValue(CHECKIFDOUBLE(m_wMagnetoMeter), data.m_magnetoMeter.data(), m_fixedData->m_infoList[index].m_wMagnetoMeter, 3);
1313  m_msg.setDataByte(data.m_rssi, m_fixedData->m_infoList[index].m_wRssi);
1314 
1315  return true;
1316 }
1317 
1318 //////////////////////////////////////////////////////////////////////////////////////////
1319 // Return the Temperature component of a data item.
1320 double LegacyDataPacket::temperature(int32_t index, int channel) const
1321 {
1322  if (containsTemperature(index, channel))
1323  return m_msg.getDataFPValue(CHECKIFDOUBLE(m_temp[channel]), m_fixedData->m_infoList[index].m_temp[channel]);
1324 
1325  return 0.0;
1326 }
1328 {
1329  if (dataSize(index) == 0)
1330  return false;
1331  if (channel >= XS_MAX_TEMPERATURE_CHANNELS)
1332  return false;
1334  return false;
1335  return true;
1336 }
1337 bool LegacyDataPacket::setTemperature(const double& temp, int32_t index, int channel)
1338 {
1339  if (dataSize(index) == 0)
1340  return false;
1341  if (channel >= XS_MAX_TEMPERATURE_CHANNELS)
1342  return false;
1343 
1345 
1346  if (m_fixedData->m_infoList[index].m_temp[channel] == XS_DATA_ITEM_NOT_AVAILABLE || !ISDOUBLE(m_temp[channel]))
1347  {
1348  // add
1349  ds = 8;
1350  //m_msg.m_autoUpdateChecksum = false;
1352  for(int i = c; i <= channel; i++) //Add (also add missing intermediate channels)
1353  {
1354  m_fixedData->m_infoList[index].m_temp[i] = (uint16_t) m_msg.getDataSize();
1355  m_msg.resizeData(m_msg.getDataSize() + ds);
1357  }
1358  }
1359  // update
1360  m_msg.setDataFPValue(CHECKIFDOUBLE(m_temp[channel]), temp, m_fixedData->m_infoList[index].m_temp[channel]);
1361  return true;
1362 }
1364 {
1365  for(int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1366  {
1368  return i;
1369  }
1371 }
1372 //////////////////////////////////////////////////////////////////////////////////////////
1373 // Return the Calibrated Accelerometer component of a data item.
1375 {
1376  XsVector3 buffer;
1378  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calAcc), &buffer[0], m_fixedData->m_infoList[index].m_calAcc, 3);
1379  else
1380  buffer.zero();
1381  return buffer;
1382 }
1384 {
1385  if (dataSize(index) == 0)
1386  return false;
1388  return false;
1389  return true;
1390 }
1392 {
1393  const uint16_t numValues = 3;
1394  if (dataSize(index) == 0)
1395  return false;
1396 
1398 
1400  {
1401  // add
1402  ds = 8;
1403  //m_msg.m_autoUpdateChecksum = false;
1404 
1405  m_fixedData->m_infoList[index].m_calAcc = (uint16_t) m_msg.getDataSize();
1406  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1407  m_fixedData->m_infoList[index].m_size += numValues*ds;
1408  }
1409  // update
1410  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calAcc), vec.data(), m_fixedData->m_infoList[index].m_calAcc, numValues);
1411  return true;
1412 }
1413 
1414 //////////////////////////////////////////////////////////////////////////////////////////
1415 // Return the Calibrated Gyroscope component of a data item.
1417 {
1418  XsVector3 buffer;
1420  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calGyr), &buffer[0], m_fixedData->m_infoList[index].m_calGyr, 3);
1421  else
1422  buffer.zero();
1423  return buffer;
1424 }
1426 {
1427  if (dataSize(index) == 0)
1428  return false;
1430  return false;
1431  return true;
1432 }
1434 {
1435  const uint16_t numValues = 3;
1436  if (dataSize(index) == 0)
1437  return false;
1438 
1440 
1442  {
1443  // add
1444  ds = 8;
1445  //m_msg.m_autoUpdateChecksum = false;
1446 
1447  m_fixedData->m_infoList[index].m_calGyr = (uint16_t) m_msg.getDataSize();
1448  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1449  m_fixedData->m_infoList[index].m_size += numValues*ds;
1450  }
1451  // update
1452  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calGyr), vec.data(), m_fixedData->m_infoList[index].m_calGyr, numValues);
1453  return true;
1454 }
1455 
1456 //////////////////////////////////////////////////////////////////////////////////////////
1457 // Return the Calibrated Magnetometer component of a data item.
1459 {
1460  XsVector3 buffer;
1462  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calMag), &buffer[0], m_fixedData->m_infoList[index].m_calMag, 3);
1463  else
1464  buffer.zero();
1465  return buffer;
1466 }
1468 {
1469  if (dataSize(index) == 0)
1470  return false;
1472  return false;
1473  return true;
1474 }
1476 {
1477  const uint16_t numValues = 3;
1478  if (dataSize(index) == 0)
1479  return false;
1480 
1482 
1484  {
1485  // add
1486  ds = 8;
1487  //m_msg.m_autoUpdateChecksum = false;
1488 
1489  m_fixedData->m_infoList[index].m_calMag = (uint16_t) m_msg.getDataSize();
1490  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1491  m_fixedData->m_infoList[index].m_size += numValues*ds;
1492  }
1493  // update
1494  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calMag), vec.data(), m_fixedData->m_infoList[index].m_calMag, numValues);
1495  return true;
1496 }
1497 
1498 /*! \brief Return the Calibrated Data component of a data item.
1499  \param index The index of the item of which the data should be returned.
1500  \returns The Calibrated Data component of a data item.
1501 */
1503 {
1506  {
1507  //lint --e{419}
1508  double* bare = &buffer.m_acc[0];
1510  memset(bare, 0, 3*sizeof(double));
1511  else
1512  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calAcc), bare, m_fixedData->m_infoList[index].m_calAcc, 3);
1513 
1514  bare = &buffer.m_gyr[0];
1516  memset(bare, 0, 3*sizeof(double));
1517  else
1518  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calGyr), bare, m_fixedData->m_infoList[index].m_calGyr, 3);
1519 
1520  bare = &buffer.m_mag[0];
1522  memset(bare, 0, 3*sizeof(double));
1523  else
1524  m_msg.getDataFPValue(CHECKIFDOUBLE(m_calMag), bare, m_fixedData->m_infoList[index].m_calMag, 3);
1525  }
1526  else
1527  {
1528  buffer.m_acc.zero();
1529  buffer.m_gyr.zero();
1530  buffer.m_mag.zero();
1531  }
1532  return buffer;
1533 }
1534 
1535 /*! \brief Check if data item contains Calibrated Data
1536  \param index The index of the item of which the data should be returned.
1537  \returns true if the packet contains Calibrated Data
1538 */
1540 {
1541  if (dataSize(index) == 0)
1542  return false;
1544 }
1545 
1546 /*! \brief Add/update Calibrated Data for the item */
1548 {
1549  const uint16_t numValues = 9;
1550  if (dataSize(index) == 0)
1551  return false;
1552 
1554 
1556  {
1557  // add
1558  ds = 8; // added values are always in double precision
1559  //m_msg.m_autoUpdateChecksum = false;
1560 
1561  m_fixedData->m_infoList[index].m_calData = (uint16_t) m_msg.getDataSize();
1562  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1566  m_fixedData->m_infoList[index].m_size += numValues*ds;
1567  }
1568  // update
1569  double* bare = (double*) &data;
1571  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calAcc), bare, m_fixedData->m_infoList[index].m_calAcc, 3);
1572  bare += 3;
1574  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calGyr), bare, m_fixedData->m_infoList[index].m_calGyr, 3);
1575  bare += 3;
1577  m_msg.setDataFPValue(CHECKIFDOUBLE(m_calMag), bare, m_fixedData->m_infoList[index].m_calMag, 3);
1578 
1579  return true;
1580 }
1581 
1582 //////////////////////////////////////////////////////////////////////////////////////////
1583 // Return the Orientation component of a data item as a Quaternion.
1585 {
1588  m_msg.getDataFPValue(CHECKIFDOUBLE(m_oriQuat), &buffer[0], m_fixedData->m_infoList[index].m_oriQuat, 4);
1589  else
1590  memset(&buffer, 0, sizeof(buffer));
1591  return buffer;
1592 }
1593 
1595 {
1596  if (dataSize(index) == 0)
1597  return false;
1599  return false;
1600  return true;
1601 }
1603 {
1604  const uint16_t numValues = 4;
1605  if (dataSize(index) == 0)
1606  return false;
1607 
1609 
1611  {
1612  // add
1613  ds = 8; // added values are always in double precision
1614  //m_msg.m_autoUpdateChecksum = false;
1615 
1616  m_fixedData->m_infoList[index].m_oriQuat = (uint16_t) m_msg.getDataSize();
1617  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1618  m_fixedData->m_infoList[index].m_size += numValues*ds;
1619 
1620  double* bare = (double*) &data;
1622  bare, m_fixedData->m_infoList[index].m_oriQuat, numValues);
1623  return true;
1624  }
1625  // update
1626  m_msg.setDataFPValue(CHECKIFDOUBLE(m_oriQuat), data.data(), m_fixedData->m_infoList[index].m_oriQuat, numValues);
1627  return true;
1628 }
1629 
1630 //////////////////////////////////////////////////////////////////////////////////////////
1631 // Return the Orientation component of a data item as XsEuler angles.
1633 {
1634  XsEuler buffer;
1636  {
1637 
1638  m_msg.getDataFPValue(CHECKIFDOUBLE(m_oriEul), &buffer[0], m_fixedData->m_infoList[index].m_oriEul, 3);
1639  }
1640  else
1641  memset(&buffer, 0, sizeof(buffer));
1642  return buffer;
1643 }
1645 {
1646  if (dataSize(index) == 0)
1647  return false;
1649  return false;
1650  return true;
1651 }
1653 {
1654  const uint16_t numValues = 3;
1655  if (dataSize(index) == 0)
1656  return false;
1657 
1659 
1661  {
1662  // add
1663  ds = 8; // added values are always in double precision
1664  //m_msg.m_autoUpdateChecksum = false;
1665 
1666  m_fixedData->m_infoList[index].m_oriEul = (uint16_t) m_msg.getDataSize();
1667  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1668  m_fixedData->m_infoList[index].m_size += numValues*ds;
1669  }
1670  // update
1671  m_msg.setDataFPValue(CHECKIFDOUBLE(m_oriEul), data.data(), m_fixedData->m_infoList[index].m_oriEul, numValues);
1672  return true;
1673 }
1674 
1675 //////////////////////////////////////////////////////////////////////////////////////////
1676 // Return the Orientation component of a data item as an Orientation Matrix.
1678 {
1680  uint16_t k = 0;
1682  {
1683  // remember to use column major order in the xbus message!
1685  for (int32_t i=0;i<3;++i)
1686  for (int32_t j=0;j<3;++j, k+=ds)
1687  buffer.setValue(j, i, m_msg.getDataFPValue(CHECKIFDOUBLE(m_oriMat), m_fixedData->m_infoList[index].m_oriMat+k));
1688  }
1689  else
1690  buffer.zero();
1691 
1692  return buffer;
1693 }
1695 {
1696  if (dataSize(index) == 0)
1697  return false;
1699  return false;
1700  return true;
1701 }
1703 {
1704  const uint16_t numValues = 9;
1705  if (dataSize(index) == 0)
1706  return false;
1707 
1709 
1710  // remember to use column major order in the xbus message!
1712  {
1713  // add
1714  ds = 8; // added values are always in double precision
1715  //m_msg.m_autoUpdateChecksum = false;
1716 
1717  m_fixedData->m_infoList[index].m_oriMat = (uint16_t) m_msg.getDataSize();
1718  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1719  m_fixedData->m_infoList[index].m_size += numValues*ds;
1720  }
1721  // update
1722  uint16_t k = 0;
1723  for (int32_t i=0;i<3;++i)
1724  for (int32_t j=0;j<3;++j, k+=ds)
1725  m_msg.setDataFPValue(CHECKIFDOUBLE(m_oriMat), data.value(j, i), m_fixedData->m_infoList[index].m_oriMat+k);
1726  return true;
1727 }
1728 
1730 {
1731  if (dataSize(index) == 0)
1732  return false;
1736  return false;
1737  return true;
1738 }
1739 
1740 //////////////////////////////////////////////////////////////////////////////////////////
1741 // Return the AnalogIn 1 component of a data item.
1743 {
1746  buffer.m_data = m_msg.getDataShort(m_fixedData->m_infoList[index].m_analogIn1);
1747 
1748  return buffer;
1749 }
1751 {
1752  if (dataSize(index) == 0)
1753  return false;
1755  return false;
1756  return true;
1757 }
1759 {
1760  if (dataSize(index) == 0)
1761  return false;
1763  {
1764  // add
1765  m_fixedData->m_infoList[index].m_analogIn1 = (uint16_t) m_msg.getDataSize();
1766  m_msg.resizeData(m_msg.getDataSize() + 2);
1768  }
1769  // update
1770  m_msg.setDataShort(data.m_data, m_fixedData->m_infoList[index].m_analogIn1);
1771  return true;
1772 }
1773 
1774 //////////////////////////////////////////////////////////////////////////////////////////
1775 // Return the AnalogIn 2 component of a data item.
1777 {
1780  buffer.m_data = m_msg.getDataShort(m_fixedData->m_infoList[index].m_analogIn2);
1781 
1782  return buffer;
1783 }
1785 {
1786  if (dataSize(index) == 0)
1787  return false;
1789  return false;
1790  return true;
1791 }
1793 {
1794  if (dataSize(index) == 0)
1795  return false;
1797  {
1798  // add
1799  m_fixedData->m_infoList[index].m_analogIn2 = (uint16_t) m_msg.getDataSize();
1800  m_msg.resizeData(m_msg.getDataSize() + 2);
1802  }
1803  // update
1804  m_msg.setDataShort(data.m_data, m_fixedData->m_infoList[index].m_analogIn2);
1805  return true;
1806 }
1807 
1808 //////////////////////////////////////////////////////////////////////////////////////////
1809 // Return the Position LLA component of a data item.
1811 {
1812  XsVector3 buffer;
1814  m_msg.getDataFPValue(CHECKIFDOUBLE(m_posLLA), &buffer[0], m_fixedData->m_infoList[index].m_posLLA, 3);
1815  else
1816  buffer.zero();
1817  return buffer;
1818 }
1820 {
1821  if (dataSize(index) == 0)
1822  return false;
1824  return false;
1825  return true;
1826 }
1828 {
1829  const uint16_t numValues = 3;
1830  if (dataSize(index) == 0)
1831  return false;
1832 
1834 
1836  {
1837  // add
1838  ds = 8; // added values are always in double precision
1839  //m_msg.m_autoUpdateChecksum = false;
1840 
1841  m_fixedData->m_infoList[index].m_posLLA = (uint16_t) m_msg.getDataSize();
1842  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1843  m_fixedData->m_infoList[index].m_size += numValues*ds;
1844  }
1845  // update
1846  m_msg.setDataFPValue(CHECKIFDOUBLE(m_posLLA), data.data(), m_fixedData->m_infoList[index].m_posLLA, numValues);
1847  return true;
1848 }
1849 
1850 //////////////////////////////////////////////////////////////////////////////////////////
1851 // Return the Velocity NED component of a data item.
1853 {
1854  XsVector3 buffer;
1855  if (containsVelocity(index))
1856  m_msg.getDataFPValue(CHECKIFDOUBLE(m_velNEDorNWU), &buffer[0], m_fixedData->m_infoList[index].m_velNEDorNWU, 3);
1857  else
1858  buffer.zero();
1859  return buffer;
1860 }
1862 {
1863  if (dataSize(index) == 0)
1864  return false;
1866  return false;
1867  return true;
1868 }
1870 {
1871  const uint16_t numValues = 3;
1872  if (dataSize(index) == 0)
1873  return false;
1874 
1876 
1878  {
1879  // add
1880  ds = 8; // added values are always in double precision
1881  //m_msg.m_autoUpdateChecksum = false;
1882 
1884  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
1885  m_fixedData->m_infoList[index].m_size += numValues*ds;
1886  }
1887  // update
1888  m_msg.setDataFPValue(CHECKIFDOUBLE(m_velNEDorNWU), data.data(), m_fixedData->m_infoList[index].m_velNEDorNWU, numValues);
1889  return true;
1890 }
1891 
1892 //////////////////////////////////////////////////////////////////////////////////////////
1893 // Return the Status component of a data item.
1894 uint32_t LegacyDataPacket::status(int32_t index, bool* outIsDetailed) const
1895 {
1896  assert(outIsDetailed != 0);
1897  if (containsStatus(index))
1898  {
1900  {
1901  *outIsDetailed = false;
1902  return m_msg.getDataByte(m_fixedData->m_infoList[index].m_status);
1903  }
1904  else
1905  {
1906  *outIsDetailed = true;
1908  return tmp;
1909  }
1910  }
1911  else
1912  {
1913  return 0;
1914  }
1915 }
1917 {
1918  if (dataSize(index) == 0)
1919  return false;
1921  return false;
1922  return true;
1923 }
1925 {
1926  if (dataSize(index) == 0)
1927  return false;
1929  return false;
1930  return true;
1931 }
1933 {
1934  if (dataSize(index) == 0)
1935  return false;
1936 
1938  {
1939  // add
1940  m_fixedData->m_infoList[index].m_status = (uint16_t) m_msg.getDataSize();
1942  m_msg.resizeData(m_msg.getDataSize() + 4);
1944  }
1945  // update
1947  m_msg.setDataByte(data&0xFF, m_fixedData->m_infoList[index].m_status);
1948  else
1950 
1951  return true;
1952 }
1953 
1954 //////////////////////////////////////////////////////////////////////////////////////////
1955 // Return the Sample Counter component of the packet.
1957 {
1959  return 0;
1960  return m_msg.getDataShort(m_fixedData->m_infoList[index].m_sc);
1961 }
1963 {
1964  if (dataSize(index) == 0)
1965  return false;
1967  return false;
1968  return true;
1969 }
1971 {
1972  if (dataSize(index) == 0)
1973  return false;
1975  {
1976  // add
1977  m_fixedData->m_infoList[index].m_sc = (uint16_t) m_msg.getDataSize();
1978  m_msg.resizeData(m_msg.getDataSize() + 2);
1980  }
1981  // update
1982  m_msg.setDataShort(counter, m_fixedData->m_infoList[index].m_sc);
1983  return true;
1984 }
1985 
1986 //////////////////////////////////////////////////////////////////////////////////////////
1987 // Return the UTC Time component of the packet.
1989 {
1990  XsUtcTime buffer;
1991  if (containsUtcTime(index))
1992  {
1993  buffer.m_nano = m_msg.getDataLong(m_fixedData->m_infoList[index].m_utcNano);
1994  buffer.m_year = m_msg.getDataShort(m_fixedData->m_infoList[index].m_utcYear);
1995 
1996  // month, day, hour, minute, second and valid
1997  uint8_t *bareByte = (uint8_t*) &buffer.m_month;
1998  for (uint16_t i=0; i < 6; ++i)
1999  bareByte[i] = m_msg.getDataByte(m_fixedData->m_infoList[index].m_utcMonth + i); //lint !e661 !e662
2000  }
2001  else
2002  buffer = XsUtcTime();
2003  return buffer;
2004 }
2006 {
2007  if (dataSize(index) == 0)
2008  return false;
2010  return false;
2011  return true;
2012 }
2014 {
2015  if (dataSize(index) == 0)
2016  return false;
2018  {
2019  // add
2020  m_fixedData->m_infoList[index].m_utcTime = (uint16_t) m_msg.getDataSize();
2021  m_msg.resizeData(m_msg.getDataSize() + 12);
2030 
2032  }
2033  // update
2034  m_msg.setDataLong(data.m_nano, m_fixedData->m_infoList[index].m_utcNano);
2035  m_msg.setDataShort(data.m_year, m_fixedData->m_infoList[index].m_utcYear);
2036 
2037  // month, day, hour, minute, second and valid
2038  int8_t* bareByte = (int8_t*)&data.m_month;
2039  for (uint16_t i=0; i<6;++i)
2040  m_msg.setDataByte(bareByte[i],m_fixedData->m_infoList[index].m_utcMonth + i); //lint !e661 !e662
2041 
2042  return true;
2043 }
2044 
2045 //////////////////////////////////////////////////////////////////////////////////////////
2046 // Return the XKF-3 Acc G component of the packet.
2048 {
2049  XsVector3 buffer;
2051  m_msg.getDataFPValue(CHECKIFDOUBLE(m_acc_g), &buffer[0], m_fixedData->m_infoList[index].m_acc_g, 3);
2052  else
2053  buffer.zero();
2054  return buffer;
2055 }
2057 {
2058  if (dataSize(index) == 0)
2059  return false;
2061  return false;
2062  return true;
2063 }
2065 {
2066  const uint16_t numValues = 3;
2067  if (dataSize(index) == 0)
2068  return false;
2069 
2071 
2073  {
2074  // add
2075  ds = 8; // added values are always in double precision
2076  //m_msg.m_autoUpdateChecksum = false;
2077 
2078  m_fixedData->m_infoList[index].m_acc_g = (uint16_t) m_msg.getDataSize();
2079  m_msg.resizeData(m_msg.getDataSize() + numValues*ds);
2080  m_fixedData->m_infoList[index].m_size += numValues*ds;
2081  }
2082  // update
2083  m_msg.setDataFPValue(CHECKIFDOUBLE(m_acc_g), g.data(), m_fixedData->m_infoList[index].m_acc_g, numValues);
2084  return true;
2085 }
2086 
2088 {
2089  switch(channelID)
2090  {
2091  case 1:
2092  return m_triggerIn1;
2093  case 2:
2094  return m_triggerIn2;
2095 
2096  default:
2097  return XsTimeStamp();
2098  }
2099 }
2100 
2101 bool LegacyDataPacket::containsTriggerIndication( int channelID /*= 0*/ ) const
2102 {
2103  switch(channelID)
2104  {
2105  case 0:
2106  return (m_triggerIn1.msTime() == 0 && m_triggerIn2.msTime() == 0) ? false : true;
2107  case 1:
2108  return (m_triggerIn1.msTime() == 0) ? false : true;
2109  case 2:
2110  return (m_triggerIn2.msTime() == 0) ? false : true;
2111 
2112  default:
2113  return false;
2114  }
2115 }
2116 
2118 {
2119  switch(channelID)
2120  {
2121  case 1:
2122  m_triggerIn1 = t;
2123  return true;
2124  case 2:
2125  m_triggerIn2 = t;
2126  return true;
2127  }
2128 
2129  return false;
2130 }
2131 //lint +esym(613, LegacyDataPacket::m_fixedData)
XsOutputMode
Bit values for legacy output mode.
Definition: xsoutputmode.h:16
uint16_t m_rawData
Offset of raw data.
bool containsMtwSdiData(int32_t index=0) const
Check if data item contains strapdown integration data.
#define XS_EXTRA_TEMPERATURE_CHANNELS
Definition: xsscrdata.h:19
bool setMtwSdiData(const MtwSdiData &data, int32_t index=0)
Add/update strapdown integration data for the item.
uint16_t m_offset
Offset of first data byte (whatever it is)
uint16_t itemCount(void) const
Returns the number of devices whose data is contained in the object.
XsSize dataSize(int32_t index=0) const
Returns the size of the data.
MtwSdiData mtwSdiData(int32_t index=0) const
Return the strapdown integration (SDI) data component of a data item.
GLuint GLuint GLsizei count
Definition: glext.h:3512
bool containsOrientation(int32_t index=0) const
Check if data item contains Orientation Data of any kind.
XsDataFormat * m_formatList
A list of the formats of the data items.
XsVector freeAcceleration(int32_t index=0) const
Return the Acc-G component of the packet.
XsScrData rawData(int32_t index=0) const
Return the Raw Data component of a data item.
XsTimeStamp rtc(void) const
Returns the Real Time Clock value as stored in the object.
uint16_t rawTemperature(int32_t index=0, int channel=0) const
Return the Raw Temperature component of a data item.
uint16_t m_gpsPvtLatitude
Offset of raw GPS latitude data.
PacketFixedData * m_fixedData
Fixed packet data.
bool containsOrientationMatrix(int32_t index=0) const
Check if data item contains Matrix Orientation data.
GLdouble GLdouble t
Definition: glext.h:3610
uint16_t m_gpsPvtGpsData
Offset of raw GPS data.
unsigned __int16 uint16_t
Definition: rptypes.h:46
#define XS_MAX_TEMPERATURE_CHANNELS
Definition: xsscrdata.h:20
struct XsPressure XsPressure
Definition: xspressure.h:21
uint16_t m_wClientId
Offset of MTw SDI client ID data.
uint16_t m_gpsPvtVeld
Offset of raw GPS dowanward velocity data.
uint16_t m_utcMonth
Offset of month part of UTC time.
void setMessage(const XsMessage &message)
Set the source message to msg.
bool setRawMagneticField(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Magnetometer data for the item.
uint16_t m_gpsPvtLongitude
Offset of raw GPS longitude data.
XsUtcTime utcTime(int32_t index=0) const
Return the UTC Time component of the packet.
uint16_t m_wAidingData
Offset of MTw SDI aiding data.
bool setTriggerIndication(int channelID, const XsTimeStamp &t)
Add/update trigger indication time for the item to the given line.
uint16_t m_wTimeSync
Offset of MTw SDI time sync data.
int temperatureChannelCount(int32_t index=0) const
Returns the number of temperature channels.
XsMessage m_msg
The message.
uint16_t m_rawAcc
Offset of raw acceleration data.
bool containsOrientationEuler(int32_t index=0) const
Check if data item contains Euler Orientation data.
bool containsRawData(int32_t index=0) const
Check if data item contains Raw Data.
GLuint buffer
Definition: glext.h:3775
uint16_t m_wFirstFrameNumber
Offset of MTw SDI first frame number in interval data.
bool setRawTemperature(uint16_t temp, int32_t index=0, int channel=0)
Add/update Raw Temperature data for the item.
A vector containing 3 short values.
uint16_t m_velNEDorNWU
Offset of velocity data.
uint16_t m_gpsPvtPressure
Offset of pressure data.
uint16_t m_gpsPvtHeight
Offset of raw GPS height data.
uint16_t m_utcTime
Offset of UTC time data.
Class to store strapdown integration data.
Definition: mtwsdidata.h:19
uint16_t m_gpsPvtVacc
Offset of raw GPS vertical accuracy estimate data.
bool setDataFormat(const XsDataFormat &format, int32_t index=0)
Sets the data format of the device with the given index to format.
uint16_t m_rawTemp[XS_MAX_TEMPERATURE_CHANNELS]
Offset of raw temperature data. Note that usually only the first item is used.
uint16_t m_calMag
Offset of calibrated magnetometer data.
bool setGpsPvtData(const XsGpsPvtData &data, int32_t index=0)
Add/update Gps PVT Data for the item.
uint16_t m_calAcc
Offset of calibrated acceleration data.
int32_t findDeviceId(XsDeviceId dev) const
Returns the index of the fixed data with id dev.
bool setOrientationQuaternion(const XsQuaternion &data, int32_t index=0)
Add/update Quaternion Orientation data for the item.
int rawTemperatureChannelCount(int32_t index=0) const
Returns the number of available Raw Temperature channels.
uint16_t m_utcValid
Offset of validity part of UTC time.
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:17
signed char int8_t
Definition: rptypes.h:42
uint16_t m_oriQuat
Offset of orientation in quaternion format.
XsUShortVector rawGyroscopeData(int32_t index=0) const
Return the Raw Gyroscope component of a data item.
uint16_t m_mtwSdiData
Offset of MTw SDI data.
bool setAnalogIn2Data(const XsAnalogInData &data, int32_t index=0)
Add/update AnalogIn 2 for the item.
XsEuler orientationEuler(int32_t index=0) const
Return the Orientation component of a data item as Euler angles.
uint16_t m_status
Offset of status data.
bool setTemperature(const double &temp, int32_t index=0, int channel=0)
Add/update Calibrated Accelerometer data for the item.
uint16_t m_utcSecond
Offset of second part of UTC time.
uint16_t m_gpsPvtPressureAge
Offset of pressure age.
uint16_t m_oriEul
Offset of orientation in euler format.
uint16_t m_rawGyr
Offset of raw gyroscope data.
uint16_t m_wCurrentBias
Offset of MTw SDI gyroscope bias data.
uint16_t m_itemCount
The number of data items in the message.
bool containsFreeAcceleration(int32_t index=0) const
Check if data item contains XKF-3 Acc-G data.
double temperature(int32_t index=0, int channel=0) const
Return the Temperature component of a data item.
uint16_t m_gpsPvtItow
Offset of raw GPS ITOW (Integer Time Of Week) data.
struct XsUtcTime XsUtcTime
Definition: xsutctime.h:25
uint16_t m_doubleBoundary
Boundary where the original data format is ignored and values are stored in double precision...
XsUShortVector rawAcceleration(int32_t index=0) const
The Raw Accelerometer component of a data item.
uint16_t m_gpsPvtGpsAge
Offset of raw GPS age.
XsVector positionLLA(int32_t index=0) const
Return the Position Lat Lon Alt component of a data item.
unsigned char uint8_t
Definition: rptypes.h:43
LegacyDataPacket()
Construct a new LegacyDataPacket without data. The LegacyDataPacket will be invalid.
XsDataFormat dataFormat(int32_t index=0) const
Returns the data format of the device with the given index.
uint16_t m_gpsPvtData
Offset of GPS & pressure data.
uint16_t m_calGyr
Offset of calibrated gyroscope data.
bool setRawGyroscopeData(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Gyroscope data for the item.
bool containsTriggerIndication(int channelID=0) const
Check if data item contains indication time on the given line.
XsAnalogInData analogIn2Data(int32_t index=0) const
Return the AnalogIn 2 component of a data item.
bool containsCalibratedData(int32_t index=0) const
Check if data item contains Calibrated Data.
bool containsCalibratedAcceleration(int32_t index=0) const
Check if data item contains Calibrated Accelerometer data.
uint16_t m_utcHour
Offset of hour part of UTC time.
Contains offset information about data in the packet.
__int16 int16_t
Definition: rptypes.h:45
XsVector calibratedGyroscopeData(int32_t index=0) const
Return the Calibrated Gyroscope component of a data item.
int64_t largePacketCounter(void) const
Return the 64-bit sample counter associated with this packet.
uint16_t m_analogIn1
Offset of analog in channel 1 data.
Structure for storing a single message.
Definition: xsmessage.h:138
__int64 int64_t
Definition: rptypes.h:51
XsGpsPvtData gpsPvtData(int32_t index=0) const
Return the Gps PVT data component of a data item.
GLuint index
Definition: glext.h:3891
const GLubyte * c
Definition: glext.h:5590
bool setAnalogIn1Data(const XsAnalogInData &data, int32_t index=0)
Add/update AnalogIn 1 for the item.
#define PACKETLOG(...)
uint16_t m_wVelocityIncrement
Offset of MTw SDI velocity increment data.
bool containsCalibratedMagneticField(int32_t index=0) const
Check if data item contains Calibrated Magnetometer data.
uint16_t m_oriMat
Offset of orientation in matrix format.
uint16_t m_gpsPvtSacc
Offset of raw GPS speed accuracy estimate data.
bool setFreeAcceleration(const XsVector &g, int32_t index=0)
Add/update XKF-3 Acc-G data for the item.
bool setPacketCounter(const uint16_t counter, int32_t index=0)
Add/update Sample Counter for all items.
PacketInfo * m_infoList
Contains information about data in the packet and the format of that data.
uint16_t m_wRssi
Offset of MTw SDI RSSI data.
void setDeviceId(XsDeviceId deviceId, int32_t index)
Sets the device ID of the device with the given index to deviceid.
bool setUtcTime(const XsUtcTime &data, int32_t index=0)
Add/update UTC Time for all items.
uint16_t m_rawMag
Offset of raw magnetometer data.
GLubyte g
Definition: glext.h:5575
bool containsUtcTime(int32_t index=0) const
Check if data item contains UTC Time.
XsDeviceId deviceId(int32_t index) const
Returns the device ID of the device with the given index.
bool setVelocity(const XsVector &data, int32_t index=0)
Add/update Velocity for the item.
struct XsTimeStamp XsTimeStamp
Definition: xstimestamp.h:227
uint16_t m_acc_g
Offset of acceleration in global frame.
bool setPositionLLA(const XsVector &data, int32_t index=0)
Add/update Position Lat Lon Alt for the item.
Class for managing timestamps in a unified way.
Definition: xstimestamp.h:43
uint16_t m_lastFoundIndex
Index of last found deviceId, speeds up searches.
XsTimeStamp triggerIndication(int channelID) const
Return the synhcronization time recorded by the station.
void setItemCount(uint16_t count)
Set the number of devices whose data is contained in this object to count.
uint16_t m_temp[XS_MAX_TEMPERATURE_CHANNELS]
Offset of calibrated temperature data. Note that usually only the first item is used.
bool containsCalibratedGyroscopeData(int32_t index=0) const
Check if data item contains Calibrated Gyroscope data.
bool setPressure(const XsPressure &data, int32_t index=0)
Add/update pressure data for the item.
#define XS_DATA_ITEM_NOT_AVAILABLE
Indicates that a data item is not available in the packet.
XsQuaternion orientationQuaternion(int32_t index=0) const
Return the Orientation component of a data item as a Quaternion.
XsMessage originalMessage(void) const
Returns the original message as it was received, without computed and added data (except for SDI inte...
const LegacyDataPacket & operator=(const LegacyDataPacket &pack)
Assignment operator, copies the contents of pack into this.
bool containsRawTemperature(int32_t index=0, int channel=0) const
Check if data item contains Raw Temperature data.
uint16_t m_utcNano
Offset of nanosecond part of UTC time.
uint16_t m_wLastFrameNumber
Offset of MTw SDI last frame number in interval data.
Data from analog inputs from sensors.
uint16_t m_utcYear
Offset of year part of UTC time.
#define CHECKIFDOUBLE(a)
bool setStatus(const uint32_t data, int32_t index=0)
Add/update Status information for the item.
__int32 int32_t
Definition: rptypes.h:48
bool containsPacketCounter(int32_t index=0) const
Check if data item contains Sample Counter.
Contains an MTData XsMessage and supports functions for extracting contained data.
A structure for storing data formats.
Definition: xsdataformat.h:17
void setXbusSystem(bool xbus, bool convert=false)
Sets the xbus flag.
XsOutputSettings
Bit values for output settings.
bool containsRawMagneticField(int32_t index=0) const
Check if data item contains Raw Magnetometer data.
XsMessage message(void) const
Returns a copy of the XsMessage contained by the object, including computed and added data...
XsAnalogInData analogIn1Data(int32_t index=0) const
Return the AnalogIn 1 component of a data item.
XsOutputMode m_outputMode
The stored output mode.
Definition: xsdataformat.h:18
uint16_t m_gpsPvtVele
Offset of raw GPS eastward velocity data.
uint16_t m_wBaroMeter
Offset of MTw SDI barometer data.
XsOutputSettings m_outputSettings
The stored output settings.
Definition: xsdataformat.h:19
uint16_t m_detailedStatus
Offset of detailed status data.
bool setRawData(const XsScrData &data, int32_t index=0)
Add/update Raw Data for the item.
A structure for storing UTC Time values.
Definition: xsutctime.h:15
PacketInfo packetInfo(int32_t index) const
Returns the packet info for the index&#39;th device in the packet.
uint16_t m_size
Total size of the data.
A structure containing fixed packet data, which should not change during a measurement for the same d...
bool containsPositionLLA(int32_t index=0) const
Check if data item contains Position Lat Lon Alt.
uint16_t m_gpsPvtVeln
Offset of raw GPS northward velocity data.
bool containsPressure(int32_t index=0) const
Return true if the packet contains pressure data.
XsTimeStamp m_triggerIn1
Trigger indication on line 1.
uint16_t packetCounter(int32_t index=0) const
Return the Sample Counter component of the packet.
XSTYPES_DLL_API int32_t XsMath_doubleToLong(double d)
uint32_t status(int32_t index, bool *outIsDetailed) const
Return the Status component of a data item.
void updateInfoList()
Update the internal info list by analyzing the known XsDataFormat for each device.
void setLargePacketCounter(int64_t sc)
Set the 64-bit sample counter associated with this packet.
bool containsOrientationQuaternion(int32_t index=0) const
Check if data item contains Quaternion Orientation data.
bool containsAnalogIn1Data(int32_t index=0) const
Check if data item contains AnalogIn 1.
uint16_t frameCounter() const
Return the frame counter (previously: sample counter) of the packet.
uint16_t m_gpsPvtHacc
Offset of raw GPS horizontal accuracy estimate data.
XsTimeStamp m_packetId
64 bit sample counter
XsUShortVector rawMagneticField(int32_t index=0) const
Return the Raw Magnetometer component of a data item.
void setTimeOfArrival(XsTimeStamp timeOfArrival)
Set the Time Of Arrival value to timeofarrival.
bool setRawAcceleration(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Accelerometer data for the item.
uint16_t m_analogIn2
Offset of analog in channel 2 data.
XsVector calibratedAcceleration(int32_t index=0) const
Return the Calibrated Accelerometer component of a data item.
uint16_t XsMtTimeStamp
An MT timestamp (sample count)
GLenum GLsizei GLenum format
Definition: glext.h:3513
uint16_t m_utcMinute
Offset of minute part of UTC time.
XsDeviceId m_lastFoundId
Last found deviceId, speeds up searches.
bool setOrientationMatrix(const XsMatrix &data, int32_t index=0)
Add/update Matrix Orientation data for the item.
Container for raw sensor measurement data.
Definition: xsscrdata.h:26
uint16_t m_calData
Offset of calibrated data.
#define ISDOUBLE(a)
XsCalibratedData calibratedData(int32_t index=0) const
Return the Calibrated Data component of a data item.
uint16_t getFPValueSize(int32_t index) const
Returns the floating/fixed point value size in bytes.
uint16_t m_wOrientationIncrement
Offset of MTw SDI orientation increment data.
bool containsAnalogIn2Data(int32_t index=0) const
Check if data item contains AnalogIn 2.
XsPressure pressure(int32_t index=0) const
Return the pressure data component of a data item.
void setRtc(XsTimeStamp rtc)
Set the Real Time Clock value to realtimeclock.
bool setCalibratedMagneticField(const XsVector &vec, int32_t index=0)
Add/update Calibrated Magnetometer data for the item.
bool containsVelocity(int32_t index=0) const
Check if data item contains Velocity.
bool containsStatus(int32_t index=0) const
Check if data item contains Status.
XsMatrix orientationMatrix(int32_t index=0) const
Return the Orientation component of a data item as an Orientation Matrix.
uint16_t m_wMagnetoMeter
Offset of MTw SDI magnetometer data.
bool containsDetailedStatus(int32_t index=0) const
Check if data item contains detailed Status information.
uint16_t m_posLLA
Offset of Latitude-Longitude-Altitude position data.
bool setCalibratedData(const XsCalibratedData &data, int32_t index=0)
Add/update Calibrated Data for the item.
uint16_t m_sc
Offset of sample counter.
XsTimeStamp m_rtc
Sample time in ms, based on the sample counter.
bool containsRawGyroscopeData(int32_t index=0) const
Check if data item contains Raw Gyroscope data.
unsigned __int32 uint32_t
Definition: rptypes.h:49
~LegacyDataPacket()
Destructor.
XsVector calibratedMagneticField(int32_t index=0) const
Return the Calibrated Magnetometer component of a data item.
#define swapEndian16(src)
Definition: cmtmessage.h:71
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520
bool containsTemperature(int32_t index=0, int channel=0) const
Check if data item contains Temperature data.
XsTimeStamp m_triggerIn2
Trigger indication on line 2.
bool setCalibratedAcceleration(const XsVector &vec, int32_t index=0)
Add/update Calibrated Accelerometer data for the item.
bool containsGpsPvtData(int32_t index=0) const
Check if data item contains Gps PVT Data.
XsVector velocity(int32_t index=0) const
Return the Velocity component of a data item.
bool isXbusSystem(void) const
Returns whether the xbus flag is set or not.
bool setCalibratedGyroscopeData(const XsVector &vec, int32_t index=0)
Add/update Calibrated Gyroscope data for the item.
bool setOrientationEuler(const XsEuler &data, int32_t index=0)
Add/update Euler Orientation data for the item.
XsTimeStamp m_toa
Time of arrival.
bool m_xm
Indicates that xbus-formatting is used.
XsTimeStamp timeOfArrival(void) const
Returns the Time Of Arrival value as stored in the object.
bool containsRawAcceleration(int32_t index=0) const
Check if data item contains Raw Accelerometer data.
Data from the GPS unit of a legacy MTi-G.
Definition: xsgpspvtdata.h:32
Pressure data.
Definition: xspressure.h:17
uint16_t m_utcDay
Offset of day part of UTC time.
XsDeviceId * m_idList
A list of the device-ids in this packet.



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020