py_canoe 3.0.1__tar.gz → 3.0.2__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.
- py_canoe-3.0.2/PKG-INFO +291 -0
- py_canoe-3.0.2/README.md +265 -0
- {py_canoe-3.0.1 → py_canoe-3.0.2}/py_canoe/__init__.py +212 -163
- {py_canoe-3.0.1 → py_canoe-3.0.2}/pyproject.toml +4 -4
- py_canoe-3.0.1/PKG-INFO +0 -84
- py_canoe-3.0.1/README.md +0 -58
- {py_canoe-3.0.1 → py_canoe-3.0.2}/LICENSE +0 -0
- {py_canoe-3.0.1 → py_canoe-3.0.2}/py_canoe/py_canoe_logger.py +0 -0
py_canoe-3.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: py_canoe
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: Python CANoe Package
|
|
5
|
+
Home-page: https://github.com/chaitu-ycr/py_canoe
|
|
6
|
+
License: LICENSE
|
|
7
|
+
Keywords: Vector,CANoe,py_canoe
|
|
8
|
+
Author: chaitu-ycr
|
|
9
|
+
Author-email: chaitu.ycr@gmail.com
|
|
10
|
+
Requires-Python: >=3.9,<4.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: License :: Other/Proprietary License
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
21
|
+
Requires-Dist: pywin32 (>=306,<=308)
|
|
22
|
+
Project-URL: Documentation, https://chaitu-ycr.github.io/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
|
|
82
|
+
from time import sleep as wait
|
|
83
|
+
|
|
84
|
+
canoe_inst = CANoe()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
|
|
91
|
+
canoe_inst.start_measurement()
|
|
92
|
+
canoe_version_info = canoe_inst.get_canoe_version_info()
|
|
93
|
+
canoe_inst.stop_measurement()
|
|
94
|
+
canoe_inst.quit()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### restart/reset running measurement
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
|
|
101
|
+
canoe_inst.start_measurement()
|
|
102
|
+
canoe_inst.reset_measurement()
|
|
103
|
+
canoe_inst.stop_ex_measurement()
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
|
|
110
|
+
canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
|
|
111
|
+
canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
|
|
112
|
+
wait(1)
|
|
113
|
+
canoe_inst.break_measurement_in_offline_mode()
|
|
114
|
+
wait(1)
|
|
115
|
+
canoe_inst.step_measurement_event_in_single_step()
|
|
116
|
+
wait(1)
|
|
117
|
+
canoe_inst.reset_measurement_in_offline_mode()
|
|
118
|
+
wait(1)
|
|
119
|
+
canoe_inst.stop_measurement()
|
|
120
|
+
wait(1)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### get/set CANoe measurement index
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
127
|
+
meas_index_value = canoe_inst.get_measurement_index()
|
|
128
|
+
canoe_inst.start_measurement()
|
|
129
|
+
canoe_inst.stop_measurement()
|
|
130
|
+
meas_index_value = canoe_inst.get_measurement_index()
|
|
131
|
+
canoe_inst.set_measurement_index(meas_index_value + 1)
|
|
132
|
+
meas_index_new = canoe_inst.get_measurement_index()
|
|
133
|
+
canoe_inst.reset_measurement()
|
|
134
|
+
canoe_inst.stop_measurement()
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### save CANoe config to a different version with different name
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
141
|
+
canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### get CAN bus statistics of CAN channel 1
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
148
|
+
canoe_inst.start_measurement()
|
|
149
|
+
wait(2)
|
|
150
|
+
canoe_inst.get_can_bus_statistics(channel=1)
|
|
151
|
+
canoe_inst.stop_measurement()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### get/set bus signal value, check signal state and get signal full name
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
158
|
+
canoe_inst.start_measurement()
|
|
159
|
+
wait(1)
|
|
160
|
+
sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
161
|
+
sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
|
|
162
|
+
canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
|
|
163
|
+
wait(1)
|
|
164
|
+
sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
165
|
+
sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
166
|
+
sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
|
|
167
|
+
canoe_inst.stop_measurement()
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### clear write window / read text from write window / control write window output file
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
174
|
+
canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
|
|
175
|
+
wait(1)
|
|
176
|
+
canoe_inst.start_measurement()
|
|
177
|
+
canoe_inst.clear_write_window_content()
|
|
178
|
+
wait(1)
|
|
179
|
+
canoe_inst.write_text_in_write_window("hello from py_canoe!")
|
|
180
|
+
wait(1)
|
|
181
|
+
text = canoe_inst.read_text_from_write_window()
|
|
182
|
+
canoe_inst.stop_measurement()
|
|
183
|
+
canoe_inst.disable_write_window_output_file()
|
|
184
|
+
wait(1)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### switch between CANoe desktops
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
191
|
+
canoe_inst.ui_activate_desktop('Configuration')
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### get/set system variable or define system variable
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
198
|
+
canoe_inst.start_measurement()
|
|
199
|
+
wait(1)
|
|
200
|
+
canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
|
|
201
|
+
canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
|
|
202
|
+
canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
|
|
203
|
+
canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
|
|
204
|
+
wait(0.1)
|
|
205
|
+
sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
|
|
206
|
+
sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
|
|
207
|
+
canoe_inst.stop_measurement()
|
|
208
|
+
# define system variable and use it in measurement
|
|
209
|
+
canoe_inst.define_system_variable('sys_demo::demo', 1)
|
|
210
|
+
canoe_inst.save_configuration()
|
|
211
|
+
canoe_inst.start_measurement()
|
|
212
|
+
wait(1)
|
|
213
|
+
sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
|
|
214
|
+
canoe_inst.stop_measurement()
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### send diagnostic request, control tester present
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
|
|
221
|
+
canoe_inst.start_measurement()
|
|
222
|
+
wait(1)
|
|
223
|
+
resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
|
|
224
|
+
canoe_inst.control_tester_present('Door', False)
|
|
225
|
+
wait(2)
|
|
226
|
+
canoe_inst.control_tester_present('Door', True)
|
|
227
|
+
wait(5)
|
|
228
|
+
resp = canoe_inst.send_diag_request('Door', '10 02')
|
|
229
|
+
canoe_inst.control_tester_present('Door', False)
|
|
230
|
+
wait(2)
|
|
231
|
+
resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
|
|
232
|
+
canoe_inst.stop_measurement()
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### set replay block source file / control replay block start stop
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
239
|
+
canoe_inst.start_measurement()
|
|
240
|
+
wait(1)
|
|
241
|
+
canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
|
|
242
|
+
wait(1)
|
|
243
|
+
canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
|
|
244
|
+
wait(2)
|
|
245
|
+
canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
|
|
246
|
+
wait(1)
|
|
247
|
+
canoe_inst.stop_measurement()
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### compile CAPL nodes and call capl function
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
254
|
+
canoe_inst.compile_all_capl_nodes()
|
|
255
|
+
canoe_inst.start_measurement()
|
|
256
|
+
wait(1)
|
|
257
|
+
canoe_inst.call_capl_function('addition_function', 100, 200)
|
|
258
|
+
canoe_inst.call_capl_function('hello_world')
|
|
259
|
+
canoe_inst.stop_measurement()
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### execute test setup test module / test environment
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
266
|
+
canoe_inst.start_measurement()
|
|
267
|
+
wait(1)
|
|
268
|
+
canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
|
|
269
|
+
canoe_inst.execute_test_module('demo_test_node_002')
|
|
270
|
+
wait(1)
|
|
271
|
+
canoe_inst.stop_measurement()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### get/set environment variable value
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
278
|
+
canoe_inst.start_measurement()
|
|
279
|
+
wait(1)
|
|
280
|
+
canoe_inst.set_environment_variable_value('int_var', 123.12)
|
|
281
|
+
canoe_inst.set_environment_variable_value('float_var', 111.123)
|
|
282
|
+
canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
|
|
283
|
+
canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
|
|
284
|
+
var_value = canoe_inst.get_environment_variable_value('int_var')
|
|
285
|
+
var_value = canoe_inst.get_environment_variable_value('float_var')
|
|
286
|
+
var_value = canoe_inst.get_environment_variable_value('string_var')
|
|
287
|
+
var_value = canoe_inst.get_environment_variable_value('data_var')
|
|
288
|
+
wait(1)
|
|
289
|
+
canoe_inst.stop_measurement()
|
|
290
|
+
```
|
|
291
|
+
|
py_canoe-3.0.2/README.md
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
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
|
|
57
|
+
from time import sleep as wait
|
|
58
|
+
|
|
59
|
+
canoe_inst = CANoe()
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### open CANoe, start measurement, get version info, stop measurement and close canoe configuration
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
|
|
66
|
+
canoe_inst.start_measurement()
|
|
67
|
+
canoe_version_info = canoe_inst.get_canoe_version_info()
|
|
68
|
+
canoe_inst.stop_measurement()
|
|
69
|
+
canoe_inst.quit()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### restart/reset running measurement
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo.cfg')
|
|
76
|
+
canoe_inst.start_measurement()
|
|
77
|
+
canoe_inst.reset_measurement()
|
|
78
|
+
canoe_inst.stop_ex_measurement()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### open CANoe offline config and start/break/step/reset/stop measurement in offline mode
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
canoe_inst.open(r'tests\demo_cfg\demo_offline.cfg')
|
|
85
|
+
canoe_inst.add_offline_source_log_file(r'tests\demo_cfg\Logs\demo_log.blf')
|
|
86
|
+
canoe_inst.start_measurement_in_animation_mode(animation_delay=200)
|
|
87
|
+
wait(1)
|
|
88
|
+
canoe_inst.break_measurement_in_offline_mode()
|
|
89
|
+
wait(1)
|
|
90
|
+
canoe_inst.step_measurement_event_in_single_step()
|
|
91
|
+
wait(1)
|
|
92
|
+
canoe_inst.reset_measurement_in_offline_mode()
|
|
93
|
+
wait(1)
|
|
94
|
+
canoe_inst.stop_measurement()
|
|
95
|
+
wait(1)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### get/set CANoe measurement index
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
102
|
+
meas_index_value = canoe_inst.get_measurement_index()
|
|
103
|
+
canoe_inst.start_measurement()
|
|
104
|
+
canoe_inst.stop_measurement()
|
|
105
|
+
meas_index_value = canoe_inst.get_measurement_index()
|
|
106
|
+
canoe_inst.set_measurement_index(meas_index_value + 1)
|
|
107
|
+
meas_index_new = canoe_inst.get_measurement_index()
|
|
108
|
+
canoe_inst.reset_measurement()
|
|
109
|
+
canoe_inst.stop_measurement()
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### save CANoe config to a different version with different name
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
116
|
+
canoe_inst.save_configuration_as(path=r'tests\demo_cfg\demo_v10.cfg', major=10, minor=0, create_dir=True)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### get CAN bus statistics of CAN channel 1
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
123
|
+
canoe_inst.start_measurement()
|
|
124
|
+
wait(2)
|
|
125
|
+
canoe_inst.get_can_bus_statistics(channel=1)
|
|
126
|
+
canoe_inst.stop_measurement()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### get/set bus signal value, check signal state and get signal full name
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
133
|
+
canoe_inst.start_measurement()
|
|
134
|
+
wait(1)
|
|
135
|
+
sig_full_name = canoe_inst.get_signal_full_name(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
136
|
+
sig_value = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=False)
|
|
137
|
+
canoe_inst.set_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', value=1, raw_value=False)
|
|
138
|
+
wait(1)
|
|
139
|
+
sig_online_state = canoe_inst.check_signal_online(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
140
|
+
sig_state = canoe_inst.check_signal_state(bus='CAN', channel=1, message='LightState', signal='FlashLight')
|
|
141
|
+
sig_val = canoe_inst.get_signal_value(bus='CAN', channel=1, message='LightState', signal='FlashLight', raw_value=True)
|
|
142
|
+
canoe_inst.stop_measurement()
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### clear write window / read text from write window / control write window output file
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
149
|
+
canoe_inst.enable_write_window_output_file(r'tests\demo_cfg\Logs\write_win.txt')
|
|
150
|
+
wait(1)
|
|
151
|
+
canoe_inst.start_measurement()
|
|
152
|
+
canoe_inst.clear_write_window_content()
|
|
153
|
+
wait(1)
|
|
154
|
+
canoe_inst.write_text_in_write_window("hello from py_canoe!")
|
|
155
|
+
wait(1)
|
|
156
|
+
text = canoe_inst.read_text_from_write_window()
|
|
157
|
+
canoe_inst.stop_measurement()
|
|
158
|
+
canoe_inst.disable_write_window_output_file()
|
|
159
|
+
wait(1)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### switch between CANoe desktops
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
166
|
+
canoe_inst.ui_activate_desktop('Configuration')
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### get/set system variable or define system variable
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
173
|
+
canoe_inst.start_measurement()
|
|
174
|
+
wait(1)
|
|
175
|
+
canoe_inst.set_system_variable_value('demo::level_two_1::sys_var2', 20)
|
|
176
|
+
canoe_inst.set_system_variable_value('demo::string_var', 'hey hello this is string variable')
|
|
177
|
+
canoe_inst.set_system_variable_value('demo::data_var', 'hey hello this is data variable')
|
|
178
|
+
canoe_inst.set_system_variable_array_values('demo::int_array_var', (00, 11, 22, 33, 44, 55, 66, 77, 88, 99))
|
|
179
|
+
wait(0.1)
|
|
180
|
+
sys_var_val = canoe_inst.get_system_variable_value('demo::level_two_1::sys_var2')
|
|
181
|
+
sys_var_val = canoe_inst.get_system_variable_value('demo::data_var')
|
|
182
|
+
canoe_inst.stop_measurement()
|
|
183
|
+
# define system variable and use it in measurement
|
|
184
|
+
canoe_inst.define_system_variable('sys_demo::demo', 1)
|
|
185
|
+
canoe_inst.save_configuration()
|
|
186
|
+
canoe_inst.start_measurement()
|
|
187
|
+
wait(1)
|
|
188
|
+
sys_var_val = canoe_inst.get_system_variable_value('sys_demo::demo')
|
|
189
|
+
canoe_inst.stop_measurement()
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### send diagnostic request, control tester present
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
canoe_inst.open(r'tests\demo_cfg\demo_diag.cfg')
|
|
196
|
+
canoe_inst.start_measurement()
|
|
197
|
+
wait(1)
|
|
198
|
+
resp = canoe_inst.send_diag_request('Door', 'DefaultSession_Start', False)
|
|
199
|
+
canoe_inst.control_tester_present('Door', False)
|
|
200
|
+
wait(2)
|
|
201
|
+
canoe_inst.control_tester_present('Door', True)
|
|
202
|
+
wait(5)
|
|
203
|
+
resp = canoe_inst.send_diag_request('Door', '10 02')
|
|
204
|
+
canoe_inst.control_tester_present('Door', False)
|
|
205
|
+
wait(2)
|
|
206
|
+
resp = canoe_inst.send_diag_request('Door', '10 03', return_sender_name=True)
|
|
207
|
+
canoe_inst.stop_measurement()
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### set replay block source file / control replay block start stop
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
214
|
+
canoe_inst.start_measurement()
|
|
215
|
+
wait(1)
|
|
216
|
+
canoe_inst.set_replay_block_file(block_name='DemoReplayBlock', recording_file_path=r'tests\demo_cfg\Logs\demo_log.blf')
|
|
217
|
+
wait(1)
|
|
218
|
+
canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=True)
|
|
219
|
+
wait(2)
|
|
220
|
+
canoe_inst.control_replay_block(block_name='DemoReplayBlock', start_stop=False)
|
|
221
|
+
wait(1)
|
|
222
|
+
canoe_inst.stop_measurement()
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### compile CAPL nodes and call capl function
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
229
|
+
canoe_inst.compile_all_capl_nodes()
|
|
230
|
+
canoe_inst.start_measurement()
|
|
231
|
+
wait(1)
|
|
232
|
+
canoe_inst.call_capl_function('addition_function', 100, 200)
|
|
233
|
+
canoe_inst.call_capl_function('hello_world')
|
|
234
|
+
canoe_inst.stop_measurement()
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### execute test setup test module / test environment
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
241
|
+
canoe_inst.start_measurement()
|
|
242
|
+
wait(1)
|
|
243
|
+
canoe_inst.execute_all_test_modules_in_test_env(demo_test_environment)
|
|
244
|
+
canoe_inst.execute_test_module('demo_test_node_002')
|
|
245
|
+
wait(1)
|
|
246
|
+
canoe_inst.stop_measurement()
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### get/set environment variable value
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
canoe_inst.open(canoe_cfg=r'tests\demo_cfg\demo_dev.cfg')
|
|
253
|
+
canoe_inst.start_measurement()
|
|
254
|
+
wait(1)
|
|
255
|
+
canoe_inst.set_environment_variable_value('int_var', 123.12)
|
|
256
|
+
canoe_inst.set_environment_variable_value('float_var', 111.123)
|
|
257
|
+
canoe_inst.set_environment_variable_value('string_var', 'this is string variable')
|
|
258
|
+
canoe_inst.set_environment_variable_value('data_var', (1, 2, 3, 4, 5, 6, 7))
|
|
259
|
+
var_value = canoe_inst.get_environment_variable_value('int_var')
|
|
260
|
+
var_value = canoe_inst.get_environment_variable_value('float_var')
|
|
261
|
+
var_value = canoe_inst.get_environment_variable_value('string_var')
|
|
262
|
+
var_value = canoe_inst.get_environment_variable_value('data_var')
|
|
263
|
+
wait(1)
|
|
264
|
+
canoe_inst.stop_measurement()
|
|
265
|
+
```
|