py_canoe 3.0.4__py3-none-any.whl → 26.0.0__py3-none-any.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.
Files changed (124) hide show
  1. py_canoe/__init__.py +2 -1
  2. py_canoe/canoe.py +910 -0
  3. py_canoe/core/__init__.py +0 -0
  4. py_canoe/core/application.py +170 -0
  5. py_canoe/core/bus.py +301 -0
  6. py_canoe/core/capl.py +59 -0
  7. py_canoe/core/child_elements/__init__.py +0 -0
  8. py_canoe/core/child_elements/application_model.py +24 -0
  9. py_canoe/core/child_elements/application_model_file.py +21 -0
  10. py_canoe/core/child_elements/application_model_files.py +22 -0
  11. py_canoe/core/child_elements/application_model_setup.py +15 -0
  12. py_canoe/core/child_elements/application_models.py +22 -0
  13. py_canoe/core/child_elements/application_socket.py +11 -0
  14. py_canoe/core/child_elements/application_specific_module.py +24 -0
  15. py_canoe/core/child_elements/application_specific_modules.py +16 -0
  16. py_canoe/core/child_elements/audio_interface.py +28 -0
  17. py_canoe/core/child_elements/available_modules.py +22 -0
  18. py_canoe/core/child_elements/basic_module.py +19 -0
  19. py_canoe/core/child_elements/basic_modules.py +16 -0
  20. py_canoe/core/child_elements/c_libraries.py +28 -0
  21. py_canoe/core/child_elements/c_library.py +33 -0
  22. py_canoe/core/child_elements/can_controller.py +74 -0
  23. py_canoe/core/child_elements/capl_function.py +17 -0
  24. py_canoe/core/child_elements/ccp_setup.py +15 -0
  25. py_canoe/core/child_elements/channel.py +20 -0
  26. py_canoe/core/child_elements/channels.py +19 -0
  27. py_canoe/core/child_elements/communication_setup.py +23 -0
  28. py_canoe/core/child_elements/compile_result.py +22 -0
  29. py_canoe/core/child_elements/configured_channel.py +48 -0
  30. py_canoe/core/child_elements/configured_channels.py +21 -0
  31. py_canoe/core/child_elements/configured_module.py +82 -0
  32. py_canoe/core/child_elements/configured_modules.py +61 -0
  33. py_canoe/core/child_elements/connected_modules.py +14 -0
  34. py_canoe/core/child_elements/data_source.py +42 -0
  35. py_canoe/core/child_elements/data_source_file.py +21 -0
  36. py_canoe/core/child_elements/data_source_files.py +22 -0
  37. py_canoe/core/child_elements/data_source_issue.py +22 -0
  38. py_canoe/core/child_elements/data_source_issues.py +16 -0
  39. py_canoe/core/child_elements/data_source_setup.py +17 -0
  40. py_canoe/core/child_elements/data_sources.py +27 -0
  41. py_canoe/core/child_elements/database_setup.py +62 -0
  42. py_canoe/core/child_elements/device.py +34 -0
  43. py_canoe/core/child_elements/devices.py +13 -0
  44. py_canoe/core/child_elements/diagnostic.py +22 -0
  45. py_canoe/core/child_elements/diagnostic_request.py +59 -0
  46. py_canoe/core/child_elements/diagnostic_response.py +34 -0
  47. py_canoe/core/child_elements/diagnostic_responses.py +13 -0
  48. py_canoe/core/child_elements/diagnostics_setup.py +254 -0
  49. py_canoe/core/child_elements/distributed_mode.py +74 -0
  50. py_canoe/core/child_elements/encoding.py +27 -0
  51. py_canoe/core/child_elements/encodings.py +13 -0
  52. py_canoe/core/child_elements/environment_array.py +13 -0
  53. py_canoe/core/child_elements/environment_group.py +22 -0
  54. py_canoe/core/child_elements/environment_info.py +14 -0
  55. py_canoe/core/child_elements/environment_variable.py +55 -0
  56. py_canoe/core/child_elements/fdx_files.py +50 -0
  57. py_canoe/core/child_elements/file_group_data_source.py +17 -0
  58. py_canoe/core/child_elements/general_setup.py +66 -0
  59. py_canoe/core/child_elements/macros_setup.py +52 -0
  60. py_canoe/core/child_elements/mc_ecus.py +428 -0
  61. py_canoe/core/child_elements/measurement_setup.py +269 -0
  62. py_canoe/core/child_elements/modules.py +87 -0
  63. py_canoe/core/child_elements/most_disassembler.py +21 -0
  64. py_canoe/core/child_elements/most_network_interface.py +4 -0
  65. py_canoe/core/child_elements/namespace.py +21 -0
  66. py_canoe/core/child_elements/namespaces.py +19 -0
  67. py_canoe/core/child_elements/network.py +18 -0
  68. py_canoe/core/child_elements/network_adapters.py +13 -0
  69. py_canoe/core/child_elements/nodes.py +119 -0
  70. py_canoe/core/child_elements/open_configuration_result.py +0 -0
  71. py_canoe/core/child_elements/panel_setup.py +97 -0
  72. py_canoe/core/child_elements/participant.py +17 -0
  73. py_canoe/core/child_elements/participants.py +22 -0
  74. py_canoe/core/child_elements/ports.py +81 -0
  75. py_canoe/core/child_elements/replay_collection.py +56 -0
  76. py_canoe/core/child_elements/security_configuration.py +20 -0
  77. py_canoe/core/child_elements/security_setup.py +31 -0
  78. py_canoe/core/child_elements/signals.py +39 -0
  79. py_canoe/core/child_elements/simulation_setup.py +0 -0
  80. py_canoe/core/child_elements/single_file_data_source.py +13 -0
  81. py_canoe/core/child_elements/snippet_setup.py +68 -0
  82. py_canoe/core/child_elements/standalone_mode.py +0 -0
  83. py_canoe/core/child_elements/start_value_list.py +0 -0
  84. py_canoe/core/child_elements/symbol_mappings.py +0 -0
  85. py_canoe/core/child_elements/tcp_ip_stack_setting.py +0 -0
  86. py_canoe/core/child_elements/test_configurations.py +0 -0
  87. py_canoe/core/child_elements/test_environment.py +64 -0
  88. py_canoe/core/child_elements/test_environments.py +26 -0
  89. py_canoe/core/child_elements/test_module.py +213 -0
  90. py_canoe/core/child_elements/test_modules.py +23 -0
  91. py_canoe/core/child_elements/test_setup.py +16 -0
  92. py_canoe/core/child_elements/test_setup_folder_ext.py +36 -0
  93. py_canoe/core/child_elements/test_setup_folders.py +25 -0
  94. py_canoe/core/child_elements/user_files.py +0 -0
  95. py_canoe/core/child_elements/variable.py +144 -0
  96. py_canoe/core/child_elements/variable_events.py +14 -0
  97. py_canoe/core/child_elements/variables.py +29 -0
  98. py_canoe/core/child_elements/variables_file.py +15 -0
  99. py_canoe/core/child_elements/variables_files.py +19 -0
  100. py_canoe/core/child_elements/visual_sequence_setup.py +46 -0
  101. py_canoe/core/child_elements/vt_system.py +83 -0
  102. py_canoe/core/child_elements/vtt_sut_import_result.py +21 -0
  103. py_canoe/core/child_elements/write.py +71 -0
  104. py_canoe/core/child_elements/xcp_setup.py +12 -0
  105. py_canoe/core/configuration.py +509 -0
  106. py_canoe/core/environment.py +59 -0
  107. py_canoe/core/measurement.py +149 -0
  108. py_canoe/core/networks.py +103 -0
  109. py_canoe/core/performance.py +21 -0
  110. py_canoe/core/simulation.py +53 -0
  111. py_canoe/core/system.py +164 -0
  112. py_canoe/core/ui.py +53 -0
  113. py_canoe/core/version.py +54 -0
  114. py_canoe/helpers/__init__.py +0 -0
  115. py_canoe/helpers/common.py +78 -0
  116. {py_canoe-3.0.4.dist-info → py_canoe-26.0.0.dist-info}/METADATA +332 -322
  117. py_canoe-26.0.0.dist-info/RECORD +118 -0
  118. py_canoe-26.0.0.dist-info/WHEEL +4 -0
  119. py_canoe/py_canoe.py +0 -2586
  120. py_canoe/py_canoe_utils/logging_collection.py +0 -345
  121. py_canoe/py_canoe_utils/py_canoe_logger.py +0 -29
  122. py_canoe-3.0.4.dist-info/LICENSE +0 -21
  123. py_canoe-3.0.4.dist-info/RECORD +0 -8
  124. py_canoe-3.0.4.dist-info/WHEEL +0 -4
@@ -1,330 +1,340 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: py_canoe
3
- Version: 3.0.4
4
- Summary: Python CANoe Package
5
- License: LICENSE
6
- Keywords: Vector,CANoe,py_canoe
3
+ Version: 26.0.0
4
+ Summary: Python 🐍 Package for accessing Vector CANoe 🛶 Tool
5
+ Keywords: Vector,CANoe,Python,Test,Automation
7
6
  Author: chaitu-ycr
8
- Author-email: chaitu.ycr@gmail.com
9
- Requires-Python: >=3.9
10
- Classifier: Programming Language :: Python :: 3
7
+ Author-email: chaitu-ycr <chaitu.ycr@gmail.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 chaitu-ycr
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ Classifier: Programming Language :: Python :: 3.10
30
+ Classifier: Programming Language :: Python :: 3.11
31
+ Classifier: Programming Language :: Python :: 3.12
32
+ Classifier: Programming Language :: Python :: 3.13
33
+ Classifier: Programming Language :: Python :: 3.14
11
34
  Classifier: License :: OSI Approved :: MIT License
12
35
  Classifier: Operating System :: Microsoft :: Windows
13
- Classifier: Topic :: Software Development :: Embedded Systems
14
36
  Requires-Dist: pywin32
15
- Project-URL: Documentation, https://chaitu-ycr.github.io/py_canoe/
16
- Project-URL: Homepage, https://github.com/chaitu-ycr/py_canoe
17
- Project-URL: Repository, https://github.com/chaitu-ycr/py_canoe
37
+ Requires-Python: >=3.10, <=3.14
38
+ Project-URL: documentation, https://chaitu-ycr.github.io/py_canoe/
39
+ Project-URL: homepage, https://github.com/chaitu-ycr/py_canoe
40
+ Project-URL: repository, https://github.com/chaitu-ycr/py_canoe
18
41
  Description-Content-Type: text/markdown
19
42
 
20
- # [py_canoe](https://github.com/chaitu-ycr/py_canoe)
21
-
22
- ## about package
23
-
24
- Python 🐍 Package for controlling Vector CANoe 🛶 Tool
25
-
26
- ## important links
27
-
28
- - py_canoe github documentation [🔗 link](https://chaitu-ycr.github.io/py_canoe/)
29
- - pypi package [🔗 link](https://pypi.org/project/py_canoe/)
30
- - github releases [🔗 link](https://github.com/chaitu-ycr/py_canoe/releases)
31
- - for ideas💡/sugessions please create new discussion [here](https://github.com/chaitu-ycr/py_canoe/discussions)
32
- - create issue or request feature [here](https://github.com/chaitu-ycr/py_canoe/issues/new/choose)
33
- - fork [py_canoe](https://github.com/chaitu-ycr/py_canoe/fork) repo and create pull request to contribute back to this project.
34
-
35
- ## prerequisites
36
-
37
- - [Python(>=3.9)](https://www.python.org/downloads/)
38
- - [Vector CANoe software(>=v11)](https://www.vector.com/int/en/support-downloads/download-center/)
39
- - [visual studio code](https://code.visualstudio.com/Download)
40
- - Windows PC(recommended win 10 os along with 16GB RAM)
41
-
42
- ## setup and installation
43
-
44
- create python virtual environment
45
-
46
- ```bat
47
- python -m venv .venv
48
- ```
49
-
50
- activate virtual environment
51
-
52
- ```bat
53
- .venv\Scripts\activate
54
- ```
55
-
56
- upgrade pip (optional)
57
-
58
- ```bat
59
- python -m pip install pip --upgrade
60
- ```
61
-
62
- Install [py_canoe](https://pypi.org/project/py_canoe/) package
63
-
64
- ```bat
65
- pip install py_canoe --upgrade
66
- ```
67
-
68
- ---
69
-
70
- ## example use cases
71
-
72
- ### import CANoe module and create CANoe object instance
73
-
74
- ```python
75
- from py_canoe import CANoe, wait
76
-
77
- canoe_inst = CANoe()
78
- ```
79
-
80
- ### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
81
-
82
- ```python
83
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
84
- canoe_inst.start_measurement()
85
- canoe_version_info = canoe_inst.get_canoe_version_info()
86
- canoe_inst.stop_measurement()
87
- canoe_inst.quit()
88
- ```
89
-
90
- ### restart/reset running measurement
91
-
92
- ```python
93
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
94
- canoe_inst.start_measurement()
95
- canoe_inst.reset_measurement()
96
- canoe_inst.stop_ex_measurement()
97
- ```
98
-
99
- ### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
100
-
101
- ```python
102
- canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
103
- canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
104
- canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
105
- wait(1)
106
- canoe_inst.break_measurement_in_offline_mode()
107
- wait(1)
108
- canoe_inst.step_measurement_event_in_single_step()
109
- wait(1)
110
- canoe_inst.reset_measurement_in_offline_mode()
111
- wait(1)
112
- canoe_inst.stop_measurement()
113
- wait(1)
114
- ```
115
-
116
- ### get/set CANoe measurement index
117
-
118
- ```python
119
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
120
- meas_index_value = canoe_inst.get_measurement_index()
121
- canoe_inst.start_measurement()
122
- canoe_inst.stop_measurement()
123
- meas_index_value = canoe_inst.get_measurement_index()
124
- canoe_inst.set_measurement_index(meas_index_value + 1)
125
- meas_index_new = canoe_inst.get_measurement_index()
126
- canoe_inst.reset_measurement()
127
- canoe_inst.stop_measurement()
128
- ```
129
-
130
- ### save CANoe config to a different version with different name
131
-
132
- ```python
133
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
134
- canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
135
- ```
136
-
137
- ### get CAN bus statistics of CAN channel 1
138
-
139
- ```python
140
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
141
- canoe_inst.start_measurement()
142
- wait(2)
143
- canoe_inst.get_can_bus_statistics(channel=1)
144
- canoe_inst.stop_measurement()
145
- ```
146
-
147
- ### get/set bus signal value, check signal state and get signal full name
148
-
149
- ```python
150
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
151
- canoe_inst.start_measurement()
152
- wait(1)
153
- sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
154
- sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
155
- canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
156
- wait(1)
157
- sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
158
- sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
159
- sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
160
- canoe_inst.stop_measurement()
161
- ```
162
-
163
- ### clear write window / read text from write window / control write window output file
164
-
165
- ```python
166
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
167
- canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
168
- wait(1)
169
- canoe_inst.start_measurement()
170
- canoe_inst.clear_write_window_content()
171
- wait(1)
172
- canoe_inst.write_text_in_write_window("hello from py_canoe!")
173
- wait(1)
174
- text = canoe_inst.read_text_from_write_window()
175
- canoe_inst.stop_measurement()
176
- canoe_inst.disable_write_window_output_file()
177
- wait(1)
178
- ```
179
-
180
- ### switch between CANoe desktops
181
-
182
- ```python
183
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
184
- canoe_inst.ui_activate_desktop('Configuration')
185
- ```
186
-
187
- ### get/set system variable or define system variable
188
-
189
- ```python
190
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
191
- canoe_inst.start_measurement()
192
- wait(1)
193
- canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
194
- canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
195
- canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
196
- canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
197
- wait(0.1)
198
- sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
199
- sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
200
- canoe_inst.stop_measurement()
201
- # define system variable and use it in measurement
202
- canoe_inst.define_system_variable('sys_demo::demo', 1)
203
- canoe_inst.save_configuration()
204
- canoe_inst.start_measurement()
205
- wait(1)
206
- sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
207
- canoe_inst.stop_measurement()
208
- ```
209
-
210
- ### send diagnostic request, control tester present
211
-
212
- ```python
213
- canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
214
- canoe_inst.start_measurement()
215
- wait(1)
216
- resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
217
- canoe_inst.control_tester_present('Door', False)
218
- wait(2)
219
- canoe_inst.control_tester_present('Door', True)
220
- wait(5)
221
- resp = canoe_inst.send_diag_request('Door', '10 02')
222
- canoe_inst.control_tester_present('Door', False)
223
- wait(2)
224
- resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
225
- canoe_inst.stop_measurement()
226
- ```
227
-
228
- ### set replay block source file / control replay block start stop
229
-
230
- ```python
231
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
232
- canoe_inst.start_measurement()
233
- wait(1)
234
- canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
235
- wait(1)
236
- canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
237
- wait(2)
238
- canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
239
- wait(1)
240
- canoe_inst.stop_measurement()
241
- ```
242
-
243
- ### compile CAPL nodes and call capl function
244
-
245
- ```python
246
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
247
- canoe_inst.compile_all_capl_nodes()
248
- canoe_inst.start_measurement()
249
- wait(1)
250
- canoe_inst.call_capl_function('addition_function', 100, 200)
251
- canoe_inst.call_capl_function('hello_world')
252
- canoe_inst.stop_measurement()
253
- ```
254
-
255
- ### execute test setup test module / test environment
256
-
257
- ```python
258
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
259
- canoe_inst.start_measurement()
260
- wait(1)
261
- canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
262
- canoe_inst.execute_test_module('demo_test_node_002')
263
- wait(1)
264
- canoe_inst.stop_measurement()
265
- ```
266
-
267
- ### get/set environment variable value
268
-
269
- ```python
270
- canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
271
- canoe_inst.start_measurement()
272
- wait(1)
273
- canoe_inst.set_environment_variable_value('int_var', 123.12)
274
- canoe_inst.set_environment_variable_value('float_var', 111.123)
275
- canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
276
- canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
277
- var_value = canoe_inst.get_environment_variable_value('int_var')
278
- var_value = canoe_inst.get_environment_variable_value('float_var')
279
- var_value = canoe_inst.get_environment_variable_value('string_var')
280
- var_value = canoe_inst.get_environment_variable_value('data_var')
281
- wait(1)
282
- canoe_inst.stop_measurement()
283
- ```
284
-
285
- ### add/remove database
286
-
287
- ```python
288
- self.canoe_inst.open(canoe_cfg=self.canoe_cfg_gen_db_setup, visible=True, auto_save=True, prompt_user=False, auto_stop=True)
289
- self.canoe_inst.start_measurement()
290
- wait(1)
291
- # add database
292
- self.canoe_inst.add_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 'CAN1', 1)
293
- # remove database
294
- self.canoe_inst.remove_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 1)
295
- ```
296
-
297
- ### start/stop online measurement setup logging block
298
-
299
- ```python
300
- self.canoe_inst.open(canoe_cfg=self.canoe_cfg_online_setup)
301
- self.canoe_inst.start_measurement()
302
- wait(1)
303
- # stop logging block
304
- self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=False)
305
- wait(2)
306
- # start logging block
307
- self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=True)
308
- ```
309
-
310
- ### working with logging blocks
311
-
312
- ```python
313
- # remove current logging blocks
314
- for i in range(canoe_inst.logging_collection.count):
315
- canoe_inst.remove_logging_block(1) # iteration start from 1 and shifts after each delete
316
-
317
- # add a new block
318
- # define dest path with file format as asc, blf or other
319
- # may include field functions like {IncMeasurement}
320
- full_path = "C:/sample_log_{IncMeasurement}.blf"
321
- canoe_inst.add_logging_block(full_path)
322
- canoe_inst.start_measurement()
323
- # ...
324
- canoe_inst.stop_measurement()
325
- # log should be fully generated at this point for you to analyze
326
- canoe_inst.set_configuration_modified(False) # to avoid popup asking to save changes
327
- canoe_inst.quit()
328
- ```
329
-
330
-
43
+ # [py_canoe](https://github.com/chaitu-ycr/py_canoe)
44
+
45
+ ## about package
46
+
47
+ Python 🐍 Package for accessing Vector CANoe 🛶 Tool
48
+
49
+ ## important links
50
+
51
+ - [🔗 github documentation](https://chaitu-ycr.github.io/py_canoe/)
52
+ - [🔗 pypi package](https://pypi.org/project/py_canoe/)
53
+ - [🔗 github releases](https://github.com/chaitu-ycr/py_canoe/releases)
54
+ - [🔗 for ideas💡/sugessions please create new discussion **here**](https://github.com/chaitu-ycr/py_canoe/discussions)
55
+ - [🔗 create issue or request feature **here**](https://github.com/chaitu-ycr/py_canoe/issues/new/choose)
56
+ - [🔗 fork repo](https://github.com/chaitu-ycr/py_canoe/fork) and create pull request to contribute back to this project.
57
+
58
+ ## prerequisites
59
+
60
+ - [Python(>=3.10)](https://www.python.org/downloads/)
61
+ - [Vector CANoe software(>=v11)](https://www.vector.com/int/en/support-downloads/download-center/)
62
+ - Vector CANoe license. Also works with Demo version of CANoe with limited functionalities.
63
+ - [visual studio code](https://code.visualstudio.com/Download)
64
+ - Windows PC(recommended windows 11 OS along with 16GB RAM)
65
+
66
+ ## setup and installation
67
+
68
+ create python virtual environment
69
+
70
+ ```
71
+ python -m venv .venv
72
+ ```
73
+
74
+ activate virtual environment
75
+
76
+ ```
77
+ .venv\Scripts\activate
78
+ ```
79
+
80
+ upgrade pip (optional)
81
+
82
+ ```
83
+ python -m pip install pip --upgrade
84
+ ```
85
+
86
+ Install [**py_canoe**](https://pypi.org/project/py_canoe/) package
87
+
88
+ ```
89
+ pip install py_canoe --upgrade
90
+ ```
91
+
92
+ ---
93
+
94
+ ## example use cases
95
+
96
+ ### import CANoe module and create CANoe object instance
97
+
98
+ ```python
99
+ from py_canoe import CANoe, wait
100
+
101
+ canoe_inst = CANoe()
102
+ ```
103
+
104
+ ### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
105
+
106
+ ```python
107
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
108
+
109
+ canoe_inst.start_measurement()
110
+ canoe_version_info = canoe_inst.get_canoe_version_info()
111
+ canoe_inst.stop_measurement()
112
+ canoe_inst.quit()
113
+ ```
114
+
115
+ ### restart/reset running measurement
116
+
117
+ ```python
118
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
119
+
120
+ canoe_inst.start_measurement()
121
+ canoe_inst.reset_measurement()
122
+ canoe_inst.stop_ex_measurement()
123
+ ```
124
+
125
+ ### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
126
+
127
+ ```python
128
+ canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
129
+
130
+ canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
131
+ canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
132
+ canoe_inst.break_measurement_in_offline_mode()
133
+ canoe_inst.step_measurement_event_in_single_step()
134
+ canoe_inst.reset_measurement_in_offline_mode()
135
+ canoe_inst.stop_measurement()
136
+ ```
137
+
138
+ ### get/set CANoe measurement index
139
+
140
+ ```python
141
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
142
+
143
+ meas_index_value = canoe_inst.get_measurement_index()
144
+ canoe_inst.start_measurement()
145
+ canoe_inst.stop_measurement()
146
+ meas_index_value = canoe_inst.get_measurement_index()
147
+ canoe_inst.set_measurement_index(meas_index_value + 1)
148
+ meas_index_new = canoe_inst.get_measurement_index()
149
+ canoe_inst.reset_measurement()
150
+ canoe_inst.stop_measurement()
151
+ ```
152
+
153
+ ### save CANoe config to a different version with different name
154
+
155
+ ```python
156
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
157
+
158
+ canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
159
+ ```
160
+
161
+ ### get CAN bus statistics of CAN channel 1
162
+
163
+ ```python
164
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
165
+
166
+ canoe_inst.start_measurement()
167
+ canoe_inst.get_can_bus_statistics(channel=1)
168
+ canoe_inst.stop_measurement()
169
+ ```
170
+
171
+ ### get/set bus signal value, check signal state and get signal full name
172
+
173
+ ```python
174
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
175
+
176
+ canoe_inst.start_measurement()
177
+ sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
178
+ sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
179
+ canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
180
+ sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
181
+ sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
182
+ sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
183
+ canoe_inst.stop_measurement()
184
+ ```
185
+
186
+ ### clear write window / read text from write window / control write window output file
187
+
188
+ ```python
189
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
190
+
191
+ canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
192
+ canoe_inst.start_measurement()
193
+ canoe_inst.clear_write_window_content()
194
+ canoe_inst.write_text_in_write_window("hello from py_canoe!")
195
+ text = canoe_inst.read_text_from_write_window()
196
+ canoe_inst.stop_measurement()
197
+ canoe_inst.disable_write_window_output_file()
198
+ ```
199
+
200
+ ### switch between CANoe desktops
201
+
202
+ ```python
203
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
204
+ canoe_inst.ui_activate_desktop('Configuration')
205
+ ```
206
+
207
+ ### get/set system variable or define system variable
208
+
209
+ ```python
210
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
211
+
212
+ canoe_inst.start_measurement()
213
+ canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
214
+ canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
215
+ canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
216
+ canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
217
+ sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
218
+ sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
219
+ canoe_inst.stop_measurement()
220
+ canoe_inst.define_system_variable('sys_demo::demo', 1)
221
+ canoe_inst.save_configuration()
222
+ canoe_inst.start_measurement()
223
+ sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
224
+ canoe_inst.stop_measurement()
225
+ ```
226
+
227
+ ### send diagnostic request, control tester present
228
+
229
+ ```python
230
+ canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
231
+
232
+ canoe_inst.start_measurement()
233
+ resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
234
+ canoe_inst.control_tester_present('Door', False)
235
+ wait(2)
236
+ canoe_inst.control_tester_present('Door', True)
237
+ wait(5)
238
+ resp = canoe_inst.send_diag_request('Door', '10 02')
239
+ canoe_inst.control_tester_present('Door', False)
240
+ wait(2)
241
+ resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
242
+ canoe_inst.stop_measurement()
243
+ ```
244
+
245
+ ### set replay block source file / control replay block start stop
246
+
247
+ ```python
248
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
249
+
250
+ canoe_inst.start_measurement()
251
+ canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
252
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
253
+ wait(2)
254
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
255
+ canoe_inst.stop_measurement()
256
+ ```
257
+
258
+ ### compile CAPL nodes and call capl function
259
+
260
+ ```python
261
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
262
+
263
+ canoe_inst.compile_all_capl_nodes()
264
+ canoe_inst.start_measurement()
265
+ canoe_inst.call_capl_function('addition_function', 100, 200)
266
+ canoe_inst.call_capl_function('hello_world')
267
+ canoe_inst.stop_measurement()
268
+ ```
269
+
270
+ ### execute test setup test module / test environment
271
+
272
+ ```python
273
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
274
+
275
+ canoe_inst.start_measurement()
276
+ canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
277
+ canoe_inst.execute_test_module('demo_test_node_002')
278
+ canoe_inst.stop_measurement()
279
+ ```
280
+
281
+ ### get/set environment variable value
282
+
283
+ ```python
284
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
285
+
286
+ canoe_inst.start_measurement()
287
+ canoe_inst.set_environment_variable_value('int_var', 123.12)
288
+ canoe_inst.set_environment_variable_value('float_var', 111.123)
289
+ canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
290
+ canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
291
+ var_value = canoe_inst.get_environment_variable_value('int_var')
292
+ var_value = canoe_inst.get_environment_variable_value('float_var')
293
+ var_value = canoe_inst.get_environment_variable_value('string_var')
294
+ var_value = canoe_inst.get_environment_variable_value('data_var')
295
+ canoe_inst.stop_measurement()
296
+ ```
297
+
298
+ ### add/remove database
299
+
300
+ ```python
301
+ canoe_inst.open(canoe_cfg=r"tests\demo_cfg\demo_conf_gen_db_setup.cfg")
302
+
303
+ canoe_inst.start_measurement()
304
+ # add database
305
+ canoe_inst.add_database(fr"{file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 'CAN1', 1)
306
+ # remove database
307
+ canoe_inst.remove_database(fr"{file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 1)
308
+ ```
309
+
310
+ ### start/stop online logging block
311
+
312
+ ```python
313
+ canoe_inst.open(canoe_cfg=r"tests\demo_cfg\demo_online_setup.cfg")
314
+
315
+ canoe_inst.start_measurement()
316
+ # stop logging block
317
+ canoe_inst.start_stop_online_logging_block(fr'{demo_cfg_dir}\Logs\demo_online_setup_log.blf', start_stop=False)
318
+ wait(2)
319
+ # start logging block
320
+ canoe_inst.start_stop_online_logging_block(fr'{demo_cfg_dir}\Logs\demo_online_setup_log.blf', start_stop=True)
321
+ ```
322
+
323
+ ### working with logging blocks
324
+
325
+ ```python
326
+ # remove current logging blocks
327
+ for i in range(canoe_inst.logging_collection.count):
328
+ canoe_inst.remove_logging_block(1) # iteration start from 1 and shifts after each delete
329
+ # add a new block
330
+ # define dest path with file format as asc, blf or other
331
+ # may include field functions like {IncMeasurement}
332
+ full_path = "C:/sample_log_{IncMeasurement}.blf"
333
+ canoe_inst.add_logging_block(full_path)
334
+ canoe_inst.start_measurement()
335
+ # ...
336
+ canoe_inst.stop_measurement()
337
+ # log should be fully generated at this point for you to analyze
338
+ canoe_inst.set_configuration_modified(False) # to avoid popup asking to save changes
339
+ canoe_inst.quit()
340
+ ```