mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
runs, prints right in reciever
This commit is contained in:
@ -106,8 +106,7 @@ int BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_
|
||||
|
||||
// if write error
|
||||
if (ret != buffersize) {
|
||||
cprintf(RED,"%d Error: Write to file failed for image number %lld\n",
|
||||
index, (long long int)fnum);
|
||||
FILE_LOG(logERROR) << index << " Error: Write to file failed for image number " << fnum;
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
|
@ -166,18 +166,14 @@ void DataProcessor::RecordFirstIndices(uint64_t fnum) {
|
||||
firstAcquisitionIndex = fnum;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"%d First Acquisition Index:%lld\tFirst Measurement Index:%lld\n",
|
||||
index, (long long int)firstAcquisitionIndex, (long long int)firstMeasurementIndex);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << index << " First Acquisition Index:" << firstAcquisitionIndex <<
|
||||
"\tFirst Measurement Index:" << firstMeasurementIndex;
|
||||
}
|
||||
|
||||
|
||||
void DataProcessor::SetGeneralData(GeneralData* g) {
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
if (file) {
|
||||
if (file->GetFileType() == HDF5) {
|
||||
file->SetNumberofPixels(generalData->nPixelsX, generalData->nPixelsY);
|
||||
@ -278,16 +274,12 @@ void DataProcessor::EndofAcquisition(bool anyPacketsCaught, uint64_t numf) {
|
||||
void DataProcessor::ThreadExecution() {
|
||||
char* buffer=0;
|
||||
fifo->PopAddress(buffer);
|
||||
#ifdef FIFODEBUG
|
||||
if (!index) cprintf(BLUE,"DataProcessor %d, pop 0x%p buffer:%s\n",
|
||||
index,(void*)(buffer),buffer);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG5) << "DataProcessor " << index << ", "
|
||||
"pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
//check dummy
|
||||
uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer));
|
||||
#ifdef VERBOSE
|
||||
if (!index) cprintf(BLUE,"DataProcessor %d, Numbytes:%u\n", index,numBytes);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
@ -304,10 +296,8 @@ void DataProcessor::ThreadExecution() {
|
||||
|
||||
|
||||
void DataProcessor::StopProcessing(char* buf) {
|
||||
#ifdef VERBOSE
|
||||
if (!index)
|
||||
cprintf(RED,"DataProcessing %d: Dummy\n", index);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
||||
|
||||
//stream or free
|
||||
if (*dataStreamEnable)
|
||||
fifo->PushAddressToStream(buf);
|
||||
@ -317,9 +307,7 @@ void DataProcessor::StopProcessing(char* buf) {
|
||||
if (file)
|
||||
file->CloseCurrentFile();
|
||||
StopRunning();
|
||||
#ifdef VERBOSE
|
||||
FILE_LOG(logINFO) << index << ": Processing Completed";
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << index << ": Processing Completed";
|
||||
}
|
||||
|
||||
|
||||
@ -335,16 +323,9 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
||||
numTotalFramesCaught++;
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
if (!index)
|
||||
cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum;
|
||||
|
||||
if (!measurementStartedFlag) {
|
||||
#ifdef VERBOSE
|
||||
if (!index) cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum);
|
||||
#endif
|
||||
RecordFirstIndices(fnum);
|
||||
|
||||
if (*dataStreamEnable) {
|
||||
@ -418,11 +399,10 @@ bool DataProcessor::SendToStreamer() {
|
||||
bool DataProcessor::CheckTimer() {
|
||||
struct timespec end;
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"%d Timer elapsed time:%f seconds\n", index,
|
||||
( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec )
|
||||
/ 1000000000.0);
|
||||
#endif
|
||||
|
||||
FILE_LOG(logDEBUG1) << index << " Timer elapsed time:" <<
|
||||
(( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0)
|
||||
<< " seconds";
|
||||
//still less than streaming timer, keep waiting
|
||||
if((( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec )
|
||||
/ 1000000000.0) < ((double)*streamingTimerInMs/1000.00))
|
||||
@ -464,9 +444,8 @@ void DataProcessor::PadMissingPackets(char* buf) {
|
||||
uint32_t dsize = generalData->dataSize;
|
||||
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
||||
uint32_t corrected_dsize = dsize - ((pperFrame * dsize) - generalData->imageSize);
|
||||
#ifdef VERBOSE
|
||||
cprintf(RED,"bitmask:%s\n", pmask.to_string().c_str());
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "bitmask: " << pmask.to_string();
|
||||
|
||||
for (unsigned int pnum = 0; pnum < pperFrame; ++pnum) {
|
||||
|
||||
// not missing packet
|
||||
|
@ -108,18 +108,14 @@ void DataStreamer::RecordFirstIndices(uint64_t fnum) {
|
||||
firstAcquisitionIndex = fnum;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"%d First Acquisition Index:%lld\tFirst Measurement Index:%lld\n",
|
||||
index, (long long int)firstAcquisitionIndex, (long long int)firstMeasurementIndex);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << index << " First Acquisition Index: " << firstAcquisitionIndex <<
|
||||
"\tFirst Measurement Index: " << firstMeasurementIndex;
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::SetGeneralData(GeneralData* g) {
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
}
|
||||
|
||||
int DataStreamer::SetThreadPriority(int priority) {
|
||||
@ -138,7 +134,7 @@ void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const char* srci
|
||||
try {
|
||||
zmqSocket = new ZmqSocket(portnum, (strlen(srcip)?srcip:NULL));
|
||||
} catch (...) {
|
||||
cprintf(RED, "Error: Could not create Zmq socket on port %d for Streamer %d\n", portnum, index);
|
||||
FILE_LOG(logERROR) << "Could not create Zmq socket on port " << portnum << " for Streamer " << index;
|
||||
throw;
|
||||
}
|
||||
FILE_LOG(logINFO) << index << " Streamer: Zmq Server started at " << zmqSocket->GetZmqServerAddress();
|
||||
@ -156,15 +152,13 @@ void DataStreamer::CloseZmqSocket() {
|
||||
void DataStreamer::ThreadExecution() {
|
||||
char* buffer=0;
|
||||
fifo->PopAddressToStream(buffer);
|
||||
#ifdef FIFODEBUG
|
||||
if (!index) cprintf(BLUE,"DataStreamer %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG5) << "DataStreamer " << index << ", "
|
||||
"pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
|
||||
//check dummy
|
||||
uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer));
|
||||
#ifdef VERBOSE
|
||||
cprintf(GREEN,"DataStreamer %d, Numbytes:%u\n", index,numBytes);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
@ -180,20 +174,17 @@ void DataStreamer::ThreadExecution() {
|
||||
|
||||
|
||||
void DataStreamer::StopProcessing(char* buf) {
|
||||
#ifdef VERBOSE
|
||||
if (!index)
|
||||
cprintf(RED,"DataStreamer %d: Dummy\n", index);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": Dummy";
|
||||
|
||||
sls_receiver_header* header = (sls_receiver_header*) (buf);
|
||||
//send dummy header and data
|
||||
if (!SendHeader(header, 0, 0, 0, true))
|
||||
cprintf(RED,"Error: Could not send zmq dummy header for streamer %d\n", index);
|
||||
if (!SendHeader(header, 0, 0, 0, true)) {
|
||||
FILE_LOG(logERROR) << "Could not send zmq dummy header for streamer " << index;
|
||||
}
|
||||
|
||||
fifo->FreeAddress(buf);
|
||||
StopRunning();
|
||||
#ifdef VERBOSE
|
||||
FILE_LOG(logINFO) << index << ": Streaming Completed";
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << index << ": Streaming Completed";
|
||||
}
|
||||
|
||||
/** buf includes only the standard header */
|
||||
@ -201,14 +192,9 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
|
||||
sls_receiver_header* header = (sls_receiver_header*) (buf + FIFO_HEADER_NUMBYTES);
|
||||
uint64_t fnum = header->detHeader.frameNumber;
|
||||
#ifdef VERBOSE
|
||||
cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum;
|
||||
|
||||
if (!measurementStartedFlag) {
|
||||
#ifdef VERBOSE
|
||||
if (!index) cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index, fnum);
|
||||
#endif
|
||||
RecordFirstIndices(fnum);
|
||||
}
|
||||
|
||||
@ -220,17 +206,16 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
//write imagesize
|
||||
|
||||
if (!SendHeader(header, generalData->imageSizeComplete,
|
||||
generalData->nPixelsXComplete, generalData->nPixelsYComplete, false))
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
generalData->nPixelsXComplete, generalData->nPixelsYComplete, false)) {
|
||||
FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index;
|
||||
}
|
||||
memcpy(completeBuffer + ((generalData->imageSize) * adcConfigured),
|
||||
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||
(uint32_t)(*((uint32_t*)buf)) );
|
||||
|
||||
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete))
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete)) {
|
||||
FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -238,14 +223,13 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
else {
|
||||
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)),
|
||||
generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
generalData->nPixelsX, generalData->nPixelsY, false)) {// new size possibly from callback
|
||||
FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index;
|
||||
}
|
||||
if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||
(uint32_t)(*((uint32_t*)buf)) )) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
(uint32_t)(*((uint32_t*)buf)) )) {// new size possibly from callback
|
||||
FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,22 +21,21 @@ Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth):
|
||||
fifoDepth(depth),
|
||||
status_fifoBound(0),
|
||||
status_fifoFree(depth){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(CreateFifos(fifoItemSize) == FAIL)
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
|
||||
Fifo::~Fifo() {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
//cprintf(BLUE,"Fifo Object %d: Goodbye\n", index);
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
DestroyFifos();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
//destroy if not already
|
||||
DestroyFifos();
|
||||
@ -69,7 +68,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
|
||||
|
||||
|
||||
void Fifo::DestroyFifos(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if(memory) {
|
||||
free(memory);
|
||||
|
@ -38,8 +38,8 @@ std::string File::GetCurrentFileName() {
|
||||
return currentFileName;
|
||||
}
|
||||
|
||||
void File::PrintMembers() {
|
||||
FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << std::endl
|
||||
void File::PrintMembers(TLogLevel level) {
|
||||
FILE_LOG(level) << "\nGeneral Writer Variables:" << std::endl
|
||||
<< "Index: " << index << std::endl
|
||||
<< "Max Frames Per File: " << *maxFramesPerFile << std::endl
|
||||
<< "Number of Detectors in x dir: " << numDetX << std::endl
|
||||
|
@ -38,9 +38,7 @@ HDF5File::HDF5File(int ind, uint32_t* maxf,
|
||||
dataspace_para(0),
|
||||
extNumImages(0)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
PrintMembers();
|
||||
#endif
|
||||
dataset_para.clear();
|
||||
parameterNames.clear();
|
||||
parameterDataTypes.clear();
|
||||
@ -95,15 +93,15 @@ HDF5File::~HDF5File() {
|
||||
CloseAllFiles();
|
||||
}
|
||||
|
||||
void HDF5File::PrintMembers() {
|
||||
void HDF5File::PrintMembers(TLogLevel level) {
|
||||
File::PrintMembers();
|
||||
UpdateDataType();
|
||||
if (datatype == PredType::STD_U8LE) {
|
||||
FILE_LOG(logINFO) << "Data Type: 4 or 8";
|
||||
FILE_LOG(level) << "Data Type: 4 or 8";
|
||||
} else if (datatype == PredType::STD_U16LE) {
|
||||
FILE_LOG(logINFO) << "Data Type: 16";
|
||||
FILE_LOG(level) << "Data Type: 16";
|
||||
} else if (datatype == PredType::STD_U32LE) {
|
||||
FILE_LOG(logINFO) << "Data Type: 32";
|
||||
FILE_LOG(level) << "Data Type: 32";
|
||||
} else {
|
||||
FILE_LOG(logERROR) << "unknown data type";
|
||||
}
|
||||
@ -154,8 +152,6 @@ int HDF5File::CreateFile(uint64_t fnum) {
|
||||
return FAIL;
|
||||
}
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
if (dataspace == NULL)
|
||||
cprintf(RED,"Got nothing!\n");
|
||||
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName;
|
||||
@ -214,9 +210,8 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
||||
if (HDF5FileStatic::ExtendDataset(index, dataspace, dataset,
|
||||
dataspace_para, dataset_para, *numImages) == OK) {
|
||||
if (!(*silentMode)) {
|
||||
cprintf(BLUE,"%d Extending HDF5 dataset by %llu, Total x Dimension: %llu\n",
|
||||
index, (long long unsigned int)extNumImages,
|
||||
(long long unsigned int)(extNumImages + *numImages));
|
||||
FILE_LOG(logINFO) << index << " Extending HDF5 dataset by " <<
|
||||
extNumImages << ", Total x Dimension: " << (extNumImages + *numImages);
|
||||
}
|
||||
extNumImages += *numImages;
|
||||
}
|
||||
@ -238,7 +233,7 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
cprintf(RED,"%d Error: Write to file failed\n", index);
|
||||
FILE_LOG(logERROR) << index << "Write to file failed";
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
@ -159,19 +159,18 @@ void Listener::RecordFirstIndices(uint64_t fnum) {
|
||||
}
|
||||
|
||||
if(!(*silentMode)) {
|
||||
if (!index) cprintf(BLUE,"%d First Acquisition Index:%lu\n"
|
||||
"%d First Measurement Index:%lu\n",
|
||||
index, firstAcquisitionIndex,
|
||||
index, firstMeasurementIndex);
|
||||
if (!index) {
|
||||
FILE_LOG(logINFOBLUE) << index <<
|
||||
" First Acquisition Index: " << firstAcquisitionIndex;
|
||||
FILE_LOG(logDEBUG1) << index << " First Measurement Index: " << firstMeasurementIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Listener::SetGeneralData(GeneralData*& g) {
|
||||
generalData = g;
|
||||
#ifdef VERY_VERBOSE
|
||||
generalData->Print();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -300,9 +299,8 @@ void Listener::ThreadExecution() {
|
||||
int rc = 0;
|
||||
|
||||
fifo->GetNewAddress(buffer);
|
||||
#ifdef FIFODEBUG
|
||||
cprintf(GREEN,"Listener %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG5) << "Listener " << index << ", "
|
||||
"pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
//udpsocket doesnt exist
|
||||
if (*activated && !udpSocketAlive && !carryOverFlag) {
|
||||
@ -320,7 +318,6 @@ void Listener::ThreadExecution() {
|
||||
|
||||
//error check, (should not be here) if not transmitting yet (previous if) rc should be > 0
|
||||
if (rc == 0) {
|
||||
//cprintf(RED,"%d Socket shut down while waiting for future packet. udpsocketalive:%d\n",index, udpSocketAlive );
|
||||
if (!udpSocketAlive) {
|
||||
(*((uint32_t*)buffer)) = 0;
|
||||
StopListening(buffer);
|
||||
@ -362,10 +359,8 @@ void Listener::StopListening(char* buf) {
|
||||
StopRunning();
|
||||
|
||||
sem_post(&semaphore_socket);
|
||||
#ifdef VERBOSE
|
||||
cprintf(GREEN,"%d: Listening Packets (%u) : %llu\n", index, *udpPortNumber, numPacketsCaught);
|
||||
cprintf(GREEN,"%d: Listening Completed\n", index);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber << ") : " << numPacketsCaught;
|
||||
FILE_LOG(logDEBUG1) << index << ": Listening Completed";
|
||||
}
|
||||
|
||||
|
||||
@ -418,7 +413,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
|
||||
//look for carry over
|
||||
if (carryOverFlag) {
|
||||
//cprintf(RED,"%d carry flag\n",index);
|
||||
FILE_LOG(logDEBUG3) << index << "carry flag";
|
||||
//check if its the current image packet
|
||||
// -------------------------- new header ----------------------------------------------------------------------
|
||||
if (standardheader) {
|
||||
@ -434,7 +429,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
if (fnum != currentFrameIndex) {
|
||||
if (fnum < currentFrameIndex) {
|
||||
cprintf(RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex);
|
||||
FILE_LOG(logERROR) << "(Weird), With carry flag: Frame number " <<
|
||||
fnum << " less than current frame number " << currentFrameIndex;
|
||||
return 0;
|
||||
}
|
||||
switch(*frameDiscardMode) {
|
||||
@ -551,25 +547,22 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
|
||||
// Eiger Firmware in a weird state
|
||||
if (myDetectorType == EIGER && fnum == 0) {
|
||||
cprintf(RED,"[%u]: Got Frame Number Zero from Firmware. Discarding Packet\n", *udpPortNumber);
|
||||
FILE_LOG(logERROR) << "[" << *udpPortNumber << "]: Got Frame Number "
|
||||
"Zero from Firmware. Discarding Packet";
|
||||
numPacketsCaught--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lastCaughtFrameIndex = fnum;
|
||||
|
||||
FILE_LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex <<
|
||||
", fnum:" << fnum << ", pnum:" << pnum << ", numpackets:" << numpackets;
|
||||
|
||||
#ifdef VERBOSE
|
||||
//if (!index)
|
||||
cprintf(GREEN,"Listening %d: currentfindex:%lu, fnum:%lu, pnum:%u numpackets:%u\n",
|
||||
index,currentFrameIndex, fnum, pnum, numpackets);
|
||||
#endif
|
||||
if (!measurementStartedFlag)
|
||||
RecordFirstIndices(fnum);
|
||||
|
||||
//future packet by looking at image number (all other detectors)
|
||||
if (fnum != currentFrameIndex) {
|
||||
//cprintf(RED,"setting carry over flag to true num:%llu nump:%u\n",fnum, numpackets );
|
||||
carryOverFlag = true;
|
||||
memcpy(carryOverPacket,listeningPacket, generalData->packetSize);
|
||||
|
||||
@ -641,19 +634,18 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
|
||||
|
||||
void Listener::PrintFifoStatistics() {
|
||||
#ifdef VERBOSE
|
||||
cout << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic << endl;
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1) << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic;
|
||||
|
||||
//calculate packet loss
|
||||
int64_t loss = -1;
|
||||
loss = (numFramesStatistic*(generalData->packetsPerFrame)) - numPacketsStatistic;
|
||||
numPacketsStatistic = 0;
|
||||
numFramesStatistic = 0;
|
||||
|
||||
if (loss)
|
||||
cprintf(RED,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tCurrent_Frame#:%lu\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , fifo->GetMinLevelForFifoFree(), currentFrameIndex);
|
||||
else
|
||||
cprintf(GREEN,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tCurrent_Frame#:%lu\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), fifo->GetMinLevelForFifoFree(), currentFrameIndex);
|
||||
FILE_LOG(loss ? logINFORED : logINFOGREEN) << "[" << *udpPortNumber << "]: "
|
||||
"Packet_Loss:" << loss <<
|
||||
" Used_Fifo_Max_Level:" << fifo->GetMaxLevelForFifoBound() <<
|
||||
" \tFree_Slots_Min_Level:" << fifo->GetMinLevelForFifoFree() <<
|
||||
" \tCurrent_Frame#:" << currentFrameIndex;
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,8 @@ void* ThreadObject::StartThread(void* thisPointer) {
|
||||
|
||||
|
||||
void ThreadObject::RunningThread() {
|
||||
cprintf(BLUE,"Created [ %s Thread %d, Tid: %ld ]\n", GetType().c_str(),index, (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Created [ " << GetType() << "Thread " << index << ", "
|
||||
"Tid: " << syscall(SYS_gettid) << "]";
|
||||
while(true) {
|
||||
|
||||
while(IsRunning()) {
|
||||
@ -88,7 +89,8 @@ void ThreadObject::RunningThread() {
|
||||
sem_wait(&semaphore);
|
||||
|
||||
if(killThread) {
|
||||
cprintf(BLUE,"Exiting [ %s Thread %d, Tid: %ld ]\n", GetType().c_str(),index, (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ " << GetType() <<
|
||||
" Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]";
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
|
@ -24,18 +24,21 @@ void sigInterruptHandler(int p){
|
||||
keeprunning = false;
|
||||
}
|
||||
|
||||
/** Define Colors to print data call back in different colors for different recievers */
|
||||
/*
|
||||
int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){
|
||||
printf("#### StartAcq: filepath:%s filename:%s fileindex:%llu datasize:%u ####\n",
|
||||
filepath, filename, fileindex, datasize);
|
||||
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
|
||||
|
||||
cprintf(BLUE, "--StartAcq: returning 0\n");
|
||||
int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){
|
||||
FILE_LOG(logINFO) << "#### StartAcq: "
|
||||
"filepath: " << filepath << "filename: " << filename <<
|
||||
"fileindex: " << fileindex << "datasize: " << datasize << " ####";
|
||||
FILE_LOG(logINFO) << "--StartAcq: returning 0";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionFinished(uint64_t frames, void*p){
|
||||
cprintf(BLUE, "#### AcquisitionFinished: frames:%llu ####\n",frames);
|
||||
FILE_LOG(logINFO) << "#### AcquisitionFinished: frames:" << frames << " ####";
|
||||
}
|
||||
|
||||
|
||||
@ -45,16 +48,16 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
||||
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCrow%u\t\tcolumn: %u\t\tcolumn: %u\t\tdebug: %u"
|
||||
"frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu"
|
||||
"\t\ttimestamp: %lu\t\tmodId: %u\t\t"
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
detectorHeader.row, detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, detectorHeader.bunchId,
|
||||
detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.column,
|
||||
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId,
|
||||
(long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
@ -66,7 +69,7 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
keeprunning = true;
|
||||
cprintf(BLUE,"Created [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Created [ Tid: " << syscall(SYS_gettid) << " ]";
|
||||
|
||||
// Catch signal SIGINT to close files and call destructors properly
|
||||
struct sigaction sa;
|
||||
@ -74,7 +77,7 @@ int main(int argc, char *argv[]) {
|
||||
sa.sa_handler=sigInterruptHandler; // handler function
|
||||
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler
|
||||
if (sigaction(SIGINT, &sa, NULL) == -1) {
|
||||
cprintf(RED, "Could not set handler function for SIGINT\n");
|
||||
FILE_LOG(logERROR) << "Could not set handler function for SIGINT";
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +88,7 @@ int main(int argc, char *argv[]) {
|
||||
asa.sa_handler=SIG_IGN; // handler function
|
||||
sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler
|
||||
if (sigaction(SIGPIPE, &asa, NULL) == -1) {
|
||||
cprintf(RED, "Could not set handler function for SIGPIPE\n");
|
||||
FILE_LOG(logERROR) << "Could not set handler function for SIGPIPE";
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +96,7 @@ int main(int argc, char *argv[]) {
|
||||
slsReceiverUsers *receiver = new slsReceiverUsers(argc, argv, ret);
|
||||
if(ret==slsDetectorDefs::FAIL){
|
||||
delete receiver;
|
||||
cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -142,18 +145,18 @@ int main(int argc, char *argv[]) {
|
||||
//start tcp server thread
|
||||
if (receiver->start() == slsDetectorDefs::FAIL){
|
||||
delete receiver;
|
||||
cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "Ready ... ";
|
||||
cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n");
|
||||
FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]";
|
||||
while(keeprunning)
|
||||
pause();
|
||||
|
||||
delete receiver;
|
||||
cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFO) << "Goodbye!";
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]";
|
||||
FILE_LOG(logINFO) << "Exiting Receiver";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,16 +24,19 @@
|
||||
/** cosntructor & destructor */
|
||||
|
||||
slsReceiverImplementation::slsReceiverImplementation() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
InitializeMembers();
|
||||
}
|
||||
|
||||
|
||||
slsReceiverImplementation::~slsReceiverImplementation() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
DeleteMembers();
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::DeleteMembers() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if (generalData) {
|
||||
delete generalData;
|
||||
generalData=0;
|
||||
@ -58,7 +61,7 @@ void slsReceiverImplementation::DeleteMembers() {
|
||||
|
||||
|
||||
void slsReceiverImplementation::InitializeMembers() {
|
||||
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
//**detector parameters***
|
||||
myDetectorType = GENERIC;
|
||||
for (int i = 0; i < MAX_DIMENSIONS; ++i)
|
||||
@ -113,7 +116,7 @@ void slsReceiverImplementation::InitializeMembers() {
|
||||
dataStreamEnable = false;
|
||||
streamingPort = 0;
|
||||
memset(streamingSrcIP, 0, sizeof(streamingSrcIP));
|
||||
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
||||
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
||||
|
||||
//** class objects ***
|
||||
generalData = 0;
|
||||
@ -135,77 +138,77 @@ void slsReceiverImplementation::InitializeMembers() {
|
||||
|
||||
/**initial parameters***/
|
||||
int* slsReceiverImplementation::getMultiDetectorSize() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return (int*) numDet;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return (int*) numDet;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::getDetectorPositionId() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return detID;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return detID;
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getDetectorHostname() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(detHostname);
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::getFlippedData(int axis) const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(axis<0 || axis > 1) return -1;
|
||||
return flippedData[axis];
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getGapPixelsEnable() const {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return gapPixelsEnable;
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
slsDetectorDefs::fileFormat slsReceiverImplementation::getFileFormat() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return fileFormatType;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return fileFormatType;
|
||||
}
|
||||
|
||||
|
||||
std::string slsReceiverImplementation::getFileName() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(fileName);
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getFilePath() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(filePath);
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getFileIndex() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return fileIndex;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return fileIndex;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getFramesPerFile() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return framesPerFile;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return framesPerFile;
|
||||
}
|
||||
|
||||
slsDetectorDefs::frameDiscardPolicy slsReceiverImplementation::getFrameDiscardPolicy() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return frameDiscardMode;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return frameDiscardMode;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getFramePaddingEnable() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return framePadding;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return framePadding;
|
||||
}
|
||||
|
||||
|
||||
bool slsReceiverImplementation::getFileWriteEnable() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return fileWriteEnable;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return fileWriteEnable;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getOverwriteEnable() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return overwriteEnable;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return overwriteEnable;
|
||||
}
|
||||
|
||||
|
||||
@ -261,130 +264,130 @@ int64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
||||
|
||||
/***connection parameters***/
|
||||
uint32_t slsReceiverImplementation::getUDPPortNumber() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return udpPortNum[0];
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return udpPortNum[0];
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getUDPPortNumber2() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return udpPortNum[1];
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return udpPortNum[1];
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getEthernetInterface() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(eth);
|
||||
}
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
std::vector<slsDetectorDefs::ROI> slsReceiverImplementation::getROI() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return roi;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return roi;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getStreamingFrequency() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return streamingFrequency;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return streamingFrequency;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getStreamingTimer() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return streamingTimerInMs;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return streamingTimerInMs;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getDataStreamEnable() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return dataStreamEnable;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return dataStreamEnable;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getAcquisitionPeriod() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return acquisitionPeriod;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return acquisitionPeriod;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getAcquisitionTime() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return acquisitionTime;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return acquisitionTime;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getSubExpTime() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return subExpTime;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return subExpTime;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getSubPeriod() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return subPeriod;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return subPeriod;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getNumberOfFrames() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return numberOfFrames;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfFrames;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getNumberofSamples() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return numberOfSamples;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfSamples;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getDynamicRange() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return dynamicRange;}
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return dynamicRange;}
|
||||
|
||||
bool slsReceiverImplementation::getTenGigaEnable() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return tengigaEnable;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return tengigaEnable;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getFifoDepth() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return fifoDepth;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return fifoDepth;
|
||||
}
|
||||
|
||||
/***receiver status***/
|
||||
slsDetectorDefs::runStatus slsReceiverImplementation::getStatus() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return status;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return status;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getSilentMode() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return silentMode;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return silentMode;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getActivate() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return activated;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return activated;
|
||||
}
|
||||
|
||||
bool slsReceiverImplementation::getDeactivatedPadding() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return deactivatedPaddingEnable;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getStreamingPort() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return streamingPort;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return streamingPort;
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getStreamingSourceIP() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(streamingSrcIP);
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getAdditionalJsonHeader() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return std::string(additionalJsonHeader);
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(additionalJsonHeader);
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getUDPSocketBufferSize() const {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return udpSocketBufferSize;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return udpSocketBufferSize;
|
||||
}
|
||||
|
||||
uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return actualUDPSocketBufferSize;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return actualUDPSocketBufferSize;
|
||||
}
|
||||
|
||||
|
||||
@ -396,7 +399,7 @@ uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const {
|
||||
/**initial parameters***/
|
||||
|
||||
void slsReceiverImplementation::setDetectorHostname(const char *c){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if(strlen(c))
|
||||
strcpy(detHostname, c);
|
||||
@ -405,7 +408,7 @@ void slsReceiverImplementation::setDetectorHostname(const char *c){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setMultiDetectorSize(const int* size) {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
char message[100];
|
||||
strcpy(message, "Detector Size: (");
|
||||
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
||||
@ -423,7 +426,7 @@ void slsReceiverImplementation::setMultiDetectorSize(const int* size) {
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFlippedData(int axis, int enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
@ -469,7 +472,7 @@ void slsReceiverImplementation::setFileFormat(const fileFormat f){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileName(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if(strlen(c))
|
||||
strcpy(fileName, c);
|
||||
@ -478,7 +481,7 @@ void slsReceiverImplementation::setFileName(const char c[]){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFilePath(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
|
||||
if(strlen(c)){
|
||||
@ -494,7 +497,7 @@ void slsReceiverImplementation::setFilePath(const char c[]){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFileIndex(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
fileIndex = i;
|
||||
FILE_LOG(logINFO) << "File Index: " << fileIndex;
|
||||
@ -502,7 +505,7 @@ void slsReceiverImplementation::setFileIndex(const uint64_t i){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFramesPerFile(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
framesPerFile = i;
|
||||
FILE_LOG(logINFO) << "Frames per file: " << framesPerFile;
|
||||
@ -510,7 +513,7 @@ void slsReceiverImplementation::setFramesPerFile(const uint32_t i){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
if (i >= 0 && i < NUM_DISCARD_POLICIES)
|
||||
frameDiscardMode = i;
|
||||
@ -520,7 +523,7 @@ void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i
|
||||
|
||||
|
||||
void slsReceiverImplementation::setFramePaddingEnable(const bool i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
framePadding = i;
|
||||
FILE_LOG(logINFO) << "Frame Padding: " << framePadding;
|
||||
@ -531,7 +534,7 @@ void slsReceiverImplementation::setFileWriteEnable(const bool b){
|
||||
if (fileWriteEnable != b){
|
||||
fileWriteEnable = b;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet,
|
||||
dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet,
|
||||
&framesPerFile, fileName, filePath, &fileIndex, &overwriteEnable,
|
||||
&detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i],
|
||||
generalData);
|
||||
@ -543,7 +546,7 @@ void slsReceiverImplementation::setFileWriteEnable(const bool b){
|
||||
|
||||
|
||||
void slsReceiverImplementation::setOverwriteEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
overwriteEnable = b;
|
||||
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||
@ -552,37 +555,37 @@ void slsReceiverImplementation::setOverwriteEnable(const bool b){
|
||||
|
||||
/***connection parameters***/
|
||||
void slsReceiverImplementation::setUDPPortNumber(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
udpPortNum[0] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
udpPortNum[1] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setEthernetInterface(const char* c){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
strcpy(eth, c);
|
||||
FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
||||
if (listener.size())
|
||||
return listener[0]->CreateDummySocketForUDPSocketBufferSize(s);
|
||||
return FAIL;
|
||||
if (listener.size())
|
||||
return listener[0]->CreateDummySocketForUDPSocketBufferSize(s);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int slsReceiverImplementation::setROI(const std::vector<slsDetectorDefs::ROI> i) {
|
||||
if (myDetectorType != GOTTHARD) {
|
||||
cprintf(RED, "Error: Can not set ROI for this detector\n");
|
||||
FILE_LOG(logERROR) << "Can not set ROI for this detector";
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -651,7 +654,7 @@ int slsReceiverImplementation::setStreamingFrequency(const uint32_t freq) {
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setStreamingTimer(const uint32_t time_in_ms){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
streamingTimerInMs = time_in_ms;
|
||||
FILE_LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs;
|
||||
@ -669,23 +672,23 @@ int slsReceiverImplementation::setDataStreamEnable(const bool enable) {
|
||||
dataStreamer.clear();
|
||||
|
||||
if (enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
}
|
||||
catch(...) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
SetThreadPriorities();
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
}
|
||||
catch(...) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
SetThreadPriorities();
|
||||
}
|
||||
}
|
||||
FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable;
|
||||
@ -701,21 +704,21 @@ void slsReceiverImplementation::setStreamingPort(const uint32_t i) {
|
||||
|
||||
|
||||
void slsReceiverImplementation::setStreamingSourceIP(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
strcpy(streamingSrcIP, c);
|
||||
FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
strcpy(additionalJsonHeader, c);
|
||||
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
strcpy(additionalJsonHeader, c);
|
||||
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
||||
}
|
||||
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionPeriod = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
||||
@ -725,7 +728,7 @@ int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime/(1E9) << "s";
|
||||
@ -735,21 +738,21 @@ int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSubExpTime(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
subExpTime = i;
|
||||
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s";
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSubPeriod(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
subPeriod = i;
|
||||
FILE_LOG(logINFO) << "Sub Exposure Period: " << (double)subPeriod/(1E9) << "s";
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setNumberOfFrames(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
numberOfFrames = i;
|
||||
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
||||
@ -824,7 +827,7 @@ int slsReceiverImplementation::setFifoDepth(const uint32_t i) {
|
||||
|
||||
/***receiver parameters***/
|
||||
bool slsReceiverImplementation::setActivate(bool enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
activated = enable;
|
||||
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
||||
return activated;
|
||||
@ -832,14 +835,14 @@ bool slsReceiverImplementation::setActivate(bool enable){
|
||||
|
||||
|
||||
bool slsReceiverImplementation::setDeactivatedPadding(bool enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
deactivatedPaddingEnable = enable;
|
||||
FILE_LOG(logINFO) << "Deactivated Padding Enable: " << stringEnable(deactivatedPaddingEnable);
|
||||
return deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSilentMode(const bool i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
silentMode = i;
|
||||
FILE_LOG(logINFO) << "Silent Mode: " << i;
|
||||
@ -854,7 +857,7 @@ void slsReceiverImplementation::setSilentMode(const bool i){
|
||||
|
||||
/***initial functions***/
|
||||
int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
FILE_LOG(logDEBUG) << "Setting receiver type";
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
DeleteMembers();
|
||||
InitializeMembers();
|
||||
myDetectorType = d;
|
||||
@ -897,30 +900,30 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
//create threads
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
|
||||
try {
|
||||
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
|
||||
&udpPortNum[i], eth, &numberOfFrames, &dynamicRange,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile,
|
||||
try {
|
||||
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
|
||||
&udpPortNum[i], eth, &numberOfFrames, &dynamicRange,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile,
|
||||
&frameDiscardMode, &activated, &deactivatedPaddingEnable, &silentMode);
|
||||
listener.push_back(l);
|
||||
listener.push_back(l);
|
||||
|
||||
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
||||
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
|
||||
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
||||
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode,
|
||||
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
||||
dataProcessor.push_back(p);
|
||||
}
|
||||
catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")";
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
return FAIL;
|
||||
}
|
||||
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
||||
dataProcessor.push_back(p);
|
||||
}
|
||||
catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")";
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
//set up writer and callbacks
|
||||
@ -931,8 +934,8 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
SetThreadPriorities();
|
||||
|
||||
// check udp socket buffer size
|
||||
setUDPSocketBufferSize(udpSocketBufferSize);
|
||||
// check udp socket buffer size
|
||||
setUDPSocketBufferSize(udpSocketBufferSize);
|
||||
|
||||
FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d);
|
||||
return OK;
|
||||
@ -942,6 +945,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
|
||||
|
||||
void slsReceiverImplementation::setDetectorPositionId(const int i){
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
detID = i;
|
||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
@ -962,6 +966,7 @@ void slsReceiverImplementation::setDetectorPositionId(const int i){
|
||||
|
||||
/***acquisition functions***/
|
||||
void slsReceiverImplementation::resetAcquisitionCount() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
@ -977,7 +982,7 @@ void slsReceiverImplementation::resetAcquisitionCount() {
|
||||
|
||||
|
||||
int slsReceiverImplementation::startReceiver(char *c) {
|
||||
cprintf(RESET,"\n");
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
FILE_LOG(logINFO) << "Starting Receiver";
|
||||
ResetParametersforNewMeasurement();
|
||||
|
||||
@ -1023,6 +1028,7 @@ int slsReceiverImplementation::startReceiver(char *c) {
|
||||
|
||||
|
||||
void slsReceiverImplementation::stopReceiver(){
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
FILE_LOG(logINFO) << "Stopping Receiver";
|
||||
|
||||
//set status to transmitting
|
||||
@ -1031,14 +1037,14 @@ void slsReceiverImplementation::stopReceiver(){
|
||||
//wait for the processes (Listener and DataProcessor) to be done
|
||||
bool running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
running = false;
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
|
||||
@ -1057,13 +1063,13 @@ void slsReceiverImplementation::stopReceiver(){
|
||||
|
||||
//wait for the processes (DataStreamer) to be done
|
||||
running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
}
|
||||
while(running) {
|
||||
running = false;
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
status = RUN_FINISHED;
|
||||
FILE_LOG(logINFO) << "Status: " << runStatusType(status);
|
||||
@ -1075,20 +1081,15 @@ void slsReceiverImplementation::stopReceiver(){
|
||||
tot += dataProcessor[i]->GetNumFramesCaught();
|
||||
|
||||
uint64_t missingpackets = numberOfFrames*generalData->packetsPerFrame-listener[i]->GetPacketsCaught();
|
||||
if ((int)missingpackets > 0) {
|
||||
cprintf(RED, "\n[Port %d]\n",udpPortNum[i]);
|
||||
cprintf(RED, "Missing Packets\t\t: %lld\n",(long long int)missingpackets);
|
||||
cprintf(RED, "Complete Frames\t\t: %lld\n",(long long int)dataProcessor[i]->GetNumFramesCaught());
|
||||
cprintf(RED, "Last Frame Caught\t: %lld\n",(long long int)listener[i]->GetLastFrameIndexCaught());
|
||||
}else{
|
||||
cprintf(GREEN, "\n[Port %d]\n",udpPortNum[i]);
|
||||
cprintf(GREEN, "Missing Packets\t\t: %lld\n",(long long int)missingpackets);
|
||||
cprintf(GREEN, "Complete Frames\t\t: %lld\n",(long long int)dataProcessor[i]->GetNumFramesCaught());
|
||||
cprintf(GREEN, "Last Frame Caught\t: %lld\n",(long long int)listener[i]->GetLastFrameIndexCaught());
|
||||
}
|
||||
FILE_LOG(((int)missingpackets > 0) ? logINFORED : logINFOGREEN) <<
|
||||
"Summary of Port " << udpPortNum[i] <<
|
||||
"\n\tMissing Packets\t\t: " << missingpackets <<
|
||||
"\n\tComplete Frames\t\t: " << dataProcessor[i]->GetNumFramesCaught() <<
|
||||
"\n\tLast Frame Caught\t: " << listener[i]->GetLastFrameIndexCaught();
|
||||
}
|
||||
if(!activated) {
|
||||
FILE_LOG(logINFORED) << "Deactivated Receiver";
|
||||
}
|
||||
if(!activated)
|
||||
cprintf(RED,"Note: Deactivated Receiver\n");
|
||||
//callback
|
||||
if (acquisitionFinishedCallBack)
|
||||
acquisitionFinishedCallBack((tot/numThreads), pAcquisitionFinished);
|
||||
@ -1104,6 +1105,7 @@ void slsReceiverImplementation::stopReceiver(){
|
||||
|
||||
|
||||
void slsReceiverImplementation::startReadout(){
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
if(status == RUNNING){
|
||||
|
||||
// wait for incoming delayed packets
|
||||
@ -1117,11 +1119,8 @@ void slsReceiverImplementation::startReadout(){
|
||||
|
||||
//wait as long as there is change from prev totalP,
|
||||
while(prev != totalP){
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(MAGENTA,"waiting for all packets prevP:%d totalP:%d\n",
|
||||
prev,totalP);
|
||||
|
||||
#endif
|
||||
FILE_LOG(logDEBUG3) << "waiting for all packets prevP:" << prev <<
|
||||
" totalP: " << totalP;
|
||||
//usleep(1*1000*1000);usleep(1*1000*1000);usleep(1*1000*1000);usleep(1*1000*1000);
|
||||
usleep(5*1000);/* Need to find optimal time **/
|
||||
|
||||
@ -1130,9 +1129,7 @@ void slsReceiverImplementation::startReadout(){
|
||||
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(MAGENTA,"\tupdated: totalP:%d\n",totalP);
|
||||
#endif
|
||||
FILE_LOG(logDEBUG3) << "\tupdated: totalP:" << totalP;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1147,6 +1144,7 @@ void slsReceiverImplementation::startReadout(){
|
||||
|
||||
|
||||
void slsReceiverImplementation::shutDownUDPSockets() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ShutDownUDPSocket();
|
||||
}
|
||||
@ -1154,6 +1152,7 @@ void slsReceiverImplementation::shutDownUDPSockets() {
|
||||
|
||||
|
||||
void slsReceiverImplementation::closeFiles() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
uint64_t maxIndexCaught = 0;
|
||||
bool anycaught = false;
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
@ -1168,6 +1167,7 @@ void slsReceiverImplementation::closeFiles() {
|
||||
|
||||
|
||||
int slsReceiverImplementation::restreamStop() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
bool ret = OK;
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
if ((*it)->RestreamStop() == FAIL)
|
||||
@ -1202,40 +1202,41 @@ void slsReceiverImplementation::registerCallBackRawDataReady(void (*func)(char*
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::registerCallBackRawDataModifyReady(void (*func)(char* ,
|
||||
char*, uint32_t&, void*),void *arg){
|
||||
rawDataModifyReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
char*, uint32_t&, void*),void *arg){
|
||||
rawDataModifyReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::SetLocalNetworkParameters() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
// to increase Max length of input packet queue
|
||||
int max_back_log;
|
||||
const char *proc_file_name = "/proc/sys/net/core/netdev_max_backlog";
|
||||
{
|
||||
std::ifstream proc_file(proc_file_name);
|
||||
proc_file >> max_back_log;
|
||||
std::ifstream proc_file(proc_file_name);
|
||||
proc_file >> max_back_log;
|
||||
}
|
||||
|
||||
if (max_back_log < MAX_SOCKET_INPUT_PACKET_QUEUE) {
|
||||
std::ofstream proc_file(proc_file_name);
|
||||
if (proc_file.good()) {
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl;
|
||||
cprintf(GREEN, "Max length of input packet queue "
|
||||
"[/proc/sys/net/core/netdev_max_backlog] modified to %d\n",
|
||||
MAX_SOCKET_INPUT_PACKET_QUEUE);
|
||||
} else {
|
||||
const char *msg = "Could not change max length of "
|
||||
"input packet queue [net.core.netdev_max_backlog]. (No Root Privileges?)";
|
||||
FILE_LOG(logWARNING) << msg;
|
||||
}
|
||||
std::ofstream proc_file(proc_file_name);
|
||||
if (proc_file.good()) {
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl;
|
||||
FILE_LOG(logINFOBLUE) << "Max length of input packet queue "
|
||||
"[/proc/sys/net/core/netdev_max_backlog] modified to " <<
|
||||
MAX_SOCKET_INPUT_PACKET_QUEUE;
|
||||
} else {
|
||||
FILE_LOG(logWARNING) << "Could not change max length of "
|
||||
"input packet queue [net.core.netdev_max_backlog]. (No Root Privileges?)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void slsReceiverImplementation::SetThreadPriorities() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||
@ -1252,7 +1253,8 @@ void slsReceiverImplementation::SetThreadPriorities() {
|
||||
|
||||
|
||||
int slsReceiverImplementation::SetupFifoStructure() {
|
||||
numberofJobs = 1;
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
numberofJobs = 1;
|
||||
|
||||
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
@ -1261,18 +1263,18 @@ int slsReceiverImplementation::SetupFifoStructure() {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
|
||||
//create fifo structure
|
||||
try {
|
||||
Fifo* f = new Fifo (i,
|
||||
(generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize),
|
||||
fifoDepth);
|
||||
fifo.push_back(f);
|
||||
} catch (...) {
|
||||
cprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
return FAIL;
|
||||
}
|
||||
try {
|
||||
Fifo* f = new Fifo (i,
|
||||
(generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize),
|
||||
fifoDepth);
|
||||
fifo.push_back(f);
|
||||
} catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not allocate memory for fifo structure of index " << i;
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
return FAIL;
|
||||
}
|
||||
//set the listener & dataprocessor threads to point to the right fifo
|
||||
if(listener.size())listener[i]->SetFifo(fifo[i]);
|
||||
if(dataProcessor.size())dataProcessor[i]->SetFifo(fifo[i]);
|
||||
@ -1287,6 +1289,7 @@ int slsReceiverImplementation::SetupFifoStructure() {
|
||||
|
||||
|
||||
void slsReceiverImplementation::ResetParametersforNewMeasurement() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
@ -1303,6 +1306,7 @@ void slsReceiverImplementation::ResetParametersforNewMeasurement() {
|
||||
|
||||
|
||||
int slsReceiverImplementation::CreateUDPSockets() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < listener.size(); ++i)
|
||||
if (listener[i]->CreateUDPSockets() == FAIL) {
|
||||
@ -1320,6 +1324,7 @@ int slsReceiverImplementation::CreateUDPSockets() {
|
||||
|
||||
|
||||
int slsReceiverImplementation::SetupWriter() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
||||
if (dataProcessor[i]->CreateNewFile(tengigaEnable,
|
||||
@ -1338,6 +1343,7 @@ int slsReceiverImplementation::SetupWriter() {
|
||||
|
||||
|
||||
void slsReceiverImplementation::StartRunning() {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
//set running mask and post semaphore to start the inner loop in execution thread
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
(*it)->StartRunning();
|
||||
|
@ -141,7 +141,7 @@ void* slsReceiverTCPIPInterface::startTCPServerThread(void *this_pointer){
|
||||
|
||||
|
||||
void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Created [ TCP server Tid: " << syscall(SYS_gettid) << "]";;
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << std::endl;
|
||||
int ret = OK;
|
||||
|
||||
@ -159,7 +159,7 @@ void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
}
|
||||
|
||||
mySock->exitServer();
|
||||
cprintf(BLUE,"Exiting [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) <<"]";
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
receiver->shutDownUDPSockets();
|
||||
}
|
||||
}
|
||||
cprintf(BLUE,"Exiting [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) <<"]";
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
}
|
||||
@ -229,7 +229,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
FILE_LOG(logDEBUG5) << "function fnum: " << i << " (" <<
|
||||
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i];
|
||||
}
|
||||
|
||||
@ -243,28 +243,29 @@ int slsReceiverTCPIPInterface::decode_function(){
|
||||
ret = FAIL;
|
||||
int n = mySock->ReceiveDataOnly(&fnum,sizeof(fnum));
|
||||
if (n <= 0) {
|
||||
FILE_LOG(logDEBUG5) << "Could not read socket. "
|
||||
FILE_LOG(logDEBUG3) << "Could not read socket. "
|
||||
"Received " << n << " bytes," <<
|
||||
"fnum:" << fnum << " "
|
||||
"(" << getFunctionNameFromEnum((enum detFuncs)fnum) << ")";
|
||||
return FAIL;
|
||||
}
|
||||
else
|
||||
FILE_LOG(logDEBUG5) << "Received " << n << " bytes";
|
||||
FILE_LOG(logDEBUG3) << "Received " << n << " bytes";
|
||||
|
||||
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
|
||||
FILE_LOG(logERROR) << "Unknown function enum " << fnum;
|
||||
ret = (this->M_nofunc)();
|
||||
} else{
|
||||
FILE_LOG(logDEBUG5) << "calling function fnum: "<< fnum << " "
|
||||
FILE_LOG(logDEBUG1) << "calling function fnum: "<< fnum << " "
|
||||
"(" << getFunctionNameFromEnum((enum detFuncs)fnum) << ") "
|
||||
"located at " << flist[fnum];
|
||||
ret = (this->*flist[fnum])();
|
||||
|
||||
if (ret == FAIL) {
|
||||
FILE_LOG(logDEBUG5) << "Failed to execute function = " << fnum << " ("
|
||||
FILE_LOG(logDEBUG1) << "Failed to execute function = " << fnum << " ("
|
||||
<< getFunctionNameFromEnum((enum detFuncs)fnum) << ")";
|
||||
}
|
||||
} else FILE_LOG(logDEBUG1) << "Function " <<
|
||||
getFunctionNameFromEnum((enum detFuncs)fnum) << " executed OK";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -352,7 +353,7 @@ int slsReceiverTCPIPInterface::exec_command() {
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::exit_server() {
|
||||
cprintf(BG_RED, "Closing server\n");
|
||||
FILE_LOG(logINFO) << "Closing server";
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
interface->Server_SendResult(false, ret, NULL, 0);
|
||||
@ -369,7 +370,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;
|
||||
FILE_LOG(logDEBUG1) << "Locking Server to " << lock;
|
||||
|
||||
// execute action
|
||||
if (lock >= 0) {
|
||||
@ -642,7 +643,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
// get
|
||||
std::string s = receiver->getDetectorHostname();
|
||||
strcpy(retval, s.c_str());
|
||||
if (s.length()) {
|
||||
if (!s.length()) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "hostname not set\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
@ -675,9 +676,9 @@ int slsReceiverTCPIPInterface::set_roi() {
|
||||
return interface->Server_SocketCrash();
|
||||
arg.push_back(temp);
|
||||
}
|
||||
FILE_LOG(logDEBUG5) << "Set ROI narg: " << narg;
|
||||
FILE_LOG(logDEBUG1) << "Set ROI narg: " << narg;
|
||||
for (int iloop = 0; iloop < narg; ++iloop) {
|
||||
FILE_LOG(logDEBUG5) << "(" << arg[iloop].xmin << ", " <<
|
||||
FILE_LOG(logDEBUG1) << "(" << arg[iloop].xmin << ", " <<
|
||||
arg[iloop].xmax << ", " << arg[iloop].ymin << ", " <<
|
||||
arg[iloop].ymax << ")";
|
||||
}
|
||||
@ -705,7 +706,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
char args[3][MAX_STR_LENGTH] = {0};
|
||||
char retval[MAX_STR_LENGTH] = {0};
|
||||
char retvals[MAX_STR_LENGTH] = {0};
|
||||
|
||||
// get args, return if socket crashed, ret is fail if receiver is not null
|
||||
if (interface->Server_ReceiveArg(ret, mess, args, sizeof(args), true, receiver) == FAIL)
|
||||
@ -755,13 +756,13 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
FILE_LOG(logERROR) << mess;
|
||||
}
|
||||
else {
|
||||
strcpy(retval,temp.c_str());
|
||||
FILE_LOG(logINFO) << "Reciever MAC Address: " << retval;
|
||||
strcpy(retvals,temp.c_str());
|
||||
FILE_LOG(logINFO) << "Reciever MAC Address: " << retvals;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, retval, sizeof(retval), mess);
|
||||
return interface->Server_SendResult(true, ret, retvals, sizeof(retvals), mess);
|
||||
}
|
||||
|
||||
|
||||
@ -778,7 +779,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
|
||||
// base object not null
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting timer index " << index[0] << " to " << index[1];
|
||||
FILE_LOG(logDEBUG1) << "Setting timer index " << index[0] << " to " << index[1];
|
||||
|
||||
// set
|
||||
if (index[1] >= 0) {
|
||||
@ -848,7 +849,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
break;
|
||||
}
|
||||
validate((int)index[1], (int)retval, std::string("set timer"), 0);
|
||||
FILE_LOG(logDEBUG5) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval;
|
||||
FILE_LOG(logDEBUG1) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -871,7 +872,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
if (dr >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting dynamic range: " << dr;
|
||||
FILE_LOG(logDEBUG1) << "Setting dynamic range: " << dr;
|
||||
bool exists = false;
|
||||
switch (dr) {
|
||||
case 16:
|
||||
@ -903,7 +904,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
// get
|
||||
retval = receiver->getDynamicRange();
|
||||
validate(dr, retval, std::string("set dynamic range"), 0);
|
||||
FILE_LOG(logDEBUG5) << "dynamic range: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "dynamic range: " << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -926,7 +927,7 @@ int slsReceiverTCPIPInterface::set_streaming_frequency() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting streaming frequency: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting streaming frequency: " << index;
|
||||
ret = receiver->setStreamingFrequency(index);
|
||||
if(ret == FAIL) {
|
||||
strcpy(mess, "Could not allocate memory for listening fifo\n");
|
||||
@ -952,9 +953,9 @@ int slsReceiverTCPIPInterface::get_status(){
|
||||
interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver);
|
||||
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Getting Status";
|
||||
FILE_LOG(logDEBUG1) << "Getting Status";
|
||||
retval = receiver->getStatus();
|
||||
FILE_LOG(logDEBUG5) << "Status:" << runStatusType(retval);
|
||||
FILE_LOG(logDEBUG1) << "Status:" << runStatusType(retval);
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -980,7 +981,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
sprintf(mess,"Cannot start Receiver as it is in %s state\n",runStatusType(s).c_str());
|
||||
FILE_LOG(logERROR) << mess;
|
||||
}else {
|
||||
FILE_LOG(logDEBUG5) << "Starting Reciever";
|
||||
FILE_LOG(logDEBUG1) << "Starting Reciever";
|
||||
ret = receiver->startReceiver(mess);
|
||||
if (ret == FAIL) {
|
||||
FILE_LOG(logERROR) << mess;
|
||||
@ -1006,7 +1007,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
// verify if receiver is unlocked
|
||||
if (interface->Server_VerifyLock(ret, mess, lockStatus) == OK) {
|
||||
if(receiver->getStatus() != IDLE) {
|
||||
FILE_LOG(logDEBUG5) << "Stopping Reciever";
|
||||
FILE_LOG(logDEBUG1) << "Stopping Reciever";
|
||||
receiver->stopReceiver();
|
||||
}
|
||||
enum runStatus s = receiver->getStatus();
|
||||
@ -1038,18 +1039,18 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
if (ret == OK) {
|
||||
// set
|
||||
if (strlen(fPath)) {
|
||||
FILE_LOG(logDEBUG5) << "Setting file path: " << fPath;
|
||||
FILE_LOG(logDEBUG1) << "Setting file path: " << fPath;
|
||||
receiver->setFilePath(fPath);
|
||||
}
|
||||
// get
|
||||
std::string s = receiver->getFilePath();
|
||||
strcpy(retval, s.c_str());
|
||||
if ((s.length()) || (strlen(fPath) && strcasecmp(fPath, retval))) {
|
||||
if ((!s.length()) || (strlen(fPath) && strcasecmp(fPath, retval))) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"receiver file path does not exist\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else
|
||||
FILE_LOG(logDEBUG5) << "file path:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "file path:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess);
|
||||
}
|
||||
@ -1070,18 +1071,18 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
if (ret == OK) {
|
||||
// set
|
||||
if (strlen(fName)) {
|
||||
FILE_LOG(logDEBUG5) << "Setting file name: " << fName;
|
||||
FILE_LOG(logDEBUG1) << "Setting file name: " << fName;
|
||||
receiver->setFileName(fName);
|
||||
}
|
||||
// get
|
||||
std::string s = receiver->getFileName();
|
||||
strcpy(retval, s.c_str());
|
||||
if (s.length()) {
|
||||
if (!s.length()) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "file name is empty\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else
|
||||
FILE_LOG(logDEBUG5) << "file name:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "file name:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess);
|
||||
}
|
||||
@ -1104,14 +1105,14 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting file index: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting file index: " << index;
|
||||
receiver->setFileIndex(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval=receiver->getFileIndex();
|
||||
validate(index, retval, std::string("set file index"), 0);
|
||||
FILE_LOG(logDEBUG5) << "file index:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "file index:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||
}
|
||||
@ -1127,9 +1128,9 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
||||
interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver);
|
||||
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Getting frame index";
|
||||
FILE_LOG(logDEBUG1) << "Getting frame index";
|
||||
retval = receiver->getAcquisitionIndex();
|
||||
FILE_LOG(logDEBUG5) << "frame index:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "frame index:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||
}
|
||||
@ -1145,9 +1146,9 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
||||
interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver);
|
||||
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Getting frames caught";
|
||||
FILE_LOG(logDEBUG1) << "Getting frames caught";
|
||||
retval = receiver->getTotalFramesCaught();
|
||||
FILE_LOG(logDEBUG5) << "frames caught:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "frames caught:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||
}
|
||||
@ -1166,7 +1167,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
||||
// only set
|
||||
// verify if receiver is unlocked
|
||||
if (interface->Server_VerifyLock(ret, mess, lockStatus) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Reset frames caught";
|
||||
FILE_LOG(logDEBUG1) << "Reset frames caught";
|
||||
receiver->resetAcquisitionCount();
|
||||
}
|
||||
}
|
||||
@ -1191,14 +1192,14 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
||||
if (enable >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting File write enable:" << enable;
|
||||
FILE_LOG(logDEBUG1) << "Setting File write enable:" << enable;
|
||||
receiver->setFileWriteEnable(enable);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getFileWriteEnable();
|
||||
validate(enable, retval, std::string("set file write enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "file write enable:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "file write enable:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1221,14 +1222,14 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting File overwrite enable:" << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting File overwrite enable:" << index;
|
||||
receiver->setOverwriteEnable(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getOverwriteEnable();
|
||||
validate(index, retval, std::string("set file overwrite enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "file overwrite enable:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "file overwrite enable:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1254,14 +1255,14 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
if (val >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting 10GbE:" << val;
|
||||
FILE_LOG(logDEBUG1) << "Setting 10GbE:" << val;
|
||||
ret = receiver->setTenGigaEnable(val);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getTenGigaEnable();
|
||||
validate(val, retval, std::string("set 10GbE"), 0);
|
||||
FILE_LOG(logDEBUG5) << "10Gbe:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "10Gbe:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1284,7 +1285,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
||||
if (value >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting fifo depth:" << value;
|
||||
FILE_LOG(logDEBUG1) << "Setting fifo depth:" << value;
|
||||
ret = receiver->setFifoDepth(value);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess,"Could not set fifo depth");
|
||||
@ -1295,7 +1296,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
||||
// get
|
||||
retval = receiver->getFifoDepth();
|
||||
validate(value, retval, std::string("set fifo depth"), 0);
|
||||
FILE_LOG(logDEBUG5) << "fifo depth:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "fifo depth:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1321,14 +1322,14 @@ int slsReceiverTCPIPInterface::set_activate() {
|
||||
if (enable >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting activate:" << enable;
|
||||
FILE_LOG(logDEBUG1) << "Setting activate:" << enable;
|
||||
receiver->setActivate(enable > 0 ? true : false);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = (int)receiver->getActivate();
|
||||
validate(enable, retval, std::string("set activate"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Activate: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1351,14 +1352,14 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting data stream enable:" << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting data stream enable:" << index;
|
||||
ret = receiver->setDataStreamEnable(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getDataStreamEnable();
|
||||
validate(index, retval, std::string("set data stream enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "data streaming enable:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "data streaming enable:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1381,14 +1382,14 @@ int slsReceiverTCPIPInterface::set_streaming_timer(){
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting streaming timer:" << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting streaming timer:" << index;
|
||||
receiver->setStreamingTimer(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval=receiver->getStreamingTimer();
|
||||
validate(index, retval, std::string("set data stream timer"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Streaming timer:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "Streaming timer:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1414,14 +1415,14 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
|
||||
if (args[1] >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting flipped data:" << args[1];
|
||||
FILE_LOG(logDEBUG1) << "Setting flipped data:" << args[1];
|
||||
receiver->setFlippedData(args[0],args[1]);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval=receiver->getFlippedData(args[0]);
|
||||
validate(args[1], retval, std::string("set flipped data"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Flipped Data:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1444,14 +1445,14 @@ int slsReceiverTCPIPInterface::set_file_format() {
|
||||
if (f >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting file format:" << f;
|
||||
FILE_LOG(logDEBUG1) << "Setting file format:" << f;
|
||||
receiver->setFileFormat(f);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getFileFormat();
|
||||
validate(f, retval, std::string("set file format"), 0);
|
||||
FILE_LOG(logDEBUG5) << "File Format: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "File Format: " << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1474,14 +1475,14 @@ int slsReceiverTCPIPInterface::set_detector_posid() {
|
||||
if (arg >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting detector position id:" << arg;
|
||||
FILE_LOG(logDEBUG1) << "Setting detector position id:" << arg;
|
||||
receiver->setDetectorPositionId(arg);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getDetectorPositionId();
|
||||
validate(arg, retval, std::string("set detector position id"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Position Id:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "Position Id:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1504,7 +1505,7 @@ int slsReceiverTCPIPInterface::set_multi_detector_size() {
|
||||
if((arg[0] > 0) && (arg[1] > 0)) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting multi detector size:" << arg[0] << "," << arg[1];
|
||||
FILE_LOG(logDEBUG1) << "Setting multi detector size:" << arg[0] << "," << arg[1];
|
||||
receiver->setMultiDetectorSize(arg);
|
||||
}
|
||||
}
|
||||
@ -1516,7 +1517,7 @@ int slsReceiverTCPIPInterface::set_multi_detector_size() {
|
||||
else
|
||||
retval *= temp[i];
|
||||
}
|
||||
FILE_LOG(logDEBUG5) << "Multi Detector Size:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "Multi Detector Size:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1539,14 +1540,14 @@ int slsReceiverTCPIPInterface::set_streaming_port() {
|
||||
if (port >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting streaming port:" << port;
|
||||
FILE_LOG(logDEBUG1) << "Setting streaming port:" << port;
|
||||
receiver->setStreamingPort(port);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getStreamingPort();
|
||||
validate(port, retval, std::string("set streaming port"), 0);
|
||||
FILE_LOG(logDEBUG5) << "streaming port:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "streaming port:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1568,12 +1569,12 @@ int slsReceiverTCPIPInterface::set_streaming_source_ip() {
|
||||
// only set
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting streaming source ip:" << arg;
|
||||
FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg;
|
||||
receiver->setStreamingSourceIP(arg);
|
||||
}
|
||||
// get
|
||||
strcpy(retval, receiver->getStreamingSourceIP().c_str());
|
||||
FILE_LOG(logDEBUG5) << "streaming source ip:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "streaming source ip:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess);
|
||||
}
|
||||
@ -1596,14 +1597,14 @@ int slsReceiverTCPIPInterface::set_silent_mode() {
|
||||
if (value >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting silent mode:" << value;
|
||||
FILE_LOG(logDEBUG1) << "Setting silent mode:" << value;
|
||||
receiver->setSilentMode(value);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = (int)receiver->getSilentMode();
|
||||
validate(value, retval, std::string("set silent mode"), 0);
|
||||
FILE_LOG(logDEBUG5) << "silent mode:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "silent mode:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1629,14 +1630,14 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
||||
if (enable >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting gap pixels enable:" << enable;
|
||||
FILE_LOG(logDEBUG1) << "Setting gap pixels enable:" << enable;
|
||||
receiver->setGapPixelsEnable(enable);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getGapPixelsEnable();
|
||||
validate(enable, retval, std::string("set gap pixels enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Gap Pixels Enable: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "Gap Pixels Enable: " << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1660,7 +1661,7 @@ int slsReceiverTCPIPInterface::restream_stop(){
|
||||
sprintf(mess,"Could not restream stop packet as data Streaming is disabled.\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else {
|
||||
FILE_LOG(logDEBUG5) << "Restreaming stop";
|
||||
FILE_LOG(logDEBUG1) << "Restreaming stop";
|
||||
ret = receiver->restreamStop();
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,"Could not restream stop packet.\n");
|
||||
@ -1689,12 +1690,12 @@ int slsReceiverTCPIPInterface::set_additional_json_header() {
|
||||
// only set
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting additional json header: " << arg;
|
||||
FILE_LOG(logDEBUG1) << "Setting additional json header: " << arg;
|
||||
receiver->setAdditionalJsonHeader(arg);
|
||||
}
|
||||
// get
|
||||
strcpy(retval, receiver->getAdditionalJsonHeader().c_str());
|
||||
FILE_LOG(logDEBUG5) << "additional json header:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "additional json header:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess);
|
||||
}
|
||||
@ -1717,7 +1718,7 @@ int slsReceiverTCPIPInterface::set_udp_socket_buffer_size() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting UDP Socket Buffer size: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << index;
|
||||
if (receiver->setUDPSocketBufferSize(index) == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not create dummy UDP Socket to test buffer size\n");
|
||||
@ -1728,7 +1729,7 @@ int slsReceiverTCPIPInterface::set_udp_socket_buffer_size() {
|
||||
// get
|
||||
retval = receiver->getUDPSocketBufferSize();
|
||||
validate(index, retval, std::string("set udp socket buffer size (No CAP_NET_ADMIN privileges?)"), 0);
|
||||
FILE_LOG(logDEBUG5) << "UDP Socket Buffer Size:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1744,7 +1745,7 @@ int slsReceiverTCPIPInterface::get_real_udp_socket_buffer_size(){
|
||||
interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver);
|
||||
|
||||
if (ret == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Getting actual UDP buffer size";
|
||||
FILE_LOG(logDEBUG1) << "Getting actual UDP buffer size";
|
||||
retval = receiver->getActualUDPSocketBufferSize();
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
@ -1768,14 +1769,14 @@ int slsReceiverTCPIPInterface::set_frames_per_file() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting frames per file: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting frames per file: " << index;
|
||||
receiver->setFramesPerFile(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getFramesPerFile();
|
||||
validate(index, retval, std::string("set frames per file"), 0);
|
||||
FILE_LOG(logDEBUG5) << "frames per file:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "frames per file:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1790,7 +1791,7 @@ 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(logDEBUG5) << "Checking versioning compatibility with value " << arg;
|
||||
FILE_LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg;
|
||||
int64_t client_requiredVersion = arg;
|
||||
int64_t rx_apiVersion = APIRECEIVER;
|
||||
int64_t rx_version = getReceiverVersion();
|
||||
@ -1838,14 +1839,14 @@ int slsReceiverTCPIPInterface::set_discard_policy() {
|
||||
if (index >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting frames discard policy: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting frames discard policy: " << index;
|
||||
receiver->setFrameDiscardPolicy((frameDiscardPolicy)index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = receiver->getFrameDiscardPolicy();
|
||||
validate(index, retval, std::string("set discard policy"), 0);
|
||||
FILE_LOG(logDEBUG5) << "frame discard policy:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "frame discard policy:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1869,14 +1870,14 @@ int slsReceiverTCPIPInterface::set_padding_enable() {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
index = (index == 0) ? 0 : 1;
|
||||
FILE_LOG(logDEBUG5) << "Setting frames padding enable: " << index;
|
||||
FILE_LOG(logDEBUG1) << "Setting frames padding enable: " << index;
|
||||
receiver->setFramePaddingEnable(index);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = (int)receiver->getFramePaddingEnable();
|
||||
validate(index, retval, std::string("set frame padding enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Frame Padding Enable:" << retval;
|
||||
FILE_LOG(logDEBUG1) << "Frame Padding Enable:" << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
@ -1902,14 +1903,14 @@ int slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable() {
|
||||
if (enable >= 0) {
|
||||
// verify if receiver is unlocked and idle
|
||||
if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) {
|
||||
FILE_LOG(logDEBUG5) << "Setting deactivated padding enable: " << enable;
|
||||
FILE_LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable;
|
||||
receiver->setDeactivatedPadding(enable > 0 ? true : false);
|
||||
}
|
||||
}
|
||||
// get
|
||||
retval = (int)receiver->getDeactivatedPadding();
|
||||
validate(enable, retval, std::string("set deactivated padding enable"), 0);
|
||||
FILE_LOG(logDEBUG5) << "Deactivated Padding Enable: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval;
|
||||
}
|
||||
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||
}
|
||||
|
Reference in New Issue
Block a user