diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-27 19:52:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-27 19:52:03 +0100 |
commit | 9990b05efb6fcd806ec5d996310f4a945a0b0fac (patch) | |
tree | cdfbacdd3b535ca594521265afaa4a1184c25201 /ftnoir_tracker_hatire/ftnoir_tracker_hat.h | |
parent | 21dbb51ed05bffa69f036c6b82842aa0069b624f (diff) |
merge in the right hatire branch this time!
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
Diffstat (limited to 'ftnoir_tracker_hatire/ftnoir_tracker_hat.h')
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 122 |
1 files changed, 88 insertions, 34 deletions
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index af583d11..a1b4ecda 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -1,46 +1,68 @@ #ifndef FTNOIR_TRACKER_HAT_H #define FTNOIR_TRACKER_HAT_H -#include "facetracknoir/global-settings.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#ifdef OPENTRACK_API +# include "ftnoir_tracker_base/ftnoir_tracker_base.h" +# include "facetracknoir/global-settings.h" +#endif #include "ftnoir_tracker_hat_settings.h" #include "ftnoir_arduino_type.h" - +#include <QObject> +#include <QPalette> +#include <QtGui> +#include <QByteArray> +#include <QMessageBox> #include <QtSerialPort/QSerialPort> -#include <QThread> -#include <QTimer> -#include <QSettings> +#include <QtSerialPort/QSerialPortInfo> #include <QMutex> #include <QMutexLocker> -#include <cmath> +#include <QSettings> -class FTNoIR_Tracker : public ITracker, QThread -{ +#define VER_FILEVERSION_STR "Version 2.0.7\0" +class FTNoIR_Tracker : public QObject, public ITracker +{ + Q_OBJECT public: FTNoIR_Tracker(); - virtual ~FTNoIR_Tracker() virt_override; - - virtual void StartTracker( QFrame* frame ) virt_override; - virtual bool GiveHeadPoseData(double *data) virt_override; - + ~FTNoIR_Tracker(); + +#ifdef OPENTRACK_API + virtual void StartTracker(QFrame*); + virtual bool GiveHeadPoseData(double* data); +#else + void Initialize( QFrame *videoframe ); + virtual void StartTracker(HWND parent_window); + virtual void StopTracker(bool exit); + virtual bool GiveHeadPoseData(THeadPoseData *data); +#endif void applysettings(const TrackerSettings& settings); void notifyCenter(); - void center(); + bool notifyZeroed(); void reset(); - void sendcmd(QString* cmd); - void get_info(QString* info , int* tps ); + void SerialInfo(); + void sendcmd(const QByteArray &cmd); + void get_info( int *tps ); + +private Q_SLOTS: + void SerialRead(); + +signals: + void sendMsgInfo(const QByteArray &MsgInfo); -protected: - void run(); // qthread override run method private: + QSerialPort *ComPort; TArduinoData ArduinoData, HAT ; // Trame from Arduino - QByteArray datagram; - QSerialPort* SerialPort; - volatile bool stop; - QMutex lock; - QString sSerialPortName; // Port serial name + QByteArray dataRead; + QByteArray dataToSend; + QByteArray Begin; + QByteArray End; + QMutex mutex; + int frame_cnt; + + TrackerSettings settings; + bool bEnableRoll; bool bEnablePitch; bool bEnableYaw; @@ -55,23 +77,54 @@ private: bool bInvertY; bool bInvertZ; + int iRollAxe; + int iPitchAxe; + int iYawAxe; + int iXAxe; + int iYAxe; + int iZAxe; + + QByteArray sCmdStart; + QByteArray sCmdStop; + QByteArray sCmdInit; + QByteArray sCmdReset; + QByteArray sCmdCenter; + QByteArray sCmdZero; + + int iDelayInit; + int iDelayStart; + int iDelaySeq; + + bool bBigEndian; + + QString sSerialPortName; + QSerialPort::BaudRate iBaudRate; + QSerialPort::DataBits iDataBits; + QSerialPort::Parity iParity; + QSerialPort::StopBits iStopBits; + QSerialPort::FlowControl iFlowControl; + + int CptError; - int iRollAxis; - int iPitchAxis; - int iYawAxis; - int iXAxis; - int iYAxis; - int iZAxis; }; -class FTNoIR_TrackerDll : public Metadata + +//******************************************************************************************************* +// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker +//******************************************************************************************************* +class TrackerDll : +#if defined(OPENTRACK_API) + public Metadata +#else + public ITrackerDll +#endif { public: - FTNoIR_TrackerDll(); - ~FTNoIR_TrackerDll(); + TrackerDll(); + ~TrackerDll(); - void getFullName(QString *strToBeFilled); + void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); void getIcon(QIcon *icon); @@ -82,4 +135,5 @@ private: QString trackerDescription; }; + #endif // FTNOIR_TRACKER_HAT_H |