Jungfrausync (#519)

* jungfrau sync
This commit is contained in:
Dhanya Thattil
2022-08-23 10:29:16 +02:00
committed by GitHub
parent da16c1101c
commit 4638bf7cf8
16 changed files with 158 additions and 4 deletions

View File

@ -397,6 +397,11 @@ int isTop(int *retval);
int isMaster(int *retval);
#endif
#ifdef JUNGFRAUD
int getSynchronization();
void setSynchronization(int enable);
#endif
#ifdef GOTTHARD2D
void updatingRegisters();
#endif

View File

@ -304,3 +304,5 @@ int set_analog_pulsing(int);
int get_digital_pulsing(int);
int set_digital_pulsing(int);
int get_module(int);
int get_synchronization(int);
int set_synchronization(int);

View File

@ -468,6 +468,8 @@ void function_table() {
flist[F_GET_DIGITAL_PULSING] = &get_digital_pulsing;
flist[F_SET_DIGITAL_PULSING] = &set_digital_pulsing;
flist[F_GET_MODULE] = &get_module;
flist[F_GET_SYNCHRONIZATION] = &get_synchronization;
flist[F_SET_SYNCHRONIZATION] = &set_synchronization;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -10126,4 +10128,51 @@ int set_digital_pulsing(int file_des) {
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
}
int get_synchronization(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting synchronization\n"));
#ifndef JUNGFRAUD
functionNotImplemented();
#else
retval = getSynchronization();
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_synchronization(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Setting synchronization: %u\n", (int)arg));
#ifndef JUNGFRAUD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if ((check_detector_idle("set synchronization") == OK) &&
(arg != 0 && arg != 1)) {
ret = FAIL;
sprintf(mess,
"Could not set synchronization. Invalid argument %d.\n",
arg);
LOG(logERROR, (mess));
} else {
setSynchronization(arg);
int retval = getSynchronization();
LOG(logDEBUG1, ("synchronization retval: %u\n", retval));
validate(&ret, mess, arg, retval, "set synchronization", DEC);
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}