diff options
-rw-r--r-- | lib/libtqtrla/src/tqtrla.cpp | 21 | ||||
-rw-r--r-- | lib/libtqtrla/src/tqtrla.h | 9 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/commanalyzer_functions.h | 1 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/gpib_conn.cpp | 541 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/scope_functions.cpp | 26 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/scope_functions.h | 24 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/signal_functions.cpp | 14 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/signal_functions.h | 12 |
8 files changed, 595 insertions, 53 deletions
diff --git a/lib/libtqtrla/src/tqtrla.cpp b/lib/libtqtrla/src/tqtrla.cpp index 4e024d3..96c2274 100644 --- a/lib/libtqtrla/src/tqtrla.cpp +++ b/lib/libtqtrla/src/tqtrla.cpp @@ -274,6 +274,27 @@ namespace KParts } } +TQDataStream &operator<<( TQDataStream &s, const TQFloatArray &data ) { + TQ_UINT32 i; + TQ_UINT32 count = data.count(); + s << count; + for (i=0; i<count; i++) { + s << data[i]; + } + return s; +} + +TQDataStream &operator>>( TQDataStream &s, TQFloatArray &data ) { + TQ_UINT32 i; + TQ_UINT32 count; + s >> count; + data.resize(count); + for (i=0; i<count; i++) { + s >> data[i]; + } + return s; +} + bool operator==( const ServiceType &s1, const ServiceType &s2 ) { bool identical = true; diff --git a/lib/libtqtrla/src/tqtrla.h b/lib/libtqtrla/src/tqtrla.h index 2db5cc0..a982946 100644 --- a/lib/libtqtrla/src/tqtrla.h +++ b/lib/libtqtrla/src/tqtrla.h @@ -93,6 +93,15 @@ namespace KParts // ============================================================================= +typedef TQMemArray<float> TQFloatArray; + +#ifndef QT_NO_DATASTREAM +Q_EXPORT TQDataStream &operator<<(TQDataStream &, const TQFloatArray &); +Q_EXPORT TQDataStream &operator>>(TQDataStream &, TQFloatArray &); +#endif + +// ============================================================================= + class ServiceType { public: diff --git a/servers/gpib_server_lin/src/commanalyzer_functions.h b/servers/gpib_server_lin/src/commanalyzer_functions.h index bbd291b..624b0f2 100644 --- a/servers/gpib_server_lin/src/commanalyzer_functions.h +++ b/servers/gpib_server_lin/src/commanalyzer_functions.h @@ -29,6 +29,7 @@ int commanalyzer_switch_to_spectrum_analyzer_mode (const char * commanalyzerType int commanalyzer_lock_screen (const char * commanalyzerType, int gpibDevice); int commanalyzer_get_spectrum_analyzer_trace (const char * commanalyzerType, int gpibDevice); +int commanalyzer_set_display_brightness(float percent, const char * commanalyzerType, int gpibDevice); int commanalyzer_set_spectrum_analyzer_center_frequency(float desired_frequency, const char * commanalyzerType, int gpibDevice); int commanalyzer_set_spectrum_analyzer_frequency_span(float desired_frequency, const char * commanalyzerType, int gpibDevice); int commanalyzer_spectrum_analyzer_set_generator_mode_tracking (const char * commanalyzerType, int gpibDevice); diff --git a/servers/gpib_server_lin/src/gpib_conn.cpp b/servers/gpib_server_lin/src/gpib_conn.cpp index 5b52430..cf19cee 100644 --- a/servers/gpib_server_lin/src/gpib_conn.cpp +++ b/servers/gpib_server_lin/src/gpib_conn.cpp @@ -251,13 +251,537 @@ void GPIBSocket::commandLoop() { TQDataStream ds(this); ds.setPrintableData(true); ds >> m_instrumentCommand; - clearFrameTail(); if (m_instrumentCommand != "") { + if (m_activeDeviceType == 2) { + // Oscilloscope + if (m_instrumentCommand == "SETHORIZTIMEBASE") { // Want to change horizontal timebase + float value; + ds >> value; + if (scope_set_timebase(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETVOLTSDIV") { // Want to change volts per division + TQ_INT32 value1; + ds >> value1; + float value2; + ds >> value2; + if (scope_set_volts_div(value1, value2, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETRUNNING") { // Want to change run status + TQ_INT32 value; + ds >> value; + if (scope_set_acquisition(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETCHANNELACTIVE") { // Want to change channel enable + TQ_INT32 value1; + ds >> value1; + TQ_INT32 value2; + ds >> value2; + if (scope_set_channel_state(value1, value2, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETTRIGGERCHANNEL") { // Want to change trigger channel + TQ_INT32 value; + ds >> value; + if (scope_set_trigger_channel(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETTRIGGERLEVEL") { // Want to change trigger level + float value; + ds >> value; + if (scope_set_trigger_level(value, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETCHANVERTPOS") { // Want to change channel vertical position + TQ_INT32 value1; + ds >> value1; + float value2; + ds >> value2; + if (scope_set_channel_position(value1, value2, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + } + else if (m_activeDeviceType == 3) { + // Function generator + char errorbuf[1000]; + if (m_instrumentCommand == "RESET") { // Want to reset function generator + if (signal_reset(m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETFREQUENCY") { // Want to change frequency + float value; + ds >> value; + if (signal_set_frequency(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETDUTYCYCLE") { // Want to change duty cycle + float value; + ds >> value; + if (signal_set_duty_cycle(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETSHAPESQUARE") { // Want to set square wave + if (signal_set_waveform("SQUARE", m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETSHAPESINE") { // Want to set sine wave + if (signal_set_waveform("SINUSOID", m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETSHAPETRIANGLE") { // Want to set triangle wave + if (signal_set_waveform("RAMP", m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETSHAPENOISE") { // Want to set noise wave + if (signal_set_waveform("NOISE", m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETPEAKPEAKVOLTAGE") { // Want to change P-P voltage + float value; + ds >> value; + if (signal_set_peak_peak_voltage(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETOFFSETVOLTAGE") { // Want to change offset voltage + float value; + ds >> value; + if (signal_set_offset_voltage(value, m_serverParent->m_funcgenType.ascii(), m_serverParent->m_funcgenDeviceSocket, errorbuf) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString(errorbuf); + writeEndOfFrame(); + } + } + } + else if (m_activeDeviceType == 4) { + // Communications analyzer + if (m_instrumentCommand == "SETMODESPECTRUMANALYZER") { // Want to set SA mode + if (commanalyzer_switch_to_spectrum_analyzer_mode(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if ((m_instrumentCommand == "GETSPECTRUMTRACE")) { // Want SA trace + ds << TQString("ACK"); + 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; + traceData.resize(tracelen); + for (i=0; i<tracelen; i++) { + traceData[i] = commanalyzer_raw_trace_data[i]; + } + ds << traceData; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "LOCKSCREEN") { // Want to lock screen + if (commanalyzer_lock_screen(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + commanalyzer_set_display_brightness(0, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket); // Don't burn in the screen + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENMODETRACKING") { // Want to set generator to tracking mode + if (commanalyzer_spectrum_analyzer_set_generator_mode_tracking(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENMODEFIXED") { // Want to set generator to fixed mode + if (commanalyzer_spectrum_analyzer_set_generator_mode_fixed(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETCENTERFREQUENCY") { // Want to change center frequency + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_center_frequency(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETFREQUENCYSPAN") { // Want to change frequency span + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_frequency_span(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETRFINPUTDEDICATED") { // Want to set RF input to dedicated connector + if (commanalyzer_spectrum_analyzer_set_rf_input_dedicated(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETRFINPUTMULTIPLEXED") { // Want to set RF input to multiplexed connector + if (commanalyzer_spectrum_analyzer_set_rf_input_muxed(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENOUTPUTDEDICATED") { // Want to set generator output to dedicated connector + if (commanalyzer_spectrum_analyzer_set_generator_output_dedicated(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENOUTPUTMULTIPLEXED") { // Want to set generator output to multiplexed connector + if (commanalyzer_spectrum_analyzer_set_generator_output_muxed(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETINPUTATTENUATION") { // Want to change input attenuation + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_input_attenuation(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETVERTICALSCALE") { // Want to change scale + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_scale(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETINPUTATTENMODEAUTO") { // Want to set RF input attenuator mode to automatic + if (commanalyzer_set_spectrum_analyzer_input_attenuator_mode_auto(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETINPUTATTENMODEFIXED") { // Want to set RF input attenuator mode to fixed + if (commanalyzer_set_spectrum_analyzer_input_attenuator_mode_fixed(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENOUTPUTPOWER") { // Want to change generator output power + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_generator_power(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENOUTPUTFREQUENCY") { // Want to change generator output frequency + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_generator_frequency(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENSWEEPASCENDING") { // Want to set generator sweep to ascending + if (commanalyzer_spectrum_analyzer_set_generator_sweep_ascending(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETGENSWEEPDESCENDING") { // Want to set generator sweep to descending + if (commanalyzer_spectrum_analyzer_set_generator_sweep_descending(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETTRACEAVERAGING") { // Want to set trace averaging + float value; + ds >> value; + if (commanalyzer_set_spectrum_analyzer_trace_averaging(value, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETREFERENCEPOWERLEVEL") { // Want to set reference power level + float 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"); + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETVERTICALDIVCOUNT") { // Want the number of vertical divisions available + TQ_INT16 divisions = commanalyzer_get_spectrum_analyzer_number_of_vertical_divisions(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket); + if (divisions >= 0) { + ds << TQString("ACK"); + ds << divisions; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETTRACESAMPLECOUNT") { // Want the number of samples in a trace + TQ_INT16 divisions = commanalyzerTraceLength(m_serverParent->m_commanalyzerType.ascii()); + if (divisions >= 0) { + ds << TQString("ACK"); + ds << divisions; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETHORIZONTALDIVCOUNT") { // Want the number of horizontal divisions available + TQ_INT16 divisions = commanalyzer_get_spectrum_analyzer_number_of_horizontal_divisions(m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket); + if (divisions >= 0) { + ds << TQString("ACK"); + ds << divisions; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETREFERENCEPOWERLEVEL") { // Want the reference power level + double rpower; + if (commanalyzer_get_spectrum_analyzer_reference_power_level(&rpower, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + ds << rpower; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETVERTDIVSCALE") { // Want the vertical division scale + double scale; + if (commanalyzer_get_spectrum_analyzer_scale(&scale, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + ds << scale; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "SETCENTERFREQUENCY") { // 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"); + ds << freq; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + else if (m_instrumentCommand == "GETFREQUENCYSPAN") { // Want to get the frequency span + double freq; + if (commanalyzer_get_spectrum_analyzer_span(&freq, m_serverParent->m_commanalyzerType.ascii(), m_serverParent->m_commanalyzerDeviceSocket) == 0) { + ds << TQString("ACK"); + ds << freq; + writeEndOfFrame(); + } + else { + ds << TQString("NCK"); + writeEndOfFrame(); + } + } + } + else { + // Unknown + transferred_data = true; + m_commandLoopState = 0; + } + m_servClientTimeout->start(NETWORK_COMM_TIMEOUT_MS, TRUE); transferred_data = true; m_commandLoopState = 2; } + + clearFrameTail(); } } } @@ -266,20 +790,7 @@ void GPIBSocket::commandLoop() { processPendingData(); } if (canReadFrame()) { - if (m_activeDeviceType == 2) { - // Oscilloscope - } - else if (m_activeDeviceType == 3) { - // Function generator - } - else if (m_activeDeviceType == 4) { - // Communications analyzer - } - else { - // Unknown - transferred_data = true; - m_commandLoopState = 0; - } + // } } } diff --git a/servers/gpib_server_lin/src/scope_functions.cpp b/servers/gpib_server_lin/src/scope_functions.cpp index 2d12f9b..d05deb4 100644 --- a/servers/gpib_server_lin/src/scope_functions.cpp +++ b/servers/gpib_server_lin/src/scope_functions.cpp @@ -37,7 +37,7 @@ extern char falpha[1024]; unsigned char scope_raw_screenshot_data[4194304]; -unsigned long scopeScreenWidth (char * scopeType) { +unsigned long scopeScreenWidth (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return 512; } @@ -49,7 +49,7 @@ unsigned long scopeScreenWidth (char * scopeType) { } } -unsigned long scopeScreenHeight (char * scopeType) { +unsigned long scopeScreenHeight (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return 280; } @@ -61,7 +61,7 @@ unsigned long scopeScreenHeight (char * scopeType) { } } -unsigned long scopeScreenSize (char * scopeType) { +unsigned long scopeScreenSize (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return scopeScreenWidth(scopeType)*scopeScreenHeight(scopeType)*3; } @@ -73,7 +73,7 @@ unsigned long scopeScreenSize (char * scopeType) { } } -int gpib_read_binblock(int ud, int max_num_bytes, char * scopeType) +int gpib_read_binblock(int ud, int max_num_bytes, const char * scopeType) { char segarray[4194304]; long array_pointer; @@ -127,7 +127,7 @@ int gpib_read_binblock(int ud, int max_num_bytes, char * scopeType) return 0; } -int scope_get_screenshot_stage2(char * scopeType, int gpibDevice) { +int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) { long bytestosend; int k; int m; @@ -175,7 +175,7 @@ int scope_get_screenshot_stage2(char * scopeType, int gpibDevice) { } -int scope_get_screenshot(char * scopeType, int gpibDevice) { +int scope_get_screenshot(const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Getting scope screenshot [Stage 1]\n\r"); if (strcmp("HP54600OS", scopeType) == 0) { @@ -227,7 +227,7 @@ int scope_get_screenshot(char * scopeType, int gpibDevice) { return 1; } -int scope_set_timebase(float desired_timebase, char * scopeType, int gpibDevice) { +int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope timebase to %E\n\r", desired_timebase); if (strcmp("HP54600OS", scopeType) == 0) { @@ -260,7 +260,7 @@ int scope_set_timebase(float desired_timebase, char * scopeType, int gpibDevice) } } -int scope_set_volts_div(int desired_channel, float desired_volts, char * scopeType, int gpibDevice) { +int scope_set_volts_div(int desired_channel, float desired_volts,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope volts/div on channel %d to %f\n\r", desired_channel, desired_volts/8); if (strcmp("HP54600OS", scopeType) == 0) { @@ -293,7 +293,7 @@ int scope_set_volts_div(int desired_channel, float desired_volts, char * scopeTy } } -int scope_set_acquisition(int status, char * scopeType, int gpibDevice) { +int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope run status to %d\n\r", status); if (strcmp("HP54600OS", scopeType) == 0) { @@ -331,7 +331,7 @@ int scope_set_acquisition(int status, char * scopeType, int gpibDevice) { } } -int scope_set_channel_state(int desired_channel, int status, char * scopeType, int gpibDevice) { +int scope_set_channel_state(int desired_channel, int status,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting channel %d state to %i\n\r", desired_channel, status); if (strcmp("HP54600OS", scopeType) == 0) { @@ -380,7 +380,7 @@ int scope_set_channel_state(int desired_channel, int status, char * scopeType, i } } -int scope_set_trigger_channel(int desired_channel, char * scopeType, int gpibDevice) { +int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope trigger channel to %d\n\r", desired_channel); if (strcmp("HP54600OS", scopeType) == 0) { @@ -413,7 +413,7 @@ int scope_set_trigger_channel(int desired_channel, char * scopeType, int gpibDev } } -int scope_set_trigger_level(float desired_level, char * scopeType, int gpibDevice) { +int scope_set_trigger_level(float desired_level,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope trigger level to %f\n\r", desired_level); if (strcmp("HP54600OS", scopeType) == 0) { @@ -446,7 +446,7 @@ int scope_set_trigger_level(float desired_level, char * scopeType, int gpibDevic } } -int scope_set_channel_position(int desired_channel, float desired_level, char * scopeType, int gpibDevice) { +int scope_set_channel_position(int desired_channel, float desired_level,const char * scopeType, int gpibDevice) { if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { printf("[INFO] Setting scope channel %d level to %f\n\r", desired_channel, desired_level); if (strcmp("HP54600OS", scopeType) == 0) { diff --git a/servers/gpib_server_lin/src/scope_functions.h b/servers/gpib_server_lin/src/scope_functions.h index 2e7eaa3..8b0a215 100644 --- a/servers/gpib_server_lin/src/scope_functions.h +++ b/servers/gpib_server_lin/src/scope_functions.h @@ -22,16 +22,16 @@ extern unsigned char scope_raw_screenshot_data[4194304]; -unsigned long scopeScreenSize (char * scopeType); -unsigned long scopeScreenWidth (char * scopeType); -unsigned long scopeScreenHeight (char * scopeType); +unsigned long scopeScreenSize (const char * scopeType); +unsigned long scopeScreenWidth (const char * scopeType); +unsigned long scopeScreenHeight (const char * scopeType); int gpib_read_binary(int ud, int max_num_bytes); -int scope_get_screenshot(char * scopeType, int gpibDevice); -int scope_get_screenshot_stage2(char * scopeType, int gpibDevice); -int scope_set_timebase(float desired_timebase, char * scopeType, int gpibDevice); -int scope_set_volts_div(int desired_channel, float desired_volts, char * scopeType, int gpibDevice); -int scope_set_acquisition(int status, char * scopeType, int gpibDevice); -int scope_set_channel_state(int desired_channel, int status, char * scopeType, int gpibDevice); -int scope_set_trigger_channel(int desired_channel, char * scopeType, int gpibDevice); -int scope_set_trigger_level(float desired_level, char * scopeType, int gpibDevice); -int scope_set_channel_position(int desired_channel, float desired_level, char * scopeType, int gpibDevice);
\ No newline at end of file +int scope_get_screenshot(const char * scopeType, int gpibDevice); +int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice); +int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDevice); +int scope_set_volts_div(int desired_channel, float desired_volts,const char * scopeType, int gpibDevice); +int scope_set_acquisition(int status,const char * scopeType, int gpibDevice); +int scope_set_channel_state(int desired_channel, int status,const char * scopeType, int gpibDevice); +int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gpibDevice); +int scope_set_trigger_level(float desired_level,const char * scopeType, int gpibDevice); +int scope_set_channel_position(int desired_channel, float desired_level,const char * scopeType, int gpibDevice);
\ No newline at end of file diff --git a/servers/gpib_server_lin/src/signal_functions.cpp b/servers/gpib_server_lin/src/signal_functions.cpp index 38dd771..2b90987 100644 --- a/servers/gpib_server_lin/src/signal_functions.cpp +++ b/servers/gpib_server_lin/src/signal_functions.cpp @@ -34,7 +34,7 @@ extern char falpha[1024]; -int signal_get_last_error(char * funcgenType, int gpibDevice, char * extendedError) { +int signal_get_last_error(const char * funcgenType, int gpibDevice, char * extendedError) { char error_array[1024]; int ei; char * ep; @@ -81,7 +81,7 @@ int signal_get_last_error(char * funcgenType, int gpibDevice, char * extendedErr return 1; } -int signal_reset(char * funcgenType, int gpibDevice, char * extendedError) +int signal_reset(const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Resetting function generator\n\r"); @@ -163,7 +163,7 @@ int signal_reset(char * funcgenType, int gpibDevice, char * extendedError) return 1; } -int signal_set_frequency(float desired_frequency, char * funcgenType, int gpibDevice, char * extendedError) { +int signal_set_frequency(float desired_frequency, const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Setting function generator frequency to %f\n\r", desired_frequency); if (strcmp("AG33250A", funcgenType) == 0) { @@ -187,7 +187,7 @@ int signal_set_frequency(float desired_frequency, char * funcgenType, int gpibDe } } -int signal_set_duty_cycle(float desired_dcycle, char * funcgenType, int gpibDevice, char * extendedError) { +int signal_set_duty_cycle(float desired_dcycle, const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Setting function generator period to %f\n\r", desired_dcycle); if (strcmp("AG33250A", funcgenType) == 0) { @@ -211,7 +211,7 @@ int signal_set_duty_cycle(float desired_dcycle, char * funcgenType, int gpibDevi } } -int signal_set_waveform(char * waveform, char * funcgenType, int gpibDevice, char * extendedError) { +int signal_set_waveform(char * waveform, const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Setting function generator waveform to %s\n\r", waveform); if (strcmp("AG33250A", funcgenType) == 0) { @@ -235,7 +235,7 @@ int signal_set_waveform(char * waveform, char * funcgenType, int gpibDevice, cha } } -int signal_set_peak_peak_voltage(float desired_voltage, char * funcgenType, int gpibDevice, char * extendedError) { +int signal_set_peak_peak_voltage(float desired_voltage, const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Setting function generator peak-peak voltage to %f\n\r", desired_voltage); if (strcmp("AG33250A", funcgenType) == 0) { @@ -259,7 +259,7 @@ int signal_set_peak_peak_voltage(float desired_voltage, char * funcgenType, int } } -int signal_set_offset_voltage(float desired_voltage, char * funcgenType, int gpibDevice, char * extendedError) { +int signal_set_offset_voltage(float desired_voltage, const char * funcgenType, int gpibDevice, char * extendedError) { if ((strcmp("AG33250A", funcgenType) == 0)) { printf("[INFO] Setting function generator peak-peak voltage to %f\n\r", desired_voltage); if (strcmp("AG33250A", funcgenType) == 0) { diff --git a/servers/gpib_server_lin/src/signal_functions.h b/servers/gpib_server_lin/src/signal_functions.h index e1e05bd..acf46b5 100644 --- a/servers/gpib_server_lin/src/signal_functions.h +++ b/servers/gpib_server_lin/src/signal_functions.h @@ -20,9 +20,9 @@ * http://www.raptorengineeringinc.com */ -int signal_reset(char * funcgenType, int gpibDevice, char * extendedError); -int signal_set_frequency(float desired_frequency, char * funcgenType, int gpibDevice, char * extendedError); -int signal_set_duty_cycle(float desired_dcycle, char * funcgenType, int gpibDevice, char * extendedError); -int signal_set_waveform(char * waveform, char * funcgenType, int gpibDevice, char * extendedError); -int signal_set_peak_peak_voltage(float desired_voltage, char * funcgenType, int gpibDevice, char * extendedError); -int signal_set_offset_voltage(float desired_voltage, char * funcgenType, int gpibDevice, char * extendedError); +int signal_reset(const char * funcgenType, int gpibDevice, char * extendedError); +int signal_set_frequency(float desired_frequency,const char * funcgenType, int gpibDevice, char * extendedError); +int signal_set_duty_cycle(float desired_dcycle,const char * funcgenType, int gpibDevice, char * extendedError); +int signal_set_waveform(char * waveform,const char * funcgenType, int gpibDevice, char * extendedError); +int signal_set_peak_peak_voltage(float desired_voltage,const char * funcgenType, int gpibDevice, char * extendedError); +int signal_set_offset_voltage(float desired_voltage,const char * funcgenType, int gpibDevice, char * extendedError); |