-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCANoeMeasurement.py
More file actions
34 lines (25 loc) · 965 Bytes
/
Copy pathCANoeMeasurement.py
File metadata and controls
34 lines (25 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import time
import win32com
class CanoeMeasurement:
def __init__(self, canoe_instance, canoe_app):
self.canoe_app = canoe_app
self.canoe_instance = canoe_instance
self.canoe_measurement = canoe_instance.Measurement
def is_running(self):
return self.canoe_measurement.Running == 1
def start(self):
if not self.canoe_app.capl._registered:
print("Functions need to be registered before starting measurement.")
return
self.add_on_init_handler()
self.canoe_measurement.Start()
while not self.is_running():
time.sleep(1)
def add_on_init_handler(self):
from PythonCanoe import MeasurementInitHandler
win32com.client.WithEvents(self.canoe_measurement, MeasurementInitHandler)
def stop(self):
if not self.is_running():
print("Measurement not running.")
return
self.canoe_measurement.Stop()