示例#1
0
  def run(self):
    self.serial.open()

    while True:
      try:
        socks = [self.multisocket, self.serial]

        ready = select.select(socks, [], [])
        handlers = self.ready_handlers()

        for h, r in zip(handlers, ready):
          if h in r:

            try:
              h[r]()
            except KeyError, e:
              pass
            except Exception, e:
              print 'Exception handling: %s' % repr(e)
              net.printtraceback()
示例#2
0
    def run(self):
        self.serial.open()

        while True:
            try:
                socks = [self.multisocket, self.serial]

                ready = select.select(socks, [], [])
                handlers = self.ready_handlers()

                for h, r in zip(handlers, ready):
                    if h in r:

                        try:
                            h[r]()
                        except KeyError, e:
                            pass
                        except Exception, e:
                            print 'Exception handling: %s' % repr(e)
                            net.printtraceback()
示例#3
0
  def run(self):
    self.serial.open()

    while True:
      try:
        socks = [self.multisocket, self.serial]

        ready = select.select(socks, [], [])
        handlers = self.ready_handlers()

        for h, r in zip(handlers, ready):
          if h in r:

            try:
              h[r]()
            except KeyError, e:
              pass
            except Exception, e:
              print 'Exception handling: %s' % repr(e)
              net.printtraceback()
          else: 
            pass  

      except Exception, e:
        print 'Exception: %s' % repr(e)
        net.printtraceback()

if __name__ == '__main__':
  sc = SerialController(50002, '/dev/ttyUSB1')
  sc.run()
示例#4
0
        self.serial.open()

        while True:
            try:
                socks = [self.multisocket, self.serial]

                ready = select.select(socks, [], [])
                handlers = self.ready_handlers()

                for h, r in zip(handlers, ready):
                    if h in r:

                        try:
                            h[r]()
                        except KeyError, e:
                            pass
                        except Exception, e:
                            print 'Exception handling: %s' % repr(e)
                            net.printtraceback()
                    else:
                        pass

            except Exception, e:
                print 'Exception: %s' % repr(e)
                net.printtraceback()


if __name__ == '__main__':
    sc = SerialController(50002, '/dev/ttyUSB1')
    sc.run()