MNE-CPP  beta 1.0
rtclient.h
Go to the documentation of this file.
1 //=============================================================================================================
38 #ifndef RTCLIENT_H
39 #define RTCLIENT_H
40 
41 //*************************************************************************************************************
42 //=============================================================================================================
43 // MNE INCLUDES
44 //=============================================================================================================
45 
46 #include "rtclient_global.h"
47 
48 
49 //*************************************************************************************************************
50 //=============================================================================================================
51 // FIFF INCLUDES
52 //=============================================================================================================
53 
54 #include <fiff/fiff_info.h>
55 
56 
57 //*************************************************************************************************************
58 //=============================================================================================================
59 // QT INCLUDES
60 //=============================================================================================================
61 
62 #include <QMutex>
63 #include <QSharedPointer>
64 #include <QString>
65 #include <QThread>
66 
67 
68 //*************************************************************************************************************
69 //=============================================================================================================
70 // Eigen INCLUDES
71 //=============================================================================================================
72 
73 #include <Eigen/Core>
74 
75 
76 //*************************************************************************************************************
77 //=============================================================================================================
78 // DEFINE NAMESPACE RTCLIENTLIB
79 //=============================================================================================================
80 
81 namespace RTCLIENTLIB
82 {
83 
84 //*************************************************************************************************************
85 //=============================================================================================================
86 // USED NAMESPACES
87 //=============================================================================================================
88 
89 using namespace Eigen;
90 using namespace FIFFLIB;
91 
92 
93 //*************************************************************************************************************
94 //=============================================================================================================
95 // FORWARD DECLARATIONS
96 //=============================================================================================================
97 
98 
99 //=============================================================================================================
105 class RTCLIENTSHARED_EXPORT RtClient : public QThread
106 {
107  Q_OBJECT
108 public:
109  typedef QSharedPointer<RtClient> SPtr;
110  typedef QSharedPointer<const RtClient> ConstSPtr;
112  //=========================================================================================================
120  explicit RtClient(QString p_sRtServerHostname, QString p_sClientAlias = "rtclient", QObject *parent = 0);
121 
122  //=========================================================================================================
126  ~RtClient();
127 
128  //=========================================================================================================
132  inline FiffInfo::SPtr& getFiffInfo();
133 
134  //=========================================================================================================
140  bool getConnectionStatus();
141 
142  //=========================================================================================================
148  virtual bool stop();
149 
150 protected:
151  //=========================================================================================================
157  virtual void run();
158 
159 private:
160  QMutex mutex;
161  bool m_bIsConnected;
162  bool m_bIsMeasuring;
163  bool m_bIsRunning;
164  QString m_sClientAlias;
165  QString m_sRtServerHostName;
166  FiffInfo::SPtr m_pFiffInfo;
168 signals:
169  //=========================================================================================================
175  void rawBufferReceived(Eigen::MatrixXf p_rawBuffer);
176 
177  //=========================================================================================================
183  void connectionChanged(bool p_bStatus);
184 };
185 
186 
187 //*************************************************************************************************************
188 //=============================================================================================================
189 // INLINE DEFINITIONS
190 //=============================================================================================================
191 
193 {
194  return m_pFiffInfo;
195 }
196 
197 } // NAMESPACE
198 
199 #ifndef metatype_matrixxf
200 #define metatype_matrixxf
201 Q_DECLARE_METATYPE(Eigen::MatrixXf);
202 #endif
203 
204 #endif // RTCLIENT_H
Real-time client.
Definition: rtclient.h:105
#define RTCLIENTSHARED_EXPORT
rtclient library export/import macros.
QSharedPointer< FiffInfo > SPtr
Definition: fiff_info.h:99
FiffInfo class declaration.
QSharedPointer< const RtClient > ConstSPtr
Definition: rtclient.h:110
Definition: fiff.h:98
FiffInfo::SPtr & getFiffInfo()
Definition: rtclient.h:192
Q_DECLARE_METATYPE(Eigen::MatrixXf)
QSharedPointer< RtClient > SPtr
Definition: rtclient.h:109