sending and writing subexptime in the receiver files, adding 0x in front of all numbers printed in command line which is hexa

This commit is contained in:
Dhanya Maliakal 2017-08-10 17:25:18 +02:00
parent af079f3168
commit f084efd263
4 changed files with 61 additions and 29 deletions

View File

@ -79,6 +79,7 @@ using namespace std;
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
#define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL
// 0x0000000FFFFFFFFFULL
/** @short class returning all error messages for error mask */
@ -251,6 +252,9 @@ public:
if(slsErrorMask&RECEIVER_FILE_FORMAT)
retval.append("Could not set receiver file format\n");
if(slsErrorMask&RECEIVER_SUBF_TIME_NOT_SET)
retval.append("Could not set sub exposure time in receiver.\n");
//------------------------------------------------------ length of message

View File

@ -4450,7 +4450,8 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
//send acquisiton period/frame number to receiver
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME)){
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME)){
string timername = getTimerType(index);
if(ret != FAIL){
int64_t args[2];
retval = -1;
@ -4459,25 +4460,21 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
//set #frames, #cycles
//set #frames * #cycles
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
timername.assign("(Number of Frames) * (Number of cycles)");
#ifdef VERBOSE
std::cout << "Setting/Getting number of frames*cycles " << index <<" to/from receiver " << args[1] << std::endl;
std::cout << "Setting/Getting " << timername << " " << index <<" to/from receiver " << args[1] << std::endl;
#endif
if(thisDetector->timerValue[CYCLES_NUMBER]==0)
args[1] = thisDetector->timerValue[FRAME_NUMBER];
else
args[1] = thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER];
}
//set period/exptime
else{
#ifdef VERBOSE
if(index==ACQUISITION_TIME)
std::cout << "Setting/Getting acquisition time " << index << " to/from receiver " << args[1] << std::endl;
else
std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl;
// set period/exptime/subexptime
else std::cout << "Setting/Getting " << timername << " " << index << " to/from receiver " << args[1] << std::endl;
#endif
}
char mess[MAX_STR_LENGTH]="";
if (connectData() == OK){
@ -4486,18 +4483,23 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
}
if((args[1] != retval)|| (ret==FAIL)){
ret = FAIL;
if(index==ACQUISITION_TIME){
if(strstr(mess,"receiver not idle")==NULL)
cout << "ERROR:Acquisition Time in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
}else if(index==FRAME_PERIOD){
if(strstr(mess,"receiver not idle")==NULL)
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
}else{
if(strstr(mess,"receiver not idle")==NULL)
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
cout << "ERROR: " << timername << " in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
if(strstr(mess,"receiver not idle")==NULL) {
switch(index) {
case ACQUISITION_TIME:
setErrorMask((getErrorMask())|(RECEIVER_ACQ_TIME_NOT_SET));
break;
case FRAME_PERIOD:
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
break;
case SUBFRAME_ACQUISITION_TIME:
setErrorMask((getErrorMask())|(RECEIVER_SUBF_TIME_NOT_SET));
break;
default:
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
break;
}
}
}
if(ret==FORCE_UPDATE)
@ -5990,6 +5992,7 @@ string slsDetector::setReceiver(string receiverIP){
std::cout << "frame index needed:" << ((thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER])>1) << endl;
std::cout << "frame period:" << thisDetector->timerValue[FRAME_PERIOD] << endl;
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] << endl;
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl << endl;
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
@ -6026,6 +6029,7 @@ string slsDetector::setReceiver(string receiverIP){
setTimer(FRAME_PERIOD,thisDetector->timerValue[FRAME_PERIOD]);
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
setTimer(SUBFRAME_ACQUISITION_TIME,thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
setDynamicRange(thisDetector->dynamicRange);
if(thisDetector->myDetectorType == EIGER){
setFlippedData(X,-1);

View File

@ -751,6 +751,30 @@ virtual void readFrameFromReceiver()=0;
default: return string("unknown"); \
}};
/** returns string from timer index
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME
\returns string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time
*/
static string getTimerType(timerIndex t){ \
switch (t) { \
case FRAME_NUMBER: return string("frame_number"); \
case ACQUISITION_TIME: return string("acquisition_time"); \
case FRAME_PERIOD: return string("frame_period"); \
case DELAY_AFTER_TRIGGER: return string("delay_after_trigger"); \
case GATES_NUMBER: return string("gates_number"); \
case PROBES_NUMBER: return string("probes_number"); \
case CYCLES_NUMBER: return string("cycles_number"); \
case ACTUAL_TIME: return string("actual_time"); \
case MEASUREMENT_TIME: return string("measurement_time"); \
case PROGRESS: return string("progress"); \
case MEASUREMENTS_NUMBER: return string("measurements_number"); \
case FRAMES_FROM_START: return string("frames_from_start"); \
case FRAMES_FROM_START_PG: return string("frames_from_start_pg"); \
case SAMPLES_JCTB: return string("samples_jctb"); \
case SUBFRAME_ACQUISITION_TIME: return string("subframe_acquisition_time"); \
default: return string("unknown"); \
}};
};

View File

@ -3586,7 +3586,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
}
@ -3600,7 +3600,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
} else
return string("undefined module number");
@ -3610,7 +3610,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
}
if (cmd.find("modulenumber")!=string::npos) {
@ -3620,7 +3620,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
} else
return string("undefined module number");
@ -3631,7 +3631,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
}
@ -3640,7 +3640,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
}
@ -3650,7 +3650,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
sprintf(answer,"0x%lx", retval);
return string(answer);
}
return string("unknown id mode ")+cmd;