mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
changes upto the receiver, not incl gui
This commit is contained in:
parent
d0b379a2d5
commit
7cde5dbe38
@ -10,6 +10,7 @@
|
|||||||
#include "sls_receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
#include "receiver_defs.h"
|
#include "receiver_defs.h"
|
||||||
|
|
||||||
|
#define NUM_BITS_IN_ONE_BYTE 8
|
||||||
|
|
||||||
class GeneralData {
|
class GeneralData {
|
||||||
|
|
||||||
@ -171,6 +172,15 @@ public:
|
|||||||
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Gap Pixels changes member variables
|
||||||
|
* @param enable true if gap pixels enable, else false
|
||||||
|
*/
|
||||||
|
virtual void SetGapPixelsEnable(bool b, int dr) {
|
||||||
|
bprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print all variables
|
* Print all variables
|
||||||
*/
|
*/
|
||||||
@ -544,6 +554,26 @@ class EigerData : public GeneralData {
|
|||||||
imageSize = dataSize*packetsPerFrame;
|
imageSize = dataSize*packetsPerFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Gap Pixels changes member variables
|
||||||
|
* @param enable true if gap pixels enable, else false
|
||||||
|
*/
|
||||||
|
void SetGapPixelsEnable(bool b, int dr) {
|
||||||
|
switch((int)b) {
|
||||||
|
case 1:
|
||||||
|
nPixelsX_Streamer = (256*2) + 3;
|
||||||
|
nPixelsY_Streamer = 256 + 1;
|
||||||
|
imageSize_Streamer = nPixelsX_Streamer * imageSize_Streamer *
|
||||||
|
((double)dr/(double)NUM_BITS_IN_ONE_BYTE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
nPixelsX_Streamer = (256*2);
|
||||||
|
nPixelsY_Streamer = 256;
|
||||||
|
imageSize_Streamer = dataSize*packetsPerFrame;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,6 +66,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int getFlippedData(int axis=0) const;
|
int getFlippedData(int axis=0) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Gap Pixels Enable (eiger specific)
|
||||||
|
* @return true if gap pixels enabled, else false
|
||||||
|
*/
|
||||||
|
bool getGapPixelsEnable() const;
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/**
|
/**
|
||||||
@ -284,6 +290,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
void setFlippedData(int axis=0, int enable=-1);
|
void setFlippedData(int axis=0, int enable=-1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Gap Pixels Enable (eiger specific)
|
||||||
|
* @param b true for gap pixels enable, else false
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setGapPixelsEnable(const bool b);
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/**
|
/**
|
||||||
@ -609,6 +622,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
uint32_t fifoDepth;
|
uint32_t fifoDepth;
|
||||||
/** enable for flipping data across both axes */
|
/** enable for flipping data across both axes */
|
||||||
int flippedData[2];
|
int flippedData[2];
|
||||||
|
/** gap pixels enable */
|
||||||
|
bool gapPixelsEnable;
|
||||||
|
|
||||||
//***receiver parameters***
|
//***receiver parameters***
|
||||||
/** Maximum Number of Listening Threads/ UDP Ports */
|
/** Maximum Number of Listening Threads/ UDP Ports */
|
||||||
|
@ -48,6 +48,7 @@ class UDPInterface {
|
|||||||
* -setFlippedData (if eiger)
|
* -setFlippedData (if eiger)
|
||||||
* -setActivate (if eiger)
|
* -setActivate (if eiger)
|
||||||
* -setTenGigaEnable (if eiger)
|
* -setTenGigaEnable (if eiger)
|
||||||
|
* -setGapPixelsEnable
|
||||||
* -setStreamingPort
|
* -setStreamingPort
|
||||||
* -setStreamingSourceIP
|
* -setStreamingSourceIP
|
||||||
* -setDataStreamEnable
|
* -setDataStreamEnable
|
||||||
@ -151,6 +152,12 @@ class UDPInterface {
|
|||||||
*/
|
*/
|
||||||
virtual int getFlippedData(int axis=0) const = 0;
|
virtual int getFlippedData(int axis=0) const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Gap Pixels Enable (eiger specific)
|
||||||
|
* @return true if gap pixels enabled, else false
|
||||||
|
*/
|
||||||
|
virtual bool getGapPixelsEnable() const = 0;
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/**
|
/**
|
||||||
@ -370,6 +377,14 @@ class UDPInterface {
|
|||||||
virtual void setFlippedData(int axis=0, int enable=-1) = 0;
|
virtual void setFlippedData(int axis=0, int enable=-1) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Gap Pixels Enable (eiger specific)
|
||||||
|
* @param b true for gap pixels enable, else false
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
virtual int setGapPixelsEnable(const bool b) = 0;
|
||||||
|
|
||||||
|
|
||||||
//***file parameters***
|
//***file parameters***
|
||||||
/**
|
/**
|
||||||
* Set File Format
|
* Set File Format
|
||||||
|
@ -53,6 +53,13 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
int64_t getAcquisitionIndex() const;
|
int64_t getAcquisitionIndex() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Gap Pixels Enable (eiger specific)
|
||||||
|
* @param b true for gap pixels enable, else false
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setGapPixelsEnable(const bool b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set File Format
|
* Set File Format
|
||||||
* @param f fileformat binary or hdf5
|
* @param f fileformat binary or hdf5
|
||||||
|
@ -261,6 +261,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/** set streaming source ip */
|
/** set streaming source ip */
|
||||||
int set_streaming_source_ip();
|
int set_streaming_source_ip();
|
||||||
|
|
||||||
|
/** enable gap pixels */
|
||||||
|
int enable_gap_pixels();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** detector type */
|
/** detector type */
|
||||||
|
@ -60,6 +60,7 @@ enum recFuncs{
|
|||||||
F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
|
F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
|
||||||
F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */
|
F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */
|
||||||
F_RECEIVER_STREAMING_SRC_IP, /** < sets the receiver streaming source IP */
|
F_RECEIVER_STREAMING_SRC_IP, /** < sets the receiver streaming source IP */
|
||||||
|
F_ENABLE_GAPPIXELS_IN_RECEIVER, /** < sets gap pixels in the receiver */
|
||||||
/* Always append functions hereafter!!! */
|
/* Always append functions hereafter!!! */
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ void UDPBaseImplementation::initializeMembers(){
|
|||||||
fifoDepth = 0;
|
fifoDepth = 0;
|
||||||
flippedData[0] = 0;
|
flippedData[0] = 0;
|
||||||
flippedData[1] = 0;
|
flippedData[1] = 0;
|
||||||
|
gapPixelsEnable = false;
|
||||||
|
|
||||||
//***receiver parameters***
|
//***receiver parameters***
|
||||||
status = IDLE;
|
status = IDLE;
|
||||||
@ -115,6 +116,10 @@ int UDPBaseImplementation::getFlippedData(int axis) const{
|
|||||||
return flippedData[axis];
|
return flippedData[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UDPBaseImplementation::getGapPixelsEnable() const {
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
return gapPixelsEnable;
|
||||||
|
}
|
||||||
|
|
||||||
/***file parameters***/
|
/***file parameters***/
|
||||||
slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileFormatType;}
|
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];
|
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***/
|
/***file parameters***/
|
||||||
void UDPBaseImplementation::setFileFormat(const fileFormat f){
|
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){
|
void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||||
switch(f){
|
switch(f){
|
||||||
#ifdef HDF5C
|
#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_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
|
||||||
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
|
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
|
||||||
case F_RECEIVER_STREAMING_SRC_IP: return "F_RECEIVER_STREAMING_SRC_IP";
|
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";
|
default: return "Unknown Function";
|
||||||
}
|
}
|
||||||
@ -326,6 +327,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
|||||||
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
|
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
|
||||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
|
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
|
||||||
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
flist[F_RECEIVER_STREAMING_SRC_IP] = &slsReceiverTCPIPInterface::set_streaming_source_ip;
|
||||||
|
flist[F_ENABLE_GAPPIXELS_IN_RECEIVER] = &slsReceiverTCPIPInterface::enable_gap_pixels;
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
|
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];
|
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)
|
if (path != NULL)
|
||||||
delete[] path;
|
delete[] path;
|
||||||
|
|
||||||
|
// gap pixels enable
|
||||||
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
|
ind = (int)receiverBase->getGapPixelsEnable();
|
||||||
|
#endif
|
||||||
|
mySock->SendDataOnly(&ind,sizeof(ind));
|
||||||
|
|
||||||
if (!lockStatus)
|
if (!lockStatus)
|
||||||
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
||||||
@ -2367,3 +2374,63 @@ int slsReceiverTCPIPInterface::set_streaming_source_ip() {
|
|||||||
// return ok/fail
|
// return ok/fail
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user