Esempio n. 1
0
    def readline(self):
        try:
            if (self.baudrateError):
                if (self._baudrate != self.baudrate):
                    gpx.write("M105")
                return ''

            try:
                return self.outgoing.get_nowait()
            except Queue.Empty:
                pass

            if gpx.listing_files():
                return gpx.readnext()

            while True:
                timeout = 2 if gpx.waiting else self.timeout
                try:
                    return self.outgoing.get(timeout=timeout)
                except Queue.Empty:
                    self._append(gpx.readnext())

        except gpx.CancelBuild:
            self._bot_reports_build_cancelled()
            return '// echo: build cancelled'
Esempio n. 2
0
	def readline(self):
		while (self.baudrateError):
			if (self._baudrate != self.baudrate):
				self.write("M105")
			return ''
		try:
			s = self.outgoing.get_nowait()
			self._logger.debug("readline: %s" % s)
			return s
		except Queue.Empty:
			pass
		s = gpx.readnext()
		timeout = self.timeout
		append_later = None
		if gpx.waiting():
			append_later = s
			timeout = 2
		else:
			self._append(s)
		try:
			s = self.outgoing.get(timeout=timeout)
			self._logger.debug("readline: %s" % s)
			return s
		except Queue.Empty:
			if append_later is not None:
				self._append(append_later)
			self._logger.debug("timeout")
			pass
		return ''
Esempio n. 3
0
	def readline(self):
		try:
			if (self.baudrateError):
				if (self._baudrate != self.baudrate):
					gpx.write("M105")
				return ''

			try:
				return self.outgoing.get_nowait()
			except Queue.Empty:
				pass

			if gpx.listing_files():
				return gpx.readnext()

			timeout = 2 if gpx.waiting else self.timeout
			try:
				return self.outgoing.get(timeout=timeout)
			except Queue.Empty:
				return gpx.readnext()

		except gpx.CancelBuild:
			self._bot_reports_build_cancelled()
			return '// echo: build cancelled'
Esempio n. 4
0
 def readline(self):
     try:
         while (self.baudrateError):
             if (self._baudrate != self.baudrate):
                 gpx.write("M105")
             return ''
         try:
             s = self.outgoing.get_nowait()
             self._logger.debug("readline: %s" % s)
             return s
         except Queue.Empty:
             pass
         s = gpx.readnext()
         timeout = self.timeout
         append_later = None
         if gpx.waiting():
             append_later = s
             timeout = 2
         else:
             self._append(s)
         while True:
             try:
                 s = self.outgoing.get(timeout=timeout)
                 if append_later is not None:
                     self._append(s)
                     s = append_later
                 self._logger.debug("readline: %s" % s)
                 return s
             except Queue.Empty:
                 self._logger.debug("timeout")
                 if append_later is None:
                     return ''
                 self._append(append_later)
                 append_later = None
     except gpx.CancelBuild:
         self._bot_reports_build_cancelled()
         return '// echo: build cancelled'
Esempio n. 5
0
 def readline(self):
     try:
         while self.baudrateError:
             if self._baudrate != self.baudrate:
                 gpx.write("M105")
             return ""
         try:
             s = self.outgoing.get_nowait()
             self._logger.debug("readline: %s" % s)
             return s
         except Queue.Empty:
             pass
         s = gpx.readnext()
         timeout = self.timeout
         append_later = None
         if gpx.waiting():
             append_later = s
             timeout = 2
         else:
             self._append(s)
         while True:
             try:
                 s = self.outgoing.get(timeout=timeout)
                 if append_later is not None:
                     self._append(s)
                     s = append_later
                 self._logger.debug("readline: %s" % s)
                 return s
             except Queue.Empty:
                 self._logger.debug("timeout")
                 if append_later is None:
                     return ""
                 self._append(append_later)
                 append_later = None
     except gpx.CancelBuild:
         self._bot_reports_build_cancelled()
         return "// echo: build cancelled"