summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/thread.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-06 09:14:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-06 09:18:20 +0200
commit9d20fa89ffdb49a3da20812e2eaa0ee2d9a24f5b (patch)
treebd645204c69544e86396a05b5315f2acbf3fb0c0 /tracker-hatire/thread.cpp
parentaaa4ed77a2506144f470ce2b7fb269bedd17a2b3 (diff)
tracker/hatire: move function from header
Diffstat (limited to 'tracker-hatire/thread.cpp')
-rwxr-xr-xtracker-hatire/thread.cpp40
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.