diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-09-12 19:54:50 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2015-09-12 19:55:33 -0500 |
commit | 305821c2b3a71f6baa33c29d60147204aefcad76 (patch) | |
tree | edd850be6e502910c6d93181868304dbb081625d /servers/gpib_server_lin/src/companalyzer_functions.cpp | |
parent | b32f713446eaf5ebb417281afe7740d149eb3f3b (diff) | |
download | ulab-305821c2b3a71f6baa33c29d60147204aefcad76.tar.gz ulab-305821c2b3a71f6baa33c29d60147204aefcad76.zip |
Add initial component analyzer capability request support
Fix a couple of minor errors in component analyzer handling
Diffstat (limited to 'servers/gpib_server_lin/src/companalyzer_functions.cpp')
-rw-r--r-- | servers/gpib_server_lin/src/companalyzer_functions.cpp | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/servers/gpib_server_lin/src/companalyzer_functions.cpp b/servers/gpib_server_lin/src/companalyzer_functions.cpp index 4eda333..9a15521 100644 --- a/servers/gpib_server_lin/src/companalyzer_functions.cpp +++ b/servers/gpib_server_lin/src/companalyzer_functions.cpp @@ -38,6 +38,8 @@ extern char falpha[1024]; double companalyzer_raw_trace_data[1024]; +double companalyzer_frequency; + unsigned long companalyzerTraceLength (const char * companalyzerType) { if (strcmp("HP4191A", companalyzerType) == 0) { return 417; @@ -80,7 +82,8 @@ int companalyzer_set_time(struct tm * datetime, const char * companalyzerType, i printf("[DEBG] Writing: %s\n\r", timebuffer); #endif if (gpib_write(gpibDevice, timebuffer) == 0) { - return 0; + char errorbuf[1000]; + return companalyzer_set_measurement_frequency(1000000, companalyzerType, gpibDevice, errorbuf); } else { return 2; @@ -200,14 +203,52 @@ int companalyzer_set_measurement_parameters(companalyzer_measurement::companalyz } } +int companalyzer_get_max_measurement_frequency(double * frequency, const char * companalyzerType, int gpibDevice, char * extendedError) { + if ((strcmp("HP4191A", companalyzerType) == 0)) { + printf("[INFO] Getting maximum component analyzer measurement frequency\n\r"); + if (strcmp("HP4191A", companalyzerType) == 0) { + *frequency = 1000000000; + return 0; + } + else { + sprintf(extendedError, "EXTAn invalid device was selected!°"); + return 1; + } + } + else { + sprintf(extendedError, "EXTAn invalid device was selected!°"); + return 1; + } +} + +int companalyzer_get_min_measurement_frequency(double * frequency, const char * companalyzerType, int gpibDevice, char * extendedError) { + if ((strcmp("HP4191A", companalyzerType) == 0)) { + printf("[INFO] Getting minimum component analyzer measurement frequency\n\r"); + if (strcmp("HP4191A", companalyzerType) == 0) { + *frequency = 1000000; + return 0; + } + else { + sprintf(extendedError, "EXTAn invalid device was selected!°"); + return 1; + } + } + else { + sprintf(extendedError, "EXTAn invalid device was selected!°"); + return 1; + } +} + int companalyzer_set_measurement_frequency(double frequency, const char * companalyzerType, int gpibDevice, char * extendedError) { if ((strcmp("HP4191A", companalyzerType) == 0)) { printf("[INFO] Setting component analyzer measurement frequency to %eMHz\n\r", frequency); if (strcmp("HP4191A", companalyzerType) == 0) { falpha[0] = 0; - - if ((frequency >= 1.0) && (frequency <= 1000.0)) { - sprintf(falpha, "FR%04.04fEN", frequency); + + double adjusted_frequency = frequency / 1000000.0; + + if ((adjusted_frequency >= 1.0) && (adjusted_frequency <= 1000.0)) { + sprintf(falpha, "FR%04.04fEN", adjusted_frequency); } if (strlen(falpha) == 0) { sprintf(extendedError, "EXTAn invalid parameter or combination of parameters was requested°"); @@ -218,6 +259,7 @@ int companalyzer_set_measurement_frequency(double frequency, const char * compan printf("[DEBG] Writing: %s\n\r", falpha); #endif if (gpib_write(gpibDevice, falpha) == 0) { + companalyzer_frequency = frequency; return 0; } else { @@ -401,6 +443,7 @@ int companalyzer_get_parameter_measurement(companalyzer_measurements_t * retval, measurement.parameter_b_value = parameter_value; } } + measurement.frequency = companalyzer_frequency; *retval = measurement; } |