py_canoe 3.0.1__tar.gz → 3.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,336 @@
1
+ Metadata-Version: 2.3
2
+ Name: py_canoe
3
+ Version: 3.0.3
4
+ Summary: Python CANoe Package
5
+ License: LICENSE
6
+ Keywords: Vector,CANoe,py_canoe
7
+ Author: chaitu-ycr
8
+ Author-email: chaitu.ycr@gmail.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: License :: Other/Proprietary License
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Embedded Systems
20
+ Requires-Dist: pywin32 (>=306,<=308)
21
+ Project-URL: Documentation, https://chaitu-ycr.github.io/py_canoe/
22
+ Project-URL: Homepage, https://github.com/chaitu-ycr/py_canoe
23
+ Project-URL: Repository, https://github.com/chaitu-ycr/py_canoe
24
+ Description-Content-Type: text/markdown
25
+
26
+ # [py_canoe](https://github.com/chaitu-ycr/py_canoe)
27
+
28
+ ## about package
29
+
30
+ Python 🐍 Package for controlling Vector CANoe 🛶 Tool
31
+
32
+ ## important links
33
+
34
+ - py_canoe github documentation [🔗 link](https://chaitu-ycr.github.io/py_canoe/)
35
+ - pypi package [🔗 link](https://pypi.org/project/py_canoe/)
36
+ - github releases [🔗 link](https://github.com/chaitu-ycr/py_canoe/releases)
37
+ - for ideas💡/sugessions please create new discussion [here](https://github.com/chaitu-ycr/py_canoe/discussions)
38
+ - create issue or request feature [here](https://github.com/chaitu-ycr/py_canoe/issues/new/choose)
39
+ - fork [py_canoe](https://github.com/chaitu-ycr/py_canoe/fork) repo and create pull request to contribute back to this project.
40
+
41
+ ## prerequisites
42
+
43
+ - [Python(>=3.9)](https://www.python.org/downloads/)
44
+ - [Vector CANoe software(>=v11)](https://www.vector.com/int/en/support-downloads/download-center/)
45
+ - [visual studio code](https://code.visualstudio.com/Download)
46
+ - Windows PC(recommended win 10 os along with 16GB RAM)
47
+
48
+ ## setup and installation
49
+
50
+ create python virtual environment
51
+
52
+ ```bat
53
+ python -m venv .venv
54
+ ```
55
+
56
+ activate virtual environment
57
+
58
+ ```bat
59
+ .venv\Scripts\activate
60
+ ```
61
+
62
+ upgrade pip (optional)
63
+
64
+ ```bat
65
+ python -m pip install pip --upgrade
66
+ ```
67
+
68
+ Install [py_canoe](https://pypi.org/project/py_canoe/) package
69
+
70
+ ```bat
71
+ pip install py_canoe --upgrade
72
+ ```
73
+
74
+ ---
75
+
76
+ ## example use cases
77
+
78
+ ### import CANoe module and create CANoe object instance
79
+
80
+ ```python
81
+ from py_canoe import CANoe, wait
82
+
83
+ canoe_inst = CANoe()
84
+ ```
85
+
86
+ ### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
87
+
88
+ ```python
89
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
90
+ canoe_inst.start_measurement()
91
+ canoe_version_info = canoe_inst.get_canoe_version_info()
92
+ canoe_inst.stop_measurement()
93
+ canoe_inst.quit()
94
+ ```
95
+
96
+ ### restart/reset running measurement
97
+
98
+ ```python
99
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
100
+ canoe_inst.start_measurement()
101
+ canoe_inst.reset_measurement()
102
+ canoe_inst.stop_ex_measurement()
103
+ ```
104
+
105
+ ### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
106
+
107
+ ```python
108
+ canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
109
+ canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
110
+ canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
111
+ wait(1)
112
+ canoe_inst.break_measurement_in_offline_mode()
113
+ wait(1)
114
+ canoe_inst.step_measurement_event_in_single_step()
115
+ wait(1)
116
+ canoe_inst.reset_measurement_in_offline_mode()
117
+ wait(1)
118
+ canoe_inst.stop_measurement()
119
+ wait(1)
120
+ ```
121
+
122
+ ### get/set CANoe measurement index
123
+
124
+ ```python
125
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
126
+ meas_index_value = canoe_inst.get_measurement_index()
127
+ canoe_inst.start_measurement()
128
+ canoe_inst.stop_measurement()
129
+ meas_index_value = canoe_inst.get_measurement_index()
130
+ canoe_inst.set_measurement_index(meas_index_value + 1)
131
+ meas_index_new = canoe_inst.get_measurement_index()
132
+ canoe_inst.reset_measurement()
133
+ canoe_inst.stop_measurement()
134
+ ```
135
+
136
+ ### save CANoe config to a different version with different name
137
+
138
+ ```python
139
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
140
+ canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
141
+ ```
142
+
143
+ ### get CAN bus statistics of CAN channel 1
144
+
145
+ ```python
146
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
147
+ canoe_inst.start_measurement()
148
+ wait(2)
149
+ canoe_inst.get_can_bus_statistics(channel=1)
150
+ canoe_inst.stop_measurement()
151
+ ```
152
+
153
+ ### get/set bus signal value, check signal state and get signal full name
154
+
155
+ ```python
156
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
157
+ canoe_inst.start_measurement()
158
+ wait(1)
159
+ sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
160
+ sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
161
+ canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
162
+ wait(1)
163
+ sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
164
+ sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
165
+ sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
166
+ canoe_inst.stop_measurement()
167
+ ```
168
+
169
+ ### clear write window / read text from write window / control write window output file
170
+
171
+ ```python
172
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
173
+ canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
174
+ wait(1)
175
+ canoe_inst.start_measurement()
176
+ canoe_inst.clear_write_window_content()
177
+ wait(1)
178
+ canoe_inst.write_text_in_write_window("hello from py_canoe!")
179
+ wait(1)
180
+ text = canoe_inst.read_text_from_write_window()
181
+ canoe_inst.stop_measurement()
182
+ canoe_inst.disable_write_window_output_file()
183
+ wait(1)
184
+ ```
185
+
186
+ ### switch between CANoe desktops
187
+
188
+ ```python
189
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
190
+ canoe_inst.ui_activate_desktop('Configuration')
191
+ ```
192
+
193
+ ### get/set system variable or define system variable
194
+
195
+ ```python
196
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
197
+ canoe_inst.start_measurement()
198
+ wait(1)
199
+ canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
200
+ canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
201
+ canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
202
+ canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
203
+ wait(0.1)
204
+ sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
205
+ sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
206
+ canoe_inst.stop_measurement()
207
+ # define system variable and use it in measurement
208
+ canoe_inst.define_system_variable('sys_demo::demo', 1)
209
+ canoe_inst.save_configuration()
210
+ canoe_inst.start_measurement()
211
+ wait(1)
212
+ sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
213
+ canoe_inst.stop_measurement()
214
+ ```
215
+
216
+ ### send diagnostic request, control tester present
217
+
218
+ ```python
219
+ canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
220
+ canoe_inst.start_measurement()
221
+ wait(1)
222
+ resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
223
+ canoe_inst.control_tester_present('Door', False)
224
+ wait(2)
225
+ canoe_inst.control_tester_present('Door', True)
226
+ wait(5)
227
+ resp = canoe_inst.send_diag_request('Door', '10 02')
228
+ canoe_inst.control_tester_present('Door', False)
229
+ wait(2)
230
+ resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
231
+ canoe_inst.stop_measurement()
232
+ ```
233
+
234
+ ### set replay block source file / control replay block start stop
235
+
236
+ ```python
237
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
238
+ canoe_inst.start_measurement()
239
+ wait(1)
240
+ canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
241
+ wait(1)
242
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
243
+ wait(2)
244
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
245
+ wait(1)
246
+ canoe_inst.stop_measurement()
247
+ ```
248
+
249
+ ### compile CAPL nodes and call capl function
250
+
251
+ ```python
252
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
253
+ canoe_inst.compile_all_capl_nodes()
254
+ canoe_inst.start_measurement()
255
+ wait(1)
256
+ canoe_inst.call_capl_function('addition_function', 100, 200)
257
+ canoe_inst.call_capl_function('hello_world')
258
+ canoe_inst.stop_measurement()
259
+ ```
260
+
261
+ ### execute test setup test module / test environment
262
+
263
+ ```python
264
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
265
+ canoe_inst.start_measurement()
266
+ wait(1)
267
+ canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
268
+ canoe_inst.execute_test_module('demo_test_node_002')
269
+ wait(1)
270
+ canoe_inst.stop_measurement()
271
+ ```
272
+
273
+ ### get/set environment variable value
274
+
275
+ ```python
276
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
277
+ canoe_inst.start_measurement()
278
+ wait(1)
279
+ canoe_inst.set_environment_variable_value('int_var', 123.12)
280
+ canoe_inst.set_environment_variable_value('float_var', 111.123)
281
+ canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
282
+ canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
283
+ var_value = canoe_inst.get_environment_variable_value('int_var')
284
+ var_value = canoe_inst.get_environment_variable_value('float_var')
285
+ var_value = canoe_inst.get_environment_variable_value('string_var')
286
+ var_value = canoe_inst.get_environment_variable_value('data_var')
287
+ wait(1)
288
+ canoe_inst.stop_measurement()
289
+ ```
290
+
291
+ ### add/remove database
292
+
293
+ ```python
294
+ self.canoe_inst.open(canoe_cfg=self.canoe_cfg_gen_db_setup, visible=True, auto_save=True, prompt_user=False, auto_stop=True)
295
+ self.canoe_inst.start_measurement()
296
+ wait(1)
297
+ # add database
298
+ self.canoe_inst.add_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 'CAN1', 1)
299
+ # remove database
300
+ self.canoe_inst.remove_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 1)
301
+ ```
302
+
303
+ ### start/stop online measurement setup logging block
304
+
305
+ ```python
306
+ self.canoe_inst.open(canoe_cfg=self.canoe_cfg_online_setup)
307
+ self.canoe_inst.start_measurement()
308
+ wait(1)
309
+ # stop logging block
310
+ self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=False)
311
+ wait(2)
312
+ # start logging block
313
+ self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=True)
314
+ ```
315
+
316
+ ### working with logging blocks
317
+
318
+ ```python
319
+ # remove current logging blocks
320
+ for i in range(canoe_inst.logging_collection.count):
321
+ canoe_inst.remove_logging_block(1) # iteration start from 1 and shifts after each delete
322
+
323
+ # add a new block
324
+ # define dest path with file format as asc, blf or other
325
+ # may include field functions like {IncMeasurement}
326
+ full_path = "C:/sample_log_{IncMeasurement}.blf"
327
+ canoe_inst.add_logging_block(full_path)
328
+ canoe_inst.start_measurement()
329
+ # ...
330
+ canoe_inst.stop_measurement()
331
+ # log should be fully generated at this point for you to analyze
332
+ canoe_inst.set_configuration_modified(False) # to avoid popup asking to save changes
333
+ canoe_inst.quit()
334
+ ```
335
+
336
+
@@ -0,0 +1,310 @@
1
+ # [py_canoe](https://github.com/chaitu-ycr/py_canoe)
2
+
3
+ ## about package
4
+
5
+ Python 🐍 Package for controlling Vector CANoe 🛶 Tool
6
+
7
+ ## important links
8
+
9
+ - py_canoe github documentation [🔗 link](https://chaitu-ycr.github.io/py_canoe/)
10
+ - pypi package [🔗 link](https://pypi.org/project/py_canoe/)
11
+ - github releases [🔗 link](https://github.com/chaitu-ycr/py_canoe/releases)
12
+ - for ideas💡/sugessions please create new discussion [here](https://github.com/chaitu-ycr/py_canoe/discussions)
13
+ - create issue or request feature [here](https://github.com/chaitu-ycr/py_canoe/issues/new/choose)
14
+ - fork [py_canoe](https://github.com/chaitu-ycr/py_canoe/fork) repo and create pull request to contribute back to this project.
15
+
16
+ ## prerequisites
17
+
18
+ - [Python(>=3.9)](https://www.python.org/downloads/)
19
+ - [Vector CANoe software(>=v11)](https://www.vector.com/int/en/support-downloads/download-center/)
20
+ - [visual studio code](https://code.visualstudio.com/Download)
21
+ - Windows PC(recommended win 10 os along with 16GB RAM)
22
+
23
+ ## setup and installation
24
+
25
+ create python virtual environment
26
+
27
+ ```bat
28
+ python -m venv .venv
29
+ ```
30
+
31
+ activate virtual environment
32
+
33
+ ```bat
34
+ .venv\Scripts\activate
35
+ ```
36
+
37
+ upgrade pip (optional)
38
+
39
+ ```bat
40
+ python -m pip install pip --upgrade
41
+ ```
42
+
43
+ Install [py_canoe](https://pypi.org/project/py_canoe/) package
44
+
45
+ ```bat
46
+ pip install py_canoe --upgrade
47
+ ```
48
+
49
+ ---
50
+
51
+ ## example use cases
52
+
53
+ ### import CANoe module and create CANoe object instance
54
+
55
+ ```python
56
+ from py_canoe import CANoe, wait
57
+
58
+ canoe_inst = CANoe()
59
+ ```
60
+
61
+ ### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
62
+
63
+ ```python
64
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
65
+ canoe_inst.start_measurement()
66
+ canoe_version_info = canoe_inst.get_canoe_version_info()
67
+ canoe_inst.stop_measurement()
68
+ canoe_inst.quit()
69
+ ```
70
+
71
+ ### restart/reset running measurement
72
+
73
+ ```python
74
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
75
+ canoe_inst.start_measurement()
76
+ canoe_inst.reset_measurement()
77
+ canoe_inst.stop_ex_measurement()
78
+ ```
79
+
80
+ ### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
81
+
82
+ ```python
83
+ canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
84
+ canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
85
+ canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
86
+ wait(1)
87
+ canoe_inst.break_measurement_in_offline_mode()
88
+ wait(1)
89
+ canoe_inst.step_measurement_event_in_single_step()
90
+ wait(1)
91
+ canoe_inst.reset_measurement_in_offline_mode()
92
+ wait(1)
93
+ canoe_inst.stop_measurement()
94
+ wait(1)
95
+ ```
96
+
97
+ ### get/set CANoe measurement index
98
+
99
+ ```python
100
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
101
+ meas_index_value = canoe_inst.get_measurement_index()
102
+ canoe_inst.start_measurement()
103
+ canoe_inst.stop_measurement()
104
+ meas_index_value = canoe_inst.get_measurement_index()
105
+ canoe_inst.set_measurement_index(meas_index_value + 1)
106
+ meas_index_new = canoe_inst.get_measurement_index()
107
+ canoe_inst.reset_measurement()
108
+ canoe_inst.stop_measurement()
109
+ ```
110
+
111
+ ### save CANoe config to a different version with different name
112
+
113
+ ```python
114
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
115
+ canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
116
+ ```
117
+
118
+ ### get CAN bus statistics of CAN channel 1
119
+
120
+ ```python
121
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
122
+ canoe_inst.start_measurement()
123
+ wait(2)
124
+ canoe_inst.get_can_bus_statistics(channel=1)
125
+ canoe_inst.stop_measurement()
126
+ ```
127
+
128
+ ### get/set bus signal value, check signal state and get signal full name
129
+
130
+ ```python
131
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
132
+ canoe_inst.start_measurement()
133
+ wait(1)
134
+ sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
135
+ sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
136
+ canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
137
+ wait(1)
138
+ sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
139
+ sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
140
+ sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
141
+ canoe_inst.stop_measurement()
142
+ ```
143
+
144
+ ### clear write window / read text from write window / control write window output file
145
+
146
+ ```python
147
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
148
+ canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
149
+ wait(1)
150
+ canoe_inst.start_measurement()
151
+ canoe_inst.clear_write_window_content()
152
+ wait(1)
153
+ canoe_inst.write_text_in_write_window("hello from py_canoe!")
154
+ wait(1)
155
+ text = canoe_inst.read_text_from_write_window()
156
+ canoe_inst.stop_measurement()
157
+ canoe_inst.disable_write_window_output_file()
158
+ wait(1)
159
+ ```
160
+
161
+ ### switch between CANoe desktops
162
+
163
+ ```python
164
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
165
+ canoe_inst.ui_activate_desktop('Configuration')
166
+ ```
167
+
168
+ ### get/set system variable or define system variable
169
+
170
+ ```python
171
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
172
+ canoe_inst.start_measurement()
173
+ wait(1)
174
+ canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
175
+ canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
176
+ canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
177
+ canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
178
+ wait(0.1)
179
+ sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
180
+ sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
181
+ canoe_inst.stop_measurement()
182
+ # define system variable and use it in measurement
183
+ canoe_inst.define_system_variable('sys_demo::demo', 1)
184
+ canoe_inst.save_configuration()
185
+ canoe_inst.start_measurement()
186
+ wait(1)
187
+ sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
188
+ canoe_inst.stop_measurement()
189
+ ```
190
+
191
+ ### send diagnostic request, control tester present
192
+
193
+ ```python
194
+ canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
195
+ canoe_inst.start_measurement()
196
+ wait(1)
197
+ resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
198
+ canoe_inst.control_tester_present('Door', False)
199
+ wait(2)
200
+ canoe_inst.control_tester_present('Door', True)
201
+ wait(5)
202
+ resp = canoe_inst.send_diag_request('Door', '10 02')
203
+ canoe_inst.control_tester_present('Door', False)
204
+ wait(2)
205
+ resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
206
+ canoe_inst.stop_measurement()
207
+ ```
208
+
209
+ ### set replay block source file / control replay block start stop
210
+
211
+ ```python
212
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
213
+ canoe_inst.start_measurement()
214
+ wait(1)
215
+ canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
216
+ wait(1)
217
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
218
+ wait(2)
219
+ canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
220
+ wait(1)
221
+ canoe_inst.stop_measurement()
222
+ ```
223
+
224
+ ### compile CAPL nodes and call capl function
225
+
226
+ ```python
227
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
228
+ canoe_inst.compile_all_capl_nodes()
229
+ canoe_inst.start_measurement()
230
+ wait(1)
231
+ canoe_inst.call_capl_function('addition_function', 100, 200)
232
+ canoe_inst.call_capl_function('hello_world')
233
+ canoe_inst.stop_measurement()
234
+ ```
235
+
236
+ ### execute test setup test module / test environment
237
+
238
+ ```python
239
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
240
+ canoe_inst.start_measurement()
241
+ wait(1)
242
+ canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
243
+ canoe_inst.execute_test_module('demo_test_node_002')
244
+ wait(1)
245
+ canoe_inst.stop_measurement()
246
+ ```
247
+
248
+ ### get/set environment variable value
249
+
250
+ ```python
251
+ canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
252
+ canoe_inst.start_measurement()
253
+ wait(1)
254
+ canoe_inst.set_environment_variable_value('int_var', 123.12)
255
+ canoe_inst.set_environment_variable_value('float_var', 111.123)
256
+ canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
257
+ canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
258
+ var_value = canoe_inst.get_environment_variable_value('int_var')
259
+ var_value = canoe_inst.get_environment_variable_value('float_var')
260
+ var_value = canoe_inst.get_environment_variable_value('string_var')
261
+ var_value = canoe_inst.get_environment_variable_value('data_var')
262
+ wait(1)
263
+ canoe_inst.stop_measurement()
264
+ ```
265
+
266
+ ### add/remove database
267
+
268
+ ```python
269
+ self.canoe_inst.open(canoe_cfg=self.canoe_cfg_gen_db_setup, visible=True, auto_save=True, prompt_user=False, auto_stop=True)
270
+ self.canoe_inst.start_measurement()
271
+ wait(1)
272
+ # add database
273
+ self.canoe_inst.add_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 'CAN1', 1)
274
+ # remove database
275
+ self.canoe_inst.remove_database(fr"{self.file_path}\demo_cfg\DBs\sample_databases\XCP.dbc", 1)
276
+ ```
277
+
278
+ ### start/stop online measurement setup logging block
279
+
280
+ ```python
281
+ self.canoe_inst.open(canoe_cfg=self.canoe_cfg_online_setup)
282
+ self.canoe_inst.start_measurement()
283
+ wait(1)
284
+ # stop logging block
285
+ self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=False)
286
+ wait(2)
287
+ # start logging block
288
+ self.canoe_inst.start_stop_online_measurement_setup_logging_block(fr'{self.demo_cfg_dir}\Logs\demo_online_setup_log.blf', start=True)
289
+ ```
290
+
291
+ ### working with logging blocks
292
+
293
+ ```python
294
+ # remove current logging blocks
295
+ for i in range(canoe_inst.logging_collection.count):
296
+ canoe_inst.remove_logging_block(1) # iteration start from 1 and shifts after each delete
297
+
298
+ # add a new block
299
+ # define dest path with file format as asc, blf or other
300
+ # may include field functions like {IncMeasurement}
301
+ full_path = "C:/sample_log_{IncMeasurement}.blf"
302
+ canoe_inst.add_logging_block(full_path)
303
+ canoe_inst.start_measurement()
304
+ # ...
305
+ canoe_inst.stop_measurement()
306
+ # log should be fully generated at this point for you to analyze
307
+ canoe_inst.set_configuration_modified(False) # to avoid popup asking to save changes
308
+ canoe_inst.quit()
309
+ ```
310
+
@@ -0,0 +1 @@
1
+ from .py_canoe import CANoe, wait