From 00d294491c390058eff4ddae83dbfa3aa03f27ee Mon Sep 17 00:00:00 2001 From: Bernhard Trinnes Date: Sun, 24 Sep 2017 21:32:04 +0200 Subject: [PATCH] added TCP Commander --- deviceplugins.pro.user | 2250 -------------------- guh-plugins.pro | 1 + tcpcommander/deviceplugintcpcommander.cpp | 142 ++ tcpcommander/deviceplugintcpcommander.h | 56 + tcpcommander/deviceplugintcpcommander.json | 148 ++ tcpcommander/tcpcommander.pro | 16 + tcpcommander/tcpserver.cpp | 101 + tcpcommander/tcpserver.h | 60 + tcpcommander/translations/de_DE.ts | 94 + tcpcommander/translations/en_US.ts | 94 + 10 files changed, 712 insertions(+), 2250 deletions(-) delete mode 100644 deviceplugins.pro.user create mode 100644 tcpcommander/deviceplugintcpcommander.cpp create mode 100644 tcpcommander/deviceplugintcpcommander.h create mode 100644 tcpcommander/deviceplugintcpcommander.json create mode 100644 tcpcommander/tcpcommander.pro create mode 100644 tcpcommander/tcpserver.cpp create mode 100644 tcpcommander/tcpserver.h create mode 100644 tcpcommander/translations/de_DE.ts create mode 100644 tcpcommander/translations/en_US.ts diff --git a/deviceplugins.pro.user b/deviceplugins.pro.user deleted file mode 100644 index 679ae42a..00000000 --- a/deviceplugins.pro.user +++ /dev/null @@ -1,2250 +0,0 @@ - - - - - - EnvironmentId - {3bef81bf-8da5-4ea2-ab6c-b05b2d7e67ce} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - 5.8-desktop - 5.8-desktop - {f567bb42-1b2c-42b6-a0d7-deee229be36a} - 0 - 0 - 0 - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - usbwde - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/usbwde/usbwde.pro - true - - usbwde/usbwde.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/usbwde - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - lgsmarttv - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/lgsmarttv/lgsmarttv.pro - true - - lgsmarttv/lgsmarttv.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/lgsmarttv - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - pushbullet - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/pushbullet/pushbullet.pro - true - - pushbullet/pushbullet.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/pushbullet - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - kodi - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/kodi/kodi.pro - true - - kodi/kodi.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/kodi - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - philipshue - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/philipshue/philipshue.pro - true - - philipshue/philipshue.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/philipshue - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - awattar - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/awattar/awattar.pro - true - - awattar/awattar.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/awattar - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - udpcommander - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/udpcommander/udpcommander.pro - true - - udpcommander/udpcommander.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/udpcommander - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - orderbutton - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/orderbutton/orderbutton.pro - true - - orderbutton/orderbutton.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/orderbutton - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - denon - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/denon/denon.pro - true - - denon/denon.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/denon - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - osdomotics - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/osdomotics/osdomotics.pro - true - - osdomotics/osdomotics.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/osdomotics - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - plantcare - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/plantcare/plantcare.pro - true - - plantcare/plantcare.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/plantcare - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - genericelements - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/genericelements/genericelements.pro - true - - genericelements/genericelements.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/genericelements - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - wakeonlan - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/wakeonlan/wakeonlan.pro - true - - wakeonlan/wakeonlan.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/wakeonlan - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - mailnotification - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/mailnotification/mailnotification.pro - true - - mailnotification/mailnotification.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/mailnotification - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - datetime - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/datetime/datetime.pro - true - - datetime/datetime.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/datetime - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - elro - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/elro/elro.pro - true - - elro/elro.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/elro - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - multisensor - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/multisensor/multisensor.pro - true - - multisensor/multisensor.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/multisensor - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - leynew - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/leynew/leynew.pro - true - - leynew/leynew.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/leynew - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - senic - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/senic/senic.pro - true - - senic/senic.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/senic - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - networkdetector - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/networkdetector/networkdetector.pro - true - - networkdetector/networkdetector.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/networkdetector - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - unitec - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/unitec/unitec.pro - true - - unitec/unitec.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/unitec - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - conrad - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/conrad/conrad.pro - true - - conrad/conrad.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/conrad - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - dollhouse - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/dollhouse/dollhouse.pro - true - - dollhouse/dollhouse.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/dollhouse - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - lircd - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/lircd/lircd.pro - true - - lircd/lircd.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/lircd - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - wemo - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/wemo/wemo.pro - true - - wemo/wemo.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/wemo - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - eq-3 - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/eq-3/eq-3.pro - true - - eq-3/eq-3.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/eq-3 - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - ws2812 - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/ws2812/ws2812.pro - true - - ws2812/ws2812.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/ws2812 - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - openweathermap - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/openweathermap/openweathermap.pro - true - - openweathermap/openweathermap.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/openweathermap - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - intertechno - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/intertechno/intertechno.pro - true - - intertechno/intertechno.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/intertechno - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - gpio - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/gpio/gpio.pro - true - - gpio/gpio.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/gpio - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - netatmo - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/netatmo/netatmo.pro - true - - netatmo/netatmo.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/netatmo - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - commandlauncher - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/commandlauncher/commandlauncher.pro - true - - commandlauncher/commandlauncher.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/commandlauncher - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - elgato - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/elgato/elgato.pro - true - - elgato/elgato.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/elgato - 3768 - false - true - false - false - true - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - avahimonitor - - Qt4ProjectManager.Qt4RunConfiguration:/home/micha/Develop/guh-plugins/avahimonitor/avahimonitor.pro - true - - avahimonitor/avahimonitor.pro - false - - /home/micha/Develop/build-deviceplugins-5_8_desktop-Debug/avahimonitor - 3768 - false - true - false - false - true - - 34 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/guh-plugins.pro b/guh-plugins.pro index 1a52c95d..6f147a8c 100644 --- a/guh-plugins.pro +++ b/guh-plugins.pro @@ -19,6 +19,7 @@ PLUGIN_DIRS = \ unitec \ leynew \ udpcommander \ + tcpcommander \ kodi \ elgato \ awattar \ diff --git a/tcpcommander/deviceplugintcpcommander.cpp b/tcpcommander/deviceplugintcpcommander.cpp new file mode 100644 index 00000000..e7684d2a --- /dev/null +++ b/tcpcommander/deviceplugintcpcommander.cpp @@ -0,0 +1,142 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "deviceplugintcpcommander.h" +#include "plugininfo.h" + + +DevicePluginTcpCommander::DevicePluginTcpCommander() +{ +} + +DeviceManager::HardwareResources DevicePluginTcpCommander::requiredHardware() const +{ + return DeviceManager::HardwareResourceNone; +} + + +DeviceManager::DeviceSetupStatus DevicePluginTcpCommander::setupDevice(Device *device) +{ + if (device->deviceClassId() == tcpOutputDeviceClassId) { + QTcpSocket *tcpSocket = new QTcpSocket(this); + m_tcpSockets.insert(tcpSocket, device); + return DeviceManager::DeviceSetupStatusSuccess; + } + + if (device->deviceClassId() == tcpInputDeviceClassId) { + int port = device->paramValue(portParamTypeId).toInt(); + TcpServer *tcpServer = new TcpServer(port, this); + //TODO Connect TCP Server request received + if (tcpServer->isValid()) { + m_tcpServer.insert(tcpServer, device); + connect(tcpServer, &TcpServer::connected, this, &DevicePluginTcpCommander::onTcpServerConnected); + connect(tcpServer, &TcpServer::disconnected, this, &DevicePluginTcpCommander::onTcpServerDisconnected); + return DeviceManager::DeviceSetupStatusSuccess; + } else { + qDebug(dcTCPCommander()) << "Could not open TCP Server"; + } + } + return DeviceManager::DeviceSetupStatusFailure; +} + + +DeviceManager::DeviceError DevicePluginTcpCommander::executeAction(Device *device, const Action &action) +{ + if (device->deviceClassId() == tcpOutputDeviceClassId) { + + if (action.actionTypeId() == outputDataActionTypeId) { + int port = device->paramValue(portParamTypeId).toInt(); + QHostAddress address= QHostAddress(device->paramValue(ipv4addressParamTypeId).toString()); + QTcpSocket *tcpSocket = m_tcpSockets.key(device); + QByteArray data = device->paramValue(outputDataAreaParamTypeId).toByteArray(); + tcpSocket->connectToHost(address, port); + tcpSocket->write(data); + tcpSocket->close(); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + return DeviceManager::DeviceErrorDeviceClassNotFound; +} + + +void DevicePluginTcpCommander::deviceRemoved(Device *device) +{ + if(device->deviceClassId() == tcpOutputDeviceClassId){ + m_tcpSockets.remove(m_tcpSockets.key(device)); + }else if(device->deviceClassId() == tcpInputDeviceClassId){ + TcpServer *tcpServer = m_tcpServer.key(device); + m_tcpServer.remove(tcpServer); + tcpServer->deleteLater(); + } +} + + +void DevicePluginTcpCommander::onTcpServerConnected() +{ + TcpServer *tcpServer = static_cast(sender()); + Device *device = m_tcpServer.value(tcpServer); + qDebug(dcTCPCommander()) << device->name() << "Tcp Server Client connected" ; + device->setStateValue(connectedStateTypeId, true); + connect(tcpServer, &TcpServer::textMessageReceived, this, &DevicePluginTcpCommander::onTcpServerTextMessageReceived); + //send signal device Setup was successfull +} + + +void DevicePluginTcpCommander::onTcpServerDisconnected() +{ + TcpServer *tcpServer = static_cast(sender()); + Device *device = m_tcpServer.value(tcpServer); + qDebug(dcTCPCommander()) << device->name() << "Tcp Server Client disconnected" ; + device->setStateValue(connectedStateTypeId, false); +} + +void DevicePluginTcpCommander::onTcpServerTextMessageReceived(QByteArray data) +{ + TcpServer *tcpServer = static_cast(sender()); + Device *device = m_tcpServer.value(tcpServer); + qDebug(dcTCPCommander()) << device->name() << "Message received" << data; + device->setStateValue(responseStateTypeId, data); //TODO change wording + + if (device->paramValue(comparisionParamTypeId).toString() == "Is exactly") { + qDebug(dcTCPCommander()) << "is exacly"; + if (data == device->paramValue(inputDataParamTypeId)) { + qDebug(dcTCPCommander()) << "comparison successful"; + emitEvent(Event(commandReceivedEventTypeId, device->id())); + } + + } else if (device->paramValue(comparisionParamTypeId).toString() == "Contains") { + if (data.contains(device->paramValue(inputDataParamTypeId).toByteArray())) { + emitEvent(Event(commandReceivedEventTypeId, device->id())); + } + + } else if (device->paramValue(comparisionParamTypeId) == "Contains not") { + if (!data.contains(device->paramValue(inputDataParamTypeId).toByteArray())) + emitEvent(Event(commandReceivedEventTypeId, device->id())); + + } else if (device->paramValue(comparisionParamTypeId) == "Starts with") { + if (data.startsWith(device->paramValue(inputDataParamTypeId).toByteArray())) + emitEvent(Event(commandReceivedEventTypeId, device->id())); + + } else if (device->paramValue(comparisionParamTypeId) == "Ends with") { + if (data.endsWith(device->paramValue(inputDataParamTypeId).toByteArray())) + emitEvent(Event(commandReceivedEventTypeId, device->id())); + } +} diff --git a/tcpcommander/deviceplugintcpcommander.h b/tcpcommander/deviceplugintcpcommander.h new file mode 100644 index 00000000..88da8fc4 --- /dev/null +++ b/tcpcommander/deviceplugintcpcommander.h @@ -0,0 +1,56 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef DEVICEPLUGINDEVTCPCOMMANDER_H +#define DEVICEPLUGINDEVTCPCOMMANDER_H + +#include "plugin/deviceplugin.h" +#include "devicemanager.h" +#include "tcpserver.h" + +class DevicePluginTcpCommander : public DevicePlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "deviceplugintcpcommander.json") + Q_INTERFACES(DevicePlugin) + +public: + explicit DevicePluginTcpCommander(); + + DeviceManager::HardwareResources requiredHardware() const override; + DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; + + void deviceRemoved(Device *device) override; + + DeviceManager::DeviceError executeAction(Device *device, const Action &action) override; + +private: + QHash m_tcpSockets; + QHash m_tcpServer; + +private slots: + void onTcpServerConnected(); + void onTcpServerDisconnected(); + void onTcpServerTextMessageReceived(QByteArray message); + +}; + +#endif // DEVICEPLUGINTCPCOMMANDER_H diff --git a/tcpcommander/deviceplugintcpcommander.json b/tcpcommander/deviceplugintcpcommander.json new file mode 100644 index 00000000..44cbab22 --- /dev/null +++ b/tcpcommander/deviceplugintcpcommander.json @@ -0,0 +1,148 @@ +{ + "name": "tcp commander", + "idName": "TCPCommander", + "id": "741b7b0a-0c9c-4c93-be99-0d0bcf5a4643", + "vendors": [ + { + "name": "TCP Commander", + "idName": "tcpCommander", + "id": "9181278e-7812-4a3e-a9ce-f00f3f8b8afd", + "deviceClasses": [ + { + "id": "c67d059f-694f-47cb-8e1d-9e3e6d014c1a", + "idName": "tcpOutput", + "name": "TCP Output", + "deviceIcon": "Network", + "createMethods": ["user"], + "basicTags": [ + "Service" + ], + "criticalStateTypeId": "725b541a-9e0c-4634-81eb-e415c0b8f025", + "primaryStateTypeId": "725b541a-9e0c-4634-81eb-e415c0b8f025", + "paramTypes": [ + { + "id": "2a3fcb23-931b-4ba1-b134-c49b656c76f7", + "idName": "ipv4address", + "name": "IPv4 Address", + "type": "QString", + "inputType": "IPv4Address", + "defaultValue": "127.0.0.1", + "index" : 0 + }, + { + "id": "bee8b151-815a-4159-9d8a-42b76e99b42c", + "idName": "port", + "name": "Port", + "type": "int", + "defaultValue": "22", + "index" : 1 + } + ], + "stateTypes":[ + { + "id": "725b541a-9e0c-4634-81eb-e415c0b8f025", + "idName": "connected", + "name": "connected", + "type": "bool", + "defaultValue": false, + "eventTypeName": "connection status changed", + "index" : 0 + } + ], + "actionTypes": [ + { + "id": "6bc52462-b192-46a4-a6df-92cc5a479c89", + "idName": "outputData", + "name": "Send Data", + "index": 0, + "paramTypes": [ + { + "id": "6604c852-6b24-4707-b8e5-1ddd8032efcc", + "idName": "outputDataArea", + "name": "Data", + "type": "QString", + "index": 0, + "inputType": "TextArea" + } + ] + } + ] + }, + { + "id": "bc40e84a-69c4-4fd2-beb0-bd65f19aa8ff", + "idName": "tcpInput", + "name": "TCP Input", + "deviceIcon": "Network", + "createMethods": ["user"], + "basicTags": [ + "Service" + ], + "primaryStateTypeId": "725b541a-9e0c-4634-81eb-e415c0b8f025", + "paramTypes": [ + { + "id": "bee8b151-815a-4159-9d8a-42b76e99b42c", + "idName": "port", + "name": "Port", + "type": "int", + "defaultValue": "22", + "index" : 0 + }, + { + "id": "d99f55c7-0e14-45ee-b0f0-33f2d1d2e674", + "idName": "comparision", + "name": "Data Comparison", + "type": "QString", + "allowedValues": [ + "Is exactly", + "Contains", + "Contains not", + "Starts with", + "Ends with" + ], + "defaultValue": "Exactly", + "index" : 1 + }, + { + "id": "23051bdf-3f50-41fa-abde-bc4fe0bcc4fc", + "idName": "inputData", + "name": "Data", + "type": "QString", + "inputType": "TextArea", + "defaultValue": "", + "index" : 2 + } + ], + "stateTypes": [ + { + "id": "725b541a-9e0c-4634-81eb-e415c0b8f025", + "idName": "connected", + "name": "connected", + "type": "bool", + "defaultValue": false, + "eventTypeName": "connection status changed", + "index" : 0 + }, + { + "id": "b98fdacc-59d7-41c4-b790-1fdca50dfb22", + "idName": "response", + "name": "Response", + "type": "QString", + "inputType": "TextArea", + "defaultValue": "", + "eventTypeName": "response received", + "index" : 1 + } + ], + "eventTypes": [ + { + "id": "6d7c6df6-cb61-4d9e-b0d7-37c43911ca4b", + "idName": "commandReceived", + "name": "Command Received", + "index": 0 + } + ] + } + ] + } + ] +} diff --git a/tcpcommander/tcpcommander.pro b/tcpcommander/tcpcommander.pro new file mode 100644 index 00000000..6fb6ac66 --- /dev/null +++ b/tcpcommander/tcpcommander.pro @@ -0,0 +1,16 @@ +TRANSLATIONS = translations/en_US.ts \ + translations/de_DE.ts + +# Note: include after the TRANSLATIONS definition +include(../plugins.pri) + +TARGET = $$qtLibraryTarget(guh_deviceplugintcpcommander) + +SOURCES += \ + deviceplugintcpcommander.cpp \ + tcpserver.cpp \ + +HEADERS += \ + deviceplugintcpcommander.h \ + tcpserver.h \ + diff --git a/tcpcommander/tcpserver.cpp b/tcpcommander/tcpserver.cpp new file mode 100644 index 00000000..0004ba50 --- /dev/null +++ b/tcpcommander/tcpserver.cpp @@ -0,0 +1,101 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "tcpserver.h" +#include "extern-plugininfo.h" +#include + + +TcpServer::TcpServer(const QHostAddress address, const int &port, QObject *parent) : + QObject(parent) +{ + m_tcpServer = new QTcpServer(this); + connect(m_tcpServer, &QTcpServer::newConnection, this, &TcpServer::newConnection); + qDebug(dcTCPCommander()) << "TCP Server on Port: " << port << "Address: " << address.toString(); + if (!m_tcpServer->listen(address, port)) { + qDebug(dcTCPCommander()) << "Unable to start the server: " << m_tcpServer->errorString(); + return; + } +} + + +TcpServer::TcpServer(const int &port, QObject *parent) : + QObject(parent) +{ + + m_tcpServer = new QTcpServer(this); + connect(m_tcpServer, &QTcpServer::newConnection, this, &TcpServer::newConnection); + qDebug(dcTCPCommander()) << "TCP Server on Port: " << port; + if (!m_tcpServer->listen(QHostAddress::Any, port)) { + qDebug(dcTCPCommander()) << "Unable to start the server: " << m_tcpServer->errorString(); + return; + } +} + +TcpServer::~TcpServer() +{ +} + +bool TcpServer::isValid() +{ + return m_tcpServer->isListening(); +} + +QHostAddress TcpServer::serverAddress() +{ + return m_tcpServer->serverAddress(); +} + +int TcpServer::serverPort() +{ + return m_tcpServer->serverPort(); +} + +void TcpServer::newConnection() +{ + qDebug(dcTCPCommander()) << "TCP Server new Connection request"; + m_socket = m_tcpServer->nextPendingConnection(); + m_socket->write("Hello client"); + m_socket->flush(); + + emit connected(); + connect(m_socket, &QTcpSocket::disconnected, this, &TcpServer::onDisconnected); + connect(m_socket, &QTcpSocket::readyRead, this, &TcpServer::readData); + // Note: error signal will be interpreted as function, not as signal in C++11 + //connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); +} + + +void TcpServer::onDisconnected() +{ + qDebug(dcTCPCommander()) << "TCP Server connection aborted"; + disconnect(m_socket, &QTcpSocket::disconnected, this, &TcpServer::onDisconnected); + disconnect(m_socket, &QTcpSocket::readyRead, this, &TcpServer::readData); + m_socket->deleteLater(); + emit disconnected(); +} + +void TcpServer::readData() +{ + QByteArray data = m_socket->readAll(); + qDebug(dcTCPCommander()) << "TCP Server data received: " << data; + emit textMessageReceived(data); + +} diff --git a/tcpcommander/tcpserver.h b/tcpcommander/tcpserver.h new file mode 100644 index 00000000..e5fc78b8 --- /dev/null +++ b/tcpcommander/tcpserver.h @@ -0,0 +1,60 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef TCPSERVER_H +#define TCPSERVER_H + +#include +#include +#include + +class TcpServer : public QObject +{ + Q_OBJECT +public: + explicit TcpServer(const QHostAddress address, const int &port, QObject *parent); + explicit TcpServer(const int &port, QObject *parent = 0); + ~TcpServer(); + + bool isValid(); + QHostAddress serverAddress(); + int serverPort(); + + void setPort(int port); + void setServerAddress(const QHostAddress &address); + + +private: + QTcpServer *m_tcpServer; + QTcpSocket *m_socket; + +signals: + void newPendingConnection(); + void textMessageReceived(QByteArray message); + void connected(); + void disconnected(); + +public slots: + void newConnection(); + void onDisconnected(); + void readData(); +}; + +#endif // TCPSERVER_H diff --git a/tcpcommander/translations/de_DE.ts b/tcpcommander/translations/de_DE.ts new file mode 100644 index 00000000..738c664a --- /dev/null +++ b/tcpcommander/translations/de_DE.ts @@ -0,0 +1,94 @@ + + + + + TCPCommander + + + tcp commander + The name of the plugin tcp commander (741b7b0a-0c9c-4c93-be99-0d0bcf5a4643) + + + + + TCP Commander + The name of the vendor (9181278e-7812-4a3e-a9ce-f00f3f8b8afd) + + + + + TCP Output + The name of the DeviceClass (c67d059f-694f-47cb-8e1d-9e3e6d014c1a) + + + + + IPv4 Address + The name of the paramType (2a3fcb23-931b-4ba1-b134-c49b656c76f7) of TCP Output + + + + + Port + The name of the paramType (bee8b151-815a-4159-9d8a-42b76e99b42c) of TCP Output + + + + + connection status changed + The name of the autocreated EventType (725b541a-9e0c-4634-81eb-e415c0b8f025) + + + + + connected + The name of the ParamType of StateType (725b541a-9e0c-4634-81eb-e415c0b8f025) of DeviceClass TCP Output + + + + + Send Data + The name of the ActionType 6bc52462-b192-46a4-a6df-92cc5a479c89 of deviceClass TCP Output + + + + + + Data + The name of the paramType (6604c852-6b24-4707-b8e5-1ddd8032efcc) of TCP Output +---------- +The name of the paramType (23051bdf-3f50-41fa-abde-bc4fe0bcc4fc) of TCP Input + + + + + TCP Input + The name of the DeviceClass (bc40e84a-69c4-4fd2-beb0-bd65f19aa8ff) + + + + + Data Comparison + The name of the paramType (d99f55c7-0e14-45ee-b0f0-33f2d1d2e674) of TCP Input + + + + + response received + The name of the autocreated EventType (b98fdacc-59d7-41c4-b790-1fdca50dfb22) + + + + + Response + The name of the ParamType of StateType (b98fdacc-59d7-41c4-b790-1fdca50dfb22) of DeviceClass TCP Input + + + + + Command Received + The name of the EventType 6d7c6df6-cb61-4d9e-b0d7-37c43911ca4b of deviceClass TCP Input + + + + diff --git a/tcpcommander/translations/en_US.ts b/tcpcommander/translations/en_US.ts new file mode 100644 index 00000000..66df86b8 --- /dev/null +++ b/tcpcommander/translations/en_US.ts @@ -0,0 +1,94 @@ + + + + + TCPCommander + + + tcp commander + The name of the plugin tcp commander (741b7b0a-0c9c-4c93-be99-0d0bcf5a4643) + + + + + TCP Commander + The name of the vendor (9181278e-7812-4a3e-a9ce-f00f3f8b8afd) + + + + + TCP Output + The name of the DeviceClass (c67d059f-694f-47cb-8e1d-9e3e6d014c1a) + + + + + IPv4 Address + The name of the paramType (2a3fcb23-931b-4ba1-b134-c49b656c76f7) of TCP Output + + + + + Port + The name of the paramType (bee8b151-815a-4159-9d8a-42b76e99b42c) of TCP Output + + + + + connection status changed + The name of the autocreated EventType (725b541a-9e0c-4634-81eb-e415c0b8f025) + + + + + connected + The name of the ParamType of StateType (725b541a-9e0c-4634-81eb-e415c0b8f025) of DeviceClass TCP Output + + + + + Send Data + The name of the ActionType 6bc52462-b192-46a4-a6df-92cc5a479c89 of deviceClass TCP Output + + + + + + Data + The name of the paramType (6604c852-6b24-4707-b8e5-1ddd8032efcc) of TCP Output +---------- +The name of the paramType (23051bdf-3f50-41fa-abde-bc4fe0bcc4fc) of TCP Input + + + + + TCP Input + The name of the DeviceClass (bc40e84a-69c4-4fd2-beb0-bd65f19aa8ff) + + + + + Data Comparison + The name of the paramType (d99f55c7-0e14-45ee-b0f0-33f2d1d2e674) of TCP Input + + + + + response received + The name of the autocreated EventType (b98fdacc-59d7-41c4-b790-1fdca50dfb22) + + + + + Response + The name of the ParamType of StateType (b98fdacc-59d7-41c4-b790-1fdca50dfb22) of DeviceClass TCP Input + + + + + Command Received + The name of the EventType 6d7c6df6-cb61-4d9e-b0d7-37c43911ca4b of deviceClass TCP Input + + + +