pyxcp 0.23.8__cp313-cp313-macosx_11_0_arm64.whl → 0.25.7__cp313-cp313-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.
- pyxcp/__init__.py +1 -1
- pyxcp/cmdline.py +14 -29
- pyxcp/config/__init__.py +1257 -1258
- pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
- pyxcp/cpp_ext/bin.hpp +7 -6
- pyxcp/cpp_ext/cpp_ext.cpython-310-darwin.so +0 -0
- pyxcp/cpp_ext/cpp_ext.cpython-311-darwin.so +0 -0
- pyxcp/cpp_ext/cpp_ext.cpython-312-darwin.so +0 -0
- pyxcp/cpp_ext/cpp_ext.cpython-313-darwin.so +0 -0
- pyxcp/cpp_ext/daqlist.hpp +241 -73
- pyxcp/cpp_ext/extension_wrapper.cpp +123 -15
- pyxcp/cpp_ext/framing.hpp +360 -0
- pyxcp/cpp_ext/helper.hpp +280 -280
- pyxcp/cpp_ext/mcobject.hpp +248 -246
- pyxcp/cpp_ext/sxi_framing.hpp +332 -0
- pyxcp/daq_stim/__init__.py +145 -67
- pyxcp/daq_stim/optimize/binpacking.py +2 -2
- pyxcp/daq_stim/scheduler.cpp +8 -8
- pyxcp/errormatrix.py +2 -2
- pyxcp/examples/run_daq.py +5 -4
- pyxcp/examples/xcp_policy.py +6 -6
- pyxcp/examples/xcp_read_benchmark.py +2 -2
- pyxcp/examples/xcp_skel.py +1 -2
- pyxcp/examples/xcp_unlock.py +10 -12
- pyxcp/examples/xcp_user_supplied_driver.py +1 -2
- pyxcp/examples/xcphello.py +2 -15
- pyxcp/examples/xcphello_recorder.py +2 -2
- pyxcp/master/__init__.py +1 -0
- pyxcp/master/errorhandler.py +134 -4
- pyxcp/master/master.py +823 -252
- pyxcp/recorder/.idea/.gitignore +8 -0
- pyxcp/recorder/.idea/misc.xml +4 -0
- pyxcp/recorder/.idea/modules.xml +8 -0
- pyxcp/recorder/.idea/recorder.iml +6 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +7 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/index.pb +7 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/index.pb +7 -0
- pyxcp/recorder/.idea/vcs.xml +10 -0
- pyxcp/recorder/__init__.py +96 -98
- pyxcp/recorder/converter/__init__.py +4 -10
- pyxcp/recorder/reader.hpp +138 -139
- pyxcp/recorder/reco.py +1 -0
- pyxcp/recorder/rekorder.cpython-310-darwin.so +0 -0
- pyxcp/recorder/rekorder.cpython-311-darwin.so +0 -0
- pyxcp/recorder/rekorder.cpython-312-darwin.so +0 -0
- pyxcp/recorder/rekorder.cpython-313-darwin.so +0 -0
- pyxcp/recorder/rekorder.hpp +274 -274
- pyxcp/recorder/unfolder.hpp +1354 -1319
- pyxcp/recorder/wrap.cpp +184 -183
- pyxcp/recorder/writer.hpp +302 -302
- pyxcp/scripts/xcp_daq_recorder.py +54 -0
- pyxcp/scripts/xcp_fetch_a2l.py +2 -2
- pyxcp/scripts/xcp_id_scanner.py +1 -2
- pyxcp/scripts/xcp_info.py +66 -51
- pyxcp/scripts/xcp_profile.py +1 -2
- pyxcp/tests/test_daq.py +1 -1
- pyxcp/tests/test_framing.py +262 -0
- pyxcp/tests/test_master.py +210 -100
- pyxcp/tests/test_transport.py +138 -42
- pyxcp/timing.py +1 -1
- pyxcp/transport/__init__.py +8 -5
- pyxcp/transport/base.py +70 -180
- pyxcp/transport/can.py +58 -7
- pyxcp/transport/eth.py +32 -15
- pyxcp/transport/hdf5_policy.py +167 -0
- pyxcp/transport/sxi.py +126 -52
- pyxcp/transport/transport_ext.cpython-310-darwin.so +0 -0
- pyxcp/transport/transport_ext.cpython-311-darwin.so +0 -0
- pyxcp/transport/transport_ext.cpython-312-darwin.so +0 -0
- pyxcp/transport/transport_ext.cpython-313-darwin.so +0 -0
- pyxcp/transport/transport_ext.hpp +214 -0
- pyxcp/transport/transport_wrapper.cpp +249 -0
- pyxcp/transport/usb_transport.py +47 -31
- pyxcp/types.py +0 -13
- pyxcp/{utils.py → utils/__init__.py} +1 -2
- pyxcp/utils/cli.py +78 -0
- {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/METADATA +4 -2
- pyxcp-0.25.7.dist-info/RECORD +158 -0
- {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/WHEEL +1 -1
- pyxcp/examples/conf_sxi.json +0 -9
- pyxcp/examples/conf_sxi.toml +0 -7
- pyxcp-0.23.8.dist-info/RECORD +0 -135
- {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/entry_points.txt +0 -0
- {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info/licenses}/LICENSE +0 -0
pyxcp/scripts/xcp_id_scanner.py
CHANGED
pyxcp/scripts/xcp_info.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
"""XCP info/exploration tool."""
|
|
4
4
|
|
|
5
|
+
import argparse
|
|
5
6
|
from pprint import pprint
|
|
6
7
|
|
|
7
8
|
from pyxcp.cmdline import ArgumentParser
|
|
@@ -46,7 +47,12 @@ def getPagInfo(x):
|
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
def main():
|
|
49
|
-
|
|
50
|
+
parser = argparse.ArgumentParser(description="XCP info/exploration tool.")
|
|
51
|
+
parser.add_argument("--no-daq", action="store_true", help="Do not query DAQ information.")
|
|
52
|
+
parser.add_argument("--no-pag", action="store_true", help="Do not query PAG information.")
|
|
53
|
+
parser.add_argument("--no-pgm", action="store_true", help="Do not query PGM information.")
|
|
54
|
+
parser.add_argument("--no-ids", action="store_true", help="Do not scan implemented IDs.")
|
|
55
|
+
ap = ArgumentParser(parser)
|
|
50
56
|
|
|
51
57
|
with ap.run() as x:
|
|
52
58
|
x.connect()
|
|
@@ -56,64 +62,73 @@ def main():
|
|
|
56
62
|
print("=================")
|
|
57
63
|
pprint(x.slaveProperties)
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
if not ap.args.no_ids:
|
|
66
|
+
result = x.id_scanner()
|
|
67
|
+
print("\n")
|
|
68
|
+
print("Implemented IDs:")
|
|
69
|
+
print("================")
|
|
70
|
+
for key, value in result.items():
|
|
71
|
+
print(f"{key}: {value}", end="\n\n")
|
|
72
|
+
|
|
65
73
|
cps = x.getCurrentProtectionStatus()
|
|
66
74
|
print("\nProtection Status")
|
|
67
75
|
print("=================")
|
|
68
76
|
for k, v in cps.items():
|
|
69
77
|
print(f" {k:6s}: {v}")
|
|
70
78
|
x.cond_unlock()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if
|
|
82
|
-
print("
|
|
79
|
+
|
|
80
|
+
if not ap.args.no_daq:
|
|
81
|
+
print("\nDAQ Info:")
|
|
82
|
+
print("=========")
|
|
83
|
+
if x.slaveProperties.supportsDaq:
|
|
84
|
+
daq_info = x.getDaqInfo()
|
|
85
|
+
pprint(daq_info)
|
|
86
|
+
|
|
87
|
+
daq_pro = daq_info["processor"]
|
|
88
|
+
daq_properties = daq_pro["properties"]
|
|
89
|
+
if x.slaveProperties.transport_layer == "CAN":
|
|
90
|
+
print("")
|
|
91
|
+
if daq_properties["pidOffSupported"]:
|
|
92
|
+
print("*** pidOffSupported -- i.e. one CAN-ID per DAQ-list.")
|
|
93
|
+
else:
|
|
94
|
+
print("*** NO support for PID_OFF")
|
|
95
|
+
num_predefined = daq_pro["minDaq"]
|
|
96
|
+
print("\nPredefined DAQ-Lists")
|
|
97
|
+
print("====================")
|
|
98
|
+
if num_predefined > 0:
|
|
99
|
+
print(f"There are {num_predefined} predefined DAQ-lists")
|
|
100
|
+
for idx in range(num_predefined):
|
|
101
|
+
print(f"DAQ-List #{idx}\n____________\n")
|
|
102
|
+
status, dm = x.try_command(x.getDaqListMode, idx)
|
|
103
|
+
if status == TryCommandResult.OK:
|
|
104
|
+
print(dm)
|
|
105
|
+
status, di = x.try_command(x.getDaqListInfo, idx)
|
|
106
|
+
if status == TryCommandResult.OK:
|
|
107
|
+
print(di)
|
|
83
108
|
else:
|
|
84
|
-
print("*** NO
|
|
85
|
-
num_predefined = daq_pro["minDaq"]
|
|
86
|
-
print("\nPredefined DAQ-Lists")
|
|
87
|
-
print("====================")
|
|
88
|
-
if num_predefined > 0:
|
|
89
|
-
print(f"There are {num_predefined} predefined DAQ-lists")
|
|
90
|
-
for idx in range(num_predefined):
|
|
91
|
-
print(f"DAQ-List #{idx}\n____________\n")
|
|
92
|
-
status, dm = x.try_command(x.getDaqListMode, idx)
|
|
93
|
-
if status == TryCommandResult.OK:
|
|
94
|
-
print(dm)
|
|
95
|
-
status, di = x.try_command(x.getDaqListInfo, idx)
|
|
96
|
-
if status == TryCommandResult.OK:
|
|
97
|
-
print(di)
|
|
109
|
+
print("*** NO Predefined DAQ-Lists")
|
|
98
110
|
else:
|
|
99
|
-
print("***
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
print("*** DAQ IS NOT SUPPORTED .")
|
|
112
|
+
|
|
113
|
+
if not ap.args.no_pag:
|
|
114
|
+
print("\nPAG Info:")
|
|
115
|
+
print("=========")
|
|
116
|
+
if x.slaveProperties.supportsCalpag:
|
|
117
|
+
pgi = getPagInfo(x)
|
|
118
|
+
pprint(pgi)
|
|
119
|
+
else:
|
|
120
|
+
print("*** PAGING IS NOT SUPPORTED.")
|
|
121
|
+
|
|
122
|
+
if not ap.args.no_pgm:
|
|
123
|
+
print("\nPGM Info:")
|
|
124
|
+
print("=========")
|
|
125
|
+
if x.slaveProperties.supportsPgm:
|
|
126
|
+
status, pgm = x.try_command(x.getPgmProcessorInfo)
|
|
127
|
+
if status == TryCommandResult.OK:
|
|
128
|
+
print(pgm)
|
|
129
|
+
else:
|
|
130
|
+
print("*** FLASH PROGRAMMING IS NOT SUPPORTED.")
|
|
131
|
+
|
|
117
132
|
if x.slaveProperties.transport_layer == "CAN":
|
|
118
133
|
print("\nTransport-Layer CAN:")
|
|
119
134
|
print("====================")
|
pyxcp/scripts/xcp_profile.py
CHANGED
pyxcp/tests/test_daq.py
CHANGED
|
@@ -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]
|