import hal
def get_handlers(linuxcnc_stat, linucnc_cmd, commands, master):
return [HandlerClass(linuxcnc_stat, linucnc_cmd, commands, master)]
class HandlerClass:
def __init__(self, linuxcnc_stat, linuxcnc_cmd, commands, master):
self.parent = commands
self.current_mode = 0
def hello_world(self, wname, m):
print '\nHello world\n'
print m
print wname.metadata
self.parent.mdi(None,'(MSG, Hello Linuxcnc World!)')
def cycle_mode(self, wname, m):
if self.current_mode == 0:
self.current_mode = 1
self.parent.set_mdi_mode()
elif self.current_mode == 1:
self.current_mode = 2
self.parent.set_auto_mode()
else:
self.current_mode = 0
self.parent.set_manual_mode()
print self.current_mode
def __getitem__(self, item):
return getattr(self, item)
def __setitem__(self, item, value):
return setattr(self, item, value)