diff options
Diffstat (limited to 'MotionControl/Service.py')
-rw-r--r-- | MotionControl/Service.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/MotionControl/Service.py b/MotionControl/Service.py new file mode 100644 index 0000000..241d141 --- /dev/null +++ b/MotionControl/Service.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import rpyc + +class Service(rpyc.Service): + stage = None + def on_connect(self): + Service.stage.onPositionChanged.connect(self.onPosition) + + for i,p in enumerate(Service.stage.position): + self.onPosition(None, i, p) + + def on_disconnect(self): + Service.stage.onPositionChanged.disconnect(self.onPosition) + + def onPosition(self, sender, axis, position): + rpyc.async(self._conn.root.onPosition)(axis, position) + + def exposed_set_destination(self, destination): + Service.stage.set_destination(destination) + def exposed_cycle_start(self): + Service.stage.cycle_start() + def exposed_abort(self): + Service.stage.abort() + + def exposed_reference(self): + Service.stage.reference() + + def exposed_getAxisLimits(self, axis): + return Service.stage.axes[axis].limits + |