mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
changes upto the receiver, not incl gui
This commit is contained in:
@ -53,6 +53,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
fifoDepth = 0;
|
||||
flippedData[0] = 0;
|
||||
flippedData[1] = 0;
|
||||
gapPixelsEnable = false;
|
||||
|
||||
//***receiver parameters***
|
||||
status = IDLE;
|
||||
@ -115,6 +116,10 @@ int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||
return flippedData[axis];
|
||||
}
|
||||
|
||||
bool UDPBaseImplementation::getGapPixelsEnable() const {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return gapPixelsEnable;
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileFormatType;}
|
||||
@ -255,6 +260,14 @@ void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
gapPixelsEnable = b;
|
||||
FILE_LOG(logINFO) << "Gap Pixels Enable: " << gapPixelsEnable;
|
||||
|
||||
// overridden
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
void UDPBaseImplementation::setFileFormat(const fileFormat f){
|
||||
|
@ -112,6 +112,21 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
if (gapPixelsEnable != b) {
|
||||
gapPixelsEnable = b;
|
||||
|
||||
// side effects
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO) << "Gap Pixels Enable: " << gapPixelsEnable;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
switch(f){
|
||||
#ifdef HDF5C
|
||||
|
@ -280,6 +280,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_SEND_RECEIVER_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
|
||||
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
|
||||
case F_RECEIVER_STREAMING_SRC_IP: return "F_RECEIVER_STREAMING_SRC_IP";
|
||||
case F_ENABLE_GAPPIXELS_IN_RECEIVER:return "F_ENABLE_GAPPIXELS_IN_RECEIVER";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -326,6 +327,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
|
||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
|
||||
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
||||
flist[F_ENABLE_GAPPIXELS_IN_RECEIVER] = &slsReceiverTCPIPInterface::enable_gap_pixels;
|
||||
#ifdef VERYVERBOSE
|
||||
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
FILE_LOG(logINFO) << "function fnum: " << i << " (" << getFunctionName((enum recFuncs)i) << ") located at " << (unsigned int)flist[i];
|
||||
@ -687,6 +689,11 @@ int slsReceiverTCPIPInterface::send_update() {
|
||||
if (path != NULL)
|
||||
delete[] path;
|
||||
|
||||
// gap pixels enable
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
ind = (int)receiverBase->getGapPixelsEnable();
|
||||
#endif
|
||||
mySock->SendDataOnly(&ind,sizeof(ind));
|
||||
|
||||
if (!lockStatus)
|
||||
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
||||
@ -2367,3 +2374,63 @@ int slsReceiverTCPIPInterface::set_streaming_source_ip() {
|
||||
// return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int enable = -1;
|
||||
int retval = -1;
|
||||
|
||||
// receive arguments
|
||||
if (mySock->ReceiveDataOnly(&enable,sizeof(enable)) < 0 )
|
||||
return printSocketReadError();
|
||||
|
||||
if (myDetectorType != EIGER)
|
||||
functionNotImplemented();
|
||||
|
||||
// execute action
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
else {
|
||||
if (receiverBase == NULL)
|
||||
invalidReceiverObject();
|
||||
else {
|
||||
// set
|
||||
if(enable >= 0) {
|
||||
if (mySock->differentClients && lockStatus)
|
||||
receiverlocked();
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else {
|
||||
receiverBase->setGapPixelsEnable(enable);
|
||||
}
|
||||
}
|
||||
//get
|
||||
retval = receiverBase->getGapPixelsEnable();
|
||||
if(enable >= 0 && retval != enable){
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not set gap pixels to %d, returned %d\n",enable,retval);
|
||||
FILE_LOG(logERROR) << "Warning: " << mess;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
||||
#endif
|
||||
|
||||
if (ret == OK && mySock->differentClients)
|
||||
ret = FORCE_UPDATE;
|
||||
|
||||
// send answer
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL)
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user