From d18f6dfa5f203f4744eb6b4929870f047c80033b Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Sun, 27 Jan 2013 12:07:19 +0000 Subject: Added message to main-window, to display connected-game-name git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@239 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp | 12 ++++++++++++ FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index d5ba964d..5506f534 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -41,6 +41,8 @@ /** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() { + blnConnectionActive = false; + hMainWindow = NULL; loadSettings(); } @@ -101,6 +103,7 @@ 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]; @@ -175,6 +178,13 @@ char data[100]; qDebug() << "FGServer::sendHeadposeToGame hasPendingDatagrams, cmd = " << cmd; // headTracker->handleGameCommand ( cmd ); // Send it upstream, for the Tracker to handle } + + if (!blnConnectionActive) { + blnConnectionActive = true; + if (hMainWindow != NULL) { + SendMessageTimeout( (HWND) hMainWindow, RegisterWindowMessageA(FT_PROGRAMID), 0, 0, 0, 2000, MsgResult); + } + } } } } @@ -198,6 +208,8 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) inSocket = 0; outSocket = 0; + hMainWindow = handle; + // // Create UDP-sockets. // diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h index 29c262f6..34773540 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h @@ -3,7 +3,7 @@ * gamers from Holland, who don't like to pay much for * * head-tracking. * * * -* Copyright (C) 2010 Wim Vriend (Developing) * +* Copyright (C) 2013 Wim Vriend (Developing) * * Ron Hendriks (Researching and Testing) * * * * Homepage * @@ -39,6 +39,8 @@ #include "Windows.h" #include "math.h" +static const char* FT_PROGRAMID = "FT_ProgramID"; // For message to FaceTrackNoIR main-window. + class FTNoIR_Protocol : public IProtocol { public: @@ -53,7 +55,11 @@ public: void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars... private: -// Tracker *headTracker; // For upstream messages... + + bool blnConnectionActive; + HANDLE hMainWindow; // Save the handle to FaceTrackNoIR main-window + + // Tracker *headTracker; // For upstream messages... TFlightGearData FlightData; QUdpSocket *inSocket; // Receive from FligthGear QUdpSocket *outSocket; // Send to FligthGear -- cgit v1.2.3