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/recorder/reader.hpp CHANGED
@@ -1,138 +1,138 @@
1
-
2
- #ifndef RECORDER_READER_HPP
3
- #define RECORDER_READER_HPP
4
-
5
- #include <iostream>
6
-
7
- class XcpLogFileReader {
8
- public:
9
-
10
- explicit XcpLogFileReader(const std::string &file_name) {
11
- if (!file_name.ends_with(detail::FILE_EXTENSION)) {
12
- m_file_name = file_name + detail::FILE_EXTENSION;
13
- } else {
14
- m_file_name = file_name;
15
- }
16
-
17
- m_mmap = new mio::mmap_source(m_file_name);
18
- blob_t magic[detail::MAGIC_SIZE + 1];
19
-
20
- read_bytes(0UL, detail::MAGIC_SIZE, magic);
21
- if (memcmp(detail::MAGIC.c_str(), magic, detail::MAGIC_SIZE) != 0) {
22
- throw std::runtime_error("Invalid file magic.");
23
- }
24
- m_offset = detail::MAGIC_SIZE;
25
-
26
- read_bytes(m_offset, detail::FILE_HEADER_SIZE, reinterpret_cast<blob_t *>(&m_header));
27
- // printf("Sizes: %u %u %.3f\n", m_header.size_uncompressed,
28
- // m_header.size_compressed,
29
- // float(m_header.size_uncompressed) / float(m_header.size_compressed));
30
- if (m_header.hdr_size != detail::FILE_HEADER_SIZE + detail::MAGIC_SIZE) {
31
- throw std::runtime_error("File header size does not match.");
32
- }
33
- if (detail::VERSION != m_header.version) {
34
- throw std::runtime_error("File version mismatch.");
35
- }
36
- #if 0
37
- if (m_header.num_containers < 1) {
38
- throw std::runtime_error("At least one container required.");
39
- }
40
- #endif
41
- m_offset += detail::FILE_HEADER_SIZE;
42
-
43
- if ((m_header.options & XMRAW_HAS_METADATA) == XMRAW_HAS_METADATA) {
44
- std::size_t metadata_length = 0;
45
- std::size_t data_start = m_offset + sizeof(std::size_t);
46
-
47
- read_bytes(m_offset, sizeof(std::size_t), reinterpret_cast<blob_t *>(&metadata_length));
48
-
49
- std::copy(ptr(data_start), ptr(data_start + metadata_length), std::back_inserter(m_metadata));
50
- m_offset += (metadata_length + sizeof(std::size_t));
51
- }
52
- }
53
-
54
- [[nodiscard]] FileHeaderType get_header() const noexcept {
55
- return m_header;
56
- }
57
-
58
- [[nodiscard]] auto get_header_as_tuple() const noexcept -> HeaderTuple {
59
- auto hdr = get_header();
60
-
61
- return std::make_tuple(
62
- hdr.version, hdr.options, hdr.num_containers, hdr.record_count, hdr.size_uncompressed, hdr.size_compressed,
63
- (double)((std::uint64_t)(((double)hdr.size_uncompressed / (double)hdr.size_compressed * 100.0) + 0.5)) / 100.0
64
- );
65
- }
66
-
67
- [[nodiscard]] auto get_metadata() const noexcept {
68
- return m_metadata;
69
- }
70
-
71
- void reset() noexcept {
72
- m_current_container = 0;
73
- m_offset = file_header_size();
74
- }
75
-
76
- std::optional<FrameVector> next_block() {
77
- auto container = ContainerHeaderType{};
78
- auto frame = frame_header_t{};
79
- std::uint64_t boffs = 0;
80
- auto result = FrameVector{};
81
- payload_t payload;
82
-
83
- if (m_current_container >= m_header.num_containers) {
84
- return std::nullopt;
85
- }
86
- read_bytes(m_offset, detail::CONTAINER_SIZE, reinterpret_cast<blob_t *>(&container));
87
- __ALIGN auto buffer = new blob_t[container.size_uncompressed];
88
- m_offset += detail::CONTAINER_SIZE;
89
- result.reserve(container.record_count);
90
- const int uc_size = ::LZ4_decompress_safe(
91
- reinterpret_cast<char const *>(ptr(m_offset)), reinterpret_cast<char *>(buffer), container.size_compressed,
92
- container.size_uncompressed
93
- );
94
- if (uc_size < 0) {
95
- throw std::runtime_error("LZ4 decompression failed.");
96
- }
97
- boffs = 0;
98
- for (std::uint64_t idx = 0; idx < container.record_count; ++idx) {
99
- _fcopy(reinterpret_cast<char *>(&frame), reinterpret_cast<char const *>(&(buffer[boffs])), sizeof(frame_header_t));
100
- boffs += sizeof(frame_header_t);
101
- result.emplace_back(
102
- frame.category, frame.counter, frame.timestamp, frame.length, create_payload(frame.length, &buffer[boffs])
103
- );
104
- boffs += frame.length;
105
- }
106
- m_offset += container.size_compressed;
107
- m_current_container += 1;
108
- delete[] buffer;
109
-
110
- return std::optional<FrameVector>{ result };
111
- }
112
-
113
- ~XcpLogFileReader() noexcept {
114
- delete m_mmap;
115
- }
116
-
117
- protected:
118
-
119
- [[nodiscard]] blob_t const *ptr(std::uint64_t pos = 0) const {
120
- return reinterpret_cast<blob_t const *>(m_mmap->data() + pos);
121
- }
122
-
123
- void read_bytes(std::uint64_t pos, std::uint64_t count, blob_t *buf) const {
124
- auto addr = reinterpret_cast<char const *>(ptr(pos));
125
- _fcopy(reinterpret_cast<char *>(buf), addr, count);
126
- }
127
-
128
- private:
129
-
130
- std::string m_file_name;
131
- std::uint64_t m_offset{ 0 };
132
- std::uint64_t m_current_container{ 0 };
133
- mio::mmap_source *m_mmap{ nullptr };
134
- FileHeaderType m_header;
135
- std::string m_metadata;
136
- };
137
-
138
- #endif // RECORDER_READER_HPP
1
+
2
+ #ifndef RECORDER_READER_HPP
3
+ #define RECORDER_READER_HPP
4
+
5
+ #include <iostream>
6
+
7
+ class XcpLogFileReader {
8
+ public:
9
+
10
+ explicit XcpLogFileReader(const std::string &file_name) {
11
+ if (!file_name.ends_with(detail::FILE_EXTENSION)) {
12
+ m_file_name = file_name + detail::FILE_EXTENSION;
13
+ } else {
14
+ m_file_name = file_name;
15
+ }
16
+
17
+ m_mmap = new mio::mmap_source(m_file_name);
18
+ blob_t magic[detail::MAGIC_SIZE + 1];
19
+
20
+ read_bytes(0UL, detail::MAGIC_SIZE, magic);
21
+ if (memcmp(detail::MAGIC.c_str(), magic, detail::MAGIC_SIZE) != 0) {
22
+ throw std::runtime_error("Invalid file magic.");
23
+ }
24
+ m_offset = detail::MAGIC_SIZE;
25
+
26
+ read_bytes(m_offset, detail::FILE_HEADER_SIZE, reinterpret_cast<blob_t *>(&m_header));
27
+ // printf("Sizes: %u %u %.3f\n", m_header.size_uncompressed,
28
+ // m_header.size_compressed,
29
+ // float(m_header.size_uncompressed) / float(m_header.size_compressed));
30
+ if (m_header.hdr_size != detail::FILE_HEADER_SIZE + detail::MAGIC_SIZE) {
31
+ throw std::runtime_error("File header size does not match.");
32
+ }
33
+ if (detail::VERSION != m_header.version) {
34
+ throw std::runtime_error("File version mismatch.");
35
+ }
36
+ #if 0
37
+ if (m_header.num_containers < 1) {
38
+ throw std::runtime_error("At least one container required.");
39
+ }
40
+ #endif
41
+ m_offset += detail::FILE_HEADER_SIZE;
42
+
43
+ if ((m_header.options & XMRAW_HAS_METADATA) == XMRAW_HAS_METADATA) {
44
+ std::size_t metadata_length = 0;
45
+ std::size_t data_start = m_offset + sizeof(std::size_t);
46
+
47
+ read_bytes(m_offset, sizeof(std::size_t), reinterpret_cast<blob_t *>(&metadata_length));
48
+
49
+ std::copy(ptr(data_start), ptr(data_start + metadata_length), std::back_inserter(m_metadata));
50
+ m_offset += (metadata_length + sizeof(std::size_t));
51
+ }
52
+ }
53
+
54
+ [[nodiscard]] FileHeaderType get_header() const noexcept {
55
+ return m_header;
56
+ }
57
+
58
+ [[nodiscard]] auto get_header_as_tuple() const noexcept -> HeaderTuple {
59
+ auto hdr = get_header();
60
+
61
+ return std::make_tuple(
62
+ hdr.version, hdr.options, hdr.num_containers, hdr.record_count, hdr.size_uncompressed, hdr.size_compressed,
63
+ (double)((std::uint64_t)(((double)hdr.size_uncompressed / (double)hdr.size_compressed * 100.0) + 0.5)) / 100.0
64
+ );
65
+ }
66
+
67
+ [[nodiscard]] auto get_metadata() const noexcept {
68
+ return m_metadata;
69
+ }
70
+
71
+ void reset() noexcept {
72
+ m_current_container = 0;
73
+ m_offset = file_header_size();
74
+ }
75
+
76
+ std::optional<FrameVector> next_block() {
77
+ auto container = ContainerHeaderType{};
78
+ auto frame = frame_header_t{};
79
+ std::uint64_t boffs = 0;
80
+ auto result = FrameVector{};
81
+ payload_t payload;
82
+
83
+ if (m_current_container >= m_header.num_containers) {
84
+ return std::nullopt;
85
+ }
86
+ read_bytes(m_offset, detail::CONTAINER_SIZE, reinterpret_cast<blob_t *>(&container));
87
+ __ALIGN auto buffer = new blob_t[container.size_uncompressed];
88
+ m_offset += detail::CONTAINER_SIZE;
89
+ result.reserve(container.record_count);
90
+ const int uc_size = ::LZ4_decompress_safe(
91
+ reinterpret_cast<char const *>(ptr(m_offset)), reinterpret_cast<char *>(buffer), container.size_compressed,
92
+ container.size_uncompressed
93
+ );
94
+ if (uc_size < 0) {
95
+ throw std::runtime_error("LZ4 decompression failed.");
96
+ }
97
+ boffs = 0;
98
+ for (std::uint64_t idx = 0; idx < container.record_count; ++idx) {
99
+ _fcopy(reinterpret_cast<char *>(&frame), reinterpret_cast<char const *>(&(buffer[boffs])), sizeof(frame_header_t));
100
+ boffs += sizeof(frame_header_t);
101
+ result.emplace_back(
102
+ frame.category, frame.counter, frame.timestamp, frame.length, create_payload(frame.length, &buffer[boffs])
103
+ );
104
+ boffs += frame.length;
105
+ }
106
+ m_offset += container.size_compressed;
107
+ m_current_container += 1;
108
+ delete[] buffer;
109
+
110
+ return std::optional<FrameVector>{ result };
111
+ }
112
+
113
+ ~XcpLogFileReader() noexcept {
114
+ delete m_mmap;
115
+ }
116
+
117
+ protected:
118
+
119
+ [[nodiscard]] blob_t const *ptr(std::uint64_t pos = 0) const {
120
+ return reinterpret_cast<blob_t const *>(m_mmap->data() + pos);
121
+ }
122
+
123
+ void read_bytes(std::uint64_t pos, std::uint64_t count, blob_t *buf) const {
124
+ auto addr = reinterpret_cast<char const *>(ptr(pos));
125
+ _fcopy(reinterpret_cast<char *>(buf), addr, count);
126
+ }
127
+
128
+ private:
129
+
130
+ std::string m_file_name;
131
+ std::uint64_t m_offset{ 0 };
132
+ std::uint64_t m_current_container{ 0 };
133
+ mio::mmap_source *m_mmap{ nullptr };
134
+ FileHeaderType m_header;
135
+ std::string m_metadata;
136
+ };
137
+
138
+ #endif // RECORDER_READER_HPP
pyxcp/recorder/reco.py CHANGED
@@ -12,6 +12,7 @@ See
12
12
 
13
13
  - ``_ for reading.
14
14
  """
15
+
15
16
  import enum
16
17
  import mmap
17
18
  import struct