30 """ |
30 """ |
31 super(MicroPythonSerialPort, self).__init__(parent) |
31 super(MicroPythonSerialPort, self).__init__(parent) |
32 |
32 |
33 self.__connected = False |
33 self.__connected = False |
34 self.__timeout = timeout # 10s default timeout |
34 self.__timeout = timeout # 10s default timeout |
|
35 self.__timedOut = False |
35 |
36 |
36 def setTimeout(self, timeout): |
37 def setTimeout(self, timeout): |
37 """ |
38 """ |
38 Public method to set the timeout for device operations. |
39 Public method to set the timeout for device operations. |
39 |
40 |
81 @return flag indicating the connection state |
82 @return flag indicating the connection state |
82 @rtype bool |
83 @rtype bool |
83 """ |
84 """ |
84 return self.__connected |
85 return self.__connected |
85 |
86 |
|
87 def hasTimedOut(self): |
|
88 """ |
|
89 Public method to check, if the last 'readUntil' has timed out. |
|
90 |
|
91 @return flag indicating a timeout |
|
92 @@rtype bool |
|
93 """ |
|
94 return self.__timedOut |
|
95 |
86 def readUntil(self, expected=b"\n", size=None): |
96 def readUntil(self, expected=b"\n", size=None): |
87 r""" |
97 r""" |
88 Public method to read data until an expected sequence is found |
98 Public method to read data until an expected sequence is found |
89 (default: \n) or a specific size is exceeded. |
99 (default: \n) or a specific size is exceeded. |
90 |
100 |