pyxcp 0.21.9__cp38-cp38-win_amd64.whl → 0.22.23__cp38-cp38-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.
Potentially problematic release.
This version of pyxcp might be problematic. Click here for more details.
- pyxcp/__init__.py +12 -20
- pyxcp/aml/EtasCANMonitoring.a2l +82 -83
- pyxcp/aml/XCP_Common.aml +0 -1
- pyxcp/aml/XCPonUSB.aml +1 -1
- pyxcp/aml/ifdata_CAN.a2l +0 -1
- pyxcp/aml/ifdata_Eth.a2l +0 -1
- pyxcp/aml/ifdata_Flx.a2l +0 -1
- pyxcp/aml/ifdata_SxI.a2l +0 -1
- pyxcp/aml/ifdata_USB.a2l +0 -1
- pyxcp/asam/types.py +4 -4
- pyxcp/asamkeydll.c +0 -1
- pyxcp/checksum.py +0 -1
- pyxcp/cmdline.py +32 -50
- pyxcp/config/__init__.py +1100 -0
- pyxcp/config/legacy.py +120 -0
- pyxcp/constants.py +12 -13
- pyxcp/cpp_ext/__init__.py +0 -0
- pyxcp/cpp_ext/bin.hpp +104 -0
- pyxcp/cpp_ext/blockmem.hpp +58 -0
- pyxcp/cpp_ext/cpp_ext.cp38-win_amd64.pyd +0 -0
- pyxcp/cpp_ext/daqlist.hpp +200 -0
- pyxcp/cpp_ext/event.hpp +67 -0
- pyxcp/cpp_ext/extension_wrapper.cpp +96 -0
- pyxcp/cpp_ext/helper.hpp +280 -0
- pyxcp/cpp_ext/mcobject.hpp +246 -0
- pyxcp/cpp_ext/tsqueue.hpp +46 -0
- pyxcp/daq_stim/__init__.py +228 -0
- pyxcp/daq_stim/optimize/__init__.py +67 -0
- pyxcp/daq_stim/optimize/binpacking.py +41 -0
- pyxcp/daq_stim/scheduler.cpp +28 -0
- pyxcp/daq_stim/scheduler.hpp +75 -0
- pyxcp/daq_stim/stim.cp38-win_amd64.pyd +0 -0
- pyxcp/daq_stim/stim.cpp +13 -0
- pyxcp/daq_stim/stim.hpp +604 -0
- pyxcp/daq_stim/stim_wrapper.cpp +48 -0
- pyxcp/dllif.py +21 -18
- pyxcp/errormatrix.py +5 -3
- pyxcp/examples/conf_can.toml +4 -2
- pyxcp/examples/conf_can_vector.json +9 -9
- pyxcp/examples/conf_can_vector.toml +4 -2
- pyxcp/examples/conf_eth.toml +5 -2
- pyxcp/examples/conf_nixnet.json +18 -18
- pyxcp/examples/conf_sxi.json +7 -7
- pyxcp/examples/ex_arrow.py +109 -0
- pyxcp/examples/ex_csv.py +85 -0
- pyxcp/examples/ex_excel.py +95 -0
- pyxcp/examples/ex_mdf.py +124 -0
- pyxcp/examples/ex_sqlite.py +128 -0
- pyxcp/examples/run_daq.py +148 -0
- pyxcp/examples/xcp_policy.py +6 -7
- pyxcp/examples/xcp_read_benchmark.py +8 -6
- pyxcp/examples/xcp_skel.py +0 -2
- pyxcp/examples/xcp_unlock.py +1 -1
- pyxcp/examples/xcp_user_supplied_driver.py +1 -2
- pyxcp/examples/xcphello.py +6 -3
- pyxcp/examples/xcphello_recorder.py +4 -4
- pyxcp/master/__init__.py +1 -2
- pyxcp/master/errorhandler.py +107 -74
- pyxcp/master/master.py +196 -114
- pyxcp/py.typed +0 -0
- pyxcp/recorder/__init__.py +27 -6
- pyxcp/recorder/converter/__init__.py +37 -0
- pyxcp/recorder/lz4.c +129 -51
- pyxcp/recorder/lz4.h +45 -28
- pyxcp/recorder/lz4hc.c +560 -156
- pyxcp/recorder/lz4hc.h +1 -1
- pyxcp/recorder/mio.hpp +721 -767
- pyxcp/recorder/reader.hpp +139 -0
- pyxcp/recorder/reco.py +5 -8
- pyxcp/recorder/rekorder.cp38-win_amd64.pyd +0 -0
- pyxcp/recorder/rekorder.cpp +18 -22
- pyxcp/recorder/rekorder.hpp +200 -587
- pyxcp/recorder/setup.py +11 -10
- pyxcp/recorder/test_reko.py +2 -3
- pyxcp/recorder/unfolder.hpp +1332 -0
- pyxcp/recorder/wrap.cpp +171 -9
- pyxcp/recorder/writer.hpp +302 -0
- pyxcp/scripts/pyxcp_probe_can_drivers.py +0 -2
- pyxcp/scripts/xcp_examples.py +64 -0
- pyxcp/scripts/xcp_fetch_a2l.py +15 -10
- pyxcp/scripts/xcp_id_scanner.py +2 -6
- pyxcp/scripts/xcp_info.py +101 -63
- pyxcp/scripts/xcp_profile.py +27 -0
- pyxcp/stim/__init__.py +0 -0
- pyxcp/tests/test_asam_types.py +2 -2
- pyxcp/tests/test_binpacking.py +186 -0
- pyxcp/tests/test_can.py +1132 -38
- pyxcp/tests/test_checksum.py +2 -1
- pyxcp/tests/test_daq.py +193 -0
- pyxcp/tests/test_frame_padding.py +6 -3
- pyxcp/tests/test_master.py +42 -31
- pyxcp/tests/test_transport.py +12 -12
- pyxcp/tests/test_utils.py +2 -5
- pyxcp/timing.py +0 -2
- pyxcp/transport/__init__.py +9 -9
- pyxcp/transport/base.py +149 -127
- pyxcp/transport/base_transport.hpp +0 -0
- pyxcp/transport/can.py +194 -167
- pyxcp/transport/eth.py +80 -82
- pyxcp/transport/sxi.py +106 -60
- pyxcp/transport/transport_wrapper.cpp +0 -0
- pyxcp/transport/usb_transport.py +65 -83
- pyxcp/types.py +69 -20
- pyxcp/utils.py +47 -16
- pyxcp/vector/map.py +1 -3
- {pyxcp-0.21.9.dist-info → pyxcp-0.22.23.dist-info}/METADATA +27 -22
- pyxcp-0.22.23.dist-info/RECORD +128 -0
- {pyxcp-0.21.9.dist-info → pyxcp-0.22.23.dist-info}/WHEEL +1 -1
- {pyxcp-0.21.9.dist-info → pyxcp-0.22.23.dist-info}/entry_points.txt +2 -0
- pyxcp/config.py +0 -57
- pyxcp/cxx/asynchiofactory.hpp +0 -24
- pyxcp/cxx/blocking_client.cpp +0 -44
- pyxcp/cxx/blocking_socket.cpp +0 -43
- pyxcp/cxx/blocking_socket.hpp +0 -558
- pyxcp/cxx/concurrent_queue.hpp +0 -60
- pyxcp/cxx/eth.hpp +0 -57
- pyxcp/cxx/exceptions.hpp +0 -30
- pyxcp/cxx/iasyncioservice.hpp +0 -31
- pyxcp/cxx/iresource.hpp +0 -17
- pyxcp/cxx/isocket.hpp +0 -22
- pyxcp/cxx/linux/epoll.cpp +0 -51
- pyxcp/cxx/linux/epoll.hpp +0 -87
- pyxcp/cxx/linux/lit_tester.cpp +0 -19
- pyxcp/cxx/linux/socket.hpp +0 -234
- pyxcp/cxx/linux/timeout.hpp +0 -81
- pyxcp/cxx/memoryblock.hpp +0 -42
- pyxcp/cxx/pool.hpp +0 -81
- pyxcp/cxx/poolmgr.cpp +0 -6
- pyxcp/cxx/poolmgr.hpp +0 -31
- pyxcp/cxx/test_queue.cpp +0 -69
- pyxcp/cxx/timestamp.hpp +0 -84
- pyxcp/cxx/utils.cpp +0 -38
- pyxcp/cxx/utils.hpp +0 -29
- pyxcp/cxx/win/iocp.cpp +0 -242
- pyxcp/cxx/win/iocp.hpp +0 -42
- pyxcp/cxx/win/perhandledata.hpp +0 -24
- pyxcp/cxx/win/periodata.hpp +0 -97
- pyxcp/cxx/win/socket.hpp +0 -185
- pyxcp/cxx/win/timeout.hpp +0 -83
- pyxcp/examples/conf_can.json +0 -20
- pyxcp/examples/conf_eth.json +0 -8
- pyxcp/logger.py +0 -67
- pyxcp/tests/test_config.py +0 -62
- pyxcp/transport/candriver/__init__.py +0 -2
- pyxcp/transport/candriver/pc_canalystii.py +0 -27
- pyxcp/transport/candriver/pc_etas.py +0 -25
- pyxcp/transport/candriver/pc_gsusb.py +0 -23
- pyxcp/transport/candriver/pc_iscan.py +0 -23
- pyxcp/transport/candriver/pc_ixxat.py +0 -27
- pyxcp/transport/candriver/pc_kvaser.py +0 -39
- pyxcp/transport/candriver/pc_neovi.py +0 -31
- pyxcp/transport/candriver/pc_nican.py +0 -23
- pyxcp/transport/candriver/pc_nixnet.py +0 -23
- pyxcp/transport/candriver/pc_pcan.py +0 -25
- pyxcp/transport/candriver/pc_seeed.py +0 -28
- pyxcp/transport/candriver/pc_serial.py +0 -27
- pyxcp/transport/candriver/pc_slcan.py +0 -29
- pyxcp/transport/candriver/pc_socketcan.py +0 -23
- pyxcp/transport/candriver/pc_systec.py +0 -29
- pyxcp/transport/candriver/pc_usb2can.py +0 -30
- pyxcp/transport/candriver/pc_vector.py +0 -34
- pyxcp/transport/candriver/python_can.py +0 -101
- pyxcp/transport/cxx_ext/CMakeLists.txt +0 -51
- pyxcp/transport/cxx_ext/setup.py +0 -49
- pyxcp/transport/cxx_ext/tests/test_basic_socket.cpp +0 -39
- pyxcp/transport/cxx_ext/tests/test_pool.cpp +0 -39
- pyxcp/transport/cxx_ext/tests/test_timestamp.cpp +0 -27
- pyxcp-0.21.9.dist-info/RECORD +0 -147
- rekorder.cp38-win_amd64.pyd +0 -0
- {pyxcp-0.21.9.dist-info/licenses → pyxcp-0.22.23.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import sqlite3
|
|
5
|
+
from array import array
|
|
6
|
+
from dataclasses import dataclass, field
|
|
7
|
+
from mmap import PAGESIZE
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any, List
|
|
10
|
+
|
|
11
|
+
from pyxcp.recorder import XcpLogFileDecoder
|
|
12
|
+
from pyxcp.recorder.converter import MAP_TO_ARRAY
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
MAP_TO_SQL = {
|
|
16
|
+
"U8": "INTEGER",
|
|
17
|
+
"I8": "INTEGER",
|
|
18
|
+
"U16": "INTEGER",
|
|
19
|
+
"I16": "INTEGER",
|
|
20
|
+
"U32": "INTEGER",
|
|
21
|
+
"I32": "INTEGER",
|
|
22
|
+
"U64": "INTEGER",
|
|
23
|
+
"I64": "INTEGER",
|
|
24
|
+
"F32": "FLOAT",
|
|
25
|
+
"F64": "FLOAT",
|
|
26
|
+
"F16": "FLOAT",
|
|
27
|
+
"BF16": "FLOAT",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger("PyXCP")
|
|
31
|
+
|
|
32
|
+
parser = argparse.ArgumentParser(description="Use .xmraw files in an Apache Arrow application.")
|
|
33
|
+
parser.add_argument("xmraw_file", help=".xmraw file")
|
|
34
|
+
args = parser.parse_args()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class Storage:
|
|
39
|
+
name: str
|
|
40
|
+
arrow_type: Any
|
|
41
|
+
arr: array
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class StorageContainer:
|
|
46
|
+
name: str
|
|
47
|
+
arr: List[Storage] = field(default_factory=[])
|
|
48
|
+
ts0: List[int] = field(default_factory=lambda: array("Q"))
|
|
49
|
+
ts1: List[int] = field(default_factory=lambda: array("Q"))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Decoder(XcpLogFileDecoder):
|
|
53
|
+
|
|
54
|
+
def __init__(self, recording_file_name: str):
|
|
55
|
+
super().__init__(recording_file_name)
|
|
56
|
+
self.sq3_file_name = Path(recording_file_name).with_suffix(".sq3")
|
|
57
|
+
try:
|
|
58
|
+
os.unlink(self.sq3_file_name)
|
|
59
|
+
except Exception as e:
|
|
60
|
+
print(e)
|
|
61
|
+
|
|
62
|
+
def initialize(self) -> None:
|
|
63
|
+
self.create_database(self.sq3_file_name)
|
|
64
|
+
self.arrow_tables = []
|
|
65
|
+
self.insert_stmt = {}
|
|
66
|
+
for dl in self.daq_lists:
|
|
67
|
+
result = []
|
|
68
|
+
for name, type_str in dl.headers:
|
|
69
|
+
array_txpe = MAP_TO_ARRAY[type_str]
|
|
70
|
+
sql_type = MAP_TO_SQL[type_str]
|
|
71
|
+
sd = Storage(name, sql_type, array(array_txpe))
|
|
72
|
+
result.append(sd)
|
|
73
|
+
sc = StorageContainer(dl.name, result)
|
|
74
|
+
print(f"Creating table {sc.name!r}.")
|
|
75
|
+
self.create_table(sc)
|
|
76
|
+
self.insert_stmt[sc.name] = (
|
|
77
|
+
f"""INSERT INTO {sc.name}({', '.join(['ts0', 'ts1'] + [r.name for r in sc.arr])}) VALUES({', '.join(["?" for _ in range(len(sc.arr) + 2)])})"""
|
|
78
|
+
)
|
|
79
|
+
self.arrow_tables.append(sc)
|
|
80
|
+
print("\nInserting data...")
|
|
81
|
+
|
|
82
|
+
def create_database(self, db_name: str) -> None:
|
|
83
|
+
self.conn = sqlite3.Connection(db_name)
|
|
84
|
+
self.cursor = self.conn.cursor()
|
|
85
|
+
self.execute("PRAGMA FOREIGN_KEYS=ON")
|
|
86
|
+
self.execute(f"PRAGMA PAGE_SIZE={PAGESIZE}")
|
|
87
|
+
self.execute("PRAGMA SYNCHRONOUS=OFF")
|
|
88
|
+
self.execute("PRAGMA LOCKING_MODE=EXCLUSIVE")
|
|
89
|
+
self.execute("PRAGMA TEMP_STORE=MEMORY")
|
|
90
|
+
|
|
91
|
+
timestamp_info = self.parameters.timestamp_info
|
|
92
|
+
self.execute(
|
|
93
|
+
"CREATE TABLE timestamp_info(timestamp_ns INTEGER, utc_offset INTEGER, dst_offset INTEGER, timezone VARCHAR(255))"
|
|
94
|
+
)
|
|
95
|
+
self.execute("CREATE TABLE table_names(name VARCHAR(255))")
|
|
96
|
+
self.execute(
|
|
97
|
+
"INSERT INTO timestamp_info VALUES(?, ?, ?, ?)",
|
|
98
|
+
[timestamp_info.timestamp_ns, timestamp_info.utc_offset, timestamp_info.dst_offset, timestamp_info.timezone],
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def create_table(self, sc: StorageContainer) -> None:
|
|
102
|
+
columns = ["ts0 INTEGER", "ts1 INTEGER"]
|
|
103
|
+
for elem in sc.arr:
|
|
104
|
+
columns.append(f"{elem.name} {elem.arrow_type}")
|
|
105
|
+
ddl = f"CREATE TABLE {sc.name}({', '.join(columns)})"
|
|
106
|
+
self.execute(ddl)
|
|
107
|
+
self.execute("INSERT INTO table_names VALUES(?)", [sc.name])
|
|
108
|
+
|
|
109
|
+
def execute(self, *args: List[str]) -> None:
|
|
110
|
+
try:
|
|
111
|
+
self.cursor.execute(*args)
|
|
112
|
+
except Exception as e:
|
|
113
|
+
print(e)
|
|
114
|
+
|
|
115
|
+
def finalize(self) -> None:
|
|
116
|
+
self.conn.commit()
|
|
117
|
+
self.conn.close()
|
|
118
|
+
print("Done.")
|
|
119
|
+
|
|
120
|
+
def on_daq_list(self, daq_list_num: int, timestamp0: int, timestamp1: int, measurements: list) -> None:
|
|
121
|
+
sc = self.arrow_tables[daq_list_num]
|
|
122
|
+
insert_stmt = self.insert_stmt[sc.name]
|
|
123
|
+
data = [timestamp0, timestamp1, *measurements]
|
|
124
|
+
self.execute(insert_stmt, data)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
decoder = Decoder(args.xmraw_file)
|
|
128
|
+
decoder.run()
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
from pyxcp.cmdline import ArgumentParser
|
|
6
|
+
from pyxcp.daq_stim import DaqList, DaqRecorder, DaqToCsv # noqa: F401
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ap = ArgumentParser(description="DAQ test")
|
|
10
|
+
|
|
11
|
+
XCP_LITE = True
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# NOTE: UPDATE TO CORRECT ADDRESSES BEFORE RUNNING!!!
|
|
15
|
+
#
|
|
16
|
+
if XCP_LITE:
|
|
17
|
+
# Vectorgrp XCPlite.
|
|
18
|
+
DAQ_LISTS = [
|
|
19
|
+
DaqList(
|
|
20
|
+
"part_1",
|
|
21
|
+
0,
|
|
22
|
+
False,
|
|
23
|
+
False,
|
|
24
|
+
[
|
|
25
|
+
("byteCounter", 0x00023648, 0, "U8"),
|
|
26
|
+
("wordCounter", 0x0002364C, 0, "U16"),
|
|
27
|
+
("dwordCounter", 0x00023650, 0, "U32"),
|
|
28
|
+
("sbyteCounter", 0x00023649, 0, "I8"),
|
|
29
|
+
],
|
|
30
|
+
),
|
|
31
|
+
DaqList(
|
|
32
|
+
"part_2",
|
|
33
|
+
7,
|
|
34
|
+
False,
|
|
35
|
+
False,
|
|
36
|
+
[
|
|
37
|
+
("swordCounter", 0x00023654, 0, "I16"),
|
|
38
|
+
("sdwordCounter", 0x00023658, 0, "I32"),
|
|
39
|
+
("channel1", 0x00023630, 0, "F64"),
|
|
40
|
+
("channel2", 0x00023638, 0, "F64"),
|
|
41
|
+
("channel3", 0x00023640, 0, "F64"),
|
|
42
|
+
],
|
|
43
|
+
),
|
|
44
|
+
]
|
|
45
|
+
else:
|
|
46
|
+
# XCPsim from CANape.
|
|
47
|
+
DAQ_LISTS = [
|
|
48
|
+
DaqList(
|
|
49
|
+
"pwm_stuff",
|
|
50
|
+
2,
|
|
51
|
+
False,
|
|
52
|
+
True,
|
|
53
|
+
[
|
|
54
|
+
("channel1", 0x1BD004, 0, "F32"),
|
|
55
|
+
("period", 0x001C0028, 0, "F32"),
|
|
56
|
+
("channel2", 0x1BD008, 0, "F32"),
|
|
57
|
+
("PWMFiltered", 0x1BDDE2, 0, "U8"),
|
|
58
|
+
("PWM", 0x1BDDDF, 0, "U8"),
|
|
59
|
+
("Triangle", 0x1BDDDE, 0, "I8"),
|
|
60
|
+
],
|
|
61
|
+
),
|
|
62
|
+
DaqList(
|
|
63
|
+
"bytes",
|
|
64
|
+
1,
|
|
65
|
+
False,
|
|
66
|
+
True,
|
|
67
|
+
[
|
|
68
|
+
("TestByte_000", 0x1BE11C, 0, "U8"),
|
|
69
|
+
("TestByte_015", 0x1BE158, 0, "U8"),
|
|
70
|
+
("TestByte_016", 0x1BE15C, 0, "U8"),
|
|
71
|
+
("TestByte_023", 0x1BE178, 0, "U8"),
|
|
72
|
+
("TestByte_024", 0x1BE17C, 0, "U8"),
|
|
73
|
+
("TestByte_034", 0x1BE1A4, 0, "U8"),
|
|
74
|
+
("TestByte_059", 0x1BE208, 0, "U8"),
|
|
75
|
+
("TestByte_061", 0x1BE210, 0, "U8"),
|
|
76
|
+
("TestByte_063", 0x1BE218, 0, "U8"),
|
|
77
|
+
("TestByte_064", 0x1BE21C, 0, "U8"),
|
|
78
|
+
("TestByte_097", 0x1BE2A0, 0, "U8"),
|
|
79
|
+
("TestByte_107", 0x1BE2C8, 0, "U8"),
|
|
80
|
+
("TestByte_131", 0x1BE328, 0, "U8"),
|
|
81
|
+
("TestByte_156", 0x1BE38C, 0, "U8"),
|
|
82
|
+
("TestByte_159", 0x1BE398, 0, "U8"),
|
|
83
|
+
("TestByte_182", 0x1BE3F4, 0, "U8"),
|
|
84
|
+
("TestByte_183", 0x1BE3F8, 0, "U8"),
|
|
85
|
+
("TestByte_189", 0x1BE410, 0, "U8"),
|
|
86
|
+
("TestByte_195", 0x1BE428, 0, "U8"),
|
|
87
|
+
("TestByte_216", 0x1BE47C, 0, "U8"),
|
|
88
|
+
("TestByte_218", 0x1BE484, 0, "U8"),
|
|
89
|
+
("TestByte_221", 0x1BE490, 0, "U8"),
|
|
90
|
+
("TestByte_251", 0x1BE508, 0, "U8"),
|
|
91
|
+
("TestByte_263", 0x1BE538, 0, "U8"),
|
|
92
|
+
("TestByte_276", 0x1BE56C, 0, "U8"),
|
|
93
|
+
("TestByte_277", 0x1BE570, 0, "U8"),
|
|
94
|
+
("TestByte_297", 0x1BE5C0, 0, "U8"),
|
|
95
|
+
("TestByte_302", 0x1BE5D4, 0, "U8"),
|
|
96
|
+
("TestByte_324", 0x1BE62C, 0, "U8"),
|
|
97
|
+
("TestByte_344", 0x1BE67C, 0, "U8"),
|
|
98
|
+
("TestByte_346", 0x1BE684, 0, "U8"),
|
|
99
|
+
],
|
|
100
|
+
),
|
|
101
|
+
DaqList(
|
|
102
|
+
"words",
|
|
103
|
+
3,
|
|
104
|
+
False,
|
|
105
|
+
True,
|
|
106
|
+
[
|
|
107
|
+
("TestWord_001", 0x1BE120, 0, "U16"),
|
|
108
|
+
("TestWord_003", 0x1BE128, 0, "U16"),
|
|
109
|
+
("TestWord_004", 0x1BE12C, 0, "U16"),
|
|
110
|
+
("TestWord_005", 0x1BE134, 0, "U16"),
|
|
111
|
+
("TestWord_006", 0x1BE134, 0, "U16"),
|
|
112
|
+
("TestWord_007", 0x1BE138, 0, "U16"),
|
|
113
|
+
("TestWord_008", 0x1BE13C, 0, "U16"),
|
|
114
|
+
("TestWord_009", 0x1BE140, 0, "U16"),
|
|
115
|
+
("TestWord_011", 0x1BE148, 0, "U16"),
|
|
116
|
+
],
|
|
117
|
+
),
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
daq_parser = DaqToCsv(DAQ_LISTS) # Record to CSV file(s).
|
|
121
|
+
# daq_parser = DaqRecorder(DAQ_LISTS, "run_daq", 2) # Record to ".xmraw" file.
|
|
122
|
+
|
|
123
|
+
with ap.run(policy=daq_parser) as x:
|
|
124
|
+
x.connect()
|
|
125
|
+
if x.slaveProperties.optionalCommMode:
|
|
126
|
+
x.getCommModeInfo()
|
|
127
|
+
|
|
128
|
+
x.cond_unlock("DAQ") # DAQ resource is locked in many cases.
|
|
129
|
+
|
|
130
|
+
DAQ_LISTS[1].event_num = 0
|
|
131
|
+
|
|
132
|
+
print("setup DAQ lists.")
|
|
133
|
+
daq_parser.setup() # Execute setup procedures.
|
|
134
|
+
print("start DAQ lists.")
|
|
135
|
+
daq_parser.start() # Start DAQ lists.
|
|
136
|
+
|
|
137
|
+
time.sleep(5.0 * 60.0) # Run for 15 minutes.
|
|
138
|
+
|
|
139
|
+
print("Stop DAQ....")
|
|
140
|
+
daq_parser.stop() # Stop DAQ lists.
|
|
141
|
+
print("finalize DAQ lists.\n")
|
|
142
|
+
x.disconnect()
|
|
143
|
+
|
|
144
|
+
if hasattr(daq_parser, "files"): # `files` attribute is specific to `DaqToCsv`.
|
|
145
|
+
print("Data written to:")
|
|
146
|
+
print("================")
|
|
147
|
+
for fl in daq_parser.files.values():
|
|
148
|
+
print(fl.name)
|
pyxcp/examples/xcp_policy.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
"""Demostrates how to use frame recording policies.
|
|
2
|
+
"""Demostrates how to use frame recording policies including recorder extension.
|
|
4
3
|
"""
|
|
5
4
|
from pprint import pprint
|
|
6
5
|
|
|
7
6
|
from pyxcp.cmdline import ArgumentParser
|
|
8
|
-
from pyxcp.transport.base import
|
|
9
|
-
|
|
7
|
+
from pyxcp.transport.base import FrameRecorderPolicy, StdoutPolicy # noqa: F401
|
|
8
|
+
|
|
10
9
|
|
|
11
10
|
ap = ArgumentParser(description="pyXCP frame recording policy example.")
|
|
12
11
|
|
|
13
12
|
LOG_FILE = "pyxcp"
|
|
14
13
|
|
|
15
|
-
policy =
|
|
14
|
+
policy = FrameRecorderPolicy(LOG_FILE)
|
|
16
15
|
use_recorder = True
|
|
17
16
|
|
|
18
17
|
# policy = StdoutPolicy() # You may also try this one.
|
|
@@ -25,7 +24,7 @@ with ap.run(policy=policy) as x:
|
|
|
25
24
|
identifier = x.identifier(0x01)
|
|
26
25
|
print("\nSlave Properties:")
|
|
27
26
|
print("=================")
|
|
28
|
-
print(f"ID:
|
|
27
|
+
print(f"ID: {identifier!r}")
|
|
29
28
|
pprint(x.slaveProperties)
|
|
30
29
|
x.disconnect()
|
|
31
30
|
|
|
@@ -34,7 +33,7 @@ if use_recorder:
|
|
|
34
33
|
from pyxcp.utils import hexDump
|
|
35
34
|
|
|
36
35
|
try:
|
|
37
|
-
import pandas
|
|
36
|
+
import pandas # noqa: F401
|
|
38
37
|
except ImportError:
|
|
39
38
|
has_pandas = False
|
|
40
39
|
else:
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""Very basic hello-world example.
|
|
4
3
|
"""
|
|
5
4
|
import time
|
|
6
|
-
from pyxcp.cmdline import ArgumentParser
|
|
7
5
|
|
|
8
6
|
import matplotlib.pyplot as plt
|
|
9
|
-
import numpy as np
|
|
10
7
|
import seaborn as sns
|
|
11
8
|
|
|
9
|
+
from pyxcp.cmdline import ArgumentParser
|
|
10
|
+
from pyxcp.transport import FrameRecorderPolicy
|
|
11
|
+
|
|
12
|
+
|
|
12
13
|
sns.set()
|
|
13
14
|
|
|
14
15
|
|
|
@@ -16,13 +17,14 @@ ADDR = 0x4000
|
|
|
16
17
|
LENGTH = 0x1000
|
|
17
18
|
ITERATIONS = 100
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
recorder_policy = FrameRecorderPolicy() # Create frame recorder.
|
|
21
|
+
ap = ArgumentParser(description="pyXCP hello world.", policy=recorder_policy)
|
|
20
22
|
with ap.run() as x:
|
|
21
23
|
xs = []
|
|
22
24
|
ys = []
|
|
23
25
|
x.connect()
|
|
24
26
|
for ctoSize in range(8, 64 + 4, 4):
|
|
25
|
-
print("CTO-Size: {}"
|
|
27
|
+
print(f"CTO-Size: {ctoSize}")
|
|
26
28
|
xs.append(ctoSize)
|
|
27
29
|
start = time.perf_counter()
|
|
28
30
|
for _ in range(ITERATIONS):
|
|
@@ -30,7 +32,7 @@ with ap.run() as x:
|
|
|
30
32
|
data = x.fetch(LENGTH, ctoSize)
|
|
31
33
|
et = time.perf_counter() - start
|
|
32
34
|
ys.append(et)
|
|
33
|
-
print("CTO size: {:-3} -- elapsed time {:-3.04}"
|
|
35
|
+
print(f"CTO size: {ctoSize:-3} -- elapsed time {et:-3.04}")
|
|
34
36
|
x.disconnect()
|
|
35
37
|
plt.plot(xs, ys)
|
|
36
38
|
plt.show()
|
pyxcp/examples/xcp_skel.py
CHANGED
pyxcp/examples/xcp_unlock.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""User supplied CAN driver.
|
|
4
3
|
|
|
5
4
|
Run as:
|
|
@@ -31,7 +30,7 @@ class MyCI(CanInterfaceBase):
|
|
|
31
30
|
def close(self):
|
|
32
31
|
pass
|
|
33
32
|
|
|
34
|
-
def
|
|
33
|
+
def get_timestamp_resolution(self):
|
|
35
34
|
pass
|
|
36
35
|
|
|
37
36
|
def read(self):
|
pyxcp/examples/xcphello.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""Very basic hello-world example.
|
|
4
3
|
"""
|
|
5
4
|
from pprint import pprint
|
|
@@ -7,6 +6,7 @@ from pprint import pprint
|
|
|
7
6
|
from pyxcp.cmdline import ArgumentParser
|
|
8
7
|
from pyxcp.utils import decode_bytes
|
|
9
8
|
|
|
9
|
+
|
|
10
10
|
daq_info = False
|
|
11
11
|
|
|
12
12
|
|
|
@@ -33,13 +33,16 @@ with ap.run() as x:
|
|
|
33
33
|
identifier = x.identifier(0x01)
|
|
34
34
|
print("\nSlave Properties:")
|
|
35
35
|
print("=================")
|
|
36
|
-
print(f"ID:
|
|
36
|
+
print(f"ID: {identifier!r}")
|
|
37
37
|
pprint(x.slaveProperties)
|
|
38
|
+
x.cond_unlock()
|
|
38
39
|
cps = x.getCurrentProtectionStatus()
|
|
39
40
|
print("\nProtection Status")
|
|
40
41
|
print("=================")
|
|
41
42
|
for k, v in cps.items():
|
|
42
43
|
print(f" {k:6s}: {v}")
|
|
44
|
+
daq = x.getDaqInfo()
|
|
45
|
+
pprint(daq)
|
|
43
46
|
if daq_info:
|
|
44
47
|
dqp = x.getDaqProcessorInfo()
|
|
45
48
|
print("\nDAQ Processor Info:")
|
|
@@ -54,7 +57,7 @@ with ap.run() as x:
|
|
|
54
57
|
dq = "DAQ" if evt.daqEventProperties.daq else ""
|
|
55
58
|
st = "STIM" if evt.daqEventProperties.stim else ""
|
|
56
59
|
dq_st = dq + " " + st
|
|
57
|
-
print(f
|
|
60
|
+
print(f" [{idx:04}] {name:r}")
|
|
58
61
|
print(f" dir: {dq_st}")
|
|
59
62
|
print(f" packed: {evt.daqEventProperties.packed}")
|
|
60
63
|
PFX_CONS = "CONSISTENCY_"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""Very basic hello-world example.
|
|
4
3
|
"""
|
|
5
4
|
from pprint import pprint
|
|
@@ -9,6 +8,7 @@ from pyxcp.recorder import XcpLogFileReader
|
|
|
9
8
|
from pyxcp.transport import FrameRecorderPolicy
|
|
10
9
|
from pyxcp.utils import decode_bytes
|
|
11
10
|
|
|
11
|
+
|
|
12
12
|
daq_info = False
|
|
13
13
|
|
|
14
14
|
|
|
@@ -39,7 +39,7 @@ with ap.run(recorder_policy) as x: # parameter policy is new.
|
|
|
39
39
|
identifier = x.identifier(0x01)
|
|
40
40
|
print("\nSlave Properties:")
|
|
41
41
|
print("=================")
|
|
42
|
-
print(f"ID:
|
|
42
|
+
print(f"ID: {identifier!r}")
|
|
43
43
|
pprint(x.slaveProperties)
|
|
44
44
|
cps = x.getCurrentProtectionStatus()
|
|
45
45
|
print("\nProtection Status")
|
|
@@ -60,7 +60,7 @@ with ap.run(recorder_policy) as x: # parameter policy is new.
|
|
|
60
60
|
dq = "DAQ" if evt.daqEventProperties.daq else ""
|
|
61
61
|
st = "STIM" if evt.daqEventProperties.stim else ""
|
|
62
62
|
dq_st = dq + " " + st
|
|
63
|
-
print(f
|
|
63
|
+
print(f" [{idx:04}] {name:r}")
|
|
64
64
|
print(f" dir: {dq_st}")
|
|
65
65
|
print(f" packed: {evt.daqEventProperties.packed}")
|
|
66
66
|
PFX_CONS = "CONSISTENCY_"
|
|
@@ -80,7 +80,7 @@ with ap.run(recorder_policy) as x: # parameter policy is new.
|
|
|
80
80
|
print("=================")
|
|
81
81
|
print(f"{x.getDaqListInfo(idx)}")
|
|
82
82
|
x.disconnect()
|
|
83
|
-
|
|
83
|
+
print("After recording...")
|
|
84
84
|
##
|
|
85
85
|
## Now read and dump recorded frames.
|
|
86
86
|
##
|
pyxcp/master/__init__.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
"""Lowlevel API reflecting available XCP services
|
|
4
3
|
|
|
5
4
|
.. note:: For technical reasons the API is split into two parts;
|
|
@@ -7,4 +6,4 @@
|
|
|
7
6
|
|
|
8
7
|
.. [1] XCP Specification, Part 2 - Protocol Layer Specification
|
|
9
8
|
"""
|
|
10
|
-
from .master import Master
|
|
9
|
+
from .master import Master # noqa: F401
|