summaryrefslogtreecommitdiffstats
path: root/clients
diff options
context:
space:
mode:
Diffstat (limited to 'clients')
-rw-r--r--clients/tde/src/part/scope/layout.ui18
-rw-r--r--clients/tde/src/part/scope/part.cpp112
-rw-r--r--clients/tde/src/part/scope/part.h4
3 files changed, 133 insertions, 1 deletions
diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui
index ee3bb81..a104177 100644
--- a/clients/tde/src/part/scope/layout.ui
+++ b/clients/tde/src/part/scope/layout.ui
@@ -104,7 +104,23 @@
<string>Capture Controls</string>
</property>
<grid>
- <widget class="TQWidget" row="0" column="0" colspan="4">
+ <widget class="TQPushButton" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>runControlStartButton</cstring>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="0" column="1" colspan="1">
+ <property name="name">
+ <cstring>runControlStopButton</cstring>
+ </property>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </widget>
+ <widget class="TQWidget" row="1" column="0" colspan="2">
<property name="name">
<cstring>traceControlLayoutWidget</cstring>
</property>
diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp
index 17c137d..03b6b25 100644
--- a/clients/tde/src/part/scope/part.cpp
+++ b/clients/tde/src/part/scope/part.cpp
@@ -53,10 +53,12 @@ enum connectionStates {
ScopeState_TraceSecondsDivRequest = 18,
ScopeState_TriggerChannelRequest = 20,
ScopeState_TriggerLevelRequest = 22,
+ ScopeState_RunningRequest = 24,
ScopeState_TraceRequest = 50,
ScopeState_ChannelActiveStateUpdate = 100,
ScopeState_TraceVoltsDivUpdate = 102,
ScopeState_TriggerLevelUpdate = 104,
+ ScopeState_RunningUpdate = 106,
ScopeState_ExternalCommandRequest = 255
};
@@ -175,6 +177,7 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
m_channelActiveSet[traceno] = false;
}
m_triggerLevelSet = false;
+ m_runningSet = false;
// Create widgets
m_base = new ScopeBase(widget());
@@ -222,6 +225,8 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
connect(m_base->acqStart, SIGNAL(clicked()), this, SLOT(startDAQ()));
connect(m_base->acqStop, SIGNAL(clicked()), this, SLOT(stopDAQ()));
+ connect(m_base->runControlStartButton, SIGNAL(clicked()), this, SLOT(startScope()));
+ connect(m_base->runControlStopButton, SIGNAL(clicked()), this, SLOT(stopScope()));
connect(m_base->waveformSave, SIGNAL(clicked()), this, SLOT(saveWaveforms()));
connect(m_base->waveformRecall, SIGNAL(clicked()), this, SLOT(recallWaveforms()));
@@ -291,6 +296,14 @@ void ScopePart::processLockouts() {
m_base->waveformSave->setEnabled(false);
m_base->waveformRecall->setEnabled(false);
}
+ if (m_running) {
+ m_base->runControlStartButton->setEnabled(false);
+ m_base->runControlStopButton->setEnabled(true);
+ }
+ else {
+ m_base->runControlStartButton->setEnabled(true);
+ m_base->runControlStopButton->setEnabled(false);
+ }
}
void ScopePart::disconnectFromServerCallback() {
@@ -324,6 +337,7 @@ void ScopePart::setTickerMessage(TQString message) {
if (m_channelActiveSet[i]) updatesPending = true;
if (m_voltsDivSet[i]) updatesPending = true;
if (m_triggerLevelSet) updatesPending = true;
+ if (m_runningSet) updatesPending = true;
}
m_connectionActiveAndValid = true;
@@ -884,6 +898,50 @@ void ScopePart::mainEventLoop() {
}
if (result == "ACK") {
+ SET_NEXT_STATE(ScopeState_RunningRequest)
+ EXEC_NEXT_STATE_IMMEDIATELY
+ }
+ else {
+ COMMUNICATIONS_FAILED
+ }
+ }
+ else {
+ if (!m_updateTimeoutTimer->isActive()) {
+ UPDATEDISPLAY_TIMEOUT
+ }
+ }
+ }
+ else if (m_commHandlerState == ScopeState_RunningRequest) {
+ // Get running, step 1
+ ds << TQString("GETRUNNING");
+ ds << m_currentOpChannel;
+ m_socket->writeEndOfFrame();
+
+ SET_NEXT_STATE(ScopeState_RunningRequest+1)
+ EXEC_NEXT_STATE_IMMEDIATELY
+ }
+ else if (m_commHandlerState == ScopeState_RunningRequest+1) {
+ // Get response data
+ if (m_socket->canReadFrame()) {
+ PAT_WATCHDOG_TIMER
+ setTickerMessage(i18n("Loading [Received run status]"));
+
+ // Get running, step 2
+ TQString result;
+ ds >> result;
+ if (result == "ACK") {
+ TQ_INT16 status;
+ ds >> status;
+ m_running = (status != 0);
+ }
+ m_socket->clearFrameTail();
+
+ if (result == "ACK") {
+ // Update display widget(s)
+ updateGraticule();
+ }
+
+ if (result == "ACK") {
m_currentOpChannel = getNextActiveChannel(0, m_channelActive, m_maxNumberOfTraces);
SET_NEXT_STATE(ScopeState_TraceRequest)
EXEC_NEXT_STATE_IMMEDIATELY
@@ -942,6 +1000,7 @@ void ScopePart::mainEventLoop() {
&& (m_channelActiveSet[m_currentOpChannel] == false)
&& (m_voltsDivSet[m_currentOpChannel] == false)
&& (m_triggerLevelSet == false)
+ && (m_runningSet == false)
) {
SET_NEXT_STATE(ScopeState_TraceRequest)
}
@@ -1109,6 +1168,48 @@ void ScopePart::mainEventLoop() {
m_socket->clearFrameTail();
if (result == "ACK") {
+ SET_NEXT_STATE(ScopeState_RunningUpdate)
+ EXEC_NEXT_STATE_IMMEDIATELY
+ }
+ else {
+ COMMUNICATIONS_FAILED
+ }
+ }
+ else {
+ if (!m_updateTimeoutTimer->isActive()) {
+ UPDATEDISPLAY_TIMEOUT
+ }
+ }
+ }
+ else if (m_commHandlerState == ScopeState_RunningUpdate) {
+ if (m_runningSet) {
+ // Set running, step 1
+ ds << TQString("SETRUNNING");
+ TQ_INT16 running = (m_running)?1:0;
+ ds << running;
+ m_socket->writeEndOfFrame();
+
+ m_runningSet = false;
+ SET_NEXT_STATE(ScopeState_RunningUpdate+1)
+ }
+ else {
+ m_currentOpChannel = getNextActiveChannel(0, m_channelActive, m_maxNumberOfTraces);
+ SET_NEXT_STATE(ScopeState_TraceRequest)
+ }
+ EXEC_NEXT_STATE_IMMEDIATELY
+ }
+ else if (m_commHandlerState == ScopeState_RunningUpdate+1) {
+ // Get response data
+ if (m_socket->canReadFrame()) {
+ PAT_WATCHDOG_TIMER
+ setTickerMessage(i18n("Updating [Set run status]"));
+
+ // Set running, step 2
+ TQString result;
+ ds >> result;
+ m_socket->clearFrameTail();
+
+ if (result == "ACK") {
m_currentOpChannel = getNextActiveChannel(0, m_channelActive, m_maxNumberOfTraces);
SET_NEXT_STATE(ScopeState_TraceRequest)
EXEC_NEXT_STATE_IMMEDIATELY
@@ -1211,6 +1312,7 @@ void ScopePart::stopDAQ() {
m_voltsDivSet[i] = false;
}
m_triggerLevelSet = false;
+ m_runningSet = false;
m_commHandlerMode = 1;
m_commHandlerCommandState = 3;
mainEventLoop();
@@ -1447,6 +1549,16 @@ void ScopePart::cursorLevelChanged(uint cursor, double level) {
}
}
+void ScopePart::startScope() {
+ m_running = true;
+ m_runningSet = true;
+}
+
+void ScopePart::stopScope() {
+ m_running = false;
+ m_runningSet = true;
+}
+
KAboutData* ScopePart::createAboutData() {
return new KAboutData( APP_NAME, I18N_NOOP( APP_PRETTYNAME ), APP_VERSION );
}
diff --git a/clients/tde/src/part/scope/part.h b/clients/tde/src/part/scope/part.h
index 24e2c84..c559f1e 100644
--- a/clients/tde/src/part/scope/part.h
+++ b/clients/tde/src/part/scope/part.h
@@ -89,6 +89,8 @@ namespace RemoteLab
void traceControlEnableChanged(bool enabled);
void traceControlVDivChanged(double vdiv);
void cursorLevelChanged(uint cursor, double level);
+ void startScope();
+ void stopScope();
void saveWaveforms();
void recallWaveforms();
virtual void postProcessTrace();
@@ -110,6 +112,7 @@ namespace RemoteLab
TQ_INT16 m_hdivs;
TQ_INT16 m_vdivs;
TQ_INT16 m_triggerChannel;
+ bool m_running;
double m_triggerLevel;
TQ_INT32 m_samplesInTrace[MAXTRACES+1];
bool m_channelActive[MAXTRACES+1];
@@ -117,6 +120,7 @@ namespace RemoteLab
double m_secsDiv[MAXTRACES+1];
TraceControlWidget* m_traceControlWidgetList[MAXTRACES];
bool m_triggerLevelSet;
+ bool m_runningSet;
bool m_voltsDivSet[MAXTRACES+1];
bool m_channelActiveSet[MAXTRACES+1];
bool m_lastChangesRequireFullUpdate;