pyxcp 0.25.1__cp314-cp314-macosx_11_0_arm64.whl → 0.25.9__cp314-cp314-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. pyxcp/__init__.py +2 -2
  2. pyxcp/cmdline.py +14 -29
  3. pyxcp/config/__init__.py +1257 -1257
  4. pyxcp/cpp_ext/aligned_buffer.hpp +1 -1
  5. pyxcp/cpp_ext/cpp_ext.cpython-310-darwin.so +0 -0
  6. pyxcp/cpp_ext/cpp_ext.cpython-311-darwin.so +0 -0
  7. pyxcp/cpp_ext/cpp_ext.cpython-312-darwin.so +0 -0
  8. pyxcp/cpp_ext/cpp_ext.cpython-313-darwin.so +0 -0
  9. pyxcp/cpp_ext/cpp_ext.cpython-314-darwin.so +0 -0
  10. pyxcp/cpp_ext/extension_wrapper.cpp +79 -2
  11. pyxcp/cpp_ext/framing.hpp +1 -1
  12. pyxcp/cpp_ext/helper.hpp +280 -280
  13. pyxcp/cpp_ext/sxi_framing.hpp +1 -1
  14. pyxcp/daq_stim/__init__.py +95 -32
  15. pyxcp/daq_stim/optimize/binpacking.py +2 -2
  16. pyxcp/daq_stim/scheduler.cpp +8 -8
  17. pyxcp/errormatrix.py +2 -2
  18. pyxcp/examples/xcp_read_benchmark.py +2 -2
  19. pyxcp/examples/xcp_skel.py +1 -2
  20. pyxcp/examples/xcp_unlock.py +10 -12
  21. pyxcp/examples/xcp_user_supplied_driver.py +1 -2
  22. pyxcp/examples/xcphello.py +2 -15
  23. pyxcp/examples/xcphello_recorder.py +2 -2
  24. pyxcp/master/__init__.py +1 -0
  25. pyxcp/master/master.py +14 -20
  26. pyxcp/recorder/.idea/misc.xml +1 -1
  27. pyxcp/recorder/.idea/modules.xml +1 -1
  28. pyxcp/recorder/.idea/recorder.iml +1 -1
  29. pyxcp/recorder/.idea/vcs.xml +1 -1
  30. pyxcp/recorder/converter/__init__.py +4 -10
  31. pyxcp/recorder/reader.hpp +138 -138
  32. pyxcp/recorder/reco.py +1 -0
  33. pyxcp/recorder/rekorder.hpp +274 -274
  34. pyxcp/recorder/wrap.cpp +184 -184
  35. pyxcp/recorder/writer.hpp +302 -302
  36. pyxcp/scripts/xcp_daq_recorder.py +54 -0
  37. pyxcp/scripts/xcp_fetch_a2l.py +2 -2
  38. pyxcp/scripts/xcp_id_scanner.py +1 -2
  39. pyxcp/scripts/xcp_info.py +66 -51
  40. pyxcp/scripts/xcp_profile.py +1 -2
  41. pyxcp/tests/test_binpacking.py +1 -0
  42. pyxcp/tests/test_daq.py +1 -1
  43. pyxcp/tests/test_framing.py +1 -1
  44. pyxcp/tests/test_master.py +104 -83
  45. pyxcp/tests/test_transport.py +0 -1
  46. pyxcp/timing.py +1 -1
  47. pyxcp/transport/base.py +1 -1
  48. pyxcp/transport/can.py +1 -1
  49. pyxcp/transport/eth.py +1 -1
  50. pyxcp/transport/hdf5_policy.py +167 -0
  51. pyxcp/transport/sxi.py +1 -1
  52. pyxcp/transport/transport_ext.cpython-310-darwin.so +0 -0
  53. pyxcp/transport/transport_ext.cpython-311-darwin.so +0 -0
  54. pyxcp/transport/transport_ext.cpython-312-darwin.so +0 -0
  55. pyxcp/transport/transport_ext.cpython-313-darwin.so +0 -0
  56. pyxcp/transport/transport_ext.cpython-314-darwin.so +0 -0
  57. pyxcp/transport/usb_transport.py +1 -1
  58. pyxcp/{utils.py → utils/__init__.py} +1 -2
  59. pyxcp/utils/cli.py +78 -0
  60. {pyxcp-0.25.1.dist-info → pyxcp-0.25.9.dist-info}/METADATA +1 -1
  61. {pyxcp-0.25.1.dist-info → pyxcp-0.25.9.dist-info}/RECORD +64 -56
  62. {pyxcp-0.25.1.dist-info → pyxcp-0.25.9.dist-info}/WHEEL +1 -1
  63. {pyxcp-0.25.1.dist-info → pyxcp-0.25.9.dist-info}/entry_points.txt +0 -0
  64. {pyxcp-0.25.1.dist-info → pyxcp-0.25.9.dist-info}/licenses/LICENSE +0 -0
pyxcp/cpp_ext/helper.hpp CHANGED
@@ -1,280 +1,280 @@
1
-
2
- #if !defined(__HELPER_HPP)
3
- #define __HELPER_HPP
4
-
5
- #if defined(_WIN32) || defined(_WIN64)
6
-
7
- #else
8
- #include <sys/time.h>
9
- #include <time.h>
10
- #endif
11
-
12
- #include <bit>
13
- #include <chrono>
14
- #include <iostream>
15
- #include <map>
16
- #include <utility>
17
- #include <variant>
18
-
19
- #if __has_include(<version>)
20
- #include <version> // Needed for feature testing.
21
- #endif
22
-
23
- #ifdef __has_include
24
- #if __has_include(<stdfloat>)
25
- #include <stdfloat>
26
- #endif
27
- #if defined(__STDCPP_BFLOAT16_T__)
28
- #define HAS_BFLOAT16 (1)
29
- #else
30
- #define HAS_BFLOAT16 (0)
31
- #endif
32
-
33
- #if defined(__STDCPP_FLOAT16_T__)
34
- #define HAS_FLOAT16 (1)
35
- #else
36
- #define HAS_FLOAT16 (0)
37
- #endif
38
- #else
39
- #define HAS_FLOAT16 (0)
40
- #define HAS_BFLOAT16 (0)
41
- #endif
42
-
43
- constexpr std::endian target_byteorder() {
44
- return std::endian::native;
45
- }
46
-
47
- template<typename... Args>
48
- constexpr void DBG_PRINTN(Args &&...args) noexcept {
49
- ((std::cout << std::forward<Args>(args) << " "), ...);
50
- }
51
-
52
- // NOTE: C++23 has std::byteswap()
53
- constexpr auto _bswap(std::uint64_t v) noexcept {
54
- return ((v & UINT64_C(0x0000'0000'0000'00FF)) << 56) | ((v & UINT64_C(0x0000'0000'0000'FF00)) << 40) |
55
- ((v & UINT64_C(0x0000'0000'00FF'0000)) << 24) | ((v & UINT64_C(0x0000'0000'FF00'0000)) << 8) |
56
- ((v & UINT64_C(0x0000'00FF'0000'0000)) >> 8) | ((v & UINT64_C(0x0000'FF00'0000'0000)) >> 24) |
57
- ((v & UINT64_C(0x00FF'0000'0000'0000)) >> 40) | ((v & UINT64_C(0xFF00'0000'0000'0000)) >> 56);
58
- }
59
-
60
- constexpr auto _bswap(std::uint32_t v) noexcept {
61
- return ((v & UINT32_C(0x0000'00FF)) << 24) | ((v & UINT32_C(0x0000'FF00)) << 8) | ((v & UINT32_C(0x00FF'0000)) >> 8) |
62
- ((v & UINT32_C(0xFF00'0000)) >> 24);
63
- }
64
-
65
- constexpr auto _bswap(std::uint16_t v) noexcept {
66
- return ((v & UINT16_C(0x00FF)) << 8) | ((v & UINT16_C(0xFF00)) >> 8);
67
- }
68
-
69
- template<typename T>
70
- inline std::string to_binary(const T &value) {
71
- std::string result;
72
-
73
- auto ptr = reinterpret_cast<const std::string::value_type *>(&value);
74
- for (std::size_t idx = 0; idx < sizeof(T); ++idx) {
75
- auto ch = ptr[idx];
76
- result.push_back(ch);
77
- }
78
- return result;
79
- }
80
-
81
- template<>
82
- inline std::string to_binary<std::string>(const std::string &value) {
83
- std::string result;
84
-
85
- auto ptr = reinterpret_cast<const std::string::value_type *>(value.c_str());
86
- const std::size_t length = std::size(value);
87
-
88
- // We are using Pascal strings as serialization format.
89
- auto len_bin = to_binary(length);
90
- std::copy(len_bin.begin(), len_bin.end(), std::back_inserter(result));
91
- for (std::size_t idx = 0; idx < length; ++idx) {
92
- auto ch = ptr[idx];
93
- result.push_back(ch);
94
- }
95
- return result;
96
- }
97
-
98
- inline auto bool_to_string(bool value) {
99
- return (value == true) ? "True" : "False";
100
- }
101
-
102
- inline auto byte_order_to_string(int value) {
103
- switch (value) {
104
- case 0:
105
- return "INTEL";
106
- case 1:
107
- return "MOTOROLA";
108
- default:
109
- return "<UNKNOWN>";
110
- }
111
- return "<UNKNOWN>";
112
- }
113
-
114
- template<typename K, typename V>
115
- static std::map<V, K> reverse_map(const std::map<K, V> &m) {
116
- std::map<V, K> result;
117
- for (const auto &[k, v] : m) {
118
- result[v] = k;
119
- }
120
- return result;
121
- }
122
-
123
- enum class TimestampType : std::uint8_t {
124
- ABSOLUTE_TS,
125
- RELATIVE_TS
126
- };
127
-
128
- class TimestampInfo {
129
- public:
130
-
131
- TimestampInfo(const TimestampInfo &) = default;
132
- TimestampInfo(TimestampInfo &&) = default;
133
- TimestampInfo &operator=(const TimestampInfo &) = default;
134
- TimestampInfo &operator=(TimestampInfo &&) = default;
135
- virtual ~TimestampInfo() {}
136
-
137
- TimestampInfo() : m_timestamp_ns(0), m_timezone{}, m_utc_offset(0), m_dst_offset(0) {
138
- }
139
-
140
- TimestampInfo(std::uint64_t timestamp_ns, const std::string &timezone, std::int16_t utc_offset, std::int16_t dst_offset) :
141
- m_timestamp_ns(timestamp_ns), m_timezone(timezone), m_utc_offset(utc_offset), m_dst_offset(dst_offset) {
142
- }
143
-
144
- explicit TimestampInfo(std::uint64_t timestamp_ns) : m_timestamp_ns(timestamp_ns) {
145
- #if defined(_WIN32) || defined(_WIN64)
146
- m_timezone = std::chrono::current_zone()->name();
147
- #else
148
- tzset();
149
- m_timezone = tzname[0];
150
-
151
- #endif // _WIN32 || _WIN64
152
- }
153
-
154
- std::string get_timezone() const noexcept {
155
- return m_timezone;
156
- }
157
-
158
- void set_timezone(const std::string &value) noexcept {
159
- m_timezone = value;
160
- }
161
-
162
- std::uint64_t get_timestamp_ns() const noexcept {
163
- return m_timestamp_ns;
164
- }
165
-
166
- void set_utc_offset(std::int16_t value) noexcept {
167
- m_utc_offset = value;
168
- }
169
-
170
- std::int16_t get_utc_offset() const noexcept {
171
- return m_utc_offset;
172
- }
173
-
174
- void set_dst_offset(std::int16_t value) noexcept {
175
- m_dst_offset = value;
176
- }
177
-
178
- std::int16_t get_dst_offset() const noexcept {
179
- return m_dst_offset;
180
- }
181
-
182
- std::string to_string() const noexcept {
183
- std::stringstream ss;
184
- ss << "TimestamInfo(\n";
185
- ss << "\ttimestamp_ns=" << m_timestamp_ns << ",\n";
186
- ss << "\ttimezone=\"" << m_timezone << "\",\n";
187
- ss << "\tutc_offset=" << m_utc_offset << ",\n";
188
- ss << "\tdst_offset=" << m_dst_offset << "\n";
189
- ss << ");";
190
- return ss.str();
191
- }
192
-
193
- virtual void dummy() const noexcept {};
194
-
195
- private:
196
-
197
- std::uint64_t m_timestamp_ns;
198
- std::string m_timezone{};
199
- std::int16_t m_utc_offset{ 0 };
200
- std::int16_t m_dst_offset{ 0 };
201
- };
202
-
203
- class Timestamp {
204
- public:
205
-
206
- explicit Timestamp(TimestampType ts_type) : m_type(ts_type) {
207
- m_initial = absolute();
208
- }
209
-
210
- Timestamp(const Timestamp &) = default;
211
- Timestamp(Timestamp &&) = default;
212
-
213
- std::uint64_t get_value() const noexcept {
214
- if (m_type == TimestampType::ABSOLUTE_TS) {
215
- return absolute();
216
- } else if (m_type == TimestampType::RELATIVE_TS) {
217
- return relative();
218
- }
219
- }
220
-
221
- std::uint64_t get_initial_value() const noexcept {
222
- return m_initial;
223
- }
224
-
225
- std::uint64_t absolute() const noexcept {
226
- std::uint64_t current;
227
-
228
- #if defined(_WIN32) || defined(_WIN64)
229
- current = std::chrono::duration_cast<std::chrono::nanoseconds>(m_clk.now().time_since_epoch()).count();
230
- #else
231
- // On MacOS `clock_gettime_nsec_np` could be used.
232
- timespec ts;
233
- clock_gettime(CLOCK_REALTIME, &ts);
234
- current = static_cast<std::uint64_t>(ts.tv_sec) * 1'000'000'000 + ts.tv_nsec;
235
- #endif // _WIN32 || _WIN64
236
- return current;
237
- }
238
-
239
- std::uint64_t relative() const noexcept {
240
- return absolute() - m_initial;
241
- }
242
-
243
- private:
244
-
245
- TimestampType m_type;
246
- #if defined(_WIN32) || defined(_WIN64)
247
- std::chrono::utc_clock m_clk;
248
- #else
249
-
250
- #endif // _WIN32 || _WIN64
251
- std::uint64_t m_initial;
252
- };
253
-
254
- template<typename T, typename V>
255
- T variant_get(V&& value) {
256
-
257
- T result;
258
-
259
- const T* value_ptr = std::get_if<T>(&value);
260
- if (value_ptr == nullptr) {
261
- result = T{};
262
- }
263
- else {
264
- result = *value_ptr;
265
- }
266
-
267
- return result;
268
- }
269
-
270
- #if 0
271
- inline void sleep_ms(std::uint64_t milliseconds) {
272
- std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
273
- }
274
-
275
- inline void sleep_ns(std::uint64_t nanoseconds) {
276
- std::this_thread::sleep_for(std::chrono::nanoseconds(nanoseconds));
277
- }
278
- #endif
279
-
280
- #endif // __HELPER_HPP
1
+
2
+ #if !defined(__HELPER_HPP)
3
+ #define __HELPER_HPP
4
+
5
+ #if defined(_WIN32) || defined(_WIN64)
6
+
7
+ #else
8
+ #include <sys/time.h>
9
+ #include <time.h>
10
+ #endif
11
+
12
+ #include <bit>
13
+ #include <chrono>
14
+ #include <iostream>
15
+ #include <map>
16
+ #include <utility>
17
+ #include <variant>
18
+
19
+ #if __has_include(<version>)
20
+ #include <version> // Needed for feature testing.
21
+ #endif
22
+
23
+ #ifdef __has_include
24
+ #if __has_include(<stdfloat>)
25
+ #include <stdfloat>
26
+ #endif
27
+ #if defined(__STDCPP_BFLOAT16_T__)
28
+ #define HAS_BFLOAT16 (1)
29
+ #else
30
+ #define HAS_BFLOAT16 (0)
31
+ #endif
32
+
33
+ #if defined(__STDCPP_FLOAT16_T__)
34
+ #define HAS_FLOAT16 (1)
35
+ #else
36
+ #define HAS_FLOAT16 (0)
37
+ #endif
38
+ #else
39
+ #define HAS_FLOAT16 (0)
40
+ #define HAS_BFLOAT16 (0)
41
+ #endif
42
+
43
+ constexpr std::endian target_byteorder() {
44
+ return std::endian::native;
45
+ }
46
+
47
+ template<typename... Args>
48
+ constexpr void DBG_PRINTN(Args &&...args) noexcept {
49
+ ((std::cout << std::forward<Args>(args) << " "), ...);
50
+ }
51
+
52
+ // NOTE: C++23 has std::byteswap()
53
+ constexpr auto _bswap(std::uint64_t v) noexcept {
54
+ return ((v & UINT64_C(0x0000'0000'0000'00FF)) << 56) | ((v & UINT64_C(0x0000'0000'0000'FF00)) << 40) |
55
+ ((v & UINT64_C(0x0000'0000'00FF'0000)) << 24) | ((v & UINT64_C(0x0000'0000'FF00'0000)) << 8) |
56
+ ((v & UINT64_C(0x0000'00FF'0000'0000)) >> 8) | ((v & UINT64_C(0x0000'FF00'0000'0000)) >> 24) |
57
+ ((v & UINT64_C(0x00FF'0000'0000'0000)) >> 40) | ((v & UINT64_C(0xFF00'0000'0000'0000)) >> 56);
58
+ }
59
+
60
+ constexpr auto _bswap(std::uint32_t v) noexcept {
61
+ return ((v & UINT32_C(0x0000'00FF)) << 24) | ((v & UINT32_C(0x0000'FF00)) << 8) | ((v & UINT32_C(0x00FF'0000)) >> 8) |
62
+ ((v & UINT32_C(0xFF00'0000)) >> 24);
63
+ }
64
+
65
+ constexpr auto _bswap(std::uint16_t v) noexcept {
66
+ return ((v & UINT16_C(0x00FF)) << 8) | ((v & UINT16_C(0xFF00)) >> 8);
67
+ }
68
+
69
+ template<typename T>
70
+ inline std::string to_binary(const T &value) {
71
+ std::string result;
72
+
73
+ auto ptr = reinterpret_cast<const std::string::value_type *>(&value);
74
+ for (std::size_t idx = 0; idx < sizeof(T); ++idx) {
75
+ auto ch = ptr[idx];
76
+ result.push_back(ch);
77
+ }
78
+ return result;
79
+ }
80
+
81
+ template<>
82
+ inline std::string to_binary<std::string>(const std::string &value) {
83
+ std::string result;
84
+
85
+ auto ptr = reinterpret_cast<const std::string::value_type *>(value.c_str());
86
+ const std::size_t length = std::size(value);
87
+
88
+ // We are using Pascal strings as serialization format.
89
+ auto len_bin = to_binary(length);
90
+ std::copy(len_bin.begin(), len_bin.end(), std::back_inserter(result));
91
+ for (std::size_t idx = 0; idx < length; ++idx) {
92
+ auto ch = ptr[idx];
93
+ result.push_back(ch);
94
+ }
95
+ return result;
96
+ }
97
+
98
+ inline auto bool_to_string(bool value) {
99
+ return (value == true) ? "True" : "False";
100
+ }
101
+
102
+ inline auto byte_order_to_string(int value) {
103
+ switch (value) {
104
+ case 0:
105
+ return "INTEL";
106
+ case 1:
107
+ return "MOTOROLA";
108
+ default:
109
+ return "<UNKNOWN>";
110
+ }
111
+ return "<UNKNOWN>";
112
+ }
113
+
114
+ template<typename K, typename V>
115
+ static std::map<V, K> reverse_map(const std::map<K, V> &m) {
116
+ std::map<V, K> result;
117
+ for (const auto &[k, v] : m) {
118
+ result[v] = k;
119
+ }
120
+ return result;
121
+ }
122
+
123
+ enum class TimestampType : std::uint8_t {
124
+ ABSOLUTE_TS,
125
+ RELATIVE_TS
126
+ };
127
+
128
+ class TimestampInfo {
129
+ public:
130
+
131
+ TimestampInfo(const TimestampInfo &) = default;
132
+ TimestampInfo(TimestampInfo &&) = default;
133
+ TimestampInfo &operator=(const TimestampInfo &) = default;
134
+ TimestampInfo &operator=(TimestampInfo &&) = default;
135
+ virtual ~TimestampInfo() {}
136
+
137
+ TimestampInfo() : m_timestamp_ns(0), m_timezone{}, m_utc_offset(0), m_dst_offset(0) {
138
+ }
139
+
140
+ TimestampInfo(std::uint64_t timestamp_ns, const std::string &timezone, std::int16_t utc_offset, std::int16_t dst_offset) :
141
+ m_timestamp_ns(timestamp_ns), m_timezone(timezone), m_utc_offset(utc_offset), m_dst_offset(dst_offset) {
142
+ }
143
+
144
+ explicit TimestampInfo(std::uint64_t timestamp_ns) : m_timestamp_ns(timestamp_ns) {
145
+ #if defined(_WIN32) || defined(_WIN64)
146
+ m_timezone = std::chrono::current_zone()->name();
147
+ #else
148
+ tzset();
149
+ m_timezone = tzname[0];
150
+
151
+ #endif // _WIN32 || _WIN64
152
+ }
153
+
154
+ std::string get_timezone() const noexcept {
155
+ return m_timezone;
156
+ }
157
+
158
+ void set_timezone(const std::string &value) noexcept {
159
+ m_timezone = value;
160
+ }
161
+
162
+ std::uint64_t get_timestamp_ns() const noexcept {
163
+ return m_timestamp_ns;
164
+ }
165
+
166
+ void set_utc_offset(std::int16_t value) noexcept {
167
+ m_utc_offset = value;
168
+ }
169
+
170
+ std::int16_t get_utc_offset() const noexcept {
171
+ return m_utc_offset;
172
+ }
173
+
174
+ void set_dst_offset(std::int16_t value) noexcept {
175
+ m_dst_offset = value;
176
+ }
177
+
178
+ std::int16_t get_dst_offset() const noexcept {
179
+ return m_dst_offset;
180
+ }
181
+
182
+ std::string to_string() const noexcept {
183
+ std::stringstream ss;
184
+ ss << "TimestamInfo(\n";
185
+ ss << "\ttimestamp_ns=" << m_timestamp_ns << ",\n";
186
+ ss << "\ttimezone=\"" << m_timezone << "\",\n";
187
+ ss << "\tutc_offset=" << m_utc_offset << ",\n";
188
+ ss << "\tdst_offset=" << m_dst_offset << "\n";
189
+ ss << ");";
190
+ return ss.str();
191
+ }
192
+
193
+ virtual void dummy() const noexcept {};
194
+
195
+ private:
196
+
197
+ std::uint64_t m_timestamp_ns;
198
+ std::string m_timezone{};
199
+ std::int16_t m_utc_offset{ 0 };
200
+ std::int16_t m_dst_offset{ 0 };
201
+ };
202
+
203
+ class Timestamp {
204
+ public:
205
+
206
+ explicit Timestamp(TimestampType ts_type) : m_type(ts_type) {
207
+ m_initial = absolute();
208
+ }
209
+
210
+ Timestamp(const Timestamp &) = default;
211
+ Timestamp(Timestamp &&) = default;
212
+
213
+ std::uint64_t get_value() const noexcept {
214
+ if (m_type == TimestampType::ABSOLUTE_TS) {
215
+ return absolute();
216
+ } else if (m_type == TimestampType::RELATIVE_TS) {
217
+ return relative();
218
+ }
219
+ }
220
+
221
+ std::uint64_t get_initial_value() const noexcept {
222
+ return m_initial;
223
+ }
224
+
225
+ std::uint64_t absolute() const noexcept {
226
+ std::uint64_t current;
227
+
228
+ #if defined(_WIN32) || defined(_WIN64)
229
+ current = std::chrono::duration_cast<std::chrono::nanoseconds>(m_clk.now().time_since_epoch()).count();
230
+ #else
231
+ // On MacOS `clock_gettime_nsec_np` could be used.
232
+ timespec ts;
233
+ clock_gettime(CLOCK_REALTIME, &ts);
234
+ current = static_cast<std::uint64_t>(ts.tv_sec) * 1'000'000'000 + ts.tv_nsec;
235
+ #endif // _WIN32 || _WIN64
236
+ return current;
237
+ }
238
+
239
+ std::uint64_t relative() const noexcept {
240
+ return absolute() - m_initial;
241
+ }
242
+
243
+ private:
244
+
245
+ TimestampType m_type;
246
+ #if defined(_WIN32) || defined(_WIN64)
247
+ std::chrono::utc_clock m_clk;
248
+ #else
249
+
250
+ #endif // _WIN32 || _WIN64
251
+ std::uint64_t m_initial;
252
+ };
253
+
254
+ template<typename T, typename V>
255
+ T variant_get(V&& value) {
256
+
257
+ T result;
258
+
259
+ const T* value_ptr = std::get_if<T>(&value);
260
+ if (value_ptr == nullptr) {
261
+ result = T{};
262
+ }
263
+ else {
264
+ result = *value_ptr;
265
+ }
266
+
267
+ return result;
268
+ }
269
+
270
+ #if 0
271
+ inline void sleep_ms(std::uint64_t milliseconds) {
272
+ std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
273
+ }
274
+
275
+ inline void sleep_ns(std::uint64_t nanoseconds) {
276
+ std::this_thread::sleep_for(std::chrono::nanoseconds(nanoseconds));
277
+ }
278
+ #endif
279
+
280
+ #endif // __HELPER_HPP
@@ -329,4 +329,4 @@ class SxiReceiver {
329
329
  std::function<void(const std::vector<uint8_t>&, uint16_t, uint16_t)> dispatch_;
330
330
  };
331
331
 
332
- #endif // __SXI_FRAMING_HPP
332
+ #endif // __SXI_FRAMING_HPP