MNE-CPP  beta 1.0
babymegclient.h
1 //=============================================================================================================
37 #ifndef BABYMEGCLIENT_H
38 #define BABYMEGCLIENT_H
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // QT INCLUDES
43 //=============================================================================================================
44 
45 #include <QObject>
46 #include <QtNetwork/QTcpSocket>
47 #include <QMutex>
48 #include <QThread>
49 #include <QDataStream>
50 
51 
52 //*************************************************************************************************************
53 //=============================================================================================================
54 // INCLUDES
55 //=============================================================================================================
56 
57 #include "babymeginfo.h"
58 
59 
60 class QTcpSocket;
61 class QNetworkSession;
62 
63 
64 //=============================================================================================================
70 class BabyMEGClient : public QThread
71 {
72  Q_OBJECT
73 
74 public:
75  //=========================================================================================================
79  explicit BabyMEGClient(int myPort, QObject *parent = 0);
80  ~BabyMEGClient();
81 public:
82  QString name;
83  int port;
84  bool SocketIsConnected;
85  bool SkipLoop;
86  bool DataAcqStartFlag;
87  BabyMEGInfo *myBabyMEGInfo;
88 
89  QByteArray buffer;
90  int numBlock;
91  bool DataACK;
92 
93 private:
94  QTcpSocket *tcpSocket;
95  QMutex m_qMutex;
96 signals:
97  void DataAcq();
98  void error(int socketError, const QString &message);
99 
100 public slots:
101  //=========================================================================================================
107  void ConnectToBabyMEG();
108  //=========================================================================================================
114  void DisConnectBabyMEG();
115  //=========================================================================================================
121  void SendCommandToBabyMEG();
122  void DisplayError(int socketError, const QString &message);
123  //=========================================================================================================
129  void ReadToBuffer();
130  void run();
131  //=========================================================================================================
137  void SendCommandToBabyMEGShortConnection(QByteArray s);
138 
139 // public function
140 public:
141  //=========================================================================================================
148  QByteArray MGH_LM_Int2Byte(int a);
149 
156  int MGH_LM_Byte2Int(QByteArray InByte);
157 
164  double MGH_LM_Byte2Double(QByteArray InByte);
170  void HexDisplay(double a);
176  void SetInfo(BabyMEGInfo *pInfo);
182  void DispatchDataPackage(int tmp);
188  void ReadNextBlock(int tmp);
194  void SendCommand(QString s);
200  void handleBuffer();
201 };
202 
203 #endif // BABYMEGCLIENT_H
BabyMEGClient(int myPort, QObject *parent=0)
void SendCommandToBabyMEG()
The BabyMEGClient class provides a TCP/IP communication between Qt and Labview.
Definition: babymeginfo.h:70
void ReadNextBlock(int tmp)
void HexDisplay(double a)
void DisConnectBabyMEG()
void SendCommandToBabyMEGShortConnection(QByteArray s)
void SetInfo(BabyMEGInfo *pInfo)
void ConnectToBabyMEG()
double MGH_LM_Byte2Double(QByteArray InByte)
int MGH_LM_Byte2Int(QByteArray InByte)
void SendCommand(QString s)
The BabyMEGClient class provides a TCP/IP communication between Qt and Labview.
Definition: babymegclient.h:70
QByteArray MGH_LM_Int2Byte(int a)
void DispatchDataPackage(int tmp)