Exemplo n.º 1
0
    def __init__(self, name, port, speed, cmd):
        self.name = name
        self.port = port
        self.speed = speed
        self.cmd = cmd
        
        print "New serial action: %s -> %s" %(name,cmd)

        self.portObj = SerialPort(port, speed)
Exemplo n.º 2
0
class SerialAction:

    def __init__(self, name, port, speed, cmd):
        self.name = name
        self.port = port
        self.speed = speed
        self.cmd = cmd
        
        print "New serial action: %s -> %s" %(name,cmd)

        self.portObj = SerialPort(port, speed)
        
    def __repr__(self):
        return "SerialAction %s -> %s %s %s" %(self.name, self.port, self.speed, self.cmd)

    def perform(self):

        print "SerialAction: performing -> %s" %self.cmd

        self.portObj.write(self.cmd + "\r")

    def quit(self):
        self.portObj.quit()