mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
still updating slsdetector.cpp
This commit is contained in:
parent
261849d69c
commit
cf87b6ca83
@ -1686,9 +1686,7 @@ void readFrame(int *ret, char *mess) {
|
||||
//FILE_LOG(logERROR ,"Waiting for finished flag\n"));
|
||||
usleep(5000);
|
||||
}
|
||||
*ret = (int)FINISHED;
|
||||
strcpy(mess,"acquisition successfully finished\n"));
|
||||
FILE_LOG(logGREEN, "%s", mess));
|
||||
FILE_LOG(logGREEN, ("acquisition successfully finished\n"));
|
||||
return;
|
||||
#else
|
||||
|
||||
@ -1714,9 +1712,7 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
|
||||
FILE_LOG(logINFO, ("*****Done Waiting...\n"));
|
||||
*ret = (int)FINISHED;
|
||||
strcpy(mess,"acquisition successfully finished\n");
|
||||
FILE_LOG(logGREEN, (mess));
|
||||
FILE_LOG(logGREEN, ("acquisition successfully finished\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1599,8 +1599,6 @@ void readFrame(int *ret, char *mess){
|
||||
//cprintf(RED,"Waiting for finished flag\n");
|
||||
usleep(5000);
|
||||
}
|
||||
*ret = (int)FINISHED;
|
||||
strcpy(mess,"acquisition successfully finished\n");
|
||||
return;
|
||||
#endif
|
||||
// wait for status to be done
|
||||
@ -1615,9 +1613,8 @@ void readFrame(int *ret, char *mess){
|
||||
sprintf(mess,"no data and run stopped: %lld frames left\n",(long long int)retval);
|
||||
cprintf(RED,"%s\n",mess);
|
||||
} else {
|
||||
*ret = (int)FINISHED;
|
||||
sprintf(mess,"acquisition successfully finished\n");
|
||||
cprintf(GREEN, "%s",mess);
|
||||
*ret = (int)OK;
|
||||
cprintf(GREEN, "acquisition successfully finished\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,6 +373,7 @@ int exec_command(int file_des) {
|
||||
|
||||
int get_detector_type(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum detectorType retval = myDetectorType;
|
||||
FILE_LOG(logDEBUG5,("Returning detector type %d\n", retval));
|
||||
return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval));
|
||||
@ -784,7 +785,7 @@ int get_adc(int file_des) {
|
||||
int write_register(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int args[2] = {-1, -1};
|
||||
uint32_t args[2] = {-1, -1};
|
||||
uint32_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
@ -1693,6 +1694,7 @@ int set_speed(int file_des) {
|
||||
int exit_server(int file_des) {
|
||||
cprintf(BG_RED,"Closing Server\n");
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
Server_SendResult(file_des, INT32, 0, NULL, 0);
|
||||
return GOODBYE;
|
||||
}
|
||||
@ -1728,6 +1730,7 @@ int lock_server(int file_des) {
|
||||
|
||||
int get_last_client_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
return Server_SendResult(file_des, INT32, 1, lastClientIP, sizeof(lastClientIP));
|
||||
}
|
||||
|
||||
@ -1738,6 +1741,7 @@ int set_port(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int p_number = -1;
|
||||
char oldLastClientIP[INET_ADDRSTRLEN] = {0};
|
||||
|
||||
if (receiveData(file_des, &p_number, sizeof(p_number), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
@ -1754,6 +1758,7 @@ int set_port(int file_des) {
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Setting %s port to %d\n",
|
||||
(isControlServer ? "control":"stop"), p_number));
|
||||
strcpy(oldLastClientIP, lastClientIP);
|
||||
sd = bindSocket(p_number);
|
||||
}
|
||||
}
|
||||
@ -1764,6 +1769,7 @@ int set_port(int file_des) {
|
||||
closeConnection(file_des);
|
||||
exitServer(sockfd);
|
||||
sockfd = sd;
|
||||
strcpy(lastClientIP, oldLastClientIP);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1295,7 +1295,7 @@ public:
|
||||
* @param gainval pointer to extra gain values
|
||||
* @param offsetval pointer to extra offset values
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns current register value
|
||||
* @returns ok or fail
|
||||
* \sa ::sls_detector_module
|
||||
*/
|
||||
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV,
|
||||
|
@ -398,64 +398,6 @@ private:
|
||||
|
||||
|
||||
|
||||
class Moench02Data : public GeneralData {
|
||||
|
||||
public:
|
||||
|
||||
/** Bytes Per Adc */
|
||||
const static uint32_t bytesPerAdc = (40*2);
|
||||
|
||||
/** Constructor */
|
||||
Moench02Data(){
|
||||
myDetectorType = slsDetectorDefs::MOENCH;
|
||||
nPixelsX = 160;
|
||||
nPixelsY = 160;
|
||||
headerSizeinPacket = 4;
|
||||
dataSize = 1280;
|
||||
packetSize = 1286;
|
||||
packetsPerFrame = 40;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFF00;
|
||||
frameIndexOffset = 8;
|
||||
packetIndexMask = 0xFF;
|
||||
maxFramesPerFile = MOENCH_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
|
||||
/**
|
||||
* Print all variables
|
||||
*/
|
||||
void Print() const {
|
||||
GeneralData::Print();
|
||||
FILE_LOG(logINFO) << "Bytes Per Adc: " << bytesPerAdc;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Moench03Data : public GeneralData {
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
Moench03Data(){
|
||||
myDetectorType = slsDetectorDefs::MOENCH;
|
||||
nPixelsX = 400;
|
||||
nPixelsY = 400;
|
||||
headerSizeinPacket = 22;
|
||||
dataSize = 8192;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
packetsPerFrame = 40;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
frameIndexOffset = (6+8);
|
||||
packetIndexMask = 0xFFFFFFFF;
|
||||
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class JCTBData : public GeneralData {
|
||||
|
||||
|
@ -334,7 +334,7 @@ int slsReceiverTCPIPInterface::exec_command() {
|
||||
|
||||
int slsReceiverTCPIPInterface::exit_server() {
|
||||
cprintf(RED,"Closing server\n");
|
||||
|
||||
memset(mess, 0, sizeof(mess));
|
||||
ret = OK;
|
||||
interface->Server_SendResult(false, ret, NULL, 0);
|
||||
return GOODBYE;
|
||||
@ -350,6 +350,7 @@ int slsReceiverTCPIPInterface::lock_receiver() {
|
||||
// get args, return if socket crashed
|
||||
if (interface->Server_ReceiveArg(ret, mess, &lock, sizeof(lock)) == FAIL)
|
||||
return FAIL;
|
||||
FILE_LOG(logDEBUG5) << "Locking Server to " << lock;
|
||||
|
||||
// execute action
|
||||
if (lock >= 0) {
|
||||
@ -362,7 +363,6 @@ int slsReceiverTCPIPInterface::lock_receiver() {
|
||||
} else
|
||||
interface->Server_LockedError(ret, mess);
|
||||
}
|
||||
|
||||
return interface->Server_SendResult(true, ret, &lockStatus,sizeof(lockStatus), mess);
|
||||
}
|
||||
|
||||
@ -548,8 +548,8 @@ int slsReceiverTCPIPInterface::send_update() {
|
||||
|
||||
int slsReceiverTCPIPInterface::get_id(){
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = getReceiverVersion();
|
||||
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
@ -609,8 +609,7 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
}
|
||||
//get
|
||||
retval = myDetectorType;
|
||||
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
return interface->Server_SendResult(false, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
|
||||
|
||||
@ -700,6 +699,7 @@ int slsReceiverTCPIPInterface::set_roi() {
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::setup_udp(){
|
||||
memset(mess, 0, sizeof(mess));
|
||||
char args[3][MAX_STR_LENGTH] = {0};
|
||||
char retval[MAX_STR_LENGTH] = {0};
|
||||
|
||||
@ -774,29 +774,38 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
|
||||
// base object not null
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5, ("Setting timer index %d to %lld ns\n", index[0], index[1]));
|
||||
char timername[100] = {0};
|
||||
|
||||
// set
|
||||
if (index[1] >= 0) {
|
||||
// verify if receiver is unlocked
|
||||
if (interface->Server_VerifyLock(ret, mess, lockStatus) == OK) {
|
||||
switch (index[0]) {
|
||||
case ACQUISITION_TIME:
|
||||
strcpy(timername, "exptime");
|
||||
ret = receiver->setAcquisitionTime(index[1]);
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
strcpy(timername, "period");
|
||||
ret = receiver->setAcquisitionPeriod(index[1]);
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
strcpy(timername, "frames_cycles_storagecells");
|
||||
receiver->setNumberOfFrames(index[1]);
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
strcpy(timername, "subexptime");
|
||||
receiver->setSubExpTime(index[1]);
|
||||
break;
|
||||
case SUBFRAME_DEADTIME:
|
||||
strcpy(timername, "subdeadtime");
|
||||
receiver->setSubPeriod(index[1] + receiver->getSubExpTime());
|
||||
break;
|
||||
case SAMPLES_JCTB:
|
||||
strcpy(timername, "samples");
|
||||
if (myDetectorType != JUNGFRAUCTB) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"This timer mode (%lld) does not exist for this receiver type\n", (long long int)index[0]);
|
||||
@ -806,6 +815,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
receiver->setNumberofSamples(index[1]);
|
||||
break;
|
||||
default:
|
||||
strcpy(timername, "unknown");
|
||||
ret = FAIL;
|
||||
sprintf(mess,"This timer mode (%lld) does not exist for receiver\n", (long long int)index[0]);
|
||||
FILE_LOG(logERROR) << mess;
|
||||
@ -849,12 +859,11 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
// check
|
||||
if (ret == OK && index[1] >= 0 && retval != index[1]) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Could not set timer\n");
|
||||
strcpy(mess,"Could not set timer %s\n", timername);
|
||||
FILE_LOG(logERROR) << mess;
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval;
|
||||
}
|
||||
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
|
||||
@ -1873,8 +1882,6 @@ int slsReceiverTCPIPInterface::check_version_compatibility() {
|
||||
// get args, return if socket crashed
|
||||
if (interface->Server_ReceiveArg(ret, mess, &arg, sizeof(arg)) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
|
||||
FILE_LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg;
|
||||
int64_t client_requiredVersion = arg;
|
||||
int64_t rx_apiVersion = APIRECEIVER;
|
||||
@ -1902,7 +1909,6 @@ int slsReceiverTCPIPInterface::check_version_compatibility() {
|
||||
FILE_LOG(logERROR) << mess;
|
||||
}
|
||||
else FILE_LOG(logINFO) << "Compatibility with Client: Successful";
|
||||
|
||||
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,6 @@ public:
|
||||
enum {
|
||||
OK, /**< function succeeded */
|
||||
FAIL, /**< function failed */
|
||||
FINISHED, /**< acquisition finished */
|
||||
FORCE_UPDATE
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user