|
@@ -11,7 +11,6 @@ hardware usable without the DATAQ SDK both on Microsoft Windows and on other
|
11
|
11
|
platforms for which there is a suitable serial driver.
|
12
|
12
|
|
13
|
13
|
@<Class declarations@>=
|
14
|
|
-#ifdef Q_OS_WIN32
|
15
|
14
|
class DataqSdkDeviceImplementation;
|
16
|
15
|
class DataqSdkDevice : public QObject
|
17
|
16
|
{
|
|
@@ -26,7 +25,6 @@ class DataqSdkDevice : public QObject
|
26
|
25
|
Q_INVOKABLE void setClockRate(double Hz);
|
27
|
26
|
Q_INVOKABLE void start();
|
28
|
27
|
};
|
29
|
|
-#endif
|
30
|
28
|
|
31
|
29
|
@ The |DataqSdkDevice| class has as a private member an instance of a class
|
32
|
30
|
called |DataqSdkDeviceImplementation|. The two classes together create and run
|
|
@@ -41,7 +39,6 @@ was considered the right thing to do, but it would be good to rewrite this to
|
41
|
39
|
not subclass |QThread| now that this is no longer required.
|
42
|
40
|
|
43
|
41
|
@<Class declarations@>=
|
44
|
|
-#ifdef Q_OS_WIN32
|
45
|
42
|
class DataqSdkDeviceImplementation : public QThread
|
46
|
43
|
{
|
47
|
44
|
Q_OBJECT
|
|
@@ -56,7 +53,6 @@ class DataqSdkDeviceImplementation : public QThread
|
56
|
53
|
private:
|
57
|
54
|
qint16 *buffer;
|
58
|
55
|
};
|
59
|
|
-#endif
|
60
|
56
|
|
61
|
57
|
@ While the |DAQ| class for communicating with National Instruments devices
|
62
|
58
|
uses a single function pointer type, increased variety of function signatures
|
|
@@ -141,7 +137,7 @@ QLibrary *driver;
|
141
|
137
|
QVector<Units::Unit> unitMap;
|
142
|
138
|
int *input_buffer;
|
143
|
139
|
QTimer *eventClock;
|
144
|
|
-QMultiMap<int, double> > smoother;
|
|
140
|
+QMultiMap<int, double> smoother;
|
145
|
141
|
|
146
|
142
|
@ Most of the interesting work associated with the |DataqSdkDevice| class is
|
147
|
143
|
handled in the |measure()| method of |DataqSdkDeviceImplementation|. This
|
|
@@ -204,7 +200,7 @@ void DataqSdkDeviceImplementation::measure()
|
204
|
200
|
QList<double> channelBuffer;
|
205
|
201
|
for(unsigned int j = 0; j < 40; j++)
|
206
|
202
|
{
|
207
|
|
- channelbuffer << ((double)buffer[i+(channels*j)] * 10.0) / 32768.0;
|
|
203
|
+ channelBuffer << ((double)buffer[i+(channels*j)] * 10.0) / 32768.0;
|
208
|
204
|
if(i == 0)
|
209
|
205
|
{
|
210
|
206
|
countList << buffer[i+(channels*j)];
|
|
@@ -213,7 +209,7 @@ void DataqSdkDeviceImplementation::measure()
|
213
|
209
|
double value = 0.0;
|
214
|
210
|
for(unsigned int j = 0; j < 40; j++)
|
215
|
211
|
{
|
216
|
|
- value += channelbuffer[j];
|
|
212
|
+ value += channelBuffer[j];
|
217
|
213
|
}
|
218
|
214
|
value /= 40.0;
|
219
|
215
|
if(i == 0)
|
|
@@ -340,7 +336,7 @@ void DataqSdkDeviceImplementation::run()
|
340
|
336
|
inlist[i].ave = 1;
|
341
|
337
|
inlist[i].counter = (oversample - 1);
|
342
|
338
|
}
|
343
|
|
- error = di_list_length(channels, 0)
|
|
339
|
+ error = di_list_length(channels, 0);
|
344
|
340
|
if(error)
|
345
|
341
|
{
|
346
|
342
|
error = 4; // List length error
|
|
@@ -598,8 +594,7 @@ QScriptValue DataqSdkDevice_newChannel(QScriptContext *context, QScriptEngine *e
|
598
|
594
|
QScriptValue object;
|
599
|
595
|
if(self)
|
600
|
596
|
{
|
601
|
|
- object = engine->newQObject(self->newChannel(argument<int>(0, context),
|
602
|
|
- argument<int>(1, context)));
|
|
597
|
+ object = engine->newQObject(self->newChannel((Units::Unit)argument<int>(0, context)));
|
603
|
598
|
setChannelProperties(object, engine);
|
604
|
599
|
}
|
605
|
600
|
return object;
|