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/build-RGBController-Desktop-Debug/Makefile | 27 ++--- qt/build-RGBController-Desktop-Debug/RGBController | Bin 1384272 -> 1614688 bytes qt/build-RGBController-Desktop-Debug/moc_predefs.h | 2 +- .../moc_serial.cpp | 114 +++++++++++++++++++++ 4 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 qt/build-RGBController-Desktop-Debug/moc_serial.cpp (limited to 'qt/build-RGBController-Desktop-Debug') diff --git a/qt/build-RGBController-Desktop-Debug/Makefile b/qt/build-RGBController-Desktop-Debug/Makefile index 93c69a1..1314c66 100644 --- a/qt/build-RGBController-Desktop-Debug/Makefile +++ b/qt/build-RGBController-Desktop-Debug/Makefile @@ -49,11 +49,9 @@ OBJECTS_DIR = ./ ####### Files SOURCES = ../RGBController/main.cpp \ - ../RGBController/controllerwindow.cpp \ - ../RGBController/serial_communication.cpp moc_controllerwindow.cpp + ../RGBController/controllerwindow.cpp moc_controllerwindow.cpp OBJECTS = main.o \ controllerwindow.o \ - serial_communication.o \ moc_controllerwindow.o DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/common/unix.conf \ @@ -259,6 +257,7 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/features/qt_config.prf \ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \ /usr/lib/qt/mkspecs/features/spec_post.prf \ + ../RGBController/.qmake.stash \ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \ /usr/lib/qt/mkspecs/features/toolchain.prf \ /usr/lib/qt/mkspecs/features/default_pre.prf \ @@ -277,10 +276,8 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/features/exceptions.prf \ /usr/lib/qt/mkspecs/features/yacc.prf \ /usr/lib/qt/mkspecs/features/lex.prf \ - ../RGBController/RGBController.pro ../RGBController/controllerwindow.h \ - ../RGBController/serial_communication.h ../RGBController/main.cpp \ - ../RGBController/controllerwindow.cpp \ - ../RGBController/serial_communication.cpp + ../RGBController/RGBController.pro ../RGBController/controllerwindow.h ../RGBController/main.cpp \ + ../RGBController/controllerwindow.cpp QMAKE_TARGET = RGBController DESTDIR = TARGET = RGBController @@ -496,6 +493,7 @@ Makefile: ../RGBController/RGBController.pro /usr/lib/qt/mkspecs/linux-g++/qmake /usr/lib/qt/mkspecs/features/qt_config.prf \ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \ /usr/lib/qt/mkspecs/features/spec_post.prf \ + .qmake.stash \ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \ /usr/lib/qt/mkspecs/features/toolchain.prf \ /usr/lib/qt/mkspecs/features/default_pre.prf \ @@ -725,6 +723,7 @@ Makefile: ../RGBController/RGBController.pro /usr/lib/qt/mkspecs/linux-g++/qmake /usr/lib/qt/mkspecs/features/qt_config.prf: /usr/lib/qt/mkspecs/linux-g++/qmake.conf: /usr/lib/qt/mkspecs/features/spec_post.prf: +.qmake.stash: /usr/lib/qt/mkspecs/features/exclusive_builds.prf: /usr/lib/qt/mkspecs/features/toolchain.prf: /usr/lib/qt/mkspecs/features/default_pre.prf: @@ -764,8 +763,8 @@ distdir: FORCE @test -d $(DISTDIR) || mkdir -p $(DISTDIR) $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ $(COPY_FILE) --parents /usr/lib/qt/mkspecs/features/data/dummy.cpp $(DISTDIR)/ - $(COPY_FILE) --parents ../RGBController/controllerwindow.h ../RGBController/serial_communication.h $(DISTDIR)/ - $(COPY_FILE) --parents ../RGBController/main.cpp ../RGBController/controllerwindow.cpp ../RGBController/serial_communication.cpp $(DISTDIR)/ + $(COPY_FILE) --parents ../RGBController/controllerwindow.h $(DISTDIR)/ + $(COPY_FILE) --parents ../RGBController/main.cpp ../RGBController/controllerwindow.cpp $(DISTDIR)/ $(COPY_FILE) --parents ../RGBController/controllerwindow.ui $(DISTDIR)/ @@ -801,8 +800,7 @@ moc_predefs.h: /usr/lib/qt/mkspecs/features/data/dummy.cpp compiler_moc_header_make_all: moc_controllerwindow.cpp compiler_moc_header_clean: -$(DEL_FILE) moc_controllerwindow.cpp -moc_controllerwindow.cpp: ../RGBController/serial_communication.h \ - ../RGBController/ui_controllerwindow.h \ +moc_controllerwindow.cpp: ../RGBController/ui_controllerwindow.h \ ../RGBController/controllerwindow.h \ moc_predefs.h \ /usr/bin/moc @@ -828,20 +826,13 @@ compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean compiler_ui ####### Compile main.o: ../RGBController/main.cpp ../RGBController/controllerwindow.h \ - ../RGBController/serial_communication.h \ ../RGBController/ui_controllerwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../RGBController/main.cpp controllerwindow.o: ../RGBController/controllerwindow.cpp ../RGBController/controllerwindow.h \ - ../RGBController/serial_communication.h \ ../RGBController/ui_controllerwindow.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o controllerwindow.o ../RGBController/controllerwindow.cpp -serial_communication.o: ../RGBController/serial_communication.cpp ../RGBController/serial_communication.h \ - ../RGBController/controllerwindow.h \ - ../RGBController/ui_controllerwindow.h - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o serial_communication.o ../RGBController/serial_communication.cpp - moc_controllerwindow.o: moc_controllerwindow.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_controllerwindow.o moc_controllerwindow.cpp diff --git a/qt/build-RGBController-Desktop-Debug/RGBController b/qt/build-RGBController-Desktop-Debug/RGBController index 42b00de..8091a3a 100755 Binary files a/qt/build-RGBController-Desktop-Debug/RGBController and b/qt/build-RGBController-Desktop-Debug/RGBController differ diff --git a/qt/build-RGBController-Desktop-Debug/moc_predefs.h b/qt/build-RGBController-Desktop-Debug/moc_predefs.h index 982a21d..886ee8d 100644 --- a/qt/build-RGBController-Desktop-Debug/moc_predefs.h +++ b/qt/build-RGBController-Desktop-Debug/moc_predefs.h @@ -130,7 +130,7 @@ #define __UINT8_TYPE__ unsigned char #define __NO_INLINE__ 1 #define __FLT_MANT_DIG__ 24 -#define __VERSION__ "6.3.1 20170109" +#define __VERSION__ "6.3.1 20170306" #define __UINT64_C(c) c ## UL #define __cpp_unicode_characters 200704 #define _STDC_PREDEF_H 1 diff --git a/qt/build-RGBController-Desktop-Debug/moc_serial.cpp b/qt/build-RGBController-Desktop-Debug/moc_serial.cpp new file mode 100644 index 0000000..4a63c61 --- /dev/null +++ b/qt/build-RGBController-Desktop-Debug/moc_serial.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'serial.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../RGBController/serial.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'serial.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_serial_t { + QByteArrayData data[3]; + char stringdata0[13]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_serial_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_serial_t qt_meta_stringdata_serial = { + { +QT_MOC_LITERAL(0, 0, 6), // "serial" +QT_MOC_LITERAL(1, 7, 4), // "read" +QT_MOC_LITERAL(2, 12, 0) // "" + + }, + "serial\0read\0" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_serial[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: name, argc, parameters, tag, flags + 1, 0, 19, 2, 0x08 /* Private */, + + // slots: parameters + QMetaType::Void, + + 0 // eod +}; + +void serial::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + serial *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->read(); break; + default: ; + } + } + Q_UNUSED(_a); +} + +const QMetaObject serial::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_serial.data, + qt_meta_data_serial, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} +}; + + +const QMetaObject *serial::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *serial::qt_metacast(const char *_clname) +{ + if (!_clname) return Q_NULLPTR; + if (!strcmp(_clname, qt_meta_stringdata_serial.stringdata0)) + return static_cast(const_cast< serial*>(this)); + return QObject::qt_metacast(_clname); +} + +int serial::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 1) + qt_static_metacall(this, _c, _id, _a); + _id -= 1; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 1) + *reinterpret_cast(_a[0]) = -1; + _id -= 1; + } + return _id; +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE -- cgit v1.2.3