xsdeviceid.c
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 "xsdeviceid.h"
66 #include "xsstring.h"
67 #include "xsdid.h"
68 #include <stdio.h>
69 #include <stdlib.h>
70 #include <ctype.h>
71 
81 uint64_t XsDeviceId_legacyBit(const struct XsDeviceId* thisPtr)
82 {
83  (void)thisPtr;
84  return XS_DID64_BIT;
85 }
86 
90 int XsDeviceId_isLegacyDeviceId(const struct XsDeviceId* thisPtr)
91 {
92  return ((thisPtr->m_deviceId & XS_DID64_BIT) == 0);
93 }
94 
98 int XsDeviceId_isMtiX(const struct XsDeviceId* thisPtr)
99 {
100  if (XsDeviceId_isLegacyDeviceId(thisPtr))
101  return ((thisPtr->m_deviceId & XS_DID_TYPEH_MASK) == XS_DID_TYPEH_MT_X_MPU);
102  else
103  {
104  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
105  return 0;
106  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
107  return ((deviceFamily != 0) && (deviceFamily < 10));
108  }
109 }
110 
114 int XsDeviceId_isMtiX0(const struct XsDeviceId* thisPtr)
115 {
116  if (XsDeviceId_isLegacyDeviceId(thisPtr))
117  return ((thisPtr->m_deviceId & XS_DID_TYPEH_MASK) == XS_DID_TYPEH_MT_X0);
118  else
119  {
120  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
121  return 0;
122  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
123  return ((deviceFamily != 0) && ((deviceFamily >= 10) && (deviceFamily < 100)));
124  }
125 }
126 
130 int XsDeviceId_isMtiX00(const struct XsDeviceId* thisPtr)
131 {
132  if (XsDeviceId_isLegacyDeviceId(thisPtr))
133  return ((thisPtr->m_deviceId & XS_DID_TYPEH_MASK) == XS_DID_TYPEH_MT_X00);
134  else
135  {
136  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
137  return 0;
138  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
139  if ((deviceFamily != 0) && (deviceFamily >= 100 && deviceFamily <= 300))
140  return 1;
141  else if (memcmp(thisPtr->m_productCode, "MTi-G-", 6) == 0)
142  {
143  deviceFamily = atoi(&thisPtr->m_productCode[6]);
144  if ((deviceFamily != 0) && (deviceFamily >= 100))
145  return 1;
146  }
147  }
148  return 0;
149 }
150 
154 int XsDeviceId_isMtigX00(const struct XsDeviceId* thisPtr)
155 {
156  if (XsDeviceId_isLegacyDeviceId(thisPtr))
157  {
158  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_700) &&
160  }
161  else
162  {
163  if (memcmp(thisPtr->m_productCode, "MTi-G-", 6) != 0)
164  return 0;
165 
166  int deviceFamily = atoi(&thisPtr->m_productCode[6]);
167  return ((deviceFamily != 0) && (deviceFamily == 700));
168  }
169 }
170 
174 int XsDeviceId_isMtigX10(const struct XsDeviceId* thisPtr)
175 {
176  if (XsDeviceId_isLegacyDeviceId(thisPtr))
177  {
178  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_700) &&
180  }
181  else
182  {
183  if (memcmp(thisPtr->m_productCode, "MTi-G-", 6) != 0)
184  return 0;
185 
186  int deviceFamily = atoi(&thisPtr->m_productCode[6]);
187  return ((deviceFamily != 0) && (deviceFamily == 710));
188  }
189 }
190 
194 int XsDeviceId_isMti6X0(const struct XsDeviceId* thisPtr)
195 {
196  if (XsDeviceId_isLegacyDeviceId(thisPtr))
197  return 0;
198  else
199  {
200  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
201  return 0;
202 
203  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
204  return ((deviceFamily != 0) && ((deviceFamily > 600) && (deviceFamily < 700)));
205  }
206 }
207 
211 int XsDeviceId_isMti8X0(const struct XsDeviceId* thisPtr)
212 {
213  if (XsDeviceId_isLegacyDeviceId(thisPtr))
214  return 0;
215  else
216  {
217  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
218  return 0;
219 
220  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
221  return ((deviceFamily != 0) && ((deviceFamily > 800) && (deviceFamily < 900)));
222  }
223 }
224 
228 int XsDeviceId_isMti3X0(const struct XsDeviceId* thisPtr)
229 {
230  if (XsDeviceId_isLegacyDeviceId(thisPtr))
231  return ((thisPtr->m_deviceId & XS_DID_TYPEH_MASK) == XS_DID_TYPEH_MT_3X0);
232  else
233  return 0;
234 }
235 
239 int XsDeviceId_isGlove(const struct XsDeviceId* thisPtr)
240 {
241  if (XsDeviceId_isLegacyDeviceId(thisPtr))
242  {
244  return 1;
245 
246  return 0;
247  }
248  else
249  {
250  if (memcmp(thisPtr->m_productCode, "Glove", 5) != 0)
251  return 0;
252 
253  return 1;
254  }
255 }
256 
261 XsHandId XsDeviceId_side(struct XsDeviceId const* thisPtr)
262 {
263  if (XsDeviceId_isLegacyDeviceId(thisPtr))
264  {
265  if (thisPtr->m_deviceId == XS_DID_GLOVEMASTER_LEFT)
266  return XHI_LeftHand;
267  if (thisPtr->m_deviceId == XS_DID_GLOVEMASTER_RIGHT)
268  return XHI_RightHand;
269  return XHI_Unknown;
270  }
271  else
272  {
273  if (memcmp(thisPtr->m_productCode, "Glove", 5) != 0)
274  return XHI_Unknown;
275 
276  switch (thisPtr->m_productCode[8])
277  {
278  case 'L':
279  return XHI_LeftHand;
280  case 'R':
281  return XHI_RightHand;
282  default:
283  return XHI_Unknown;
284  }
285  }
286 }
287 
291 int XsDeviceId_isDot(struct XsDeviceId const* thisPtr)
292 {
293  if (XsDeviceId_isLegacyDeviceId(thisPtr))
294  return 0;
295  else
296  {
297  if (memcmp(thisPtr->m_productCode, "XS-", 3) != 0)
298  return 0;
299 
300  return 1;
301  }
302 }
303 
307 int XsDeviceId_isRugged(struct XsDeviceId const* thisPtr)
308 {
309  if (XsDeviceId_isMti6X0(thisPtr) || XsDeviceId_isMti8X0(thisPtr))
310  {
311  if (thisPtr->m_productCode[7] == 'R' || thisPtr->m_productCode[7] == 'G')
312  return 1;
313  }
314  return 0;
315 
316 }
317 
321 int XsDeviceId_hasInternalGnss(struct XsDeviceId const* thisPtr)
322 {
323  if (XsDeviceId_isMti6X0(thisPtr) || XsDeviceId_isMti8X0(thisPtr))
324  {
325  if (thisPtr->m_productCode[7] == 'G')
326  return 1;
327  }
328  if (XsDeviceId_isMtigX10(thisPtr))
329  return 1;
330  return 0;
331 
332 }
333 
337 int XsDeviceId_isMtw(const struct XsDeviceId* thisPtr)
338 {
339  return XsDeviceId_isMtw2(thisPtr);
340 }
341 
345 int XsDeviceId_isMtw2(const struct XsDeviceId* thisPtr)
346 {
347  if (XsDeviceId_isLegacyDeviceId(thisPtr))
348  return XS_DID_MTW2(thisPtr->m_deviceId);
349  else
350  return (memcmp(thisPtr->m_productCode, "MTw2", 4) == 0);
351 }
352 
356 int XsDeviceId_isMtx(const struct XsDeviceId* thisPtr)
357 {
358  return XsDeviceId_isMtx2(thisPtr);
359 }
360 
364 int XsDeviceId_isMtx2(const struct XsDeviceId* thisPtr)
365 {
366  if (XsDeviceId_isLegacyDeviceId(thisPtr))
367  return XS_DID_MTX2(thisPtr->m_deviceId);
368  else
369  return (memcmp(thisPtr->m_productCode, "MTx2", 4) == 0);
370 }
371 
375 int XsDeviceId_isBodyPack(const struct XsDeviceId* thisPtr)
376 {
377  if (XsDeviceId_isLegacyDeviceId(thisPtr))
378  return XS_DID_BODYPACK(thisPtr->m_deviceId) || (thisPtr->m_deviceId == XS_DID_ABMCLOCKMASTER);
379  else
380  return ((memcmp(thisPtr->m_productCode, "BodyPack", 8) == 0) || (memcmp(thisPtr->m_productCode, "BPACK", 5) == 0));
381 }
382 
386 int XsDeviceId_isBodyPackV1(const struct XsDeviceId* thisPtr)
387 {
388  if (XsDeviceId_isLegacyDeviceId(thisPtr))
389  return XS_DID_BODYPACK(thisPtr->m_deviceId) || (thisPtr->m_deviceId == XS_DID_ABMCLOCKMASTER);
390  else
391  return 0; // all BPv1 devices use legacy device IDs
392 }
393 
397 int XsDeviceId_isBodyPackV2(const struct XsDeviceId* thisPtr)
398 {
399  if (!XsDeviceId_isLegacyDeviceId(thisPtr))
400  return memcmp(thisPtr->m_productCode, "BPACK-V2", 8) == 0;
401  else
402  return 0; // all BPv2 devices use big device IDs
403 }
404 
408 int XsDeviceId_isWirelessMaster(const struct XsDeviceId* thisPtr)
409 {
410  if (XsDeviceId_isLegacyDeviceId(thisPtr))
411  {
412  return ((thisPtr->m_deviceId & XS_DID_TYPEH_MASK) == XS_DID_TYPEH_AWINDAMASTER) &&
413  !XsDeviceId_isBodyPack(thisPtr) &&
414  !XsDeviceId_isSyncStationX(thisPtr);
415  }
416  else
417  return (memcmp(thisPtr->m_productCode, "AW-", 3) == 0);
418 }
419 
423 int XsDeviceId_isAwindaX(const struct XsDeviceId* thisPtr)
424 {
425  return XsDeviceId_isAwinda2(thisPtr);
426 }
427 
431 int XsDeviceId_isAwindaXStation(const struct XsDeviceId* thisPtr)
432 {
433  return XsDeviceId_isAwinda2Station(thisPtr);
434 }
435 
439 int XsDeviceId_isAwindaXDongle(const struct XsDeviceId* thisPtr)
440 {
441  return XsDeviceId_isAwinda2Dongle(thisPtr);
442 }
443 
447 int XsDeviceId_isAwindaXOem(const struct XsDeviceId* thisPtr)
448 {
449  return XsDeviceId_isAwinda2Oem(thisPtr);
450 }
451 
455 int XsDeviceId_isAwinda2(const struct XsDeviceId* thisPtr)
456 {
457  if (XsDeviceId_isLegacyDeviceId(thisPtr))
458  return XS_DID_AWINDA2(thisPtr->m_deviceId);
459  else
460  return (memcmp(thisPtr->m_productCode, "AW-", 3) == 0);
461 }
462 
466 int XsDeviceId_isAwinda2Station(const struct XsDeviceId* thisPtr)
467 {
468  if (XsDeviceId_isLegacyDeviceId(thisPtr))
469  return XS_DID_AWINDA2_STATION(thisPtr->m_deviceId);
470  else
471  return memcmp(thisPtr->m_productCode, "AW-A2", 5) == 0;
472 }
473 
477 int XsDeviceId_isAwinda2Dongle(const struct XsDeviceId* thisPtr)
478 {
479  if (XsDeviceId_isLegacyDeviceId(thisPtr))
480  return XS_DID_AWINDA2_DONGLE(thisPtr->m_deviceId);
481  else
482  return memcmp(thisPtr->m_productCode, "AW-DNG2", 7) == 0;
483 }
484 
488 int XsDeviceId_isAwinda2Oem(const struct XsDeviceId* thisPtr)
489 {
490  return XS_DID_AWINDA2_OEM(thisPtr->m_deviceId);
491 }
492 
496 int XsDeviceId_isSyncStationX(const struct XsDeviceId* thisPtr)
497 {
498  return XS_DID_SYNCSTATION(thisPtr->m_deviceId);
499 }
500 
504 int XsDeviceId_isSyncStation2(const struct XsDeviceId* thisPtr)
505 {
506  return XS_DID_SYNCSTATION2(thisPtr->m_deviceId);
507 }
508 
512 int XsDeviceId_isHilDevice(const struct XsDeviceId* thisPtr)
513 {
514  if (XsDeviceId_isLegacyDeviceId(thisPtr))
515  return 0;
516  else
517  return strcmp(thisPtr->m_productCode, "HILDEVICE") == 0;
518 }
519 
523 int XsDeviceId_isImu(const struct XsDeviceId* thisPtr)
524 {
525  if (XsDeviceId_isLegacyDeviceId(thisPtr))
526  {
527  return (((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_1_MPU) ||
531  }
532  else
533  {
534  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
535  return 0;
536 
537  int deviceFamily = thisPtr->m_productCode[4] - '0';
538  if (deviceFamily == 0)
539  return 0;
540 
541  if (deviceFamily == 6 || deviceFamily == 8)
542  deviceFamily = thisPtr->m_productCode[5] - '0';
543 
544  return (deviceFamily == 1);
545  }
546 }
547 
551 int XsDeviceId_isVru(const struct XsDeviceId* thisPtr)
552 {
553  if (XsDeviceId_isLegacyDeviceId(thisPtr))
554  {
555  return (((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_2_MPU) ||
559  }
560  else
561  {
562  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
563  return 0;
564 
565  int deviceFamily = thisPtr->m_productCode[4] - '0';
566  if (deviceFamily == 0)
567  return 0;
568 
569  if (deviceFamily == 6 || deviceFamily == 8)
570  deviceFamily = thisPtr->m_productCode[5] - '0';
571 
572  return (deviceFamily == 2);
573  }
574 }
575 
579 int XsDeviceId_isAhrs(const struct XsDeviceId* thisPtr)
580 {
581  if (XsDeviceId_isLegacyDeviceId(thisPtr))
582  {
583  return (((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_3_MPU) ||
587  }
588  else
589  {
590  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
591  return 0;
592 
593  int deviceFamily = thisPtr->m_productCode[4] - '0';
594  if (deviceFamily == 0)
595  return 0;
596 
597  if (deviceFamily == 6 || deviceFamily == 8)
598  deviceFamily = thisPtr->m_productCode[5] - '0';
599 
600  return (deviceFamily == 3);
601  }
602 }
603 
607 int XsDeviceId_isGnss(const struct XsDeviceId* thisPtr)
608 {
609  if (XsDeviceId_isLegacyDeviceId(thisPtr))
610  {
611  return (((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_700) ||
614  }
615  else
616  {
617  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
618  return 0;
619 
620  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
621  if (deviceFamily == 7)
622  return 1;
623  else if ((deviceFamily == 670) || (deviceFamily == 680) || (deviceFamily == 870) || (deviceFamily == 880))
624  return 1;
625  else
626  {
627  if (memcmp(thisPtr->m_productCode, "MTi-G-", 6) != 0)
628  return 0;
629 
630  deviceFamily = atoi(&thisPtr->m_productCode[6]);
631  return (deviceFamily == 700 || deviceFamily == 710);
632  }
633  }
634 }
635 
639 int XsDeviceId_isRtk(const struct XsDeviceId* thisPtr)
640 {
641  if (XsDeviceId_isLegacyDeviceId(thisPtr))
642  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_8_MPU);
643  else
644  {
645  if (memcmp(thisPtr->m_productCode, "MTi-", 4) != 0)
646  return 0;
647 
648  int deviceFamily = atoi(&thisPtr->m_productCode[4]);
649  return ((deviceFamily == 680) || (deviceFamily == 880));
650  }
651 }
652 
656 int XsDeviceId_isContainerDevice(const struct XsDeviceId* thisPtr)
657 {
658  return XsDeviceId_isBodyPack(thisPtr) || XsDeviceId_isWirelessMaster(thisPtr);
659 }
660 
664 int XsDeviceId_isMt(const struct XsDeviceId* thisPtr)
665 {
666  return (XsDeviceId_isMti(thisPtr) || XsDeviceId_isMtig(thisPtr) || XsDeviceId_isMtw(thisPtr) || XsDeviceId_isMtx(thisPtr));
667 }
668 
672 int XsDeviceId_isMti(const struct XsDeviceId* thisPtr)
673 {
674  return (XsDeviceId_isMtiX(thisPtr) || XsDeviceId_isMtiX0(thisPtr) || XsDeviceId_isMtiX00(thisPtr) || XsDeviceId_isMti3X0(thisPtr) || XsDeviceId_isMti6X0(thisPtr) || XsDeviceId_isMti8X0(thisPtr));
675 }
676 
680 int XsDeviceId_isMtig(const struct XsDeviceId* thisPtr)
681 {
682  return (XsDeviceId_isMtigX00(thisPtr) || XsDeviceId_isMtigX10(thisPtr));
683 }
684 
688 int XsDeviceId_isMtMark4(const struct XsDeviceId* thisPtr)
689 {
690  if (XsDeviceId_isLegacyDeviceId(thisPtr))
691  return (XsDeviceId_isMtiX0(thisPtr) || XsDeviceId_isMtiX00(thisPtr)) && ((thisPtr->m_deviceId & XS_DID_TYPEL_MK5) != XS_DID_TYPEL_MK5);
692  else
693  return (XsDeviceId_isMtiX0(thisPtr) || XsDeviceId_isMtiX00(thisPtr)) && thisPtr->m_hardwareVersion < 0x300;
694 }
695 
699 int XsDeviceId_isMtMark5(const struct XsDeviceId* thisPtr)
700 {
701  if (XsDeviceId_isLegacyDeviceId(thisPtr))
702  return (XsDeviceId_isMtiX0(thisPtr) || XsDeviceId_isMtiX00(thisPtr)) && ((thisPtr->m_deviceId & XS_DID_TYPEL_MK5) == XS_DID_TYPEL_MK5);
703  else
704  return (XsDeviceId_isMtiX0(thisPtr) || XsDeviceId_isMtiX00(thisPtr)) && thisPtr->m_hardwareVersion >= 0x300;
705 }
706 
707 //------------------------------------------------------------------------------------------------------------
708 //------------------------------------------------------------------------------------------------------------
709 //------------------------------------------------------------------------------------------------------------
710 //------------------------------------------------------------------------------------------------------------
711 
715 void XsDeviceId_toString(const XsDeviceId* thisPtr, XsString* str)
716 {
717  if (XsDeviceId_isLegacyDeviceId(thisPtr))
718  {
719  char device[9];
720  sprintf(device, "%08" PRINTF_INT32_MODIFIER "X", (uint32_t)thisPtr->m_deviceId);
721  XsString_assign(str, 8, device);
722  }
723  else
724  {
725  XsSize n;
726  char device[23];
727  if (thisPtr->m_subDevice)
728  n = (XsSize)(ptrdiff_t) sprintf(device, "%010" PRINTF_INT64_MODIFIER "X/%hu", thisPtr->m_deviceId, (unsigned short int) thisPtr->m_subDevice);
729  else
730  n = (XsSize)(ptrdiff_t) sprintf(device, "%010" PRINTF_INT64_MODIFIER "X", thisPtr->m_deviceId);
731  XsString_assign(str, n, device);
732  }
733 }
734 
738 void XsDeviceId_fromString(XsDeviceId* thisPtr, const XsString* str)
739 {
740  uint64_t tmp = 0;
741  uint16_t sub = 0;
742  if (!thisPtr || !str || !str->m_data)
743  return;
744 
745  if (isalpha(str->m_data[0]))
746  return;
747 
748  int result = sscanf(str->m_data, "%" PRINTF_INT64_MODIFIER "x/%hu", &tmp, &sub);
749  if (result >= 1)
750  thisPtr->m_deviceId = tmp;
751  if (result >= 2)
752  thisPtr->m_subDevice = sub;
753  else
754  thisPtr->m_subDevice = 0;
755 }
756 
761 void XsDeviceId_toDeviceTypeString(const XsDeviceId* thisPtr, XsString* str, int makeType)
762 {
763  XsDeviceId deviceType = XSDEVICEID_INITIALIZER;
764  if (makeType)
765  XsDeviceId_deviceType(thisPtr, 1, &deviceType);
766  else
767  deviceType = *thisPtr;
768  char device[50];
769  XsSize n;
770  if (thisPtr->m_hardwareVersion == 0)
771  n = (XsSize)(ptrdiff_t) sprintf(device, "%s%s%08X.%08X", deviceType.m_productCode, deviceType.m_productCode[0] ? "_" : "", (uint32_t)deviceType.m_deviceId, thisPtr->m_productVariant);
772  else
773  n = (XsSize)(ptrdiff_t) sprintf(device, "%s%s%08X.%08X.%d_%d", deviceType.m_productCode, deviceType.m_productCode[0] ? "_" : "", (uint32_t)deviceType.m_deviceId, thisPtr->m_productVariant, (uint8_t)((thisPtr->m_hardwareVersion & 0xFF00) >> 8), (uint8_t)(thisPtr->m_hardwareVersion & 0xFF));
774  XsString_assign(str, n, device);
775 }
776 
781 {
782  uint32_t id = 0;
783  int hwRevH = 0, hwRevL = 0;
784  uint32_t variant;
785  char productCode[24];
786  if (!thisPtr || !str || !str->m_data)
787  return;
788  int result = sscanf(str->m_data, "%24[^_]_%08X.%08X.%d_%d", productCode, &id, &variant, &hwRevH, &hwRevL);
789  if (result == 5 || result == 3)
790  {
791  thisPtr->m_deviceId = id;
792  thisPtr->m_hardwareVersion = (uint16_t)((uint16_t)hwRevH << 8) + (uint16_t)hwRevL;
793  thisPtr->m_productVariant = variant;
794  strcpy(thisPtr->m_productCode, productCode);
795  }
796 }
797 
801 int XsDeviceId_isValid(const struct XsDeviceId* thisPtr)
802 {
803  if (XsDeviceId_isLegacyDeviceId(thisPtr))
804  return thisPtr->m_deviceId != 0;
805  else
806  return thisPtr->m_productCode[0] != 0 && thisPtr->m_deviceId != 0;
807 }
808 
814 {
815  XsDeviceId tmp = *a;
816  *a = *b;
817  *b = tmp;
818 }
819 
824 int XsDeviceId_contains(XsDeviceId const* thisPtr, XsDeviceId const* other)
825 {
826  if (thisPtr == other)
827  return 1;
828  if (thisPtr->m_deviceId == other->m_deviceId)
829  return 1;
830  if (thisPtr->m_deviceId & XS_DID_ID_MASK) // NOTE: This produces incorrect results for device ids ending with 0000. See MVN-3876
831  return 0;
832  XsDeviceId typeThis, typeOther;
833  XsDeviceId_deviceType(thisPtr, 1, &typeThis);
834  XsDeviceId_deviceType(other, 1, &typeOther);
835  if (XsDeviceId_isLegacyDeviceId(thisPtr))
836  return typeThis.m_deviceId == typeOther.m_deviceId;
837  else
838  {
839  if (strcmp(typeThis.m_productCode, typeOther.m_productCode) == 0)
840  return 1;
841  }
842 
843  return 0;
844 }
845 
849 int XsDeviceId_isType(XsDeviceId const* thisPtr)
850 {
851  // true when we have a valid type (not a broadcast) and a 0 ID
852  if (XsDeviceId_isLegacyDeviceId(thisPtr))
853  return !(thisPtr->m_deviceId & XS_DID_ID_MASK);
854  else
855  return !(thisPtr->m_deviceId & ~XS_DID64_BIT);
856 }
857 
861 void XsDeviceId_typeName(XsDeviceId const* thisPtr, XsString* str)
862 {
863  if (!str)
864  return;
865 
866  if (!thisPtr)
867  {
868  XsString_assignCharArray(str, "invalid");
869  return;
870  }
871 
872  if (XsDeviceId_isAwinda2Station(thisPtr))
873  XsString_assignCharArray(str, "Awinda Station v2");
874  else if (XsDeviceId_isAwinda2Dongle(thisPtr))
875  XsString_assignCharArray(str, "Awinda Dongle v2");
876  else if (XsDeviceId_isAwinda2Oem(thisPtr))
877  XsString_assignCharArray(str, "Awinda OEM v2");
878  else if (XsDeviceId_isMtw2(thisPtr))
879  XsString_assignCharArray(str, "MTw2");
880  else if (XsDeviceId_isMtx2(thisPtr))
881  XsString_assignCharArray(str, "MTx2");
882  else if (XsDeviceId_isBodyPackV2(thisPtr))
883  XsString_assignCharArray(str, "BPACK-V2");
884  else if (XsDeviceId_isBodyPack(thisPtr))
885  XsString_assignCharArray(str, "Bodypack");
886  else if (XsDeviceId_isSyncStation2(thisPtr))
887  XsString_assignCharArray(str, "Sync Station v2");
888  else if (XsDeviceId_isMti6X0(thisPtr))
889  {
890  XsSize length = 7;
891  if (thisPtr->m_productCode[7] != '-')
892  length = 8;
893  XsString_assign(str, length, thisPtr->m_productCode);
894  }
895  else if (XsDeviceId_isMti8X0(thisPtr))
896  {
897  XsSize length = 7;
898  if (thisPtr->m_productCode[7] != '-')
899  length = 8;
900  XsString_assign(str, length, thisPtr->m_productCode);
901  }
902  else if (XsDeviceId_isMti3X0(thisPtr))
903  {
904  if (XsDeviceId_isImu(thisPtr))
905  XsString_assignCharArray(str, "MTi-310");
906  else if (XsDeviceId_isVru(thisPtr))
907  XsString_assignCharArray(str, "MTi-320");
908  else if (XsDeviceId_isAhrs(thisPtr))
909  XsString_assignCharArray(str, "MTi-330");
910  }
911  else if (XsDeviceId_isMtiX(thisPtr) && XsDeviceId_isRtk(thisPtr))
912  XsString_assignCharArray(str, "MTi-8");
913  else if (XsDeviceId_isMtMk4_1(thisPtr))
914  XsString_assignCharArray(str, "MTi-1");
915  else if (XsDeviceId_isMtMk4_2(thisPtr))
916  XsString_assignCharArray(str, "MTi-2");
917  else if (XsDeviceId_isMtMk4_3(thisPtr))
918  XsString_assignCharArray(str, "MTi-3");
919  else if (XsDeviceId_isMtMk4_7(thisPtr))
920  XsString_assignCharArray(str, "MTi-7");
921  else if (XsDeviceId_isMtMk4_10(thisPtr))
922  XsString_assignCharArray(str, "MTi-10");
923  else if (XsDeviceId_isMtMk4_20(thisPtr))
924  XsString_assignCharArray(str, "MTi-20");
925  else if (XsDeviceId_isMtMk4_30(thisPtr))
926  XsString_assignCharArray(str, "MTi-30");
927  else if (XsDeviceId_isMtMk4_100(thisPtr))
928  XsString_assignCharArray(str, "MTi-100");
929  else if (XsDeviceId_isMtMk4_200(thisPtr))
930  XsString_assignCharArray(str, "MTi-200");
931  else if (XsDeviceId_isMtMk4_300(thisPtr))
932  XsString_assignCharArray(str, "MTi-300");
933  else if (XsDeviceId_isMtMk4_400(thisPtr))
934  XsString_assignCharArray(str, "MTi-400");
935  else if (XsDeviceId_isMtMk4_500(thisPtr))
936  XsString_assignCharArray(str, "MTi-500");
937  else if (XsDeviceId_isMtMk4_710(thisPtr))
938  XsString_assignCharArray(str, "MTi-G-710");
939  else if (XsDeviceId_isMtMk4_700(thisPtr))
940  XsString_assignCharArray(str, "MTi-G-700");
941  else if (XsDeviceId_isMtMk4_800(thisPtr))
942  XsString_assignCharArray(str, "MTi-G-800");
943  else if (XsDeviceId_isMtMk4_900(thisPtr))
944  XsString_assignCharArray(str, "MTi-G-900");
945  else if (XsDeviceId_isGlove(thisPtr))
946  XsString_assignCharArray(str, "Glove");
947  else
948  XsString_assignCharArray(str, "Unknown");
949 }
950 
954 void XsDeviceId_type(struct XsDeviceId const* thisPtr, struct XsDeviceId* type)
955 {
956  if (!type)
957  return;
958  if (!XsDeviceId_isLegacyDeviceId(thisPtr))
959  {
960  type->m_deviceId = XS_DID64_BIT;
961  XsString typeName = XsString_INITIALIZER;
962  XsDeviceId_typeName(thisPtr, &typeName);
963  strcpy(type->m_productCode, typeName.m_data);
964  }
965  else
966  type->m_deviceId = thisPtr->m_deviceId & XS_DID_FULLTYPE_MASK;
967 }
968 
973 void XsDeviceId_deviceType(struct XsDeviceId const* thisPtr, int detailed, struct XsDeviceId* type)
974 {
975  if (!type)
976  return;
977  if (!XsDeviceId_isLegacyDeviceId(thisPtr))
978  {
979  if (XsDeviceId_isMti6X0(thisPtr) || XsDeviceId_isMti8X0(thisPtr))
980  {
981  type->m_deviceId = XS_DID64_BIT;
982  strncpy(type->m_productCode, thisPtr->m_productCode, 7);
983  type->m_productCode[7] = 0;
984  if (detailed)
985  {
986  type->m_hardwareVersion = thisPtr->m_hardwareVersion;
987  type->m_productVariant = thisPtr->m_productVariant;
988  }
989  else
990  {
991  type->m_hardwareVersion = 0;
992  type->m_productVariant = 0;
993  }
994  }
995  else
996  {
997  type->m_deviceId = XS_DID64_BIT;
998  strncpy(type->m_productCode, thisPtr->m_productCode, 24);
999  type->m_productCode[23] = 0;
1000  if (detailed)
1001  {
1002  type->m_hardwareVersion = thisPtr->m_hardwareVersion;
1003  type->m_productVariant = thisPtr->m_productVariant;
1004  }
1005  else
1006  {
1007  type->m_hardwareVersion = 0;
1008  type->m_productVariant = 0;
1009  }
1010  }
1011  }
1012  else
1013  {
1014  XsDeviceId_deviceTypeMask(thisPtr, detailed, type);
1015  type->m_deviceId = thisPtr->m_deviceId & type->m_deviceId;
1016  strcpy(type->m_productCode, thisPtr->m_productCode);
1017  }
1018 }
1019 
1024 void XsDeviceId_deviceTypeMask(struct XsDeviceId const* thisPtr, int detailed, struct XsDeviceId* type)
1025 {
1026  if (XsDeviceId_isLegacyDeviceId(thisPtr))
1027  {
1028  if (XsDeviceId_isMti3X0(thisPtr))
1029  type->m_deviceId = (XS_DID_TYPEH_MASK | (detailed ? (XS_DID_GPH_MASK | XS_DID_GPL_MASK) : 0));
1030  else if (XsDeviceId_isMtMk4_X(thisPtr))
1032  else if (XsDeviceId_isMtMk4(thisPtr))
1034  else if (XsDeviceId_isAwindaX(thisPtr))
1035  type->m_deviceId = (XS_DID_TYPEH_MASK | (detailed ? (XS_DID_GPH_MASK | XS_DID_GPL_MASK) : 0));
1036  else if (XsDeviceId_isSyncStationX(thisPtr))
1037  type->m_deviceId = (XS_DID_TYPEH_MASK | (detailed ? (XS_DID_GPH_MASK | XS_DID_GPL_MASK) : 0));
1038  else if (XsDeviceId_isMtw(thisPtr) || XsDeviceId_isMtx(thisPtr))
1039  type->m_deviceId = (XS_DID_TYPE_MASK | (detailed ? (XS_DID_GPH_MASK | XS_DID_GPL_MASK) : 0));
1040  else if (thisPtr->m_deviceId == XS_DID_ABMCLOCKMASTER)
1042  else
1043  type->m_deviceId = XS_DID_TYPEH_MASK;
1044  }
1045  else
1046  type->m_deviceId = XS_DID64_BIT;
1047 }
1048 
1049 //============================================================================================================
1050 //============================================================================================================
1051 //==== Deprecated methods follow =====
1052 //============================================================================================================
1053 //============================================================================================================
1054 
1059 int XsDeviceId_isMtMk4(const struct XsDeviceId* thisPtr)
1060 {
1061  return (XsDeviceId_isMtMk4_X(thisPtr) ||
1062  XsDeviceId_isMtMk4_X0(thisPtr) ||
1063  XsDeviceId_isMtMk4_X00(thisPtr));
1064 }
1065 
1070 int XsDeviceId_isMtMk4_X(const struct XsDeviceId* thisPtr)
1071 {
1072  return XsDeviceId_isMtiX(thisPtr);
1073 }
1074 
1079 int XsDeviceId_isMtMk4_1(const struct XsDeviceId* thisPtr)
1080 {
1081  return XsDeviceId_isMtiX(thisPtr) && XsDeviceId_isImu(thisPtr);
1082 }
1083 
1088 int XsDeviceId_isMtMk4_2(const struct XsDeviceId* thisPtr)
1089 {
1090  return XsDeviceId_isMtiX(thisPtr) && XsDeviceId_isVru(thisPtr);
1091 }
1092 
1097 int XsDeviceId_isMtMk4_3(const struct XsDeviceId* thisPtr)
1098 {
1099  return XsDeviceId_isMtiX(thisPtr) && XsDeviceId_isAhrs(thisPtr);
1100 }
1101 
1106 int XsDeviceId_isMtMk4_7(const struct XsDeviceId* thisPtr)
1107 {
1108  return XsDeviceId_isMtiX(thisPtr) && XsDeviceId_isGnss(thisPtr) && !XsDeviceId_isRtk(thisPtr);
1109 }
1110 
1115 int XsDeviceId_isMtMk4_X0(const struct XsDeviceId* thisPtr)
1116 {
1117  return XsDeviceId_isMtiX0(thisPtr);
1118 }
1119 
1124 int XsDeviceId_isMtMk4_10(const struct XsDeviceId* thisPtr)
1125 {
1126  return XsDeviceId_isMtiX0(thisPtr) && XsDeviceId_isImu(thisPtr);
1127 }
1128 
1133 int XsDeviceId_isMtMk4_20(const struct XsDeviceId* thisPtr)
1134 {
1135  return XsDeviceId_isMtiX0(thisPtr) && XsDeviceId_isVru(thisPtr);
1136 }
1137 
1142 int XsDeviceId_isMtMk4_30(const struct XsDeviceId* thisPtr)
1143 {
1144  return XsDeviceId_isMtiX0(thisPtr) && XsDeviceId_isAhrs(thisPtr);
1145 }
1146 
1151 int XsDeviceId_isMtMk4_X00(const struct XsDeviceId* thisPtr)
1152 {
1153  return XsDeviceId_isMtiX00(thisPtr);
1154 }
1155 
1160 int XsDeviceId_isMtMk4_100(const struct XsDeviceId* thisPtr)
1161 {
1162  return XsDeviceId_isMtiX00(thisPtr) && XsDeviceId_isImu(thisPtr);
1163 }
1164 
1169 int XsDeviceId_isMtMk4_200(const struct XsDeviceId* thisPtr)
1170 {
1171  return XsDeviceId_isMtiX00(thisPtr) && XsDeviceId_isVru(thisPtr);
1172 }
1173 
1178 int XsDeviceId_isMtMk4_300(const struct XsDeviceId* thisPtr)
1179 {
1180  return XsDeviceId_isMtiX00(thisPtr) && XsDeviceId_isAhrs(thisPtr);
1181 }
1182 
1187 int XsDeviceId_isMtMk4_400(const struct XsDeviceId* thisPtr)
1188 {
1189  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_400);
1190 }
1191 
1196 int XsDeviceId_isMtMk4_500(const struct XsDeviceId* thisPtr)
1197 {
1198  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_500);
1199 }
1200 
1205 int XsDeviceId_isMtMk4_600(const struct XsDeviceId* thisPtr)
1206 {
1207  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_600);
1208 }
1209 
1217 int XsDeviceId_isMtMk4_700(const struct XsDeviceId* thisPtr)
1218 {
1219  return XsDeviceId_isMtigX00(thisPtr) || XsDeviceId_isMtigX10(thisPtr);
1220 }
1221 
1226 int XsDeviceId_isMtMk4_710(const struct XsDeviceId* thisPtr)
1227 {
1228  return XsDeviceId_isMtigX10(thisPtr);
1229 }
1230 
1235 int XsDeviceId_isMtMk4_800(const struct XsDeviceId* thisPtr)
1236 {
1237  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_800);
1238 }
1239 
1244 int XsDeviceId_isMtMk4_900(const struct XsDeviceId* thisPtr)
1245 {
1246  return ((thisPtr->m_deviceId & XS_DID_MK4TYPE_MASK) == XS_DID_MK4TYPE_MT_900);
1247 }
1248 
1253 int XsDeviceId_isMtMk5(const struct XsDeviceId* thisPtr)
1254 {
1255  return XsDeviceId_isMtMark5(thisPtr);
1256 }
1257 
1262 int XsDeviceId_isMtMk5_X0(const struct XsDeviceId* thisPtr)
1263 {
1264  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_X0(thisPtr);
1265 }
1266 
1271 int XsDeviceId_isMtMk5_10(const struct XsDeviceId* thisPtr)
1272 {
1273  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_10(thisPtr);
1274 }
1275 
1280 int XsDeviceId_isMtMk5_20(const struct XsDeviceId* thisPtr)
1281 {
1282  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_20(thisPtr);
1283 }
1284 
1289 int XsDeviceId_isMtMk5_30(const struct XsDeviceId* thisPtr)
1290 {
1291  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_30(thisPtr);
1292 }
1293 
1298 int XsDeviceId_isMtMk5_X00(const struct XsDeviceId* thisPtr)
1299 {
1300  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_X00(thisPtr);
1301 }
1302 
1307 int XsDeviceId_isMtMk5_100(const struct XsDeviceId* thisPtr)
1308 {
1309  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_100(thisPtr);
1310 }
1311 
1316 int XsDeviceId_isMtMk5_200(const struct XsDeviceId* thisPtr)
1317 {
1318  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_200(thisPtr);
1319 }
1320 
1325 int XsDeviceId_isMtMk5_300(const struct XsDeviceId* thisPtr)
1326 {
1327  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_300(thisPtr);
1328 }
1329 
1334 int XsDeviceId_isMtMk5_710(const struct XsDeviceId* thisPtr)
1335 {
1336  return XsDeviceId_isMtMk5(thisPtr) && XsDeviceId_isMtMk4_710(thisPtr);
1337 }
1338 
XsDeviceId_isMtMk5_10
int XsDeviceId_isMtMk5_10(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 10.
Definition: xsdeviceid.c:1271
XS_DID_GLOVEMASTER_RIGHT
#define XS_DID_GLOVEMASTER_RIGHT
Definition: xsdid.h:194
xsstring.h
XsDeviceId_isAwindaX
int XsDeviceId_isAwindaX(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda device.
Definition: xsdeviceid.c:423
XS_DID_MK4TYPE_MT_100
#define XS_DID_MK4TYPE_MT_100
Definition: xsdid.h:161
XsDeviceId_isMtMk4_100
int XsDeviceId_isMtMk4_100(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 100.
Definition: xsdeviceid.c:1160
XS_DID_MK4TYPE_MT_10
#define XS_DID_MK4TYPE_MT_10
Definition: xsdid.h:158
XsDeviceId_isMt
int XsDeviceId_isMt(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MT device (any Mti, Mtig, Mtx or Mtw)
Definition: xsdeviceid.c:664
XsDeviceId_isMtMk5_X0
int XsDeviceId_isMtMk5_X0(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 10 series.
Definition: xsdeviceid.c:1262
XsDeviceId_toString
void XsDeviceId_toString(const XsDeviceId *thisPtr, XsString *str)
Get a string with a readable representation of this device ID.
Definition: xsdeviceid.c:715
XsDeviceId_isMtMk4_X
int XsDeviceId_isMtMk4_X(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 1 series.
Definition: xsdeviceid.c:1070
XS_DID_TYPEH_AWINDAMASTER
#define XS_DID_TYPEH_AWINDAMASTER
Definition: xsdid.h:85
XS_DID_TYPEL_MASK
#define XS_DID_TYPEL_MASK
Definition: xsdid.h:69
XS_DID_TYPEH_MT_X00
#define XS_DID_TYPEH_MT_X00
Definition: xsdid.h:87
XsDeviceId_isAwindaXDongle
int XsDeviceId_isAwindaXDongle(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda Dongle.
Definition: xsdeviceid.c:439
XS_DID_MK4TYPE_MT_300
#define XS_DID_MK4TYPE_MT_300
Definition: xsdid.h:163
PRINTF_INT32_MODIFIER
#define PRINTF_INT32_MODIFIER
Definition: pstdint.h:487
XsDeviceId::m_productCode
char m_productCode[XSDEVICEID_PRODUCT_CODE_LEN]
The productcode of a device.
Definition: xsdeviceid.h:906
XS_DID_TYPEL_MK5
#define XS_DID_TYPEL_MK5
Definition: xsdid.h:107
XsDeviceId_deviceTypeMask
void XsDeviceId_deviceTypeMask(struct XsDeviceId const *thisPtr, int detailed, struct XsDeviceId *type)
Returns the mask which can be used to get the detailed device type (eg 10, 300 and Awinda2 Master)
Definition: xsdeviceid.c:1024
XsDeviceId_isBodyPackV2
int XsDeviceId_isBodyPackV2(const struct XsDeviceId *thisPtr)
Test if this device ID represents a bodypack V2 device.
Definition: xsdeviceid.c:397
XsDeviceId_isMtMk4_10
int XsDeviceId_isMtMk4_10(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 10.
Definition: xsdeviceid.c:1124
XsDeviceId_isLegacyDeviceId
int XsDeviceId_isLegacyDeviceId(const struct XsDeviceId *thisPtr)
Test if the device ID represents a legacy device identification.
Definition: xsdeviceid.c:90
XsDeviceId_isMtMk5_300
int XsDeviceId_isMtMk5_300(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 300.
Definition: xsdeviceid.c:1325
XS_DID_MK4TYPE_MT_900
#define XS_DID_MK4TYPE_MT_900
Definition: xsdid.h:169
XsDeviceId_isAwinda2Station
int XsDeviceId_isAwinda2Station(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda2 Station.
Definition: xsdeviceid.c:466
XS_DID_SYNCSTATION
#define XS_DID_SYNCSTATION(did)
Definition: xsdid.h:207
XHI_RightHand
@ XHI_RightHand
The Right Hand.
Definition: xshandid.h:78
XsDeviceId_swap
void XsDeviceId_swap(XsDeviceId *a, XsDeviceId *b)
Swap the contents of a with those of b.
Definition: xsdeviceid.c:813
XsDeviceId_isMtMk4_500
int XsDeviceId_isMtMk4_500(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 500.
Definition: xsdeviceid.c:1196
XsDeviceId_isAwindaXOem
int XsDeviceId_isAwindaXOem(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda OEM board.
Definition: xsdeviceid.c:447
XsDeviceId_isMtMk4_700
int XsDeviceId_isMtMk4_700(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 700.
Definition: xsdeviceid.c:1217
XsDeviceId_isBodyPackV1
int XsDeviceId_isBodyPackV1(const struct XsDeviceId *thisPtr)
Test if this device ID represents a bodypack V1 device.
Definition: xsdeviceid.c:386
XsDeviceId_isMtx
int XsDeviceId_isMtx(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTx.
Definition: xsdeviceid.c:356
XsDeviceId_isSyncStation2
int XsDeviceId_isSyncStation2(const struct XsDeviceId *thisPtr)
Test if this device ID represents a SyncStation v2.
Definition: xsdeviceid.c:504
XsDeviceId_isMti3X0
int XsDeviceId_isMti3X0(const struct XsDeviceId *thisPtr)
Test if the device ID represents an MTi-3X0 device.
Definition: xsdeviceid.c:228
XS_DID_MK4TYPE_MT_2_MPU
#define XS_DID_MK4TYPE_MT_2_MPU
Definition: xsdid.h:151
XsDeviceId_isMtMk5_710
int XsDeviceId_isMtMk5_710(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 710.
Definition: xsdeviceid.c:1334
XsHandId
XsHandId
This is an enumerator that contains the left and right hand.
Definition: xshandid.h:75
XsDeviceId_isMtMk4_300
int XsDeviceId_isMtMk4_300(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 300.
Definition: xsdeviceid.c:1178
XsDeviceId_isMti
int XsDeviceId_isMti(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTi device (1, 10 or 100 series, 1 includes MTi-7)
Definition: xsdeviceid.c:672
XsDeviceId_isMtMk5_30
int XsDeviceId_isMtMk5_30(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 30.
Definition: xsdeviceid.c:1289
XS_DID_MK4TYPE_MT_20
#define XS_DID_MK4TYPE_MT_20
Definition: xsdid.h:159
XS_DID_AWINDA2
#define XS_DID_AWINDA2(did)
Definition: xsdid.h:209
XS_DID_ID_MASK
#define XS_DID_ID_MASK
Definition: xsdid.h:76
XS_DID_MTX2
#define XS_DID_MTX2(did)
Definition: xsdid.h:200
XS_DID_MK4TYPE_MT_700
#define XS_DID_MK4TYPE_MT_700
Definition: xsdid.h:167
XsDeviceId_isMtiX0
int XsDeviceId_isMtiX0(const struct XsDeviceId *thisPtr)
Test if the device ID represents an Mti 10-series device.
Definition: xsdeviceid.c:114
XsDeviceId_isMtMk4_200
int XsDeviceId_isMtMk4_200(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 200.
Definition: xsdeviceid.c:1169
XS_DID_AWINDA2_STATION
#define XS_DID_AWINDA2_STATION(did)
Definition: xsdid.h:202
XS_DID_MK4TYPE_MT_600
#define XS_DID_MK4TYPE_MT_600
Definition: xsdid.h:166
XS_DID_MK4TYPE_MT_200
#define XS_DID_MK4TYPE_MT_200
Definition: xsdid.h:162
XsDeviceId_isBodyPack
int XsDeviceId_isBodyPack(const struct XsDeviceId *thisPtr)
Test if this device ID represents a bodypack (any version) device.
Definition: xsdeviceid.c:375
XsDeviceId_isMtMk4_400
int XsDeviceId_isMtMk4_400(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 400.
Definition: xsdeviceid.c:1187
XsDeviceId_isMtMark4
int XsDeviceId_isMtMark4(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Mk4 generation MT device.
Definition: xsdeviceid.c:688
XsDeviceId_deviceType
void XsDeviceId_deviceType(struct XsDeviceId const *thisPtr, int detailed, struct XsDeviceId *type)
Returns the device type identified by this id (eg 10, 300 and Awinda2 Master)
Definition: xsdeviceid.c:973
XsDeviceId_isMtMk4_X0
int XsDeviceId_isMtMk4_X0(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 10 series.
Definition: xsdeviceid.c:1115
XsDeviceId_isMtMk4
int XsDeviceId_isMtMk4(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4.
Definition: xsdeviceid.c:1059
XsDeviceId_isAwinda2
int XsDeviceId_isAwinda2(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda2 device.
Definition: xsdeviceid.c:455
XS_DID_MK4TYPE_MT_330
#define XS_DID_MK4TYPE_MT_330
Definition: xsdid.h:157
XS_DID_GPL_MASK
#define XS_DID_GPL_MASK
Definition: xsdid.h:71
XsDeviceId_isMtw2
int XsDeviceId_isMtw2(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTw2.
Definition: xsdeviceid.c:345
XsDeviceId_isRtk
int XsDeviceId_isRtk(const struct XsDeviceId *thisPtr)
Test if this device ID represents an RTK (capable) device.
Definition: xsdeviceid.c:639
XS_DID_FULLTYPE_MASK
#define XS_DID_FULLTYPE_MASK
Definition: xsdid.h:77
XsDeviceId_isMtMk4_900
int XsDeviceId_isMtMk4_900(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 900.
Definition: xsdeviceid.c:1244
XsDeviceId_isWirelessMaster
int XsDeviceId_isWirelessMaster(const struct XsDeviceId *thisPtr)
Test if this device ID represents a Wireless Master device (Awinda Station, Awinda Dongle,...
Definition: xsdeviceid.c:408
XS_DID_BODYPACK
#define XS_DID_BODYPACK(did)
Definition: xsdid.h:211
XsDeviceId_isImu
int XsDeviceId_isImu(const struct XsDeviceId *thisPtr)
Test if this device ID represents an IMU.
Definition: xsdeviceid.c:523
XS_DID_TYPEH_MASK
#define XS_DID_TYPEH_MASK
Definition: xsdid.h:70
XsDeviceId_isMtMk4_7
int XsDeviceId_isMtMk4_7(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 7.
Definition: xsdeviceid.c:1106
XsDeviceId_isMtMk4_600
int XsDeviceId_isMtMk4_600(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 600.
Definition: xsdeviceid.c:1205
XS_DID64_BIT
#define XS_DID64_BIT
Definition: xsdid.h:216
XsDeviceId_isAwinda2Oem
int XsDeviceId_isAwinda2Oem(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda2 OEM board.
Definition: xsdeviceid.c:488
XsDeviceId_isMtMk4_20
int XsDeviceId_isMtMk4_20(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 20.
Definition: xsdeviceid.c:1133
XS_DID_MK4TYPE_MT_400
#define XS_DID_MK4TYPE_MT_400
Definition: xsdid.h:164
XsString_INITIALIZER
#define XsString_INITIALIZER
Definition: xsstring.h:85
XsDeviceId_isMtMk4_1
int XsDeviceId_isMtMk4_1(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 1.
Definition: xsdeviceid.c:1079
XsDeviceId_legacyBit
uint64_t XsDeviceId_legacyBit(const struct XsDeviceId *thisPtr)
Definition: xsdeviceid.c:81
XsDeviceId_isValid
int XsDeviceId_isValid(const struct XsDeviceId *thisPtr)
Test if the device ID is a valid id (not 0).
Definition: xsdeviceid.c:801
XsDeviceId_isMtMark5
int XsDeviceId_isMtMark5(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Mk5 generation MT device.
Definition: xsdeviceid.c:699
XS_DID_AWINDA2_OEM
#define XS_DID_AWINDA2_OEM(did)
Definition: xsdid.h:204
XsDeviceId_typeName
void XsDeviceId_typeName(XsDeviceId const *thisPtr, XsString *str)
Returns the name of the type of device identified by this id.
Definition: xsdeviceid.c:861
XS_DID_MK4TYPE_MASK
#define XS_DID_MK4TYPE_MASK
Definition: xsdid.h:75
XsDeviceId_isMtMk4_X00
int XsDeviceId_isMtMk4_X00(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 100 series (including 700 and 710)
Definition: xsdeviceid.c:1151
XsDeviceId_isAwindaXStation
int XsDeviceId_isAwindaXStation(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda Station.
Definition: xsdeviceid.c:431
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
XS_DID_MTW2
#define XS_DID_MTW2(did)
Definition: xsdid.h:199
XsDeviceId::m_productVariant
uint32_t m_productVariant
The product variant of a device.
Definition: xsdeviceid.h:907
XS_DID_MK4TYPE_MT_7_MPU
#define XS_DID_MK4TYPE_MT_7_MPU
Definition: xsdid.h:153
XsDeviceId_isMtMk4_710
int XsDeviceId_isMtMk4_710(const struct XsDeviceId *thisPtr)
Test if this device ID represents either an MTMk4 710 or Mk5 710.
Definition: xsdeviceid.c:1226
XS_DID_MK4TYPE_MT_320
#define XS_DID_MK4TYPE_MT_320
Definition: xsdid.h:156
XsDeviceId_isAhrs
int XsDeviceId_isAhrs(const struct XsDeviceId *thisPtr)
Test if this device ID represents an AHRS.
Definition: xsdeviceid.c:579
XsDeviceId_isMti6X0
int XsDeviceId_isMti6X0(const struct XsDeviceId *thisPtr)
Test if the device ID represents an MTi-600 series device.
Definition: xsdeviceid.c:194
XS_DID_MK4TYPE_MT_500
#define XS_DID_MK4TYPE_MT_500
Definition: xsdid.h:165
XsDeviceId_isMtx2
int XsDeviceId_isMtx2(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTx2.
Definition: xsdeviceid.c:364
XsDeviceId_isMtMk5_200
int XsDeviceId_isMtMk5_200(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 200.
Definition: xsdeviceid.c:1316
XHI_Unknown
@ XHI_Unknown
Used as uninitialized or unknown side.
Definition: xshandid.h:79
XsDeviceId_isMtMk5_20
int XsDeviceId_isMtMk5_20(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 20.
Definition: xsdeviceid.c:1280
XsDeviceId_isMtMk4_800
int XsDeviceId_isMtMk4_800(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 800.
Definition: xsdeviceid.c:1235
XsDeviceId_isSyncStationX
int XsDeviceId_isSyncStationX(const struct XsDeviceId *thisPtr)
Test if this device ID represents a SyncStation.
Definition: xsdeviceid.c:496
XsDeviceId_isMtMk5
int XsDeviceId_isMtMk5(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5.
Definition: xsdeviceid.c:1253
XS_DID_AWINDA2_DONGLE
#define XS_DID_AWINDA2_DONGLE(did)
Definition: xsdid.h:203
XS_DID_TYPEL_COMM_MASK
#define XS_DID_TYPEL_COMM_MASK
Definition: xsdid.h:105
XsDeviceId_isMtig
int XsDeviceId_isMtig(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTig device (700 or 710 series)
Definition: xsdeviceid.c:680
xsdid.h
XsSize
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:74
XS_DID_MK4TYPE_MT_30
#define XS_DID_MK4TYPE_MT_30
Definition: xsdid.h:160
XsDeviceId_side
XsHandId XsDeviceId_side(struct XsDeviceId const *thisPtr)
Return the side the device should be worn on.
Definition: xsdeviceid.c:261
XHI_LeftHand
@ XHI_LeftHand
The Left Hand.
Definition: xshandid.h:77
XsDeviceId_isDot
int XsDeviceId_isDot(struct XsDeviceId const *thisPtr)
Test if the device ID represents a Dot series device.
Definition: xsdeviceid.c:291
xsdeviceid.h
XS_DID_MK4TYPE_MT_8_MPU
#define XS_DID_MK4TYPE_MT_8_MPU
Definition: xsdid.h:154
XsDeviceId_isMtMk5_100
int XsDeviceId_isMtMk5_100(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 100.
Definition: xsdeviceid.c:1307
XS_DID_TYPEH_MT_X0
#define XS_DID_TYPEH_MT_X0
Definition: xsdid.h:86
XS_DID_GLOVEMASTER_LEFT
#define XS_DID_GLOVEMASTER_LEFT
Definition: xsdid.h:193
XsDeviceId
Contains an Xsens device ID and provides operations for determining the type of device.
Definition: xsdeviceid.h:192
XsDeviceId_fromDeviceTypeString
void XsDeviceId_fromDeviceTypeString(XsDeviceId *thisPtr, const XsString *str)
Read a device ID from the supplied string.
Definition: xsdeviceid.c:780
XsDeviceId_type
void XsDeviceId_type(struct XsDeviceId const *thisPtr, struct XsDeviceId *type)
Returns the type of device identified by this id.
Definition: xsdeviceid.c:954
XsDeviceId_isMtMk4_30
int XsDeviceId_isMtMk4_30(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 30.
Definition: xsdeviceid.c:1142
XS_DID_MK4TYPE_MT_710_RANGE_START
#define XS_DID_MK4TYPE_MT_710_RANGE_START
Definition: xsdid.h:213
XsDeviceId_isMtMk5_X00
int XsDeviceId_isMtMk5_X00(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk5 100 series.
Definition: xsdeviceid.c:1298
XS_DID_GPH_MASK
#define XS_DID_GPH_MASK
Definition: xsdid.h:72
XsDeviceId_isHilDevice
int XsDeviceId_isHilDevice(const struct XsDeviceId *thisPtr)
Test if this device ID represents a Hardware In the Loop test device.
Definition: xsdeviceid.c:512
XsDeviceId_contains
int XsDeviceId_contains(XsDeviceId const *thisPtr, XsDeviceId const *other)
Returns true if this is equal to other or this is a type-specifier that matches other.
Definition: xsdeviceid.c:824
XS_DID_MK4TYPE_MT_800
#define XS_DID_MK4TYPE_MT_800
Definition: xsdid.h:168
XS_DID_ABMCLOCKMASTER
#define XS_DID_ABMCLOCKMASTER
Definition: xsdid.h:185
XsDeviceId_isRugged
int XsDeviceId_isRugged(struct XsDeviceId const *thisPtr)
Test if this device ID represents an Rugged Version.
Definition: xsdeviceid.c:307
XsDeviceId::m_subDevice
uint16_t m_subDevice
The index of a sub-device, ie a finger in an Xsens Glove. 1-based, 0 = the whole device (default)
Definition: xsdeviceid.h:909
XS_DID_MK4TYPE_MT_1_MPU
#define XS_DID_MK4TYPE_MT_1_MPU
Definition: xsdid.h:150
XsDeviceId_isMtMk4_2
int XsDeviceId_isMtMk4_2(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 2.
Definition: xsdeviceid.c:1088
XsDeviceId_isContainerDevice
int XsDeviceId_isContainerDevice(const struct XsDeviceId *thisPtr)
Test if this device ID represents any of the container devices such as Bodypack and Awinda Station.
Definition: xsdeviceid.c:656
XsDeviceId_isType
int XsDeviceId_isType(XsDeviceId const *thisPtr)
Returns true if the ID is just a device type, not an actual device ID.
Definition: xsdeviceid.c:849
XS_DID_MK4TYPE_MT_3_MPU
#define XS_DID_MK4TYPE_MT_3_MPU
Definition: xsdid.h:152
XsString_assignCharArray
void XsString_assignCharArray(XsString *thisPtr, const char *src)
This function determines the size of src and copies the contents to the object.
Definition: xsstring.c:172
XsDeviceId::m_hardwareVersion
uint16_t m_hardwareVersion
The hardware version of a device.
Definition: xsdeviceid.h:908
XsDeviceId::m_deviceId
uint64_t m_deviceId
The serialnumber of a device.
Definition: xsdeviceid.h:905
length
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
XsDeviceId_isMtiX
int XsDeviceId_isMtiX(const struct XsDeviceId *thisPtr)
Test if the device ID represents an Mti 1-series device.
Definition: xsdeviceid.c:98
XsDeviceId_hasInternalGnss
int XsDeviceId_hasInternalGnss(struct XsDeviceId const *thisPtr)
Test if this device ID represents a device with internal GNSS receiver.
Definition: xsdeviceid.c:321
XsDeviceId_isGnss
int XsDeviceId_isGnss(const struct XsDeviceId *thisPtr)
Test if this device ID represents an GNSS (capable) device.
Definition: xsdeviceid.c:607
XS_DID_TYPE_MASK
#define XS_DID_TYPE_MASK
Definition: xsdid.h:73
XS_DID_TYPEH_MT_3X0
#define XS_DID_TYPEH_MT_3X0
Definition: xsdid.h:90
XsDeviceId_isAwinda2Dongle
int XsDeviceId_isAwinda2Dongle(const struct XsDeviceId *thisPtr)
Test if this device ID represents an Awinda2 Dongle.
Definition: xsdeviceid.c:477
XSDEVICEID_INITIALIZER
#define XSDEVICEID_INITIALIZER
Definition: xsdeviceid.h:81
XsDeviceId_isVru
int XsDeviceId_isVru(const struct XsDeviceId *thisPtr)
Test if this device ID represents a VRU.
Definition: xsdeviceid.c:551
XS_DID_TYPEH_MT_X_MPU
#define XS_DID_TYPEH_MT_X_MPU
Definition: xsdid.h:91
XsDeviceId_isMtw
int XsDeviceId_isMtw(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTw.
Definition: xsdeviceid.c:337
XsDeviceId_isGlove
int XsDeviceId_isGlove(const struct XsDeviceId *thisPtr)
Test if the device ID represents a Glove series device.
Definition: xsdeviceid.c:239
XS_DID_MK4TYPE_MT_310
#define XS_DID_MK4TYPE_MT_310
Definition: xsdid.h:155
XsString_assign
void XsString_assign(XsString *thisPtr, XsSize count, const char *src)
Reinitializes the XsArray with space for count items and copies them from src.
Definition: xsstring.c:142
XsString
A 0-terminated managed string of characters.
XsDeviceId_isMtiX00
int XsDeviceId_isMtiX00(const struct XsDeviceId *thisPtr)
Test if the device ID represents an Mti 100-series device.
Definition: xsdeviceid.c:130
XS_DID_SYNCSTATION2
#define XS_DID_SYNCSTATION2(did)
Definition: xsdid.h:206
XsDeviceId_isMtigX10
int XsDeviceId_isMtigX10(const struct XsDeviceId *thisPtr)
Test if the device ID represents an Mtig 710 device.
Definition: xsdeviceid.c:174
XsDeviceId_fromString
void XsDeviceId_fromString(XsDeviceId *thisPtr, const XsString *str)
Read a device ID from the supplied string.
Definition: xsdeviceid.c:738
XsDeviceId_isMti8X0
int XsDeviceId_isMti8X0(const struct XsDeviceId *thisPtr)
Test if the device ID represents an MTi-800 series device.
Definition: xsdeviceid.c:211
XsDeviceId_isMtigX00
int XsDeviceId_isMtigX00(const struct XsDeviceId *thisPtr)
Test if the device ID represents an Mtig 700 device.
Definition: xsdeviceid.c:154
XsDeviceId_toDeviceTypeString
void XsDeviceId_toDeviceTypeString(const XsDeviceId *thisPtr, XsString *str, int makeType)
Get a string with a readable representation of this device ID. Either full or as a type.
Definition: xsdeviceid.c:761
XsDeviceId_isMtMk4_3
int XsDeviceId_isMtMk4_3(const struct XsDeviceId *thisPtr)
Test if this device ID represents an MTMk4 3.
Definition: xsdeviceid.c:1097


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