| Xavia SDK c++ API 2.1.0 API description of the xavia library

Loading...
Searching...
No Matches
serialNumber.h
1#pragma once
2
3#include "xmsdk_export.h"
4
5#include <cstdint>
6#include <string>
7
8namespace xavia::sdk
9{
10 enum class SensorType {
11 XT_G4,
12 XL_G6,
13 Unknown,
14 };
15
16 enum class SensorVariation {
17 X30,
18 X60,
19 X45,
20 SL,
21 DL,
22 FV,
23 STANDARD,
24 Unknown,
25 };
26
30 class XMSDK_EXPORT SerialNumber
31 {
32 public:
33 explicit SerialNumber(const std::uint8_t* serialNumberHex);
34 explicit SerialNumber(const std::uint32_t& serialNumberHex);
35 SerialNumber() = default;
36 virtual ~SerialNumber();
37
38 constexpr SensorType GetSensorType() const { return type; }
39 constexpr std::uint32_t GetSensorUID() const { return uid; }
40 constexpr SensorVariation GetSensorVariation() const { return variation; }
41 constexpr std::uint32_t GetSensorTypeVersion() const { return version; }
42 std::string ToString() const;
43 std::wstring ToWString() const;
44 constexpr std::uint32_t ToInt() const { return integerRepresentation; }
45
46 private:
47 void _DeserializeSerialNumber(const std::uint8_t* serialNumberHex);
48 SensorType _ExtractSensorType(const std::uint8_t* serialNumberHex) const;
49 std::uint32_t _ExtractUID(const std::uint8_t* serialNumberHex) const;
50 std::uint32_t _ExtractVersion(const std::uint8_t* serialNumberHex) const;
51 SensorVariation _ExtractVariation(const std::uint8_t* serialNumberHex) const;
52 bool _ExtractOrientation(const std::uint8_t* serialNumberHex) const;
53
54 // Private members
55 SensorType type{SensorType::XL_G6};
56 std::uint32_t uid{0};
57 SensorVariation variation{SensorVariation::X30};
58 std::uint32_t version{0};
59 bool isVertical{false};
60 std::uint32_t integerRepresentation{0};
61 };
62}