diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-06 09:14:29 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-06 09:18:20 +0200 | 
| commit | 9d20fa89ffdb49a3da20812e2eaa0ee2d9a24f5b (patch) | |
| tree | bd645204c69544e86396a05b5315f2acbf3fb0c0 /tracker-hatire | |
| parent | aaa4ed77a2506144f470ce2b7fb269bedd17a2b3 (diff) | |
tracker/hatire: move function from header
Diffstat (limited to 'tracker-hatire')
| -rwxr-xr-x | tracker-hatire/thread.cpp | 40 | ||||
| -rwxr-xr-x | tracker-hatire/thread.hpp | 40 | 
2 files changed, 41 insertions, 39 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. diff --git a/tracker-hatire/thread.hpp b/tracker-hatire/thread.hpp index 39719ef8..f36d114e 100755 --- a/tracker-hatire/thread.hpp +++ b/tracker-hatire/thread.hpp @@ -107,45 +107,7 @@ private slots:      void on_serial_read();      void teardown_serial(); -    void sendcmd_impl(unused(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 sendcmd_impl(unused(const QByteArray, &cmd));      void serial_info_impl();      serial_result init_serial_port_impl();      void update_serial_settings_impl(const thread_settings& s);  | 
