Add GETPERMITTEDSDIVS command to gpib server

master
Timothy Pearson 11 years ago
parent de23e8f184
commit 260c25ebe5

@ -549,6 +549,27 @@ void GPIBSocket::commandLoop() {
writeEndOfFrame();
}
}
else if (m_instrumentCommand == "GETPERMITTEDSDIVS") { // Want to get permitted seconds/div settings
double* permitted_array;
int permitted_count;
TQ_INT32 value;
ds >> value;
if (scope_get_permitted_seconds_div_settings(&permitted_count, &permitted_array, m_serverParent->m_scopeType.ascii(), m_serverParent->m_scopeDeviceSocket) == 0) {
long i;
TQDoubleList permittedValues;
for (i=0; i<permitted_count; i++) {
permittedValues.append(permitted_array[i]);
}
free(permitted_array);
ds << TQString("ACK");
ds << permittedValues;
writeEndOfFrame();
}
else {
ds << TQString("NCK");
writeEndOfFrame();
}
}
else {
printf("[WARNING] Received unknown command %s from host %s\n\r", m_instrumentCommand.ascii(), m_remoteHost.ascii()); fflush(stdout);
ds << TQString("NCK");

@ -1250,3 +1250,48 @@ int scope_get_permitted_volts_div_settings_at_1x(int * number_of_values, double
return -1;
}
}
int scope_get_permitted_seconds_div_settings(int * number_of_values, double ** retarray, const char * scopeType, int gpibDevice) {
if (strcmp("HP54600OS", scopeType) == 0) {
// FIXME
// Not supported (yet)
return -1;
}
else if (strcmp("TDS744AOS", scopeType) == 0) {
*number_of_values = 28;
double* values = (double*)malloc(sizeof(double)*(*number_of_values));
values[0] = 1.25e-8;
values[1] = 2.5e-8;
values[2] = 5e-8;
values[3] = 1e-7;
values[4] = 2e-7;
values[5] = 5e-7;
values[6] = 1e-6;
values[7] = 2e-6;
values[8] = 5e-6;
values[9] = 1e-5;
values[10] = 2e-5;
values[11] = 5e-5;
values[12] = 1e-4;
values[13] = 2e-4;
values[14] = 5e-4;
values[15] = 1e-3;
values[16] = 2e-3;
values[17] = 5e-3;
values[18] = 1e-2;
values[19] = 2e-2;
values[20] = 5e-2;
values[21] = 1e-1;
values[22] = 2e-1;
values[23] = 5e-1;
values[24] = 1e0;
values[25] = 2e0;
values[26] = 5e0;
values[27] = 1e1;
*retarray = values;
return 0;
}
else {
return -1;
}
}

@ -52,3 +52,4 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch
int scope_get_channel_sample_count(unsigned long * retval, int desired_channel, const char * scopeType, int gpibDevice);
int scope_get_probe_attenuation_multiplier(double * retval, int desired_channel, const char * scopeType, int gpibDevice);
int scope_get_permitted_volts_div_settings_at_1x(int * number_of_values, double ** retarray, const char * scopeType, int gpibDevice);
int scope_get_permitted_seconds_div_settings(int * number_of_values, double ** retarray, const char * scopeType, int gpibDevice);
Loading…
Cancel
Save