|
@@ -16,6 +16,7 @@ MainClass::MainClass(QObject *parent)
|
16
|
16
|
, m_address(QHostAddress::Any)
|
17
|
17
|
, m_port(39415)
|
18
|
18
|
, m_verbose(false)
|
|
19
|
+ , m_interval(100)
|
19
|
20
|
, m_lastTime(0)
|
20
|
21
|
{
|
21
|
22
|
}
|
|
@@ -47,7 +48,7 @@ void MainClass::main()
|
47
|
48
|
m_input = new InputBusiness(input, m_channels, server);
|
48
|
49
|
m_timer = new QTimer(this);
|
49
|
50
|
m_timer->setSingleShot(false);
|
50
|
|
- m_timer->setInterval(0);
|
|
51
|
+ m_timer->setInterval(m_interval / 1000);
|
51
|
52
|
connect(m_timer, SIGNAL(timeout()), this, SLOT(maySend()));
|
52
|
53
|
m_timer->start();
|
53
|
54
|
}
|
|
@@ -86,6 +87,8 @@ void MainClass::getOpts()
|
86
|
87
|
parser.addOption(port);
|
87
|
88
|
QCommandLineOption verbose((QStringList() << "verbose"), "enable verbose mode");
|
88
|
89
|
parser.addOption(verbose);
|
|
90
|
+ QCommandLineOption interval((QStringList() << "i" << "interval"), "interval between measures in usec", "INTERVAL", QString::number(m_interval));
|
|
91
|
+ parser.addOption(interval);
|
89
|
92
|
|
90
|
93
|
parser.process(*qApp);
|
91
|
94
|
|
|
@@ -123,5 +126,12 @@ void MainClass::getOpts()
|
123
|
126
|
parser.showHelp(EX_USAGE);
|
124
|
127
|
}
|
125
|
128
|
|
|
129
|
+ m_interval = parser.value(interval).toInt(&ok);
|
|
130
|
+ if (!ok || m_interval < 0)
|
|
131
|
+ {
|
|
132
|
+ std::cerr << "Invalid interval" << std::endl;
|
|
133
|
+ parser.showHelp(EX_USAGE);
|
|
134
|
+ }
|
|
135
|
+
|
126
|
136
|
m_verbose = parser.isSet(verbose);
|
127
|
137
|
}
|