summaryrefslogtreecommitdiffstats
path: root/servers/gpib_server_lin/src/gpib_conn.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 01:44:02 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 01:44:02 -0500
commit89702662657667460d0e5914794366d190f11534 (patch)
treef5ea5b866bba0095675bcfe0190685b839d0ff4e /servers/gpib_server_lin/src/gpib_conn.cpp
parent8d3c1358eeaefec559c4a09995ff5b26393a9620 (diff)
downloadulab-89702662657667460d0e5914794366d190f11534.tar.gz
ulab-89702662657667460d0e5914794366d190f11534.zip
Fix commanalyzer functionality
Diffstat (limited to 'servers/gpib_server_lin/src/gpib_conn.cpp')
-rw-r--r--servers/gpib_server_lin/src/gpib_conn.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/servers/gpib_server_lin/src/gpib_conn.cpp b/servers/gpib_server_lin/src/gpib_conn.cpp
index a17ee1f..d27c049 100644
--- a/servers/gpib_server_lin/src/gpib_conn.cpp
+++ b/servers/gpib_server_lin/src/gpib_conn.cpp
@@ -209,10 +209,17 @@ void GPIBSocket::commandLoop() {
}
if (m_activeDeviceType != 0) {
+ ds << TQString("ACK");
+ writeEndOfFrame();
+
m_servClientTimeout->start(NETWORK_COMM_TIMEOUT_MS, TRUE);
transferred_data = true;
m_commandLoopState = 1;
}
+ else {
+ ds << TQString("NCK");
+ writeEndOfFrame();
+ }
}
}
else if (m_commandLoopState == 1) {
@@ -226,6 +233,7 @@ void GPIBSocket::commandLoop() {
ds.setPrintableData(true);
TQByteArray recData;
ds >> recData;
+ clearFrameTail();
if (recData.size() > 0) {
if (write(m_serverParent->m_serialDeviceSocket, recData.data(), recData.size()) < 0) {
// ERROR
@@ -251,12 +259,12 @@ void GPIBSocket::commandLoop() {
TQDataStream ds(this);
ds.setPrintableData(true);
ds >> m_instrumentCommand;
-
+
if (m_instrumentCommand != "") {
if (m_activeDeviceType == 2) {
// Oscilloscope
if (m_instrumentCommand == "SETHORIZTIMEBASE") { // Want to change horizontal timebase
- float value;
+ double value;
ds >> value;
if (scope_set_timebase(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -341,7 +349,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETTRIGGERLEVEL") { // Want to change trigger level
- float value;
+ double value;
ds >> value;
if (scope_set_trigger_level(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -381,7 +389,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETFREQUENCY") { // Want to change frequency
- float value;
+ double value;
ds >> value;
if (signal_set_frequency(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) {
ds << TQString("ACK");
@@ -393,7 +401,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETDUTYCYCLE") { // Want to change duty cycle
- float value;
+ double value;
ds >> value;
if (signal_set_duty_cycle(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) {
ds << TQString("ACK");
@@ -445,7 +453,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETPEAKPEAKVOLTAGE") { // Want to change P-P voltage
- float value;
+ double value;
ds >> value;
if (signal_set_peak_peak_voltage(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) {
ds << TQString("ACK");
@@ -457,7 +465,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETOFFSETVOLTAGE") { // Want to change offset voltage
- float value;
+ double value;
ds >> value;
if (signal_set_offset_voltage(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) {
ds << TQString("ACK");
@@ -485,7 +493,7 @@ void GPIBSocket::commandLoop() {
if (commanalyzer_get_spectrum_analyzer_trace(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
int i;
int tracelen = commanalyzerTraceLength(m_serverParent->m_commanalyzerType.ascii());
- TQFloatArray traceData;
+ TQDoubleArray traceData;
traceData.resize(tracelen);
for (i=0; i<tracelen; i++) {
traceData[i] = commanalyzer_raw_trace_data[i];
@@ -531,7 +539,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETCENTERFREQUENCY") { // Want to change center frequency
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_center_frequency(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -543,7 +551,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETFREQUENCYSPAN") { // Want to change frequency span
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_frequency_span(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -595,7 +603,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETINPUTATTENUATION") { // Want to change input attenuation
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_input_attenuation(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -607,7 +615,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETVERTICALSCALE") { // Want to change scale
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_scale(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -639,7 +647,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETGENOUTPUTPOWER") { // Want to change generator output power
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_generator_power(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -651,7 +659,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETGENOUTPUTFREQUENCY") { // Want to change generator output frequency
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_generator_frequency(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -683,7 +691,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETTRACEAVERAGING") { // Want to set trace averaging
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_trace_averaging(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -695,7 +703,7 @@ void GPIBSocket::commandLoop() {
}
}
else if (m_instrumentCommand == "SETREFERENCEPOWERLEVEL") { // Want to set reference power level
- float value;
+ double value;
ds >> value;
if (commanalyzer_set_spectrum_analyzer_reference_power_level(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");
@@ -766,7 +774,7 @@ void GPIBSocket::commandLoop() {
writeEndOfFrame();
}
}
- else if (m_instrumentCommand == "SETCENTERFREQUENCY") { // Want to get the center frequency
+ else if (m_instrumentCommand == "GETCENTERFREQUENCY") { // Want to get the center frequency
double freq;
if (commanalyzer_get_spectrum_analyzer_center_frequency(&freq, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) {
ds << TQString("ACK");