pyxcp 0.21.10__cp312-cp312-win_amd64.whl → 0.22.23__cp312-cp312-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.

Files changed (182) hide show
  1. pyxcp/__init__.py +12 -20
  2. pyxcp/aml/EtasCANMonitoring.a2l +82 -83
  3. pyxcp/aml/XCP_Common.aml +0 -1
  4. pyxcp/aml/XCPonUSB.aml +1 -1
  5. pyxcp/aml/ifdata_CAN.a2l +0 -1
  6. pyxcp/aml/ifdata_Eth.a2l +0 -1
  7. pyxcp/aml/ifdata_Flx.a2l +0 -1
  8. pyxcp/aml/ifdata_SxI.a2l +0 -1
  9. pyxcp/aml/ifdata_USB.a2l +0 -1
  10. pyxcp/asam/types.py +4 -4
  11. pyxcp/asamkeydll.c +0 -1
  12. pyxcp/checksum.py +0 -1
  13. pyxcp/cmdline.py +32 -50
  14. pyxcp/config/__init__.py +1100 -0
  15. pyxcp/config/legacy.py +120 -0
  16. pyxcp/constants.py +12 -13
  17. pyxcp/cpp_ext/__init__.py +0 -0
  18. pyxcp/cpp_ext/bin.hpp +104 -0
  19. pyxcp/cpp_ext/blockmem.hpp +58 -0
  20. pyxcp/cpp_ext/cpp_ext.cp310-win_amd64.pyd +0 -0
  21. pyxcp/cpp_ext/cpp_ext.cp311-win_amd64.pyd +0 -0
  22. pyxcp/cpp_ext/cpp_ext.cp312-win_amd64.pyd +0 -0
  23. pyxcp/cpp_ext/cpp_ext.cp38-win_amd64.pyd +0 -0
  24. pyxcp/cpp_ext/cpp_ext.cp39-win_amd64.pyd +0 -0
  25. pyxcp/cpp_ext/daqlist.hpp +200 -0
  26. pyxcp/cpp_ext/event.hpp +67 -0
  27. pyxcp/cpp_ext/extension_wrapper.cpp +96 -0
  28. pyxcp/cpp_ext/helper.hpp +280 -0
  29. pyxcp/cpp_ext/mcobject.hpp +246 -0
  30. pyxcp/cpp_ext/tsqueue.hpp +46 -0
  31. pyxcp/daq_stim/__init__.py +228 -0
  32. pyxcp/daq_stim/optimize/__init__.py +67 -0
  33. pyxcp/daq_stim/optimize/binpacking.py +41 -0
  34. pyxcp/daq_stim/scheduler.cpp +28 -0
  35. pyxcp/daq_stim/scheduler.hpp +75 -0
  36. pyxcp/daq_stim/stim.cp310-win_amd64.pyd +0 -0
  37. pyxcp/daq_stim/stim.cp311-win_amd64.pyd +0 -0
  38. pyxcp/daq_stim/stim.cp312-win_amd64.pyd +0 -0
  39. pyxcp/daq_stim/stim.cp38-win_amd64.pyd +0 -0
  40. pyxcp/daq_stim/stim.cp39-win_amd64.pyd +0 -0
  41. pyxcp/daq_stim/stim.cpp +13 -0
  42. pyxcp/daq_stim/stim.hpp +604 -0
  43. pyxcp/daq_stim/stim_wrapper.cpp +48 -0
  44. pyxcp/dllif.py +21 -18
  45. pyxcp/errormatrix.py +5 -3
  46. pyxcp/examples/conf_can.toml +4 -2
  47. pyxcp/examples/conf_can_vector.json +9 -9
  48. pyxcp/examples/conf_can_vector.toml +4 -2
  49. pyxcp/examples/conf_eth.toml +5 -2
  50. pyxcp/examples/conf_nixnet.json +18 -18
  51. pyxcp/examples/conf_sxi.json +7 -7
  52. pyxcp/examples/ex_arrow.py +109 -0
  53. pyxcp/examples/ex_csv.py +85 -0
  54. pyxcp/examples/ex_excel.py +95 -0
  55. pyxcp/examples/ex_mdf.py +124 -0
  56. pyxcp/examples/ex_sqlite.py +128 -0
  57. pyxcp/examples/run_daq.py +148 -0
  58. pyxcp/examples/xcp_policy.py +6 -7
  59. pyxcp/examples/xcp_read_benchmark.py +8 -6
  60. pyxcp/examples/xcp_skel.py +0 -2
  61. pyxcp/examples/xcp_unlock.py +1 -1
  62. pyxcp/examples/xcp_user_supplied_driver.py +1 -2
  63. pyxcp/examples/xcphello.py +6 -3
  64. pyxcp/examples/xcphello_recorder.py +4 -4
  65. pyxcp/master/__init__.py +1 -2
  66. pyxcp/master/errorhandler.py +107 -74
  67. pyxcp/master/master.py +201 -119
  68. pyxcp/py.typed +0 -0
  69. pyxcp/recorder/__init__.py +27 -6
  70. pyxcp/recorder/converter/__init__.py +37 -0
  71. pyxcp/recorder/lz4.c +129 -51
  72. pyxcp/recorder/lz4.h +45 -28
  73. pyxcp/recorder/lz4hc.c +560 -156
  74. pyxcp/recorder/lz4hc.h +1 -1
  75. pyxcp/recorder/mio.hpp +721 -767
  76. pyxcp/recorder/reader.hpp +139 -0
  77. pyxcp/recorder/reco.py +5 -8
  78. pyxcp/recorder/rekorder.cp310-win_amd64.pyd +0 -0
  79. pyxcp/recorder/rekorder.cp311-win_amd64.pyd +0 -0
  80. pyxcp/recorder/rekorder.cp312-win_amd64.pyd +0 -0
  81. pyxcp/recorder/rekorder.cp38-win_amd64.pyd +0 -0
  82. pyxcp/recorder/rekorder.cp39-win_amd64.pyd +0 -0
  83. pyxcp/recorder/rekorder.cpp +18 -22
  84. pyxcp/recorder/rekorder.hpp +200 -587
  85. pyxcp/recorder/setup.py +11 -10
  86. pyxcp/recorder/test_reko.py +2 -3
  87. pyxcp/recorder/unfolder.hpp +1332 -0
  88. pyxcp/recorder/wrap.cpp +171 -9
  89. pyxcp/recorder/writer.hpp +302 -0
  90. pyxcp/scripts/pyxcp_probe_can_drivers.py +0 -2
  91. pyxcp/scripts/xcp_examples.py +64 -0
  92. pyxcp/scripts/xcp_fetch_a2l.py +15 -10
  93. pyxcp/scripts/xcp_id_scanner.py +2 -6
  94. pyxcp/scripts/xcp_info.py +101 -63
  95. pyxcp/scripts/xcp_profile.py +27 -0
  96. pyxcp/stim/__init__.py +0 -0
  97. pyxcp/tests/test_asam_types.py +2 -2
  98. pyxcp/tests/test_binpacking.py +186 -0
  99. pyxcp/tests/test_can.py +1132 -38
  100. pyxcp/tests/test_checksum.py +2 -1
  101. pyxcp/tests/test_daq.py +193 -0
  102. pyxcp/tests/test_frame_padding.py +6 -3
  103. pyxcp/tests/test_master.py +42 -31
  104. pyxcp/tests/test_transport.py +12 -12
  105. pyxcp/tests/test_utils.py +2 -5
  106. pyxcp/timing.py +0 -2
  107. pyxcp/transport/__init__.py +9 -9
  108. pyxcp/transport/base.py +149 -127
  109. pyxcp/transport/base_transport.hpp +0 -0
  110. pyxcp/transport/can.py +194 -167
  111. pyxcp/transport/eth.py +80 -82
  112. pyxcp/transport/sxi.py +106 -60
  113. pyxcp/transport/transport_wrapper.cpp +0 -0
  114. pyxcp/transport/usb_transport.py +65 -83
  115. pyxcp/types.py +69 -20
  116. pyxcp/utils.py +47 -16
  117. pyxcp/vector/map.py +1 -3
  118. {pyxcp-0.21.10.dist-info → pyxcp-0.22.23.dist-info}/METADATA +28 -23
  119. pyxcp-0.22.23.dist-info/RECORD +140 -0
  120. {pyxcp-0.21.10.dist-info → pyxcp-0.22.23.dist-info}/WHEEL +1 -1
  121. {pyxcp-0.21.10.dist-info → pyxcp-0.22.23.dist-info}/entry_points.txt +2 -0
  122. pyxcp/config.py +0 -57
  123. pyxcp/cxx/asynchiofactory.hpp +0 -24
  124. pyxcp/cxx/blocking_client.cpp +0 -44
  125. pyxcp/cxx/blocking_socket.cpp +0 -43
  126. pyxcp/cxx/blocking_socket.hpp +0 -558
  127. pyxcp/cxx/concurrent_queue.hpp +0 -60
  128. pyxcp/cxx/eth.hpp +0 -57
  129. pyxcp/cxx/exceptions.hpp +0 -30
  130. pyxcp/cxx/iasyncioservice.hpp +0 -31
  131. pyxcp/cxx/iresource.hpp +0 -17
  132. pyxcp/cxx/isocket.hpp +0 -22
  133. pyxcp/cxx/linux/epoll.cpp +0 -51
  134. pyxcp/cxx/linux/epoll.hpp +0 -87
  135. pyxcp/cxx/linux/lit_tester.cpp +0 -19
  136. pyxcp/cxx/linux/socket.hpp +0 -234
  137. pyxcp/cxx/linux/timeout.hpp +0 -81
  138. pyxcp/cxx/memoryblock.hpp +0 -42
  139. pyxcp/cxx/pool.hpp +0 -81
  140. pyxcp/cxx/poolmgr.cpp +0 -6
  141. pyxcp/cxx/poolmgr.hpp +0 -31
  142. pyxcp/cxx/test_queue.cpp +0 -69
  143. pyxcp/cxx/timestamp.hpp +0 -84
  144. pyxcp/cxx/utils.cpp +0 -38
  145. pyxcp/cxx/utils.hpp +0 -29
  146. pyxcp/cxx/win/iocp.cpp +0 -242
  147. pyxcp/cxx/win/iocp.hpp +0 -42
  148. pyxcp/cxx/win/perhandledata.hpp +0 -24
  149. pyxcp/cxx/win/periodata.hpp +0 -97
  150. pyxcp/cxx/win/socket.hpp +0 -185
  151. pyxcp/cxx/win/timeout.hpp +0 -83
  152. pyxcp/examples/conf_can.json +0 -20
  153. pyxcp/examples/conf_eth.json +0 -8
  154. pyxcp/logger.py +0 -67
  155. pyxcp/tests/test_config.py +0 -62
  156. pyxcp/transport/candriver/__init__.py +0 -2
  157. pyxcp/transport/candriver/pc_canalystii.py +0 -27
  158. pyxcp/transport/candriver/pc_etas.py +0 -25
  159. pyxcp/transport/candriver/pc_gsusb.py +0 -23
  160. pyxcp/transport/candriver/pc_iscan.py +0 -23
  161. pyxcp/transport/candriver/pc_ixxat.py +0 -27
  162. pyxcp/transport/candriver/pc_kvaser.py +0 -39
  163. pyxcp/transport/candriver/pc_neovi.py +0 -31
  164. pyxcp/transport/candriver/pc_nican.py +0 -23
  165. pyxcp/transport/candriver/pc_nixnet.py +0 -23
  166. pyxcp/transport/candriver/pc_pcan.py +0 -25
  167. pyxcp/transport/candriver/pc_seeed.py +0 -28
  168. pyxcp/transport/candriver/pc_serial.py +0 -27
  169. pyxcp/transport/candriver/pc_slcan.py +0 -29
  170. pyxcp/transport/candriver/pc_socketcan.py +0 -23
  171. pyxcp/transport/candriver/pc_systec.py +0 -29
  172. pyxcp/transport/candriver/pc_usb2can.py +0 -30
  173. pyxcp/transport/candriver/pc_vector.py +0 -34
  174. pyxcp/transport/candriver/python_can.py +0 -101
  175. pyxcp/transport/cxx_ext/CMakeLists.txt +0 -51
  176. pyxcp/transport/cxx_ext/setup.py +0 -49
  177. pyxcp/transport/cxx_ext/tests/test_basic_socket.cpp +0 -39
  178. pyxcp/transport/cxx_ext/tests/test_pool.cpp +0 -39
  179. pyxcp/transport/cxx_ext/tests/test_timestamp.cpp +0 -27
  180. pyxcp-0.21.10.dist-info/RECORD +0 -147
  181. rekorder.cp312-win_amd64.pyd +0 -0
  182. {pyxcp-0.21.10.dist-info/licenses → pyxcp-0.22.23.dist-info}/LICENSE +0 -0
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for Peak System interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
- from can import BusState
10
-
11
-
12
- class PCan(python_can.PythonCAN, can.CanInterfaceBase):
13
- """"""
14
-
15
- PARAMETER_MAP = {
16
- # Type Req'd Default
17
- "STATE": (BusState, False, BusState.ACTIVE),
18
- }
19
-
20
- PARAMETER_TO_KW_ARG_MAP = {
21
- "STATE": "state",
22
- }
23
-
24
- def __init__(self):
25
- super(PCan, self).__init__(bustype="pcan")
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for USB-CAN Analyzer by Seeed Studio interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class Seeed(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(Seeed, self).__init__(bustype="seeedstudio")
26
-
27
-
28
- # from can.interfaces.seeedstudio import SeeedBus
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver serial port connected interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class Serial(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "BAUDRATE": (int, False, 115200),
16
- "TIMEOUT": (float, False, 0.1),
17
- "RTSCTS": (bool, False, False),
18
- }
19
-
20
- PARAMETER_TO_KW_ARG_MAP = {
21
- "BAUDRATE": "baudrate",
22
- "TIMEOUT": "timeout",
23
- "RTSCTS": "rtscts",
24
- }
25
-
26
- def __init__(self):
27
- super(Serial, self).__init__(bustype="serial")
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for CAN over Serial (like Lawicel) interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class SlCan(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "TTY_BAUDRATE": (int, False, 115200),
16
- "POLL_INTERVAL": (float, False, 0.01),
17
- "SLEEP_AFTER_OPEN": (float, False, 2.0),
18
- "RTSCTS": (bool, False, False),
19
- }
20
-
21
- PARAMETER_TO_KW_ARG_MAP = {
22
- "TTY_BAUDRATE": "ttyBaudrate",
23
- "POLL_INTERVAL": "poll_interval",
24
- "SLEEP_AFTER_OPEN": "sleep_after_open",
25
- "RTSCTS": "rtscts",
26
- }
27
-
28
- def __init__(self):
29
- super(SlCan, self).__init__(bustype="slcan")
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for Linux SocketCAN interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class SocketCAN(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "FD": (bool, False, False),
16
- }
17
-
18
- PARAMETER_TO_KW_ARG_MAP = {
19
- "FD": "fd",
20
- }
21
-
22
- def __init__(self):
23
- super(SocketCAN, self).__init__(bustype="socketcan")
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for Systec interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class Systec(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "DEVICE_NUMBER": (int, False, 255),
16
- "RX_BUFFER_ENTRIES": (int, False, 4096),
17
- "TX_BUFFER_ENTRIES": (int, False, 4096),
18
- "STATE": (str, False, "ACTIVE"),
19
- }
20
-
21
- PARAMETER_TO_KW_ARG_MAP = {
22
- "DEVICE_NUMBER": "device_number",
23
- "RX_BUFFER_ENTRIES": "rx_buffer_entries",
24
- "TX_BUFFER_ENTRIES": "tx_buffer_entries",
25
- "STATE": "state",
26
- }
27
-
28
- def __init__(self):
29
- super(Systec, self).__init__(bustype="systec")
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for 8devices USB2CAN interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class Usb2Can(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "FLAGS": (int, False, 0),
16
- }
17
-
18
- PARAMETER_TO_KW_ARG_MAP = {
19
- "FLAGS": "flags",
20
- }
21
-
22
- """
23
-
24
- :param int flags:
25
- Flags to directly pass to open function of the usb2can abstraction layer.
26
-
27
- """
28
-
29
- def __init__(self):
30
- super(Usb2Can, self).__init__(bustype="usb2can")
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- python-can driver for Vector Informatik interfaces.
5
- """
6
- import pyxcp.transport.can as can
7
- import pyxcp.transport.candriver.python_can as python_can
8
-
9
-
10
- class Vector(python_can.PythonCAN, can.CanInterfaceBase):
11
- """"""
12
-
13
- PARAMETER_MAP = {
14
- # Type Req'd Default
15
- "POLL_INTERVAL": (float, False, 0.01),
16
- "APP_NAME": (str, False, ""),
17
- "SERIAL": (int, False, None),
18
- "RX_QUEUE_SIZE": (int, False, 16384),
19
- "FD": (bool, False, False),
20
- "DATA_BITRATE": (int, False, 0),
21
- "DATA_SAMPLE_POINT": (float, False, 0),
22
- }
23
-
24
- PARAMETER_TO_KW_ARG_MAP = {
25
- "POLL_INTERVAL": "poll_interval",
26
- "RX_QUEUE_SIZE": "rx_queue_size",
27
- "FD": "fd",
28
- "DATA_BITRATE": "data_bitrate",
29
- "APP_NAME": "app_name",
30
- "SERIAL": "serial",
31
- }
32
-
33
- def __init__(self):
34
- super(Vector, self).__init__(bustype="vector")
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- """
4
- Support for python-can - github.com/hardbyte/python-can
5
- """
6
- import pyxcp.transport.can as can
7
- import re
8
- from collections import OrderedDict
9
-
10
- from can import Bus
11
- from can import CanError
12
- from can import Message
13
-
14
- NUMBER = re.compile(r"(?P<hex>0[x|X])?(?P<number>[0-9]+)", re.VERBOSE)
15
-
16
-
17
- class PythonCAN:
18
- """"""
19
-
20
- def __init__(self, bustype):
21
- self.bustype = bustype
22
- self.connected = False
23
-
24
- def init(self, parent, receive_callback):
25
- self.parent = parent
26
- self.is_fd = self.config.get("FD")
27
-
28
- def connect(self):
29
- if self.connected:
30
- return
31
-
32
- self.kwargs = OrderedDict()
33
- # Fetch driver keyword arguments.
34
- self._fetch_kwargs(False)
35
- self._fetch_kwargs(True)
36
- can_id = self.parent.can_id_master
37
- can_filter = {
38
- "can_id": can_id.id,
39
- "can_mask": can.MAX_29_BIT_IDENTIFIER if can_id.is_extended else can.MAX_11_BIT_IDENTIFIER,
40
- "extended": can_id.is_extended,
41
- }
42
- self.bus = Bus(bustype=self.bustype, **self.kwargs)
43
- self.bus.set_filters([can_filter])
44
- self.parent.logger.debug("Python-CAN driver: {} - {}]".format(self.bustype, self.bus))
45
- self.connected = True
46
-
47
- def _fetch_kwargs(self, local):
48
- if local:
49
- base = self
50
- else:
51
- base = self.parent
52
- for param, arg in base.PARAMETER_TO_KW_ARG_MAP.items():
53
- value = base.config.get(param)
54
- # if param == "CHANNEL":
55
- # value = self._handle_channel(value)
56
- self.kwargs[arg] = value
57
-
58
- def _handle_channel(self, value):
59
- match = NUMBER.match(value)
60
- if match:
61
- gd = match.groupdict()
62
- base = 16 if not gd["hex"] is None else 10
63
- return int(value, base)
64
- else:
65
- return value
66
-
67
- def close(self):
68
- if self.connected:
69
- self.bus.shutdown()
70
- self.connected = False
71
-
72
- def transmit(self, payload):
73
- frame = Message(
74
- arbitration_id=self.parent.can_id_slave.id,
75
- is_extended_id=True if self.parent.can_id_slave.is_extended else False,
76
- is_fd=self.is_fd,
77
- data=payload,
78
- )
79
- self.bus.send(frame)
80
-
81
- def read(self):
82
- if not self.connected:
83
- return None
84
- try:
85
- frame = self.bus.recv(5)
86
- except CanError:
87
- return None
88
- else:
89
- if frame is None or frame.arbitration_id != self.parent.can_id_master.id or not len(frame.data):
90
- return None # Timeout condition.
91
- extended = frame.is_extended_id
92
- identifier = can.Identifier.make_identifier(frame.arbitration_id, extended)
93
- return can.Frame(
94
- id_=identifier,
95
- dlc=frame.dlc,
96
- data=frame.data,
97
- timestamp=frame.timestamp,
98
- )
99
-
100
- def getTimestampResolution(self):
101
- return 10 * 1000
@@ -1,51 +0,0 @@
1
- cmake_minimum_required(VERSION 3.12)
2
- project(eth_booster VERSION 0.1.0 LANGUAGES CXX)
3
-
4
- set(BUILD_SHARED_LIBS false)
5
-
6
- set(BASE_DIR "../../cxx")
7
-
8
- if(WIN32)
9
- set(_PS "win")
10
- elseif(UNIX)
11
- set(_PS "linux")
12
- endif(WIN32)
13
-
14
-
15
- add_library(eth
16
- ${BASE_DIR}/utils.cpp
17
- )
18
- if(WIN32)
19
- set(ADD_LIBS ws2_32)
20
- elseif(UNIX)
21
- set(ADD_LIBS pthread rt)
22
- endif(WIN32)
23
-
24
- target_compile_features(eth PRIVATE cxx_std_14)
25
- target_include_directories(eth PUBLIC ${BASE_DIR} ${BASE_DIR}/${_PS})
26
-
27
- add_executable(test_timestamp tests/test_timestamp.cpp)
28
- target_include_directories(
29
- test_timestamp PUBLIC
30
- ${eth_booster_SOURCE_DIR}
31
- ${eth_booster_SOURCE_DIR}/${_PS}
32
- )
33
- target_link_libraries(test_timestamp eth)
34
-
35
-
36
- add_executable(test_pool tests/test_pool.cpp)
37
- target_include_directories(
38
- test_pool PUBLIC
39
- ${eth_booster_SOURCE_DIR}
40
- ${eth_booster_SOURCE_DIR}/${_PS}
41
- )
42
- target_link_libraries(test_pool eth)
43
-
44
- add_executable(blocking_client ${BASE_DIR}/blocking_socket.cpp ${BASE_DIR}/blocking_client.cpp)
45
- target_include_directories(
46
- blocking_client PUBLIC
47
- ${eth_booster_SOURCE_DIR}
48
- # ${eth_booster_SOURCE_DIR}/${_PS}
49
- )
50
- target_link_libraries(blocking_client eth ${ADD_LIBS})
51
-
@@ -1,49 +0,0 @@
1
- import os
2
- import subprocess
3
- import sys
4
-
5
- from distutils.core import Extension
6
- from distutils.core import setup
7
- from pybind11.setup_helpers import build_ext
8
- from pybind11.setup_helpers import Pybind11Extension
9
-
10
- try:
11
- INCLUDE_DIRS = subprocess.getoutput("pybind11-config --include")
12
- except Exception as e:
13
- print("Error while executing pybind11-config ('{}').\npybind11 probably not installed?".format(str(e)))
14
- sys.exit(1)
15
-
16
- pf = sys.platform
17
- if pf.startswith("win32"):
18
- LIBS = ["ws2_32"]
19
- elif pf.startswith("linux"):
20
- LIBS = ["pthread", "rt"]
21
- else:
22
- raise RuntimeError("Platform '{}' currently not supported.".format(pf))
23
-
24
-
25
- os.environ["CFLAGS"] = ""
26
-
27
- PKG_NAME = "eth_booster"
28
- EXT_NAMES = ["eth_booster"]
29
- __version__ = "0.0.1"
30
-
31
- ext_modules = [
32
- Pybind11Extension(
33
- EXT_NAMES[0],
34
- include_dirs=[INCLUDE_DIRS],
35
- sources=["blocking_socket.cpp", "utils.cpp", "wrap.cpp"],
36
- define_macros=[("EXTENSION_NAME", EXT_NAMES[0])],
37
- extra_compile_args=["-O3", "-Wall", "-Weffc++", "-std=c++17"],
38
- libraries=LIBS,
39
- ),
40
- ]
41
-
42
- setup(
43
- name=PKG_NAME,
44
- version="0.0.1",
45
- author="Christoph Schueler",
46
- description="Example",
47
- ext_modules=ext_modules,
48
- cmdclass={"build_ext": build_ext},
49
- )
@@ -1,39 +0,0 @@
1
-
2
-
3
- #include "eth.hpp"
4
- #include "socket.hpp"
5
- #include "asynchiofactory.hpp"
6
-
7
- #include <iomanip>
8
- #include <iostream>
9
-
10
- using std::cout;
11
- using std::endl;
12
- using std::setw;
13
- using std::internal;
14
- using std::fixed;
15
- using std::setfill;
16
-
17
- using namespace std;
18
-
19
- std::array<char, 15> hellomsg {"hello world!!!"};
20
-
21
- Eth eth;
22
-
23
- int main(void)
24
- {
25
-
26
- CAddress address;
27
- auto asio = createAsyncIoService();
28
- auto sock = Socket {PF_INET, SOCK_STREAM, IPPROTO_TCP};
29
-
30
- //sock.getaddrinfo(PF_INET, SOCK_STREAM, IPPROTO_TCP, "localhost", 50007, address, 0);
31
- sock.getaddrinfo(PF_INET, SOCK_STREAM, IPPROTO_TCP, "192.168.168.100", 50007, address, 0);
32
- sock.connect(address);
33
- asio->registerSocket(sock);
34
- //sock.getaddrinfo(PF_INET, SOCK_STREAM, IPPROTO_TCP, "google.de", 80, address, 0);
35
- //printf("addr: %x", address.address);
36
-
37
- sock.write(hellomsg);
38
- Sleep(250);
39
- }
@@ -1,39 +0,0 @@
1
-
2
- #include "memoryblock.hpp"
3
- #include "pool.hpp"
4
-
5
- #include <iostream>
6
- #include <cassert>
7
-
8
-
9
- typedef Pool<MemoryBlock<char, 64>, 8> Pool_t;
10
-
11
- void acquire_memory_blocks(Pool_t& pool)
12
- {
13
- for (int i = 0; i < 8; ++i) {
14
- auto obj = pool.acquire();
15
- pool.release(obj);
16
- }
17
- // Blocks should be released.
18
- }
19
-
20
- int main()
21
- {
22
- Pool_t pool;
23
-
24
- acquire_memory_blocks(pool);
25
-
26
- auto p0 = pool.acquire();
27
- auto p1 = pool.acquire();
28
- auto p2 = pool.acquire();
29
- auto p3 = pool.acquire();
30
- auto p4 = pool.acquire();
31
- auto p5 = pool.acquire();
32
- auto p6 = pool.acquire();
33
- auto p7 = pool.acquire();
34
- try {
35
- auto p8 = pool.acquire(); // should throw CapacityExhaustedException.
36
- } catch(CapacityExhaustedException) {
37
- std::cout << "OK, caught CapacityExhaustedException as expected." << std::endl;
38
- }
39
- }
@@ -1,27 +0,0 @@
1
-
2
- #include "timestamp.hpp"
3
- #include "utils.hpp"
4
-
5
- #include <iomanip>
6
- #include <iostream>
7
-
8
- using std::cout;
9
- using std::endl;
10
- using namespace std;
11
-
12
-
13
- int main(void)
14
- {
15
- auto ts = Timestamp();
16
- double previous = 0.0;
17
- double current = 0.0;
18
-
19
- cout << fixed;
20
-
21
- for (uint16_t idx = 0; idx < 100; ++idx) {
22
- current = ts.get();
23
- cout << "#" << setw(3) << setfill('0') << idx + 1 << " " << current << " diff: " << current -previous << endl;
24
- Sleep(100);
25
- previous = current;
26
- }
27
- }