163 self.__serial.write(b"\r\x01") # send CTRL-A again |
163 self.__serial.write(b"\r\x01") # send CTRL-A again |
164 self.__serial.readUntil(rawReplMessage) |
164 self.__serial.readUntil(rawReplMessage) |
165 if self.__serial.hasTimedOut(): |
165 if self.__serial.hasTimedOut(): |
166 return False |
166 return False |
167 |
167 |
168 QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents) |
168 QCoreApplication.processEvents( |
|
169 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
169 self.__serial.readAll() # read all data and discard it |
170 self.__serial.readAll() # read all data and discard it |
170 return True |
171 return True |
171 |
172 |
172 def __rawOff(self): |
173 def __rawOff(self): |
173 """ |
174 """ |
214 for command in commands: |
215 for command in commands: |
215 if command: |
216 if command: |
216 commandBytes = command.encode("utf-8") |
217 commandBytes = command.encode("utf-8") |
217 self.__serial.write(commandBytes + b"\x04") |
218 self.__serial.write(commandBytes + b"\x04") |
218 QCoreApplication.processEvents( |
219 QCoreApplication.processEvents( |
219 QEventLoop.ExcludeUserInputEvents) |
220 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
220 ok = self.__serial.readUntil(b"OK") |
221 ok = self.__serial.readUntil(b"OK") |
221 if ok != b"OK": |
222 if ok != b"OK": |
222 return ( |
223 return ( |
223 b"", |
224 b"", |
224 "Expected 'OK', got '{0}', followed by '{1}'".format( |
225 "Expected 'OK', got '{0}', followed by '{1}'".format( |