コード例 #1
0
ファイル: serial_write_State.py プロジェクト: lyh3/automation
 def SerialInvoke(self):
     data = None
     if self._keystroke is not None:
         for i in range(0, self._recur):
             if self._keystroke['invoke'] == 'write':
                 InvokeSerial(self._port,
                              self._baud).Write(self._keystroke['data'])
             else:
                 data = self._keystroke['data']
             if data is not None:
                 InvokeSerial(self._port, self._baud).WriteLines(data)
コード例 #2
0
    def SerialInvoke(self):
        while True:
            try:
                self._checkTimeout(self._timeout)
                if self._success:
                    print('Timeout for [{0}] (sec).'.format(self._timeout))
                    break
                ret = InvokeSerial(self._port,
                                   self._baud).ReadMessage().strip()
                if ret is not None and ret != '':
                    for t in self._trims:
                        ret = ret.replace(t, '')
                    print(ret)
                    if len(re.findall(self.WaitFor, ret)) > 0:
                        if self.WaitFor == 'Press F2':
                            InvokeSerial(self._port,
                                         self._baud).WriteLines(r'\x1b2')
                        print('Find [{0}].'.format(self.WaitFor))
                        break

            except Exception as e:
                print(str(e))
コード例 #3
0
ファイル: healthCheck.py プロジェクト: lyh3/automation
 def Launch(config, filters, testType):
     resourcePath = os.path.realpath(r'Json/Resource.json')
     try:
         resource = json.loads(open(resourcePath).read())
         serialInvoke = None
         if 'serialport' in config.keys():
             InvokeSerial(config['serialport'],
                          int(config['serialportbaudrate']))
         if testType is TEST_TYPE.PERF:
             t = PerformanceTestThread(config, resource)
         elif testType is TEST_TYPE.PerfTuning:
             t = PerformanceTuningThread(config, resource)
         else:
             t = SelfCheckThread(config, resource, serialInvoke)
         t.Filters = filters
         if testType is TEST_TYPE.UEFI or testType is TEST_TYPE.PERF or testType is TEST_TYPE.PerfTuning:
             t.IsDefaultTestType = False
         t.Start()
     except Exception as e:
         print(str(e))
         sys.exit(1)
コード例 #4
0
 def SerialInvoke(self):
     return InvokeSerial(self._port, self._baud).ReadMessage()