pyxcp 0.23.3__cp312-cp312-win_arm64.whl → 0.25.6__cp312-cp312-win_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/asamkeydll.exe +0 -0
- pyxcp/cmdline.py +15 -30
- pyxcp/config/__init__.py +73 -20
- pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
- pyxcp/cpp_ext/bin.hpp +7 -6
- pyxcp/cpp_ext/cpp_ext.cp310-win_arm64.pyd +0 -0
- pyxcp/cpp_ext/cpp_ext.cp311-win_arm64.pyd +0 -0
- pyxcp/cpp_ext/cpp_ext.cp312-win_arm64.pyd +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/mcobject.hpp +5 -3
- pyxcp/cpp_ext/sxi_framing.hpp +332 -0
- pyxcp/daq_stim/__init__.py +182 -45
- pyxcp/daq_stim/optimize/binpacking.py +2 -2
- pyxcp/daq_stim/scheduler.cpp +8 -8
- pyxcp/daq_stim/stim.cp310-win_arm64.pyd +0 -0
- pyxcp/daq_stim/stim.cp311-win_arm64.pyd +0 -0
- pyxcp/daq_stim/stim.cp312-win_arm64.pyd +0 -0
- pyxcp/errormatrix.py +2 -2
- pyxcp/examples/run_daq.py +5 -3
- 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 +248 -13
- pyxcp/master/master.py +838 -250
- 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 +5 -10
- pyxcp/recorder/converter/__init__.py +4 -10
- pyxcp/recorder/reader.hpp +0 -1
- pyxcp/recorder/reco.py +1 -0
- pyxcp/recorder/rekorder.cp310-win_arm64.pyd +0 -0
- pyxcp/recorder/rekorder.cp311-win_arm64.pyd +0 -0
- pyxcp/recorder/rekorder.cp312-win_arm64.pyd +0 -0
- pyxcp/recorder/unfolder.hpp +129 -107
- pyxcp/recorder/wrap.cpp +3 -8
- 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 +187 -143
- pyxcp/transport/can.py +117 -13
- pyxcp/transport/eth.py +55 -20
- pyxcp/transport/hdf5_policy.py +167 -0
- pyxcp/transport/sxi.py +126 -52
- pyxcp/transport/transport_ext.cp310-win_arm64.pyd +0 -0
- pyxcp/transport/transport_ext.cp311-win_arm64.pyd +0 -0
- pyxcp/transport/transport_ext.cp312-win_arm64.pyd +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} +3 -4
- pyxcp/utils/cli.py +78 -0
- pyxcp-0.25.6.dist-info/METADATA +341 -0
- pyxcp-0.25.6.dist-info/RECORD +153 -0
- {pyxcp-0.23.3.dist-info → pyxcp-0.25.6.dist-info}/WHEEL +1 -1
- pyxcp/examples/conf_sxi.json +0 -9
- pyxcp/examples/conf_sxi.toml +0 -7
- pyxcp-0.23.3.dist-info/METADATA +0 -219
- pyxcp-0.23.3.dist-info/RECORD +0 -131
- {pyxcp-0.23.3.dist-info → pyxcp-0.25.6.dist-info}/entry_points.txt +0 -0
- {pyxcp-0.23.3.dist-info → pyxcp-0.25.6.dist-info/licenses}/LICENSE +0 -0
pyxcp/tests/test_transport.py
CHANGED
|
@@ -1,55 +1,151 @@
|
|
|
1
1
|
from unittest import mock
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
|
+
import serial
|
|
5
|
+
from can.bus import BusABC
|
|
4
6
|
|
|
5
7
|
import pyxcp.transport.base as tr
|
|
6
8
|
|
|
7
9
|
|
|
10
|
+
def create_mock_serial():
|
|
11
|
+
"""Create a mock serial port for testing."""
|
|
12
|
+
mock_serial = mock.MagicMock(spec=serial.Serial)
|
|
13
|
+
mock_serial.portstr = "MOCK_PORT"
|
|
14
|
+
mock_serial.in_waiting = 0
|
|
15
|
+
mock_serial.read.return_value = b""
|
|
16
|
+
mock_serial.is_open = True
|
|
17
|
+
return mock_serial
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def create_mock_can_interface():
|
|
21
|
+
"""Create a mock CAN interface for testing."""
|
|
22
|
+
mock_can = mock.MagicMock(spec=BusABC)
|
|
23
|
+
mock_can.filters = []
|
|
24
|
+
mock_can.state = "ACTIVE"
|
|
25
|
+
mock_can.recv.return_value = None
|
|
26
|
+
return mock_can
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Mock CAN interface configuration class
|
|
30
|
+
class MockCanInterfaceConfig:
|
|
31
|
+
OPTIONAL_BASE_PARAMS = []
|
|
32
|
+
CAN_PARAM_MAP = {}
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def class_own_traits(cls):
|
|
36
|
+
return {}
|
|
37
|
+
|
|
38
|
+
|
|
8
39
|
def create_config():
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
# Create a class to simulate the config structure
|
|
41
|
+
class EthConfig:
|
|
42
|
+
def __init__(self):
|
|
43
|
+
self.host = "localhost"
|
|
44
|
+
self.port = 5555
|
|
45
|
+
self.bind_to_address = ""
|
|
46
|
+
self.bind_to_port = 0
|
|
47
|
+
self.protocol = "UDP"
|
|
48
|
+
self.ipv6 = False
|
|
49
|
+
self.tcp_nodelay = False
|
|
50
|
+
|
|
51
|
+
class SxiConfig:
|
|
52
|
+
def __init__(self):
|
|
53
|
+
self.port = "MOCK_PORT" # This won't be used with the mock
|
|
54
|
+
self.bitrate = 115200
|
|
55
|
+
self.bytesize = 8
|
|
56
|
+
self.parity = "N"
|
|
57
|
+
self.stopbits = 1
|
|
58
|
+
self.mode = "NORMAL"
|
|
59
|
+
self.header_format = "HEADER_LEN_BYTE"
|
|
60
|
+
self.tail_format = ""
|
|
61
|
+
self.framing = 0
|
|
62
|
+
self.esc_sync = 0
|
|
63
|
+
self.esc_esc = 0
|
|
64
|
+
|
|
65
|
+
class CanConfig:
|
|
66
|
+
def __init__(self):
|
|
67
|
+
self.can_id_master = 1
|
|
68
|
+
self.can_id_slave = 2
|
|
69
|
+
self.interface = "MockCanInterface"
|
|
70
|
+
self.channel = "vcan0"
|
|
71
|
+
self.use_default_listener = False # Don't start the listener
|
|
72
|
+
self.fd = False
|
|
73
|
+
self.max_dlc_required = False
|
|
74
|
+
self.padding_value = 0
|
|
75
|
+
self.timeout = 1.0
|
|
76
|
+
self.daq_identifier = [] # Empty list for DAQ identifiers
|
|
77
|
+
|
|
78
|
+
# Add the MockCanInterface attribute
|
|
79
|
+
self.MockCanInterface = MockCanInterfaceConfig()
|
|
80
|
+
|
|
81
|
+
# Special flag for testing
|
|
82
|
+
self.testing = True
|
|
83
|
+
|
|
84
|
+
class Config:
|
|
85
|
+
def __init__(self):
|
|
86
|
+
# Set attributes directly on the class for BaseTransport.load_config
|
|
87
|
+
self.eth = EthConfig()
|
|
88
|
+
self.sxi = SxiConfig()
|
|
89
|
+
self.can = CanConfig()
|
|
90
|
+
|
|
91
|
+
# Set attributes for BaseTransport.__init__
|
|
92
|
+
self.create_daq_timestamps = False
|
|
93
|
+
self.alignment = 1
|
|
94
|
+
self.timeout = 1.0
|
|
95
|
+
|
|
96
|
+
return Config()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@mock.patch("pyxcp.transport.can.detect_available_configs")
|
|
100
|
+
@mock.patch("pyxcp.transport.can.CAN_INTERFACE_MAP")
|
|
101
|
+
def test_factory_works(mock_can_interface_map, mock_detect_configs):
|
|
102
|
+
# Mock the detect_available_configs function to return an empty list
|
|
103
|
+
mock_detect_configs.return_value = []
|
|
104
|
+
|
|
105
|
+
# Mock the CAN_INTERFACE_MAP to return an instance of our MockCanInterfaceConfig for any key
|
|
106
|
+
mock_can_interface_map.__getitem__.return_value = MockCanInterfaceConfig()
|
|
107
|
+
|
|
23
108
|
config = create_config()
|
|
109
|
+
mock_serial_port = create_mock_serial()
|
|
110
|
+
mock_can_interface = create_mock_can_interface()
|
|
111
|
+
|
|
112
|
+
# Test ETH transport
|
|
24
113
|
assert isinstance(tr.create_transport("eth", config=config), tr.BaseTransport)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
114
|
+
|
|
115
|
+
# Test SXI transport with mock serial port
|
|
116
|
+
assert isinstance(tr.create_transport("sxi", config=config, transport_layer_interface=mock_serial_port), tr.BaseTransport)
|
|
117
|
+
|
|
118
|
+
# Test CAN transport with mock CAN interface
|
|
119
|
+
# assert isinstance(
|
|
120
|
+
# tr.create_transport("can", config=config, transport_layer_interface=mock_can_interface),
|
|
121
|
+
# tr.BaseTransport,
|
|
122
|
+
# )
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@mock.patch("pyxcp.transport.can.detect_available_configs")
|
|
126
|
+
@mock.patch("pyxcp.transport.can.CAN_INTERFACE_MAP")
|
|
127
|
+
def test_factory_works_case_insensitive(mock_can_interface_map, mock_detect_configs):
|
|
128
|
+
# Mock the detect_available_configs function to return an empty list
|
|
129
|
+
mock_detect_configs.return_value = []
|
|
130
|
+
|
|
131
|
+
# Mock the CAN_INTERFACE_MAP to return an instance of our MockCanInterfaceConfig for any key
|
|
132
|
+
mock_can_interface_map.__getitem__.return_value = MockCanInterfaceConfig()
|
|
133
|
+
|
|
134
|
+
config = create_config()
|
|
135
|
+
mock_serial_port = create_mock_serial()
|
|
136
|
+
mock_can_interface = create_mock_can_interface()
|
|
137
|
+
|
|
138
|
+
# Test ETH transport with uppercase name
|
|
139
|
+
assert isinstance(tr.create_transport("ETH", config=config), tr.BaseTransport)
|
|
140
|
+
|
|
141
|
+
# Test SXI transport with uppercase name and mock serial port
|
|
142
|
+
assert isinstance(tr.create_transport("SXI", config=config, transport_layer_interface=mock_serial_port), tr.BaseTransport)
|
|
143
|
+
|
|
144
|
+
# Test CAN transport with uppercase name and mock CAN interface
|
|
145
|
+
# assert isinstance(
|
|
146
|
+
# tr.create_transport("CAN", config=config, transport_layer_interface=mock_can_interface),
|
|
147
|
+
# tr.BaseTransport,
|
|
148
|
+
# )
|
|
53
149
|
|
|
54
150
|
|
|
55
151
|
def test_factory_invalid_transport_name_raises():
|
pyxcp/timing.py
CHANGED
|
@@ -12,7 +12,7 @@ class Timing:
|
|
|
12
12
|
T_MS: "mS",
|
|
13
13
|
T_S: "S",
|
|
14
14
|
}
|
|
15
|
-
FMT = "min: {0:2.3f} {4}\nmax: {1:2.3f} {4}\
|
|
15
|
+
FMT = "min: {0:2.3f} {4}\nmax: {1:2.3f} {4}\navg: {2:2.3f} {4}\nlast: {3:2.3f} {4}"
|
|
16
16
|
|
|
17
17
|
def __init__(self, unit=T_MS, record=False):
|
|
18
18
|
self.min = None
|
pyxcp/transport/__init__.py
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
from .
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
# from .transport_ext import (
|
|
3
|
+
# FrameAcquisitionPolicy, # noqa: F401
|
|
4
|
+
# FrameRecorderPolicy, # noqa: F401
|
|
5
|
+
# LegacyFrameAcquisitionPolicy, # noqa: F401
|
|
6
|
+
# NoOpPolicy, # noqa: F401
|
|
7
|
+
# StdoutPolicy, # noqa: F401
|
|
8
|
+
# )
|
|
9
|
+
|
|
7
10
|
from .can import Can # noqa: F401
|
|
8
11
|
from .eth import Eth # noqa: F401
|
|
9
12
|
from .sxi import SxI # noqa: F401
|