xsdevice_def.cpp
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #include "xsdevice_def.h"
66 #include <xstypes/xsdatapacket.h>
68 #include <xstypes/xsdeviceid.h>
69 #include <xstypes/xsstring.h>
73 #include <xstypes/xsintarray.h>
74 #include <xstypes/xsportinfo.h>
76 #include "protocolhandler.h"
77 #include "communicator.h"
78 #include "mtbdatalogger.h"
79 #include <xstypes/xsbaud.h>
81 #include "xsselftestresult.h"
82 #include <xstypes/xsscrdata.h>
84 #include <xstypes/xsresetmethod.h>
85 #include <xstypes/xssyncsetting.h>
86 #include "nmea_protocolhandler.h"
87 #include <xstypes/xsrssi.h>
88 #include "supportedsyncsettings.h"
89 #include "messageserializer.h"
90 #include "xsdeviceptrarray.h"
91 #include <functional>
95 #include "xsdef.h"
96 #include "xsiccrepmotionresult.h"
97 #include <xscommon/xprintf.h>
98 
100 using namespace xsens;
101 using namespace XsTime;
102 
103 #if 1 && defined(XSENS_RELEASE) && defined(XSENS_DEBUG)
104  // prevent spamming logs with identical "packet missed" loglines
105  #define ONLYFIRSTMTX2 if (!deviceId().isMtx2() || firstChild() == this)
106 #else
107  #define ONLYFIRSTMTX2
108 #endif
109 
111 #define TOADUMP 0 // set to 0 to disable
112 #if TOADUMP
113  #define CREATETOADUMPFILE() if (this == master()) do { if (m_toaDumpFile != nullptr) { fflush(m_toaDumpFile); fclose(m_toaDumpFile); } m_toaDumpFile = fopen(xprintf("toadump_%08X_%p_%llu.csv", deviceId().toInt(), this, XsTimeStamp::nowMs()).c_str(), "wt"); } while(0)
114 #else
115  #define CREATETOADUMPFILE() ((void)0)
116 #endif
117 
118 // set to 1 to log all messages sent and received through the doTransaction functions
119 #ifndef XSENS_RELEASE
120  #define LOGTRANSACTIONS 1 // enable in full debug build
121 #else
122  #define LOGTRANSACTIONS 0 // disable in release and rd builds
123 #endif
124 
146 #if LOGTRANSACTIONS
147 std::string msgToString(XsMessage const& msg)
148 {
149  std::string rv;
150  XsSize sz = msg.getTotalMessageSize();
151  uint8_t const* buffy = msg.getMessageStart();
152  rv.reserve((sz + 1) * 2);
153  for (XsSize i = 0; i < sz; ++i)
154  rv.append(xprintf("%02X", (unsigned int)buffy[i]));
155  return rv;
156 }
157 #define TRANSACTIONLOG(...) JLDEBUGG(__VA_ARGS__)
158 #else
159 #define TRANSACTIONLOG(...) ((void) 0)
160 #endif
161 
166  : m_latestLivePacket(new XsDataPacket)
167  , m_latestBufferedPacket(new XsDataPacket)
168  , m_unavailableDataBoundary(-1)
169  , m_deviceId(id)
170  , m_state(XDS_Initial)
171  , m_connectivity(XCS_Disconnected)
172  , m_communicator(nullptr)
173  , m_logFileInterface(nullptr)
174  , m_master(this)
175  , m_refCounter(0)
176  , m_writeToFile(false)
177  , m_isInitialized(false)
178  , m_terminationPrepared(false)
179  , m_gotoConfigOnClose(true)
180  , m_justWriteSetting(false)
181  , m_skipEmtsReadOnInit(true)
182  , m_options(XSO_None)
183  , m_startRecordingPacketId(-1)
184  , m_stopRecordingPacketId(-1)
185  , m_stoppedRecordingPacketId(-1)
186  , m_lastAvailableLiveDataCache(new XsDataPacket)
187  , m_toaDumpFile(nullptr)
188 {
190  JLDEBUGG(this << " Created device " << deviceId());
191 }
192 
198  : m_latestLivePacket(new XsDataPacket)
199  , m_latestBufferedPacket(new XsDataPacket)
200  , m_unavailableDataBoundary(-1)
201  , m_deviceId(0)
202  , m_state(XDS_Initial)
203  , m_connectivity(XCS_Disconnected)
204  , m_communicator(comm)
205  , m_logFileInterface(nullptr)
206  , m_master(this)
207  , m_refCounter(0)
208  , m_writeToFile(false)
209  , m_isInitialized(false)
210  , m_terminationPrepared(false)
211  , m_gotoConfigOnClose(true)
212  , m_justWriteSetting(false)
213  , m_skipEmtsReadOnInit(false)
214  , m_options(XSO_None)
215  , m_startRecordingPacketId(-1)
216  , m_stopRecordingPacketId(-1)
217  , m_stoppedRecordingPacketId(-1)
218  , m_lastAvailableLiveDataCache(new XsDataPacket)
219  , m_toaDumpFile(nullptr)
220 {
221  // put callback managers and callbacks in place
224 
226 
228 
229  if (m_communicator->isPortOpen())
231  else if (m_communicator->isReadingFromFile())
232  {
235  }
237  JLDEBUGG(this << " Created device " << deviceId());
238 }
239 
245 XsDevice::XsDevice(XsDevice* masterDevice, const XsDeviceId& childDeviceId)
246  : m_latestLivePacket(new XsDataPacket)
247  , m_latestBufferedPacket(new XsDataPacket)
248  , m_unavailableDataBoundary(-1)
249  , m_deviceId(childDeviceId)
250  , m_state(XDS_Initial)
251  , m_connectivity(XCS_Unknown)
252  , m_communicator(nullptr)
253  , m_logFileInterface(nullptr)
254  , m_master(masterDevice)
255  , m_refCounter(0)
256  , m_writeToFile(false)
257  , m_isInitialized(false)
258  , m_terminationPrepared(false)
259  , m_gotoConfigOnClose(true)
260  , m_justWriteSetting(false)
261  , m_skipEmtsReadOnInit(true)
262  , m_options(XSO_None)
263  , m_startRecordingPacketId(-1)
264  , m_stopRecordingPacketId(-1)
265  , m_stoppedRecordingPacketId(-1)
266  , m_lastAvailableLiveDataCache(new XsDataPacket)
267  , m_toaDumpFile(nullptr)
268 {
269  (void)masterDevice;
270  JLDEBUGG(this << " Created device " << deviceId() << " child of " << masterDevice << " " << (masterDevice ? masterDevice->deviceId() : XsDeviceId()));
271 }
272 
275 {
276  JLDEBUGG(this << " did " << deviceId() << " refcounter " << m_refCounter.load());
277  LockSuspendable locky(&m_deviceMutex, LS_Write); // This is to make sure that we're not deleting the object while some other thread is using it. Especially the communicator threads tend to still be active at this point.
278 
279  assert(m_refCounter.load() == 0);
280  assert(m_terminationPrepared);
281 
282  try
283  {
284  if (m_latestLivePacket)
285  {
286  delete m_latestLivePacket;
287  m_latestLivePacket = nullptr;
288  }
290  {
291  delete m_latestBufferedPacket;
292  m_latestBufferedPacket = nullptr;
293  }
295  {
298  }
299 
300  locky.unlock(); // the lock will interfere with thread termination
302  {
305  m_communicator = nullptr;
306  }
307 
308  if (m_logFileInterface)
309  {
311  delete m_logFileInterface;
312  }
313 
314  JLDEBUGG(this << " destroyed");
315 
316  if (m_toaDumpFile)
317  {
318  fflush(m_toaDumpFile);
319  fclose(m_toaDumpFile);
320  m_toaDumpFile = nullptr;
321  }
322  }
323  catch (...)
324  {
325  }
326 }
327 
333 {
334  return m_master;
335 }
336 
340 {
341 }
342 
347 {
349  {
350  JLDEBUGG("Preparing " << deviceId() << " for termination");
351 
353 
354  if (isMasterDevice() && m_communicator != nullptr && m_communicator->isPortOpen())
355  {
357  gotoConfig();
359  }
360  // finishLastProcessingTask(); // make sure no processing is going on in the background either...
361  m_terminationPrepared = true;
362  }
363 }
364 
372 {
374  LockGuarded lockG(&m_deviceMutex);
375 
376  // we don't allow any transitions out of the (final) destructing state
377  if (m_state == XDS_Destructing)
378  return;
379 
380  XsDeviceState oldState = m_state;
381  if (oldState != newState)
382  {
383  ONLYFIRSTMTX2
384  JLDEBUGG("did: " << m_deviceId << " new: " << newState << " old: " << m_state);
385  // some special case handling
386  switch (newState)
387  {
388  case XDS_FlushingData: // to
389  switch (oldState)
390  {
391  case XDS_Measurement: // from
392  return;
393 
394  case XDS_Recording: // from
398  ONLYFIRSTMTX2
399  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
400  break;
401 
402  case XDS_WaitingForRecordingStart: // from
404  return;
405 
406  default:
407  break;
408  }
409  break;
410 
411  case XDS_Recording: // to
412  switch (oldState)
413  {
414  case XDS_Measurement: // from
419  ONLYFIRSTMTX2
420  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
421  break;
422  default:
423  break;
424  }
425  break;
426 
427  case XDS_WaitingForRecordingStart: // to
428  switch (oldState)
429  {
430  case XDS_Measurement: // from
434  ONLYFIRSTMTX2
435  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
436  break;
437  default:
438  break;
439  }
440  break;
441 
442  case XDS_Measurement: // to
443  switch (oldState)
444  {
445  case XDS_Recording: // from
446  case XDS_FlushingData: // from
452  //m_latestBufferedPacket->clear();
453  ONLYFIRSTMTX2
454  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
455  break;
456 
457  case XDS_Config:
458  default:
462  ONLYFIRSTMTX2
463  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
466  break;
467  }
468  break;
469 
470  default:
471  break;
472  }
473 
474  m_state = newState;
475  lockG.unlock();
476  locky.unlock();
477  onDeviceStateChanged(this, newState, oldState);
478  }
479 }
480 
483 {
484  return false;
485 }
486 
489 {
490  return false;
491 }
492 
500 XsDevice* XsDevice::findDevice(XsDeviceId const& deviceid) const
501 {
502  if (deviceid == m_deviceId)
503  return const_cast<XsDevice*>(this);
504  return nullptr;
505 }
506 
512 XsDevice const* XsDevice::findDeviceConst(XsDeviceId const& deviceid) const
513 {
514  return const_cast<XsDevice const*>(const_cast<XsDevice*>(this)->findDevice(deviceid));
515 }
516 
519 void XsDevice::setGotoConfigOnClose(bool gotoConfigOnClose)
520 {
521  m_gotoConfigOnClose = gotoConfigOnClose;
522 }
536 {
537  return 0;
538 }
539 
545 {
546  return 0;
547 }
548 
555 {
556  return false;
557 }
558 
563 {
564  return XDOF_None;
565 }
566 
571 {
572  XsDataIdentifier mask;
573  if ((dataType & XDI_TypeMask) == dataType)
574  mask = XDI_TypeMask;
575  else
576  mask = XDI_FullTypeMask;
577 
579  auto item = std::find_if(cfg.begin(), cfg.end(),
580  [&](const XsOutputConfiguration & cfg)
581  {
582  return (cfg.m_dataIdentifier & mask) == dataType;
583  }
584 
585  );
586  if (item == cfg.end())
587  return XsOutputConfiguration();
588  return *item;
589 }
602 {
604 
605  if (cfg.m_dataIdentifier == XDI_None)
606  return updateRate();
607 
608  return cfg.m_frequency;
609 }
610 
623 {
624  return updateRateForDataIdentifier(dataType);
625 }
626 
633 {
634  return checkDataEnabled(dataType, outputConfiguration());
635 }
636 
639 bool XsDevice::checkDataEnabled(XsDataIdentifier dataType, XsOutputConfigurationArray const& configurations)
640 {
641  XsDataIdentifier mask;
642  if ((dataType & XDI_TypeMask) == dataType)
643  mask = XDI_TypeMask;
644  else // if ((dataType & XDI_FullTypeMask) == dataType)
645  mask = XDI_FullTypeMask;
646 
647  dataType = dataType & mask;
648 
649  for (XsOutputConfigurationArray::const_iterator i = configurations.begin(); i != configurations.end(); ++i)
650  {
651  if (dataType == (i->m_dataIdentifier & mask))
652  return true;
653  }
654  return false;
655 }
666 {
667  return false;
668 }
669 
676 {
677  return m_firmwareVersion;
678 }
679 
683 void XsDevice::setFirmwareVersion(const XsVersion& version)
684 {
685  if (m_firmwareVersion != version)
686 #ifdef XSENS_DEBUG
687  JLDEBUGG("Device " << deviceId() << " has firmware version " << version.toString());
688 #else
689  JLWRITEG("Device " << deviceId() << " has firmware version " << version.toString());
690 #endif
691  m_firmwareVersion = version;
692 }
693 
697 void XsDevice::extractFirmwareVersion(XsMessage const& message)
698 {
700  m_firmwareVersion = XsVersion(message.getDataByte(0), message.getDataByte(1), message.getDataByte(2));
701  if (message.getDataSize() > 3)
702  m_firmwareVersion.setBuild((int)(int32_t) message.getDataLong(3));
703  if (message.getDataSize() > 7)
704  m_firmwareVersion.setReposVersion((int)(int32_t) message.getDataLong(7));
705  if (old != m_firmwareVersion)
706 #ifdef XSENS_DEBUG
707  JLDEBUGG("Device " << deviceId() << " has firmware version " << m_firmwareVersion.toString());
708 #else
709  JLWRITEG("Device " << deviceId() << " has firmware version " << m_firmwareVersion.toString());
710 #endif
711 }
712 
715 {
716  return m_communicator;
717 }
718 
720 DataLogger* XsDevice::logFileInterface(std::unique_ptr<xsens::Lock>& myLock) const
721 {
722  if (!myLock)
723  myLock.reset(new xsens::Lock(&m_logFileMutex, true));
724  else if (!myLock->isLocked())
725  myLock->lock();
726  return m_logFileInterface;
727 }
728 
731 void XsDevice::setDeviceId(const XsDeviceId& deviceid)
732 {
733  m_deviceId = deviceid;
734 }
743 {
744  return m_deviceId;
745 }
746 
751 {
752  return false;
753 }
754 
759 {
760  return false;
761 }
762 
768 {
769  if (isMasterDevice() && (busid == XS_BID_MASTER || busid == 1))
770  return this;
771  return nullptr;
772 }
773 
778 const XsDevice* XsDevice::deviceAtBusIdConst(int busid) const
779 {
780  // prevent code duplication, go through the non-const implementation
781  return const_cast<XsDevice const*>(const_cast<XsDevice*>(this)->deviceAtBusId(busid));
782 }
783 
786 {
787 }
788 
795 {
796  return m_lastResult;
797 }
798 
805 {
806  return m_lastResult.lastResultText();
807 }
808 
814 {
815  return false;
816 }
817 
826 {
827  return 0;
828 }
829 
838 {
839  return XBR_Invalid;
840 }
841 
850 {
851  Communicator* comm = communicator();
852  if (!comm)
853  return XBR_Invalid;
854  return comm->portInfo().baudrate();
855 }
856 
860 int XsDevice::busId() const
861 {
862  return XS_BID_MASTER;
863 }
864 
876 {
877  if (!isMasterDevice())
878  return false;
879 
880  Communicator* comm = communicator();
881  if (!comm)
882  return false;
883 
884  if (comm->isReadingFromFile())
885  return false;
886 
888  snd.setBusId(XS_BID_MASTER);
889  snd.setDataByte(XsBaud::rateToCode(baudrate));
890 
891  if (!doTransaction(snd, 1000))//increased from 500 to 1000, since the One Series timed out very rarely with the old value
892  return false;
893 
894  if (comm->portInfo().baudrate() == XBR_Invalid ||
895  comm->portInfo().baudrate() == baudrate ||
897  return true;
898 
899  if (!resetRemovesPort())
900  return reset();
901  else
902  return true;
903 }
904 
911 {
912  return XsIntArray();
913 }
914 
931 {
932  (void)config;
933  return false;
934 }
935 
941 {
942  LockGuarded lockG(&m_deviceMutex);
943  JLDEBUGG("did: " << deviceId());
944  m_latestLivePacket->clear();
945  m_latestBufferedPacket->clear();
946  m_lastDataOkStamp = 0;
950 }
961 {
962  JLDEBUGG(deviceId());
963 
964  if (!isMasterDevice())
965  {
966  m_lastResult.set(XRV_OTHER, deviceId().toString() << " is not a master device, can't switch to measurement mode");
968  return false;
969  }
970 
971  if (m_state == XDS_Measurement) // if we're already in measurement mode, we can ignore this command
972  {
973  m_lastResult.set(XRV_OK, deviceId().toString() << " was already in measurement mode");
975  return true;
976  }
977 
978  Communicator* comm = communicator();
979  if (!comm)
980  {
981  m_lastResult.set(XRV_OTHER, deviceId().toString() << " doesn't have a communicator, can't switch to measurement mode");
983  return false;
984  }
985 
986  if (comm->isReadingFromFile())
987  {
988  m_lastResult.set(XRV_OTHER, deviceId().toString() << " is reading from file, can't switch to measurement mode");
990  return false;
991  }
992 
993  XsResultValue res = comm->gotoMeasurement();
994  if (res == XRV_OK)
995  {
996  // switch device (and children) to measuring state
998  m_lastResult.set(XRV_OK, deviceId().toString() << " now in measurement mode");
1000  return true;
1001  }
1002 
1003  m_lastResult.set(XRV_OTHER, deviceId().toString() << " communicator refused with code " << res << " (" << XsResultValue_toString(res) << "), switching children back to config mode");
1005  return false;
1006 }
1007 
1015 {
1016  JLDEBUGG(deviceId());
1017  if (!isMasterDevice())
1018  {
1019  m_lastResult.set(XRV_OTHER, deviceId().toString() << " is not a master device, can't switch to config mode");
1021  return false;
1022  }
1023 
1024  if (m_state == XDS_Config) // if we're already in config mode, we can ignore this command
1025  {
1026  m_lastResult.set(XRV_OK, deviceId().toString() << " was already in config mode");
1028  return true;
1029  }
1030 
1031  Communicator* comm = communicator();
1032  if (!comm)
1033  {
1034  m_lastResult.set(XRV_OTHER, deviceId().toString() << " doesn't have a communicator, can't switch to config mode");
1036  return false;
1037  }
1038 
1039  if (comm->isReadingFromFile())
1040  {
1041  m_lastResult.set(XRV_INVALIDOPERATION, deviceId().toString() << " is reading from file, can't switch to config mode");
1043  return false;
1044  }
1045 
1046  XsResultValue res = comm->gotoConfig();
1047  if (res == XRV_OK)
1048  {
1050  m_lastResult.set(XRV_OK, deviceId().toString() << " now in config mode");
1052  return true;
1053  }
1054 
1055  m_lastResult.set(XRV_OTHER, deviceId().toString() << " communicator refused with code " << res << " (" << XsResultValue_toString(res) << "), can't switch to config mode");
1057  return false;
1058 }
1059 
1065 {
1066  return m_state;
1067 }
1068 
1076 {
1077  // LockSuspendable locky(&m_deviceMutex, LS_Write);
1078  // lock is already acquired by updateDeviceState,
1079  updateDeviceState(state);
1080 }
1087 {
1088  return this == master();
1089 }
1090 
1095 {
1096  return false;
1097 }
1098 
1103 {
1104  return isMasterDevice() && !isContainerDevice();
1105 }
1106 
1113 {
1115  snd.setBusId(busId());
1116  MessageSerializer(snd) << (uint32_t)setFlags << (uint32_t)clearFlags;
1117 
1118  XsMessage rcv;
1119  if (!doTransaction(snd, rcv))
1120  return false;
1121 
1122  return true;
1123 }
1124 
1139 {
1140  auto const rv = setOutputConfigurationInternal(config);
1141  if (rv != XRV_OK)
1142  return false;
1143  return true;
1144 }
1145 
1151 {
1153  snd.setBusId(busId());
1154  bool wasEmpty = config.empty();
1155  MessageSerializer(snd) << config;
1156 
1157  XsMessage rcv;
1158  if (!doTransaction(snd, rcv))
1159  {
1160  // deal w/ possible race condition on m_lastResult
1161  auto const rv = rcv.toResultValue();
1162  m_lastResult = rv;
1163  return rv;
1164  }
1165 
1166  MessageDeserializer(rcv) >> config;
1167  if (wasEmpty && config.size() == 1 && config[0] == XsOutputConfiguration(XDI_None, 0))
1168  config.clear();
1169 
1170  m_outputConfiguration = config;
1171  return XRV_OK;
1172 }
1173 /* \endcond */
1174 
1189 {
1190  (void)config;
1191  return false;
1192 }
1193 
1199 {
1200  (void)config;
1201  return false;
1202 }
1203 
1210 {
1211  return outputConfiguration();
1212 }
1213 
1220 bool XsDevice::setStringOutputMode(uint16_t type, uint16_t period, uint16_t skipFactor)
1221 {
1223  sndType.setBusId(XS_BID_MASTER); // Always send to master device
1224  sndType.resizeData(2);
1225  sndType.setDataShort(type);
1226 
1227  if (!doTransaction(sndType))
1228  return false;
1229 
1230  if (type == 0)
1231  return true;
1232 
1234  sndSkip.setBusId(busId());
1235  sndSkip.resizeData(2);
1236  sndSkip.setDataShort(skipFactor);
1237 
1238  if (!doTransaction(sndSkip))
1239  return false;
1240 
1241  m_config.masterInfo().m_outputSkipFactor = skipFactor;
1242 
1243  XsMessage sndPer(XMID_SetPeriod);
1244  sndPer.setBusId(XS_BID_MASTER); // Always send to master device
1245  sndPer.resizeData(2);
1246  sndPer.setDataShort(period);
1247 
1248  if (!doTransaction(sndPer))
1249  return false;
1250 
1251  m_config.masterInfo().m_samplingPeriod = period;
1252 
1253  return true;
1254 }
1255 
1260 {
1261  return XsStringOutputTypeArray();
1262 }
1263 
1270 {
1271  if (method == XRM_StoreAlignmentMatrix && deviceState() != XDS_Config)
1272  return false;
1273 
1275  return false;
1276 
1278  snd.setBusId(busId());
1279  snd.resizeData(2);
1280  snd.setDataShort((uint16_t)method);
1281 
1282  if (!doTransaction(snd))
1283  return false;
1284  return true;
1285 }
1302 bool XsDevice::sendCustomMessage(const XsMessage& messageSend, bool waitForResult, XsMessage& messageReceive, int timeout)
1303 {
1304  return sendCustomMessage(messageSend, waitForResult, static_cast<XsXbusMessageId>(messageSend.getMessageId() + 1), messageReceive, timeout);
1305 }
1306 
1312 {
1313  Communicator* comm = communicator();
1314  if (!comm)
1315  return false;
1316  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(message));
1317  return comm->writeMessage(message);
1318 }
1319 
1338 bool XsDevice::sendCustomMessage(const XsMessage& messageSend, bool waitForResult, XsXbusMessageId messageId, XsMessage& messageReceive, int timeout)
1339 {
1340  Communicator* comm = communicator();
1341  if (!comm)
1342  return false;
1343 
1344  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(messageSend));
1345  std::shared_ptr<ReplyObject> reply = comm->addReplyObject(messageId);
1346  if (!comm->writeMessage(messageSend))
1347  return false;
1348 
1349  if (waitForResult)
1350  {
1351  if (!timeout)
1352  timeout = (int)(int32_t) comm->defaultTimeout();
1353  messageReceive = reply->message((uint32_t)(unsigned int)timeout);
1354  TRANSACTIONLOG(m_deviceId << " RCV: " << msgToString(messageReceive));
1355  if (messageReceive.getMessageId() != messageId)
1356  return false;
1357  }
1358 
1359  return true;
1360 }
1361 
1368 bool XsDevice::waitForCustomMessage(XsXbusMessageId messageId, XsMessage& messageReceive, int timeout)
1369 {
1370  Communicator* comm = communicator();
1371  if (!comm)
1372  return false;
1373 
1374  std::shared_ptr<ReplyObject> reply = comm->addReplyObject(messageId);
1375 
1376  if (!timeout)
1377  timeout = (int)(int32_t) comm->defaultTimeout();
1378  messageReceive = reply->message((uint32_t)(unsigned int)timeout);
1379 
1380  if (messageReceive.getMessageId() != messageId)
1381  return false;
1382 
1383  return true;
1384 }
1385 
1392 bool XsDevice::waitForCustomMessage(std::shared_ptr<ReplyObject> reply, XsMessage& messageReceive, int timeout)
1393 {
1394  if (!timeout && communicator())
1395  timeout = (int)(int32_t) communicator()->defaultTimeout();
1396  messageReceive = reply->message((uint32_t)(unsigned int)timeout);
1397 
1398  if (messageReceive.getMessageId() != reply->msgId())
1399  return false;
1400 
1401  return true;
1402 }
1403 
1409 std::shared_ptr<ReplyObject> XsDevice::addReplyObject(XsXbusMessageId messageId, uint8_t data)
1410 {
1411  Communicator* comm = communicator();
1412  if (!comm)
1413  return std::shared_ptr<ReplyObject>();
1414 
1415  return comm->addReplyObject(messageId, 0, 1, &data);
1416 }
1417 
1424 bool XsDevice::shouldDataMsgBeRecorded(const XsMessage& msg) const
1425 {
1426  (void)msg;
1427  return (deviceState() == XDS_Recording);
1428 }
1429 
1432 void XsDevice::handleMessage(const XsMessage& msg)
1433 {
1434  if (isMasterDevice())
1435  writeMessageToLogFile(msg);
1436 
1437  switch (msg.getMessageId())
1438  {
1439  case XMID_MtData2:
1440  {
1441  XsDataPacket packet(&msg);
1442  packet.setDeviceId(deviceId());
1443  handleDataPacket(packet);
1444  break;
1445  }
1446 
1447  case XMID_Error:
1448  handleErrorMessage(msg);
1449  break;
1450 
1451  case XMID_Warning:
1452  handleWarningMessage(msg);
1453  break;
1454 
1455  case XMID_MasterIndication:
1457  break;
1458 
1459  case XMID_Wakeup:
1460  handleWakeupMessage(msg);
1461  break;
1462 
1463  default:
1464  JLDEBUGG("Handling non-data msg " << msg.getMessageId() << " bid " << JLHEXLOG((int)msg.getBusId()));
1465  handleNonDataMessage(msg);
1466  break;
1467  }
1468 }
1469 
1473 {
1474  onNonDataMessage(this, &msg);
1475 }
1476 
1479 void XsDevice::handleErrorMessage(const XsMessage& msg)
1480 {
1481  uint8_t errorCode = msg.getDataByte(0);
1482  XsResultValue xsResultValue = static_cast<XsResultValue>(errorCode);
1483  onNonDataMessage(this, &msg);
1484  onError(this, xsResultValue);
1485 }
1486 
1490 {
1491  onNonDataMessage(this, &msg);
1492 }
1493 
1497 {
1498  (void)msg;
1499  onWakeupReceived(this);
1500 
1501  //"reset" some of the states after a wake up of a device
1506 }
1507 
1512 void XsDevice::insertIntoDataCache(int64_t pid, XsDataPacket* pack)
1513 {
1514  LockGuarded lockG(&m_deviceMutex);
1515 
1516  if (m_dataCache.empty())
1517  m_dataCache.insert(std::make_pair(pid, pack));
1518  else
1519  {
1520  auto it = m_dataCache.lower_bound(pid);
1521  if (it == m_dataCache.end())
1522  m_dataCache.insert(it, std::make_pair(pid, pack));
1523  else
1524  {
1525  if (it->first != pid)
1526  m_dataCache.insert(it, std::make_pair(pid, pack));
1527  else
1528  {
1529  it->second->merge(*pack, true);
1530  delete pack;
1531  }
1532  }
1533  }
1534 }
1535 
1539 {
1540  LockGuarded lockG(&m_deviceMutex);
1541 
1542  for (auto& it : m_dataCache)
1543  delete it.second;
1544  m_dataCache.clear();
1545  //m_latestLivePacket->clear();
1546  m_latestBufferedPacket->clear();
1548 }
1549 
1554 void XsDevice::handleUnavailableData(int64_t frameNumber)
1555 {
1556  LockGuarded lockG(&m_deviceMutex);
1557 
1558  if (frameNumber < latestBufferedPacketId())
1559  return; // The recording stream already advanced itself beyond this frame. We don't need it
1560  if (latestLivePacketId() == -1)
1561  return;
1562  if (m_stopRecordingPacketId >= 0 && frameNumber > m_stopRecordingPacketId)
1563  return; // we're missing data past the end of the recording, ignore
1564 
1565  //JLDEBUGG("Device " << m_deviceId << " Updating m_unavailableDataBoundary from " << m_unavailableDataBoundary << " to " << (std::max)(m_unavailableDataBoundary, frameNumber));
1566  m_unavailableDataBoundary = (std::max)(m_unavailableDataBoundary, frameNumber); // Note: (std::max) to prevent a macro for max() to be substituted
1567  checkDataCache();
1568 }
1569 
1575 {
1576  if (p.empty())
1577  return false;
1578 
1579  if (isReadingFromFile())
1580  return true;
1581 
1582  switch (deviceState())
1583  {
1584  case XDS_Recording:
1585  case XDS_FlushingData:
1586  break;
1587 
1588  default:
1589  return false;
1590  }
1591 
1592  if (isStandaloneDevice())
1593  return true;
1594 
1595  if (m_stopRecordingPacketId >= 0 && p.packetId() > m_stopRecordingPacketId)
1596  return false;
1597 
1598  if (!p.containsFrameRange())
1599  return p.packetId() >= m_startRecordingPacketId;
1600 
1601  int64_t startPid = p.packetId() - p.frameRange().interval();
1602  return startPid >= m_startRecordingPacketId;
1603 }
1604 
1608 void XsDevice::handleDataPacket(const XsDataPacket& packet)
1609 {
1610  LockGuarded locky(&m_deviceMutex);
1612  return; // we're being destroyed, abort handling of datapacket, state may be invalid
1613 
1614  m_lastDataOkStamp = XsTimeStamp::now();
1615  int64_t fastest = latestLivePacketConst().packetId();
1616  int64_t slowest = latestBufferedPacketConst().packetId();
1617 
1618  std::unique_ptr<XsDataPacket> pack(new XsDataPacket(packet));
1619  master()->m_packetStamper.stampPacket(*pack, latestLivePacket()); // always go through master for stamping packets so we have consistent timing
1620  int64_t current = pack->packetId();
1621 
1622 #if TOADUMP
1623  fprintf(master()->m_toaDumpFile, "%llu,%llu,%llu\n", current, pack->timeOfArrival().msTime(), pack->estimatedTimeOfSampling().msTime());
1624 #endif
1625 
1626 #if 0
1627  ONLYFIRSTMTX2
1628  JLWRITEG(this << " [TOALOG] pid: " << current <<
1629  " did: " << deviceId() <<
1630  " awindaframenr: " << packet.awindaSnapshot().m_frameNumber <<
1631  " packetTOA: " << pack->timeOfArrival().msTime() <<
1632  " fastest: " << fastest <<
1633  " slowest: " << slowest <<
1634  " etos " << pack->estimatedTimeOfSampling().msTime());
1635  JLDEBUGG("stamped: " << current << " new latestlive: " << latestLivePacketConst().packetId());
1636 #endif
1637 
1638  bool interpolate = false;
1639  if (fastest >= 0)
1640  {
1641  int64_t dpc = current - fastest;
1642 
1643  if (dpc > 1)
1644  {
1645  int64_t firstMissed = fastest + 1;
1646  int64_t lastMissed = current - 1;
1647  ONLYFIRSTMTX2
1648  JLDEBUGG("Detected " << (dpc - 1) << " packets have been missed by device " << deviceId() << ", last was " << fastest << " (" << (uint16_t) fastest << ") current is " << current << " (" << (uint16_t) current << ")");
1649  onMissedPackets(this, (int) dpc - 1, (int) firstMissed, (int) lastMissed);
1650 
1651  for (int64_t i = firstMissed; i <= lastMissed; ++i)
1652  {
1654  {
1655  //JLDEBUGG("not expecting retransmission for packet " << i);
1658  interpolate = true;
1659  }
1660  }
1661  }
1662  }
1663  else if (isReadingFromFile() && getStartRecordingPacketId() == -1)
1664  setStartRecordingPacketId(current);
1665 
1666  if (current >= fastest)
1667  {
1668  JLTRACEG("Processing (live) packet " << current);
1669  std::unique_ptr<XsDataPacket> copy(new XsDataPacket(*pack));
1670  processLivePacket(*copy);
1671 
1672  if (interpolate)
1673  {
1674  // when this returns true, the packet has been processed properly already so we should return
1676  [this](XsDataPacket * ppp)
1677  {
1678  handleDataPacket(*ppp);
1679  delete ppp;
1680  }))
1681  {
1682  return;
1683  }
1684  }
1685 
1686  // store result
1687  latestLivePacket().swap(*copy);
1688 
1689  // do callbacks
1690  if (!latestLivePacketConst().empty())
1691  {
1696 
1697  //if (isRecording())
1698  // JLDEBUGG("Device " << m_deviceId << " triggering onLiveDataAvailable " << latestLivePacketConst().packetId());
1700  if (!isReadingFromFile())
1702  if (isStandaloneDevice())
1703  {
1704  XsDevicePtrArray devs;
1705  const XsDataPacket* ppack = &latestLivePacketConst();
1706  devs.push_back(this);
1707  XsDataPacketPtrArray packs;
1708  packs.push_back(const_cast<XsDataPacket*>(ppack));
1709  onAllLiveDataAvailable(&devs, &packs);
1710  if (!isReadingFromFile())
1711  onAllDataAvailable(&devs, &packs);
1712  }
1713  }
1714  }
1715  else
1716  {
1717  // probably a retransmission
1718  //JLDEBUGG("Device " << deviceId() << " ignoring (live) packet " << current << " because it is older than " << fastest);
1719  }
1720 
1721  if (latestBufferedPacketConst().empty() || current > slowest)
1722  {
1723  // insert into cache
1724  //JLDEBUGG("Device " << deviceId() << " Adding (buffered) packet " << current);
1725  insertIntoDataCache(current, pack.get());
1726  pack.release();
1727  checkDataCache();
1728  }
1729  else
1730  {
1731  // not correct, weird old retransmission
1732  ONLYFIRSTMTX2
1733  JLDEBUGG("Device " << deviceId() << " ignoring (buffered) packet " << current << " because it is not newer than " << slowest);
1734  }
1735 }
1742 {
1743  switch (deviceState())
1744  {
1745  case XDS_Measurement:
1747  case XDS_Recording:
1748  case XDS_FlushingData:
1749  return true;
1750 
1751  case XDS_Initial:
1752  case XDS_Config:
1753  case XDS_Destructing:
1754  default:
1755  return false;
1756  }
1757 }
1758 
1763 {
1764  switch (deviceState())
1765  {
1767  case XDS_Recording:
1768  case XDS_FlushingData:
1769  return true;
1770 
1771  case XDS_Measurement:
1772  case XDS_Initial:
1773  case XDS_Config:
1774  case XDS_Destructing:
1775  default:
1776  return false;
1777  }
1778 }
1779 
1784 {
1785  if (!communicator())
1786  return false;
1787  assert(communicator());
1788  return communicator()->isReadingFromFile();
1789 }
1790 
1795 {
1796 }
1797 
1801 {
1802 }
1808 {
1809  JLDEBUGG(this);
1810  if (isMasterDevice() && communicator())
1811  communicator()->flushPort();
1812  clearDataCache();
1814 }
1815 
1822 {
1823  return XSR_None;
1824 }
1825 
1831 {
1832  JLDEBUGG("");
1833  if (isMasterDevice())
1834  {
1835  Communicator* comm = communicator();
1836  if (!comm)
1837  return false;
1838 
1839  if (comm->isReadingFromFile())
1840  {
1841  XsMessage rcv;
1842 
1844  if (comm->lastResult() != XRV_OK)
1845  return false;
1846  m_config.readFromMessage(rcv);
1847 
1849  if (comm->lastResult() != XRV_OK)
1850  {
1851  // We cannot determine the firmware version of the master, use the first sensor (fallback)
1852  auto const& tmp = m_config.deviceInfo((XsSize)(ptrdiff_t)busId());
1853  m_firmwareVersion = XsVersion(tmp.m_fwRevMajor, tmp.m_fwRevMinor, tmp.m_fwRevRevision);
1854  }
1855  else
1857  }
1858  else
1859  {
1860  if (!gotoConfig())
1861  {
1862  JLALERTG("Failed to go to config");
1863  return false;
1864  }
1865 
1866  XsMessage snd(XMID_Initbus);
1867  snd.setBusId(busId());
1868 
1869  if (!doTransaction(snd, 500))
1870  {
1871  JLALERTG("Failed to init bus");
1872  return false;
1873  }
1874 
1875  snd.setMessageId(XMID_ReqConfiguration);
1876  snd.setBusId(busId());
1877 
1878  XsMessage rcv;
1879  if (!doTransaction(snd, rcv, 5000))
1880  {
1881  JLALERTG("Failed to req configuration");
1882  return false;
1883  }
1884 
1885  m_config.readFromMessage(rcv);
1887  snd.setMessageId(XMID_ReqFirmwareRevision);
1888  snd.setBusId(busId());
1889 
1890  if (doTransaction(snd, rcv) && rcv.getMessageId() == XMID_FirmwareRevision)
1892 
1894  }
1895  return true;
1896  }
1897  else
1898  {
1899  try
1900  {
1901  const XsMtDeviceConfiguration& devinf = deviceConfigurationConst().deviceInfo(deviceId());
1904 #ifndef XSENS_DEBUG
1905  // this is support debug info, we don't want to spam the debugger windows
1906  if (old != m_firmwareVersion)
1907  JLWRITEG("Device " << deviceId() << " has firmware version " << m_firmwareVersion.toString());
1908 #endif
1909  return true;
1910  }
1911  catch (XsDeviceConfigurationException&)
1912  {
1913  return false;
1914  }
1915  }
1916  return false;
1917 }
1918 
1925 {
1926  return m_config;
1927 }
1928 
1935 {
1936  return const_cast<XsDeviceConfiguration&>(deviceConfigurationConst());
1937 }
1946 {
1947  return deviceConfigurationConst();
1948 }
1949 
1954 {
1956  return false;
1957 
1959  snd.setBusId(busId());
1960 
1961  if (!doTransaction(snd, 2000))
1962  return false;
1963 
1964  return true;
1965 }
1966 
1972 {
1973  return reset(false);
1974 }
1975 
1982 bool XsDevice::reset(bool skipDeviceIdCheck)
1983 {
1984  if (!isMasterDevice())
1985  return false;
1986 
1987  Communicator* comm = communicator();
1988  if (!comm)
1989  return false;
1990 
1991  if (!gotoConfig())
1992  return false;
1993 
1994  XsMessage snd(XMID_Reset);
1995  snd.setBusId(XS_BID_MASTER);
1996 
1997  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(snd));
1998  std::shared_ptr<ReplyObject> wakeup = comm->addReplyObject(XMID_Wakeup);
1999  comm->writeMessage(snd);
2000 
2001  if (!reopenPort(false, skipDeviceIdCheck))
2002  return false;
2003 
2004  if (!gotoConfig())
2005  return false;
2006 
2007  return true;
2008 }
2017 bool XsDevice::reopenPort(bool gotoConfig, bool skipDeviceIdCheck)
2018 {
2020 
2021  Communicator* comm = communicator();
2022  if (!comm)
2023  return false;
2024 
2025  return comm->reopenPort(OPS_OpenPort, skipDeviceIdCheck);
2026 }
2027 
2031 {
2032 }
2033 
2039 {
2040  JLDEBUGG(filename);
2041  Communicator* comm = communicator();
2042  if (!comm || !comm->isPortOpen())
2043  {
2044  JLALERTG("No port open");
2045  return XRV_NOPORTOPEN;
2046  }
2047 
2048  std::unique_ptr<xsens::Lock> myLock(new xsens::Lock(&m_logFileMutex, true));
2049  if (logFileInterface(myLock))
2050  {
2051  JLERRORG("A file is already open");
2052  return XRV_ALREADYOPEN;
2053  }
2054 
2055  std::unique_ptr<MtbDataLogger> newfile(new MtbDataLogger);
2056  if (newfile->create(filename))
2057  {
2058  m_logFileInterface = newfile.release();
2059  JLDEBUGG("Creation ok");
2060  tm dateTime;
2061  getDateTime(&dateTime);
2062  getDateAsString((char*) m_config.masterInfo().m_date, &dateTime);
2063  getTimeAsString((char*) m_config.masterInfo().m_time, &dateTime);
2064 
2065  XsMessage msg;
2066  deviceConfiguration().writeToMessage(msg);
2069  return XRV_OK;
2070  }
2071  JLDEBUGG("Creation failed");
2072  newfile->close(true);
2074  newfile.reset();
2075  return XRV_OUTPUTCANNOTBEOPENED;
2076 }
2077 
2083 {
2084  return XRV_NOTIMPLEMENTED;
2085 }
2086 
2095 {
2096  (void)frame;
2097  (void)quat;
2098  return false;
2099 }
2100 
2107 {
2108  (void)frame;
2109  return XsQuaternion();
2110 }
2111 
2121 {
2122  (void)frame;
2123  (void)matrix;
2124  return false;
2125 }
2126 
2133 {
2134  (void)frame;
2135  return XsMatrix();
2136 }
2137 
2143 {
2144  return XRV_NOTIMPLEMENTED;
2145 }
2146 
2151 {
2152  xsens::Lock myLock(&m_logFileMutex, true);
2153  if (m_logFileInterface)
2154  {
2158  delete m_logFileInterface;
2159  m_logFileInterface = NULL;
2160  }
2161  return true;
2162 }
2163 
2172 {
2173  JLDEBUGG("");
2174  if (!isMasterDevice())
2175  return false;
2176 
2177  if (deviceState() != XDS_Measurement)
2178  return false;
2179 
2182 
2183  return true;
2184 }
2185 
2192 {
2193  return startRecording();
2194 }
2195 
2202 {
2203  JLDEBUGG("");
2204  if (!isMasterDevice())
2205  return false;
2206 
2207  if (deviceState() != XDS_Recording)
2208  return false;
2209 
2211  return true;
2212 }
2213 
2217 {
2218  if (packet.containsAwindaSnapshot())
2219  return packet.isAwindaSnapshotARetransmission();
2220 
2221  return false;
2222 }
2223 
2227 {
2228  LockGuarded lockG(&m_deviceMutex);
2229 
2230  if (m_dataCache.empty() || (m_startRecordingPacketId < 0))
2231  return;
2232 
2233  if (m_stopRecordingPacketId >= 0)
2234  {
2235  //The first packetId following the latestBufferedPacket (head of recording stream) is what is blocking possible cached data
2236  //If the recording stream is empty the beginning of the recording is unavailable (from start recording until the first packet in the cache)
2237  int64_t blockingPacketId = (latestBufferedPacketId() < 0) ? m_startRecordingPacketId : latestBufferedPacketId() + 1;
2238 
2239  while (blockingPacketId <= m_stopRecordingPacketId)
2240  {
2241  //Mark blocking packet as unavailable.
2242  handleUnavailableData(blockingPacketId);
2243  //If marking the blocking packet unavailable did not advance the head of the recording stream the next blocking packet follows the current one immediately
2244  blockingPacketId = (std::max)(blockingPacketId + 1, latestBufferedPacketId() + 1); // Note: (std::max) to prevent a macro for max() to be substituted
2245  }
2246  }
2247 
2248  checkDataCache();
2249  // clearDataCache();
2250 }
2251 
2254 {
2255  LockGuarded lockG(&m_deviceMutex);
2256  // process available data
2257  while (!m_dataCache.empty())
2258  {
2259  auto it = m_dataCache.begin();
2260  //JLWRITEG("pid: " << it->second->packetId() << " range? " << it->second->containsFrameRange() << " retransmission? " << it->second->isAwindaSnapshotARetransmission() << " snapshotA,F? " << it->second->containsAwindaSnapshot() << "," << it->second->containsFullSnapshot());
2261 
2262  int64_t expectedPacketId = latestBufferedPacketId() < 0 ? -1 : latestBufferedPacketId() + 1;
2263  if (expectedPacketId < m_startRecordingPacketId)
2264  {
2265  //If there is a frame range (i.e. we get an interval) the packetId is equal to the end of that interval
2266  //The startRecordingPacketId always is equal to the start value of an interval. Therefore if using the startRecordingPacketId to
2267  //calculate the expected packetId for an ideal interval (no missing data) is to +1 the startRecordingPacketId
2268  //For an ideal (expected) situation this would be 1 higher than the startRecordingPacketId
2269  expectedPacketId = it->second->containsFrameRange() ? m_startRecordingPacketId + 1 : getStartRecordingPacketId();
2271  }
2272  int64_t packetId = it->first;
2273 
2274  auto missingDataIsUnavailable = [this](int64_t rFirst, int64_t rLast)
2275  {
2277  return true;
2278  if ((m_stopRecordingPacketId >= 0 && rFirst > m_stopRecordingPacketId) ||
2279  (rLast - 1 <= m_unavailableDataBoundary))
2280  {
2281  // notify unavailable data in recording states
2282  // when not recording, unavailable data is expected and should not be reported
2283  if (isRecording())
2284  {
2285  //JLDEBUGG("Device " << m_deviceId << " data unavailable in range " << rFirst << " - " << rLast);
2286  if (m_stopRecordingPacketId != -1 && rLast > m_stopRecordingPacketId)
2287  rLast = m_stopRecordingPacketId;
2288  if (rFirst < rLast)
2289  {
2290  ONLYFIRSTMTX2
2291  JLDEBUGG("Device " << m_deviceId << " Data is unavailable in reported range " << rFirst << " - " << rLast << " Stop Recording Packet ID " << m_stopRecordingPacketId << " Unavailable Data Boundary " << m_unavailableDataBoundary);
2292  for (int64_t r = rFirst; r < rLast; ++r)
2293  onDataUnavailable(this, r);
2294  }
2295  else
2296  {
2297  //ONLYFIRSTMTX2
2298  //JLDEBUGG("Device " << m_deviceId << " NOT Reporting data unavailable");
2299  }
2300  }
2301 
2302  return true;
2303  }
2304  return false;
2305  };
2306 
2307  int64_t rFirst = expectedPacketId >= 0 ? expectedPacketId : packetId;
2308  int64_t rLast = packetId;
2309  if (it->second->containsFrameRange())
2310  {
2311  XsRange rng = it->second->frameRange();
2312  rFirst = rng.first() + 1;
2313  }
2314 
2315  if ((expectedPacketId >= 0) && (packetId > expectedPacketId))
2316  {
2317  if (!missingDataIsUnavailable(rFirst, rLast))
2318  {
2319  //JLDEBUGG("Device " << m_deviceId << " Waiting for retransmissions in range " << rFirst << " - " << rLast);
2320  break; // waiting for retransmissions
2321  }
2322  }
2323  // we need to 'else' here to avoid duplicate and erroneous missed packet handling
2324  else if (it->second->containsFrameRange())
2325  {
2326  if (rLast > rFirst)
2327  {
2328  if (!missingDataIsUnavailable(rFirst, rLast))
2329  break; // waiting for retransmissions
2330  }
2331  }
2332 
2333  // do 'buffered' processing
2334  processBufferedPacket(*it->second);
2335 
2336  // store result
2337  latestBufferedPacket().swap(*it->second);
2338  // ONLYFIRSTMTX2
2339  // JLDEBUGG("latestBufferedPacket is now " << latestBufferedPacket().packetId() << " old: " << it->second->packetId());
2340  delete it->second;
2341  m_dataCache.erase(it);
2342 
2343  if (latestBufferedPacketConst().empty())
2344  continue;
2345 
2348 
2349  // do callbacks
2350  const XsDataPacket& buf = latestBufferedPacketConst();
2351  //if (isRecording())
2352  // JLDEBUGG("Device " << m_deviceId << " triggering onBufferedDataAvailable " << buf.packetId());
2353  onBufferedDataAvailable(this, &buf);
2354  bool doRecCallback = shouldDoRecordedCallback(buf);
2355  if (isReadingFromFile())
2356  onDataAvailable(this, &buf);
2357  if (doRecCallback)
2358  onRecordedDataAvailable(this, &buf);
2359 
2360  if (isStandaloneDevice())
2361  {
2362  XsDevicePtrArray devs;
2363  const XsDataPacket* ppack = &latestBufferedPacketConst();
2364  devs.push_back(this);
2365  XsDataPacketPtrArray packs;
2366  packs.push_back((XsDataPacket*)ppack);
2367  onAllBufferedDataAvailable(&devs, &packs);
2368  if (isReadingFromFile())
2369  onAllDataAvailable(&devs, &packs);
2370  if (doRecCallback)
2371  onAllRecordedDataAvailable(&devs, &packs);
2372  }
2373  }
2374 }
2375 
2377 void XsDevice::writeMessageToLogFile(const XsMessage& message)
2378 {
2380  return;
2381 
2382  if (!onWriteMessageToLogFile(this, &message))
2383  return;
2384 
2385  std::unique_ptr<xsens::Lock> myLock;
2386  DataLogger* logInt = logFileInterface(myLock);
2387  if (!logInt)
2388  return;
2389 
2390  logInt->writeMessage(message);
2391 }
2392 
2395 {
2396 }
2403 std::vector<int> XsDevice::supportedUpdateRates(XsDataIdentifier dataType) const
2404 {
2405  (void)dataType;
2406  return std::vector<int>();
2407 }
2408 
2414 {
2415  return false;
2416 }
2423 {
2424  (void)enabled;
2425  return false;
2426 }
2427 
2433 {
2434  return false;
2435 }
2445 {
2446  (void)enabled;
2447  return false;
2448 }
2455 {
2456  return false;
2457 }
2464 {
2465  return XEM_Invalid;
2466 }
2474 {
2475  (void)errormode;
2476  return false;
2477 }
2478 
2479 // MT Device functions
2480 
2486 bool XsDevice::setHeadingOffset(double offset)
2487 {
2488  (void)offset;
2489  return false;
2490 }
2491 
2496 {
2497  return 0;
2498 }
2499 
2507 {
2508  (void)id;
2509  return false;
2510 }
2511 
2518 {
2519  return 0;
2520 }
2521 
2528 {
2529  if (locationId() == locId)
2530  return this;
2531 
2532  return nullptr;
2533 }
2534 
2542 {
2543  return XsMatrix();
2544 }
2545 
2555 {
2556  (void)matrix;
2557  return false;
2558 }
2559 
2567 {
2568  return 0;
2569 }
2570 
2580 {
2581  (void)mag;
2582  return false;
2583 }
2584 
2595 {
2596  return false;
2597 }
2598 
2604 {
2605  return XsFilterProfile();
2606 }
2607 
2619 bool XsDevice::setXdaFilterProfile(int profileType)
2620 {
2621  (void)profileType;
2622  return false;
2623 }
2624 
2636 bool XsDevice::setXdaFilterProfile(XsString const& profileType)
2637 {
2638  (void)profileType;
2639  return false;
2640 }
2641 
2647 {
2648  return XsFilterProfile();
2649 }
2650 
2660 {
2661  (void)profileType;
2662  return false;
2663 }
2664 
2674 {
2675  (void)profileType;
2676  return false;
2677 }
2678 
2685 bool XsDevice::replaceFilterProfile(XsFilterProfile const& profileCurrent, XsFilterProfile const& profileNew)
2686 {
2687  (void)profileCurrent;
2688  (void)profileNew;
2689  return false;
2690 }
2691 
2697 {
2698  return XsFilterProfileArray();
2699 }
2700 
2706 {
2707  return XsFilterProfileArray();
2708 }
2709 
2717 {
2718  return 0;
2719 }
2720 
2728 {
2729  return 0;
2730 }
2731 
2743 bool XsDevice::setNoRotation(uint16_t duration)
2744 {
2745  (void)duration;
2746  return false;
2747 }
2748 
2754 {
2755  return false;
2756 }
2757 
2763 {
2764  return false;
2765 }
2766 
2773 {
2774  return XsIccRepMotionResult();
2775 }
2776 
2781 {
2782  return false;
2783 }
2784 
2794 {
2795  return XsVector();
2796 }
2797 
2810 {
2811  (void)lla;
2812  return false;
2813 }
2814 
2820 {
2821  return XsTimeInfo();
2822 }
2823 
2832 {
2833  (void)time;
2834  return false;
2835 }
2836 
2842 {
2843  return 0;
2844 }
2845 
2852 {
2853  (void)delay;
2854  return false;
2855 }
2856 
2865 {
2866  return XsSelfTestResult();
2867 }
2868 
2876 {
2877  return false;
2878 }
2879 
2889 {
2890  return false;
2891 }
2892 
2893 // MTix device
2901 {
2902  return false;
2903 }
2904 
2913 {
2914  (void)enable;
2915  return false;
2916 }
2917 
2924 {
2925  return false;
2926 }
2927 
2935 {
2936  (void)enable;
2937  return false;
2938 }
2939 
2947 {
2948  (void)arm;
2949  return false;
2950 }
2951 
2954 {
2955  return XsVector();
2956 }
2957 
2961 {
2962  return false;
2963 }
2966 // Mtw device
2974 {
2975  return false;
2976 }
2977 
2982 {
2983  return 0;
2984 }
2985 
2995 bool XsDevice::setTransportMode(bool transportModeEnabled)
2996 {
2997  (void)transportModeEnabled;
2998  return false;
2999 }
3000 
3006 {
3007  return false;
3008 }
3009 
3015 {
3016  return stringOutputType() != 0;
3017 }
3018 
3023 {
3024  return isInStringOutputMode();
3025 }
3026 
3032 {
3033  xsens::Lock myLock(&m_logFileMutex, true);
3034  m_logFileInterface = logger;
3035 }
3046 {
3047  Communicator* comm = communicator();
3048  if (!comm)
3049  return false;
3050 
3051  if (!comm->isReadingFromFile())
3052  return false;
3053 
3054  comm->loadLogFile(this);
3055  return true;
3056 }
3057 
3063 {
3064  Communicator* comm = communicator();
3065  if (comm && comm->isReadingFromFile())
3066  {
3067  comm->abortLoadLogFile();
3068  comm->waitForLastTaskCompletion();
3069  return true;
3070  }
3071  return false;
3072 }
3073 
3079 {
3080  if (!isReadingFromFile())
3081  {
3082  std::unique_ptr<xsens::Lock> myLock;
3083  if (logFileInterface(myLock))
3084  {
3085  MtbDataLogger const* mtb = dynamic_cast<MtbDataLogger const*>(logFileInterface(myLock));
3086  if (mtb != nullptr)
3087  return mtb->filename();
3088  }
3089  return XsString();
3090  }
3091 
3092  Communicator* object = communicator();
3093  if (!object)
3094  return XsString();
3095  return object->logFileName();
3096 }
3097 
3103 {
3104  // Get the supported update rates
3105  std::vector<int> frameRates = supportedUpdateRates();
3106 
3107  // Determine the maximum value
3108  std::vector<int>::iterator p = std::max_element(frameRates.begin(), frameRates.end());
3109  if (p != frameRates.end())
3110  return *p;
3111  else
3112  return 0;
3113 }
3114 
3119 {
3120  LockGuarded lockG(&m_deviceMutex);
3121 
3122  if (m_dataCache.empty())
3123  return 0;
3124 
3125  return (int)(m_dataCache.rbegin()->first - latestBufferedPacketId());
3126 }
3127 
3132 {
3133  LockGuarded lockG(&m_deviceMutex);
3134  return (int) m_dataCache.size();
3135 }
3136 
3137 
3145 {
3146  return XsSyncSettingArray();
3147 }
3148 
3159 {
3160  (void)settingList;
3161  return false;
3162 }
3163 
3176 {
3178 }
3179 
3188 {
3189  return scheduleOrientationReset(resetmethod);
3190 }
3191 
3199 {
3200  JLDEBUGG("");
3201 
3202  Communicator* comm = communicator();
3203  if (!comm || !comm->isReadingFromFile())
3204  return false;
3205 
3206  comm->resetLogFileReadPosition();
3207 
3208  clearDataCache();
3210  return true;
3211 }
3212 
3220 {
3221  JLDEBUGG("");
3222 
3223  Communicator* comm = communicator();
3224  if (!comm || !comm->isReadingFromFile())
3225  return 0;
3226 
3227  return comm->logFileSize();
3228 }
3229 
3237 {
3238  JLDEBUGG("");
3239 
3240  Communicator* comm = communicator();
3241  if (!comm || !comm->isReadingFromFile())
3242  return -1;
3243 
3244  return comm->logFileReadPosition();
3245 }
3246 
3255 {
3256  JLDEBUGG("");
3257 
3258  if (isMeasuring())
3259  return false;
3260 
3261  return initialize();
3262 }
3263 
3268 bool XsDevice::initialize()
3269 {
3270  m_isInitialized = true;
3271  return true;
3272 }
3281 {
3282  Communicator* comm = communicator();
3283  if (!comm)
3284  return false;
3285 
3286  switch (protocol)
3287  {
3288  case XPT_Xbus:
3289  comm->addProtocolHandler(new ProtocolHandler());
3290  return true;
3291  case XPT_Nmea:
3293  return true;
3294  default:
3295  return false; // unknown type
3296  }
3297 }
3298 
3305 {
3306  Communicator* comm = communicator();
3307  if (!comm)
3308  return false;
3309 
3310  switch (protocol)
3311  {
3312  case XPT_Xbus:
3314  return true;
3315  case XPT_Nmea:
3317  return true;
3318  default:
3319  return false; // unknown type
3320  }
3321 }
3322 
3327 {
3328  Communicator* comm = communicator();
3329  if (!comm)
3330  return false;
3331  return comm->hasProtocol(protocol);
3332 }
3333 
3338 {
3339  return 0xFFFF;
3340 }
3341 
3346 {
3347  return 0xFFFF;
3348 }
3349 
3355 {
3356  return 0x0000;
3357 }
3358 
3363 {
3364  return XOP_LiveStream;
3365 }
3366 
3372 {
3373  (void)mode;
3374  return true;
3375 }
3376 
3381 {
3382  return XsOutputConfigurationArray();
3383 }
3384 
3389 {
3391 }
3392 
3397 {
3398  return 0;
3399 }
3400 
3412 {
3413  if (communicator() && !communicator()->allowReprocessing())
3414  {
3415  enable = enable & ~(XSO_Calibrate | XSO_Orientation);
3416  disable = disable | (XSO_Calibrate | XSO_Orientation);
3417  }
3418 
3419  XsOption upd = XsOption_purify((XsOption)((m_options & ~disable) | enable));
3421 
3422  // this has to be done in this order to prevent timing issues
3423  bool clr = ((m_options & mask) != (upd & mask));
3424  m_options = upd;
3425  if (clr)
3427 }
3428 
3435 {
3436  return (m_options & options) == options;
3437 }
3438 
3444 {
3445  return m_options;
3446 }
3447 
3452 {
3453  return XsString();
3454 }
3455 
3460 {
3461  return productCode();
3462 }
3463 
3468 {
3469  return XsVersion();
3470 }
3471 
3478 bool XsDevice::enableRadio(int channel)
3479 {
3480  (void)channel;
3481  return false;
3482 }
3483 
3489 {
3490  return false;
3491 }
3492 
3498 {
3499  return false;
3500 }
3501 
3507 {
3508  return -1;
3509 }
3510 
3511 #if 0
3512 
3517 int XsDevice::radioQualityIndication() const
3518 {
3519  return -1;
3520 }
3521 #endif
3522 
3527 void XsDevice::handleMasterIndication(const XsMessage& message)
3528 {
3529  onNonDataMessage(this, &message);
3530 }
3538 {
3539  return true;
3540 }
3541 
3549 {
3550  return false;
3551 }
3552 
3563 {
3564  return false;
3565 }
3566 
3572 {
3573  return 0;
3574 }
3575 
3582 {
3583  (void)priority;
3584  return false;
3585 }
3586 
3592 {
3593  if (newState != m_connectivity)
3594  {
3595  JLDEBUGG(deviceId() << " newState " << newState << " oldState " << m_connectivity);
3596  m_connectivity = newState;
3597  onConnectivityChanged(this, newState);
3598  }
3599 }
3600 
3604 {
3605  return m_connectivity;
3606 }
3615 {
3616  return XRR_Unknown;
3617 }
3618 
3625 {
3626  return XS_RSSI_UNKNOWN;
3627 }
3628 
3633 void XsDevice::setPacketErrorRate(int per)
3634 {
3635  (void)per;
3636 }
3654 {
3655  return 0;
3656 }
3657 
3664 {
3665  return m_connectivity;
3666 }
3667 
3674 {
3675  (void)dev;
3676  return false;
3677 }
3678 
3684 {
3685  Communicator* comm = communicator();
3686  if (!comm)
3687  return XsString();
3688 
3689  return comm->portInfo().portName();
3690 }
3691 
3697 {
3698  Communicator* comm = communicator();
3699  if (!comm)
3700  return XsPortInfo();
3701 
3702  return comm->portInfo();
3703 }
3704 
3705 #ifndef XSENS_NO_PORT_NUMBERS
3706 
3709 int XsDevice::portNumber() const
3710 {
3711  Communicator* comm = communicator();
3712  if (!comm)
3713  return 0;
3714  return comm->portInfo().portNumber();
3715 }
3716 #endif
3717 
3722 {
3723  return m_isInitialized;
3724 }
3725 
3731 {
3732  return false;
3733 }
3734 
3740 {
3741  return false;
3742 }
3743 
3752 {
3753  return false;
3754 }
3755 
3761 {
3762  return XACM_None;
3763 }
3764 
3770 {
3771  return XsDeviceIdArray();
3772 }
3773 
3779 {
3780  return false;
3781 }
3782 
3787 {
3788  return false;
3789 }
3790 
3793 {
3794  return false;
3795 }
3796 
3802 {
3803  return false;
3804 }
3805 
3811 {
3812  JLTRACEG(this << " pre: " << m_refCounter.load());
3813  ++m_refCounter;
3814 }
3815 
3820 {
3821  return (XsSize)(ptrdiff_t) m_refCounter.load();
3822 }
3823 
3832 {
3833  JLTRACEG(this << " pre: " << m_refCounter.load());
3834 
3835  // Do not decrease when already at 0 ref count
3836  // In this case, the device is just waiting for all children to be dereferenced
3837  if (m_refCounter.load() != 0)
3838  {
3839  --m_refCounter;
3840  assert(m_refCounter.load() >= 0);
3841  }
3842 
3843  // Always check if this device can be removed
3844  removeIfNoRefs();
3845 }
3846 
3854 bool XsDevice::writeEmtsPage(uint8_t const* data, int pageNr, int bankNr)
3855 {
3856  (void)data;
3857  (void)pageNr;
3858  (void)bankNr;
3859  return false;
3860 }
3861 
3865 {
3866  // If any child has refs, no need to delete this device
3868  if (childCount())
3869  return;
3870  //for (XsDevice* dev:m_children)
3871  // if (dev->refCounter() > 0)
3872  // return;
3873 
3874  if (m_refCounter.load() == 0)
3875  {
3876  lock.unlock();
3878  delete this;
3879  }
3880 }
3881 
3883 bool XsDevice::messageLooksSane(const XsMessage& msg) const
3884 {
3885  return msg.getBusId() == XS_BID_MASTER;
3886 }
3887 
3888 void XsDevice::onMessageSent(const XsMessage& msg)
3889 {
3890  onMessageSentToDevice(this, &msg);
3891 }
3892 
3893 void XsDevice::onMessageReceived(const XsMessage& msg)
3894 {
3895  onMessageReceivedFromDevice(this, &msg);
3896 }
3897 
3898 void XsDevice::onMessageDetected2(XsProtocolType type, const XsByteArray& rawMessage)
3899 {
3900  CallbackManagerXda::onMessageDetected(this, type, &rawMessage);
3901 }
3902 
3904 {
3905 }
3906 
3908 {
3910 }
3911 
3913 {
3914  LockGuarded locky(&m_deviceMutex);
3917 }
3918 
3920 {
3922 }
3923 
3925 int64_t XsDevice::latestLivePacketId() const
3926 {
3927  LockGuarded locky(&m_deviceMutex);
3928  return latestLivePacketConst().packetId();
3929 }
3930 
3932 int64_t XsDevice::latestBufferedPacketId() const
3933 {
3934  LockGuarded locky(&m_deviceMutex);
3935  return latestBufferedPacketConst().packetId();
3936 }
3937 
3943 bool XsDevice::shouldWriteMessageToLogFile(const XsMessage& msg) const
3944 {
3945  return shouldWriteMessageToLogFile(this, msg);
3946 }
3947 
3954 bool XsDevice::shouldWriteMessageToLogFile(const XsDevice* dev, const XsMessage& message) const
3955 {
3956  (void)dev;
3957  (void)message;
3958  return true;
3959 }
3960 
3966 bool XsDevice::doTransaction(const XsMessage& snd) const
3967 {
3968  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(snd));
3969  bool rv = communicator() && communicator()->doTransaction(snd);
3970  TRANSACTIONLOG(m_deviceId << " RCV rv: " << rv);
3971  return rv;
3972 }
3973 
3980 bool XsDevice::doTransaction(const XsMessage& snd, uint32_t timeout) const
3981 {
3982  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(snd) << " timeout: " << timeout);
3983  bool rv = communicator() && communicator()->doTransaction(snd, timeout);
3984  TRANSACTIONLOG(m_deviceId << " RCV rv: " << rv);
3985  return rv;
3986 }
3987 
3994 bool XsDevice::doTransaction(const XsMessage& snd, XsMessage& rcv) const
3995 {
3996  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(snd));
3997  bool rv = communicator() && communicator()->doTransaction(snd, rcv);
3998  TRANSACTIONLOG(m_deviceId << " RCV: " << msgToString(rcv));
3999  return rv;
4000 }
4001 
4009 bool XsDevice::doTransaction(const XsMessage& snd, XsMessage& rcv, uint32_t timeout) const
4010 {
4011  TRANSACTIONLOG(m_deviceId << " SND: " << msgToString(snd) << " timeout: " << timeout);
4012  bool rv = communicator() && communicator()->doTransaction(snd, rcv, timeout);
4013  TRANSACTIONLOG(m_deviceId << " RCV: " << msgToString(rcv));
4014  return rv;
4015 }
4026 {
4027  return false;
4028 }
4029 
4035 {
4036  return false;
4037 }
4038 
4044 {
4046  XsSyncSettingArray result;
4047  for (XsSyncSetting const& setting : settings)
4048  result.push_back(setting);
4049 
4050  return result;
4051 }
4052 
4058 {
4060 }
4061 
4068 bool XsDevice::isCompatibleSyncSetting(XsDeviceId const& deviceId, XsSyncSetting const& setting1, XsSyncSetting const& setting2)
4069 {
4070  return Synchronization::isCompatibleSyncSetting(deviceId, setting1, setting2);
4071 }
4072 
4078 {
4080 }
4081 
4086 {
4087  return 0;
4088 }
4089 
4093 std::vector<XsDevice*> XsDevice::children() const
4094 {
4095  return std::vector<XsDevice*>();
4096 }
4097 
4103 {
4104  if (m_communicator)
4106  m_communicator = comm;
4107 }
4108 
4111 void XsDevice::setRecordingStartFrame(uint16_t startFrame)
4112 {
4113  LockGuarded lock(&m_deviceMutex);
4116  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
4117 }
4118 
4121 void XsDevice::setRecordingStopFrame(uint16_t stopFrame)
4122 {
4123  LockGuarded lock(&m_deviceMutex);
4124  JLDEBUGG(this << " " << deviceId() << " Setting recording stop frame to " << stopFrame << " last known frame is " << latestBufferedPacketId() << " (" << (latestBufferedPacketId() & 0xffff) << ")");
4127  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
4128 }
4129 
4133 {
4134  LockGuarded lock(&m_deviceMutex);
4135  for (auto item : m_linearPacketCache)
4136  delete item;
4137  m_linearPacketCache.clear();
4139 }
4140 
4144 {
4145  LockGuarded lockG(&m_deviceMutex);
4146  for (auto item : m_dataCache)
4147  {
4148  if (item.first < m_startRecordingPacketId)
4149  {
4150  delete item.second;
4151  m_dataCache.erase(item.first);
4152  }
4153  }
4154 }
4155 
4159 {
4160  LockGuarded lockG(&m_deviceMutex);
4161  m_lastAvailableLiveDataCache->merge(pack, true);
4162 }
4163 
4167 void XsDevice::retainPacket(XsDataPacket const& pack)
4168 {
4169  LockGuarded lockG(&m_deviceMutex);
4170  if (!m_linearPacketCache.empty() && m_linearPacketCache.back()->packetId() == pack.packetId())
4171  m_linearPacketCache.back()->merge(pack, true);
4172  else
4173  m_linearPacketCache.push_back(new XsDataPacket(pack));
4174 }
4175 
4180 bool XsDevice::resetRemovesPort() const
4181 {
4182  return true;
4183 }
4194 {
4195  LockGuarded lockG(&m_deviceMutex);
4196  if (index < m_linearPacketCache.size())
4197  return *m_linearPacketCache.at(index);
4198  return XsDataPacket();
4199 }
4200 
4207 {
4208  LockGuarded lockG(&m_deviceMutex);
4209  return m_linearPacketCache.size();
4210 }
4211 
4219 {
4220  LockGuarded lockG(&m_deviceMutex);
4222 }
4223 
4231 {
4232  LockGuarded lockG(&m_deviceMutex);
4233  if (m_linearPacketCache.empty())
4234  return XsDataPacket();
4235 
4236  std::unique_ptr<XsDataPacket> rv(m_linearPacketCache.at(0));
4237  m_linearPacketCache.pop_front();
4238  return *rv; // copy and delete, hopefully optimizing the copy into a move operation
4239 }
4240 
4245 void XsDevice::setStartRecordingPacketId(int64_t startFrame)
4246 {
4247  LockGuarded lockG(&m_deviceMutex);
4248  m_startRecordingPacketId = startFrame;
4249  ONLYFIRSTMTX2
4250  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
4251 }
4252 
4256 void XsDevice::setStopRecordingPacketId(int64_t stopFrame)
4257 {
4258  LockGuarded lockG(&m_deviceMutex);
4259  m_stopRecordingPacketId = stopFrame;
4261  ONLYFIRSTMTX2
4262  JLDEBUGG(this << " " << deviceId() << " m_startRecordingPacketId = " << m_startRecordingPacketId << " m_stopRecordingPacketId = " << m_stopRecordingPacketId << " m_stoppedRecordingPacketId = " << m_stoppedRecordingPacketId);
4263 }
4264 
4268 void XsDevice::setSkipEmtsReadOnInit(bool skip)
4269 {
4270  m_skipEmtsReadOnInit = skip;
4271 }
4272 
4279 {
4280  if (!gotoConfig())
4281  return false;
4282 
4283  XsMessage snd(XMID_ReqEmts, 2);
4284  snd.setBusId(busId());
4285  snd.setDataByte(0, 0);
4286  snd.setDataByte(255, 1);
4287 
4288  XsMessage rcv;
4289  if (!doTransaction(snd, rcv, 10000))
4290  return false;
4291 
4292  m_emtsBlob = rcv;
4293 
4294  snd.setMessageId(XMID_ReqConfiguration);
4295  snd.setBusId(busId());
4296 
4297  rcv.clear();
4298  if (!doTransaction(snd, rcv, 5000))
4299  return false;
4300 
4301  m_config.readFromMessage(rcv);
4302 
4303  return true;
4304 }
4305 
4309 int64_t XsDevice::deviceRecordingBufferItemCount(int64_t& lastCompletePacketId) const
4310 {
4311  lastCompletePacketId = latestLivePacketId();
4312  return 0;
4313 }
4320 {
4321  return 0;
4322 }
4323 
4329 {
4330  (void)frames;
4331  return true;
4332 }
4333 
4340 {
4341  while (!isInitialized())
4342  XsTime::msleep(0);
4343 }
4344 
4350 {
4351  Communicator const* comm = communicator();
4352  if (!comm)
4353  return false;
4354 
4355  if (!comm->isReadingFromFile())
4356  return false;
4357 
4358  return comm->isLoadLogFileInProgress();
4359 }
4360 
4365 {
4367  XsTime::msleep(10);
4368 }
4369 
4375 {
4376  return m_startRecordingPacketId;
4377 }
4378 
4384 {
4386 }
4387 
4457 {
4458  (void)parameter;
4459  return XRV_UNSUPPORTED;
4460 }
4461 
4469 {
4470  (void)parameter;
4471  return XRV_UNSUPPORTED;
4472 }
4473 
4481 {
4482  return static_cast<XsGnssPlatform>(ubloxGnssPlatform());
4483 }
4484 
4491 bool XsDevice::setGnssPlatform(XsGnssPlatform gnssPlatform)
4492 {
4494 }
4502 {
4503  return XGP_Portable;
4504 }
4505 
4512 {
4513  (void) ubloxGnssPlatform;
4514  return false;
4515 }
4516 
4521 {
4522  return XsIntArray();
4523 }
4524 
4529 bool XsDevice::setGnssReceiverSettings(const XsIntArray& gnssReceiverSettings)
4530 {
4531  (void)gnssReceiverSettings;
4532  return false;
4533 }
4534 
4538 {
4539  // intentionally empty, private implementation
4540 }
4541 
4548 bool XsDevice::expectingRetransmissionForPacket(int64_t packetId) const
4549 {
4550  if (isMasterDevice())
4551  return false;
4552 
4553  // child devices use their parent's decision
4554  return master()->expectingRetransmissionForPacket(packetId);
4555 }
4556 
4558 {
4559  // intentionally empty, private implementation
4560  return false;
4561 }
4562 
4564 {
4565  // intentionally empty, private implementation
4566 }
4567 
4570 XsDevice const* XsDevice::firstChild() const
4571 {
4572  return this;
4573 }
4574 
4582 bool XsDevice::interpolateMissingData(XsDataPacket const& pack, XsDataPacket const& prev, std::function<void (XsDataPacket*)> packetHandler)
4583 {
4584  (void) pack;
4585  (void) prev;
4586  (void) packetHandler;
4587  return false;
4588 }
4598 void XsDevice::discardRetransmissions(int64_t firstNewPacketId)
4599 {
4600  (void) firstNewPacketId;
4601 }
4602 
4611 {
4612  // The basic device supports nothing
4613  return (uint32_t) 0;
4614 }
4615 
4621 {
4622  (void) newInfo;
4623  return XRV_NOTIMPLEMENTED;
4624 }
4625 
4632 XsDevice* XsDevice::subDevice(int subDeviceId) const
4633 {
4634  if (subDeviceId)
4635  return nullptr;
4636  return const_cast<XsDevice*>(this);
4637 }
4638 
4645 {
4646  return 0;
4647 }
4648 
4653 {
4654  return XsByteArray();
4655 }
XsDevice::setPortConfiguration
virtual bool setPortConfiguration(XsIntArray &config)
Change the port configuration of a device.
Definition: xsdevice_def.cpp:930
XDOF_None
@ XDOF_None
When set to 1, disables all option flags.
Definition: xsdeviceoptionflag.h:92
XS_BID_MASTER
#define XS_BID_MASTER
The bus identifier of the master device.
Definition: xsbusid.h:73
XsDevice::findConfiguration
XsOutputConfiguration findConfiguration(XsDataIdentifier dataType) const
XsDevice::powerDown
virtual bool powerDown()
Tell the device to power down completely.
Definition: xsdevice_def.cpp:2454
XsDevice::getStartRecordingPacketId
int64_t getStartRecordingPacketId() const
Return the ID of the first packet that should be recorded.
Definition: xsdevice_def.cpp:4374
XsDevice::supportedUpdateRates
virtual std::vector< int > supportedUpdateRates(XsDataIdentifier dataType=XDI_None) const
Ask the device for its supported update rates for the given dataType.
Definition: xsdevice_def.cpp:2403
XRV_NOPORTOPEN
@ XRV_NOPORTOPEN
288: No serial port opened for reading/writing
Definition: xsresultvalue.h:159
CallbackManagerXda::addChainedManager
void addChainedManager(CallbackManagerXda *cm)
Add a chained manager to the list.
Definition: callbackmanagerxda.cpp:262
XsDevice::logFileInterface
virtual DataLogger XSNOEXPORT * logFileInterface(std::unique_ptr< xsens::Lock > &myLock) const
XDOF_DisableAutoMeasurement
@ XDOF_DisableAutoMeasurement
When set to 1, the MT will stay in Config Mode upon start up.
Definition: xsdeviceoptionflag.h:78
XsDevice::expectingRetransmissionForPacket
virtual bool expectingRetransmissionForPacket(int64_t packetId) const
XsString
struct XsString XsString
Definition: xsstring.h:87
Communicator::removeProtocolHandler
void removeProtocolHandler(XsProtocolType type)
Removes a protocol handler.
Definition: communicator.cpp:317
XsDevice::isInitialized
bool isInitialized() const
Returns true when the device is initialized.
Definition: xsdevice_def.cpp:3721
XsDevice::setCanOutputConfiguration
virtual bool setCanOutputConfiguration(XsCanOutputConfigurationArray &config)
Set the CAN output configuration for this device.
Definition: xsdevice_def.cpp:1188
XsDevice::handleUnavailableData
virtual XSNOEXPORT void handleUnavailableData(int64_t frameNumber)
Communicator::hasProtocol
bool hasProtocol(XsProtocolType type) const
Definition: communicator.cpp:327
XsFilterProfile
struct XsFilterProfile XsFilterProfile
Definition: xsfilterprofile.h:300
xsstring.h
XsSyncSettingArray
struct XsSyncSettingArray XsSyncSettingArray
Definition: xssyncsettingarray.h:82
XsOutputConfiguration::m_frequency
uint16_t m_frequency
The frequency.
Definition: xsoutputconfiguration.h:99
XsDevice::lastAvailableLiveData
XsDataPacket lastAvailableLiveData() const
Return the last available live data.
Definition: xsdevice_def.cpp:4218
XMID_ReqEmts
@ XMID_ReqEmts
Definition: xsxbusmessageid.h:358
XsMtDeviceConfiguration::m_fwRevRevision
uint8_t m_fwRevRevision
The revision version of the firmware.
Definition: xsdeviceconfiguration.h:109
TRANSACTIONLOG
#define TRANSACTIONLOG(...)
Definition: xsdevice_def.cpp:157
XsDevice::utcTime
virtual XsTimeInfo utcTime() const
Gets the 'UTC Time' setting of the device.
Definition: xsdevice_def.cpp:2819
XsOutputConfiguration
struct XsOutputConfiguration XsOutputConfiguration
Definition: xsoutputconfiguration.h:118
XsTimeInfo
struct XsTimeInfo XsTimeInfo
Definition: xstimeinfo.h:148
XsDataPacketPtrArray
A list of XsDataPacketPtr values.
XsMatrix
A class that represents a matrix of real numbers.
Definition: xsmatrix.h:107
XsDevice::gnssLeverArm
virtual XsVector gnssLeverArm() const
Definition: xsdevice_def.cpp:2953
XsDataPacket
struct XsDataPacket XsDataPacket
Definition: xsdatapacket.h:107
XsDevice::findDeviceConst
XsDevice const * findDeviceConst(XsDeviceId const &deviceid) const
Find the child device with deviceid.
Definition: xsdevice_def.cpp:512
XsDevice::setRs485TransmissionDelay
virtual bool setRs485TransmissionDelay(uint16_t delay)
Set the transmission delay used for RS485 transmissions.
Definition: xsdevice_def.cpp:2851
XsDevice::runSelfTest
virtual XsSelfTestResult runSelfTest()
Run the self test for the device.
Definition: xsdevice_def.cpp:2864
XsDevice::enableProtocol
virtual bool enableProtocol(XsProtocolType protocol)
Enable an additional communication protocol when reading messages.
Definition: xsdevice_def.cpp:3280
XsDevice::deviceId
XsDeviceId const & deviceId() const
Return the device ID of the device.
Definition: xsdevice_def.cpp:742
CallbackManagerXda::onAllRecordedDataAvailable
void onAllRecordedDataAvailable(XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
The XsCallback::onAllRecordedDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:612
xsens::LS_Write
@ LS_Write
Definition: xsens_mutex.h:127
XsDevice::isStandaloneDevice
bool isStandaloneDevice() const
Returns true if this is a standalone device (not a child of another device and not a container device...
Definition: xsdevice_def.cpp:1102
XSO_Calibrate
@ XSO_Calibrate
Compute calibrated inertial data from raw data and temperature.
Definition: xsoption.h:79
MessageDeserializer
A class that does the message deserialization.
Definition: messageserializer.h:149
CallbackManagerXda::removeChainedManager
void removeChainedManager(CallbackManagerXda *cm)
Remove achained manager from the list.
Definition: callbackmanagerxda.cpp:298
XsVector
A class that represents a vector of real numbers.
Definition: xsvector.h:113
XsDevice::useLogInterface
void useLogInterface(DataLogger *logger)
Uses log interface for a given data logger.
XsFilterProfileArray
struct XsFilterProfileArray XsFilterProfileArray
Definition: xsfilterprofilearray.h:84
XsDevice::abortLoadLogFile
virtual bool abortLoadLogFile()
Aborts loading a logfile.
Definition: xsdevice_def.cpp:3062
XsDevice::handleMessage
virtual XSNOEXPORT void handleMessage(const XsMessage &msg)
XsDevice::startRepresentativeMotion
virtual bool startRepresentativeMotion()
Let the user indicate that he is starting the representative motion for the In-Run Compass Calibratio...
Definition: xsdevice_def.cpp:2753
XsDevice::setErrorMode
virtual bool setErrorMode(XsErrorMode errormode)
Sets the error mode of the device.
Definition: xsdevice_def.cpp:2473
Communicator::gotoMeasurement
virtual XsResultValue gotoMeasurement()=0
Request a device to go to measurement mode.
XsDevice::storeFilterState
virtual bool storeFilterState()
Store orientation filter state in the device.
Definition: xsdevice_def.cpp:2888
msg
msg
XDS_FlushingData
@ XDS_FlushingData
Definition: xsdevicestate.h:84
CallbackManagerXda::onWriteMessageToLogFile
int onWriteMessageToLogFile(XsDevice *dev, const XsMessage *message) override
The XsCallback::onWriteMessageToLogFile() callback forwarding function.
Definition: callbackmanagerxda.cpp:441
XsDevice::onMessageDetected2
virtual XSNOEXPORT void onMessageDetected2(XsProtocolType type, const XsByteArray &rawMessage)
XsDevice::availableXdaFilterProfiles
virtual XsFilterProfileArray availableXdaFilterProfiles() const
Return the list of filter profiles available on the host PC.
Definition: xsdevice_def.cpp:2705
XsDevice::ubloxGnssPlatform
virtual XsUbloxGnssPlatform ubloxGnssPlatform() const
Returns the device GNSS platform for u-blox GNSS receivers.
Definition: xsdevice_def.cpp:4501
XsOutputConfiguration::m_dataIdentifier
XsDataIdentifier m_dataIdentifier
The data identifier.
Definition: xsoutputconfiguration.h:98
XsDevice::supportsSyncSettings
static bool supportsSyncSettings(XsDeviceId const &deviceId)
Determines whether the device specified by deviceId supports sync settings.
Definition: xsdevice_def.cpp:4057
XsDevice::m_dataCache
DataPacketCache m_dataCache
A data cache.
Definition: xsdevice_def.h:691
XsDevice::isReadingFromFile
virtual bool isReadingFromFile() const
Returns true if the device is reading from a file.
Definition: xsdevice_def.cpp:1783
XSO_Orientation
@ XSO_Orientation
Compute orientation, the orientation is typically only computed in one stream. If not specified the s...
Definition: xsoption.h:80
CallbackManagerXda::onBufferedDataAvailable
void onBufferedDataAvailable(XsDevice *dev, const XsDataPacket *data) override
The XsCallback::onBufferedDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:456
XsByteArray
A list of uint8_t values.
XsDevice::stringOutputType
virtual uint16_t stringOutputType() const
Returns the string output type.
Definition: xsdevice_def.cpp:3354
xsfilterprofilearray.h
XsDevice::packetErrorRate
virtual int packetErrorRate() const
Returns the packet error rate for the for the device.
Definition: xsdevice_def.cpp:3653
XsDevice::stringSamplePeriod
virtual uint16_t stringSamplePeriod() const
Returns the sample period for string output.
Definition: xsdevice_def.cpp:3337
XsDevice::operationalMode
virtual XsOperationalMode operationalMode() const
Returns the operational mode.
Definition: xsdevice_def.cpp:3362
XsDevice::getDataPacketByIndex
virtual XsDataPacket getDataPacketByIndex(XsSize index) const
Return the cached data packet with index.
Definition: xsdevice_def.cpp:4193
XsByteArray
struct XsByteArray XsByteArray
Definition: xsbytearray.h:81
Communicator::portInfo
virtual XsPortInfo portInfo() const =0
XsDevice::m_toaDumpFile
DebugFileType * m_toaDumpFile
To a dump file.
Definition: xsdevice_def.h:788
XsDevice::firstChild
virtual XsDevice const * firstChild() const
XsDevice::setInitialPositionLLA
virtual bool setInitialPositionLLA(const XsVector &lla)
Sets the 'Latitude Longitude Altitude' setting of the device to the given vector.
Definition: xsdevice_def.cpp:2809
ProtocolHandler
Message protocol handling class.
Definition: protocolhandler.h:71
OPS_OpenPort
@ OPS_OpenPort
Definition: openportstage.h:78
XsDevice::~XsDevice
virtual XSNOEXPORT ~XsDevice()
Destroy the device.
Definition: xsdevice_def.cpp:274
CallbackManagerXda::onRecordedDataAvailable
void onRecordedDataAvailable(XsDevice *dev, const XsDataPacket *data) override
The XsCallback::onRecordedDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:599
XsDevice::handleErrorMessage
virtual XSNOEXPORT void handleErrorMessage(const XsMessage &msg)
XsDevice::setSerialBaudRate
virtual bool setSerialBaudRate(XsBaudRate baudrate)
Change the serial baudrate to baudrate.
Definition: xsdevice_def.cpp:875
LastResultManager::lastResultText
XsString lastResultText() const
Definition: lastresultmanager.h:101
Communicator::defaultTimeout
uint32_t defaultTimeout() const
Definition: communicator.h:145
XsDevice::retainPacket
void retainPacket(XsDataPacket const &pack)
XsIccRepMotionResult
Contains the result of the representative motion processed by ICC.
Definition: xsiccrepmotionresult.h:72
XsDevice::deviceState
virtual XsDeviceState deviceState() const
Return the state of this device.
Definition: xsdevice_def.cpp:1064
XMID_SetPeriod
@ XMID_SetPeriod
Definition: xsxbusmessageid.h:84
XsDevice::master
virtual XsDevice * master() const
Return the master device of this device.
Definition: xsdevice_def.cpp:332
XsDevice::removeRef
virtual void removeRef()
Decrease this XsDevices reference counter with 1.
Definition: xsdevice_def.cpp:3831
XsDevice::onEofReached
virtual XSNOEXPORT void onEofReached()
XsDevice::xdaFilterProfile
virtual XsFilterProfile xdaFilterProfile() const
Gets the filter profile in use for computing orientations on the host PC.
Definition: xsdevice_def.cpp:2603
XsDevice::m_logFileMutex
xsens::Mutex m_logFileMutex
The mutex for guarding access to the log file.
Definition: xsdevice_def.h:670
XsFilterProfileArray
A list of XsFilterProfile values.
XMID_Error
@ XMID_Error
Definition: xsxbusmessageid.h:187
Communicator::setMasterDevice
void setMasterDevice(XsDevice *masterDevice)
Sets a master device.
Definition: communicator.cpp:126
XsDevice::XsDevice
XsDevice(XsDeviceId const &id)
Construct an empty device with device id id.
Definition: xsdevice_def.cpp:165
XDI_None
@ XDI_None
Empty datatype.
Definition: xsdataidentifier.h:86
XsDevice::m_skipEmtsReadOnInit
bool m_skipEmtsReadOnInit
Skip EMTS read on init boolean variable.
Definition: xsdevice_def.h:750
XsDevice::isInitialBiasUpdateEnabled
virtual bool isInitialBiasUpdateEnabled() const
Returns if the device does gyroscope bias estimation when switching to measurement mode.
Definition: xsdevice_def.cpp:2900
XsDevice::readMetaDataFromLogFile
virtual XsByteArray readMetaDataFromLogFile()
Returns internal meta-data about the recording that some devices store in the mtb logfile.
Definition: xsdevice_def.cpp:4652
Synchronization::supportsSyncSettings
bool supportsSyncSettings(XsDeviceId const &deviceId)
Definition: supportedsyncsettings.cpp:116
XCS_PluggedIn
@ XCS_PluggedIn
Definition: xsconnectivitystate.h:82
XsDeviceConfiguration
Structure containing a full device configuration as returned by the ReqConfig message.
Definition: xsdeviceconfiguration.h:143
XsDevice::reinitializeProcessors
virtual void reinitializeProcessors()
XsDevice::latestBufferedPacket
XsDataPacket & latestBufferedPacket()
Definition: xsdevice_def.h:582
XsDevice::m_outputConfiguration
XsOutputConfigurationArray m_outputConfiguration
A devices output configuration.
Definition: xsdevice_def.h:715
XsDevice::initialize
virtual bool XSNOEXPORT initialize()
XsDevice::isInSyncStationMode
virtual bool isInSyncStationMode()
Definition: xsdevice_def.cpp:3792
XsDevice::packetContainsRetransmission
static bool packetContainsRetransmission(XsDataPacket const &pack)
MtbDataLogger
A class for logging the mtb data.
Definition: mtbdatalogger.h:73
Communicator::masterDeviceId
XsDeviceId masterDeviceId() const
Definition: communicator.cpp:157
XsDevice::lastKnownRssi
virtual int16_t lastKnownRssi() const
Returns the last known RSSI value of the device.
Definition: xsdevice_def.cpp:3624
XsDevice::m_terminationPrepared
bool m_terminationPrepared
Termination prepared boolean variable.
Definition: xsdevice_def.h:739
XsCanOutputConfigurationArray
struct XsCanOutputConfigurationArray XsCanOutputConfigurationArray
Definition: xscanoutputconfigurationarray.h:82
XsDevice::gnssPlatform
XSNOEXPORT XSDEPRECATED XsGnssPlatform gnssPlatform() const
XsDevice::locationId
virtual int locationId() const
Get the location ID of the device.
Definition: xsdevice_def.cpp:2517
XsDevice::setXdaFilterProfile
virtual bool setXdaFilterProfile(int profileType)
Sets the filter profile to use for computing orientations on the host PC.
Definition: xsdevice_def.cpp:2619
XsDevice::sendCustomMessage
virtual bool sendCustomMessage(const XsMessage &messageSend, bool waitForResult, XsMessage &messageReceive, int timeout=0)
Send a custom message messageSend to the device and possibly wait for a result.
Definition: xsdevice_def.cpp:1302
XsRejectReason
XsRejectReason
Identifiers for why a device's connection was rejected.
Definition: xsrejectreason.h:74
XsDevice::deviceAtBusIdConst
const XsDevice * deviceAtBusIdConst(int busid) const
Return the device with bus ID busid.
Definition: xsdevice_def.cpp:778
XsDevice::serialBaudRate
virtual XsBaudRate serialBaudRate() const
The baud rate configured for cabled connection.
Definition: xsdevice_def.cpp:837
XsDevice::setCommunicator
void setCommunicator(Communicator *comm)
XsDevice::deviceIsDocked
virtual bool deviceIsDocked(XsDevice *dev) const
Check if the device is docked.
Definition: xsdevice_def.cpp:3673
XsDevice::m_stoppedRecordingPacketId
int64_t m_stoppedRecordingPacketId
The ID of the last packet that was recorded. Remains valid after Flushing has ended,...
Definition: xsdevice_def.h:772
XsIntArray
A list of XsInt values.
XsDevice::setSyncSettings
virtual bool setSyncSettings(const XsSyncSettingArray &settingList)
Set the synchronization settings of the device.
Definition: xsdevice_def.cpp:3158
XsDevice::isBusPowerEnabled
virtual bool isBusPowerEnabled() const
Returns if the Xbus is powering its child devices or not.
Definition: xsdevice_def.cpp:2432
XsDeviceIdArray
A list of XsDeviceId values.
XsDevice::isContainerDevice
virtual bool isContainerDevice() const
Returns true if this device can have child devices.
Definition: xsdevice_def.cpp:1094
XsDevice::setStringOutputMode
virtual bool setStringOutputMode(uint16_t type, uint16_t period, uint16_t skipFactor)
Sets the string output mode for this device.
Definition: xsdevice_def.cpp:1220
XsDevice::isMasterDevice
bool isMasterDevice() const
Returns true if this is the master device (not a child of another device)
Definition: xsdevice_def.cpp:1086
XsDevice::m_connectivity
XsConnectivityState m_connectivity
A current device connectivity state.
Definition: xsdevice_def.h:706
Communicator::addReplyObject
std::shared_ptr< ReplyObject > addReplyObject(uint8_t mid)
Add a MidReplyObject.
Definition: communicator.cpp:274
XsDevice::hardwareVersion
virtual XsVersion hardwareVersion() const
Return the hardware version of the device.
Definition: xsdevice_def.cpp:3467
XsDevice::handleWarningMessage
virtual XSNOEXPORT void handleWarningMessage(const XsMessage &msg)
protocolhandler.h
XsDevice::availableOnboardFilterProfiles
virtual XsFilterProfileArray availableOnboardFilterProfiles() const
Return the list of filter profiles available on the device.
Definition: xsdevice_def.cpp:2696
DataLogger::writeMessage
virtual bool writeMessage(const XsMessage &message)=0
Write a message to the logging stream.
XDS_Initial
@ XDS_Initial
Definition: xsdevicestate.h:79
XsDevice::disableProtocol
virtual bool disableProtocol(XsProtocolType protocol)
Disable a communication protocol previously added by XsDevice::enableProtocol.
Definition: xsdevice_def.cpp:3304
XsDataPacket
Contains an interpreted data message. The class provides easy access to the contained data through it...
Definition: xsdatapacket.h:301
XsVersion
struct XsVersion XsVersion
Definition: xsversion.h:80
CallbackManagerXda::onAllDataAvailable
void onAllDataAvailable(XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
The XsCallback::onAllDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:586
XsDevice::sendRawMessage
virtual bool sendRawMessage(const XsMessage &message)
Send a message directly to the communicator.
Definition: xsdevice_def.cpp:1311
XsDevice::checkDataEnabled
static bool checkDataEnabled(XsDataIdentifier dataType, XsOutputConfigurationArray const &configurations)
XsDevice::endRecordingStream
virtual void endRecordingStream()
XsOutputConfigurationArray
struct XsOutputConfigurationArray XsOutputConfigurationArray
Definition: xsoutputconfigurationarray.h:82
XsDevice::updateRate
virtual int updateRate() const
Get the legacy update rate of the device.
Definition: xsdevice_def.cpp:544
XsDevice::m_latestBufferedPacket
XsDataPacket * m_latestBufferedPacket
A copy of the latest ready recording packet. This is the last packet that was popped off the front of...
Definition: xsdevice_def.h:676
XsDevice::onboardFilterProfile
virtual XsFilterProfile onboardFilterProfile() const
Gets the filter profile in use by the device for computing orientations.
Definition: xsdevice_def.cpp:2646
XsDevice::m_justWriteSetting
bool m_justWriteSetting
Just write setting boolean variable.
Definition: xsdevice_def.h:745
Communicator::gotoConfig
virtual XsResultValue gotoConfig(bool detectRs485=false)=0
Request a device to go to config mode.
XsSelfTestResult
Contains the results of a self-test performed by an Xsens device.
Definition: xsselftestresult.h:105
xscanoutputconfigurationarray.h
XsDevice::subDeviceCount
virtual int subDeviceCount() const
Returns the number of sub-devices of this device.
Definition: xsdevice_def.cpp:4644
XsDevice::writeDeviceSettingsToFile
virtual void writeDeviceSettingsToFile()
Write the emts/wms/xms of the device and all its children to the open logfile.
Definition: xsdevice_def.cpp:2030
Communicator::logFileReadPosition
virtual XsFilePos logFileReadPosition() const =0
XsDevice::setFirmwareVersion
void setFirmwareVersion(const XsVersion &version)
XsDevice::children
virtual std::vector< XsDevice * > children() const
Return a managed array containing the child-devices this device has. For standalone devices this is a...
Definition: xsdevice_def.cpp:4093
XsDevice::createLogFile
XsResultValue createLogFile(const XsString &filename)
Create a log file for logging.
Definition: xsdevice_def.cpp:2038
XsDevice::initialPositionLLA
virtual XsVector initialPositionLLA() const
Gets the 'Latitude Longitude Altitude' setting of the device.
Definition: xsdevice_def.cpp:2793
JLALERTG
#define JLALERTG(msg)
Definition: journaller.h:281
XsDevice::requestUtcTime
virtual XSNOEXPORT bool requestUtcTime()
XsDevice::setOutputConfigurationInternal
virtual XsResultValue setOutputConfigurationInternal(XsOutputConfigurationArray &config)
XRR_Unknown
@ XRR_Unknown
Definition: xsrejectreason.h:76
XsDevice::portInfo
virtual XsPortInfo portInfo() const
The port information of the connection.
Definition: xsdevice_def.cpp:3696
XS_LEN_BAUDRATE
#define XS_LEN_BAUDRATE
Definition: xsdef.h:105
XsStringOutputTypeArray
struct XsStringOutputTypeArray XsStringOutputTypeArray
Definition: xsstringoutputtypearray.h:81
XEM_Invalid
@ XEM_Invalid
No error mode available.
Definition: xserrormode.h:80
XsDevice::shouldDoRecordedCallback
virtual bool shouldDoRecordedCallback(XsDataPacket const &packet) const
XsDevice::m_options
XsOption m_options
The options.
Definition: xsdevice_def.h:756
XsDevice::stealthMode
virtual bool stealthMode() const
Return the state of the stealth mode setting.
Definition: xsdevice_def.cpp:4034
Communicator::isPortOpen
virtual bool isPortOpen() const =0
XMID_FirmwareRevision
@ XMID_FirmwareRevision
Definition: xsxbusmessageid.h:104
XRV_ALREADYOPEN
@ XRV_ALREADYOPEN
269: An I/O device is already opened with this object
Definition: xsresultvalue.h:139
XsQuaternion
A class that implements a quaternion.
Definition: xsquaternion.h:102
XsDevice::supportedStatusFlags
virtual uint32_t supportedStatusFlags() const
Returns a bitmask with all the status flags supported by this device.
Definition: xsdevice_def.cpp:4610
XsDevice::reinitialize
virtual bool reinitialize()
Reinitialize the XsDevice.
Definition: xsdevice_def.cpp:2594
XsDevice::productCode
virtual XsString productCode() const
Return the product code of the device.
Definition: xsdevice_def.cpp:3451
xsportinfo.h
XsDevice::transportMode
virtual bool transportMode()
Returns the current state of the transport mode feature.
Definition: xsdevice_def.cpp:3005
xsdatapacketptrarray.h
XMID_MtData2
@ XMID_MtData2
Definition: xsxbusmessageid.h:168
nmea_protocolhandler.h
XsDevice::isRadioEnabled
virtual bool isRadioEnabled() const
Returns if the radio is enabled.
Definition: xsdevice_def.cpp:3497
XsDevice::outputConfiguration
virtual XsOutputConfigurationArray outputConfiguration() const
Returns the currently configured output of the device.
Definition: xsdevice_def.cpp:3380
XsDevice::latestLivePacket
XsDataPacket & latestLivePacket()
Definition: xsdevice_def.h:575
XsDevice::childCount
virtual int childCount() const
Return the number of child-devices this device has. For standalone devices this is always 0.
Definition: xsdevice_def.cpp:4085
XsDevice::onMessageReceived
virtual XSNOEXPORT void onMessageReceived(const XsMessage &message)
XsDevice::getDataPacketCount
XsSize getDataPacketCount() const
Return the current size of the retained data packet cache.
Definition: xsdevice_def.cpp:4206
XsDevice::setRecordingStartFrame
virtual void setRecordingStartFrame(uint16_t startFrame)
XsDevice::updateRateForDataIdentifier
virtual int updateRateForDataIdentifier(XsDataIdentifier dataType) const
Returns the currently configured update rate for the supplied dataType.
Definition: xsdevice_def.cpp:601
XsDevice::flushInputBuffers
virtual void flushInputBuffers()
Clear the inbound data buffers of the device.
Definition: xsdevice_def.cpp:1807
nmea::ProtocolHandler
The protocol handler for a different NMEA data types.
Definition: nmea_protocolhandler.h:76
XsDevice::clearProcessors
virtual void clearProcessors()
XsDevice::m_unavailableDataBoundary
int64_t m_unavailableDataBoundary
A packet ID of the last sample we know to be unavailable.
Definition: xsdevice_def.h:694
XsDevice::isCompatibleSyncSetting
static bool isCompatibleSyncSetting(XsDeviceId const &deviceId, XsSyncSetting const &setting1, XsSyncSetting const &setting2)
Determines whether setting1 is compatible with setting2 for deviceId deviceId.
Definition: xsdevice_def.cpp:4068
XsDevice::processBufferedPacket
virtual void processBufferedPacket(XsDataPacket &pack)
XsDevice::setDeviceId
void setDeviceId(const XsDeviceId &deviceId)
xsresetmethod.h
XsDevice::shortProductCode
virtual XsString shortProductCode() const
Return the shortened product code of the device suitable for display.
Definition: xsdevice_def.cpp:3459
CallbackManagerXda::onLiveDataAvailable
void onLiveDataAvailable(XsDevice *dev, const XsDataPacket *packet) override
The XsCallback::onLiveDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:363
XRV_OK
@ XRV_OK
0: Operation was performed successfully
Definition: xsresultvalue.h:85
XsDevice::communicator
Communicator XSNOEXPORT * communicator() const
XsDevice::m_communicator
Communicator * m_communicator
A communicator.
Definition: xsdevice_def.h:721
Communicator::isReadingFromFile
virtual bool isReadingFromFile() const =0
XsDevice::setFixedGravityEnabled
virtual bool setFixedGravityEnabled(bool enable)
Sets whether the fixed gravity value should be used or if it should be computed from the initialPosit...
Definition: xsdevice_def.cpp:2934
mtbdatalogger.h
XsRange
A class whose objects can be used to store a range. It provides method to check whether a value is in...
Definition: xsrange.h:89
Communicator::addProtocolHandler
virtual void addProtocolHandler(IProtocolHandler *handler)
Adds a protocol handler.
Definition: communicator.cpp:303
XDI_FullTypeMask
@ XDI_FullTypeMask
Mask to get the type of data, without the data format.
Definition: xsdataidentifier.h:88
Communicator::flushPort
virtual void flushPort()=0
Flushes all remaining data on the open port.
XsDevice::supportedStringOutputTypes
virtual XsStringOutputTypeArray supportedStringOutputTypes() const
Ask the device for its supported string output types.
Definition: xsdevice_def.cpp:1259
XsDevice::stopRecording
virtual bool stopRecording()
Stop recording incoming data.
Definition: xsdevice_def.cpp:2201
Communicator::loadLogFile
virtual void loadLogFile(XsDevice *device)=0
Load a complete logfile.
XsDevice::setNoRotation
virtual bool setNoRotation(uint16_t duration)
Set the no rotation period to duration.
Definition: xsdevice_def.cpp:2743
XsOption
XsOption
Xda options, used to control the kind of data processing done by XDA.
Definition: xsoption.h:76
XsDevice::handleWakeupMessage
virtual XSNOEXPORT void handleWakeupMessage(const XsMessage &msg)
XsDevice::setSyncStationMode
virtual bool setSyncStationMode(bool enabled)
Set the Sync Station mode of the Awinda Station device.
Definition: xsdevice_def.cpp:3801
XsResultValue
XsResultValue
Xsens result values.
Definition: xsresultvalue.h:82
XPT_Nmea
@ XPT_Nmea
The NMEA protocol, only the messages that can be sent from Xsens devices are recognized.
Definition: xsprotocoltype.h:75
XsDevice::latestBufferedPacketId
virtual int64_t latestBufferedPacketId() const
XsDevice::waitForLoadLogFileDone
void waitForLoadLogFileDone() const
Wait for the file operation started by loadLogFile to complete.
Definition: xsdevice_def.cpp:4364
CallbackManagerXda::onDataUnavailable
void onDataUnavailable(XsDevice *dev, int64_t packetId) override
The XsCallback::onDataUnavailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:402
Communicator::lastResult
XsResultValue lastResult() const
Get the result value of the last operation.
Definition: communicator.cpp:167
XsDevice::busId
virtual int busId() const
The bus ID for this device.
Definition: xsdevice_def.cpp:860
XsDevice::interpolateMissingData
virtual bool interpolateMissingData(XsDataPacket const &pack, XsDataPacket const &prev, std::function< void(XsDataPacket *)> packetHandler)
XMID_Initbus
@ XMID_Initbus
Definition: xsxbusmessageid.h:80
XsDevice::onSessionRestarted
virtual XSNOEXPORT void onSessionRestarted()
LastResultManager::set
void set(XsResultValue res, XsString const &text)
Sets the last results.
Definition: lastresultmanager.h:86
XsOutputConfigurationArray
A list of XsOutputConfiguration values.
CREATETOADUMPFILE
#define CREATETOADUMPFILE()
Definition: xsdevice_def.cpp:115
xsdeviceptrarray.h
XsDevice::updateLastAvailableLiveDataCache
void updateLastAvailableLiveDataCache(XsDataPacket const &pack)
XsDevice::resetRemovesPort
virtual bool resetRemovesPort() const
CallbackManagerXda::copyCallbackHandlersFrom
void copyCallbackHandlersFrom(CallbackManagerXda *cm, bool chain=true)
Copy all handlers from cm into this manager.
Definition: callbackmanagerxda.cpp:337
XsOperationalMode
XsOperationalMode
Definition: xsoperationalmode.h:68
DataLogger
An abstract class for data logging.
Definition: datalogger.h:73
XsDevice::rs485TransmissionDelay
virtual uint16_t rs485TransmissionDelay() const
Returns the transmission delay used for RS485 transmissions.
Definition: xsdevice_def.cpp:2841
Communicator::doTransaction
bool doTransaction(const XsMessage &message)
Write a message and await the reply.
Definition: communicator.cpp:222
CallbackManagerXda::onWakeupReceived
void onWakeupReceived(XsDevice *dev) override
The XsCallback::onWakeupReceived() callback forwarding function.
Definition: callbackmanagerxda.cpp:415
XsSyncSetting
A structure for storing all xsens sync settings.
Definition: xssyncsetting.h:95
DataPacketCache::insert
std::pair< iterator, bool > insert(int64_t id, XsDataPacket const &p)
Inserts a data packet.
Definition: datapacketcache.cpp:68
XsTime
Namespace for time and date constants and operations.
XsDataIdentifier
XsDataIdentifier
Defines the data identifiers.
Definition: xsdataidentifier.h:84
XsDevice::getDeviceFromLocationId
virtual XsDevice * getDeviceFromLocationId(uint16_t locId)
Get the device given locId.
Definition: xsdevice_def.cpp:2527
XMID_Wakeup
@ XMID_Wakeup
Definition: xsxbusmessageid.h:181
XsDevice::isMotionTracker
virtual bool isMotionTracker() const
Returns true if this is a motion tracker.
Definition: xsdevice_def.cpp:813
XsGnssPlatform
enum XsUbloxGnssPlatform XsGnssPlatform
Definition: xsgnssplatform.h:71
XsFilterProfile
Contains information about an available filter profile.
Definition: xsfilterprofile.h:92
XsDevice::loadLogFile
virtual bool loadLogFile()
Load a complete logfile.
Definition: xsdevice_def.cpp:3045
Communicator
A base struct for a communication interface.
Definition: communicator.h:95
XsPortInfo
struct XsPortInfo XsPortInfo
Definition: xsportinfo.h:83
XS_RSSI_UNKNOWN
#define XS_RSSI_UNKNOWN
Definition: xsrssi.h:71
XsDevice::isOperational
virtual bool isOperational() const
Definition: xsdevice_def.cpp:3786
XsDevice::m_deviceId
XsDeviceId m_deviceId
An ID of the device.
Definition: xsdevice_def.h:697
XsDevice::findDevice
virtual XsDevice * findDevice(XsDeviceId const &deviceid) const
Find the child device with deviceid.
Definition: xsdevice_def.cpp:500
XsBaudRate
enum XsBaudRate XsBaudRate
Communication speed.
Definition: xsbaud.h:81
XsDevice::addRef
virtual void addRef()
Increase reference count of XsDevice pointer XsDevice pointers stay alive while reference counter is ...
Definition: xsdevice_def.cpp:3810
XsDevice::prepareForTermination
virtual XSNOEXPORT void prepareForTermination()
XsDevice::deviceConfigurationConst
virtual XsDeviceConfiguration const &XSNOEXPORT deviceConfigurationConst() const
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
XsIccRepMotionResult
struct XsIccRepMotionResult XsIccRepMotionResult
Definition: xsiccrepmotionresult.h:114
XsDevice::m_state
XsDeviceState m_state
A current device state.
Definition: xsdevice_def.h:703
XsDevice::setDeviceBufferSize
virtual bool setDeviceBufferSize(uint32_t frames)
Request the device to set it's internal buffer to the specified size.
Definition: xsdevice_def.cpp:4328
XsDevice::accessControlMode
virtual XsAccessControlMode accessControlMode() const
Request the access control mode of the master device.
Definition: xsdevice_def.cpp:3760
XsDevice::replaceFilterProfile
virtual bool replaceFilterProfile(XsFilterProfile const &profileCurrent, XsFilterProfile const &profileNew)
Replaces profileCurrent by profileNew in the device.
Definition: xsdevice_def.cpp:2685
XsDevice::setOutputConfiguration
bool setOutputConfiguration(XsOutputConfigurationArray &config)
Set the output configuration for this device.
Definition: xsdevice_def.cpp:1138
XsDeviceParameter
Class to set and retrieve parameters from a XsDevice object.
Definition: xsdeviceparameter.h:81
XsPortInfo
Contains a descriptor for opening a communication port to an Xsens device.
Definition: xsportinfo.h:128
XsDevice::m_latestLivePacket
XsDataPacket * m_latestLivePacket
A copy of the latest ready live packet. This is the packet with the highest 64-bit sample counter so ...
Definition: xsdevice_def.h:673
CallbackManagerXda::onAllLiveDataAvailable
void onAllLiveDataAvailable(XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
The XsCallback::onAllLiveDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:376
xsdef.h
Macros and types for use in the Xsens communication protocol and Xsens Device API classes.
XsDevice::firmwareVersion
virtual XsVersion firmwareVersion() const
Return the firmware version.
Definition: xsdevice_def.cpp:675
XsQuaternion
struct XsQuaternion XsQuaternion
Definition: xsquaternion.h:80
XMID_Warning
@ XMID_Warning
Definition: xsxbusmessageid.h:188
CallbackManagerXda::onNonDataMessage
void onNonDataMessage(XsDevice *dev, XsMessage const *message) override
The Xscallback::onNonDataMessage() callback forwarding function.
Definition: callbackmanagerxda.cpp:521
XsDevice::setRecordingStopFrame
virtual void setRecordingStopFrame(uint16_t stopFrame)
XsDevice::syncSettings
virtual XsSyncSettingArray syncSettings() const
Get all the current synchronization settings of the device.
Definition: xsdevice_def.cpp:3144
XsDevice::connectivityState
virtual XsConnectivityState connectivityState() const
Returns the connectivity state of the device.
Definition: xsdevice_def.cpp:3663
XsDevice::baudRate
virtual XsBaudRate baudRate() const
Get the baud rate (communication speed) of the serial port on which the given deviceId is connected.
Definition: xsdevice_def.cpp:849
CallbackManagerXda::onMessageSentToDevice
void onMessageSentToDevice(XsDevice *dev, XsMessage const *message) override
The Xscallback::onMessageSentToDevice() callback forwarding function.
Definition: callbackmanagerxda.cpp:560
CallbackManagerXda::onConnectivityChanged
void onConnectivityChanged(XsDevice *dev, XsConnectivityState newState) override
The XsCallback::onConnectivityChanged() callback forwarding function.
Definition: callbackmanagerxda.cpp:482
XsDevice::setHeadingOffset
virtual bool setHeadingOffset(double offset)
Set the 'heading offset' setting of the device.
Definition: xsdevice_def.cpp:2486
XsDevice::restoreFactoryDefaults
virtual bool restoreFactoryDefaults()
Restore the device to its factory default settings.
Definition: xsdevice_def.cpp:1953
XGP_Portable
@ XGP_Portable
Definition: xsubloxgnssplatform.h:74
Communicator::isLoadLogFileInProgress
virtual bool isLoadLogFileInProgress() const
Definition: communicator.cpp:350
XsDevice::representativeMotionState
virtual bool representativeMotionState()
Retrieves the active representative motion state for the In-Run Compass Calibration.
Definition: xsdevice_def.cpp:2762
XsDevice::m_stopRecordingPacketId
int64_t m_stopRecordingPacketId
The ID of the last packet that should be / was recorded. Only valid in Recording/Flushing states.
Definition: xsdevice_def.h:769
XsDevice::m_packetStamper
PacketStamper m_packetStamper
A packet stamper.
Definition: xsdevice_def.h:753
XsDevice::messageLooksSane
virtual XSNOEXPORT bool messageLooksSane(const XsMessage &msg) const
XsDevice::headingOffset
virtual double headingOffset() const
Return the 'heading offset' setting of the device.
Definition: xsdevice_def.cpp:2495
PacketStamper::stampPacket
int64_t stampPacket(XsDataPacket &pack, XsDataPacket const &highest)
Create 64 bit counter for a packet.
Definition: packetstamper.cpp:133
XsDevice::updateDeviceState
virtual void updateDeviceState(XsDeviceState state)
XsDevice::m_lastResult
LastResultManager m_lastResult
The last result of an operation.
Definition: xsdevice_def.h:700
XsDevice::logFileReadPosition
XsFilePos logFileReadPosition() const
Get the current read position of the open log file.
Definition: xsdevice_def.cpp:3236
XsDevice::m_config
XsDeviceConfiguration m_config
A device configuration.
Definition: xsdevice_def.h:712
XsDevice::m_firmwareVersion
XsVersion m_firmwareVersion
A firmware version.
Definition: xsdevice_def.h:718
xsselftestresult.h
XsDevice::waitForAllDevicesInitialized
virtual void waitForAllDevicesInitialized()
Wait until are known devices are initialized.
Definition: xsdevice_def.cpp:4339
XsDevice::isSoftwareFilteringEnabled
virtual bool isSoftwareFilteringEnabled() const
MtbDataLogger::filename
XsString filename() const
Definition: mtbdatalogger.cpp:188
XsDevice::m_lastDataOkStamp
XsTimeStamp m_lastDataOkStamp
A time stamp for an OK last data.
Definition: xsdevice_def.h:709
XsDevice::discardRetransmissions
virtual void discardRetransmissions(int64_t firstNewPacketId)
Tell XDA and the device that any data from before firstNewPacketId may be lossy.
Definition: xsdevice_def.cpp:4598
XsDevice::checkDataCache
virtual void XSNOEXPORT checkDataCache()
XDS_Recording
@ XDS_Recording
Definition: xsdevicestate.h:83
XsDevice::deviceAtBusId
virtual XsDevice * deviceAtBusId(int busid)
Return the device with bus ID busid.
Definition: xsdevice_def.cpp:767
XsDevice::storeIccResults
virtual bool storeIccResults()
Store the onboard ICC results for use by the device.
Definition: xsdevice_def.cpp:2780
JLTRACEG
#define JLTRACEG(msg)
Definition: journaller.h:279
XsDevice::updateRateForProcessedDataIdentifier
virtual int updateRateForProcessedDataIdentifier(XsDataIdentifier dataType) const
Returns the currently configured update rate for the supplied dataType.
Definition: xsdevice_def.cpp:622
PacketStamper::calculateLargePacketCounter
static int64_t calculateLargePacketCounter(int64_t frameCounter, int64_t lastCounter, int64_t boundary)
Calculate the new large packet counter value based on frameCounter and the lastCounter.
Definition: packetstamper.cpp:106
XsDevice::waitForCustomMessage
virtual XSNOEXPORT bool waitForCustomMessage(XsXbusMessageId messageId, XsMessage &messageReceive, int timeout=0)
XsMatrix
struct XsMatrix XsMatrix
Definition: xsmatrix.h:81
CallbackManagerXda::onMessageReceivedFromDevice
void onMessageReceivedFromDevice(XsDevice *dev, XsMessage const *message) override
The Xscallback::onMessageReceivedFromDevice() callback forwarding function.
Definition: callbackmanagerxda.cpp:547
XMID_SetOutputConfiguration
@ XMID_SetOutputConfiguration
Definition: xsxbusmessageid.h:459
xssyncsettingarray.h
XsDevice::refCounter
XsSize refCounter() const
The current reference counter.
Definition: xsdevice_def.cpp:3819
PacketStamper::MTSCBOUNDARY
static const int64_t MTSCBOUNDARY
16 bit MT Sample Counter boundary
Definition: packetstamper.h:80
XsSelfTestResult
struct XsSelfTestResult XsSelfTestResult
Definition: xsselftestresult.h:228
XsDevice::setUpdateRate
virtual bool setUpdateRate(int rate)
Set the legacy update rate of the device.
Definition: xsdevice_def.cpp:554
XsDevice::canOutputConfiguration
virtual XsCanOutputConfigurationArray canOutputConfiguration() const
Returns the currently configured CAN output of the device.
Definition: xsdevice_def.cpp:3388
xsdevice_def.h
XsDevice::deviceParameter
virtual XsResultValue deviceParameter(XsDeviceParameter &parameter) const
Retrieves the requested parameter's current value.
Definition: xsdevice_def.cpp:4468
CallbackManagerXda::onDeviceStateChanged
void onDeviceStateChanged(XsDevice *dev, XsDeviceState newState, XsDeviceState oldState) override
The XsCallback::onDeviceStateChanged() callback forwarding function.
Definition: callbackmanagerxda.cpp:350
XRV_NOTIMPLEMENTED
@ XRV_NOTIMPLEMENTED
257: Operation not implemented in this version (yet)
Definition: xsresultvalue.h:127
XsDevice::setPacketErrorRate
virtual XSNOEXPORT void setPacketErrorRate(int per)
XsDevice::maximumUpdateRate
virtual int maximumUpdateRate() const
Get the maximum update rate for the device.
Definition: xsdevice_def.cpp:3102
XsDevice::removeIfNoRefs
void removeIfNoRefs()
XsDevice::m_gotoConfigOnClose
bool m_gotoConfigOnClose
Go to confing on close boolean variable.
Definition: xsdevice_def.h:742
XsSyncRole
XsSyncRole
Synchronization roles.
Definition: xssyncrole.h:73
XsDevice::setOnboardFilterProfile
virtual bool setOnboardFilterProfile(int profileType)
Sets the filter profile to use for computing orientations on the device.
Definition: xsdevice_def.cpp:2659
XsResetMethod
XsResetMethod
Orientation reset type.
Definition: xsresetmethod.h:74
XsDevice::isSyncMaster
virtual bool isSyncMaster() const
returns whether this device is in a master role regarding the device synchronization
Definition: xsdevice_def.cpp:750
XsSize
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:74
XsDevice::setGotoConfigOnClose
void setGotoConfigOnClose(bool gotoConfigOnClose)
On closePort the device will go to config by default, with this function it is possible to prevent th...
Definition: xsdevice_def.cpp:519
XsDevice::takeFirstDataPacketInQueue
XsDataPacket takeFirstDataPacketInQueue()
Return the first packet in the packet queue or an empty packet if the queue is empty.
Definition: xsdevice_def.cpp:4230
XDS_WaitingForRecordingStart
@ XDS_WaitingForRecordingStart
Definition: xsdevicestate.h:82
XsDevice::resetPacketStamping
virtual void resetPacketStamping()
XsVersion
A class to store version information.
Definition: xsversion.h:95
XsDevice::m_logFileInterface
DataLogger * m_logFileInterface
A data logger for a file interface.
Definition: xsdevice_def.h:724
XSO_InterpolateMissingData
@ XSO_InterpolateMissingData
When set, any gaps in the data streams of child devices will be filled with interpolated data....
Definition: xsoption.h:90
xsdatapacket.h
XsDevice::deviceBufferSize
virtual uint32_t deviceBufferSize()
Request the size of the interal buffer.
Definition: xsdevice_def.cpp:4319
XsAccessControlMode
XsAccessControlMode
Device access control modes (XsDevice::setAccessControlMode())
Definition: xsaccesscontrolmode.h:74
XsDevice::enableRadio
virtual bool enableRadio(int channel)
Set the radio channel to use for wireless communication.
Definition: xsdevice_def.cpp:3478
XsUbloxGnssPlatform
XsUbloxGnssPlatform
Used to select u-blox GNSS chip platform.
Definition: xsubloxgnssplatform.h:72
XsDevice::gyroscopeRange
virtual double gyroscopeRange() const
Returns the maximum official value of the gyroscopes in the device.
Definition: xsdevice_def.cpp:2727
XsVector
struct XsVector XsVector
Definition: xsvector.h:87
XsXbusMessageId
XsXbusMessageId
Xsens Xbus Message Identifiers.
Definition: xsxbusmessageid.h:73
XsDevice::stringSkipFactor
virtual uint16_t stringSkipFactor() const
Returns the skipfactor for string output.
Definition: xsdevice_def.cpp:3345
XsDevice::setDeviceState
virtual void setDeviceState(XsDeviceState state)
XsDevice::gnssReceiverSettings
virtual XsIntArray gnssReceiverSettings() const
Gets some GNSS receiver settings.
Definition: xsdevice_def.cpp:4520
XCS_File
@ XCS_File
Definition: xsconnectivitystate.h:85
XsDevice::startRecording
virtual bool startRecording()
Start recording incoming data.
Definition: xsdevice_def.cpp:2171
xsdeviceid.h
XsDevice::setWirelessPriority
virtual bool setWirelessPriority(int priority)
Sets the wireless priority of the device.
Definition: xsdevice_def.cpp:3581
Communicator::waitForLastTaskCompletion
virtual void waitForLastTaskCompletion()=0
Wait for the last processing task to complete in the threadpool.
XSR_None
@ XSR_None
Definition: xssyncrole.h:76
XsDevice::insertIntoDataCache
virtual void insertIntoDataCache(int64_t pid, XsDataPacket *pack)
XsDevice::portName
virtual XsString portName() const
The port name of the connection.
Definition: xsdevice_def.cpp:3683
XsDevice::reopenPort
virtual bool reopenPort(bool gotoConfig, bool skipDeviceIdCheck=false)
Reopens a port Uses rescan method to redetect a device. Also if USB descriptor has changed.
Definition: xsdevice_def.cpp:2017
XsMessage
Structure for storing a single message.
Definition: xsmessage.h:202
XsDevice::setAlignmentRotationMatrix
virtual bool setAlignmentRotationMatrix(XsAlignmentFrame frame, const XsMatrix &matrix)
Set an arbitrary alignment rotation matrix Use to rotate either L to the chosen frame L' or S to the ...
Definition: xsdevice_def.cpp:2120
XsDevice::isRecording
virtual bool isRecording() const
Returns true if the device is currently in a recording state.
Definition: xsdevice_def.cpp:1762
Communicator::resetLogFileReadPosition
virtual void resetLogFileReadPosition(void)=0
Resets the logfile read position.
XsDevice::reset
virtual bool reset()
Reset the device.
Definition: xsdevice_def.cpp:1971
XsDevice::isProtocolEnabled
virtual bool isProtocolEnabled(XsProtocolType protocol) const
Definition: xsdevice_def.cpp:3326
XsDevice::stopRepresentativeMotion
virtual XsIccRepMotionResult stopRepresentativeMotion()
Let the user indicate that he stopped the representative motion.
Definition: xsdevice_def.cpp:2772
XsDevice::processLivePacket
virtual void processLivePacket(XsDataPacket &pack)
Communicator::readMessageFromStartOfFile
virtual XsMessage readMessageFromStartOfFile(uint8_t msgId, int maxMsgs=0)=0
Read a message from the start of the open file.
XsDevice::setStealthMode
virtual bool setStealthMode(bool enabled)
Enable or disable stealth mode.
Definition: xsdevice_def.cpp:4025
XsDevice::alignmentRotationMatrix
virtual XsMatrix alignmentRotationMatrix(XsAlignmentFrame frame) const
Retrieve the alignment rotation matrix to rotate S to the chosen frame S'.
Definition: xsdevice_def.cpp:2132
XMID_ReqConfiguration
@ XMID_ReqConfiguration
Definition: xsxbusmessageid.h:96
xsoutputconfigurationarray.h
XsDevice::setObjectAlignment
virtual bool setObjectAlignment(const XsMatrix &matrix)
Sets the object alignment of the device to the given matrix.
Definition: xsdevice_def.cpp:2554
XsMtDeviceConfiguration::m_fwRevMajor
uint8_t m_fwRevMajor
The major version of the firmware.
Definition: xsdeviceconfiguration.h:107
XMID_Configuration
@ XMID_Configuration
Definition: xsxbusmessageid.h:97
xsscrdata.h
XsDevice::m_refCounter
volatile std::atomic_int m_refCounter
A reference counter.
Definition: xsdevice_def.h:730
XsDevice::lastResult
XsResultValue lastResult() const
Get the result value of the last operation.
Definition: xsdevice_def.cpp:794
XsDeviceId
Contains an Xsens device ID and provides operations for determining the type of device.
Definition: xsdeviceid.h:192
XsDevice::m_deviceMutex
xsens::GuardedMutex m_deviceMutex
The mutex for guarding state changes of the device.
Definition: xsdevice_def.h:667
XsDevice::applyConfigFile
virtual XsResultValue applyConfigFile(const XsString &filename)
Loads a config file(.xsa) and configures the device accordingly.
Definition: xsdevice_def.cpp:2142
XsDevice::radioChannel
virtual int radioChannel() const
Returns the radio channel used for wireless communication.
Definition: xsdevice_def.cpp:3506
XsDevicePtrArray
A list of XsDevicePtr values.
XsDevice::m_lastAvailableLiveDataCache
XsDataPacket * m_lastAvailableLiveDataCache
A last available live data cache.
Definition: xsdevice_def.h:783
XsDevice::setStartRecordingPacketId
virtual void setStartRecordingPacketId(int64_t startFrame)
XDS_Destructing
@ XDS_Destructing
Definition: xsdevicestate.h:85
XsIntArray
struct XsIntArray XsIntArray
Definition: xsintarray.h:80
XsDevice::shouldDataMsgBeRecorded
virtual bool shouldDataMsgBeRecorded(const XsMessage &msg) const
xsstringoutputtypearray.h
XsDevice::rejectReason
virtual XsRejectReason rejectReason() const
Returns the reason why a device's connection was rejected.
Definition: xsdevice_def.cpp:3614
XsDevice::setOperationalMode
virtual bool setOperationalMode(XsOperationalMode mode)
Set the device in the given operational mode.
Definition: xsdevice_def.cpp:3371
XCS_Unknown
@ XCS_Unknown
Definition: xsconnectivitystate.h:86
XDS_Measurement
@ XDS_Measurement
Definition: xsdevicestate.h:81
XsDevice::readEmtsAndDeviceConfiguration
virtual XSNOEXPORT bool readEmtsAndDeviceConfiguration()
XsDevice::closeLogFile
virtual bool closeLogFile()
Close the log file.
Definition: xsdevice_def.cpp:2150
XsDevice::syncSettingsTimeResolutionInMicroSeconds
static unsigned int syncSettingsTimeResolutionInMicroSeconds(XsDeviceId const &deviceId)
Definition: xsdevice_def.cpp:4077
XMID_RestoreFactoryDef
@ XMID_RestoreFactoryDef
Definition: xsxbusmessageid.h:98
XsDevice::setUbloxGnssPlatform
virtual bool setUbloxGnssPlatform(XsUbloxGnssPlatform ubloxGnssPlatform)
Set the device GNSS platform for u-blox GNSS receivers.
Definition: xsdevice_def.cpp:4511
XsDevice::onConnectionLost
virtual XSNOEXPORT void onConnectionLost()
XsDevice::updateCachedDeviceInformation
virtual bool updateCachedDeviceInformation()
Updates the cached device information for all devices connected to this port.
Definition: xsdevice_def.cpp:3254
XsDevice::setAlignmentRotationQuaternion
virtual bool setAlignmentRotationQuaternion(XsAlignmentFrame frame, const XsQuaternion &quat)
Set an arbitrary alignment rotation quaternion. Use to rotate either L to the chosen frame L' or S to...
Definition: xsdevice_def.cpp:2094
XsDevice::updateConnectivityState
void updateConnectivityState(XsConnectivityState newState)
XsDevice::onMessageSent
virtual XSNOEXPORT void onMessageSent(const XsMessage &message)
XsDevice::isSoftwareCalibrationEnabled
virtual bool isSoftwareCalibrationEnabled() const
XPT_Xbus
@ XPT_Xbus
The Xsens Xbus protocol, enabled by default, always 0.
Definition: xsprotocoltype.h:74
XsDevice::readDeviceConfiguration
virtual bool readDeviceConfiguration()
XRV_OTHER
@ XRV_OTHER
286: Something else was received than was requested
Definition: xsresultvalue.h:156
XsDevice::latestLivePacketConst
XsDataPacket const & latestLivePacketConst() const
Definition: xsdevice_def.h:589
XsResultValue_toString
const char * XsResultValue_toString(XsResultValue result)
Retrieve a character string corresponding to the given result code.
Definition: xsresultvalue.c:78
XsDevice::handleMasterIndication
virtual XSNOEXPORT void handleMasterIndication(const XsMessage &message)
xsrssi.h
XsDevice::isSyncSlave
virtual bool isSyncSlave() const
returns whether this device is in a slave role regarding the device synchronization
Definition: xsdevice_def.cpp:758
Communicator::reopenPort
virtual bool reopenPort(OpenPortStage stage=OPS_Full, bool skipDeviceIdCheck=false)=0
Reopens the port.
Communicator::configurationMessageSearchLimit
static int configurationMessageSearchLimit()
Definition: communicator.h:316
xssyncsetting.h
XsDevice::setDeviceParameter
virtual XsResultValue setDeviceParameter(XsDeviceParameter const &parameter)
Sets the given parameter for the device.
Definition: xsdevice_def.cpp:4456
XsDevice::setGnssLeverArm
virtual bool setGnssLeverArm(const XsVector &arm)
Sets the GNSS Lever Arm vector.
Definition: xsdevice_def.cpp:2946
MessageSerializer
A class that does the message serialization.
Definition: messageserializer.h:79
XsDevice::logFileName
virtual XsString logFileName() const
Get the name of the log file the device is reading from.
Definition: xsdevice_def.cpp:3078
XsDevice::accelerometerRange
virtual double accelerometerRange() const
Returns the maximum official value of the accelerometers in the device.
Definition: xsdevice_def.cpp:2716
JLHEXLOG
#define JLHEXLOG(d)
Definition: journaller.h:335
CallbackManagerXda::onMissedPackets
void onMissedPackets(XsDevice *dev, int count, int first, int last) override
The XsCallback::onMissedPackets() callback forwarding function.
Definition: callbackmanagerxda.cpp:389
XsDevice::resetLogFileReadPosition
virtual bool resetLogFileReadPosition()
Set the read position of the open log file to the start of the file.
Definition: xsdevice_def.cpp:3198
XsDevice::requestBatteryLevel
virtual bool requestBatteryLevel()
Request the battery level from the device.
Definition: xsdevice_def.cpp:2973
XsDevice::gotoConfig
virtual bool gotoConfig()
Put the device in config mode.
Definition: xsdevice_def.cpp:1014
XsConnectivityState
XsConnectivityState
XsDevice connectivity state identifiers.
Definition: xsconnectivitystate.h:78
xsbaud.h
XsDevice::clearDataCache
virtual void clearDataCache()
CallbackManagerXda::onDataAvailable
void onDataAvailable(XsDevice *dev, const XsDataPacket *data) override
The XsCallback::onDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:573
XsDevice::areOptionsEnabled
virtual bool areOptionsEnabled(XsOption options) const
Returns true when all the specified processing options are enabled.
Definition: xsdevice_def.cpp:3434
XsDevice::getOptions
XsOption getOptions() const
Return the currently enabled options.
Definition: xsdevice_def.cpp:3443
XsDevice::deviceOptionFlags
virtual XsDeviceOptionFlag deviceOptionFlags() const
Returns the device option flags.
Definition: xsdevice_def.cpp:562
XsDevice::abortFlushing
virtual bool abortFlushing()
Abort the wireless flushing operation and finalize the recording.
Definition: xsdevice_def.cpp:3537
XsDevice::usesLegacyDeviceMode
virtual bool usesLegacyDeviceMode() const
Returns whether the device uses legacy device mode.
Definition: xsdevice_def.cpp:3022
XsDevice::setStopRecordingPacketId
virtual void setStopRecordingPacketId(int64_t stopFrame)
XsDevice::setGnssReceiverSettings
virtual bool setGnssReceiverSettings(const XsIntArray &gnssReceiverSettings)
Sets some GNSS receiver settings.
Definition: xsdevice_def.cpp:4529
Communicator::writeMessage
virtual bool writeMessage(const XsMessage &message)=0
Write message to the device.
XDS_Config
@ XDS_Config
Definition: xsdevicestate.h:80
Communicator::logFileSize
virtual XsFilePos logFileSize() const =0
XSO_RetainLiveData
@ XSO_RetainLiveData
Keep the live data in a cache so it can be accessed through XsDevice::getDataPacketByIndex or XsDevic...
Definition: xsoption.h:83
XsDevice::isInStringOutputMode
virtual bool isInStringOutputMode() const
Returns if the device is outputting data in string mode.
Definition: xsdevice_def.cpp:3014
JLDEBUGG
#define JLDEBUGG(msg)
Definition: journaller.h:280
XsMtDeviceConfiguration
Device information for MT devices in an XsDeviceConfiguration.
Definition: xsdeviceconfiguration.h:102
JLWRITEG
#define JLWRITEG(msg)
Definition: journaller.h:284
XsDevice::canConfiguration
virtual uint32_t canConfiguration() const
Returns the currently configured CAN configuration of the device.
Definition: xsdevice_def.cpp:3396
XsDevice::acceptConnection
virtual bool acceptConnection()
Accept connections from the device on the parent/master device.
Definition: xsdevice_def.cpp:3548
XsDevice::portConfiguration
virtual XsIntArray portConfiguration() const
Get the current port configuration of a device.
Definition: xsdevice_def.cpp:910
CallbackManagerXda::onAllBufferedDataAvailable
void onAllBufferedDataAvailable(XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
The XsCallback::onAllBufferedDataAvailable() callback forwarding function.
Definition: callbackmanagerxda.cpp:469
XRV_OUTPUTCANNOTBEOPENED
@ XRV_OUTPUTCANNOTBEOPENED
268: The specified i/o device can not be opened
Definition: xsresultvalue.h:138
xsiccrepmotionresult.h
XsDevice::deviceConfiguration
XsDeviceConfiguration deviceConfiguration() const
Returns the device configuration.
Definition: xsdevice_def.cpp:1945
XMID_SetOutputSkipFactor
@ XMID_SetOutputSkipFactor
Definition: xsxbusmessageid.h:474
XMID_ResetOrientation
@ XMID_ResetOrientation
Definition: xsxbusmessageid.h:387
xsens::Lock
A base class for a Lock.
Definition: xsens_mutex.h:947
CallbackManagerXda::onMessageDetected
void onMessageDetected(XsDevice *dev, XsProtocolType type, XsByteArray const *rawMessage) override
The Xscallback::onMessageReceivedFromDevice() callback forwarding function.
Definition: callbackmanagerxda.cpp:534
Communicator::abortLoadLogFile
virtual void abortLoadLogFile()=0
Aborts loading a logfile.
XsDevice::gotoMeasurement
virtual bool gotoMeasurement()
Put this device in measurement mode.
Definition: xsdevice_def.cpp:960
XsDevice::disableRadio
virtual bool disableRadio()
Disables the radio for this station, resetting all children to disconnected state.
Definition: xsdevice_def.cpp:3488
XsDevice::rejectConnection
virtual bool rejectConnection()
Reject connections from the device on the parent/master device.
Definition: xsdevice_def.cpp:3562
JLERRORG
#define JLERRORG(msg)
Definition: journaller.h:282
XsErrorMode
XsErrorMode
Error modes for use in XsDevice::setErrorMode.
Definition: xserrormode.h:74
XMID_Reset
@ XMID_Reset
Definition: xsxbusmessageid.h:185
XsDevice::setAccessControlMode
virtual bool setAccessControlMode(XsAccessControlMode mode, const XsDeviceIdArray &initialList)
Set the access control mode of the master device.
Definition: xsdevice_def.cpp:3751
XsProtocolType
XsProtocolType
Protocol types (XsDevice::enableProtocol())
Definition: xsprotocoltype.h:72
XsDevice::setTransportMode
virtual bool setTransportMode(bool transportModeEnabled)
Enable or disable the transport mode for the device.
Definition: xsdevice_def.cpp:2995
XMID_SetStringOutputType
@ XMID_SetStringOutputType
Definition: xsxbusmessageid.h:350
XsSyncSettingArray
A list of XsSyncSetting values.
int32_t
signed int int32_t
Definition: pstdint.h:515
XsDevice::shouldWriteMessageToLogFile
virtual bool shouldWriteMessageToLogFile(const XsMessage &msg) const
XsDevice::resetOrientation
virtual bool resetOrientation(XsResetMethod resetmethod)
Perform an orientation reset on the device using the given resetMethod.
Definition: xsdevice_def.cpp:3187
XsDevice::setOptions
virtual void setOptions(XsOption enable, XsOption disable)
Enable and disable processing options.
Definition: xsdevice_def.cpp:3411
XsDevice::setGravityMagnitude
virtual bool setGravityMagnitude(double mag)
Sets the 'Gravity Magnitude' of the device to the given value mag.
Definition: xsdevice_def.cpp:2579
PacketStamper::resetTosEstimation
void resetTosEstimation()
Reset the Time Of Sampling estimation parameters.
Definition: packetstamper.cpp:89
XsDevice::m_startRecordingPacketId
int64_t m_startRecordingPacketId
The ID of the first packet that should be / was recorded.
Definition: xsdevice_def.h:766
XsDevice::setUtcTime
virtual bool setUtcTime(const XsTimeInfo &time)
Sets the 'UTC Time' setting of the device to the given time.
Definition: xsdevice_def.cpp:2831
XsDevice::createConfigFile
virtual XsResultValue createConfigFile(const XsString &filename)
Stores the current device configuration in a config file(.xsa)
Definition: xsdevice_def.cpp:2082
XsDevice::deviceRecordingBufferItemCount
virtual XSNOEXPORT int64_t deviceRecordingBufferItemCount(int64_t &lastCompletePacketId) const
XsDevice::currentAccessControlList
virtual XsDeviceIdArray currentAccessControlList() const
Request the access control list of the master device.
Definition: xsdevice_def.cpp:3769
xsfilterprofile.h
XsDevice::subDevice
virtual XsDevice * subDevice(int subDeviceId) const
Returns the sub-device at index index.
Definition: xsdevice_def.cpp:4632
XsDevice::writeMessageToLogFile
virtual void writeMessageToLogFile(const XsMessage &message)
XsDevice::handleDataPacket
virtual XSNOEXPORT void handleDataPacket(const XsDataPacket &packet)
XsDevice::initializeSoftwareCalibration
virtual bool XSNOEXPORT initializeSoftwareCalibration()
XsDevice::isMeasuring
virtual bool isMeasuring() const
Returns true if the device is currently in a measuring state.
Definition: xsdevice_def.cpp:1741
XsDevice::setDeviceAccepted
virtual bool setDeviceAccepted(const XsDeviceId &deviceId)
Accepts a device.
Definition: xsdevice_def.cpp:3730
XsDevice::recordingQueueLength
int recordingQueueLength() const
Get the number of packets currently waiting in the slow data cache for the device based.
Definition: xsdevice_def.cpp:3118
xprintf.h
Synchronization::supportedSyncSettings
XsSyncSettingArray supportedSyncSettings(XsDeviceId const &deviceId)
Returns the list of the supported synchronizations settings for the specified device id Each item in ...
Definition: supportedsyncsettings.cpp:78
XsDevice::isBlueToothEnabled
virtual bool isBlueToothEnabled() const
Returns true if the device has its BlueTooth radio enabled.
Definition: xsdevice_def.cpp:2413
XRV_UNSUPPORTED
@ XRV_UNSUPPORTED
303: The requested functionality is not supported by the device
Definition: xsresultvalue.h:178
XsDevice::requestData
virtual bool requestData()
Request data when configured in legacy mode with infinite skip factor.
Definition: xsdevice_def.cpp:2875
XsDevice::alignmentRotationQuaternion
virtual XsQuaternion alignmentRotationQuaternion(XsAlignmentFrame frame) const
Retrieve the alignment rotation quaternion.
Definition: xsdevice_def.cpp:2106
XMID_MasterIndication
@ XMID_MasterIndication
Definition: xsxbusmessageid.h:194
XRM_StoreAlignmentMatrix
@ XRM_StoreAlignmentMatrix
Store the current object alignment matrix to persistent memory.
Definition: xsresetmethod.h:76
XsStringOutputTypeArray
A list of XsStringOutputType values.
XsDevice::m_emtsBlob
XsMessage m_emtsBlob
An EMTS blob from device.
Definition: xsdevice_def.h:761
XsDevice::batteryLevel
virtual int batteryLevel() const
Get the batterylevel of this device The battery level is a value between 0 and 100 that indicates the...
Definition: xsdevice_def.cpp:535
xsens::LockSuspendable::unlock
bool unlock() noexcept
Unlocks the write or read locked mutex.
Definition: xsens_mutex.h:1513
XsDevice::wirelessPriority
virtual int wirelessPriority() const
Returns the wireless priority of the device.
Definition: xsdevice_def.cpp:3571
xscalibrateddata.h
XsDevice::gravityMagnitude
virtual double gravityMagnitude() const
Returns the 'Gravity Magnitude' of the device.
Definition: xsdevice_def.cpp:2566
XsDevice::deviceConfigurationRef
XsDeviceConfiguration &XSNOEXPORT deviceConfigurationRef()
Synchronization::isCompatibleSyncSetting
bool isCompatibleSyncSetting(XsDeviceId const &deviceId, XsSyncSetting const &setting1, XsSyncSetting const &setting2)
Return true if setting1 is compatible with setting2 for a device with deviceId.
Definition: supportedsyncsettings.cpp:126
XsDevice::onWirelessConnectionLost
virtual XSNOEXPORT void onWirelessConnectionLost()
XsCanOutputConfigurationArray
A list of XsCanOutputConfiguration values.
XsDeviceState
XsDeviceState
XsDevice state identifiers.
Definition: xsdevicestate.h:77
DataLogger::close
virtual void close()=0
Closes a file.
XsDevice::objectAlignment
virtual XsMatrix objectAlignment() const
Returns the object alignment matrix of the device.
Definition: xsdevice_def.cpp:2541
XsDevice::setInitialBiasUpdateEnabled
virtual bool setInitialBiasUpdateEnabled(bool enable)
Set if the device does gyroscope bias estimation when switching to measurement mode.
Definition: xsdevice_def.cpp:2912
XsDevice::clearCacheToRecordingStart
virtual void clearCacheToRecordingStart()
XsDevice::addReplyObject
virtual std::shared_ptr< ReplyObject > addReplyObject(XsXbusMessageId messageId, uint8_t data)
communicator.h
XsDevice::writeEmtsPage
virtual XSNOEXPORT bool writeEmtsPage(uint8_t const *data, int pageNr, int bankNr)
XsDevice::makeOperational
virtual bool makeOperational()
Sets the Awinda station to operational state.
Definition: xsdevice_def.cpp:3778
XsDevice::doTransaction
bool doTransaction(const XsMessage &snd) const
xsens_threadpool.h
Communicator::destroy
void destroy()
Destroys the communicator.
Definition: communicator.cpp:344
xsens::LockSuspendable
A readers-writer lock class that is able to be suspended.
Definition: xsens_mutex.h:1344
XSO_KeepLastLiveData
@ XSO_KeepLastLiveData
Keep the last available live data in a cache so XsDevice::lastAvailableLiveData will work.
Definition: xsoption.h:82
XsMtDeviceConfiguration::m_fwRevMinor
uint8_t m_fwRevMinor
The minor version of the firmware.
Definition: xsdeviceconfiguration.h:108
XsOutputConfiguration
Single data type output configuration.
Definition: xsoutputconfiguration.h:96
XsDevice::scheduleOrientationReset
virtual bool scheduleOrientationReset(XsResetMethod method)
XMID_SetOptionFlags
@ XMID_SetOptionFlags
Definition: xsxbusmessageid.h:199
XBR_Invalid
XBR_Invalid
Not a valid baud rate.
Definition: xsbaudrate.h:126
XRV_INVALIDOPERATION
@ XRV_INVALIDOPERATION
265: Operation is invalid at this point
Definition: xsresultvalue.h:135
messageserializer.h
CallbackManagerXda::onError
void onError(XsDevice *dev, XsResultValue error) override
The Xscallback::onError() callback forwarding function.
Definition: callbackmanagerxda.cpp:508
XsDevice::setDeviceRejected
virtual bool setDeviceRejected(const XsDeviceId &deviceId)
Rejects a device.
Definition: xsdevice_def.cpp:3739
XsDevice::setGnssPlatform
XSNOEXPORT virtual XSDEPRECATED bool setGnssPlatform(XsGnssPlatform gnssPlatform)
XSO_RetainBufferedData
@ XSO_RetainBufferedData
Keep the buffered data in a cache so it can be accessed through XsDevice::getDataPacketByIndex or XsD...
Definition: xsoption.h:84
XACM_None
@ XACM_None
No access control mode defined, do not use in 'set' function. Devices that support Access Control are...
Definition: xsaccesscontrolmode.h:76
XsDevice::logFileSize
XsFilePos logFileSize() const
Get the size of the log file the device is reading from.
Definition: xsdevice_def.cpp:3219
XOP_LiveStream
@ XOP_LiveStream
Definition: xsoperationalmode.h:71
Communicator::closePort
virtual void closePort()=0
Closes the open port.
XsDevice::setBlueToothEnabled
virtual bool setBlueToothEnabled(bool enabled)
Enable or disable the BlueTooth radio of the device.
Definition: xsdevice_def.cpp:2422
XMID_SetBaudrate
@ XMID_SetBaudrate
Definition: xsxbusmessageid.h:114
XsFilePos
int64_t XsFilePos
The type that is used for positioning inside a file.
Definition: xsfilepos.h:102
XsString
A 0-terminated managed string of characters.
XsDevice::clearExternalPacketCaches
virtual void clearExternalPacketCaches()
XsDevice::m_linearPacketCache
std::deque< XsDataPacket * > m_linearPacketCache
A linear data packet cache.
Definition: xsdevice_def.h:780
XsDevice::writeFilterStateToFile
virtual void writeFilterStateToFile()
XsDevice
Definition: xsdevice_def.h:164
XsDevice::supportedSyncSettings
virtual XsSyncSettingArray supportedSyncSettings() const
Get all supported synchronization settings available on the device.
Definition: xsdevice_def.cpp:3175
XsDevice::deinitializeSoftwareCalibration
virtual void XSNOEXPORT deinitializeSoftwareCalibration()
XSO_ExpectNoRetransmissionsInFile
@ XSO_ExpectNoRetransmissionsInFile
When set and reading a file, missing data is immediately treated as unavailable. The default behaviou...
Definition: xsoption.h:92
XsDevice::extractFirmwareVersion
void extractFirmwareVersion(XsMessage const &message)
XsDevice::latestBufferedPacketConst
XsDataPacket const & latestBufferedPacketConst() const
Definition: xsdevice_def.h:596
XsDevice::setCanConfiguration
virtual bool setCanConfiguration(uint32_t config)
Set the CAN configuration for this device.
Definition: xsdevice_def.cpp:1198
XsDevice::hasDataEnabled
virtual bool hasDataEnabled(XsDataIdentifier dataType) const
Returns if the currently configured output contains dataType.
Definition: xsdevice_def.cpp:632
XsDevice::dataLength
virtual int dataLength() const
Returns the length of the data in the legacy MTData packets that the device will send in measurement ...
Definition: xsdevice_def.cpp:825
xsens
Definition: threading.cpp:78
XsDevice::syncRole
virtual XsSyncRole syncRole() const
Returns the synchronization role of the device.
Definition: xsdevice_def.cpp:1821
XsDevice::m_isInitialized
bool m_isInitialized
Is intialized boolean variable.
Definition: xsdevice_def.h:736
XsDevice::cacheSize
int cacheSize() const
Get the number of items currently in the slow data cache for the device.
Definition: xsdevice_def.cpp:3131
XsDevice::processedOutputConfiguration
virtual XsOutputConfigurationArray processedOutputConfiguration() const
Return the full output configuration including post processing outputs.
Definition: xsdevice_def.cpp:1209
XsDevice::setSkipEmtsReadOnInit
XSNOEXPORT void setSkipEmtsReadOnInit(bool skip)
XsDevice::restartFilter
virtual void restartFilter()
Restart the software filter used by this device.
Definition: xsdevice_def.cpp:785
XsDevice::errorMode
virtual XsErrorMode errorMode() const
Returns the error mode of the device.
Definition: xsdevice_def.cpp:2463
msgToString
std::string msgToString(XsMessage const &msg)
Definition: xsdevice_def.cpp:147
Synchronization::timeResolutionInMicroseconds
unsigned int timeResolutionInMicroseconds(XsDeviceId const &deviceId)
Definition: supportedsyncsettings.cpp:140
XsDevice::handleNonDataMessage
virtual XSNOEXPORT void handleNonDataMessage(const XsMessage &msg)
XsDevice::setDeviceOptionFlags
virtual bool setDeviceOptionFlags(XsDeviceOptionFlag setFlags, XsDeviceOptionFlag clearFlags)
Set the device option flags.
Definition: xsdevice_def.cpp:1112
supportedsyncsettings.h
XsDevice::defaultChildConnectivityState
virtual XsConnectivityState defaultChildConnectivityState() const
XsDevice::isLoadLogFileInProgress
bool isLoadLogFileInProgress() const
Returns true if the file operation started by loadLogFile is still in progress.
Definition: xsdevice_def.cpp:4349
XsTimeStamp
This class contains method to set, retrieve and compare timestamps.
Definition: xstimestamp.h:115
XsDevice::setBusPowerEnabled
virtual bool setBusPowerEnabled(bool enabled)
Tell the Xbus to provide power to its child devices or not.
Definition: xsdevice_def.cpp:2444
XSO_None
@ XSO_None
No option.
Definition: xsoption.h:78
XDI_TypeMask
@ XDI_TypeMask
Mask for checking the group which a dataidentifier belongs to, Eg. XDI_TimestampGroup or XDI_Orientat...
Definition: xsdataidentifier.h:87
XsDevice::m_master
XsDevice * m_master
A device object.
Definition: xsdevice_def.h:727
XsDevice::updatePortInfo
virtual XsResultValue updatePortInfo(XsPortInfo const &newInfo)
Update the connection information, this is only useful for devices communicating over a dynamic link ...
Definition: xsdevice_def.cpp:4620
XsDevice::isFixedGravityEnabled
virtual bool isFixedGravityEnabled() const
Returns if the fixed gravity value should be used or if it should be computed from the initialPositio...
Definition: xsdevice_def.cpp:2923
XsDeviceOptionFlag
XsDeviceOptionFlag
Used to enable or disable some device options.
Definition: xsdeviceoptionflag.h:75
XsDevice::getStopRecordingPacketId
int64_t getStopRecordingPacketId() const
Return the ID of the last packet that should be recorded.
Definition: xsdevice_def.cpp:4383
XsDevice::triggerStartRecording
virtual bool triggerStartRecording()
Start recording incoming data through generating a virtual input trigger.
Definition: xsdevice_def.cpp:2191
xsens::LockGuarded
A guarded lock class.
Definition: xsens_mutex.h:1569
XsDevice::lastResultText
XsString lastResultText() const
Get the accompanying error text for the value returned by lastResult() It may provide situation-speci...
Definition: xsdevice_def.cpp:804
XsAlignmentFrame
XsAlignmentFrame
Alignment frame.
Definition: xsalignmentframe.h:74
xsdeviceidarray.h
XsDeviceIdArray
struct XsDeviceIdArray XsDeviceIdArray
Definition: xsdeviceidarray.h:80
XsDevice::latestLivePacketId
virtual int64_t latestLivePacketId() const
XCS_Disconnected
@ XCS_Disconnected
Definition: xsconnectivitystate.h:80
xsintarray.h
XsDevice::batteryLevelTime
virtual XsTimeStamp batteryLevelTime()
Requests the time the battery level was last updated.
Definition: xsdevice_def.cpp:2981
XsTimeInfo
A structure for storing Time values.
Definition: xstimeinfo.h:87
XMID_ReqFirmwareRevision
@ XMID_ReqFirmwareRevision
Definition: xsxbusmessageid.h:103
XsDevice::setLocationId
virtual bool setLocationId(int id)
Set the location ID of the device.
Definition: xsdevice_def.cpp:2506
XsDevice::hasProcessedDataEnabled
virtual bool hasProcessedDataEnabled(XsDataIdentifier dataType) const
Returns if the currently configured output contains dataType after processing on the host.
Definition: xsdevice_def.cpp:665


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20