Merge pull request #108 from slsdetectorgroup/removeget

Removeget
This commit is contained in:
Dhanya Thattil 2020-06-19 14:24:32 +02:00 committed by GitHub
commit da2ce03e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 387 additions and 482 deletions

View File

@ -17,8 +17,6 @@ void init_enums(py::module &m) {
xy.def_readwrite("y", &slsDetectorDefs::xy::y); xy.def_readwrite("y", &slsDetectorDefs::xy::y);
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType") py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
.value("GET_DETECTOR_TYPE",
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC) .value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
.value("EIGER", slsDetectorDefs::detectorType::EIGER) .value("EIGER", slsDetectorDefs::detectorType::EIGER)
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD) .value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
@ -40,8 +38,6 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy") py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("GET_FRAME_DISCARD_POLICY",
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD) .value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES", .value("DISCARD_EMPTY_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES) slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
@ -52,16 +48,15 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat") py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
.value("BINARY", slsDetectorDefs::fileFormat::BINARY) .value("BINARY", slsDetectorDefs::fileFormat::BINARY)
.value("HDF5", slsDetectorDefs::fileFormat::HDF5) .value(" HDF5", slsDetectorDefs::fileFormat::HDF5)
.value("NUM_FILE_FORMATS", .value(" NUM_FILE_FORMATS",
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS) slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension") py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X) .value("X", slsDetectorDefs::dimension::X)
.value("Y", slsDetectorDefs::dimension::Y) .value(" Y", slsDetectorDefs::dimension::Y)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag") py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
@ -76,7 +71,6 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode") py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING) .value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
.value("TRIGGER_EXPOSURE", .value("TRIGGER_EXPOSURE",
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE) slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
@ -206,7 +200,6 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings") py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD) .value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
.value("FAST", slsDetectorDefs::detectorSettings::FAST) .value("FAST", slsDetectorDefs::detectorSettings::FAST)
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN) .value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
@ -259,34 +252,24 @@ void init_enums(py::module &m) {
.value(" QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED) .value(" QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
.export_values();
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags") py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER) .value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER) .value(" IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE) .value(" IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType") py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL) .value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL) .value(" NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD) .value(" FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD) .value(" NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType") py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("GET_DETECTOR_MODE",
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING) .value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value("INTERPOLATING", .value(" INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING) slsDetectorDefs::detectorModeType::INTERPOLATING)
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG) .value(" ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode") py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")

View File

@ -1112,7 +1112,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED) { if (sett == UNINITIALIZED) {
return thisSettings; return thisSettings;
} }
if (sett != GET_SETTINGS)
thisSettings = sett; thisSettings = sett;
LOG(logINFO, ("Settings: %d\n", thisSettings)); LOG(logINFO, ("Settings: %d\n", thisSettings));
return thisSettings; return thisSettings;
@ -1355,7 +1354,7 @@ enum timingMode getTiming() {
return GATED; return GATED;
default: default:
LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode)); LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
return GET_TIMING_MODE; return GET_FLAG;
} }
} }

View File

@ -1044,13 +1044,12 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
// set settings // set settings
uint32_t addr = ASIC_CONFIG_REG; uint32_t addr = ASIC_CONFIG_REG;
uint32_t mask = ASIC_CONFIG_GAIN_MSK; uint32_t mask = ASIC_CONFIG_GAIN_MSK;
if (sett != GET_SETTINGS) {
switch (sett) { switch (sett) {
case DYNAMICGAIN: case DYNAMICGAIN:
bus_w(addr, bus_r(addr) & ~mask); bus_w(addr, bus_r(addr) & ~mask);
bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL); bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL);
LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n", LOG(logINFO,
bus_r(addr) & mask)); ("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask));
break; break;
case FIXGAIN1: case FIXGAIN1:
bus_w(addr, bus_r(addr) & ~mask); bus_w(addr, bus_r(addr) & ~mask);
@ -1066,12 +1065,10 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
break; break;
default: default:
LOG(logERROR, LOG(logERROR,
("This settings is not defined for this detector %d\n", ("This settings is not defined for this detector %d\n", (int)sett));
(int)sett));
return -1; return -1;
} }
thisSettings = sett; thisSettings = sett;
}
return getSettings(); return getSettings();
} }

View File

@ -950,7 +950,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
return thisSettings; return thisSettings;
// set settings // set settings
if (sett != GET_SETTINGS) {
u_int32_t addr = GAIN_REG; u_int32_t addr = GAIN_REG;
// find conf gain value // find conf gain value
@ -978,8 +977,7 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
break; break;
default: default:
LOG(logERROR, LOG(logERROR,
("This settings is not defined for this detector %d\n", ("This settings is not defined for this detector %d\n", (int)sett));
(int)sett));
return -1; return -1;
} }
// set conf gain // set conf gain
@ -987,7 +985,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
bus_w(addr, bus_r(addr) | confgain); bus_w(addr, bus_r(addr) | confgain);
LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr))); LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr)));
thisSettings = sett; thisSettings = sett;
}
return getSettings(); return getSettings();
} }

View File

@ -753,12 +753,11 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
return thisSettings; return thisSettings;
// set settings // set settings
if (sett != GET_SETTINGS) {
switch (sett) { switch (sett) {
case DYNAMICGAIN: case DYNAMICGAIN:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
LOG(logINFO, ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", LOG(logINFO,
bus_r(DAQ_REG))); ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break; break;
case DYNAMICHG0: case DYNAMICHG0:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
@ -792,13 +791,11 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
break; break;
default: default:
LOG(logERROR, LOG(logERROR,
("This settings is not defined for this detector %d\n", ("This settings is not defined for this detector %d\n", (int)sett));
(int)sett));
return -1; return -1;
} }
thisSettings = sett; thisSettings = sett;
}
return getSettings(); return getSettings();
} }

View File

@ -909,7 +909,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
return thisSettings; return thisSettings;
// set settings // set settings
if (sett != GET_SETTINGS) {
switch (sett) { switch (sett) {
case G1_HIGHGAIN: case G1_HIGHGAIN:
LOG(logINFO, ("Set settings - G1_HIGHGAIN\n")); LOG(logINFO, ("Set settings - G1_HIGHGAIN\n"));
@ -945,13 +944,11 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
break; break;
default: default:
LOG(logERROR, LOG(logERROR,
("This settings is not defined for this detector %d\n", ("This settings is not defined for this detector %d\n", (int)sett));
(int)sett));
return -1; return -1;
} }
setPatternBitMask(DEFAULT_PATSETBIT); setPatternBitMask(DEFAULT_PATSETBIT);
thisSettings = sett; thisSettings = sett;
}
return getSettings(); return getSettings();
} }

View File

@ -1157,7 +1157,6 @@ int setHighVoltage(int val) {
/* parameters - timing */ /* parameters - timing */
void setTiming(enum timingMode arg) { void setTiming(enum timingMode arg) {
if (arg != GET_TIMING_MODE) {
switch (arg) { switch (arg) {
case AUTO_TIMING: case AUTO_TIMING:
LOG(logINFO, ("Set Timing: Auto (Int. Trigger, Int. Gating)\n")); LOG(logINFO, ("Set Timing: Auto (Int. Trigger, Int. Gating)\n"));
@ -1188,7 +1187,6 @@ void setTiming(enum timingMode arg) {
LOG(logERROR, ("Unknown timing mode %d\n", arg)); LOG(logERROR, ("Unknown timing mode %d\n", arg));
return; return;
} }
}
} }
enum timingMode getTiming() { enum timingMode getTiming() {

View File

@ -361,7 +361,7 @@ void modeNotImplemented(char *modename, int mode) {
} }
void validate(int arg, int retval, char *modename, enum numberMode nummode) { void validate(int arg, int retval, char *modename, enum numberMode nummode) {
if (ret == OK && arg != -1 && retval != arg) { if (ret == OK && arg != GET_FLAG && retval != arg) {
ret = FAIL; ret = FAIL;
if (nummode == HEX) if (nummode == HEX)
sprintf(mess, "Could not %s. Set 0x%x, but read 0x%x\n", modename, sprintf(mess, "Could not %s. Set 0x%x, but read 0x%x\n", modename,
@ -375,7 +375,7 @@ void validate(int arg, int retval, char *modename, enum numberMode nummode) {
void validate64(int64_t arg, int64_t retval, char *modename, void validate64(int64_t arg, int64_t retval, char *modename,
enum numberMode nummode) { enum numberMode nummode) {
if (ret == OK && arg != -1 && retval != arg) { if (ret == OK && arg != GET_FLAG && retval != arg) {
ret = FAIL; ret = FAIL;
if (nummode == HEX) if (nummode == HEX)
sprintf(mess, "Could not %s. Set 0x%llx, but read 0x%llx\n", sprintf(mess, "Could not %s. Set 0x%llx, but read 0x%llx\n",
@ -574,15 +574,15 @@ int set_external_signal_flag(int file_des) {
int set_timing_mode(int file_des) { int set_timing_mode(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum timingMode arg = GET_TIMING_MODE; enum timingMode arg = AUTO_TIMING;
enum timingMode retval = GET_TIMING_MODE; enum timingMode retval = AUTO_TIMING;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg)); LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg));
// set // set
if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) { if (((int)arg != GET_FLAG) && (Server_VerifyLock() == OK)) {
switch (arg) { switch (arg) {
case AUTO_TIMING: case AUTO_TIMING:
case TRIGGER_EXPOSURE: case TRIGGER_EXPOSURE:
@ -998,7 +998,7 @@ int set_dac(int file_des) {
(mV ? "mV" : "dac units"))); (mV ? "mV" : "dac units")));
// set & get // set & get
if ((val == -1) || (Server_VerifyLock() == OK)) { if ((val == GET_FLAG) || (Server_VerifyLock() == OK)) {
switch (ind) { switch (ind) {
// adc vpp // adc vpp
@ -1072,7 +1072,7 @@ int set_dac(int file_des) {
case V_POWER_C: case V_POWER_C:
case V_POWER_D: case V_POWER_D:
case V_POWER_IO: case V_POWER_IO:
if (val != -1) { if (val != GET_FLAG) {
if (!mV) { if (!mV) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
@ -1126,7 +1126,8 @@ int set_dac(int file_des) {
} }
retval = getVchip(); retval = getVchip();
LOG(logDEBUG1, ("Vchip: %d\n", retval)); LOG(logDEBUG1, ("Vchip: %d\n", retval));
if (ret == OK && val != -1 && val != -100 && retval != val) { if (ret == OK && val != GET_FLAG && val != -100 &&
retval != val) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set vchip. Set %d, but read %d\n", sprintf(mess, "Could not set vchip. Set %d, but read %d\n",
val, retval); val, retval);
@ -1170,9 +1171,9 @@ int set_dac(int file_des) {
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD) || defined(MOENCHD)
if ((val != -1 && mV && if ((val != GET_FLAG && mV &&
checkVLimitCompliant(val) == FAIL) || checkVLimitCompliant(val) == FAIL) ||
(val != -1 && !mV && (val != GET_FLAG && !mV &&
checkVLimitDacCompliant(val) == FAIL)) { checkVLimitDacCompliant(val) == FAIL)) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
@ -1187,7 +1188,7 @@ int set_dac(int file_des) {
retval = getDAC(serverDacIndex, mV); retval = getDAC(serverDacIndex, mV);
} }
#ifdef EIGERD #ifdef EIGERD
if (val != -1) { if (val != GET_FLAG) {
// changing dac changes settings to undefined // changing dac changes settings to undefined
switch (serverDacIndex) { switch (serverDacIndex) {
case E_VCMP_LL: case E_VCMP_LL:
@ -1208,7 +1209,7 @@ int set_dac(int file_des) {
#endif #endif
// check // check
if (ret == OK) { if (ret == OK) {
if ((abs(retval - val) <= 5) || val == -1) { if ((abs(retval - val) <= 5) || val == GET_FLAG) {
ret = OK; ret = OK;
} else { } else {
ret = FAIL; ret = FAIL;
@ -1501,7 +1502,6 @@ int set_module(int file_des) {
case VERYHIGHGAIN: case VERYHIGHGAIN:
case VERYLOWGAIN: case VERYLOWGAIN:
#elif JUNGFRAUD #elif JUNGFRAUD
case GET_SETTINGS:
case DYNAMICGAIN: case DYNAMICGAIN:
case DYNAMICHG0: case DYNAMICHG0:
case FIXGAIN1: case FIXGAIN1:
@ -1509,14 +1509,11 @@ int set_module(int file_des) {
case FORCESWITCHG1: case FORCESWITCHG1:
case FORCESWITCHG2: case FORCESWITCHG2:
#elif GOTTHARDD #elif GOTTHARDD
case GET_SETTINGS:
case DYNAMICGAIN: case DYNAMICGAIN:
case HIGHGAIN: case HIGHGAIN:
case LOWGAIN: case LOWGAIN:
case MEDIUMGAIN: case MEDIUMGAIN:
case VERYHIGHGAIN: case VERYHIGHGAIN:
#elif MYTHEN3D
case GET_SETTINGS:
#endif #endif
break; break;
default: default:
@ -1541,8 +1538,8 @@ int set_module(int file_des) {
int set_settings(int file_des) { int set_settings(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum detectorSettings isett = GET_SETTINGS; enum detectorSettings isett = STANDARD;
enum detectorSettings retval = GET_SETTINGS; enum detectorSettings retval = STANDARD;
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0) if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
@ -1553,11 +1550,11 @@ int set_settings(int file_des) {
LOG(logDEBUG1, ("Setting settings %d\n", isett)); LOG(logDEBUG1, ("Setting settings %d\n", isett));
// set & get // set & get
if ((isett == GET_SETTINGS) || (Server_VerifyLock() == OK)) { if (((int)isett == GET_FLAG) || (Server_VerifyLock() == OK)) {
if ((int)isett != GET_FLAG) {
// check index // check index
switch (isett) { switch (isett) {
case GET_SETTINGS:
#ifdef JUNGFRAUD #ifdef JUNGFRAUD
case DYNAMICGAIN: case DYNAMICGAIN:
case DYNAMICHG0: case DYNAMICHG0:
@ -1597,14 +1594,18 @@ int set_settings(int file_des) {
break; break;
} }
// if index is okay, set & get
if (ret == OK) { if (ret == OK) {
retval = setSettings(isett); setSettings(isett);
}
}
retval = getSettings();
LOG(logDEBUG1, ("Settings: %d\n", retval)); LOG(logDEBUG1, ("Settings: %d\n", retval));
if ((int)isett != GET_FLAG) {
validate((int)isett, (int)retval, "set settings", DEC); validate((int)isett, (int)retval, "set settings", DEC);
#if defined(JUNGFRAUD) || defined(GOTTHARDD) #if defined(JUNGFRAUD) || defined(GOTTHARDD)
// gotthard2 does not set default dacs // gotthard2 does not set default dacs
if (ret == OK && isett >= 0) { if (ret == OK) {
ret = setDefaultDacs(); ret = setDefaultDacs();
if (ret == FAIL) { if (ret == FAIL) {
strcpy(mess, "Could change settings, but could not set to " strcpy(mess, "Could change settings, but could not set to "
@ -1686,7 +1687,7 @@ int start_acquisition(int file_des) {
"same as hardware detector mac address %s\n", "same as hardware detector mac address %s\n",
src_mac); src_mac);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(-1) && } else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails.srcip != getDetectorIP())) { (udpDetails.srcip != getDetectorIP())) {
ret = FAIL; ret = FAIL;
uint32_t sourceip = getDetectorIP(); uint32_t sourceip = getDetectorIP();
@ -1804,7 +1805,7 @@ int start_and_read_all(int file_des) {
"same as hardware detector mac address %s\n", "same as hardware detector mac address %s\n",
src_mac); src_mac);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(-1) && } else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails.srcip != getDetectorIP())) { (udpDetails.srcip != getDetectorIP())) {
ret = FAIL; ret = FAIL;
uint32_t sourceip = getDetectorIP(); uint32_t sourceip = getDetectorIP();
@ -2623,10 +2624,10 @@ int set_dynamic_range(int file_des) {
LOG(logDEBUG1, ("Setting dr to %d\n", dr)); LOG(logDEBUG1, ("Setting dr to %d\n", dr));
// set & get // set & get
if ((dr == -1) || (Server_VerifyLock() == OK)) { if ((dr == GET_FLAG) || (Server_VerifyLock() == OK)) {
// check dr // check dr
switch (dr) { switch (dr) {
case -1: case GET_FLAG:
#ifdef MYTHEN3D #ifdef MYTHEN3D
case 32: case 32:
#elif EIGERD #elif EIGERD
@ -2795,8 +2796,8 @@ int enable_ten_giga(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg >= 0 && enableTenGigabitEthernet(-1) != arg) { if (arg >= 0 && enableTenGigabitEthernet(GET_FLAG) != arg) {
enableTenGigabitEthernet(arg); enableTenGigabitEthernet(arg);
uint64_t hardwaremac = getDetectorMAC(); uint64_t hardwaremac = getDetectorMAC();
if (udpDetails.srcmac != hardwaremac) { if (udpDetails.srcmac != hardwaremac) {
@ -2810,7 +2811,7 @@ int enable_ten_giga(int file_des) {
} }
configure_mac(); configure_mac();
} }
retval = enableTenGigabitEthernet(-1); retval = enableTenGigabitEthernet(GET_FLAG);
LOG(logDEBUG1, ("10GbE: %d\n", retval)); LOG(logDEBUG1, ("10GbE: %d\n", retval));
validate(arg, retval, "enable/disable 10GbE", DEC); validate(arg, retval, "enable/disable 10GbE", DEC);
} }
@ -2870,7 +2871,7 @@ int set_pattern_io_control(int file_des) {
#else #else
LOG(logDEBUG1, LOG(logDEBUG1,
("Setting Pattern IO Control to 0x%llx\n", (long long int)arg)); ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg));
if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) { if (((int64_t)arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = writePatternIOControl(arg); retval = writePatternIOControl(arg);
LOG(logDEBUG1, LOG(logDEBUG1,
("Pattern IO Control retval: 0x%llx\n", (long long int)retval)); ("Pattern IO Control retval: 0x%llx\n", (long long int)retval));
@ -2893,7 +2894,7 @@ int set_pattern_clock_control(int file_des) {
#else #else
LOG(logDEBUG1, LOG(logDEBUG1,
("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg)); ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg));
if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) { if (((int64_t)arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = writePatternClkControl(arg); retval = writePatternClkControl(arg);
LOG(logDEBUG1, LOG(logDEBUG1,
("Pattern Clock Control retval: 0x%llx\n", (long long int)retval)); ("Pattern Clock Control retval: 0x%llx\n", (long long int)retval));
@ -2955,7 +2956,8 @@ int set_pattern_loop_addresses(int file_des) {
LOG(logDEBUG1, ("Setting Pattern loop addresses(loopLevel:%d " LOG(logDEBUG1, ("Setting Pattern loop addresses(loopLevel:%d "
"startAddr:0x%x stopAddr:0x%x)\n", "startAddr:0x%x stopAddr:0x%x)\n",
loopLevel, startAddr, stopAddr)); loopLevel, startAddr, stopAddr));
if ((startAddr == -1) || (stopAddr == -1) || (Server_VerifyLock() == OK)) { if ((startAddr == GET_FLAG) || (stopAddr == GET_FLAG) ||
(Server_VerifyLock() == OK)) {
// valid loop level // valid loop level
if (loopLevel < -1 || if (loopLevel < -1 ||
loopLevel > 2) { // loop level of -1 : complete pattern loopLevel > 2) { // loop level of -1 : complete pattern
@ -3007,7 +3009,7 @@ int set_pattern_loop_cycles(int file_des) {
int numLoops = args[1]; int numLoops = args[1];
LOG(logDEBUG1, ("Setting Pattern loop cycles (loopLevel:%d numLoops:%d)\n", LOG(logDEBUG1, ("Setting Pattern loop cycles (loopLevel:%d numLoops:%d)\n",
loopLevel, numLoops)); loopLevel, numLoops));
if ((numLoops == -1) || (Server_VerifyLock() == OK)) { if ((numLoops == GET_FLAG) || (Server_VerifyLock() == OK)) {
// valid loop level // valid loop level
if (loopLevel < 0 || loopLevel > 2) { if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL; ret = FAIL;
@ -3017,8 +3019,8 @@ int set_pattern_loop_cycles(int file_des) {
loopLevel); loopLevel);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
int startAddr = -1; int startAddr = GET_FLAG;
int stopAddr = -1; int stopAddr = GET_FLAG;
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops); setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
retval = numLoops; retval = numLoops;
LOG(logDEBUG1, LOG(logDEBUG1,
@ -3045,7 +3047,7 @@ int set_pattern_wait_addr(int file_des) {
int addr = args[1]; int addr = args[1];
LOG(logDEBUG1, ("Setting Pattern wait address (loopLevel:%d addr:0x%x)\n", LOG(logDEBUG1, ("Setting Pattern wait address (loopLevel:%d addr:0x%x)\n",
loopLevel, addr)); loopLevel, addr));
if ((addr == -1) || (Server_VerifyLock() == OK)) { if ((addr == GET_FLAG) || (Server_VerifyLock() == OK)) {
// valid loop level 0-2 // valid loop level 0-2
if (loopLevel < 0 || loopLevel > 2) { if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL; ret = FAIL;
@ -3088,7 +3090,7 @@ int set_pattern_wait_time(int file_des) {
uint64_t timeval = args[1]; uint64_t timeval = args[1];
LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n",
loopLevel, (long long int)timeval)); loopLevel, (long long int)timeval));
if (((int64_t)timeval == -1) || (Server_VerifyLock() == OK)) { if (((int64_t)timeval == GET_FLAG) || (Server_VerifyLock() == OK)) {
// valid loop level 0-2 // valid loop level 0-2
if (loopLevel < 0 || loopLevel > 2) { if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL; ret = FAIL;
@ -3245,7 +3247,7 @@ int set_counter_bit(int file_des) {
setCounterBit(arg); setCounterBit(arg);
} }
// get // get
retval = setCounterBit(-1); retval = setCounterBit(GET_FLAG);
LOG(logDEBUG1, ("Set counter bit retval: %d\n", retval)); LOG(logDEBUG1, ("Set counter bit retval: %d\n", retval));
validate(arg, retval, "set counter bit", DEC); validate(arg, retval, "set counter bit", DEC);
#endif #endif
@ -3747,7 +3749,7 @@ int power_chip(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
#if defined(MYTHEN3D) || defined(GOTTHARD2D) #if defined(MYTHEN3D) || defined(GOTTHARD2D)
// check only when powering on // check only when powering on
if (arg != -1 && arg != 0) { if (arg != -1 && arg != 0) {
@ -3783,7 +3785,7 @@ int power_chip(int file_des) {
#ifdef JUNGFRAUD #ifdef JUNGFRAUD
// narrow down error when powering on // narrow down error when powering on
if (ret == FAIL && arg > 0) { if (ret == FAIL && arg > 0) {
if (setTemperatureEvent(-1) == 1) if (setTemperatureEvent(GET_FLAG) == 1)
sprintf(mess, sprintf(mess,
"Powering chip failed due to over-temperature event. " "Powering chip failed due to over-temperature event. "
"Clear event & power chip again. Set %d, read %d \n", "Clear event & power chip again. Set %d, read %d \n",
@ -3810,7 +3812,7 @@ int set_activate(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg >= 0) { if (arg >= 0) {
if (setActivate(arg) == FAIL) { if (setActivate(arg) == FAIL) {
ret = FAIL; ret = FAIL;
@ -3869,7 +3871,7 @@ int threshold_temp(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg > MAX_THRESHOLD_TEMP_VAL) { if (arg > MAX_THRESHOLD_TEMP_VAL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Threshold Temp %d should be in range: 0 - %d\n", arg, sprintf(mess, "Threshold Temp %d should be in range: 0 - %d\n", arg,
@ -3902,7 +3904,7 @@ int temp_control(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = setTemperatureControl(arg); retval = setTemperatureControl(arg);
LOG(logDEBUG1, ("Temperature control: %d\n", retval)); LOG(logDEBUG1, ("Temperature control: %d\n", retval));
validate(arg, retval, "set temperature control", DEC); validate(arg, retval, "set temperature control", DEC);
@ -3926,7 +3928,7 @@ int temp_event(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = setTemperatureEvent(arg); retval = setTemperatureEvent(arg);
LOG(logDEBUG1, ("Temperature event: %d\n", retval)); LOG(logDEBUG1, ("Temperature event: %d\n", retval));
validate(arg, retval, "set temperature event", DEC); validate(arg, retval, "set temperature event", DEC);
@ -3949,7 +3951,7 @@ int auto_comp_disable(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = autoCompDisable(arg); retval = autoCompDisable(arg);
LOG(logDEBUG1, ("Auto comp disable: %d\n", retval)); LOG(logDEBUG1, ("Auto comp disable: %d\n", retval));
validate(arg, retval, "set auto comp disable", DEC); validate(arg, retval, "set auto comp disable", DEC);
@ -3972,7 +3974,7 @@ int storage_cell_start(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg > MAX_STORAGE_CELL_VAL) { if (arg > MAX_STORAGE_CELL_VAL) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Max Storage cell number should not exceed 15\n"); strcpy(mess, "Max Storage cell number should not exceed 15\n");
@ -4092,7 +4094,7 @@ int led(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
retval = setLEDEnable(arg); retval = setLEDEnable(arg);
LOG(logDEBUG1, ("LED Enable: %d\n", retval)); LOG(logDEBUG1, ("LED Enable: %d\n", retval));
validate(arg, retval, "LED Enable", DEC); validate(arg, retval, "LED Enable", DEC);
@ -4386,7 +4388,7 @@ int set_external_sampling_source(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg < -1 || arg > 63) { if (arg < -1 || arg > 63) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
@ -4418,7 +4420,7 @@ int set_external_sampling(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == -1) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
arg = (arg > 0) ? 1 : arg; arg = (arg > 0) ? 1 : arg;
retval = setExternalSampling(arg); retval = setExternalSampling(arg);
LOG(logDEBUG1, ("External Sampling enable: %d\n", retval)); LOG(logDEBUG1, ("External Sampling enable: %d\n", retval));
@ -4663,8 +4665,8 @@ int set_read_n_lines(int file_des) {
MAX_ROWS_PER_READOUT); MAX_ROWS_PER_READOUT);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
int dr = setDynamicRange(-1); int dr = setDynamicRange(GET_FLAG);
int isTenGiga = enableTenGigabitEthernet(-1); int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
unsigned int maxnl = MAX_ROWS_PER_READOUT; unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (isTenGiga ? 4 : 16) * dr; unsigned int maxnp = (isTenGiga ? 4 : 16) * dr;
if ((arg * maxnp) % maxnl) { if ((arg * maxnp) % maxnl) {
@ -6955,7 +6957,7 @@ int get_receiver_parameters(int file_des) {
return printSocketReadError(); return printSocketReadError();
// dynamic range // dynamic range
i32 = setDynamicRange(-1); i32 = setDynamicRange(GET_FLAG);
n += sendData(file_des, &i32, sizeof(i32), INT32); n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
@ -6968,7 +6970,7 @@ int get_receiver_parameters(int file_des) {
// 10 gbe // 10 gbe
#if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
i32 = enableTenGigabitEthernet(-1); i32 = enableTenGigabitEthernet(GET_FLAG);
#else #else
i32 = 0; i32 = 0;
#endif #endif

View File

@ -1186,9 +1186,9 @@ std::string CmdProxy::Threshold(int action) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
det->setThresholdEnergy(StringTo<int>(args[0]), auto t = det->getSettings({det_id}).tsquash(
slsDetectorDefs::GET_SETTINGS, true, "Inconsistent settings between detectors");
{det_id}); det->setThresholdEnergy(StringTo<int>(args[0]), t, true, {det_id});
} else if (args.size() == 2) { } else if (args.size() == 2) {
det->setThresholdEnergy( det->setThresholdEnergy(
StringTo<int>(args[0]), StringTo<int>(args[0]),
@ -1216,9 +1216,9 @@ std::string CmdProxy::ThresholdNoTb(int action) {
throw sls::RuntimeError("cannot get"); throw sls::RuntimeError("cannot get");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
det->setThresholdEnergy(StringTo<int>(args[0]), auto t = det->getSettings({det_id}).tsquash(
slsDetectorDefs::GET_SETTINGS, false, "Inconsistent settings between detectors");
{det_id}); det->setThresholdEnergy(StringTo<int>(args[0]), t, false, {det_id});
} else if (args.size() == 2) { } else if (args.size() == 2) {
det->setThresholdEnergy( det->setThresholdEnergy(
StringTo<int>(args[0]), StringTo<int>(args[0]),

View File

@ -569,7 +569,7 @@ Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
} }
void Detector::setNumberofUDPInterfaces(int n, Positions pos) { void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(); int previouslyClientStreaming = pimpl->getDataStreamingToClient();
bool useReceiver = getUseReceiverFlag().squash(false); bool useReceiver = getUseReceiverFlag().squash(false);
bool previouslyReceiverStreaming = false; bool previouslyReceiverStreaming = false;
if (useReceiver) { if (useReceiver) {
@ -583,8 +583,8 @@ void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
} }
// redo the zmq sockets if enabled // redo the zmq sockets if enabled
if (previouslyClientStreaming != 0) { if (previouslyClientStreaming != 0) {
pimpl->enableDataStreamingToClient(0); pimpl->setDataStreamingToClient(false);
pimpl->enableDataStreamingToClient(1); pimpl->setDataStreamingToClient(true);
} }
if (previouslyReceiverStreaming) { if (previouslyReceiverStreaming) {
setRxZmqDataStream(false, pos); setRxZmqDataStream(false, pos);
@ -995,11 +995,11 @@ Result<IpAddr> Detector::getClientZmqIp(Positions pos) const {
} }
void Detector::setClientZmqIp(const IpAddr ip, Positions pos) { void Detector::setClientZmqIp(const IpAddr ip, Positions pos) {
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1); int previouslyClientStreaming = pimpl->getDataStreamingToClient();
pimpl->Parallel(&Module::setClientStreamingIP, pos, ip); pimpl->Parallel(&Module::setClientStreamingIP, pos, ip);
if (previouslyClientStreaming != 0) { if (previouslyClientStreaming != 0) {
pimpl->enableDataStreamingToClient(0); pimpl->setDataStreamingToClient(false);
pimpl->enableDataStreamingToClient(1); pimpl->setDataStreamingToClient(true);
} }
} }

View File

@ -975,10 +975,11 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage, bool quadEnable,
return imagesize; return imagesize;
} }
bool DetectorImpl::enableDataStreamingToClient(int enable) { bool DetectorImpl::getDataStreamingToClient() { return client_downstream; }
if (enable >= 0) {
void DetectorImpl::setDataStreamingToClient(bool enable) {
// destroy data threads // destroy data threads
if (enable == 0) { if (!enable) {
createReceivingDataSockets(true); createReceivingDataSockets(true);
// create data threads // create data threads
} else { } else {
@ -986,8 +987,6 @@ bool DetectorImpl::enableDataStreamingToClient(int enable) {
throw RuntimeError("Could not create data threads in client."); throw RuntimeError("Could not create data threads in client.");
} }
} }
}
return client_downstream;
} }
void DetectorImpl::registerAcquisitionFinishedCallback(void (*func)(double, int, void DetectorImpl::registerAcquisitionFinishedCallback(void (*func)(double, int,
@ -1003,7 +1002,7 @@ void DetectorImpl::registerDataCallback(void (*userCallback)(detectorData *,
void *pArg) { void *pArg) {
dataReady = userCallback; dataReady = userCallback;
pCallbackArg = pArg; pCallbackArg = pArg;
enableDataStreamingToClient(dataReady == nullptr ? 0 : 1); setDataStreamingToClient(dataReady == nullptr ? false : true);
} }
int DetectorImpl::acquire() { int DetectorImpl::acquire() {

View File

@ -238,12 +238,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
/** [Eiger][Jungfrau] */ /** [Eiger][Jungfrau] */
void setGapPixelsinCallback(const bool enable); void setGapPixelsinCallback(const bool enable);
/** bool getDataStreamingToClient();
* Enable data streaming to client void setDataStreamingToClient(bool enable);
* @param enable 0 to disable, 1 to enable, -1 to get the value
* @returns data streaming to client enable
*/
bool enableDataStreamingToClient(int enable = -1);
/** /**
* register callback for accessing acquisition final data * register callback for accessing acquisition final data

View File

@ -142,7 +142,7 @@ void Module::updateNumberOfDetector(slsDetectorDefs::xy det) {
} }
slsDetectorDefs::detectorSettings Module::getSettings() { slsDetectorDefs::detectorSettings Module::getSettings() {
auto r = sendToDetector<int>(F_SET_SETTINGS, -1); auto r = sendToDetector<int>(F_SET_SETTINGS, GET_FLAG);
return static_cast<detectorSettings>(r); return static_cast<detectorSettings>(r);
} }
@ -176,7 +176,7 @@ void Module::loadSettingsFile(const std::string &fname) {
} }
int Module::getAllTrimbits() { int Module::getAllTrimbits() {
return sendToDetector<int>(F_SET_ALL_TRIMBITS, -1); return sendToDetector<int>(F_SET_ALL_TRIMBITS, GET_FLAG);
} }
void Module::setAllTrimbits(int val) { void Module::setAllTrimbits(int val) {
@ -242,36 +242,27 @@ void Module::setDelayAfterTrigger(int64_t value) {
} }
int64_t Module::getNumberOfFramesLeft() const { int64_t Module::getNumberOfFramesLeft() const {
int64_t retval = -1; return sendToDetectorStop<int64_t>(F_GET_FRAMES_LEFT);
sendToDetectorStop(F_GET_FRAMES_LEFT, nullptr, retval);
return retval;
} }
int64_t Module::getNumberOfTriggersLeft() const { int64_t Module::getNumberOfTriggersLeft() const {
int64_t retval = -1; return sendToDetectorStop<int64_t>(F_GET_TRIGGERS_LEFT);
sendToDetectorStop(F_GET_TRIGGERS_LEFT, nullptr, retval);
return retval;
} }
int64_t Module::getDelayAfterTriggerLeft() const { int64_t Module::getDelayAfterTriggerLeft() const {
int64_t retval = -1; return sendToDetectorStop<int64_t>(F_GET_DELAY_AFTER_TRIGGER_LEFT);
sendToDetectorStop(F_GET_DELAY_AFTER_TRIGGER_LEFT, nullptr, retval);
return retval;
} }
int64_t Module::getPeriodLeft() const { int64_t Module::getPeriodLeft() const {
int64_t retval = -1; return sendToDetectorStop<int64_t>(F_GET_PERIOD_LEFT);
sendToDetectorStop(F_GET_PERIOD_LEFT, nullptr, retval);
return retval;
} }
slsDetectorDefs::timingMode Module::getTimingMode() { slsDetectorDefs::timingMode Module::getTimingMode() {
return sendToDetector<timingMode>(F_SET_TIMING_MODE, -1); return sendToDetector<timingMode>(F_SET_TIMING_MODE, GET_FLAG);
} }
void Module::setTimingMode(timingMode value) { void Module::setTimingMode(timingMode value) {
timingMode retval = GET_TIMING_MODE; sendToDetector<int>(F_SET_TIMING_MODE, static_cast<int>(value));
sendToDetector(F_SET_TIMING_MODE, static_cast<int>(value), retval);
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr); sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
} }
@ -310,7 +301,7 @@ void Module::setClockFrequency(int clkIndex, int value) {
} }
int Module::getDAC(dacIndex index, bool mV) { int Module::getDAC(dacIndex index, bool mV) {
int args[]{static_cast<int>(index), static_cast<int>(mV), -1}; int args[]{static_cast<int>(index), static_cast<int>(mV), GET_FLAG};
return sendToDetector<int>(F_SET_DAC, args); return sendToDetector<int>(F_SET_DAC, args);
} }
@ -320,7 +311,7 @@ void Module::setDAC(int val, dacIndex index, bool mV) {
} }
bool Module::getPowerChip() { bool Module::getPowerChip() {
int arg = -1; int arg = GET_FLAG;
return sendToDetector<int>(F_POWER_CHIP, arg); return sendToDetector<int>(F_POWER_CHIP, arg);
} }
@ -640,17 +631,16 @@ std::string Module::printReceiverConfiguration() {
} }
bool Module::getTenGiga() { bool Module::getTenGiga() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToDetector<int>(F_ENABLE_TEN_GIGA, arg)); return static_cast<bool>(sendToDetector<int>(F_ENABLE_TEN_GIGA, arg));
} }
void Module::setTenGiga(bool value) { void Module::setTenGiga(bool value) {
int arg = static_cast<int>(value); int arg = static_cast<int>(value);
int retval = -1; auto retval = sendToDetector<int>(F_ENABLE_TEN_GIGA, arg);
sendToDetector(F_ENABLE_TEN_GIGA, arg, retval);
sendToDetectorStop<int>(F_ENABLE_TEN_GIGA, arg); sendToDetectorStop<int>(F_ENABLE_TEN_GIGA, arg);
arg = retval; arg = retval;
if (shm()->useReceiverFlag && arg != -1) { if (shm()->useReceiverFlag && arg != GET_FLAG) {
sendToReceiver<int>(F_ENABLE_RECEIVER_TEN_GIGA, arg); sendToReceiver<int>(F_ENABLE_RECEIVER_TEN_GIGA, arg);
} }
} }
@ -769,9 +759,8 @@ int Module::getReceiverPort() const { return shm()->rxTCPPort; }
int Module::setReceiverPort(int port_number) { int Module::setReceiverPort(int port_number) {
if (port_number >= 0 && port_number != shm()->rxTCPPort) { if (port_number >= 0 && port_number != shm()->rxTCPPort) {
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
int retval = -1; shm()->rxTCPPort =
sendToReceiver(F_SET_RECEIVER_PORT, port_number, retval); sendToReceiver<int>(F_SET_RECEIVER_PORT, port_number);
shm()->rxTCPPort = retval;
} else { } else {
shm()->rxTCPPort = port_number; shm()->rxTCPPort = port_number;
} }
@ -780,7 +769,7 @@ int Module::setReceiverPort(int port_number) {
} }
int Module::getReceiverFifoDepth() { int Module::getReceiverFifoDepth() {
int arg = -1; int arg = GET_FLAG;
return sendToReceiver<int>(F_SET_RECEIVER_FIFO_DEPTH, arg); return sendToReceiver<int>(F_SET_RECEIVER_FIFO_DEPTH, arg);
} }
@ -815,7 +804,7 @@ void Module::setPartialFramesPadding(bool padding) {
} }
int64_t Module::getReceiverUDPSocketBufferSize() const { int64_t Module::getReceiverUDPSocketBufferSize() const {
int64_t arg = -1; int64_t arg = GET_FLAG;
return sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE, arg); return sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE, arg);
} }
@ -828,7 +817,7 @@ void Module::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) {
} }
bool Module::getReceiverLock() { bool Module::getReceiverLock() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToReceiver<int>(F_LOCK_RECEIVER, arg)); return static_cast<bool>(sendToReceiver<int>(F_LOCK_RECEIVER, arg));
} }
@ -954,7 +943,7 @@ void Module::setReceiverStreamingFrequency(int freq) {
} }
int Module::getReceiverStreamingTimer() { int Module::getReceiverStreamingTimer() {
int arg = -1; int arg = GET_FLAG;
return sendToReceiver<int>(F_RECEIVER_STREAMING_TIMER, arg); return sendToReceiver<int>(F_RECEIVER_STREAMING_TIMER, arg);
} }
@ -1001,7 +990,7 @@ void Module::setClientStreamingIP(const sls::IpAddr ip) {
// Eiger Specific // Eiger Specific
int Module::getDynamicRange() { int Module::getDynamicRange() {
return sendToDetector<int>(F_SET_DYNAMIC_RANGE, -1); return sendToDetector<int>(F_SET_DYNAMIC_RANGE, GET_FLAG);
} }
void Module::setDynamicRange(int n) { void Module::setDynamicRange(int n) {
@ -1120,7 +1109,7 @@ void Module::setOverFlowMode(const bool enable) {
} }
bool Module::getFlippedDataX() { bool Module::getFlippedDataX() {
return sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, -1); return sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, GET_FLAG);
} }
void Module::setFlippedDataX(bool value) { void Module::setFlippedDataX(bool value) {
@ -1191,7 +1180,7 @@ int64_t Module::getMeasuredSubFramePeriod() const {
} }
bool Module::getActivate() { bool Module::getActivate() {
int arg = -1; int arg = GET_FLAG;
auto retval = sendToDetector<int>(F_ACTIVATE, arg); auto retval = sendToDetector<int>(F_ACTIVATE, arg);
auto retval2 = sendToDetectorStop<int>(F_ACTIVATE, arg); auto retval2 = sendToDetectorStop<int>(F_ACTIVATE, arg);
if (retval != retval2) { if (retval != retval2) {
@ -1222,7 +1211,7 @@ void Module::setDeactivatedRxrPaddingMode(bool padding) {
} }
bool Module::getCounterBit() { bool Module::getCounterBit() {
int arg = -1; int arg = GET_FLAG;
return (!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, arg))); return (!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, arg)));
} }
@ -1257,7 +1246,7 @@ void Module::setQuad(const bool enable) {
// Jungfrau Specific // Jungfrau Specific
int Module::getThresholdTemperature() { int Module::getThresholdTemperature() {
int arg = -1; int arg = GET_FLAG;
auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, arg); auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, arg);
if (retval != 0) { if (retval != 0) {
retval /= 1000; retval /= 1000;
@ -1275,7 +1264,7 @@ void Module::setThresholdTemperature(int val) {
} }
bool Module::getTemperatureControl() { bool Module::getTemperatureControl() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToDetectorStop<int>(F_TEMP_CONTROL, arg)); return static_cast<bool>(sendToDetectorStop<int>(F_TEMP_CONTROL, arg));
} }
@ -1284,7 +1273,7 @@ void Module::setTemperatureControl(bool val) {
} }
int Module::getTemperatureEvent() { int Module::getTemperatureEvent() {
int arg = -1; int arg = GET_FLAG;
return sendToDetectorStop<int>(F_TEMP_EVENT, arg); return sendToDetectorStop<int>(F_TEMP_EVENT, arg);
} }
@ -1294,7 +1283,7 @@ void Module::resetTemperatureEvent() {
} }
bool Module::getAutoComparatorDisableMode() { bool Module::getAutoComparatorDisableMode() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToDetector<int>(F_AUTO_COMP_DISABLE, arg)); return static_cast<bool>(sendToDetector<int>(F_AUTO_COMP_DISABLE, arg));
} }
@ -1311,7 +1300,7 @@ void Module::setNumberOfAdditionalStorageCells(int value) {
} }
int Module::getStorageCellStart() { int Module::getStorageCellStart() {
int arg = -1; int arg = GET_FLAG;
return sendToDetector<int>(F_STORAGE_CELL_START, arg); return sendToDetector<int>(F_STORAGE_CELL_START, arg);
} }
@ -1696,7 +1685,7 @@ void Module::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
} }
int Module::getExternalSamplingSource() { int Module::getExternalSamplingSource() {
return setExternalSamplingSource(-1); return setExternalSamplingSource(GET_FLAG);
} }
int Module::setExternalSamplingSource(int value) { int Module::setExternalSamplingSource(int value) {
@ -1704,7 +1693,7 @@ int Module::setExternalSamplingSource(int value) {
} }
bool Module::getExternalSampling() { bool Module::getExternalSampling() {
int arg = -1; int arg = GET_FLAG;
return sendToDetector<int>(F_EXTERNAL_SAMPLING, arg); return sendToDetector<int>(F_EXTERNAL_SAMPLING, arg);
} }
@ -1746,7 +1735,7 @@ void Module::setDigitalIODelay(uint64_t pinMask, int delay) {
} }
bool Module::getLEDEnable() { bool Module::getLEDEnable() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToDetector<int>(F_LED, arg)); return static_cast<bool>(sendToDetector<int>(F_LED, arg));
} }
@ -1773,7 +1762,7 @@ void Module::setPattern(const std::string &fname) {
} }
uint64_t Module::getPatternIOControl() { uint64_t Module::getPatternIOControl() {
int64_t arg = -1; int64_t arg = GET_FLAG;
return sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL, arg); return sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL, arg);
} }
@ -1782,7 +1771,7 @@ void Module::setPatternIOControl(uint64_t word) {
} }
uint64_t Module::getPatternClockControl() { uint64_t Module::getPatternClockControl() {
int64_t arg = -1; int64_t arg = GET_FLAG;
return sendToDetector<uint64_t>(F_SET_PATTERN_CLOCK_CONTROL, arg); return sendToDetector<uint64_t>(F_SET_PATTERN_CLOCK_CONTROL, arg);
} }
@ -1791,7 +1780,8 @@ void Module::setPatternClockControl(uint64_t word) {
} }
uint64_t Module::getPatternWord(int addr) { uint64_t Module::getPatternWord(int addr) {
uint64_t args[]{static_cast<uint64_t>(addr), static_cast<uint64_t>(-1)}; uint64_t args[]{static_cast<uint64_t>(addr),
static_cast<uint64_t>(GET_FLAG)};
return sendToDetector<uint64_t>(F_SET_PATTERN_WORD, args); return sendToDetector<uint64_t>(F_SET_PATTERN_WORD, args);
} }
@ -1801,7 +1791,7 @@ void Module::setPatternWord(int addr, uint64_t word) {
} }
std::array<int, 2> Module::getPatternLoopAddresses(int level) { std::array<int, 2> Module::getPatternLoopAddresses(int level) {
int args[]{level, -1, -1}; int args[]{level, GET_FLAG, GET_FLAG};
std::array<int, 2> retvals{}; std::array<int, 2> retvals{};
sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals); sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals);
return retvals; return retvals;
@ -1814,7 +1804,7 @@ void Module::setPatternLoopAddresses(int level, int start, int stop) {
} }
int Module::getPatternLoopCycles(int level) { int Module::getPatternLoopCycles(int level) {
int args[]{level, -1}; int args[]{level, GET_FLAG};
return sendToDetector<int>(F_SET_PATTERN_LOOP_CYCLES, args); return sendToDetector<int>(F_SET_PATTERN_LOOP_CYCLES, args);
} }
@ -1824,7 +1814,7 @@ void Module::setPatternLoopCycles(int level, int n) {
} }
int Module::getPatternWaitAddr(int level) { int Module::getPatternWaitAddr(int level) {
int args[]{level, -1}; int args[]{level, GET_FLAG};
return sendToDetector<int>(F_SET_PATTERN_WAIT_ADDR, args); return sendToDetector<int>(F_SET_PATTERN_WAIT_ADDR, args);
} }
@ -1834,7 +1824,8 @@ void Module::setPatternWaitAddr(int level, int addr) {
} }
uint64_t Module::getPatternWaitTime(int level) { uint64_t Module::getPatternWaitTime(int level) {
uint64_t args[]{static_cast<uint64_t>(level), static_cast<uint64_t>(-1)}; uint64_t args[]{static_cast<uint64_t>(level),
static_cast<uint64_t>(GET_FLAG)};
return sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_TIME, args); return sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_TIME, args);
} }
@ -2069,7 +2060,7 @@ int Module::setStopPort(int port_number) {
} }
bool Module::getLockDetector() { bool Module::getLockDetector() {
int arg = -1; int arg = GET_FLAG;
return static_cast<bool>(sendToDetector<int>(F_LOCK_SERVER, arg)); return static_cast<bool>(sendToDetector<int>(F_LOCK_SERVER, arg));
} }
@ -2618,10 +2609,6 @@ void Module::updateRateCorrection() {
void Module::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, void Module::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
bool trimbits) { bool trimbits) {
// if settings provided, use that, else use the shared memory variable
detectorSettings is =
((isettings != GET_SETTINGS) ? isettings : getSettings());
// verify e_eV exists in trimEneregies[] // verify e_eV exists in trimEneregies[]
if (shm()->trimEnergies.empty() || (e_eV < shm()->trimEnergies.front()) || if (shm()->trimEnergies.empty() || (e_eV < shm()->trimEnergies.front()) ||
(e_eV > shm()->trimEnergies.back())) { (e_eV > shm()->trimEnergies.back())) {
@ -2636,7 +2623,7 @@ void Module::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
sls_detector_module myMod{shm()->myDetectorType}; sls_detector_module myMod{shm()->myDetectorType};
if (!interpolate) { if (!interpolate) {
std::string settingsfname = getTrimbitFilename(is, e_eV); std::string settingsfname = getTrimbitFilename(isettings, e_eV);
LOG(logDEBUG1) << "Settings File is " << settingsfname; LOG(logDEBUG1) << "Settings File is " << settingsfname;
myMod = readSettingsFile(settingsfname, trimbits); myMod = readSettingsFile(settingsfname, trimbits);
} else { } else {
@ -2649,8 +2636,8 @@ void Module::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
break; break;
} }
} }
std::string settingsfname1 = getTrimbitFilename(is, trim1); std::string settingsfname1 = getTrimbitFilename(isettings, trim1);
std::string settingsfname2 = getTrimbitFilename(is, trim2); std::string settingsfname2 = getTrimbitFilename(isettings, trim2);
LOG(logDEBUG1) << "Settings Files are " << settingsfname1 << " and " LOG(logDEBUG1) << "Settings Files are " << settingsfname1 << " and "
<< settingsfname2; << settingsfname2;
auto myMod1 = readSettingsFile(settingsfname1, trimbits); auto myMod1 = readSettingsFile(settingsfname1, trimbits);
@ -2665,10 +2652,10 @@ void Module::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings,
linearInterpolation(e_eV, trim1, trim2, myMod1.tau, myMod2.tau); linearInterpolation(e_eV, trim1, trim2, myMod1.tau, myMod2.tau);
} }
myMod.reg = is; myMod.reg = isettings;
myMod.eV = e_eV; myMod.eV = e_eV;
setModule(myMod, trimbits); setModule(myMod, trimbits);
if (getSettings() != is) { if (getSettings() != isettings) {
throw RuntimeError("setThresholdEnergyAndSettings: Could not set " throw RuntimeError("setThresholdEnergyAndSettings: Could not set "
"settings in detector"); "settings in detector");
} }

View File

@ -293,8 +293,8 @@ class Module : public virtual slsDetectorDefs {
int64_t getSubDeadTime(); int64_t getSubDeadTime();
void setSubDeadTime(int64_t value); void setSubDeadTime(int64_t value);
int getThresholdEnergy(); int getThresholdEnergy();
void setThresholdEnergy(int e_eV, detectorSettings isettings = GET_SETTINGS, void setThresholdEnergy(int e_eV, detectorSettings isettings,
bool trimbits = true); bool trimbits);
std::string getSettingsDir(); std::string getSettingsDir();
std::string setSettingsDir(const std::string &dir); std::string setSettingsDir(const std::string &dir);
bool getParallelMode(); bool getParallelMode();

View File

@ -1088,8 +1088,7 @@ int ClientInterface::set_flipped_data(Interface &socket) {
} }
int ClientInterface::set_file_format(Interface &socket) { int ClientInterface::set_file_format(Interface &socket) {
fileFormat f = GET_FILE_FORMAT; auto f = socket.Receive<fileFormat>();
socket.Receive(f);
if (f < 0 || f > NUM_FILE_FORMATS) { if (f < 0 || f > NUM_FILE_FORMATS) {
throw RuntimeError("Invalid file format: " + std::to_string(f)); throw RuntimeError("Invalid file format: " + std::to_string(f));
} }

View File

@ -50,7 +50,6 @@
/** maximum unit size of program sent to detector */ /** maximum unit size of program sent to detector */
#define MAX_FPGAPROGRAMSIZE (2 * 1024 * 1024) #define MAX_FPGAPROGRAMSIZE (2 * 1024 * 1024)
/** get flag form most functions */
#define GET_FLAG -1 #define GET_FLAG -1
#define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee" #define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee"
@ -73,7 +72,6 @@ class slsDetectorDefs {
/** Type of the detector */ /** Type of the detector */
enum detectorType { enum detectorType {
GET_DETECTOR_TYPE = -1,
GENERIC, GENERIC,
EIGER, EIGER,
GOTTHARD, GOTTHARD,
@ -85,20 +83,17 @@ class slsDetectorDefs {
}; };
/** return values */ /** return values */
enum { enum { OK, FAIL };
OK, /**< function succeeded */
FAIL /**< function failed */
};
/** staus mask */ /** staus mask */
enum runStatus { enum runStatus {
IDLE, /**< detector ready to start acquisition - no data in memory */ IDLE,
ERROR, /**< error i.e. normally fifo full */ ERROR,
WAITING, /**< waiting for trigger or gate signal */ WAITING,
RUN_FINISHED, /**< acquisition not running but data in memory */ RUN_FINISHED,
TRANSMITTING, /**< acquisition running and data in memory */ TRANSMITTING,
RUNNING, /**< acquisition running, no data in memory */ RUNNING,
STOPPED /**< acquisition stopped externally */ STOPPED
}; };
/** /**
@ -121,22 +116,19 @@ class slsDetectorDefs {
*/ */
typedef struct { typedef struct {
uint64_t frameNumber; /**< is the frame number */ uint64_t frameNumber;
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real uint32_t expLength;
time exposure time in 100ns (others) */ uint32_t packetNumber;
uint32_t packetNumber; /**< is the packet number */ uint64_t bunchId;
uint64_t bunchId; /**< is the bunch id from beamline */ uint64_t timestamp;
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */ uint16_t modId;
uint16_t modId; /**< is the unique module id (unique even for left, uint16_t row;
right, top, bottom) */ uint16_t column;
uint16_t row; /**< is the row index in the complete detector system */ uint16_t reserved;
uint16_t uint32_t debug;
column; /**< is the column index in the complete detector system */ uint16_t roundRNumber;
uint16_t reserved; /**< is reserved */ uint8_t detType;
uint32_t debug; /**< is for debugging purposes */ uint8_t version;
uint16_t roundRNumber; /**< is the round robin set number */
uint8_t detType; /**< is the detector type see :: detectorType */
uint8_t version; /**< is the version number of this structure format */
} sls_detector_header; } sls_detector_header;
#ifdef __cplusplus #ifdef __cplusplus
@ -149,37 +141,27 @@ class slsDetectorDefs {
}; };
#endif #endif
enum frameDiscardPolicy { enum frameDiscardPolicy {
GET_FRAME_DISCARD_POLICY = -1, /**< to get the missing packet mode */ NO_DISCARD,
NO_DISCARD, /**< pad incomplete packets with -1, default mode */ DISCARD_EMPTY_FRAMES,
DISCARD_EMPTY_FRAMES, /**< discard incomplete frames, fastest mode, save DISCARD_PARTIAL_FRAMES,
space, not suitable for multiple modules */
DISCARD_PARTIAL_FRAMES, /**< ignore missing packets, must check with
packetsMask for data integrity, fast mode and
suitable for multiple modules */
NUM_DISCARD_POLICIES NUM_DISCARD_POLICIES
}; };
enum fileFormat { enum fileFormat { BINARY, HDF5, NUM_FILE_FORMATS };
GET_FILE_FORMAT = -1, /**< the receiver will return its file format */
BINARY, /**< binary format */
HDF5, /**< hdf5 format */
NUM_FILE_FORMATS
};
/** /**
@short structure for a region of interest @short structure for a region of interest
xmin,xmax,ymin,ymax define the limits of the region xmin,xmax,ymin,ymax define the limits of the region
*/ */
#ifdef __cplusplus #ifdef __cplusplus
struct ROI { struct ROI {
int xmin{-1}; /**< is the roi xmin (in channel number) */ int xmin{-1};
int xmax{-1}; /**< is the roi xmax (in channel number)*/ int xmax{-1};
} __attribute__((packed)); } __attribute__((packed));
#else #else
typedef struct { typedef struct {
int xmin; /**< is the roi xmin (in channel number) */ int xmin;
int xmax; /**< is the roi xmax (in channel number)*/ int xmax;
} ROI; } ROI;
#endif #endif
@ -191,10 +173,7 @@ typedef struct {
/** /**
dimension indexes dimension indexes
*/ */
enum dimension { enum dimension { X, Y };
X = 0, /**< X dimension */
Y = 1 /**< Y dimension */
};
#ifdef __cplusplus #ifdef __cplusplus
struct xy { struct xy {
@ -219,12 +198,11 @@ typedef struct {
communication mode using external signals communication mode using external signals
*/ */
enum timingMode { enum timingMode {
GET_TIMING_MODE = -1, /**<return flag for communication mode */ AUTO_TIMING,
AUTO_TIMING, /**< internal timing */ TRIGGER_EXPOSURE,
TRIGGER_EXPOSURE, /**< trigger mode i.e. exposure is triggered */ GATED,
GATED, /**< gated */ BURST_TRIGGER,
BURST_TRIGGER, /**< trigger a burst of frames */ TRIGGER_GATED,
TRIGGER_GATED, /**< trigger and gating */
NUM_TIMING_MODES NUM_TIMING_MODES
}; };
@ -350,7 +328,6 @@ typedef struct {
detector settings indexes detector settings indexes
*/ */
enum detectorSettings { enum detectorSettings {
GET_SETTINGS = -1,
STANDARD, STANDARD,
FAST, FAST,
HIGHGAIN, HIGHGAIN,
@ -372,8 +349,8 @@ typedef struct {
G2_LOWCAP_LOWGAIN, G2_LOWCAP_LOWGAIN,
G4_HIGHGAIN, G4_HIGHGAIN,
G4_LOWGAIN, G4_LOWGAIN,
UNDEFINED = 200, /**< undefined or custom settings */ UNDEFINED = 200,
UNINITIALIZED /**< uninitialiazed (status at startup) */ UNINITIALIZED
}; };
#define TRIMBITMASK 0x3f #define TRIMBITMASK 0x3f
@ -388,41 +365,18 @@ typedef struct {
/** chip speed */ /** chip speed */
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED }; enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED };
/** port type */
enum portType {
CONTROL_PORT, /**< control port */
STOP_PORT, /**<stop port */
DATA_PORT /**< receiver tcp port with client*/
};
/** hierarchy in multi-detector structure, if any */ /** hierarchy in multi-detector structure, if any */
enum masterFlags { enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE };
GET_MASTER = -1, /**< return master flag */
NO_MASTER, /**< no master/slave hierarchy defined */
IS_MASTER, /**<is master */
IS_SLAVE /**< is slave */
};
/** /**
* frame mode for processor * frame mode for processor
*/ */
enum frameModeType { enum frameModeType { PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD };
GET_FRAME_MODE = -1,
PEDESTAL, /** < pedestal */
NEW_PEDESTAL, /** < new pedestal */
FLATFIELD, /** < flatfield */
NEW_FLATFIELD /** < new flatfield */
};
/** /**
* detector mode for processor * detector mode for processor
*/ */
enum detectorModeType { enum detectorModeType { COUNTING, INTERPOLATING, ANALOG };
GET_DETECTOR_MODE = -1,
COUNTING, /** < counting */
INTERPOLATING, /** < interpolating */
ANALOG /** < analog */
};
/** /**
* burst mode for gotthard2 * burst mode for gotthard2

View File

@ -9,4 +9,4 @@
#define APIGOTTHARD2 0x200618 #define APIGOTTHARD2 0x200618
#define APIJUNGFRAU 0x200618 #define APIJUNGFRAU 0x200618
#define APIMYTHEN3 0x200618 #define APIMYTHEN3 0x200618
#define APIMOENCH 0x200615 #define APIMOENCH 0x200618