pyxcp 0.21.10__cp311-cp311-win_amd64.whl → 0.22.23__cp311-cp311-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.cp310-win_amd64.pyd +0 -0
- pyxcp/cpp_ext/cpp_ext.cp311-win_amd64.pyd +0 -0
- pyxcp/cpp_ext/cpp_ext.cp38-win_amd64.pyd +0 -0
- pyxcp/cpp_ext/cpp_ext.cp39-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.cp310-win_amd64.pyd +0 -0
- pyxcp/daq_stim/stim.cp311-win_amd64.pyd +0 -0
- pyxcp/daq_stim/stim.cp38-win_amd64.pyd +0 -0
- pyxcp/daq_stim/stim.cp39-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 +201 -119
- 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.cp310-win_amd64.pyd +0 -0
- pyxcp/recorder/rekorder.cp311-win_amd64.pyd +0 -0
- pyxcp/recorder/rekorder.cp38-win_amd64.pyd +0 -0
- pyxcp/recorder/rekorder.cp39-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.10.dist-info → pyxcp-0.22.23.dist-info}/METADATA +28 -23
- pyxcp-0.22.23.dist-info/RECORD +137 -0
- {pyxcp-0.21.10.dist-info → pyxcp-0.22.23.dist-info}/WHEEL +1 -1
- {pyxcp-0.21.10.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.10.dist-info/RECORD +0 -147
- rekorder.cp311-win_amd64.pyd +0 -0
- {pyxcp-0.21.10.dist-info/licenses → pyxcp-0.22.23.dist-info}/LICENSE +0 -0
pyxcp/cxx/win/socket.hpp
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
#if !defined(__SOCKET_HPP)
|
|
3
|
-
#define __SOCKET_HPP
|
|
4
|
-
|
|
5
|
-
#include <array>
|
|
6
|
-
|
|
7
|
-
#include <WinSock2.h>
|
|
8
|
-
#include <Ws2tcpip.h>
|
|
9
|
-
#include <Mstcpip.h>
|
|
10
|
-
#include <MSWSock.h>
|
|
11
|
-
#include <Windows.h>
|
|
12
|
-
|
|
13
|
-
#include "isocket.hpp"
|
|
14
|
-
#include "timeout.hpp"
|
|
15
|
-
#include "periodata.hpp"
|
|
16
|
-
#include "perhandledata.hpp"
|
|
17
|
-
#include "pool.hpp"
|
|
18
|
-
#include "poolmgr.hpp"
|
|
19
|
-
|
|
20
|
-
class IOCP;
|
|
21
|
-
|
|
22
|
-
class Socket : public ISocket {
|
|
23
|
-
public:
|
|
24
|
-
|
|
25
|
-
using Pool_t = Pool<PerIoData, 16>;
|
|
26
|
-
|
|
27
|
-
Socket(int family = PF_INET, int socktype = SOCK_STREAM, int protocol = IPPROTO_TCP) :
|
|
28
|
-
m_family(family), m_socktype(socktype), m_protocol(protocol), m_connected(false),
|
|
29
|
-
m_pool_mgr(PoolManager()), m_addr(nullptr) {
|
|
30
|
-
m_socket = ::WSASocket(m_family, m_socktype, m_protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
|
|
31
|
-
if (m_socket == INVALID_SOCKET) {
|
|
32
|
-
SocketErrorExit("Socket::Socket()");
|
|
33
|
-
}
|
|
34
|
-
ZeroOut(&m_peerAddress, sizeof(SOCKADDR_STORAGE));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
~Socket() {
|
|
38
|
-
::closesocket(m_socket);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
void option(int optname, int level, int * value) {
|
|
42
|
-
int len;
|
|
43
|
-
|
|
44
|
-
len = sizeof(*value);
|
|
45
|
-
if (*value == 0) {
|
|
46
|
-
::getsockopt(m_socket, level, optname, (char*) value, &len);
|
|
47
|
-
} else {
|
|
48
|
-
::setsockopt(m_socket, level, optname, (const char*) value, len);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
bool getaddrinfo(int family, int socktype, int protocol, const char * hostname, int port, CAddress & address, int flags = AI_PASSIVE) {
|
|
53
|
-
int err;
|
|
54
|
-
ADDRINFO hints;
|
|
55
|
-
ADDRINFO * t_addr;
|
|
56
|
-
char port_str[16] = {0};
|
|
57
|
-
|
|
58
|
-
ZeroOut(&hints, sizeof(hints));
|
|
59
|
-
hints.ai_family = family;
|
|
60
|
-
hints.ai_socktype = socktype;
|
|
61
|
-
hints.ai_protocol = protocol;
|
|
62
|
-
hints.ai_flags = flags;
|
|
63
|
-
|
|
64
|
-
::sprintf(port_str, "%d", port);
|
|
65
|
-
err = ::getaddrinfo(hostname, port_str, &hints, &t_addr);
|
|
66
|
-
if (err != 0) {
|
|
67
|
-
printf("%s\n", gai_strerror(err));
|
|
68
|
-
::freeaddrinfo(t_addr);
|
|
69
|
-
SocketErrorExit("getaddrinfo()");
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
address.length = t_addr->ai_addrlen;
|
|
74
|
-
::CopyMemory(&address.address, t_addr->ai_addr, sizeof(struct sockaddr));
|
|
75
|
-
|
|
76
|
-
::freeaddrinfo(t_addr);
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
void connect(CAddress & address) {
|
|
81
|
-
if (::connect(m_socket, &address.address, address.length) == SOCKET_ERROR) {
|
|
82
|
-
SocketErrorExit("Socket::connect()");
|
|
83
|
-
}
|
|
84
|
-
PerHandleData handleData(HandleType::HANDLE_SOCKET, getHandle());
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
void bind(CAddress & address) {
|
|
88
|
-
if (::bind(m_socket, &address.address, address.length) == SOCKET_ERROR) {
|
|
89
|
-
SocketErrorExit("Socket::bind()");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
void listen(int backlog = 5) {
|
|
94
|
-
if (::listen(m_socket, backlog) == SOCKET_ERROR) {
|
|
95
|
-
SocketErrorExit("Socket::listen()");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
void accept(CAddress & peerAddress) {
|
|
100
|
-
SOCKET sock;
|
|
101
|
-
|
|
102
|
-
peerAddress.length = sizeof peerAddress.address;
|
|
103
|
-
sock = ::accept(m_socket, (sockaddr *)&peerAddress.address, &peerAddress.length);
|
|
104
|
-
|
|
105
|
-
if (sock == INVALID_SOCKET) {
|
|
106
|
-
SocketErrorExit("Socket::accept()");
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
template <typename T, size_t N>
|
|
111
|
-
void write(std::array<T, N>& arr, bool alloc = true) {
|
|
112
|
-
DWORD bytesWritten = 0;
|
|
113
|
-
int addrLen;
|
|
114
|
-
//PerIoData * iod = new PerIoData(128);
|
|
115
|
-
PerIoData * iod;
|
|
116
|
-
|
|
117
|
-
if (alloc == true) {
|
|
118
|
-
iod = m_pool_mgr.get_iod().acquire();
|
|
119
|
-
//iod = m_iod_pool.acquire();
|
|
120
|
-
}
|
|
121
|
-
m_timeout.arm();
|
|
122
|
-
iod->reset();
|
|
123
|
-
iod->set_buffer(arr);
|
|
124
|
-
iod->set_opcode(IoType::IO_WRITE);
|
|
125
|
-
iod->set_transfer_length(arr.size());
|
|
126
|
-
if (m_socktype == SOCK_DGRAM) {
|
|
127
|
-
addrLen = sizeof(SOCKADDR_STORAGE);
|
|
128
|
-
if (::WSASendTo(m_socket,
|
|
129
|
-
iod->get_buffer(),
|
|
130
|
-
1,
|
|
131
|
-
&bytesWritten,
|
|
132
|
-
0,
|
|
133
|
-
(LPSOCKADDR)&m_peerAddress,
|
|
134
|
-
addrLen,
|
|
135
|
-
(LPWSAOVERLAPPED)iod,
|
|
136
|
-
nullptr
|
|
137
|
-
) == SOCKET_ERROR) {
|
|
138
|
-
// WSA_IO_PENDING
|
|
139
|
-
SocketErrorExit("Socket::send()");
|
|
140
|
-
}
|
|
141
|
-
} else if (m_socktype == SOCK_STREAM) {
|
|
142
|
-
if (::WSASend(
|
|
143
|
-
m_socket,
|
|
144
|
-
iod->get_buffer(),
|
|
145
|
-
1,
|
|
146
|
-
&bytesWritten,
|
|
147
|
-
0,
|
|
148
|
-
(LPWSAOVERLAPPED)iod,
|
|
149
|
-
nullptr) == SOCKET_ERROR) {
|
|
150
|
-
SocketErrorExit("Socket::send()");
|
|
151
|
-
closesocket(m_socket);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
printf("Status: %d bytes_written: %d\n", WSAGetLastError(), bytesWritten);
|
|
155
|
-
}
|
|
156
|
-
void triggerRead(unsigned int len);
|
|
157
|
-
|
|
158
|
-
HANDLE getHandle() const {
|
|
159
|
-
return reinterpret_cast<HANDLE>(m_socket);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const TimeoutTimer& getTimeoutTimer() const {
|
|
163
|
-
return m_timeout;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
void setIOCP(IOCP * iocp) {
|
|
167
|
-
m_iocp = iocp;
|
|
168
|
-
m_timeout.setIOCP(iocp);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private:
|
|
172
|
-
int m_family;
|
|
173
|
-
int m_socktype;
|
|
174
|
-
int m_protocol;
|
|
175
|
-
bool m_connected;
|
|
176
|
-
PoolManager m_pool_mgr;
|
|
177
|
-
ADDRINFO * m_addr;
|
|
178
|
-
SOCKET m_socket;
|
|
179
|
-
//CAddress ourAddress;
|
|
180
|
-
SOCKADDR_STORAGE m_peerAddress;
|
|
181
|
-
TimeoutTimer m_timeout {150};
|
|
182
|
-
IOCP * m_iocp = nullptr;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
#endif // __SOCKET_HPP
|
pyxcp/cxx/win/timeout.hpp
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
#if !defined(__TIMEOUT_HPP)
|
|
3
|
-
#define __TIMEOUT_HPP
|
|
4
|
-
|
|
5
|
-
#include <Windows.h>
|
|
6
|
-
|
|
7
|
-
#include "utils.hpp"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
*
|
|
12
|
-
* Implements a timer queue based time-out.
|
|
13
|
-
*
|
|
14
|
-
* Resolution is milli-seconds.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
class IOCP;
|
|
20
|
-
|
|
21
|
-
void CALLBACK Timeout_CB(void * lpParam, unsigned char TimerOrWaitFired);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class TimeoutTimer {
|
|
25
|
-
public:
|
|
26
|
-
|
|
27
|
-
explicit TimeoutTimer(uint64_t value) : m_millis(value) {
|
|
28
|
-
m_timer_queue = ::CreateTimerQueue();
|
|
29
|
-
if (m_timer_queue == nullptr)
|
|
30
|
-
OsErrorExit("TimeoutTimer::TimeoutTimer() -- CreateTimerQueue");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
TimeoutTimer(const TimeoutTimer&) = default;
|
|
34
|
-
TimeoutTimer(const TimeoutTimer&&) = delete;
|
|
35
|
-
|
|
36
|
-
~TimeoutTimer() {
|
|
37
|
-
if (!::DeleteTimerQueue(m_timer_queue)) {
|
|
38
|
-
OsErrorExit("TimeoutTimer::~TimeoutTimer() -- DeleteTimerQueueEx");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
void arm() {
|
|
43
|
-
if (m_iocp != nullptr) {
|
|
44
|
-
if (!::CreateTimerQueueTimer(&m_timer, m_timer_queue, Timeout_CB, reinterpret_cast<void*>(m_iocp), m_millis, 0, 0)) {
|
|
45
|
-
OsErrorExit("TimeoutTimer::arm() -- CreateTimerQueueTimer");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
void disarm() {
|
|
51
|
-
if (m_timer != INVALID_HANDLE_VALUE) {
|
|
52
|
-
if (!::DeleteTimerQueueTimer(m_timer_queue, m_timer, nullptr)) {
|
|
53
|
-
OsErrorExit("TimeoutTimer::disarm() -- DeleteTimerQueueTimer");
|
|
54
|
-
}
|
|
55
|
-
m_timer = INVALID_HANDLE_VALUE;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
HANDLE getHandle() const {
|
|
60
|
-
return m_timer_queue;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
uint64_t getValue() const {
|
|
64
|
-
return m_millis;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
void setValue(uint64_t new_millis) {
|
|
68
|
-
m_millis = new_millis;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
void setIOCP(IOCP * iocp) {
|
|
72
|
-
m_iocp = iocp;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
private:
|
|
76
|
-
|
|
77
|
-
uint64_t m_millis;
|
|
78
|
-
HANDLE m_timer_queue {INVALID_HANDLE_VALUE};
|
|
79
|
-
HANDLE m_timer {INVALID_HANDLE_VALUE};
|
|
80
|
-
IOCP * m_iocp = nullptr;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
#endif // __TIMEOUT_HPP
|
pyxcp/examples/conf_can.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"TRANSPORT": "CAN",
|
|
3
|
-
"CAN_DRIVER": "Kvaser",
|
|
4
|
-
"CAN_USE_DEFAULT_LISTENER": true,
|
|
5
|
-
"CHANNEL": 0,
|
|
6
|
-
"ACCEPT_VIRTUAL": true,
|
|
7
|
-
"BAUDRATE_PRESET": true,
|
|
8
|
-
"CAN_ID_MASTER": 257,
|
|
9
|
-
"CAN_ID_SLAVE": 258,
|
|
10
|
-
"CAN_ID_BROADCAST": 256,
|
|
11
|
-
"MAX_DLC_REQUIRED": false,
|
|
12
|
-
"BITRATE": 250000,
|
|
13
|
-
"BTL_CYCLES": 16,
|
|
14
|
-
"SAMPLE_RATE": 1,
|
|
15
|
-
"SAMPLE_POINT": 87.5,
|
|
16
|
-
"SJW": 2,
|
|
17
|
-
"TSEG1": 5,
|
|
18
|
-
"TSEG2": 2,
|
|
19
|
-
"CREATE_DAQ_TIMESTAMPS": false
|
|
20
|
-
}
|
pyxcp/examples/conf_eth.json
DELETED
pyxcp/logger.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
logging.basicConfig()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Logger(object):
|
|
9
|
-
|
|
10
|
-
LOGGER_BASE_NAME = "pyxcp"
|
|
11
|
-
FORMAT = "[%(levelname)s (%(name)s)]: %(message)s"
|
|
12
|
-
|
|
13
|
-
def __init__(self, name, level=logging.WARN):
|
|
14
|
-
self.logger = logging.getLogger("{0}.{1}".format(self.LOGGER_BASE_NAME, name))
|
|
15
|
-
self.logger.setLevel(level)
|
|
16
|
-
handler = logging.StreamHandler()
|
|
17
|
-
handler.setLevel(level)
|
|
18
|
-
formatter = logging.Formatter(self.FORMAT)
|
|
19
|
-
handler.setFormatter(formatter)
|
|
20
|
-
self.logger.addHandler(handler)
|
|
21
|
-
#self.logger.propagate = False
|
|
22
|
-
self.lastMessage = None
|
|
23
|
-
self.lastSeverity = None
|
|
24
|
-
|
|
25
|
-
def getLastError(self):
|
|
26
|
-
result = (self.lastSeverity, self.lastMessage)
|
|
27
|
-
self.lastSeverity = self.lastMessage = None
|
|
28
|
-
return result
|
|
29
|
-
|
|
30
|
-
def log(self, message, level):
|
|
31
|
-
self.lastSeverity = level
|
|
32
|
-
self.lastMessage = message
|
|
33
|
-
self.logger.log(level, "{0}".format(message))
|
|
34
|
-
# print("{0}{1}".format(level, message))
|
|
35
|
-
|
|
36
|
-
def info(self, message):
|
|
37
|
-
self.log(message, logging.INFO)
|
|
38
|
-
|
|
39
|
-
def warn(self, message):
|
|
40
|
-
self.log(message, logging.WARN)
|
|
41
|
-
|
|
42
|
-
def debug(self, message):
|
|
43
|
-
self.log(message, logging.DEBUG)
|
|
44
|
-
|
|
45
|
-
def error(self, message):
|
|
46
|
-
self.log(message, logging.ERROR)
|
|
47
|
-
|
|
48
|
-
def critical(self, message):
|
|
49
|
-
self.log(message, logging.CRITICAL)
|
|
50
|
-
|
|
51
|
-
def verbose(self):
|
|
52
|
-
self.logger.setLevel(logging.DEBUG)
|
|
53
|
-
|
|
54
|
-
def silent(self):
|
|
55
|
-
self.logger.setLevel(logging.CRITICAL)
|
|
56
|
-
|
|
57
|
-
def setLevel(self, level):
|
|
58
|
-
LEVEL_MAP = {
|
|
59
|
-
"INFO": logging.INFO,
|
|
60
|
-
"WARN": logging.WARN,
|
|
61
|
-
"DEBUG": logging.DEBUG,
|
|
62
|
-
"ERROR": logging.ERROR,
|
|
63
|
-
"CRITICAL": logging.CRITICAL,
|
|
64
|
-
}
|
|
65
|
-
if isinstance(level, str):
|
|
66
|
-
level = LEVEL_MAP.get(level.upper(), logging.WARN)
|
|
67
|
-
self.logger.setLevel(level)
|
pyxcp/tests/test_config.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
from collections import OrderedDict
|
|
2
|
-
from io import StringIO
|
|
3
|
-
from pyxcp.config import readConfiguration
|
|
4
|
-
|
|
5
|
-
JSON = """{
|
|
6
|
-
"PORT": "COM10",
|
|
7
|
-
"BITRATE": 38400,
|
|
8
|
-
"BYTESIZE": 8,
|
|
9
|
-
"PARITY": "N",
|
|
10
|
-
"STOPBITS": 1,
|
|
11
|
-
"CREATE_DAQ_TIMESTAMPS": false
|
|
12
|
-
}"""
|
|
13
|
-
|
|
14
|
-
TOML = """PORT = "COM10"
|
|
15
|
-
BITRATE = 38400
|
|
16
|
-
PARITY = "N"
|
|
17
|
-
BYTESIZE = 8
|
|
18
|
-
STOPBITS = 1
|
|
19
|
-
CREATE_DAQ_TIMESTAMPS = false
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
CONF_JSON = StringIO(JSON)
|
|
23
|
-
CONF_JSON.name = "hello.json"
|
|
24
|
-
|
|
25
|
-
CONF_TOML = StringIO(TOML)
|
|
26
|
-
CONF_TOML.name = "hello.toml"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def test_read_empty_config():
|
|
30
|
-
assert readConfiguration(None) == {}
|
|
31
|
-
assert readConfiguration({}) == {}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def test_read_json_config():
|
|
35
|
-
assert readConfiguration(CONF_JSON) == {
|
|
36
|
-
"BITRATE": 38400,
|
|
37
|
-
"BYTESIZE": 8,
|
|
38
|
-
"CREATE_DAQ_TIMESTAMPS": False,
|
|
39
|
-
"PARITY": "N",
|
|
40
|
-
"PORT": "COM10",
|
|
41
|
-
"STOPBITS": 1,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def test_read_toml_config():
|
|
46
|
-
assert readConfiguration(CONF_TOML) == {
|
|
47
|
-
"BITRATE": 38400,
|
|
48
|
-
"BYTESIZE": 8,
|
|
49
|
-
"CREATE_DAQ_TIMESTAMPS": False,
|
|
50
|
-
"PARITY": "N",
|
|
51
|
-
"PORT": "COM10",
|
|
52
|
-
"STOPBITS": 1,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_read_dict():
|
|
57
|
-
assert readConfiguration({"A": 1, "B": 2, "C": 3}) == {"A": 1, "B": 2, "C": 3}
|
|
58
|
-
assert readConfiguration(OrderedDict({"A": 1, "B": 2, "C": 3})) == {
|
|
59
|
-
"A": 1,
|
|
60
|
-
"B": 2,
|
|
61
|
-
"C": 3,
|
|
62
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for CANalyst-II(+) by ZLG ZHIYUAN Electronics interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Canalystii(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"BAUD ": (int, False, None),
|
|
16
|
-
"TIMING0": (int, False, None),
|
|
17
|
-
"TIMING1": (int, False, None),
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
21
|
-
"BAUD": "baud",
|
|
22
|
-
"TIMING0": "Timing0",
|
|
23
|
-
"TIMING1": "Timing1",
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
def __init__(self):
|
|
27
|
-
super(Canalystii, self).__init__(bustype="canalystii")
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for ETAS BOA interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Etas(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"FD": (bool, False, False),
|
|
16
|
-
"DATA_BITRATE": (int, False, None),
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
20
|
-
"FD": "fd",
|
|
21
|
-
"DATA_BITRATE": "data_bitrate",
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
def __init__(self):
|
|
25
|
-
super(Etas, self).__init__(bustype="etas")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for CAN driver for Geschwister Schneider USB/CAN devices and bytewerk.org candleLight USB CAN interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class GsUsb(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
PARAMETER_MAP = {
|
|
15
|
-
# Type Req'd Default
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
19
|
-
}
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
super(GsUsb, self).__init__(bustype="gs_usb")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for isCAN from Thorsis Technologies GmbH.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class IsCAN(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"POLL_INTERVAL": (float, False, 0.01),
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
19
|
-
"POLL_INTERVAL": "poll_interval",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
super(IsCAN, self).__init__(bustype="iscan")
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for Ixxat interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Ixxat(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"UNIQUE_HARDWARE_ID": (str, False, None),
|
|
16
|
-
"RX_FIFO_SIZE": (int, False, 16),
|
|
17
|
-
"TX_FIFO_SIZE": (int, False, 16),
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
21
|
-
"UNIQUE_HARDWARE_ID": "UniqueHardwareId",
|
|
22
|
-
"RX_FIFO_SIZE": "rxFifoSize",
|
|
23
|
-
"TX_FIFO_SIZE": "txFifoSize",
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
def __init__(self):
|
|
27
|
-
super(Ixxat, self).__init__(bustype="ixxat")
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for Kvaser interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Kvaser(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"ACCEPT_VIRTUAL": (bool, False, True),
|
|
16
|
-
"DRIVER_MODE": (bool, False, True),
|
|
17
|
-
"NO_SAMP": (int, False, 1),
|
|
18
|
-
"SJW": (int, False, 2),
|
|
19
|
-
"TSEG1": (int, False, 5),
|
|
20
|
-
"TSEG2": (int, False, 2),
|
|
21
|
-
"SINGLE_HANDLE": (bool, False, True),
|
|
22
|
-
"FD": (bool, False, False),
|
|
23
|
-
"DATA_BITRATE": (int, False, None),
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
27
|
-
"ACCEPT_VIRTUAL": "accept_virtual",
|
|
28
|
-
"TSEG1": "tseg1",
|
|
29
|
-
"TSEG2": "tseg2",
|
|
30
|
-
"SJW": "sjw",
|
|
31
|
-
"NO_SAMP": "no_samp",
|
|
32
|
-
"DRIVER_MODE": "driver_mode",
|
|
33
|
-
"SINGLE_HANDLE": "single_handle",
|
|
34
|
-
"FD": "fd",
|
|
35
|
-
"DATA_BITRATE": "data_bitrate",
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
def __init__(self):
|
|
39
|
-
super(Kvaser, self).__init__(bustype="kvaser")
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for ICS NeoVi interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Neovi(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"FD": (bool, False, False),
|
|
16
|
-
"DATA_BITRATE": (int, False, None),
|
|
17
|
-
"USE_SYSTEM_TIMESTAMP": (bool, False, False),
|
|
18
|
-
"SERIAL": (str, False, None),
|
|
19
|
-
"OVERRIDE_LIBRARY_NAME": (str, False, None),
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
23
|
-
"FD": "fd",
|
|
24
|
-
"DATA_BITRATE": "data_bitrate",
|
|
25
|
-
"USE_SYSTEM_TIMESTAMP": "use_system_timestamp",
|
|
26
|
-
"SERIAL": "serial",
|
|
27
|
-
"OVERRIDE_LIBRARY_NAME": "override_library_name",
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
def __init__(self):
|
|
31
|
-
super(Neovi, self).__init__(bustype="neovi")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for National Instruments interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class NiCan(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"LOG_ERRORS": (bool, False, False),
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
19
|
-
"LOG_ERRORS": "log_errors",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
super(NiCan, self).__init__(bustype="nican")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
python-can driver for National Instruments xnet interfaces.
|
|
5
|
-
"""
|
|
6
|
-
import pyxcp.transport.can as can
|
|
7
|
-
import pyxcp.transport.candriver.python_can as python_can
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class NiXnet(python_can.PythonCAN, can.CanInterfaceBase):
|
|
11
|
-
""""""
|
|
12
|
-
|
|
13
|
-
PARAMETER_MAP = {
|
|
14
|
-
# Type Req'd Default
|
|
15
|
-
"LOG_ERRORS": (bool, False, False),
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PARAMETER_TO_KW_ARG_MAP = {
|
|
19
|
-
"LOG_ERRORS": "log_errors",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
super(NiXnet, self).__init__(bustype="nixnet")
|