diff options
Diffstat (limited to 'tracker-hatire/thread.cpp')
-rwxr-xr-x | tracker-hatire/thread.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp index 40648c9f..5df3a68c 100755 --- a/tracker-hatire/thread.cpp +++ b/tracker-hatire/thread.cpp @@ -8,6 +8,46 @@ #include <cstring> +void hatire_thread::sendcmd_impl(const QByteArray &cmd) +{ +#ifndef HATIRE_DEBUG_LOGFILE + QByteArray Msg; + + if (cmd.length() > 0) + { + if (com_port.isOpen()) + { + QString logMess; + logMess.append("SEND '"); + logMess.append(cmd); + logMess.append("'"); + Log(logMess); + com_port.write(cmd); + if (!com_port.waitForBytesWritten(1000)) { + emit serial_debug_info("TimeOut in writing CMD"); + } else + { + Msg.append("\r\n"); + Msg.append("SEND '"); + Msg.append(cmd); + Msg.append("'\r\n"); + } +#if 0 // WaitForReadyRead isn't working well and there are some reports of it being a win32 issue. We can live without it anyway + if ( !com_port.waitForReadyRead(1000)) { + emit serial_debug_info("TimeOut in response to CMD") ; + } else { + emit serial_debug_info(Msg); + } +#else + emit serial_debug_info(Msg); +#endif + } else { + emit serial_debug_info("ComPort not open") ; + } + } +#endif +} + void hatire_thread::Log(const QString& message) { // Drop out immediately if logging is off. Yes, there is still some overhead because of passing strings around for no reason. |