diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2011-04-04 19:58:09 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2011-04-04 19:58:09 +0000 |
commit | d3456cb84b428b2f5070517d6e571f6b2724dd24 (patch) | |
tree | b4885f52965952f8a4a529bce3edadc6dc425867 /FTNoIR_Protocol_FG | |
parent | 28c091a886e6c98f41d3f5f8b153768b4a589fcd (diff) |
Move protocols to DLL: TrackIR
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@61 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Protocol_FG')
-rw-r--r-- | FTNoIR_Protocol_FG/FGTypes.h | 28 | ||||
-rw-r--r-- | FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp | 32 | ||||
-rw-r--r-- | FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h | 6 | ||||
-rw-r--r-- | FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj | 4 |
4 files changed, 64 insertions, 6 deletions
diff --git a/FTNoIR_Protocol_FG/FGTypes.h b/FTNoIR_Protocol_FG/FGTypes.h new file mode 100644 index 00000000..949dc213 --- /dev/null +++ b/FTNoIR_Protocol_FG/FGTypes.h @@ -0,0 +1,28 @@ +/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
+* *
+* Type definitions for the FlightGear server. *
+********************************************************************************/
+#pragma once
+#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)
+struct TFlightGearData {
+ double x, y, z, h, p, r;
+ int status;
+};
+
+#endif//INCLUDED_FGTYPES_H
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index cb03c70e..95c83958 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -33,6 +33,9 @@ */
#include "ftnoir_protocol_fg.h"
+// For Todd
+//#define SEND_ASCII_DATA
+
/** constructor **/
FTNoIR_Protocol_FG::FTNoIR_Protocol_FG()
{
@@ -97,6 +100,10 @@ int no_bytes; QHostAddress sender;
quint16 senderPort;
+#ifdef SEND_ASCII_DATA
+char data[100];
+#endif
+
//
// Copy the Raw measurements directly to the client.
//
@@ -112,6 +119,22 @@ quint16 senderPort; // Try to send an UDP-message to the FlightGear
//
+#ifdef SEND_ASCII_DATA
+ sprintf_s(data, "%.4f;%.4f;%.4f;%.2f;%.2f;%.2f\n\0", FlightData.x, FlightData.y, FlightData.z, FlightData.p, FlightData.h, FlightData.r);
+
+ if (outSocket != 0) {
+ no_bytes = outSocket->writeDatagram((const char *) &data, strlen( data ), destIP, destPort);
+ if ( no_bytes > 0) {
+ qDebug() << "FGServer::writePendingDatagrams says: bytes send =" << data;
+ }
+ else {
+ qDebug() << "FGServer::writePendingDatagrams says: nothing sent!";
+ }
+ }
+
+#endif
+
+ #ifndef SEND_ASCII_DATA
//! [1]
// no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), QHostAddress::LocalHost, 5550);
if (outSocket != 0) {
@@ -123,6 +146,7 @@ quint16 senderPort; qDebug() << "FGServer::writePendingDatagrams says: nothing sent!";
}
}
+ #endif
//
// FlightGear keeps sending data, so we must read that here.
@@ -208,13 +232,15 @@ FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol() //
// Constructor for server-settings-dialog
//
-FGControls::FGControls( QWidget *parent, Qt::WindowFlags f ) :
-QWidget( parent , f)
+FGControls::FGControls() :
+QWidget()
{
ui.setupUi( this );
QPoint offsetpos(100, 100);
- this->move(parent->pos() + offsetpos);
+ //if (parent) {
+ // this->move(parent->pos() + offsetpos);
+ //}
// Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h index 220dc60d..45188257 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h @@ -1,5 +1,5 @@ /********************************************************************************
-* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* FaceTrackNoIR This program is a private project of some enthusiastic *
* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
@@ -31,7 +31,7 @@ #include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
#include "ui_FTNoIR_FGcontrols.h"
-#include "..\facetracknoir\FGTypes.h"
+#include "FGTypes.h"
#include <QThread>
#include <QUdpSocket>
#include <QMessageBox>
@@ -70,7 +70,7 @@ class FGControls: public QWidget, Ui::UICFGControls, public IProtocolDialog Q_OBJECT
public:
- explicit FGControls( QWidget *parent=0, Qt::WindowFlags f=0 );
+ explicit FGControls();
virtual ~FGControls();
void showEvent ( QShowEvent * event );
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj index eae8510a..2a84fa7a 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj @@ -178,6 +178,10 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath=".\FGTypes.h"
+ >
+ </File>
+ <File
RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base.h"
>
</File>
|