• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

QtSDKとDAQmxBase(Linux)を使ったアナログ信号収録ストリーミング


コミットメタ情報

リビジョン151878d4cef034cc5f0226f2c070e88cc67ed4f7 (tree)
日時2012-08-24 18:44:11
作者arakaki <alucky4416@user...>
コミッターarakaki

ログメッセージ

ADD: add DataSaveThread.

変更サマリ

差分

--- a/QtSimpleDAQ_AI_Streaming.pro
+++ b/QtSimpleDAQ_AI_Streaming.pro
@@ -12,11 +12,13 @@ TEMPLATE = app
1212
1313 SOURCES += main.cpp \
1414 mainwindow.cpp \
15- daqthread.cpp
15+ daqthread.cpp \
16+ savedatathread.cpp
1617
1718 HEADERS += mainwindow.h \
1819 daqthread.h \
19- NIDAQmxBase.h
20+ NIDAQmxBase.h \
21+ savedatathread.h
2022
2123
2224 FORMS += mainwindow.ui
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -4,6 +4,7 @@
44 #include <QMainWindow>
55
66 #include "daqthread.h"
7+#include "savedatathread.h"
78
89 namespace Ui {
910 class MainWindow;
@@ -29,6 +30,8 @@ private:
2930
3031 DAQThread *DaqTh;
3132 bool flag_aiexec_status;
33+
34+ SaveDataThread *SaveDataTh;
3235 };
3336
3437 #endif // MAINWINDOW_H
--- /dev/null
+++ b/savedatathread.cpp
@@ -0,0 +1,30 @@
1+#include <QDebug>
2+#include <QString>
3+
4+#include "savedatathread.h"
5+
6+SaveDataThread::SaveDataThread(QObject *parent) :
7+ QThread(parent)
8+{
9+ stopped = false;
10+
11+ state = State_IDLE;
12+ EvtQue = new QQueue<int>();
13+}
14+
15+SaveDataThread::~SaveDataThread()
16+{
17+ delete EvtQue;
18+}
19+
20+void SaveDataThread::stop()
21+{
22+ stopped = true;
23+}
24+
25+void SaveDataThread::run()
26+{
27+ while(!stopped) {
28+ msleep(100);
29+ }
30+}
--- /dev/null
+++ b/savedatathread.h
@@ -0,0 +1,40 @@
1+#ifndef SAVEDATATHREAD_H
2+#define SAVEDATATHREAD_H
3+
4+#include <QThread>
5+#include <QQueue>
6+
7+class SaveDataThread : public QThread
8+{
9+ Q_OBJECT
10+public:
11+ explicit SaveDataThread(QObject *parent = 0);
12+ ~SaveDataThread();
13+ void stop();
14+
15+signals:
16+
17+
18+public slots:
19+
20+
21+protected:
22+ void run();
23+
24+private:
25+ volatile bool stopped;
26+
27+ // State Machine, state Id
28+ enum { State_IDLE = 0,
29+ State_EXEC // SaveData Executing
30+ } state;
31+ // State Machine, event Id
32+ enum { Ev_Nop = 0,
33+ Ev_Save_Start, // start SaveData to File
34+ Ev_Save_Stop // stop SaveData to File
35+ };
36+
37+ QQueue<int> *EvtQue; // EventQue
38+};
39+
40+#endif // SAVEDATATHREAD_H