summaryrefslogtreecommitdiffhomepage
path: root/proto-udp
diff options
context:
space:
mode:
Diffstat (limited to 'proto-udp')
-rw-r--r--proto-udp/CMakeLists.txt1
-rw-r--r--proto-udp/ftnoir_ftncontrols.ui266
-rw-r--r--proto-udp/ftnoir_protocol_ftn.cpp34
-rw-r--r--proto-udp/ftnoir_protocol_ftn.h69
-rw-r--r--proto-udp/ftnoir_protocol_ftn_dialog.cpp42
-rw-r--r--proto-udp/lang/nl_NL.ts58
-rw-r--r--proto-udp/lang/ru_RU.ts58
-rw-r--r--proto-udp/lang/stub.ts58
8 files changed, 586 insertions, 0 deletions
diff --git a/proto-udp/CMakeLists.txt b/proto-udp/CMakeLists.txt
new file mode 100644
index 00000000..abba4f52
--- /dev/null
+++ b/proto-udp/CMakeLists.txt
@@ -0,0 +1 @@
+otr_module(proto-udp)
diff --git a/proto-udp/ftnoir_ftncontrols.ui b/proto-udp/ftnoir_ftncontrols.ui
new file mode 100644
index 00000000..28f8ccdf
--- /dev/null
+++ b/proto-udp/ftnoir_ftncontrols.ui
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UICFTNControls</class>
+ <widget class="QWidget" name="UICFTNControls">
+ <property name="windowModality">
+ <enum>Qt::NonModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>411</width>
+ <height>169</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>UDP protocol settings</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="../gui/main-facetracknoir.qrc">
+ <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="_vertical_layout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="4">
+ <widget class="QSpinBox" name="spinIPFourthNibble">
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="spinIPFirstNibble">
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="spinIPSecondNibble">
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QSpinBox" name="spinIPThirdNibble">
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>IP-address remote PC</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Port-number</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="spinPortNumber">
+ <property name="minimum">
+ <number>1000</number>
+ </property>
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Enter IP-address and port-number for the remote PC.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Remember: you may have to change firewall-settings too!</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QPushButton" name="btnOK">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnCancel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>spinIPFirstNibble</tabstop>
+ <tabstop>spinIPSecondNibble</tabstop>
+ <tabstop>spinIPThirdNibble</tabstop>
+ <tabstop>spinIPFourthNibble</tabstop>
+ <tabstop>spinPortNumber</tabstop>
+ <tabstop>btnOK</tabstop>
+ <tabstop>btnCancel</tabstop>
+ </tabstops>
+ <resources>
+ <include location="../gui/main-facetracknoir.qrc"/>
+ </resources>
+ <connections/>
+ <slots>
+ <slot>startEngineClicked()</slot>
+ <slot>stopEngineClicked()</slot>
+ <slot>cameraSettingsClicked()</slot>
+ </slots>
+</ui>
diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp
new file mode 100644
index 00000000..b659e3b5
--- /dev/null
+++ b/proto-udp/ftnoir_protocol_ftn.cpp
@@ -0,0 +1,34 @@
+/* Homepage http://facetracknoir.sourceforge.net/home/default.htm *
+ * *
+ * ISC License (ISC) *
+ * *
+ * Copyright (c) 2015, Wim Vriend *
+ * *
+ * Permission to use, copy, modify, and/or distribute this software for any *
+ * purpose with or without fee is hereby granted, provided that the above *
+ * copyright notice and this permission notice appear in all copies. *
+ */
+#include "ftnoir_protocol_ftn.h"
+#include <QFile>
+#include "api/plugin-api.hpp"
+
+udp::udp()
+{
+}
+
+void udp::pose(const double *headpose) {
+ int destPort = s.port;
+ QHostAddress destIP(QString("%1.%2.%3.%4").arg(
+ QString::number(static_cast<int>(s.ip1)),
+ QString::number(static_cast<int>(s.ip2)),
+ QString::number(static_cast<int>(s.ip3)),
+ QString::number(static_cast<int>(s.ip4))));
+ outSocket.writeDatagram((const char *) headpose, sizeof( double[6] ), destIP, destPort);
+}
+
+bool udp::correct()
+{
+ return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
+}
+
+OPENTRACK_DECLARE_PROTOCOL(udp, FTNControls, udpDll)
diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h
new file mode 100644
index 00000000..383b4ed7
--- /dev/null
+++ b/proto-udp/ftnoir_protocol_ftn.h
@@ -0,0 +1,69 @@
+/* Homepage http://facetracknoir.sourceforge.net/home/default.htm *
+ * *
+ * ISC License (ISC) *
+ * *
+ * Copyright (c) 2015, Wim Vriend *
+ * *
+ * Permission to use, copy, modify, and/or distribute this software for any *
+ * purpose with or without fee is hereby granted, provided that the above *
+ * copyright notice and this permission notice appear in all copies. *
+ */
+#pragma once
+
+#include "ui_ftnoir_ftncontrols.h"
+#include <QThread>
+#include <QUdpSocket>
+#include <QMessageBox>
+#include <cmath>
+#include "api/plugin-api.hpp"
+#include "options/options.hpp"
+using namespace options;
+
+struct settings : opts {
+ value<int> ip1, ip2, ip3, ip4, port;
+ settings() :
+ opts("udp-proto"),
+ ip1(b, "ip1", 192),
+ ip2(b, "ip2", 168),
+ ip3(b, "ip3", 0),
+ ip4(b, "ip4", 2),
+ port(b, "port", 4242)
+ {}
+};
+
+class udp : public IProtocol
+{
+public:
+ udp();
+ bool correct();
+ void pose(const double *headpose);
+ QString game_name() {
+ return QCoreApplication::translate("udp", "UDP Tracker");
+ }
+private:
+ QUdpSocket outSocket;
+ settings s;
+};
+
+// Widget that has controls for FTNoIR protocol client-settings.
+class FTNControls: public IProtocolDialog
+{
+ Q_OBJECT
+public:
+ FTNControls();
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
+private:
+ Ui::UICFTNControls ui;
+ settings s;
+private slots:
+ void doOK();
+ void doCancel();
+};
+
+class udpDll : public Metadata
+{
+public:
+ QString name() { return QString(QCoreApplication::translate("udpDll", "UDP receiver")); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
+};
diff --git a/proto-udp/ftnoir_protocol_ftn_dialog.cpp b/proto-udp/ftnoir_protocol_ftn_dialog.cpp
new file mode 100644
index 00000000..70416a69
--- /dev/null
+++ b/proto-udp/ftnoir_protocol_ftn_dialog.cpp
@@ -0,0 +1,42 @@
+/* Homepage http://facetracknoir.sourceforge.net/home/default.htm *
+ * *
+ * ISC License (ISC) *
+ * *
+ * Copyright (c) 2015, Wim Vriend *
+ * *
+ * Permission to use, copy, modify, and/or distribute this software for any *
+ * purpose with or without fee is hereby granted, provided that the above *
+ * copyright notice and this permission notice appear in all copies. *
+ */
+#include "ftnoir_protocol_ftn.h"
+#include "api/plugin-api.hpp"
+
+FTNControls::FTNControls()
+{
+ ui.setupUi( this );
+
+ tie_setting(s.ip1, ui.spinIPFirstNibble);
+ tie_setting(s.ip2, ui.spinIPSecondNibble);
+ tie_setting(s.ip3, ui.spinIPThirdNibble);
+ tie_setting(s.ip4, ui.spinIPFourthNibble);
+ tie_setting(s.port, ui.spinPortNumber);
+
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+}
+
+//
+// OK clicked on server-dialog
+//
+void FTNControls::doOK() {
+ s.b->save();
+ close();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FTNControls::doCancel()
+{
+ close();
+}
diff --git a/proto-udp/lang/nl_NL.ts b/proto-udp/lang/nl_NL.ts
new file mode 100644
index 00000000..989194c5
--- /dev/null
+++ b/proto-udp/lang/nl_NL.ts
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="nl_NL">
+<context>
+ <name>UICFTNControls</name>
+ <message>
+ <location filename="../ftnoir_ftncontrols.ui" line="+17"/>
+ <source>UDP protocol settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+82"/>
+ <source>IP-address remote PC</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>Port-number</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+34"/>
+ <source>Enter IP-address and port-number for the remote PC.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>Remember: you may have to change firewall-settings too!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+47"/>
+ <source>OK</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+25"/>
+ <source>Cancel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udp</name>
+ <message>
+ <location filename="../ftnoir_protocol_ftn.h" line="+41"/>
+ <source>UDP Tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udpDll</name>
+ <message>
+ <location line="+26"/>
+ <source>UDP receiver</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/proto-udp/lang/ru_RU.ts b/proto-udp/lang/ru_RU.ts
new file mode 100644
index 00000000..c489ebf5
--- /dev/null
+++ b/proto-udp/lang/ru_RU.ts
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="ru_RU">
+<context>
+ <name>UICFTNControls</name>
+ <message>
+ <location filename="../ftnoir_ftncontrols.ui" line="+17"/>
+ <source>UDP protocol settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+82"/>
+ <source>IP-address remote PC</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>Port-number</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+34"/>
+ <source>Enter IP-address and port-number for the remote PC.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>Remember: you may have to change firewall-settings too!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+47"/>
+ <source>OK</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+25"/>
+ <source>Cancel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udp</name>
+ <message>
+ <location filename="../ftnoir_protocol_ftn.h" line="+41"/>
+ <source>UDP Tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udpDll</name>
+ <message>
+ <location line="+26"/>
+ <source>UDP receiver</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/proto-udp/lang/stub.ts b/proto-udp/lang/stub.ts
new file mode 100644
index 00000000..9ef5380e
--- /dev/null
+++ b/proto-udp/lang/stub.ts
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>UICFTNControls</name>
+ <message>
+ <location filename="../ftnoir_ftncontrols.ui" line="+17"/>
+ <source>UDP protocol settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+82"/>
+ <source>IP-address remote PC</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>Port-number</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+34"/>
+ <source>Enter IP-address and port-number for the remote PC.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>Remember: you may have to change firewall-settings too!</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+47"/>
+ <source>OK</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+25"/>
+ <source>Cancel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udp</name>
+ <message>
+ <location filename="../ftnoir_protocol_ftn.h" line="+41"/>
+ <source>UDP Tracker</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>udpDll</name>
+ <message>
+ <location line="+26"/>
+ <source>UDP receiver</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>