Esempio n. 1
0
 def open_transport(self):
     if self.fp is None:
         ser = serial.Serial(self.device, timeout=self.timeout)
         if not ser.isOpen():
             raise SystemError("Unable to open %s" % self.device)
         self.fp = ser
     self._flush()
     self._negotiate()
Esempio n. 2
0
 def _execute(self):
     connection = serial.Serial(port=SERIAL_PORT,
                                timeout=READ_TIMEOUT,
                                writeTimeout=WRITE_TIMEOUT)
     connection.write(self.request.encode('ascii'))
     return connection.readline().strip(b'\x04\n').decode('ascii')
 def open_transport(self):
     ser = serial.Serial(self.device, timeout=self.timeout)
     if not ser.isOpen():
         raise SystemError("Unable to open %s" % self.device)
     self.fp = ser