diff options
Diffstat (limited to 'ftnoir_protocol_fg')
-rw-r--r-- | ftnoir_protocol_fg/fgtypes.h | 5 | ||||
-rw-r--r-- | ftnoir_protocol_fg/ftnoir_fgcontrols.ui | 2 | ||||
-rw-r--r-- | ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 20 | ||||
-rw-r--r-- | ftnoir_protocol_fg/ftnoir_protocol_fg.h | 20 | ||||
-rw-r--r-- | ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 14 | ||||
-rw-r--r-- | ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp | 7 | ||||
-rw-r--r-- | ftnoir_protocol_fg/images/flightgear.ico | bin | 0 -> 13094 bytes |
7 files changed, 28 insertions, 40 deletions
diff --git a/ftnoir_protocol_fg/fgtypes.h b/ftnoir_protocol_fg/fgtypes.h index 949dc213..68f85877 100644 --- a/ftnoir_protocol_fg/fgtypes.h +++ b/ftnoir_protocol_fg/fgtypes.h @@ -14,15 +14,14 @@ #ifndef INCLUDED_FGTYPES_H
#define INCLUDED_FGTYPES_H
-#include "Windows.h"
-
//
// x,y,z position in metres, heading, pitch and roll in degrees...
//
-#pragma pack(2)
+#pragma pack(push, 2)
struct TFlightGearData {
double x, y, z, h, p, r;
int status;
};
+#pragma pack(pop)
#endif//INCLUDED_FGTYPES_H
diff --git a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui index 3469e7aa..116f830b 100644 --- a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui +++ b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui @@ -15,7 +15,7 @@ </property>
<property name="windowIcon">
<iconset>
- <normaloff>images/FaceTrackNoIR.ico</normaloff>images/FaceTrackNoIR.ico</iconset>
+ <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 5506f534..0c259d61 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -33,6 +33,7 @@ */
#include "ftnoir_protocol_fg.h"
#include <QFile>
+#include "facetracknoir/global-settings.h"
// For Todd and Arda Kutlu
//#define SEND_ASCII_DATA
@@ -42,7 +43,6 @@ FTNoIR_Protocol::FTNoIR_Protocol()
{
blnConnectionActive = false;
- hMainWindow = NULL;
loadSettings();
}
@@ -103,7 +103,6 @@ void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData int no_bytes;
QHostAddress sender;
quint16 senderPort;
-PDWORD_PTR MsgResult = 0;
#ifdef SEND_ASCII_DATA
char data[100];
@@ -152,7 +151,7 @@ char data[100]; //! [1]
// no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), QHostAddress::LocalHost, 5550);
if (outSocket != 0) {
- no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), destIP, destPort);
+ no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), destIP, destPort);
if ( no_bytes > 0) {
// qDebug() << "FGServer::writePendingDatagrams says: bytes send =" << no_bytes << sizeof( double );
}
@@ -181,9 +180,6 @@ char data[100]; if (!blnConnectionActive) {
blnConnectionActive = true;
- if (hMainWindow != NULL) {
- SendMessageTimeout( (HWND) hMainWindow, RegisterWindowMessageA(FT_PROGRAMID), 0, 0, 0, 2000, MsgResult);
- }
}
}
}
@@ -193,7 +189,7 @@ char data[100]; // Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK()
{
// Init. the data
FlightData.x = 0.0f;
@@ -208,8 +204,6 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) inSocket = 0;
outSocket = 0;
- hMainWindow = handle;
-
//
// Create UDP-sockets.
//
@@ -238,7 +232,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) //
void FTNoIR_Protocol::getNameFromGame( char *dest )
{
- sprintf_s(dest, 99, "FlightGear");
+ sprintf(dest, "FlightGear");
return;
}
@@ -249,9 +243,9 @@ void FTNoIR_Protocol::getNameFromGame( char *dest ) // GetProtocol - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
+//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor()
{
- return new FTNoIR_Protocol;
+ return (IProtocol*) new FTNoIR_Protocol;
}
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 34773540..4ff2846f 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -29,17 +29,17 @@ #ifndef INCLUDED_FGSERVER_H
#define INCLUDED_FGSERVER_H
-#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
-#include "ui_FTNoIR_FGcontrols.h"
-#include "FGTypes.h"
+#include "ftnoir_protocol_base/ftnoir_protocol_base.h"
+#include "ui_ftnoir_fgcontrols.h"
+#include "fgtypes.h"
#include <QThread>
#include <QUdpSocket>
#include <QMessageBox>
#include <QSettings>
-#include "Windows.h"
-#include "math.h"
+#include <math.h>
+#include "facetracknoir/global-settings.h"
-static const char* FT_PROGRAMID = "FT_ProgramID"; // For message to FaceTrackNoIR main-window.
+#define FT_PROGRAMID "FT_ProgramID"
class FTNoIR_Protocol : public IProtocol
{
@@ -50,14 +50,13 @@ public: void Release();
void Initialize();
- bool checkServerInstallationOK( HANDLE handle );
+ bool checkServerInstallationOK();
void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose );
void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
private:
bool blnConnectionActive;
- HANDLE hMainWindow; // Save the handle to FaceTrackNoIR main-window
// Tracker *headTracker; // For upstream messages...
TFlightGearData FlightData;
@@ -81,7 +80,6 @@ public: virtual ~FGControls();
void showEvent ( QShowEvent * event );
- void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
void registerProtocol(IProtocol *protocol) {
theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
@@ -109,7 +107,7 @@ private slots: //*******************************************************************************************************
// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
//*******************************************************************************************************
-class FTNoIR_ProtocolDll : public IProtocolDll
+class FTNoIR_ProtocolDll : public Metadata
{
public:
FTNoIR_ProtocolDll();
@@ -119,7 +117,7 @@ public: void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); };
void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear UDP protocol"); };
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/FlightGear.ico"); };
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/flightgear.png"); };
};
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 0138a4c1..9867ea2f 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -33,6 +33,7 @@ */
#include "ftnoir_protocol_fg.h"
#include <QFile>
+#include "facetracknoir/global-settings.h"
//*******************************************************************************************************
// FaceTrackNoIR Client Settings-dialog.
@@ -74,11 +75,6 @@ FGControls::~FGControls() { qDebug() << "~FGControls() says: started";
}
-void FGControls::Release()
-{
- delete this;
-}
-
//
// Initialize tracker-client-dialog
//
@@ -217,9 +213,9 @@ void FGControls::chkLocalPCOnlyChanged() { // GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+//#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog( )
{
- return new FGControls;
-}
\ No newline at end of file + return (IProtocolDialog*) new FGControls;
+}
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp index ca71063b..45d6271c 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp @@ -32,6 +32,7 @@ */
#include "ftnoir_protocol_fg.h"
#include <QDebug>
+#include "facetracknoir/global-settings.h"
FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
}
@@ -48,9 +49,9 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() // GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
-#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
+//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll()
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
{
- return new FTNoIR_ProtocolDll;
+ return new FTNoIR_ProtocolDll;
}
diff --git a/ftnoir_protocol_fg/images/flightgear.ico b/ftnoir_protocol_fg/images/flightgear.ico Binary files differnew file mode 100644 index 00000000..f96c0f88 --- /dev/null +++ b/ftnoir_protocol_fg/images/flightgear.ico |