mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
client: added command line and for APIfor framemode and detectormode. Refactorinng required in the future
This commit is contained in:
@ -1956,6 +1956,27 @@ std::string multiSlsDetector::getAdditionalJsonParameter(const std::string& key,
|
|||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int multiSlsDetector::setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value, int detPos) {
|
||||||
|
// single
|
||||||
|
if (detPos >= 0) {
|
||||||
|
return detectors[detPos]->setAdditionalJsonSpecificParameter(mode, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi
|
||||||
|
auto r = parallelCall(&slsDetector::setAdditionalJsonSpecificParameter, mode, value);
|
||||||
|
return sls::minusOneIfDifferent(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
int multiSlsDetector::getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int detPos) {
|
||||||
|
// single
|
||||||
|
if (detPos >= 0) {
|
||||||
|
return detectors[detPos]->getAdditionalJsonSpecificParameter(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// multi
|
||||||
|
auto r = serialCall(&slsDetector::getAdditionalJsonSpecificParameter, mode);
|
||||||
|
return sls::minusOneIfDifferent(r);
|
||||||
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize, int detPos) {
|
int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize, int detPos) {
|
||||||
// single
|
// single
|
||||||
|
@ -1087,6 +1087,23 @@ class multiSlsDetector : public virtual slsDetectorDefs,
|
|||||||
*/
|
*/
|
||||||
std::string getAdditionalJsonParameter(const std::string& key, int detPos = -1);
|
std::string getAdditionalJsonParameter(const std::string& key, int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for a specific additional json header parameter
|
||||||
|
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
|
||||||
|
* @param value to set the parameter to, json_readout_mode and json_detector_mode can have only have values from jsonReadoutModeType or jsonDetectorModeType
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
* @returns the specific additional json header parameter value or enum
|
||||||
|
*/
|
||||||
|
int setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value, int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the specific additional json header parameter value
|
||||||
|
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
* @returns the specific additional json header parameter value or enum
|
||||||
|
*/
|
||||||
|
int getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver UDP socket buffer size
|
* Sets the receiver UDP socket buffer size
|
||||||
* @param udpsockbufsize additional json header
|
* @param udpsockbufsize additional json header
|
||||||
|
@ -2729,6 +2729,84 @@ std::string slsDetector::getAdditionalJsonParameter(const std::string& key) {
|
|||||||
return std::string("");
|
return std::string("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsDetector::validateSpecificJsonParameterValue(jsonHeaderParameterType mode, int value) {
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
|
||||||
|
case JSON_EMIN:
|
||||||
|
case JSON_EMAX:
|
||||||
|
return OK;
|
||||||
|
|
||||||
|
case JSON_FRAME_MODE:
|
||||||
|
switch (value) {
|
||||||
|
case JSON_PEDESTAL:
|
||||||
|
case JSON_N_PEDESTAL:
|
||||||
|
case JSON_FLATFIELD:
|
||||||
|
case JSON_N_FLATFIELD:
|
||||||
|
case JSON_FRAME:
|
||||||
|
return OK;
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
case JSON_DETECTOR_MODE:
|
||||||
|
switch (value) {
|
||||||
|
case JSON_ANALOG:
|
||||||
|
case JSON_COUNTING:
|
||||||
|
case JSON_INTERPOLATING:
|
||||||
|
return OK;
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR) << "Unkown Json Parameter Type " << mode;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsDetector::setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value) {
|
||||||
|
|
||||||
|
if (validateSpecificJsonParameterValue(mode, value) == FAIL) {
|
||||||
|
FILE_LOG(logERROR) << "Unknown mode " << value << " to set detector mode for json header";
|
||||||
|
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
|
||||||
|
return getAdditionalJsonSpecificParameter(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string smode = getJsonHeaderParameterTypeAsString(mode);
|
||||||
|
std::string sval;
|
||||||
|
if (mode == JSON_EMIN || mode == JSON_EMAX)
|
||||||
|
sval = std::to_string(value);
|
||||||
|
else
|
||||||
|
sval = getJsonHeaderParameterValueAsString((jsonHeaderParameterValuesType)value);
|
||||||
|
setAdditionalJsonParameter(smode, sval);
|
||||||
|
return getAdditionalJsonSpecificParameter(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsDetector::getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode) {
|
||||||
|
std::string smode = getJsonHeaderParameterTypeAsString(mode);
|
||||||
|
std::string sval = getAdditionalJsonParameter(smode);
|
||||||
|
|
||||||
|
int val = 0;
|
||||||
|
if (mode == JSON_EMIN || mode == JSON_EMAX) {
|
||||||
|
try{
|
||||||
|
val = stoi(sval);
|
||||||
|
} catch(...) {
|
||||||
|
FILE_LOG(logERROR) << "json emin or emax set to a string. Fix additional json header";
|
||||||
|
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
val = getJsonHeaderParameterValuesAsEnum(sval);
|
||||||
|
|
||||||
|
if (validateSpecificJsonParameterValue(mode, val) == FAIL) {
|
||||||
|
FILE_LOG(logERROR) << "Unknown mode " << val << "(" <<sval << ") retrieved from detector mode for json header";
|
||||||
|
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
|
int slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
|
||||||
int fnum = F_RECEIVER_UDP_SOCK_BUF_SIZE;
|
int fnum = F_RECEIVER_UDP_SOCK_BUF_SIZE;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
|
@ -994,6 +994,28 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::string getAdditionalJsonParameter(const std::string& key);
|
std::string getAdditionalJsonParameter(const std::string& key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the value parsed for the corresponding parameter type
|
||||||
|
* @param mode specific parameter type
|
||||||
|
* @value value enum of the value
|
||||||
|
*/
|
||||||
|
int validateSpecificJsonParameterValue(jsonHeaderParameterType mode, int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for a specific additional json header parameter
|
||||||
|
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
|
||||||
|
* @param value to set the parameter to, json_readout_mode and json_detector_mode can have only have values from jsonReadoutModeType or jsonDetectorModeType
|
||||||
|
* @returns the specific additional json header parameter value or enum
|
||||||
|
*/
|
||||||
|
int setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the specific additional json header parameter value
|
||||||
|
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
|
||||||
|
* @returns the specific additional json header parameter value or enum
|
||||||
|
*/
|
||||||
|
int getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver UDP socket buffer size
|
* Sets the receiver UDP socket buffer size
|
||||||
* @param udpsockbufsize additional json header
|
* @param udpsockbufsize additional json header
|
||||||
|
@ -63,7 +63,7 @@ The commands are sudivided into different pages depending on their functionaliti
|
|||||||
- \ref output "Output": commands to define output file destination and format
|
- \ref output "Output": commands to define output file destination and format
|
||||||
- \ref network "Network": commands to setup the network between client, detector and receiver
|
- \ref network "Network": commands to setup the network between client, detector and receiver
|
||||||
- \ref receiver "Receiver": commands to configure the receiver
|
- \ref receiver "Receiver": commands to configure the receiver
|
||||||
- \ref ctb "Chiptest board": commands specific for the new chiptest board as pattern generator
|
- \ref prototype "Prototype (Chip Test Board / Moench)": commands specific for the chiptest board or moench
|
||||||
- \ref test "Developer": commands to be used only for software debugging. Avoid using them!
|
- \ref test "Developer": commands to be used only for software debugging. Avoid using them!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -1633,20 +1633,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
/*! \page network
|
|
||||||
- <b>rx_jsonaddheader [t]</b> sets/gets additional json header to be streamed out with the zmq from receiver. Default is empty. \c t must be in the format "\"label1\":\"value1\",\"label2\":\"value2\"" etc. Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "rx_jsonaddheader"; //
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
/*! \page network
|
|
||||||
- <b>rx_jsonpara [k] [v]</b> sets/gets value v for additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "rx_jsonpara"; //
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
/*! \page network
|
/*! \page network
|
||||||
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
@ -1793,146 +1779,190 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
/*! \page receiver
|
||||||
|
- <b>rx_jsonaddheader [t]</b> sets/gets additional json header to be streamed out with the zmq from receiver. Default is empty. \c t must be in the format "\"label1\":\"value1\",\"label2\":\"value2\"" etc. Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "rx_jsonaddheader"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
/*! \page receiver
|
||||||
|
- <b>rx_jsonpara [k] [v]</b> sets/gets value v for additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "rx_jsonpara"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
/* pattern generator */
|
/* pattern generator */
|
||||||
|
|
||||||
/*! \page ctb Chiptest board
|
/*! \page prototype Protoype (Chip Test Board / Moench)
|
||||||
Commands specific for the new chiptest board as pattern generator
|
Commands specific for the chiptest board or moench
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \page ctb
|
|
||||||
|
/*! \page prototype
|
||||||
- <b>adcinvert [mask]</b> Sets/gets ADC inversion mask (8 digits hex format)
|
- <b>adcinvert [mask]</b> Sets/gets ADC inversion mask (8 digits hex format)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "adcinvert"; //
|
descrToFuncMap[i].m_pFuncName = "adcinvert"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>adcdisable [mask]</b> Sets/gets ADC disable mask (8 digits hex format)
|
- <b>adcdisable [mask]</b> Sets/gets ADC disable mask (8 digits hex format)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "adcdisable"; //
|
descrToFuncMap[i].m_pFuncName = "adcdisable"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
|
- <b>json_emin [i] </b> Sets/gets detector minimum energy threshold for the Moench (soft setting). It is only set in the json header for the processor. \c Returns string
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "json_emin"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
/*! \page prototype
|
||||||
|
- <b>json_emax [i] </b> Sets/gets detector maximum energy threshold for the Moench (soft setting). It is only set in the json header for the processor. \c Returns string
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "json_emax"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
/*! \page prototype
|
||||||
|
- <b>json_framemode [i] </b> Sets/gets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. \c Returns string
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "json_framemode"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
/*! \page prototype
|
||||||
|
- <b>json_detectormode [i] </b> Sets/gets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. \c Returns string
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "json_detectormode"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
/*! \page prototype
|
||||||
- <b>pattern fn</b> loads binary pattern file fn
|
- <b>pattern fn</b> loads binary pattern file fn
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "pattern"; //
|
descrToFuncMap[i].m_pFuncName = "pattern"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patword addr [word]</b> sets/gets 64 bit word at address addr of pattern memory. Both address and word in hex format. Advanced!
|
- <b>patword addr [word]</b> sets/gets 64 bit word at address addr of pattern memory. Both address and word in hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patword"; //
|
descrToFuncMap[i].m_pFuncName = "patword"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patioctrl [word]</b> sets/gets 64 bit mask defining input (0) and output (1) signals. hex format.
|
- <b>patioctrl [word]</b> sets/gets 64 bit mask defining input (0) and output (1) signals. hex format.
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patioctrl"; //
|
descrToFuncMap[i].m_pFuncName = "patioctrl"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patclkctrl [word]</b> sets/gets 64 bit mask defining if output signal is a clock and runs. hex format. Unused at the moment.
|
- <b>patclkctrl [word]</b> sets/gets 64 bit mask defining if output signal is a clock and runs. hex format. Unused at the moment.
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patclkctrl"; //
|
descrToFuncMap[i].m_pFuncName = "patclkctrl"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patlimits [addr1 addr2]</b> sets/gets the start and stop limits of the pattern to be executed. hex format. Advanced!
|
- <b>patlimits [addr1 addr2]</b> sets/gets the start and stop limits of the pattern to be executed. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patlimits"; //
|
descrToFuncMap[i].m_pFuncName = "patlimits"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patloop0 [addr1 addr2]</b> sets/gets the start and stop limits of the level 0 loop. hex format. Advanced!
|
- <b>patloop0 [addr1 addr2]</b> sets/gets the start and stop limits of the level 0 loop. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop0"; //
|
descrToFuncMap[i].m_pFuncName = "patloop0"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patnloop0 [n]</b> sets/gets the number of cyclesof the level 0 loop (int).
|
- <b>patnloop0 [n]</b> sets/gets the number of cyclesof the level 0 loop (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop0"; //
|
descrToFuncMap[i].m_pFuncName = "patnloop0"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwait0 [addr]</b> sets/gets the address of the level 0 wait point. hex format. Advanced!
|
- <b>patwait0 [addr]</b> sets/gets the address of the level 0 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwait0"; //
|
descrToFuncMap[i].m_pFuncName = "patwait0"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwaittime0 [n]</b> sets/gets the duration of the witing of the 0 waiting point in clock cycles (int).
|
- <b>patwaittime0 [n]</b> sets/gets the duration of the witing of the 0 waiting point in clock cycles (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwaittime0"; //
|
descrToFuncMap[i].m_pFuncName = "patwaittime0"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patloop1 [addr1 addr2]</b> sets/gets the start and stop limits of the level 1 loop. hex format. Advanced!
|
- <b>patloop1 [addr1 addr2]</b> sets/gets the start and stop limits of the level 1 loop. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop1"; //
|
descrToFuncMap[i].m_pFuncName = "patloop1"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patnloop1 [n]</b> sets/gets the number of cyclesof the level 1 loop (int).
|
- <b>patnloop1 [n]</b> sets/gets the number of cyclesof the level 1 loop (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop1"; //
|
descrToFuncMap[i].m_pFuncName = "patnloop1"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwait1 [addr]</b> sets/gets the address of the level 1 wait point. hex format. Advanced!
|
- <b>patwait1 [addr]</b> sets/gets the address of the level 1 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwait1"; //
|
descrToFuncMap[i].m_pFuncName = "patwait1"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwaittime1 [n]</b> sets/gets the duration of the witing of the 1 waiting point in clock cycles (int).
|
- <b>patwaittime1 [n]</b> sets/gets the duration of the witing of the 1 waiting point in clock cycles (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwaittime1"; //
|
descrToFuncMap[i].m_pFuncName = "patwaittime1"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patloop2 [addr1 addr2]</b> sets/gets the start and stop limits of the level 2 loop. hex format. Advanced!
|
- <b>patloop2 [addr1 addr2]</b> sets/gets the start and stop limits of the level 2 loop. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop2"; //
|
descrToFuncMap[i].m_pFuncName = "patloop2"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patnloop2 [n]</b> sets/gets the number of cyclesof the level 2 loop (int).
|
- <b>patnloop2 [n]</b> sets/gets the number of cyclesof the level 2 loop (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop2"; //
|
descrToFuncMap[i].m_pFuncName = "patnloop2"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwait2 [addr]</b> sets/gets the address of the level 2 wait point. hex format. Advanced!
|
- <b>patwait2 [addr]</b> sets/gets the address of the level 2 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwait2"; //
|
descrToFuncMap[i].m_pFuncName = "patwait2"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>patwaittime2 [n]</b> sets/gets the duration of the waiting of the 2 waiting point in clock cycles (int).
|
- <b>patwaittime2 [n]</b> sets/gets the duration of the waiting of the 2 waiting point in clock cycles (int).
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "patwaittime2"; //
|
descrToFuncMap[i].m_pFuncName = "patwaittime2"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page ctb
|
/*! \page prototype
|
||||||
- <b>dut_clk [i]</b> sets/gets the signal to be used as a clock for the digital data coming from the device under test. Advanced!
|
- <b>dut_clk [i]</b> sets/gets the signal to be used as a clock for the digital data coming from the device under test. Advanced!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "dut_clk"; //
|
descrToFuncMap[i].m_pFuncName = "dut_clk"; //
|
||||||
@ -2846,16 +2876,6 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int
|
|||||||
myDet->setReceiverDataStreamingOutIP(args[1], detPos);
|
myDet->setReceiverDataStreamingOutIP(args[1], detPos);
|
||||||
}
|
}
|
||||||
return myDet->getReceiverStreamingIP(detPos);
|
return myDet->getReceiverStreamingIP(detPos);
|
||||||
} else if (cmd == "rx_jsonaddheader") {
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
myDet->setAdditionalJsonHeader(args[1], detPos);
|
|
||||||
}
|
|
||||||
return myDet->getAdditionalJsonHeader(detPos);
|
|
||||||
} else if (cmd == "rx_jsonpara") {
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
myDet->setAdditionalJsonParameter(args[1], args[2], detPos);
|
|
||||||
}
|
|
||||||
return myDet->getAdditionalJsonParameter(args[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ("unknown network parameter") + cmd;
|
return ("unknown network parameter") + cmd;
|
||||||
@ -2892,11 +2912,6 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
|||||||
"Default is ip of rx_hostname and works for GUI. This is usually used to stream out to an external process for further processing."
|
"Default is ip of rx_hostname and works for GUI. This is usually used to stream out to an external process for further processing."
|
||||||
"restarts streaming in receiver with new port"
|
"restarts streaming in receiver with new port"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
|
|
||||||
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
|
||||||
"Use only if it needs to be processed by an intermediate process."
|
|
||||||
<< std::endl;
|
|
||||||
os << "rx_jsonpara [k v]\n sets value to v for additional json header parameter k to be streamed out with the zmq from receiver. Use only if it needs to be processed by an intermediate process." << std::endl;
|
|
||||||
os << "rx_udpsocksize [t]\n sets the UDP socket buffer size. Different defaults for Jungfrau. "
|
os << "rx_udpsocksize [t]\n sets the UDP socket buffer size. Different defaults for Jungfrau. "
|
||||||
"Does not remember in client shared memory, "
|
"Does not remember in client shared memory, "
|
||||||
"so must be initialized each time after setting receiver "
|
"so must be initialized each time after setting receiver "
|
||||||
@ -2918,10 +2933,6 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
|||||||
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from" << std::endl;
|
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from" << std::endl;
|
||||||
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
|
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
|
||||||
os << "rx_zmqip \n gets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from. If no custom ip, empty until first time connect to receiver" << std::endl;
|
os << "rx_zmqip \n gets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from. If no custom ip, empty until first time connect to receiver" << std::endl;
|
||||||
os << "rx_jsonaddheader \n gets additional json header to be streamed "
|
|
||||||
"out with the zmq from receiver."
|
|
||||||
<< std::endl;
|
|
||||||
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found. Use only if it needs to be processed by an intermediate process." << std::endl;
|
|
||||||
os << "rx_udpsocksize \n gets the UDP socket buffer size." << std::endl;
|
os << "rx_udpsocksize \n gets the UDP socket buffer size." << std::endl;
|
||||||
os << "rx_realudpsocksize \n gets the actual UDP socket buffer size. Usually double the set udp socket buffer size due to kernel bookkeeping." << std::endl;
|
os << "rx_realudpsocksize \n gets the actual UDP socket buffer size. Usually double the set udp socket buffer size due to kernel bookkeeping." << std::endl;
|
||||||
}
|
}
|
||||||
@ -4863,6 +4874,20 @@ std::string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action,
|
|||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (cmd == "rx_jsonaddheader") {
|
||||||
|
if (action == PUT_ACTION) {
|
||||||
|
myDet->setAdditionalJsonHeader(args[1], detPos);
|
||||||
|
}
|
||||||
|
return myDet->getAdditionalJsonHeader(detPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (cmd == "rx_jsonpara") {
|
||||||
|
if (action == PUT_ACTION) {
|
||||||
|
myDet->setAdditionalJsonParameter(args[1], args[2], detPos);
|
||||||
|
}
|
||||||
|
return myDet->getAdditionalJsonParameter(args[1], detPos);
|
||||||
|
}
|
||||||
|
|
||||||
return std::string("could not decode command");
|
return std::string("could not decode command");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4879,6 +4904,11 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
|||||||
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||||
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||||
|
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
|
||||||
|
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||||
|
"Use only if it needs to be processed by an intermediate process." << std::endl;
|
||||||
|
os << "rx_jsonpara [k] [v]\n sets value to v for additional json header parameter k to be streamed out with the zmq from receiver." << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
||||||
@ -4891,6 +4921,10 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
|||||||
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||||
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||||
|
os << "rx_jsonaddheader \n gets additional json header to be streamed "
|
||||||
|
"out with the zmq from receiver." << std::endl;
|
||||||
|
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found." << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -5427,3 +5461,60 @@ std::string slsDetectorCommand::cmdPulse(int narg, char *args[], int action, int
|
|||||||
else
|
else
|
||||||
return std::string(" unsuccessful");
|
return std::string(" unsuccessful");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string slsDetectorCommand::helpProcessor(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
|
os << "json_emin [t]\n sets value to t for minimum threshold (emin) in additional json header to be streamed out with the zmq from receiver. For Moench." << std::endl;
|
||||||
|
os << "json_emax [t]\n sets value to t for maximum threshold (emax) in additional json header to be streamed out with the zmq from receiver. For Moench." << std::endl;
|
||||||
|
os << "json_framemode [s]\n sets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. " << std::endl;
|
||||||
|
os << "json_detectormode [s]\n sets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. " << std::endl;
|
||||||
|
}
|
||||||
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
|
os << "json_emin \n gets value of minimum threshold (emin) in additional json header to be streamed out with the zmq from receiver. If no parameter found, it returns empty string. For Moench." << std::endl;
|
||||||
|
os << "json_emin \n gets value of maximum threshold (emax) in additional json header to be streamed out with the zmq from receiver. If no parameter found, it returns empty string. For Moench." << std::endl;
|
||||||
|
os << "json_framemode [s]\n gets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. " << std::endl;
|
||||||
|
os << "json_detectormode [s]\n gets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. " << std::endl;
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string slsDetectorCommand::cmdProcessor(int narg, char *args[], int action, int detPos) {
|
||||||
|
if (action == HELP_ACTION)
|
||||||
|
return helpProcessor(action);
|
||||||
|
|
||||||
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
|
|
||||||
|
int imode = getJsonHeaderParameterTypeAsEnum(cmd);
|
||||||
|
jsonHeaderParameterType mode = JSON_EMIN;
|
||||||
|
if (imode != -1)
|
||||||
|
mode = (jsonHeaderParameterType)imode;
|
||||||
|
int ival = -1;
|
||||||
|
|
||||||
|
if (cmd == "json_emin" || cmd == "json_emax") {
|
||||||
|
if (action == PUT_ACTION) {
|
||||||
|
if (!sscanf(args[1],"%d", &ival))
|
||||||
|
return std::string("cannot scan value ") + std::string(args[1]) + std::string(" for command ") + cmd;
|
||||||
|
myDet->setAdditionalJsonSpecificParameter(mode, ival);
|
||||||
|
}
|
||||||
|
return std::to_string(myDet->getAdditionalJsonSpecificParameter(mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (cmd == "json_framemode" || cmd == "json_detectormode") {
|
||||||
|
if (action == PUT_ACTION) {
|
||||||
|
ival = getJsonHeaderParameterValuesAsEnum(args[1]);
|
||||||
|
if (ival == -1)
|
||||||
|
return std::string("cannot scan value ") + std::string(args[1]) + std::string(" for command ") + cmd;
|
||||||
|
myDet->setAdditionalJsonSpecificParameter(mode, ival);
|
||||||
|
}
|
||||||
|
int retval = myDet->getAdditionalJsonSpecificParameter(mode);
|
||||||
|
if (retval == -1)
|
||||||
|
return std::string("unknown");
|
||||||
|
return getJsonHeaderParameterValueAsString((jsonHeaderParameterValuesType)retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string("could not decode command");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static std::string helpReceiver(int action);
|
static std::string helpReceiver(int action);
|
||||||
static std::string helpPattern(int action);
|
static std::string helpPattern(int action);
|
||||||
static std::string helpPulse(int action);
|
static std::string helpPulse(int action);
|
||||||
|
static std::string helpProcessor(int action);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
std::string cmdReceiver(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdReceiver(int narg, char *args[], int action, int detPos = -1);
|
||||||
std::string cmdPattern(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdPattern(int narg, char *args[], int action, int detPos = -1);
|
||||||
std::string cmdPulse(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdPulse(int narg, char *args[], int action, int detPos = -1);
|
||||||
|
std::string cmdProcessor(int narg, char *args[], int action, int detPos = -1);
|
||||||
|
|
||||||
int numberOfCommands;
|
int numberOfCommands;
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
|
@ -556,6 +556,23 @@ public:
|
|||||||
GAIN_IMAGE /**< gain image */
|
GAIN_IMAGE /**< gain image */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum jsonHeaderParameterType {
|
||||||
|
JSON_EMIN, /**< minimum energy threshold for the processor */
|
||||||
|
JSON_EMAX, /**< maximum energy threshold for the processor*/
|
||||||
|
JSON_FRAME_MODE, /**< frame mode for the processor*/
|
||||||
|
JSON_DETECTOR_MODE /**< detector mode for the processor*/
|
||||||
|
};
|
||||||
|
|
||||||
|
enum jsonHeaderParameterValuesType {
|
||||||
|
JSON_PEDESTAL, /**< pedestal mode for the processor */
|
||||||
|
JSON_N_PEDESTAL, /**< new pedestal mode for the processor */
|
||||||
|
JSON_FLATFIELD, /**< flatfield mode for the processor */
|
||||||
|
JSON_N_FLATFIELD, /**< new flatfield mode for the processor */
|
||||||
|
JSON_FRAME, /**< frame for the processor */
|
||||||
|
JSON_ANALOG, /**< analog mode for the processor */
|
||||||
|
JSON_COUNTING, /**< counting mode for the processor */
|
||||||
|
JSON_INTERPOLATING /**< interpolating mode for the processor */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -876,6 +893,67 @@ public:
|
|||||||
}}; \
|
}}; \
|
||||||
|
|
||||||
|
|
||||||
|
/** returns std::string from jsonHeaderParameterType
|
||||||
|
* @param h can be JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE
|
||||||
|
* @returns json_emin, json_emax, json_framemode, json_detectormode, unknown
|
||||||
|
*/
|
||||||
|
static std::string getJsonHeaderParameterTypeAsString(jsonHeaderParameterType h) { \
|
||||||
|
switch(h) { \
|
||||||
|
case JSON_EMIN: return std::string("json_emin"); \
|
||||||
|
case JSON_EMAX: return std::string("json_emax"); \
|
||||||
|
case JSON_FRAME_MODE: return std::string("json_framemode"); \
|
||||||
|
case JSON_DETECTOR_MODE: return std::string("json_detectormode"); \
|
||||||
|
default: return std::string("unknown"); \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
|
||||||
|
/** returns std::string from jsonHeaderParameterType
|
||||||
|
* @param h can be json_emin, json_emax, json_framemode, json_detectormode
|
||||||
|
* @returns JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE, -1
|
||||||
|
*/
|
||||||
|
static int getJsonHeaderParameterTypeAsEnum(std::string h) { \
|
||||||
|
if (h == "json_emin") return JSON_EMIN; \
|
||||||
|
if (h == "json_emax") return JSON_EMAX; \
|
||||||
|
if (h == "json_framemode") return JSON_FRAME_MODE; \
|
||||||
|
if (h == "json_detectormode") return JSON_DETECTOR_MODE; \
|
||||||
|
return -1; \
|
||||||
|
}; \
|
||||||
|
|
||||||
|
/** returns std::string from jsonHeaderParameterTyp
|
||||||
|
* @param h can be JSON_PEDESTAL, JSON_N_PEDESTAL, JSON_FLATFIELD, JSON_N_FLATFIELD, JSON_FRAME, JSON_ANALOG, JSON_COUNTING, JSON_INTERPOLATING
|
||||||
|
* @returns json_pedestal, json_newpedestal, json_flatfield, json_newflatfield, json_frame, json_analog, json_counting, json_interpolating, unknown
|
||||||
|
*/
|
||||||
|
static std::string getJsonHeaderParameterValueAsString(jsonHeaderParameterValuesType h) { \
|
||||||
|
switch(h) { \
|
||||||
|
case JSON_PEDESTAL: return std::string("json_pedestal"); \
|
||||||
|
case JSON_N_PEDESTAL: return std::string("json_newpedestal"); \
|
||||||
|
case JSON_FLATFIELD: return std::string("json_flatfield"); \
|
||||||
|
case JSON_N_FLATFIELD: return std::string("json_newflatfield"); \
|
||||||
|
case JSON_FRAME: return std::string("json_frame"); \
|
||||||
|
case JSON_ANALOG: return std::string("json_analog"); \
|
||||||
|
case JSON_COUNTING: return std::string("json_counting"); \
|
||||||
|
case JSON_INTERPOLATING: return std::string("json_interpolating"); \
|
||||||
|
default: return std::string("unknown"); \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
|
||||||
|
/** returns std::string from jsonHeaderParameterTyp
|
||||||
|
* @param h can be json_emin, json_emax, json_framemode, json_detectormode
|
||||||
|
* @returns JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE, -1
|
||||||
|
*/
|
||||||
|
static int getJsonHeaderParameterValuesAsEnum(std::string h) { \
|
||||||
|
if (h == "json_pedestal") return JSON_PEDESTAL; \
|
||||||
|
if (h == "json_newpedestal") return JSON_N_PEDESTAL; \
|
||||||
|
if (h == "json_flatfield") return JSON_FLATFIELD; \
|
||||||
|
if (h == "json_newflatfield") return JSON_N_FLATFIELD; \
|
||||||
|
if (h == "json_frame") return JSON_FRAME; \
|
||||||
|
if (h == "json_analog") return JSON_ANALOG; \
|
||||||
|
if (h == "json_counting") return JSON_COUNTING; \
|
||||||
|
if (h == "json_interpolating") return JSON_INTERPOLATING; \
|
||||||
|
return -1; \
|
||||||
|
}; \
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Reference in New Issue
Block a user