pyxcp 0.22.30__tar.gz → 0.22.32__tar.gz

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.

Potentially problematic release.


This version of pyxcp might be problematic. Click here for more details.

Files changed (123) hide show
  1. {pyxcp-0.22.30 → pyxcp-0.22.32}/PKG-INFO +1 -1
  2. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyproject.toml +1 -1
  3. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/__init__.py +1 -1
  4. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/extension_wrapper.cpp +1 -0
  5. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/__init__.py +2 -2
  6. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/master/master.py +2 -2
  7. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/converter/__init__.py +13 -13
  8. pyxcp-0.22.32/pyxcp/tests/test_daq_opt.py +426 -0
  9. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_master.py +1 -1
  10. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_transport.py +19 -2
  11. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/base.py +1 -1
  12. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/sxi.py +4 -2
  13. {pyxcp-0.22.30 → pyxcp-0.22.32}/CMakeLists.txt +0 -0
  14. {pyxcp-0.22.30 → pyxcp-0.22.32}/LICENSE +0 -0
  15. {pyxcp-0.22.30 → pyxcp-0.22.32}/README.md +0 -0
  16. {pyxcp-0.22.30 → pyxcp-0.22.32}/build_ext.py +0 -0
  17. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/EtasCANMonitoring.a2l +0 -0
  18. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/EtasCANMonitoring.aml +0 -0
  19. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCP_Common.aml +0 -0
  20. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCPonCAN.aml +0 -0
  21. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCPonEth.aml +0 -0
  22. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCPonFlx.aml +0 -0
  23. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCPonSxI.aml +0 -0
  24. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/XCPonUSB.aml +0 -0
  25. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/ifdata_CAN.a2l +0 -0
  26. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/ifdata_Eth.a2l +0 -0
  27. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/ifdata_Flx.a2l +0 -0
  28. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/ifdata_SxI.a2l +0 -0
  29. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/aml/ifdata_USB.a2l +0 -0
  30. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/asam/__init__.py +0 -0
  31. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/asam/types.py +0 -0
  32. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/asamkeydll.c +0 -0
  33. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/asamkeydll.sh +0 -0
  34. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/checksum.py +0 -0
  35. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cmdline.py +0 -0
  36. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/config/__init__.py +0 -0
  37. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/config/legacy.py +0 -0
  38. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/constants.py +0 -0
  39. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/__init__.py +0 -0
  40. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/bin.hpp +0 -0
  41. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/blockmem.hpp +0 -0
  42. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/daqlist.hpp +0 -0
  43. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/event.hpp +0 -0
  44. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/helper.hpp +0 -0
  45. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/mcobject.hpp +0 -0
  46. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/cpp_ext/tsqueue.hpp +0 -0
  47. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/optimize/__init__.py +0 -0
  48. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/optimize/binpacking.py +0 -0
  49. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/scheduler.cpp +0 -0
  50. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/scheduler.hpp +0 -0
  51. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/stim.cpp +0 -0
  52. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/stim.hpp +0 -0
  53. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/daq_stim/stim_wrapper.cpp +0 -0
  54. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/dllif.py +0 -0
  55. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/errormatrix.py +0 -0
  56. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_can.toml +0 -0
  57. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_can_user.toml +0 -0
  58. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_can_vector.json +0 -0
  59. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_can_vector.toml +0 -0
  60. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_eth.toml +0 -0
  61. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_nixnet.json +0 -0
  62. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_socket_can.toml +0 -0
  63. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_sxi.json +0 -0
  64. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/conf_sxi.toml +0 -0
  65. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/run_daq.py +0 -0
  66. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcp_policy.py +0 -0
  67. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcp_read_benchmark.py +0 -0
  68. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcp_skel.py +0 -0
  69. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcp_unlock.py +0 -0
  70. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcp_user_supplied_driver.py +0 -0
  71. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcphello.py +0 -0
  72. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/examples/xcphello_recorder.py +0 -0
  73. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/master/__init__.py +0 -0
  74. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/master/errorhandler.py +0 -0
  75. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/py.typed +0 -0
  76. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/__init__.py +0 -0
  77. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/build_clang.cmd +0 -0
  78. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/build_clang.sh +0 -0
  79. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/build_gcc.cmd +0 -0
  80. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/build_gcc.sh +0 -0
  81. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/build_gcc_arm.sh +0 -0
  82. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/lz4.c +0 -0
  83. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/lz4.h +0 -0
  84. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/lz4hc.c +0 -0
  85. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/lz4hc.h +0 -0
  86. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/mio.hpp +0 -0
  87. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/reader.hpp +0 -0
  88. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/reco.py +0 -0
  89. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/recorder.rst +0 -0
  90. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/rekorder.cpp +0 -0
  91. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/rekorder.hpp +0 -0
  92. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/setup.py +0 -0
  93. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/test_reko.py +0 -0
  94. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/unfolder.hpp +0 -0
  95. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/wrap.cpp +0 -0
  96. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/recorder/writer.hpp +0 -0
  97. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/__init__.py +0 -0
  98. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/pyxcp_probe_can_drivers.py +0 -0
  99. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xcp_examples.py +0 -0
  100. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xcp_fetch_a2l.py +0 -0
  101. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xcp_id_scanner.py +0 -0
  102. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xcp_info.py +0 -0
  103. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xcp_profile.py +0 -0
  104. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/scripts/xmraw_converter.py +0 -0
  105. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/stim/__init__.py +0 -0
  106. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_asam_types.py +0 -0
  107. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_binpacking.py +0 -0
  108. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_can.py +0 -0
  109. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_checksum.py +0 -0
  110. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_daq.py +0 -0
  111. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_frame_padding.py +0 -0
  112. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/tests/test_utils.py +0 -0
  113. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/timing.py +0 -0
  114. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/__init__.py +0 -0
  115. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/base_transport.hpp +0 -0
  116. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/can.py +0 -0
  117. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/eth.py +0 -0
  118. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/transport_wrapper.cpp +0 -0
  119. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/transport/usb_transport.py +0 -0
  120. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/types.py +0 -0
  121. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/utils.py +0 -0
  122. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/vector/__init__.py +0 -0
  123. {pyxcp-0.22.30 → pyxcp-0.22.32}/pyxcp/vector/map.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyxcp
3
- Version: 0.22.30
3
+ Version: 0.22.32
4
4
  Summary: Universal Calibration Protocol for Python
5
5
  License: LGPLv3
6
6
  Keywords: automotive,ecu,xcp,asam,autosar
@@ -37,7 +37,7 @@ dynamic = ["license", "readme", "authors", "requires-python", "description", "cl
37
37
  [tool.poetry]
38
38
  authors = ["Christoph Schueler <cpu.gems@googlemail.com>"]
39
39
  name = "pyxcp"
40
- version = "0.22.30"
40
+ version = "0.22.32"
41
41
  readme = "README.md"
42
42
  description = "Universal Calibration Protocol for Python"
43
43
  keywords = ["automotive", "ecu", "xcp", "asam", "autosar"]
@@ -17,4 +17,4 @@ tb_install(show_locals=True, max_frames=3) # Install custom exception handler.
17
17
 
18
18
  # if you update this manually, do not forget to update
19
19
  # .bumpversion.cfg and pyproject.toml.
20
- __version__ = "0.22.30"
20
+ __version__ = "0.22.32"
@@ -40,6 +40,7 @@ PYBIND11_MODULE(cpp_ext, m) {
40
40
  .def_property_readonly("components", &McObject::get_components)
41
41
 
42
42
  .def("add_component", &McObject::add_component, "component"_a)
43
+ .def("__eq__", [](const McObject& self, const McObject& other) { return self == other; })
43
44
  .def("__repr__", [](const McObject& self) { return to_string(self); })
44
45
  .def("__hash__", [](const McObject& self) { return self.get_hash(); })
45
46
  ;
@@ -218,8 +218,8 @@ class DaqToCsv(DaqOnlinePolicy):
218
218
  hdr = ",".join(["timestamp0", "timestamp1"] + [h[0] for h in daq_list.headers])
219
219
  out_file.write(f"{hdr}\n")
220
220
 
221
- def on_daq_list(self, daq_list: int, ts0: int, ts1: int, payload: list):
222
- self.files[daq_list].write(f"{ts0},{ts1},{', '.join([str(x) for x in payload])}\n")
221
+ def on_daq_list(self, daq_list: int, timestamp0: int, timestamp1: int, payload: list):
222
+ self.files[daq_list].write(f"{timestamp0},{timestamp1},{', '.join([str(x) for x in payload])}\n")
223
223
 
224
224
  def finalize(self):
225
225
  self.log.debug("DaqCsv::finalize()")
@@ -694,7 +694,7 @@ class Master:
694
694
  callback_remaining = total_length
695
695
  for _ in chunks:
696
696
  block = data[offset : offset + max_payload]
697
- dl_func(block, max_payload, last=True)
697
+ dl_func(block, max_payload, last=False)
698
698
  offset += max_payload
699
699
  callback_remaining -= chunk_size
700
700
  if callback and callback_remaining <= total_length - (total_length / 100) * percent_complete:
@@ -1328,7 +1328,7 @@ class Master:
1328
1328
  if wait_for_optional_response:
1329
1329
  return self.transport.request_optional_response(types.Command.PROGRAM_RESET)
1330
1330
  else:
1331
- return self.transport.block_request(types.Command.PROGRAM_RESET)
1331
+ return self.transport.request(types.Command.PROGRAM_RESET)
1332
1332
 
1333
1333
  @wrapped
1334
1334
  def getPgmProcessorInfo(self):
@@ -98,8 +98,8 @@ class Storage:
98
98
  class StorageContainer:
99
99
  name: str
100
100
  arr: List[Storage] = field(default_factory=[])
101
- ts0: List[int] = field(default_factory=lambda: array("Q"))
102
- ts1: List[int] = field(default_factory=lambda: array("Q"))
101
+ timestamp0: List[int] = field(default_factory=lambda: array("Q"))
102
+ timestamp1: List[int] = field(default_factory=lambda: array("Q"))
103
103
 
104
104
 
105
105
  class XcpLogFileDecoder(_XcpLogFileDecoder):
@@ -158,8 +158,8 @@ class CollectRows:
158
158
 
159
159
  def on_daq_list(self, daq_list_num: int, timestamp0: int, timestamp1: int, measurements: list) -> None:
160
160
  storage_container = self.tables[daq_list_num]
161
- storage_container.ts0.append(timestamp0)
162
- storage_container.ts1.append(timestamp1)
161
+ storage_container.timestamp0.append(timestamp0)
162
+ storage_container.timestamp1.append(timestamp1)
163
163
  for idx, elem in enumerate(measurements):
164
164
  storage = storage_container.arr[idx]
165
165
  storage.arr.append(elem)
@@ -198,8 +198,8 @@ class ArrowConverter(CollectRows, XcpLogFileDecoder):
198
198
  def on_finalize(self) -> None:
199
199
  result = []
200
200
  for arr in self.tables:
201
- timestamp0 = arr.ts0
202
- timestamp1 = arr.ts1
201
+ timestamp0 = arr.timestamp0
202
+ timestamp1 = arr.timestamp1
203
203
  names = ["timestamp0", "timestamp1"]
204
204
  data = [timestamp0, timestamp1]
205
205
  for sd in arr.arr:
@@ -229,7 +229,7 @@ class CsvConverter(XcpLogFileDecoder):
229
229
  fname = f"{sc.name}{self.out_file_suffix}"
230
230
  self.logger.info(f"Creating file {fname!r}.")
231
231
  writer = csv.writer(open(fname, "w", newline=""), dialect="excel")
232
- headers = ["ts0", "ts1"] + [e.name for e in sc.arr]
232
+ headers = ["timestamp0", "timestamp1"] + [e.name for e in sc.arr]
233
233
  writer.writerow(headers)
234
234
  self.csv_writers.append(writer)
235
235
 
@@ -257,7 +257,7 @@ class ExcelConverter(XcpLogFileDecoder):
257
257
  def on_container(self, sc: StorageContainer) -> None:
258
258
  sheet = self.xls_workbook.add_worksheet(sc.name)
259
259
  self.xls_sheets.append(sheet)
260
- headers = ["ts0", "ts1"] + [e.name for e in sc.arr]
260
+ headers = ["timestamp0", "timestamp1"] + [e.name for e in sc.arr]
261
261
  sheet.write_row(0, 0, headers)
262
262
  self.rows.append(1)
263
263
 
@@ -285,8 +285,8 @@ class HdfConverter(CollectRows, XcpLogFileDecoder):
285
285
 
286
286
  def on_finalize(self) -> None:
287
287
  for arr in self.tables:
288
- timestamp0 = arr.ts0
289
- timestamp1 = arr.ts1
288
+ timestamp0 = arr.timestamp0
289
+ timestamp1 = arr.timestamp1
290
290
  self.out_file[f"/{arr.name}/timestamp0"] = timestamp0
291
291
  self.out_file[f"/{arr.name}/timestamp1"] = timestamp1
292
292
  for sd in arr.arr:
@@ -322,7 +322,7 @@ class MdfConverter(CollectRows, XcpLogFileDecoder):
322
322
  mdf4.header = hdr
323
323
  for idx, arr in enumerate(self.tables):
324
324
  signals = []
325
- timestamps = arr.ts0
325
+ timestamps = arr.timestamp0
326
326
  for sd in arr.arr:
327
327
  signal = Signal(samples=sd.arr, name=sd.name, timestamps=timestamps)
328
328
  signals.append(signal)
@@ -369,7 +369,7 @@ class SqliteConverter(XcpLogFileDecoder):
369
369
  self.create_table(sc)
370
370
  self.logger.info(f"Creating table {sc.name!r}.")
371
371
  self.insert_stmt[sc.name] = (
372
- f"""INSERT INTO {sc.name}({', '.join(['ts0', 'ts1'] + [r.name for r in sc.arr])}) VALUES({', '.join(["?" for _ in range(len(sc.arr) + 2)])})"""
372
+ f"""INSERT INTO {sc.name}({', '.join(['timestamp0', 'timestamp1'] + [r.name for r in sc.arr])}) VALUES({', '.join(["?" for _ in range(len(sc.arr) + 2)])})"""
373
373
  )
374
374
 
375
375
  def on_finalize(self) -> None:
@@ -403,7 +403,7 @@ class SqliteConverter(XcpLogFileDecoder):
403
403
  )
404
404
 
405
405
  def create_table(self, sc: StorageContainer) -> None:
406
- columns = ["ts0 INTEGER", "ts1 INTEGER"]
406
+ columns = ["timestamp0 INTEGER", "timestamp1 INTEGER"]
407
407
  for elem in sc.arr:
408
408
  columns.append(f"{elem.name} {elem.target_type}")
409
409
  ddl = f"CREATE TABLE {sc.name}({', '.join(columns)})"
@@ -0,0 +1,426 @@
1
+ #!/usr/bin/env python
2
+
3
+ import pytest
4
+
5
+ from pyxcp.cpp_ext.cpp_ext import Bin, DaqList, McObject # # noqa: F401
6
+ from pyxcp.daq_stim.optimize import make_continuous_blocks
7
+ from pyxcp.daq_stim.optimize.binpacking import first_fit_decreasing
8
+
9
+
10
+ DAQ_LISTS_1 = [
11
+ DaqList(
12
+ "test",
13
+ 0,
14
+ False,
15
+ False,
16
+ [
17
+ ("voltage1", 0x0080051A - 4, 0, "F32"), # 80053a
18
+ ("voltage2", 0x0080051E - 4, 0, "F32"),
19
+ ("voltage3", 0x00800522 - 4, 0, "F32"),
20
+ ("voltage4", 0x00800526 - 4, 0, "F32"),
21
+ ("sine_wave", 0x00800512, 0, "F32"),
22
+ ],
23
+ ),
24
+ ]
25
+
26
+ DAQ_LISTS_2 = [
27
+ DaqList(
28
+ "test",
29
+ 0,
30
+ False,
31
+ False,
32
+ [
33
+ ("voltage1", 0x0080051A, 0, "F32"), # 80053a
34
+ ("voltage2", 0x0080051E, 0, "F32"),
35
+ ("voltage3", 0x00800522, 0, "F32"),
36
+ ("voltage4", 0x00800526, 0, "F32"),
37
+ ("sq0", 0x00800516, 0, "U8"),
38
+ ("sq1", 0x00800517, 0, "U8"),
39
+ ("sine_wave", 0x00800512, 0, "F32"),
40
+ ],
41
+ ),
42
+ ]
43
+
44
+ max_payload_size = 64
45
+ max_payload_size_first = 64
46
+
47
+ EXPECTED_BLOCK_VAR_1_64 = [
48
+ McObject(
49
+ name="",
50
+ address=8389906,
51
+ ext=0,
52
+ data_type="",
53
+ length=20,
54
+ components=[
55
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
56
+ McObject(name="voltage1", address=8389910, ext=0, data_type="F32", length=4, components=[]),
57
+ McObject(name="voltage2", address=8389914, ext=0, data_type="F32", length=4, components=[]),
58
+ McObject(name="voltage3", address=8389918, ext=0, data_type="F32", length=4, components=[]),
59
+ McObject(name="voltage4", address=8389922, ext=0, data_type="F32", length=4, components=[]),
60
+ ],
61
+ )
62
+ ]
63
+
64
+ EXPECTED_BLOCK_VAR_1_8 = [
65
+ McObject(
66
+ name="",
67
+ address=8389906,
68
+ ext=0,
69
+ data_type="",
70
+ length=4,
71
+ components=[McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[])],
72
+ ),
73
+ McObject(
74
+ name="",
75
+ address=8389910,
76
+ ext=0,
77
+ data_type="",
78
+ length=4,
79
+ components=[McObject(name="voltage1", address=8389910, ext=0, data_type="F32", length=4, components=[])],
80
+ ),
81
+ McObject(
82
+ name="",
83
+ address=8389914,
84
+ ext=0,
85
+ data_type="",
86
+ length=4,
87
+ components=[McObject(name="voltage2", address=8389914, ext=0, data_type="F32", length=4, components=[])],
88
+ ),
89
+ McObject(
90
+ name="",
91
+ address=8389918,
92
+ ext=0,
93
+ data_type="",
94
+ length=4,
95
+ components=[McObject(name="voltage3", address=8389918, ext=0, data_type="F32", length=4, components=[])],
96
+ ),
97
+ McObject(
98
+ name="",
99
+ address=8389922,
100
+ ext=0,
101
+ data_type="",
102
+ length=4,
103
+ components=[McObject(name="voltage4", address=8389922, ext=0, data_type="F32", length=4, components=[])],
104
+ ),
105
+ ]
106
+
107
+ EXPECTED_BLOCK_VAR_2_64 = [
108
+ McObject(
109
+ name="",
110
+ address=8389906,
111
+ ext=0,
112
+ data_type="",
113
+ length=6,
114
+ components=[
115
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
116
+ McObject(name="sq0", address=8389910, ext=0, data_type="U8", length=1, components=[]),
117
+ McObject(name="sq1", address=8389911, ext=0, data_type="U8", length=1, components=[]),
118
+ ],
119
+ ),
120
+ McObject(
121
+ name="",
122
+ address=8389914,
123
+ ext=0,
124
+ data_type="",
125
+ length=16,
126
+ components=[
127
+ McObject(name="voltage1", address=8389914, ext=0, data_type="F32", length=4, components=[]),
128
+ McObject(name="voltage2", address=8389918, ext=0, data_type="F32", length=4, components=[]),
129
+ McObject(name="voltage3", address=8389922, ext=0, data_type="F32", length=4, components=[]),
130
+ McObject(name="voltage4", address=8389926, ext=0, data_type="F32", length=4, components=[]),
131
+ ],
132
+ ),
133
+ ]
134
+
135
+ EXPECTED_BLOCK_VAR_2_8 = [
136
+ McObject(
137
+ name="",
138
+ address=8389906,
139
+ ext=0,
140
+ data_type="",
141
+ length=6,
142
+ components=[
143
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
144
+ McObject(name="sq0", address=8389910, ext=0, data_type="U8", length=1, components=[]),
145
+ McObject(name="sq1", address=8389911, ext=0, data_type="U8", length=1, components=[]),
146
+ ],
147
+ ),
148
+ McObject(
149
+ name="",
150
+ address=8389914,
151
+ ext=0,
152
+ data_type="",
153
+ length=4,
154
+ components=[
155
+ McObject(name="voltage1", address=8389914, ext=0, data_type="F32", length=4, components=[]),
156
+ ],
157
+ ),
158
+ McObject(
159
+ name="",
160
+ address=8389918,
161
+ ext=0,
162
+ data_type="",
163
+ length=4,
164
+ components=[
165
+ McObject(name="voltage2", address=8389918, ext=0, data_type="F32", length=4, components=[]),
166
+ ],
167
+ ),
168
+ McObject(
169
+ name="",
170
+ address=8389922,
171
+ ext=0,
172
+ data_type="",
173
+ length=4,
174
+ components=[
175
+ McObject(name="voltage3", address=8389922, ext=0, data_type="F32", length=4, components=[]),
176
+ ],
177
+ ),
178
+ McObject(
179
+ name="",
180
+ address=8389926,
181
+ ext=0,
182
+ data_type="",
183
+ length=4,
184
+ components=[
185
+ McObject(name="voltage4", address=8389926, ext=0, data_type="F32", length=4, components=[]),
186
+ ],
187
+ ),
188
+ ]
189
+
190
+ BIN_PACKING_VAR1_8 = (
191
+ (
192
+ 7,
193
+ 3,
194
+ [
195
+ McObject(
196
+ name="",
197
+ address=8389906,
198
+ ext=0,
199
+ data_type="",
200
+ length=4,
201
+ components=[
202
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
203
+ ],
204
+ )
205
+ ],
206
+ ),
207
+ (
208
+ 7,
209
+ 3,
210
+ [
211
+ McObject(
212
+ name="",
213
+ address=8389910,
214
+ ext=0,
215
+ data_type="",
216
+ length=4,
217
+ components=[
218
+ McObject(name="voltage1", address=8389910, ext=0, data_type="F32", length=4, components=[]),
219
+ ],
220
+ )
221
+ ],
222
+ ),
223
+ (
224
+ 7,
225
+ 3,
226
+ [
227
+ McObject(
228
+ name="",
229
+ address=8389914,
230
+ ext=0,
231
+ data_type="",
232
+ length=4,
233
+ components=[
234
+ McObject(name="voltage2", address=8389914, ext=0, data_type="F32", length=4, components=[]),
235
+ ],
236
+ )
237
+ ],
238
+ ),
239
+ (
240
+ 7,
241
+ 3,
242
+ [
243
+ McObject(
244
+ name="",
245
+ address=8389918,
246
+ ext=0,
247
+ data_type="",
248
+ length=4,
249
+ components=[
250
+ McObject(name="voltage3", address=8389918, ext=0, data_type="F32", length=4, components=[]),
251
+ ],
252
+ )
253
+ ],
254
+ ),
255
+ )
256
+
257
+ BIN_PACKING_VAR2_8 = (
258
+ (
259
+ 7,
260
+ 1,
261
+ [
262
+ McObject(
263
+ name="",
264
+ address=8389906,
265
+ ext=0,
266
+ data_type="",
267
+ length=6,
268
+ components=[
269
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
270
+ McObject(name="sq0", address=8389910, ext=0, data_type="U8", length=1, components=[]),
271
+ McObject(name="sq1", address=8389911, ext=0, data_type="U8", length=1, components=[]),
272
+ ],
273
+ )
274
+ ],
275
+ ),
276
+ (
277
+ 7,
278
+ 3,
279
+ [
280
+ McObject(
281
+ name="",
282
+ address=8389914,
283
+ ext=0,
284
+ data_type="",
285
+ length=4,
286
+ components=[
287
+ McObject(name="voltage1", address=8389914, ext=0, data_type="F32", length=4, components=[]),
288
+ ],
289
+ )
290
+ ],
291
+ ),
292
+ (
293
+ 7,
294
+ 3,
295
+ [
296
+ McObject(
297
+ name="",
298
+ address=8389918,
299
+ ext=0,
300
+ data_type="",
301
+ length=4,
302
+ components=[
303
+ McObject(name="voltage2", address=8389918, ext=0, data_type="F32", length=4, components=[]),
304
+ ],
305
+ )
306
+ ],
307
+ ),
308
+ (
309
+ 7,
310
+ 3,
311
+ [
312
+ McObject(
313
+ name="",
314
+ address=8389922,
315
+ ext=0,
316
+ data_type="",
317
+ length=4,
318
+ components=[
319
+ McObject(name="voltage3", address=8389922, ext=0, data_type="F32", length=4, components=[]),
320
+ ],
321
+ )
322
+ ],
323
+ ),
324
+ (
325
+ 7,
326
+ 3,
327
+ [
328
+ McObject(
329
+ name="",
330
+ address=8389926,
331
+ ext=0,
332
+ data_type="",
333
+ length=4,
334
+ components=[
335
+ McObject(name="voltage4", address=8389926, ext=0, data_type="F32", length=4, components=[]),
336
+ ],
337
+ )
338
+ ],
339
+ ),
340
+ )
341
+
342
+ BIN_PACKING_VAR1_64 = (
343
+ (
344
+ 63,
345
+ 43,
346
+ [
347
+ McObject(
348
+ name="",
349
+ address=8389906,
350
+ ext=0,
351
+ data_type="",
352
+ length=20,
353
+ components=[
354
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
355
+ McObject(name="voltage1", address=8389910, ext=0, data_type="F32", length=4, components=[]),
356
+ McObject(name="voltage2", address=8389914, ext=0, data_type="F32", length=4, components=[]),
357
+ McObject(name="voltage3", address=8389918, ext=0, data_type="F32", length=4, components=[]),
358
+ McObject(name="voltage4", address=8389922, ext=0, data_type="F32", length=4, components=[]),
359
+ ],
360
+ )
361
+ ],
362
+ ),
363
+ )
364
+
365
+ BIN_PACKING_VAR2_64 = (
366
+ 63,
367
+ 41,
368
+ [
369
+ McObject(
370
+ name="",
371
+ address=8389914,
372
+ ext=0,
373
+ data_type="",
374
+ length=16,
375
+ components=[
376
+ McObject(name="voltage1", address=8389914, ext=0, data_type="F32", length=4, components=[]),
377
+ McObject(name="voltage2", address=8389918, ext=0, data_type="F32", length=4, components=[]),
378
+ McObject(name="voltage3", address=8389922, ext=0, data_type="F32", length=4, components=[]),
379
+ McObject(name="voltage4", address=8389926, ext=0, data_type="F32", length=4, components=[]),
380
+ ],
381
+ ),
382
+ McObject(
383
+ name="",
384
+ address=8389906,
385
+ ext=0,
386
+ data_type="",
387
+ length=6,
388
+ components=[
389
+ McObject(name="sine_wave", address=8389906, ext=0, data_type="F32", length=4, components=[]),
390
+ McObject(name="sq0", address=8389910, ext=0, data_type="U8", length=1, components=[]),
391
+ McObject(name="sq1", address=8389911, ext=0, data_type="U8", length=1, components=[]),
392
+ ],
393
+ ),
394
+ ],
395
+ )
396
+
397
+
398
+ @pytest.mark.parametrize(
399
+ "daq_lists, expected_blocks, payload_size",
400
+ [
401
+ (DAQ_LISTS_1, EXPECTED_BLOCK_VAR_1_64, 64),
402
+ (DAQ_LISTS_1, EXPECTED_BLOCK_VAR_1_8, 8),
403
+ (DAQ_LISTS_2, EXPECTED_BLOCK_VAR_2_64, 64),
404
+ (DAQ_LISTS_2, EXPECTED_BLOCK_VAR_2_8, 8),
405
+ ],
406
+ )
407
+ def test_make_continuous_blocks(daq_lists, expected_blocks, payload_size):
408
+ daq_list = daq_lists[0]
409
+ blocks = make_continuous_blocks(daq_list.measurements, payload_size - 1, payload_size - 1)
410
+ for block, expected_block in zip(blocks, expected_blocks):
411
+ assert block == expected_block
412
+
413
+
414
+ @pytest.mark.parametrize(
415
+ "blocks, expected_blocks, payload_size",
416
+ [
417
+ (EXPECTED_BLOCK_VAR_1_8, BIN_PACKING_VAR1_8, 8),
418
+ (EXPECTED_BLOCK_VAR_2_8, BIN_PACKING_VAR2_8, 8),
419
+ (EXPECTED_BLOCK_VAR_1_64, BIN_PACKING_VAR1_64, 64),
420
+ (EXPECTED_BLOCK_VAR_2_64, BIN_PACKING_VAR2_64, 64),
421
+ ],
422
+ )
423
+ def test_first_fit_decreasing(blocks, expected_blocks, payload_size):
424
+ res = first_fit_decreasing(blocks, payload_size - 1, payload_size - 1) # noqa: F841
425
+ # for entry in res:
426
+ # print(entry.size, entry.residual_capacity, entry.entries)
@@ -134,7 +134,7 @@ class TestMaster:
134
134
  def testDisconnect(self, eth):
135
135
  with Master("eth", config=create_config()) as xm:
136
136
  xm.transport = eth()
137
- xm.transport.request.return_value = bytes([])
137
+ xm.transport.request_optional_response.return_value = bytes([])
138
138
  res = xm.disconnect()
139
139
  assert res == b""
140
140
 
@@ -1,11 +1,28 @@
1
+ from unittest import mock
2
+
1
3
  import pytest
2
4
 
3
5
  import pyxcp.transport.base as tr
4
6
 
5
7
 
8
+ def create_config():
9
+ # Exception: XCPonEth - Failed to resolve address <MagicMock name='mock.transport.eth.host' id='2414047113872'>:<MagicMock name='mock.transport.eth.port' id='2414047478992'>
10
+ config = mock.MagicMock()
11
+ config.general.return_value = mock.MagicMock()
12
+ config.transport.return_value = mock.MagicMock()
13
+ config.transport.eth.return_value = mock.MagicMock()
14
+ config.transport.eth.host = "localhost"
15
+ config.transport.eth.port = 5555
16
+ config.transport.eth.bind_to_address = ""
17
+ config.transport.eth.bind_to_port = 0
18
+ config.transport.create_daq_timestamps = False
19
+ return config
20
+
21
+
6
22
  def test_factory_works():
7
- assert isinstance(tr.create_transport("eth"), tr.BaseTransport)
8
- assert isinstance(tr.create_transport("sxi"), tr.BaseTransport)
23
+ config = create_config()
24
+ assert isinstance(tr.create_transport("eth", config=config), tr.BaseTransport)
25
+ assert isinstance(tr.create_transport("sxi", config=config), tr.BaseTransport)
9
26
  assert isinstance(
10
27
  tr.create_transport(
11
28
  "can",
@@ -278,7 +278,7 @@ class BaseTransport(metaclass=abc.ABCMeta):
278
278
  err = types.XcpError.parse(xcpPDU[1:])
279
279
  raise types.XcpResponseError(err)
280
280
  with self.command_lock:
281
- if isinstance(*data, list):
281
+ if isinstance(data, list):
282
282
  data = data[0] # C++ interfacing.
283
283
  frame = self._prepare_request(cmd, *data)
284
284
  with self.policy_lock:
@@ -42,7 +42,7 @@ class SxI(BaseTransport):
42
42
  if self.has_user_supplied_interface and transport_layer_interface:
43
43
  self.comm_port = transport_layer_interface
44
44
  else:
45
- self.logger.info(f"XCPonSxI - trying to open serial comm_port {self.port_name}.")
45
+ self.logger.info(f"XCPonSxI - trying to open serial comm_port {self.port_name!r}.")
46
46
  try:
47
47
  self.comm_port = serial.Serial(
48
48
  port=self.port_name,
@@ -88,7 +88,9 @@ class SxI(BaseTransport):
88
88
  self.unpacker = unpacker
89
89
 
90
90
  def connect(self) -> None:
91
- self.logger.info(f"XCPonSxI - serial comm_port openend: {self.comm_port.portstr}@{self.baudrate} Bits/Sec.")
91
+ self.logger.info(
92
+ f"XCPonSxI - serial comm_port {self.comm_port.portstr!r} openend [{self.baudrate}/{self.bytesize}-{self.parity}-{self.stopbits}]"
93
+ )
92
94
  self.start_listener()
93
95
 
94
96
  def output(self, enable) -> None:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes