pyxcp 0.25.4__cp313-cp313-win_amd64.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 (157) hide show
  1. pyxcp/__init__.py +20 -0
  2. pyxcp/aml/EtasCANMonitoring.a2l +82 -0
  3. pyxcp/aml/EtasCANMonitoring.aml +67 -0
  4. pyxcp/aml/XCP_Common.aml +408 -0
  5. pyxcp/aml/XCPonCAN.aml +78 -0
  6. pyxcp/aml/XCPonEth.aml +33 -0
  7. pyxcp/aml/XCPonFlx.aml +113 -0
  8. pyxcp/aml/XCPonSxI.aml +66 -0
  9. pyxcp/aml/XCPonUSB.aml +106 -0
  10. pyxcp/aml/ifdata_CAN.a2l +20 -0
  11. pyxcp/aml/ifdata_Eth.a2l +11 -0
  12. pyxcp/aml/ifdata_Flx.a2l +94 -0
  13. pyxcp/aml/ifdata_SxI.a2l +13 -0
  14. pyxcp/aml/ifdata_USB.a2l +81 -0
  15. pyxcp/asam/__init__.py +0 -0
  16. pyxcp/asam/types.py +131 -0
  17. pyxcp/asamkeydll.c +116 -0
  18. pyxcp/asamkeydll.exe +0 -0
  19. pyxcp/asamkeydll.sh +2 -0
  20. pyxcp/checksum.py +732 -0
  21. pyxcp/cmdline.py +71 -0
  22. pyxcp/config/__init__.py +1257 -0
  23. pyxcp/config/legacy.py +120 -0
  24. pyxcp/constants.py +47 -0
  25. pyxcp/cpp_ext/__init__.py +0 -0
  26. pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
  27. pyxcp/cpp_ext/bin.hpp +105 -0
  28. pyxcp/cpp_ext/blockmem.hpp +58 -0
  29. pyxcp/cpp_ext/cpp_ext.cp310-win_amd64.pyd +0 -0
  30. pyxcp/cpp_ext/cpp_ext.cp311-win_amd64.pyd +0 -0
  31. pyxcp/cpp_ext/cpp_ext.cp312-win_amd64.pyd +0 -0
  32. pyxcp/cpp_ext/cpp_ext.cp313-win_amd64.pyd +0 -0
  33. pyxcp/cpp_ext/daqlist.hpp +374 -0
  34. pyxcp/cpp_ext/event.hpp +67 -0
  35. pyxcp/cpp_ext/extension_wrapper.cpp +131 -0
  36. pyxcp/cpp_ext/framing.hpp +360 -0
  37. pyxcp/cpp_ext/helper.hpp +280 -0
  38. pyxcp/cpp_ext/mcobject.hpp +248 -0
  39. pyxcp/cpp_ext/sxi_framing.hpp +332 -0
  40. pyxcp/cpp_ext/tsqueue.hpp +46 -0
  41. pyxcp/daq_stim/__init__.py +291 -0
  42. pyxcp/daq_stim/optimize/__init__.py +67 -0
  43. pyxcp/daq_stim/optimize/binpacking.py +41 -0
  44. pyxcp/daq_stim/scheduler.cpp +62 -0
  45. pyxcp/daq_stim/scheduler.hpp +75 -0
  46. pyxcp/daq_stim/stim.cp310-win_amd64.pyd +0 -0
  47. pyxcp/daq_stim/stim.cp311-win_amd64.pyd +0 -0
  48. pyxcp/daq_stim/stim.cp312-win_amd64.pyd +0 -0
  49. pyxcp/daq_stim/stim.cp313-win_amd64.pyd +0 -0
  50. pyxcp/daq_stim/stim.cpp +13 -0
  51. pyxcp/daq_stim/stim.hpp +604 -0
  52. pyxcp/daq_stim/stim_wrapper.cpp +50 -0
  53. pyxcp/dllif.py +100 -0
  54. pyxcp/errormatrix.py +878 -0
  55. pyxcp/examples/conf_can.toml +19 -0
  56. pyxcp/examples/conf_can_user.toml +16 -0
  57. pyxcp/examples/conf_can_vector.json +11 -0
  58. pyxcp/examples/conf_can_vector.toml +11 -0
  59. pyxcp/examples/conf_eth.toml +9 -0
  60. pyxcp/examples/conf_nixnet.json +20 -0
  61. pyxcp/examples/conf_socket_can.toml +12 -0
  62. pyxcp/examples/run_daq.py +165 -0
  63. pyxcp/examples/xcp_policy.py +60 -0
  64. pyxcp/examples/xcp_read_benchmark.py +38 -0
  65. pyxcp/examples/xcp_skel.py +48 -0
  66. pyxcp/examples/xcp_unlock.py +36 -0
  67. pyxcp/examples/xcp_user_supplied_driver.py +43 -0
  68. pyxcp/examples/xcphello.py +65 -0
  69. pyxcp/examples/xcphello_recorder.py +107 -0
  70. pyxcp/master/__init__.py +10 -0
  71. pyxcp/master/errorhandler.py +677 -0
  72. pyxcp/master/master.py +2641 -0
  73. pyxcp/py.typed +0 -0
  74. pyxcp/recorder/.idea/.gitignore +8 -0
  75. pyxcp/recorder/.idea/misc.xml +4 -0
  76. pyxcp/recorder/.idea/modules.xml +8 -0
  77. pyxcp/recorder/.idea/recorder.iml +6 -0
  78. pyxcp/recorder/.idea/sonarlint/issuestore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +7 -0
  79. pyxcp/recorder/.idea/sonarlint/issuestore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  80. pyxcp/recorder/.idea/sonarlint/issuestore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  81. pyxcp/recorder/.idea/sonarlint/issuestore/index.pb +7 -0
  82. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +0 -0
  83. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  84. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  85. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/index.pb +7 -0
  86. pyxcp/recorder/.idea/vcs.xml +10 -0
  87. pyxcp/recorder/__init__.py +96 -0
  88. pyxcp/recorder/build_clang.cmd +1 -0
  89. pyxcp/recorder/build_clang.sh +2 -0
  90. pyxcp/recorder/build_gcc.cmd +1 -0
  91. pyxcp/recorder/build_gcc.sh +2 -0
  92. pyxcp/recorder/build_gcc_arm.sh +2 -0
  93. pyxcp/recorder/converter/__init__.py +444 -0
  94. pyxcp/recorder/lz4.c +2829 -0
  95. pyxcp/recorder/lz4.h +879 -0
  96. pyxcp/recorder/lz4hc.c +2041 -0
  97. pyxcp/recorder/lz4hc.h +413 -0
  98. pyxcp/recorder/mio.hpp +1714 -0
  99. pyxcp/recorder/reader.hpp +138 -0
  100. pyxcp/recorder/reco.py +278 -0
  101. pyxcp/recorder/recorder.rst +0 -0
  102. pyxcp/recorder/rekorder.cp310-win_amd64.pyd +0 -0
  103. pyxcp/recorder/rekorder.cp311-win_amd64.pyd +0 -0
  104. pyxcp/recorder/rekorder.cp312-win_amd64.pyd +0 -0
  105. pyxcp/recorder/rekorder.cp313-win_amd64.pyd +0 -0
  106. pyxcp/recorder/rekorder.cpp +59 -0
  107. pyxcp/recorder/rekorder.hpp +274 -0
  108. pyxcp/recorder/setup.py +41 -0
  109. pyxcp/recorder/test_reko.py +34 -0
  110. pyxcp/recorder/unfolder.hpp +1354 -0
  111. pyxcp/recorder/wrap.cpp +184 -0
  112. pyxcp/recorder/writer.hpp +302 -0
  113. pyxcp/scripts/__init__.py +0 -0
  114. pyxcp/scripts/pyxcp_probe_can_drivers.py +20 -0
  115. pyxcp/scripts/xcp_examples.py +64 -0
  116. pyxcp/scripts/xcp_fetch_a2l.py +40 -0
  117. pyxcp/scripts/xcp_id_scanner.py +18 -0
  118. pyxcp/scripts/xcp_info.py +159 -0
  119. pyxcp/scripts/xcp_profile.py +26 -0
  120. pyxcp/scripts/xmraw_converter.py +31 -0
  121. pyxcp/stim/__init__.py +0 -0
  122. pyxcp/tests/test_asam_types.py +24 -0
  123. pyxcp/tests/test_binpacking.py +186 -0
  124. pyxcp/tests/test_can.py +1324 -0
  125. pyxcp/tests/test_checksum.py +95 -0
  126. pyxcp/tests/test_daq.py +193 -0
  127. pyxcp/tests/test_daq_opt.py +426 -0
  128. pyxcp/tests/test_frame_padding.py +156 -0
  129. pyxcp/tests/test_framing.py +262 -0
  130. pyxcp/tests/test_master.py +2116 -0
  131. pyxcp/tests/test_transport.py +177 -0
  132. pyxcp/tests/test_utils.py +30 -0
  133. pyxcp/timing.py +60 -0
  134. pyxcp/transport/__init__.py +13 -0
  135. pyxcp/transport/base.py +484 -0
  136. pyxcp/transport/base_transport.hpp +0 -0
  137. pyxcp/transport/can.py +660 -0
  138. pyxcp/transport/eth.py +254 -0
  139. pyxcp/transport/hdf5_policy.py +129 -0
  140. pyxcp/transport/sxi.py +209 -0
  141. pyxcp/transport/transport_ext.cp310-win_amd64.pyd +0 -0
  142. pyxcp/transport/transport_ext.cp311-win_amd64.pyd +0 -0
  143. pyxcp/transport/transport_ext.cp312-win_amd64.pyd +0 -0
  144. pyxcp/transport/transport_ext.cp313-win_amd64.pyd +0 -0
  145. pyxcp/transport/transport_ext.hpp +214 -0
  146. pyxcp/transport/transport_wrapper.cpp +249 -0
  147. pyxcp/transport/usb_transport.py +229 -0
  148. pyxcp/types.py +987 -0
  149. pyxcp/utils/__init__.py +127 -0
  150. pyxcp/utils/cli.py +78 -0
  151. pyxcp/vector/__init__.py +0 -0
  152. pyxcp/vector/map.py +82 -0
  153. pyxcp-0.25.4.dist-info/METADATA +341 -0
  154. pyxcp-0.25.4.dist-info/RECORD +157 -0
  155. pyxcp-0.25.4.dist-info/WHEEL +4 -0
  156. pyxcp-0.25.4.dist-info/entry_points.txt +9 -0
  157. pyxcp-0.25.4.dist-info/licenses/LICENSE +165 -0
@@ -0,0 +1,156 @@
1
+ import pytest
2
+
3
+ from pyxcp.transport.can import pad_frame
4
+
5
+
6
+ def test_frame_padding_no_padding_length():
7
+ EXPECTED = (
8
+ (0, 8),
9
+ (1, 8),
10
+ (2, 8),
11
+ (3, 8),
12
+ (4, 8),
13
+ (5, 8),
14
+ (6, 8),
15
+ (7, 8),
16
+ (8, 8),
17
+ (9, 12),
18
+ (10, 12),
19
+ (11, 12),
20
+ (12, 12),
21
+ (13, 16),
22
+ (14, 16),
23
+ (15, 16),
24
+ (16, 16),
25
+ (17, 20),
26
+ (18, 20),
27
+ (19, 20),
28
+ (20, 20),
29
+ (21, 24),
30
+ (22, 24),
31
+ (23, 24),
32
+ (24, 24),
33
+ (25, 32),
34
+ (26, 32),
35
+ (27, 32),
36
+ (28, 32),
37
+ (29, 32),
38
+ (30, 32),
39
+ (31, 32),
40
+ (32, 32),
41
+ (33, 48),
42
+ (34, 48),
43
+ (35, 48),
44
+ (36, 48),
45
+ (37, 48),
46
+ (38, 48),
47
+ (39, 48),
48
+ (40, 48),
49
+ (41, 48),
50
+ (42, 48),
51
+ (43, 48),
52
+ (44, 48),
53
+ (45, 48),
54
+ (46, 48),
55
+ (47, 48),
56
+ (48, 48),
57
+ (49, 64),
58
+ (50, 64),
59
+ (51, 64),
60
+ (52, 64),
61
+ (53, 64),
62
+ (54, 64),
63
+ (55, 64),
64
+ (56, 64),
65
+ (57, 64),
66
+ (58, 64),
67
+ (59, 64),
68
+ (60, 64),
69
+ (61, 64),
70
+ (62, 64),
71
+ (63, 64),
72
+ (64, 64),
73
+ )
74
+ for frame_len in range(65):
75
+ frame = bytes(frame_len)
76
+ padded_frame = pad_frame(frame, padding_value=0, pad_frame=True)
77
+ frame_len = len(padded_frame)
78
+ _, expected_len = EXPECTED[frame_len]
79
+ assert frame_len == expected_len
80
+
81
+
82
+ @pytest.mark.skip
83
+ def test_frame_padding_padding_length32():
84
+ EXPECTED = (
85
+ (0, 32),
86
+ (1, 32),
87
+ (2, 32),
88
+ (3, 32),
89
+ (4, 32),
90
+ (5, 32),
91
+ (6, 32),
92
+ (7, 32),
93
+ (8, 32),
94
+ (9, 32),
95
+ (10, 32),
96
+ (11, 32),
97
+ (12, 32),
98
+ (13, 32),
99
+ (14, 32),
100
+ (15, 32),
101
+ (16, 32),
102
+ (17, 32),
103
+ (18, 32),
104
+ (19, 32),
105
+ (20, 32),
106
+ (21, 32),
107
+ (22, 32),
108
+ (23, 32),
109
+ (24, 32),
110
+ (25, 32),
111
+ (26, 32),
112
+ (27, 32),
113
+ (28, 32),
114
+ (29, 32),
115
+ (30, 32),
116
+ (31, 32),
117
+ (32, 32),
118
+ (33, 48),
119
+ (34, 48),
120
+ (35, 48),
121
+ (36, 48),
122
+ (37, 48),
123
+ (38, 48),
124
+ (39, 48),
125
+ (40, 48),
126
+ (41, 48),
127
+ (42, 48),
128
+ (43, 48),
129
+ (44, 48),
130
+ (45, 48),
131
+ (46, 48),
132
+ (47, 48),
133
+ (48, 48),
134
+ (49, 64),
135
+ (50, 64),
136
+ (51, 64),
137
+ (52, 64),
138
+ (53, 64),
139
+ (54, 64),
140
+ (55, 64),
141
+ (56, 64),
142
+ (57, 64),
143
+ (58, 64),
144
+ (59, 64),
145
+ (60, 64),
146
+ (61, 64),
147
+ (62, 64),
148
+ (63, 64),
149
+ (64, 64),
150
+ )
151
+ for frame_len in range(65):
152
+ frame = bytes(frame_len)
153
+ padded_frame = pad_frame(frame, padding_value=0, pad_frame=True)
154
+ frame_len = len(padded_frame)
155
+ _, expected_len = EXPECTED[frame_len]
156
+ assert frame_len == expected_len
@@ -0,0 +1,262 @@
1
+ from pyxcp.transport.base import XcpFraming, XcpFramingConfig, XcpTransportLayerType, ChecksumType
2
+
3
+
4
+ def test_prepare_request_sxiL1CN():
5
+ config = XcpFramingConfig(
6
+ transport_layer_type=XcpTransportLayerType.SXI,
7
+ header_len=1,
8
+ header_ctr=0,
9
+ header_fill=0,
10
+ tail_fill=False,
11
+ tail_cs=ChecksumType.NO_CHECKSUM,
12
+ )
13
+ framing = XcpFraming(config)
14
+ framing.counter_send = 3
15
+ cmd = 0xFF
16
+ request = framing.prepare_request(cmd, 0x00)
17
+ assert list(request) == [0x02, 0xFF, 0x00]
18
+
19
+
20
+ def test_prepare_request_sxiL1CB():
21
+ config = XcpFramingConfig(
22
+ transport_layer_type=XcpTransportLayerType.SXI,
23
+ header_len=1,
24
+ header_ctr=0,
25
+ header_fill=0,
26
+ tail_fill=False,
27
+ tail_cs=ChecksumType.BYTE_CHECKSUM,
28
+ )
29
+ framing = XcpFraming(config)
30
+ framing.counter_send = 3
31
+ cmd = 0xFF
32
+ request = framing.prepare_request(cmd, 0x00)
33
+ assert list(request) == [0x02, 0xFF, 0x00, 0x01]
34
+
35
+
36
+ def test_prepare_request_sxiL1CW_1():
37
+ config = XcpFramingConfig(
38
+ transport_layer_type=XcpTransportLayerType.SXI,
39
+ header_len=1,
40
+ header_ctr=0,
41
+ header_fill=0,
42
+ tail_fill=False,
43
+ tail_cs=ChecksumType.WORD_CHECKSUM,
44
+ )
45
+ framing = XcpFraming(config)
46
+ framing.counter_send = 3
47
+ cmd = 0xFF
48
+ request = framing.prepare_request(cmd, 0x00)
49
+ assert list(request) == [0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF]
50
+
51
+
52
+ def test_prepare_request_sxiL1CW_2():
53
+ config = XcpFramingConfig(
54
+ transport_layer_type=XcpTransportLayerType.SXI,
55
+ header_len=1,
56
+ header_ctr=0,
57
+ header_fill=0,
58
+ tail_fill=False,
59
+ tail_cs=ChecksumType.WORD_CHECKSUM,
60
+ )
61
+ framing = XcpFraming(config)
62
+ framing.counter_send = 3
63
+ cmd = 0xFF
64
+ request = framing.prepare_request(cmd, 0x00, 0x55)
65
+ assert list(request) == [0x03, 0xFF, 0x00, 0x55, 0x03, 0x54]
66
+
67
+
68
+ def test_prepare_request_sxiL1C1CN():
69
+ config = XcpFramingConfig(
70
+ transport_layer_type=XcpTransportLayerType.SXI,
71
+ header_len=1,
72
+ header_ctr=1,
73
+ header_fill=0,
74
+ tail_fill=False,
75
+ tail_cs=ChecksumType.NO_CHECKSUM,
76
+ )
77
+ framing = XcpFraming(config)
78
+ framing.counter_send = 0xAA
79
+ cmd = 0xFF
80
+ request = framing.prepare_request(cmd, 0x00)
81
+ assert list(request) == [0x02, 0xAA, 0xFF, 0x00]
82
+
83
+
84
+ def test_prepare_request_sxiL1C1CB():
85
+ config = XcpFramingConfig(
86
+ transport_layer_type=XcpTransportLayerType.SXI,
87
+ header_len=1,
88
+ header_ctr=1,
89
+ header_fill=0,
90
+ tail_fill=False,
91
+ tail_cs=ChecksumType.BYTE_CHECKSUM,
92
+ )
93
+ framing = XcpFraming(config)
94
+ framing.counter_send = 0xAA
95
+ cmd = 0xFF
96
+ request = framing.prepare_request(cmd, 0x00)
97
+ assert list(request) == [0x02, 0xAA, 0xFF, 0x00, 0xAB]
98
+
99
+
100
+ def test_prepare_request_sxiL1C1CW_1():
101
+ config = XcpFramingConfig(
102
+ transport_layer_type=XcpTransportLayerType.SXI,
103
+ header_len=1,
104
+ header_ctr=1,
105
+ header_fill=0,
106
+ tail_fill=False,
107
+ tail_cs=ChecksumType.WORD_CHECKSUM,
108
+ )
109
+ framing = XcpFraming(config)
110
+ framing.counter_send = 0xAA
111
+ cmd = 0xFF
112
+ request = framing.prepare_request(cmd, 0x00)
113
+ assert list(request) == [0x02, 0xAA, 0xFF, 0x00, 0x01, 0xAB]
114
+
115
+
116
+ def test_prepare_request_sxiL1C1CW_2():
117
+ config = XcpFramingConfig(
118
+ transport_layer_type=XcpTransportLayerType.SXI,
119
+ header_len=1,
120
+ header_ctr=1,
121
+ header_fill=0,
122
+ tail_fill=False,
123
+ tail_cs=ChecksumType.WORD_CHECKSUM,
124
+ )
125
+ framing = XcpFraming(config)
126
+ framing.counter_send = 0xAA
127
+ cmd = 0xFF
128
+ request = framing.prepare_request(cmd, 0x00, 0x55)
129
+ assert list(request) == [0x03, 0xAA, 0xFF, 0x00, 0x55, 0x00, 0x57, 0xAB]
130
+
131
+
132
+ def test_prepare_request_sxiL2CN():
133
+ config = XcpFramingConfig(
134
+ transport_layer_type=XcpTransportLayerType.SXI,
135
+ header_len=2,
136
+ header_ctr=0,
137
+ header_fill=0,
138
+ tail_fill=False,
139
+ tail_cs=ChecksumType.NO_CHECKSUM,
140
+ )
141
+ framing = XcpFraming(config)
142
+ framing.counter_send = 3
143
+ cmd = 0xFF
144
+ request = framing.prepare_request(cmd, 0x00)
145
+ # print("RQ", list(request))
146
+ assert list(request) == [0x02, 0x00, 0xFF, 0x00]
147
+
148
+
149
+ def test_prepare_request_sxiL2CB():
150
+ config = XcpFramingConfig(
151
+ transport_layer_type=XcpTransportLayerType.SXI,
152
+ header_len=2,
153
+ header_ctr=0,
154
+ header_fill=0,
155
+ tail_fill=False,
156
+ tail_cs=ChecksumType.BYTE_CHECKSUM,
157
+ )
158
+ framing = XcpFraming(config)
159
+ framing.counter_send = 3
160
+ cmd = 0xFF
161
+ request = framing.prepare_request(cmd, 0x00)
162
+ # print("RQ", list(request))
163
+ assert list(request) == [0x02, 0x00, 0xFF, 0x00, 0x01]
164
+
165
+
166
+ def test_prepare_request_sxiL2CW_1():
167
+ config = XcpFramingConfig(
168
+ transport_layer_type=XcpTransportLayerType.SXI,
169
+ header_len=2,
170
+ header_ctr=0,
171
+ header_fill=0,
172
+ tail_fill=False,
173
+ tail_cs=ChecksumType.WORD_CHECKSUM,
174
+ )
175
+ framing = XcpFraming(config)
176
+ framing.counter_send = 3
177
+ cmd = 0xFF
178
+ request = framing.prepare_request(cmd, 0x00)
179
+ # print("RQ", list(request))
180
+ assert list(request) == [0x02, 0x00, 0xFF, 0x00, 0x01, 0x01]
181
+
182
+
183
+ def test_prepare_request_sxiL2CW_2():
184
+ config = XcpFramingConfig(
185
+ transport_layer_type=XcpTransportLayerType.SXI,
186
+ header_len=2,
187
+ header_ctr=0,
188
+ header_fill=0,
189
+ tail_fill=False,
190
+ tail_cs=ChecksumType.WORD_CHECKSUM,
191
+ )
192
+ framing = XcpFraming(config)
193
+ framing.counter_send = 3
194
+ cmd = 0xFF
195
+ request = framing.prepare_request(cmd, 0x00, 0x00)
196
+ # print("RQ", list(request))
197
+ assert list(request) == [0x03, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x01]
198
+
199
+
200
+ # const uint8_t FRAME5[] = {0x02, 0x00, 0x03, 0x00, 0xff, 0x00}; // LEN_CTR_WORD / NO_CS
201
+ def test_prepare_request_sxiL2C2CN():
202
+ config = XcpFramingConfig(
203
+ transport_layer_type=XcpTransportLayerType.SXI,
204
+ header_len=2,
205
+ header_ctr=2,
206
+ header_fill=0,
207
+ tail_fill=False,
208
+ tail_cs=ChecksumType.NO_CHECKSUM,
209
+ )
210
+ framing = XcpFraming(config)
211
+ framing.counter_send = 3
212
+ cmd = 0xFF
213
+ request = framing.prepare_request(cmd, 0x00)
214
+ assert list(request) == [0x02, 0x00, 0x03, 0x00, 0xFF, 0x00]
215
+
216
+
217
+ def test_prepare_request_sxiL2C2CB():
218
+ config = XcpFramingConfig(
219
+ transport_layer_type=XcpTransportLayerType.SXI,
220
+ header_len=2,
221
+ header_ctr=2,
222
+ header_fill=0,
223
+ tail_fill=False,
224
+ tail_cs=ChecksumType.BYTE_CHECKSUM,
225
+ )
226
+ framing = XcpFraming(config)
227
+ framing.counter_send = 3
228
+ cmd = 0xFF
229
+ request = framing.prepare_request(cmd, 0x00)
230
+ assert list(request) == [0x02, 0x00, 0x03, 0x00, 0xFF, 0x00, 0x04]
231
+
232
+
233
+ def test_prepare_request_sxiL2C2CW_1():
234
+ config = XcpFramingConfig(
235
+ transport_layer_type=XcpTransportLayerType.SXI,
236
+ header_len=2,
237
+ header_ctr=2,
238
+ header_fill=0,
239
+ tail_fill=False,
240
+ tail_cs=ChecksumType.WORD_CHECKSUM,
241
+ )
242
+ framing = XcpFraming(config)
243
+ framing.counter_send = 3
244
+ cmd = 0xFF
245
+ request = framing.prepare_request(cmd, 0x00)
246
+ assert list(request) == [0x02, 0x00, 0x03, 0x00, 0xFF, 0x00, 0x04, 0x01]
247
+
248
+
249
+ def test_prepare_request_sxiL2C2CW_2():
250
+ config = XcpFramingConfig(
251
+ transport_layer_type=XcpTransportLayerType.SXI,
252
+ header_len=2,
253
+ header_ctr=2,
254
+ header_fill=0,
255
+ tail_fill=False,
256
+ tail_cs=ChecksumType.WORD_CHECKSUM,
257
+ )
258
+ framing = XcpFraming(config)
259
+ framing.counter_send = 3
260
+ cmd = 0xFF
261
+ request = framing.prepare_request(cmd, 0x00, 0x55)
262
+ assert list(request) == [0x03, 0x00, 0x03, 0x00, 0xFF, 0x00, 0x55, 0x00, 0x5A, 0x01]