Main MRPT website > C++ reference for MRPT 1.9.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 //////////////////////////////////////////////////////////////////////////////////////////
33 #define FORMAT_DOUBLE \
34  ((m_fixedData->m_formatList[index].m_outputSettings & \
35  XOS_Dataformat_Mask) | \
36  XOS_Dataformat_Double)
37 #define ISDOUBLE(a) \
38  (m_fixedData->m_infoList[index].a >= \
39  m_fixedData->m_infoList[index].m_doubleBoundary)
40 #define CHECKIFDOUBLE(a) \
41  ISDOUBLE(a) ? FORMAT_DOUBLE \
42  : m_fixedData->m_formatList[index].m_outputSettings
43 
44 /*! \struct LegacyDataPacket
45  \brief Contains an MTData XsMessage and supports functions for extracting
46  contained data.
47 */
48 
49 /*! \brief Construct a new %LegacyDataPacket without data. The %LegacyDataPacket
50  * will be invalid. */
52  : m_fixedData(new PacketFixedData),
53  m_lastFoundId(0),
54  m_lastFoundIndex(0),
55  m_rtc(0),
56  m_toa(0),
57  m_packetId(0),
58  m_triggerIn1(0),
59  m_triggerIn2(0)
60 {
61  PACKETLOG("%s creating default %p\n", __FUNCTION__, this);
62 }
63 
64 /*! \brief Construct a new %LegacyDataPacket with room for data from \a count
65  devices.
66  \param count The number of devices whose data is in the object
67  \param xbus Whether the message was sent by an Xbus Master or by a
68  standalone MT. This matters
69  because the sample counter is in a different place.
70 */
72  : m_fixedData(new PacketFixedData(count)),
73  m_lastFoundId(0),
74  m_lastFoundIndex(0),
75  m_rtc(0),
76  m_toa(0),
77  m_packetId(0),
78  m_triggerIn1(0),
79  m_triggerIn2(0)
80 
81 {
82  PACKETLOG(
83  "%s creating %p with %d items and xbus option %d\n", __FUNCTION__, this,
84  count, xbus);
85  m_fixedData->m_xm = xbus;
86 }
87 
88 /*! \brief Construct a LegacyDataPacket as a copy of \a other. */
90  : m_fixedData(0),
91  m_lastFoundId(0),
92  m_lastFoundIndex(0),
93  m_rtc(0),
94  m_toa(0),
95  m_packetId(0),
96  m_triggerIn1(0),
97  m_triggerIn2(0)
98 
99 {
100  PACKETLOG("%s creating %p from %p\n", __FUNCTION__, this, &other);
101  *this = other;
102  PACKETLOG("%s creating %p from %p done\n", __FUNCTION__, this, &other);
103 }
104 
105 /*! \brief Assignment operator, copies the contents of \a pack into this
106 */
108  const LegacyDataPacket& pack)
109 {
110  PACKETLOG("%s copying from %p to %p\n", __FUNCTION__, &pack, this);
111  if (this == &pack) return *this;
112 
113  delete m_fixedData;
114  m_fixedData = nullptr;
115 
116  if (pack.m_fixedData) // Can be empty
117  {
121  }
122 
123  m_toa = pack.m_toa;
124  m_rtc = pack.m_rtc;
125  m_msg = pack.m_msg;
126  m_packetId = pack.m_packetId;
127  m_triggerIn1 = pack.m_triggerIn1;
128  m_triggerIn2 = pack.m_triggerIn2;
129 
130  PACKETLOG("%s copying from %p to %p done\n", __FUNCTION__, &pack, this);
131  return *this;
132 }
133 
134 /*! \brief Destructor */
136 {
137  try
138  {
139  PACKETLOG("%s destroying %p\n", __FUNCTION__, this);
140  delete m_fixedData;
141  m_fixedData = nullptr;
142  PACKETLOG("%s destroyed %p\n", __FUNCTION__, this);
143  }
144  catch (...)
145  {
146  }
147 }
148 
149 // lint -esym(613, LegacyDataPacket::m_fixedData) assert and dataSize take care
150 // of this
151 /*! \brief Returns the number of devices whose data is contained in the object
152 */
154 {
155  assert(m_fixedData);
156  return m_fixedData->m_itemCount;
157 }
158 
159 /*! \brief Set the number of devices whose data is contained in this object to
160  * \a count
161 */
163 {
164  assert(m_fixedData);
166 }
167 
168 /*! \brief Returns the Time Of Arrival value as stored in the object
169 */
171 /*! \brief Set the Time Of Arrival value to \a timeofarrival
172 */
174 {
175  m_toa = timeofarrival;
176 }
177 
178 /*! \brief Returns the Real Time Clock value as stored in the object
179 */
180 XsTimeStamp LegacyDataPacket::rtc(void) const { return m_rtc; }
181 /*! \brief Set the Real Time Clock value to \a realtimeclock
182 */
183 void LegacyDataPacket::setRtc(const XsTimeStamp realtimeclock)
184 {
185  m_rtc = realtimeclock;
186 }
187 
188 /*! \brief Return the 64-bit sample counter associated with this packet
189  \returns The 64-bit sample counter associated with this packet
190  \note This sample counter may differ a lot from the normal 16-bit sample
191  counter
192 */
194 {
195  return m_packetId.msTime();
196 }
197 
198 /*! \brief Set the 64-bit sample counter associated with this packet
199 */
201 {
202  m_packetId = sc;
203 }
204 
205 /*! \brief Returns a copy of the %XsMessage contained by the object, including
206  * computed and added data. */
208 /*! \brief Returns the original message as it was received, without computed and
209  * added data (except for SDI interval reconstruction)
210 */
212 {
213  assert(m_fixedData);
214  uint16_t originalSize = 0;
215  for (uint16_t i = 0; i < m_fixedData->m_itemCount; ++i)
216  if (m_fixedData->m_infoList[i].m_doubleBoundary > originalSize)
217  originalSize = m_fixedData->m_infoList[i].m_doubleBoundary;
218 
219  if (originalSize == m_msg.getDataSize()) return m_msg;
220 
221  XsMessage m = m_msg;
222  m.resizeData(originalSize);
223  m.setDataBuffer(m_msg.getDataBuffer(), originalSize);
224  m.recomputeChecksum();
225  return m;
226 }
227 
228 /*! \brief Set the source message to \a msg
229  \param msg The message to use
230  \note Call updateInfoList() to actually start using the new message
231 */
232 void LegacyDataPacket::setMessage(const XsMessage& msg) { m_msg = msg; }
233 /*! \brief Returns the packet info for the \a index'th device in the packet.
234  \details This describes what data is contained by the object.
235  \param index The index of the device whose packet info should be returned
236  \returns The packet info for device \a index
237 */
239 {
240  assert(m_fixedData);
242 
243  return m_fixedData->m_infoList[index];
244 }
245 
246 /*! \brief Return the frame counter (previously: sample counter) of the packet
247  \details For SDI data, this function will return the Last Frame Number in
248  the SDI interval.
249  For other data, this function will return the plain Sample Counter.
250  \returns The frame counter of the packet or 0 if it isn't present in the
251  packet (note that 0 is
252  a valid sample counter, so don't use it for an error check).
253 */
255 {
256  assert(m_fixedData);
257  if (containsPacketCounter(0))
258  return m_msg.getDataShort(m_fixedData->m_infoList[0].m_sc);
259  else if (containsMtwSdiData(0))
260  return m_msg.getDataShort(
262  return 0;
263 }
264 
265 //////////////////////////////////////////////////////////////////////////////////////////
266 /*! \brief Returns the index of the fixed data with id \a dev
267  \details If the result is not -1, it can be used as the \a index parameter
268  in other functions
269  that require it (see the list below).
270  \param dev The device ID to find
271  \returns The index of the fixed data
272  \sa deviceId \sa setDeviceId \sa dataFormat \sa setDataFormat(const
273  XsDataFormat&, int32_t)
274  \sa setDataFormat(XsOutputMode, XsOutputSettings, int32_t)
275 */
277 {
278  assert(m_fixedData);
279  if (!dev.isValid()) return 0;
280  if (dev == m_lastFoundId) return m_lastFoundIndex;
281  for (uint16_t i = 0; i < m_fixedData->m_itemCount; ++i)
282  {
283  if (m_fixedData->m_idList[i] == dev)
284  {
285  m_lastFoundId = dev;
286  m_lastFoundIndex = i;
287  return i;
288  }
289  }
290  return -1;
291 }
292 
293 /*! \brief Returns the device ID of the device with the given \a index
294  \param index The index of the device whose device ID should be returned
295  \returns The device ID of the device
296  \sa findDeviceId
297 */
299 {
300  assert(m_fixedData);
301  return m_fixedData->m_idList[index];
302 }
303 
304 /*! \brief Sets the device ID of the device with the given \a index to \a
305  deviceid
306  \param deviceid The device ID to set
307  \param index The index of the device whose device ID should be updated
308  \returns true if the device ID was successfully updated
309  \sa findDeviceId
310 */
312 {
313  assert(m_fixedData);
314  m_fixedData->m_idList[index] = deviceid;
315 }
316 
317 //////////////////////////////////////////////////////////////////////////////////////////
318 /*! \brief Returns the data format of the device with the given \a index
319  \param index The index of the device whose data format should be returned
320  \returns The data format of the device
321  \sa findDeviceId
322 */
324 {
326  m_fixedData->m_formatList == nullptr)
327  return XsDataFormat();
328 
329  return m_fixedData->m_formatList[index];
330 }
331 
332 //////////////////////////////////////////////////////////////////////////////////////////
333 /*! \brief Sets the data format of the device with the given \a index to \a
334  format
335  \param format The data format of the device
336  \param index The index of the device whose data format should be updated
337  \returns true if the data format was successfully updated
338  \sa findDeviceId
339 */
341 {
342  assert(m_fixedData);
343 
344  if (index < m_fixedData->m_itemCount)
345  {
347  updateInfoList();
348  return true;
349  }
350  return false;
351 }
352 
353 //////////////////////////////////////////////////////////////////////////////////////////
354 /*! \brief Sets the data format of the device with the given \a index to \a
355  outputMode and \a outputSettings
356  \param outputMode The output mode of the device (see low level communication
357  documentation)
358  \param outputSettings The output settings of the device (see low level
359  communication documentation)
360  \param index The index of the device whose data format should be updated
361  \returns true if the data format was successfully updated
362  \sa findDeviceId
363 */
365  XsOutputMode outputMode, XsOutputSettings outputSettings, int32_t index)
366 {
367  assert(m_fixedData);
368 
369  if (index < m_fixedData->m_itemCount)
370  {
372  m_fixedData->m_formatList[index].m_outputSettings = outputSettings;
373  updateInfoList();
374  return true;
375  }
376  return false;
377 }
378 
379 //////////////////////////////////////////////////////////////////////////////////////////
380 /*! \brief Returns whether the xbus flag is set or not
381  \returns trur if the xbus flag is set or not
382  \sa setXbusSystem
383 */
385 {
386  assert(m_fixedData);
387  return m_fixedData->m_xm;
388 }
389 
390 //////////////////////////////////////////////////////////////////////////////////////////
391 /*! \brief Sets the xbus flag
392  \details The xbus flag determines where the packet counter is stored in the
393  message. Setting
394  this value incorrectly can lead to corrupted data reads.
395  \param xbus The desired setting
396  \param convert When set to true, the sample counter will be moved from its
397  old place to the new
398  place.
399 */
400 void LegacyDataPacket::setXbusSystem(bool xbus, bool convert)
401 {
402  assert(m_fixedData);
403 
404  if (xbus != m_fixedData->m_xm)
405  {
406  if (convert)
407  {
408  XsMtTimeStamp stamp = packetCounter(0);
409 
410  // move the time stamp value(s) around
411  if (xbus)
412  {
413  // new version is Xbus, so old version is regular format ->
414  // place timestamp at start of packet and remove from all
415  // individual data units
416  // remove the timestamp from all data units
417 
418  // insert timestamp at the start
419  m_msg.insertData(2, 0);
420  m_msg.setDataShort(stamp, 0);
421  }
422  else
423  {
424  // new version is regular, so old version is Xbus format ->
425  // place timestamp at end of all individual data units and
426  // remove from start of packet
427  // append the timestamp to all data units
428 
429  // remove timestamp from the start
430  m_msg.deleteData(2, 0);
431  }
432  }
433  // update the state cache
434  m_fixedData->m_xm = xbus;
435  updateInfoList();
436  }
437 }
438 
439 /*! \brief Returns the floating/fixed point value size in bytes
440  \param index The index of the item whose fp size should be returned.
441  \returns The floating/fixed point value size in bytes
442 */
444 {
445  assert(m_fixedData);
446  uint16_t ds = 4;
449  {
451  ds = 4;
452  break;
453 
455  ds = 8;
456  break;
457 
459  ds = 6;
460  break;
461 
463  ds = 4;
464  break;
465  default:
466  break;
467  }
468  return ds;
469 }
470 
471 /*! \brief Returns the size of the data
472  \param index The index of the item of which the size should be returned.
473  \returns The size of the data
474 */
476 {
477  if (m_fixedData && index < m_fixedData->m_itemCount)
479  return 0;
480 }
481 
482 /*! \brief Update the internal info list by analyzing the known XsDataFormat for
483  * each device.
484 */
486 {
487  assert(m_fixedData);
488  if (m_fixedData->m_infoList != nullptr)
489  {
490  delete[] m_fixedData->m_infoList;
491  m_fixedData->m_infoList = nullptr;
492  }
493 
494  assert(m_fixedData->m_itemCount);
495  // allocate list
497  uint16_t totalOffset;
498  if (m_fixedData->m_xm)
499  totalOffset = 2;
500  else
501  totalOffset = 0;
502 
503  // fill lists
504  for (uint16_t i = 0; i < m_fixedData->m_itemCount; ++i)
505  {
506  m_fixedData->m_infoList[i].m_offset = totalOffset;
507  m_fixedData->m_infoList[i].m_size = 0;
508 
509  uint16_t ds = getFPValueSize(i);
510 
512  {
513  m_fixedData->m_infoList[i].m_rawData = totalOffset;
514  m_fixedData->m_infoList[i].m_rawAcc = totalOffset;
515  m_fixedData->m_infoList[i].m_rawGyr = totalOffset + 6;
516  m_fixedData->m_infoList[i].m_rawMag = totalOffset + 12;
517  m_fixedData->m_infoList[i].m_rawTemp[0] = totalOffset + 18;
518 
519  m_fixedData->m_infoList[i].m_size += 20;
520  totalOffset += 20;
521 
524  {
525  for (int j = 0; j < XS_EXTRA_TEMPERATURE_CHANNELS; j++)
526  {
527  m_fixedData->m_infoList[i].m_rawTemp[j + 1] = totalOffset;
528  m_fixedData->m_infoList[i].m_size += 2;
529  totalOffset += 2;
530  }
531  }
532  else
533  {
534  for (int j = 0; j < XS_EXTRA_TEMPERATURE_CHANNELS; j++)
535  {
536  m_fixedData->m_infoList[i].m_rawTemp[j + 1] =
538  }
539  }
540  }
541  else
542  {
547  for (int j = 0; j < XS_MAX_TEMPERATURE_CHANNELS; j++)
550  }
551 
553  {
554  m_fixedData->m_infoList[i].m_mtwSdiData = totalOffset;
555  m_fixedData->m_infoList[i].m_wClientId = totalOffset;
556  m_fixedData->m_infoList[i].m_wTimeSync = totalOffset + 4;
557  m_fixedData->m_infoList[i].m_wFirstFrameNumber = totalOffset + 5;
558  m_fixedData->m_infoList[i].m_wLastFrameNumber = totalOffset + 7;
559  m_fixedData->m_infoList[i].m_wCurrentBias = totalOffset + 9;
561  totalOffset + 9 + 3 * ds;
563  totalOffset + 9 + 7 * ds;
565  totalOffset + 9 + 10 * ds;
567  totalOffset + 10 + 10 * ds;
569  totalOffset + 12 + 10 * ds;
570  m_fixedData->m_infoList[i].m_wRssi = totalOffset + 12 + 13 * ds;
571  m_fixedData->m_infoList[i].m_size += 13 + 13 * ds;
572  totalOffset += 13 + 13 * ds;
573  }
574  else
575  {
597  }
598 
600  {
601  m_fixedData->m_infoList[i].m_gpsPvtData = totalOffset;
602  m_fixedData->m_infoList[i].m_gpsPvtPressure = totalOffset;
603  m_fixedData->m_infoList[i].m_gpsPvtPressureAge = totalOffset + 2;
604  m_fixedData->m_infoList[i].m_size += 3;
605  totalOffset += 3;
606 
608  XOS_NoGpsInGpsPvt) == 0)
609  {
610  m_fixedData->m_infoList[i].m_gpsPvtGpsData = totalOffset;
611  m_fixedData->m_infoList[i].m_gpsPvtItow = totalOffset;
612  m_fixedData->m_infoList[i].m_gpsPvtLatitude = totalOffset + 4;
613  m_fixedData->m_infoList[i].m_gpsPvtLongitude = totalOffset + 8;
614  m_fixedData->m_infoList[i].m_gpsPvtHeight = totalOffset + 12;
615  m_fixedData->m_infoList[i].m_gpsPvtVeln = totalOffset + 16;
616  m_fixedData->m_infoList[i].m_gpsPvtVele = totalOffset + 20;
617  m_fixedData->m_infoList[i].m_gpsPvtVeld = totalOffset + 24;
618  m_fixedData->m_infoList[i].m_gpsPvtHacc = totalOffset + 28;
619  m_fixedData->m_infoList[i].m_gpsPvtVacc = totalOffset + 32;
620  m_fixedData->m_infoList[i].m_gpsPvtSacc = totalOffset + 36;
621  m_fixedData->m_infoList[i].m_gpsPvtGpsAge = totalOffset + 40;
622  m_fixedData->m_infoList[i].m_size += 41;
623  totalOffset += 41;
624  }
625  else
626  {
651  }
652  }
653  else
654  {
661 
686  }
687 
688  for (int j = 0; j < XS_MAX_TEMPERATURE_CHANNELS; j++)
690 
692  {
693  int tCount = (m_fixedData->m_formatList[i].m_outputSettings &
696  : 1;
697  for (int j = 0; j < tCount; j++)
698  {
699  m_fixedData->m_infoList[i].m_temp[j] = totalOffset;
700  m_fixedData->m_infoList[i].m_size += ds;
701  totalOffset += ds;
702  }
703  }
704 
706  {
707  m_fixedData->m_infoList[i].m_calData = totalOffset;
710  {
711  m_fixedData->m_infoList[i].m_calAcc = totalOffset;
712  m_fixedData->m_infoList[i].m_size += 3 * ds;
713  totalOffset += 3 * ds;
714  }
715  else
718 
721  {
722  m_fixedData->m_infoList[i].m_calGyr = totalOffset;
723  m_fixedData->m_infoList[i].m_size += 3 * ds;
724  totalOffset += 3 * ds;
725  }
726  else
729 
732  {
733  m_fixedData->m_infoList[i].m_calMag = totalOffset;
734  m_fixedData->m_infoList[i].m_size += 3 * ds;
735  totalOffset += 3 * ds;
736  }
737  else
740 
746  }
747  else
748  {
753  }
754 
758 
760  {
763  {
765  m_fixedData->m_infoList[i].m_oriEul = totalOffset;
766  m_fixedData->m_infoList[i].m_size += 3 * ds;
767  totalOffset += 3 * ds;
768  break;
770  m_fixedData->m_infoList[i].m_oriQuat = totalOffset;
771  m_fixedData->m_infoList[i].m_size += 4 * ds;
772  totalOffset += 4 * ds;
773  break;
775  m_fixedData->m_infoList[i].m_oriMat = totalOffset;
776  m_fixedData->m_infoList[i].m_size += 9 * ds;
777  totalOffset += 9 * ds;
778  break;
779  default:
780  break;
781  }
782  }
783 
787  {
790  {
791  m_fixedData->m_infoList[i].m_analogIn1 = totalOffset;
792  m_fixedData->m_infoList[i].m_size += 2;
793  totalOffset += 2;
794  }
795  else
798 
801  {
802  m_fixedData->m_infoList[i].m_analogIn2 = totalOffset;
803  m_fixedData->m_infoList[i].m_size += 2;
804  totalOffset += 2;
805  }
806  else
809  }
810 
813  {
816  {
817  m_fixedData->m_infoList[i].m_posLLA = totalOffset;
818  m_fixedData->m_infoList[i].m_size += 3 * ds;
819  totalOffset += 3 * ds;
820  }
821  }
822 
825  {
828  {
829  m_fixedData->m_infoList[i].m_velNEDorNWU = totalOffset;
830  m_fixedData->m_infoList[i].m_size += 3 * ds;
831  totalOffset += 3 * ds;
832  }
833  }
834 
836  {
837  m_fixedData->m_infoList[i].m_status = totalOffset;
838 
841  {
842  m_fixedData->m_infoList[i].m_detailedStatus = totalOffset;
843  m_fixedData->m_infoList[i].m_size += 4;
844  totalOffset += 4;
845  }
846  else
847  {
850  m_fixedData->m_infoList[i].m_size += 1;
851  totalOffset += 1;
852  }
853  }
854  else
855  {
859  }
860 
865  {
866  if (!m_fixedData->m_xm)
867  m_fixedData->m_infoList[i].m_sc = totalOffset;
868  m_fixedData->m_infoList[i].m_size += 2;
869  totalOffset += 2;
870  }
871 
874  {
875  m_fixedData->m_infoList[i].m_utcTime = totalOffset;
876  m_fixedData->m_infoList[i].m_utcNano = totalOffset;
877  m_fixedData->m_infoList[i].m_utcYear = totalOffset + 4;
878  m_fixedData->m_infoList[i].m_utcMonth = totalOffset + 6;
879  m_fixedData->m_infoList[i].m_utcDay = totalOffset + 7;
880  m_fixedData->m_infoList[i].m_utcHour = totalOffset + 8;
881  m_fixedData->m_infoList[i].m_utcMinute = totalOffset + 9;
882  m_fixedData->m_infoList[i].m_utcSecond = totalOffset + 10;
883  m_fixedData->m_infoList[i].m_utcValid = totalOffset + 11;
884  m_fixedData->m_infoList[i].m_size += 12;
885  totalOffset += 12;
886  }
887  else
888  {
898  }
899 
900  // post-processing data is never available at this point
902  m_fixedData->m_infoList[i].m_doubleBoundary = totalOffset;
903 
907  }
908 }
909 
910 #if 0
911 /*! \brief Take packet fixed data out of this packet
912  \details The packet fixed data can usually be shared across several other packets. When
913  implementing caching, the fixed packet data can cause a huge overhead. By removing it from the
914  packet, the amount of memory usage is significantly reduced.
915 */
916 PacketFixedData LegacyDataPacket::takePacketFixedData()
917 {
918  if (m_fixedData == nullptr)
919  return PacketFixedData();
920 
922  CHKDELNUL(m_fixedData);
923  return data;
924 }
925 
926 
927 /*! \brief Put packet fixed data back into this packet
928  \see takePacketFixedData
929 */
930 void LegacyDataPacket::putPacketFixedData(const PacketFixedData& data)
931 {
932  CHKDELNUL(m_fixedData);
934 }
935 #endif
936 
937 /*! \brief The Raw Accelerometer component of a data item.
938 
939  \param index The index of the item of which the data should be returned.
940 
941  \returns A XsUShortVector containing the x, y and z axis values in that
942  order
943 */
945 {
948  for (uint16_t i = 0; i < 3; ++i)
949  buffer[i] = m_msg.getDataShort(
950  m_fixedData->m_infoList[index].m_rawAcc + (2 * i));
951 
952  return buffer;
953 }
954 
955 /*! \brief Check if data item contains Raw Accelerometer data
956 
957  \param index The index of the item of which the data should be returned
958 
959  \returns true if this packet contains raw acceleration data
960 */
962 {
963  if (dataSize(index) == 0) return false;
965  return false;
966  return true;
967 }
968 
969 /*! \brief Add/update Raw Accelerometer data for the item */
971  const XsUShortVector& vec, int32_t index)
972 {
973  if (dataSize(index) == 0) return false;
975  {
976  // add
977  m_fixedData->m_infoList[index].m_rawAcc = (uint16_t)m_msg.getDataSize();
978  m_msg.resizeData(m_msg.getDataSize() + 3 * 2);
979  m_fixedData->m_infoList[index].m_size += 3 * 2;
980  }
981  // update
982  for (uint16_t i = 0; i < 3; ++i)
983  m_msg.setDataShort(
984  vec[i], m_fixedData->m_infoList[index].m_rawAcc + (2 * i));
985  return true;
986 }
987 
988 //////////////////////////////////////////////////////////////////////////////////////////
989 // Return the Raw Gyroscope component of a data item.
991 {
994  for (uint16_t i = 0; i < 3; ++i)
995  buffer[i] = m_msg.getDataShort(
996  m_fixedData->m_infoList[index].m_rawGyr + (2 * i));
997 
998  return buffer;
999 }
1001 {
1002  if (dataSize(index) == 0) return false;
1004  return false;
1005  return true;
1006 }
1008  const XsUShortVector& vec, int32_t index)
1009 {
1010  if (dataSize(index) == 0) return false;
1012  {
1013  // add
1014  m_fixedData->m_infoList[index].m_rawGyr = (uint16_t)m_msg.getDataSize();
1015  m_msg.resizeData(m_msg.getDataSize() + 3 * 2);
1016  m_fixedData->m_infoList[index].m_size += 3 * 2;
1017  }
1018  // update
1019  for (uint16_t i = 0; i < 3; ++i)
1020  m_msg.setDataShort(
1021  vec[i], m_fixedData->m_infoList[index].m_rawGyr + (2 * i));
1022  return true;
1023 }
1024 
1025 //////////////////////////////////////////////////////////////////////////////////////////
1026 // Return the Raw Magnetometer component of a data item.
1028 {
1031  for (uint16_t i = 0; i < 3; ++i)
1032  buffer[i] = m_msg.getDataShort(
1033  m_fixedData->m_infoList[index].m_rawMag + (2 * i));
1034 
1035  return buffer;
1036 }
1038 {
1039  if (dataSize(index) == 0) return false;
1041  return false;
1042  return true;
1043 }
1045  const XsUShortVector& vec, int32_t index)
1046 {
1047  if (dataSize(index) == 0) return false;
1049  {
1050  // add
1051  m_fixedData->m_infoList[index].m_rawMag = (uint16_t)m_msg.getDataSize();
1052  m_msg.resizeData(m_msg.getDataSize() + 3 * 2);
1053  m_fixedData->m_infoList[index].m_size += 3 * 2;
1054  }
1055  // update
1056  for (uint16_t i = 0; i < 3; ++i)
1057  m_msg.setDataShort(
1058  vec[i], m_fixedData->m_infoList[index].m_rawMag + (2 * i));
1059  return true;
1060 }
1061 
1062 //////////////////////////////////////////////////////////////////////////////////////////
1063 // Return the Raw Temperature component of a data item.
1065 {
1066  if (!containsRawTemperature(index, channel)) return 0;
1067 
1068  return m_msg.getDataShort(
1069  m_fixedData->m_infoList[index].m_rawTemp[channel]);
1070 }
1072 {
1073  if (dataSize(index) == 0) return false;
1074  if (channel >= XS_MAX_TEMPERATURE_CHANNELS) return false;
1075  if (m_fixedData->m_infoList[index].m_rawTemp[channel] ==
1077  return false;
1078  return true;
1079 }
1081  const uint16_t temp, int32_t index, int channel)
1082 {
1083  if (dataSize(index) == 0) return false;
1084  if (channel >= XS_MAX_TEMPERATURE_CHANNELS) return false;
1085  if (m_fixedData->m_infoList[index].m_rawTemp[channel] ==
1087  {
1089  for (int i = c; i <= channel;
1090  i++) // Add (also add missing intermediate channels)
1091  {
1093  (uint16_t)m_msg.getDataSize();
1094  m_msg.resizeData(m_msg.getDataSize() + 2);
1096  }
1097  }
1098  // update
1099  m_msg.setDataShort(temp, m_fixedData->m_infoList[index].m_rawTemp[channel]);
1100  return true;
1101 }
1103 {
1104  for (int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1105  {
1108  return i;
1109  }
1111 }
1112 
1113 //////////////////////////////////////////////////////////////////////////////////////////
1114 // Return the Raw Data component of a data item.
1116 {
1117  XsScrData buffer;
1118  if (containsRawData(index))
1119  {
1120  const uint8_t* tmp =
1121  m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_rawData);
1122  const uint16_t* sh = (const uint16_t*)tmp;
1123  uint16_t* bare = (uint16_t*)&buffer;
1124 
1125  for (uint16_t i = 0; i < (9 + rawTemperatureChannelCount(index));
1126  ++i, ++sh, ++bare)
1127  *bare = swapEndian16(
1128  *sh); // m_msg.getDataShort(m_fixedData->m_infoList[index].m_rawData
1129  // + (2*i));
1130  }
1131  return buffer;
1132 }
1134 {
1135  if (dataSize(index) == 0) return false;
1136  return (
1138 }
1140 {
1141  if (dataSize(index) == 0) return false;
1143  {
1144  // add
1146  (uint16_t)m_msg.getDataSize();
1147  m_msg.resizeData(m_msg.getDataSize() + 3 * 3 * 2 + 2);
1154  for (int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1155  {
1157  m_fixedData->m_infoList[index].m_rawData + 9 * 2 + (i * 2);
1158  }
1160  3 * 3 * 2 + (XS_MAX_TEMPERATURE_CHANNELS * 2);
1161  }
1162  // update
1163  int16_t* bare = (int16_t*)&data;
1164  for (uint16_t i = 0; i < (9 + rawTemperatureChannelCount(index)); ++i)
1165  m_msg.setDataShort(
1166  bare[i], m_fixedData->m_infoList[index].m_rawData + (2 * i));
1167  return true;
1168 }
1169 
1170 //////////////////////////////////////////////////////////////////////////////////////////
1171 // Return the Gps PVT Data component of a data item.
1173 {
1176  {
1177  // const uint8_t* tmp =
1178  // m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_gpsPvtData);
1179  // const uint16_t* sh = (const uint16_t*) tmp;
1180  // uint16_t* bare = (uint16_t*) &buffer;
1181 
1182  // pressure data
1183  buffer.m_pressure =
1185  // pressAge
1186  buffer.m_pressureAge = m_msg.getDataByte(
1188 
1189  // lon,lat,height,hacc,vacc,veln,vele,veld
1190  // tmp =
1191  // m_msg.getDataBuffer(m_fixedData->m_infoList[index].m_gpsPvtGpsData);
1192  // const uint32_t* ln = (const uint32_t*) tmp;
1193  uint32_t* bareln = (uint32_t*)&buffer.m_itow;
1194  for (uint16_t i = 0; i < 10; ++i)
1195  {
1196  // lint --e{662, 661}
1199  {
1200  bareln[i] = m_msg.getDataLong(
1202  (4 * i)); // lint !e661 !e662
1203  }
1204  else
1205  {
1206  bareln[i] = 0;
1207  }
1208  }
1209 
1210  // gpsAge
1213  {
1214  buffer.m_gpsAge = m_msg.getDataByte(
1216  }
1217  else
1218  {
1219  buffer.m_gpsAge = 0;
1220  }
1221  }
1222  else
1223  buffer.clear();
1224  return buffer;
1225 }
1227 {
1228  if (dataSize(index) == 0) return false;
1231  return false;
1232  return true;
1233 }
1235 {
1236  if (dataSize(index) == 0) return false;
1239  {
1240  // add
1242  (uint16_t)m_msg.getDataSize();
1243  m_msg.resizeData(m_msg.getDataSize() + (2 + 1) + (40 + 1));
1248 
1273 
1274  m_fixedData->m_infoList[index].m_size += (2 + 1) + (40 + 1);
1275  }
1276  // update
1277  m_msg.setDataShort(
1279  m_msg.setDataByte(
1281 
1282  // lon,lat,height,hacc,vacc,veln,vele,veld
1283  int32_t* bareln = (int32_t*)&data.m_itow;
1284  for (uint16_t i = 0; i < 10; ++i)
1285  m_msg.setDataLong(
1287  (4 * i)); // lint !e661 !e662
1288 
1289  // gpsAge
1290  m_msg.setDataByte(
1292  return true;
1293 }
1294 
1295 /*! \brief Return the pressure data component of a data item.
1296  \param index The index of the item of which the data should be returned.
1297  \returns The pressure data component of a data item.
1298 */
1300 {
1302  if (containsPressure(index))
1303  {
1304  // pressure data
1305  // MH; \todo need a conversion factor here to go from short to double?
1306  buffer.m_pressure = (double)m_msg.getDataShort(
1308  // pressAge
1309  buffer.m_pressureAge = m_msg.getDataByte(
1311  }
1312  else if (containsMtwSdiData(index))
1313  {
1314  // pressure data
1315  buffer.m_pressure = (double)m_msg.getDataShort(
1317  // pressAge
1318  buffer.m_pressureAge =
1320  ? 0
1321  : 255);
1322  }
1323  else
1324  buffer = XsPressure();
1325  return buffer;
1326 }
1327 
1328 /*! \brief Return true if the packet contains pressure data
1329 */
1331 {
1332  if (dataSize(index) == 0) return false;
1337  return false;
1338  return true;
1339 }
1340 
1341 /*! \brief Add/update pressure data for the item
1342 */
1344 {
1345  if (dataSize(index) == 0) return false;
1348  {
1349  // add
1351  (uint16_t)m_msg.getDataSize();
1352  m_msg.resizeData(m_msg.getDataSize() + (2 + 1));
1357 
1358  m_fixedData->m_infoList[index].m_size += (2 + 1);
1359  }
1360  // update
1361  m_msg.setDataShort(
1362  (uint16_t)data.m_pressure,
1364  m_msg.setDataByte(
1366 
1367  return true;
1368 }
1369 
1370 /*! \brief Return the strapdown integration (SDI) data component of a data item.
1371  \param index The index of the item of which the data should be returned.
1372  \returns The SDI data component of a data item.
1373 */
1375 {
1378  {
1379  buffer.m_deviceId =
1380  m_msg.getDataLong(m_fixedData->m_infoList[index].m_wClientId);
1381  buffer.m_timeSync =
1382  m_msg.getDataByte(m_fixedData->m_infoList[index].m_wTimeSync);
1383  buffer.m_firstFrameNumber = m_msg.getDataShort(
1385  buffer.m_lastFrameNumber = m_msg.getDataShort(
1387  m_msg.getDataFPValue(
1388  CHECKIFDOUBLE(m_wCurrentBias), &buffer.m_currentBias[0],
1390  buffer.m_aidingData =
1391  (m_msg.getDataByte(m_fixedData->m_infoList[index].m_wAidingData) ==
1392  1)
1393  ? true
1394  : false;
1395  buffer.m_barometer =
1396  m_msg.getDataShort(m_fixedData->m_infoList[index].m_wBaroMeter) /
1397  50.0;
1398  buffer.m_rssi =
1399  (int8_t)m_msg.getDataByte(m_fixedData->m_infoList[index].m_wRssi);
1400 
1401  m_msg.getDataFPValue(
1402  CHECKIFDOUBLE(m_wOrientationIncrement),
1403  &buffer.m_orientationIncrement[0],
1405  m_msg.getDataFPValue(
1406  CHECKIFDOUBLE(m_wVelocityIncrement), &buffer.m_velocityIncrement[0],
1408  m_msg.getDataFPValue(
1409  CHECKIFDOUBLE(m_wMagnetoMeter), &buffer.m_magnetoMeter[0],
1411  }
1412  else
1413  {
1414  buffer.m_deviceId = 0;
1415  buffer.m_timeSync = 0;
1416  buffer.m_firstFrameNumber = 0;
1417  buffer.m_lastFrameNumber = 0;
1418  buffer.m_currentBias.zero();
1419  buffer.m_aidingData = 0;
1420  buffer.m_barometer = 0;
1421  buffer.m_rssi = 0;
1422 
1423  buffer.m_orientationIncrement = XsQuaternion::identity();
1424  buffer.m_velocityIncrement.zero();
1425  buffer.m_magnetoMeter.zero();
1426  }
1427  return buffer;
1428 }
1429 
1430 /*! \brief Check if data item contains strapdown integration data
1431  \param index The index of the item of which the data should be returned.
1432  \returns true if the packet contains MTw SDI data
1433 */
1435 {
1436  if (dataSize(index) == 0) return false;
1439  return false;
1440  return true;
1441 }
1442 
1443 /*! \brief Add/update strapdown integration data for the item
1444  \param data The updated data
1445  \param index The index of the item of which the data should be returned.
1446  \returns true if the data was successfully updated
1447 */
1449 {
1452  {
1453  // add
1455  (uint16_t)m_msg.getDataSize();
1456  XsSize ds = 8; // add as doubles
1457  m_msg.resizeData(m_msg.getDataSize() + 13 + 13 * ds);
1458 
1470  m_fixedData->m_infoList[index].m_mtwSdiData + 9 + 3 * ds);
1472  m_fixedData->m_infoList[index].m_mtwSdiData + 9 + 7 * ds);
1474  m_fixedData->m_infoList[index].m_mtwSdiData + 9 + 10 * ds);
1476  m_fixedData->m_infoList[index].m_mtwSdiData + 10 + 10 * ds);
1478  m_fixedData->m_infoList[index].m_mtwSdiData + 12 + 10 * ds);
1480  m_fixedData->m_infoList[index].m_mtwSdiData + 12 + 13 * ds);
1481  m_fixedData->m_infoList[index].m_size += (uint16_t)(13 + 13 * ds);
1482  }
1483  // update
1484  m_msg.setDataLong(
1485  data.m_deviceId.toInt(), m_fixedData->m_infoList[index].m_wClientId);
1486  m_msg.setDataByte(
1487  data.m_timeSync, m_fixedData->m_infoList[index].m_wTimeSync);
1488  m_msg.setDataShort(
1489  data.m_firstFrameNumber,
1491  m_msg.setDataShort(
1492  data.m_lastFrameNumber,
1494  m_msg.setDataFPValue(
1495  CHECKIFDOUBLE(m_wCurrentBias), data.m_currentBias.data(),
1497  m_msg.setDataFPValue(
1498  CHECKIFDOUBLE(m_wOrientationIncrement),
1499  data.m_orientationIncrement.data(),
1501  m_msg.setDataFPValue(
1502  CHECKIFDOUBLE(m_wVelocityIncrement), data.m_velocityIncrement.data(),
1504  m_msg.setDataByte(
1505  (data.m_aidingData == true) ? 1 : 0,
1507  m_msg.setDataShort(
1508  (uint16_t)(XsMath_doubleToLong(data.m_barometer * 50)),
1510  m_msg.setDataFPValue(
1511  CHECKIFDOUBLE(m_wMagnetoMeter), data.m_magnetoMeter.data(),
1513  m_msg.setDataByte(data.m_rssi, m_fixedData->m_infoList[index].m_wRssi);
1514 
1515  return true;
1516 }
1517 
1518 //////////////////////////////////////////////////////////////////////////////////////////
1519 // Return the Temperature component of a data item.
1520 double LegacyDataPacket::temperature(int32_t index, int channel) const
1521 {
1522  if (containsTemperature(index, channel))
1523  return m_msg.getDataFPValue(
1524  CHECKIFDOUBLE(m_temp[channel]),
1525  m_fixedData->m_infoList[index].m_temp[channel]);
1526 
1527  return 0.0;
1528 }
1530 {
1531  if (dataSize(index) == 0) return false;
1532  if (channel >= XS_MAX_TEMPERATURE_CHANNELS) return false;
1533  if (m_fixedData->m_infoList[index].m_temp[channel] ==
1535  return false;
1536  return true;
1537 }
1539  const double& temp, int32_t index, int channel)
1540 {
1541  if (dataSize(index) == 0) return false;
1542  if (channel >= XS_MAX_TEMPERATURE_CHANNELS) return false;
1543 
1545 
1546  if (m_fixedData->m_infoList[index].m_temp[channel] ==
1548  !ISDOUBLE(m_temp[channel]))
1549  {
1550  // add
1551  ds = 8;
1552  // m_msg.m_autoUpdateChecksum = false;
1554  for (int i = c; i <= channel;
1555  i++) // Add (also add missing intermediate channels)
1556  {
1558  (uint16_t)m_msg.getDataSize();
1559  m_msg.resizeData(m_msg.getDataSize() + ds);
1561  }
1562  }
1563  // update
1564  m_msg.setDataFPValue(
1565  CHECKIFDOUBLE(m_temp[channel]), temp,
1566  m_fixedData->m_infoList[index].m_temp[channel]);
1567  return true;
1568 }
1570 {
1571  for (int i = 0; i < XS_MAX_TEMPERATURE_CHANNELS; i++)
1572  {
1573  if (m_fixedData->m_infoList[index].m_temp[i] ==
1575  return i;
1576  }
1578 }
1579 //////////////////////////////////////////////////////////////////////////////////////////
1580 // Return the Calibrated Accelerometer component of a data item.
1582 {
1583  XsVector3 buffer;
1585  m_msg.getDataFPValue(
1586  CHECKIFDOUBLE(m_calAcc), &buffer[0],
1588  else
1589  buffer.zero();
1590  return buffer;
1591 }
1593 {
1594  if (dataSize(index) == 0) return false;
1596  return false;
1597  return true;
1598 }
1600  const XsVector& vec, int32_t index)
1601 {
1602  const uint16_t numValues = 3;
1603  if (dataSize(index) == 0) return false;
1604 
1606 
1608  !ISDOUBLE(m_calAcc))
1609  {
1610  // add
1611  ds = 8;
1612  // m_msg.m_autoUpdateChecksum = false;
1613 
1614  m_fixedData->m_infoList[index].m_calAcc = (uint16_t)m_msg.getDataSize();
1615  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1616  m_fixedData->m_infoList[index].m_size += numValues * ds;
1617  }
1618  // update
1619  m_msg.setDataFPValue(
1620  CHECKIFDOUBLE(m_calAcc), vec.data(),
1621  m_fixedData->m_infoList[index].m_calAcc, numValues);
1622  return true;
1623 }
1624 
1625 //////////////////////////////////////////////////////////////////////////////////////////
1626 // Return the Calibrated Gyroscope component of a data item.
1628 {
1629  XsVector3 buffer;
1631  m_msg.getDataFPValue(
1632  CHECKIFDOUBLE(m_calGyr), &buffer[0],
1634  else
1635  buffer.zero();
1636  return buffer;
1637 }
1639 {
1640  if (dataSize(index) == 0) return false;
1642  return false;
1643  return true;
1644 }
1646  const XsVector& vec, int32_t index)
1647 {
1648  const uint16_t numValues = 3;
1649  if (dataSize(index) == 0) return false;
1650 
1652 
1654  !ISDOUBLE(m_calGyr))
1655  {
1656  // add
1657  ds = 8;
1658  // m_msg.m_autoUpdateChecksum = false;
1659 
1660  m_fixedData->m_infoList[index].m_calGyr = (uint16_t)m_msg.getDataSize();
1661  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1662  m_fixedData->m_infoList[index].m_size += numValues * ds;
1663  }
1664  // update
1665  m_msg.setDataFPValue(
1666  CHECKIFDOUBLE(m_calGyr), vec.data(),
1667  m_fixedData->m_infoList[index].m_calGyr, numValues);
1668  return true;
1669 }
1670 
1671 //////////////////////////////////////////////////////////////////////////////////////////
1672 // Return the Calibrated Magnetometer component of a data item.
1674 {
1675  XsVector3 buffer;
1677  m_msg.getDataFPValue(
1678  CHECKIFDOUBLE(m_calMag), &buffer[0],
1680  else
1681  buffer.zero();
1682  return buffer;
1683 }
1685 {
1686  if (dataSize(index) == 0) return false;
1688  return false;
1689  return true;
1690 }
1692  const XsVector& vec, int32_t index)
1693 {
1694  const uint16_t numValues = 3;
1695  if (dataSize(index) == 0) return false;
1696 
1698 
1700  !ISDOUBLE(m_calMag))
1701  {
1702  // add
1703  ds = 8;
1704  // m_msg.m_autoUpdateChecksum = false;
1705 
1706  m_fixedData->m_infoList[index].m_calMag = (uint16_t)m_msg.getDataSize();
1707  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1708  m_fixedData->m_infoList[index].m_size += numValues * ds;
1709  }
1710  // update
1711  m_msg.setDataFPValue(
1712  CHECKIFDOUBLE(m_calMag), vec.data(),
1713  m_fixedData->m_infoList[index].m_calMag, numValues);
1714  return true;
1715 }
1716 
1717 /*! \brief Return the Calibrated Data component of a data item.
1718  \param index The index of the item of which the data should be returned.
1719  \returns The Calibrated Data component of a data item.
1720 */
1722 {
1725  {
1726  // lint --e{419}
1727  double* bare = &buffer.m_acc[0];
1730  memset(bare, 0, 3 * sizeof(double));
1731  else
1732  m_msg.getDataFPValue(
1733  CHECKIFDOUBLE(m_calAcc), bare,
1735 
1736  bare = &buffer.m_gyr[0];
1739  memset(bare, 0, 3 * sizeof(double));
1740  else
1741  m_msg.getDataFPValue(
1742  CHECKIFDOUBLE(m_calGyr), bare,
1744 
1745  bare = &buffer.m_mag[0];
1748  memset(bare, 0, 3 * sizeof(double));
1749  else
1750  m_msg.getDataFPValue(
1751  CHECKIFDOUBLE(m_calMag), bare,
1753  }
1754  else
1755  {
1756  buffer.m_acc.zero();
1757  buffer.m_gyr.zero();
1758  buffer.m_mag.zero();
1759  }
1760  return buffer;
1761 }
1762 
1763 /*! \brief Check if data item contains Calibrated Data
1764  \param index The index of the item of which the data should be returned.
1765  \returns true if the packet contains Calibrated Data
1766 */
1768 {
1769  if (dataSize(index) == 0) return false;
1770  return (
1772 }
1773 
1774 /*! \brief Add/update Calibrated Data for the item */
1777 {
1778  const uint16_t numValues = 9;
1779  if (dataSize(index) == 0) return false;
1780 
1782 
1785  !ISDOUBLE(m_calData))
1786  {
1787  // add
1788  ds = 8; // added values are always in double precision
1789  // m_msg.m_autoUpdateChecksum = false;
1790 
1792  (uint16_t)m_msg.getDataSize();
1793  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1800  m_fixedData->m_infoList[index].m_size += numValues * ds;
1801  }
1802  // update
1803  double* bare = (double*)&data;
1805  m_msg.setDataFPValue(
1806  CHECKIFDOUBLE(m_calAcc), bare,
1808  bare += 3;
1810  m_msg.setDataFPValue(
1811  CHECKIFDOUBLE(m_calGyr), bare,
1813  bare += 3;
1815  m_msg.setDataFPValue(
1816  CHECKIFDOUBLE(m_calMag), bare,
1818 
1819  return true;
1820 }
1821 
1822 //////////////////////////////////////////////////////////////////////////////////////////
1823 // Return the Orientation component of a data item as a Quaternion.
1825 {
1828  m_msg.getDataFPValue(
1829  CHECKIFDOUBLE(m_oriQuat), &buffer[0],
1831  else
1832  memset(&buffer, 0, sizeof(buffer));
1833  return buffer;
1834 }
1835 
1837 {
1838  if (dataSize(index) == 0) return false;
1840  return false;
1841  return true;
1842 }
1844  const XsQuaternion& data, int32_t index)
1845 {
1846  const uint16_t numValues = 4;
1847  if (dataSize(index) == 0) return false;
1848 
1850 
1853  !ISDOUBLE(m_oriQuat))
1854  {
1855  // add
1856  ds = 8; // added values are always in double precision
1857  // m_msg.m_autoUpdateChecksum = false;
1858 
1860  (uint16_t)m_msg.getDataSize();
1861  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1862  m_fixedData->m_infoList[index].m_size += numValues * ds;
1863 
1864  double* bare = (double*)&data;
1865  m_msg.setDataFPValue(
1869  bare, m_fixedData->m_infoList[index].m_oriQuat, numValues);
1870  return true;
1871  }
1872  // update
1873  m_msg.setDataFPValue(
1874  CHECKIFDOUBLE(m_oriQuat), data.data(),
1875  m_fixedData->m_infoList[index].m_oriQuat, numValues);
1876  return true;
1877 }
1878 
1879 //////////////////////////////////////////////////////////////////////////////////////////
1880 // Return the Orientation component of a data item as XsEuler angles.
1882 {
1883  XsEuler buffer;
1885  {
1886  m_msg.getDataFPValue(
1887  CHECKIFDOUBLE(m_oriEul), &buffer[0],
1889  }
1890  else
1891  memset(&buffer, 0, sizeof(buffer));
1892  return buffer;
1893 }
1895 {
1896  if (dataSize(index) == 0) return false;
1898  return false;
1899  return true;
1900 }
1902 {
1903  const uint16_t numValues = 3;
1904  if (dataSize(index) == 0) return false;
1905 
1907 
1909  !ISDOUBLE(m_oriEul))
1910  {
1911  // add
1912  ds = 8; // added values are always in double precision
1913  // m_msg.m_autoUpdateChecksum = false;
1914 
1915  m_fixedData->m_infoList[index].m_oriEul = (uint16_t)m_msg.getDataSize();
1916  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1917  m_fixedData->m_infoList[index].m_size += numValues * ds;
1918  }
1919  // update
1920  m_msg.setDataFPValue(
1921  CHECKIFDOUBLE(m_oriEul), data.data(),
1922  m_fixedData->m_infoList[index].m_oriEul, numValues);
1923  return true;
1924 }
1925 
1926 //////////////////////////////////////////////////////////////////////////////////////////
1927 // Return the Orientation component of a data item as an Orientation Matrix.
1929 {
1931  uint16_t k = 0;
1933  {
1934  // remember to use column major order in the xbus message!
1936  for (int32_t i = 0; i < 3; ++i)
1937  for (int32_t j = 0; j < 3; ++j, k += ds)
1938  buffer.setValue(
1939  j, i, m_msg.getDataFPValue(
1940  CHECKIFDOUBLE(m_oriMat),
1942  }
1943  else
1944  buffer.zero();
1945 
1946  return buffer;
1947 }
1949 {
1950  if (dataSize(index) == 0) return false;
1952  return false;
1953  return true;
1954 }
1956 {
1957  const uint16_t numValues = 9;
1958  if (dataSize(index) == 0) return false;
1959 
1961 
1962  // remember to use column major order in the xbus message!
1964  !ISDOUBLE(m_oriMat))
1965  {
1966  // add
1967  ds = 8; // added values are always in double precision
1968  // m_msg.m_autoUpdateChecksum = false;
1969 
1970  m_fixedData->m_infoList[index].m_oriMat = (uint16_t)m_msg.getDataSize();
1971  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
1972  m_fixedData->m_infoList[index].m_size += numValues * ds;
1973  }
1974  // update
1975  uint16_t k = 0;
1976  for (int32_t i = 0; i < 3; ++i)
1977  for (int32_t j = 0; j < 3; ++j, k += ds)
1978  m_msg.setDataFPValue(
1979  CHECKIFDOUBLE(m_oriMat), data.value(j, i),
1981  return true;
1982 }
1983 
1985 {
1986  if (dataSize(index) == 0) return false;
1990  return false;
1991  return true;
1992 }
1993 
1994 //////////////////////////////////////////////////////////////////////////////////////////
1995 // Return the AnalogIn 1 component of a data item.
1997 {
2000  buffer.m_data =
2001  m_msg.getDataShort(m_fixedData->m_infoList[index].m_analogIn1);
2002 
2003  return buffer;
2004 }
2006 {
2007  if (dataSize(index) == 0) return false;
2010  return false;
2011  return true;
2012 }
2014  const XsAnalogInData& data, int32_t index)
2015 {
2016  if (dataSize(index) == 0) return false;
2019  {
2020  // add
2022  (uint16_t)m_msg.getDataSize();
2023  m_msg.resizeData(m_msg.getDataSize() + 2);
2025  }
2026  // update
2027  m_msg.setDataShort(data.m_data, m_fixedData->m_infoList[index].m_analogIn1);
2028  return true;
2029 }
2030 
2031 //////////////////////////////////////////////////////////////////////////////////////////
2032 // Return the AnalogIn 2 component of a data item.
2034 {
2037  buffer.m_data =
2038  m_msg.getDataShort(m_fixedData->m_infoList[index].m_analogIn2);
2039 
2040  return buffer;
2041 }
2043 {
2044  if (dataSize(index) == 0) return false;
2047  return false;
2048  return true;
2049 }
2051  const XsAnalogInData& data, int32_t index)
2052 {
2053  if (dataSize(index) == 0) return false;
2056  {
2057  // add
2059  (uint16_t)m_msg.getDataSize();
2060  m_msg.resizeData(m_msg.getDataSize() + 2);
2062  }
2063  // update
2064  m_msg.setDataShort(data.m_data, m_fixedData->m_infoList[index].m_analogIn2);
2065  return true;
2066 }
2067 
2068 //////////////////////////////////////////////////////////////////////////////////////////
2069 // Return the Position LLA component of a data item.
2071 {
2072  XsVector3 buffer;
2074  m_msg.getDataFPValue(
2075  CHECKIFDOUBLE(m_posLLA), &buffer[0],
2077  else
2078  buffer.zero();
2079  return buffer;
2080 }
2082 {
2083  if (dataSize(index) == 0) return false;
2085  return false;
2086  return true;
2087 }
2089 {
2090  const uint16_t numValues = 3;
2091  if (dataSize(index) == 0) return false;
2092 
2094 
2096  !ISDOUBLE(m_posLLA))
2097  {
2098  // add
2099  ds = 8; // added values are always in double precision
2100  // m_msg.m_autoUpdateChecksum = false;
2101 
2102  m_fixedData->m_infoList[index].m_posLLA = (uint16_t)m_msg.getDataSize();
2103  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
2104  m_fixedData->m_infoList[index].m_size += numValues * ds;
2105  }
2106  // update
2107  m_msg.setDataFPValue(
2108  CHECKIFDOUBLE(m_posLLA), data.data(),
2109  m_fixedData->m_infoList[index].m_posLLA, numValues);
2110  return true;
2111 }
2112 
2113 //////////////////////////////////////////////////////////////////////////////////////////
2114 // Return the Velocity NED component of a data item.
2116 {
2117  XsVector3 buffer;
2118  if (containsVelocity(index))
2119  m_msg.getDataFPValue(
2120  CHECKIFDOUBLE(m_velNEDorNWU), &buffer[0],
2122  else
2123  buffer.zero();
2124  return buffer;
2125 }
2127 {
2128  if (dataSize(index) == 0) return false;
2131  return false;
2132  return true;
2133 }
2135 {
2136  const uint16_t numValues = 3;
2137  if (dataSize(index) == 0) return false;
2138 
2140 
2143  !ISDOUBLE(m_posLLA))
2144  {
2145  // add
2146  ds = 8; // added values are always in double precision
2147  // m_msg.m_autoUpdateChecksum = false;
2148 
2150  (uint16_t)m_msg.getDataSize();
2151  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
2152  m_fixedData->m_infoList[index].m_size += numValues * ds;
2153  }
2154  // update
2155  m_msg.setDataFPValue(
2156  CHECKIFDOUBLE(m_velNEDorNWU), data.data(),
2157  m_fixedData->m_infoList[index].m_velNEDorNWU, numValues);
2158  return true;
2159 }
2160 
2161 //////////////////////////////////////////////////////////////////////////////////////////
2162 // Return the Status component of a data item.
2163 uint32_t LegacyDataPacket::status(int32_t index, bool* outIsDetailed) const
2164 {
2165  assert(outIsDetailed != 0);
2166  if (containsStatus(index))
2167  {
2170  {
2171  *outIsDetailed = false;
2172  return m_msg.getDataByte(m_fixedData->m_infoList[index].m_status);
2173  }
2174  else
2175  {
2176  *outIsDetailed = true;
2177  uint32_t tmp = m_msg.getDataLong(
2179  return tmp;
2180  }
2181  }
2182  else
2183  {
2184  return 0;
2185  }
2186 }
2188 {
2189  if (dataSize(index) == 0) return false;
2191  return false;
2192  return true;
2193 }
2195 {
2196  if (dataSize(index) == 0) return false;
2199  return false;
2200  return true;
2201 }
2203 {
2204  if (dataSize(index) == 0) return false;
2205 
2207  {
2208  // add
2209  m_fixedData->m_infoList[index].m_status = (uint16_t)m_msg.getDataSize();
2211  (uint16_t)m_msg.getDataSize();
2212  m_msg.resizeData(m_msg.getDataSize() + 4);
2214  }
2215  // update
2218  m_msg.setDataByte(data & 0xFF, m_fixedData->m_infoList[index].m_status);
2219  else
2220  m_msg.setDataLong(
2222 
2223  return true;
2224 }
2225 
2226 //////////////////////////////////////////////////////////////////////////////////////////
2227 // Return the Sample Counter component of the packet.
2229 {
2230  if (!containsPacketCounter(index)) return 0;
2231  return m_msg.getDataShort(m_fixedData->m_infoList[index].m_sc);
2232 }
2234 {
2235  if (dataSize(index) == 0) return false;
2237  return false;
2238  return true;
2239 }
2241 {
2242  if (dataSize(index) == 0) return false;
2244  {
2245  // add
2246  m_fixedData->m_infoList[index].m_sc = (uint16_t)m_msg.getDataSize();
2247  m_msg.resizeData(m_msg.getDataSize() + 2);
2249  }
2250  // update
2251  m_msg.setDataShort(counter, m_fixedData->m_infoList[index].m_sc);
2252  return true;
2253 }
2254 
2255 //////////////////////////////////////////////////////////////////////////////////////////
2256 // Return the UTC Time component of the packet.
2258 {
2259  XsUtcTime buffer;
2260  if (containsUtcTime(index))
2261  {
2262  buffer.m_nano =
2263  m_msg.getDataLong(m_fixedData->m_infoList[index].m_utcNano);
2264  buffer.m_year =
2265  m_msg.getDataShort(m_fixedData->m_infoList[index].m_utcYear);
2266 
2267  // month, day, hour, minute, second and valid
2268  uint8_t* bareByte = (uint8_t*)&buffer.m_month;
2269  for (uint16_t i = 0; i < 6; ++i)
2270  bareByte[i] = m_msg.getDataByte(
2272  i); // lint !e661 !e662
2273  }
2274  else
2275  buffer = XsUtcTime();
2276  return buffer;
2277 }
2279 {
2280  if (dataSize(index) == 0) return false;
2282  return false;
2283  return true;
2284 }
2286 {
2287  if (dataSize(index) == 0) return false;
2289  {
2290  // add
2292  (uint16_t)m_msg.getDataSize();
2293  m_msg.resizeData(m_msg.getDataSize() + 12);
2310 
2312  }
2313  // update
2314  m_msg.setDataLong(data.m_nano, m_fixedData->m_infoList[index].m_utcNano);
2315  m_msg.setDataShort(data.m_year, m_fixedData->m_infoList[index].m_utcYear);
2316 
2317  // month, day, hour, minute, second and valid
2318  int8_t* bareByte = (int8_t*)&data.m_month;
2319  for (uint16_t i = 0; i < 6; ++i)
2320  m_msg.setDataByte(
2321  bareByte[i],
2322  m_fixedData->m_infoList[index].m_utcMonth + i); // lint !e661 !e662
2323 
2324  return true;
2325 }
2326 
2327 //////////////////////////////////////////////////////////////////////////////////////////
2328 // Return the XKF-3 Acc G component of the packet.
2330 {
2331  XsVector3 buffer;
2333  m_msg.getDataFPValue(
2334  CHECKIFDOUBLE(m_acc_g), &buffer[0],
2336  else
2337  buffer.zero();
2338  return buffer;
2339 }
2341 {
2342  if (dataSize(index) == 0) return false;
2344  return false;
2345  return true;
2346 }
2348 {
2349  const uint16_t numValues = 3;
2350  if (dataSize(index) == 0) return false;
2351 
2353 
2355  !ISDOUBLE(m_acc_g))
2356  {
2357  // add
2358  ds = 8; // added values are always in double precision
2359  // m_msg.m_autoUpdateChecksum = false;
2360 
2361  m_fixedData->m_infoList[index].m_acc_g = (uint16_t)m_msg.getDataSize();
2362  m_msg.resizeData(m_msg.getDataSize() + numValues * ds);
2363  m_fixedData->m_infoList[index].m_size += numValues * ds;
2364  }
2365  // update
2366  m_msg.setDataFPValue(
2367  CHECKIFDOUBLE(m_acc_g), g.data(),
2368  m_fixedData->m_infoList[index].m_acc_g, numValues);
2369  return true;
2370 }
2371 
2373 {
2374  switch (channelID)
2375  {
2376  case 1:
2377  return m_triggerIn1;
2378  case 2:
2379  return m_triggerIn2;
2380 
2381  default:
2382  return XsTimeStamp();
2383  }
2384 }
2385 
2386 bool LegacyDataPacket::containsTriggerIndication(int channelID /*= 0*/) const
2387 {
2388  switch (channelID)
2389  {
2390  case 0:
2391  return (m_triggerIn1.msTime() == 0 && m_triggerIn2.msTime() == 0)
2392  ? false
2393  : true;
2394  case 1:
2395  return (m_triggerIn1.msTime() == 0) ? false : true;
2396  case 2:
2397  return (m_triggerIn2.msTime() == 0) ? false : true;
2398 
2399  default:
2400  return false;
2401  }
2402 }
2403 
2405 {
2406  switch (channelID)
2407  {
2408  case 1:
2409  m_triggerIn1 = t;
2410  return true;
2411  case 2:
2412  m_triggerIn2 = t;
2413  return true;
2414  }
2415 
2416  return false;
2417 }
2418 // 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:26
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:3528
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:3689
uint16_t m_gpsPvtGpsData
Offset of raw GPS data.
unsigned __int16 uint16_t
Definition: rptypes.h:44
#define XS_MAX_TEMPERATURE_CHANNELS
Definition: xsscrdata.h:27
struct XsPressure XsPressure
Definition: xspressure.h:24
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:3917
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.
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.
for(ctr=DCTSIZE;ctr > 0;ctr--)
Definition: jidctflt.cpp:56
uint16_t m_utcValid
Offset of validity part of UTC time.
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:19
signed char int8_t
Definition: rptypes.h:40
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:36
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:41
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:43
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:198
__int64 int64_t
Definition: rptypes.h:49
XsGpsPvtData gpsPvtData(int32_t index=0) const
Return the Gps PVT data component of a data item.
GLuint index
Definition: glext.h:4054
const GLubyte * c
Definition: glext.h:6313
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:6279
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:253
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:53
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.
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:46
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:20
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:22
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:3531
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:35
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:47
~LegacyDataPacket()
Destructor.
XsVector calibratedMagneticField(int32_t index=0) const
Return the Calibrated Magnetometer component of a data item.
#define swapEndian16(src)
Definition: cmtmessage.h:76
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3546
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:34
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.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019