diff options
author | daniel-Jones <daniel@danieljon.es> | 2017-04-07 09:17:10 +0930 |
---|---|---|
committer | daniel-Jones <daniel@danieljon.es> | 2017-04-07 09:17:10 +0930 |
commit | 9ff573e9fe4c40ffb342ce2b215042c39b518aeb (patch) | |
tree | e4168caacbb934b072da417275ea578d26229db6 /qt/RGBController/old_src/serial.h | |
parent | 1189c8c2671b2463dbca7842a81adfe00c35549c (diff) | |
download | RGB-Controller-9ff573e9fe4c40ffb342ce2b215042c39b518aeb.tar.gz RGB-Controller-9ff573e9fe4c40ffb342ce2b215042c39b518aeb.zip |
Merged source into one .cpp and .h. Added serial communication from the Arduino to the host computer. Added ping/pong system to maintain a connection, once 3 failed tries have occured, the connection is force closed, this restores the ui to a desired state. A ping is sent every 60 seconds and a response is required within one second. Some debug UI additions and code is still present, to be removed.
Diffstat (limited to 'qt/RGBController/old_src/serial.h')
-rw-r--r-- | qt/RGBController/old_src/serial.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/qt/RGBController/old_src/serial.h b/qt/RGBController/old_src/serial.h new file mode 100644 index 0000000..6403887 --- /dev/null +++ b/qt/RGBController/old_src/serial.h @@ -0,0 +1,32 @@ +#ifndef SERIAL_H +#define SERIAL_H + +#include <QObject> +#include <QSerialPort> +#include <QSerialPortInfo> +#include <QDebug> + +class serial : public QObject +{ + Q_OBJECT + public: + explicit serial(QObject *parent = 0); + + + /* function declares */ + bool serial_connect(QString port); + bool serial_disconnect(); + void rgb_change(int r, int g, int b); + void send(QString com); + void parse(QString message); + /* variables */ + QString port_name; + //QSerialPort ser; + QSerialPort *ser; + QByteArray data; + QByteArray serdata; + private slots: + void read(); +}; + +#endif // SERIAL_H |