From 9ff573e9fe4c40ffb342ce2b215042c39b518aeb Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Fri, 7 Apr 2017 09:17:10 +0930 Subject: 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. --- qt/RGBController/old_src/serial_communication.h | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 qt/RGBController/old_src/serial_communication.h (limited to 'qt/RGBController/old_src/serial_communication.h') diff --git a/qt/RGBController/old_src/serial_communication.h b/qt/RGBController/old_src/serial_communication.h new file mode 100644 index 0000000..5f2826c --- /dev/null +++ b/qt/RGBController/old_src/serial_communication.h @@ -0,0 +1,27 @@ +#ifndef SERIAL_COMMUNICATION_H +#define SERIAL_COMMUNICATION_H + +/* includes */ +#include +#include +#include + + +class serial_communication +{ + public: + /* function declares */ + serial_communication(); + bool serial_connect(QString port); + bool serial_disconnect(); + void rgb_change(int r, int g, int b); + void send(QString com); + /* variables */ + QString port_name; + QSerialPort serial; + QByteArray data; + private slots: + void read(); +}; + +#endif // SERIAL_COMMUNICATION_H -- cgit v1.2.3