mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 17:40:01 +02:00
just started changin frm ostringstream
This commit is contained in:
parent
9468b9ca1e
commit
91b7a87557
@ -21,7 +21,7 @@
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
|
|
||||||
class UDPInterface {
|
class UDPInterface: public Logger {
|
||||||
|
|
||||||
|
|
||||||
/* abstract class that defines the UDP interface of an sls detector data receiver.
|
/* abstract class that defines the UDP interface of an sls detector data receiver.
|
||||||
|
@ -831,6 +831,9 @@ private:
|
|||||||
/** Progress (currentFrameNumber) Mutex */
|
/** Progress (currentFrameNumber) Mutex */
|
||||||
pthread_mutex_t progressMutex;
|
pthread_mutex_t progressMutex;
|
||||||
|
|
||||||
|
char streambuf[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
|
||||||
|
char cstreambuf[MAX_STR_LENGTH];
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ enum communicationProtocol{
|
|||||||
total_sent(0),// sender (client): where to? ip
|
total_sent(0),// sender (client): where to? ip
|
||||||
header_packet_size(0)
|
header_packet_size(0)
|
||||||
{
|
{
|
||||||
memset(&serverAddress, 0, sizeof(serverAddress));
|
memset(&serverAddress, 0,sizeof(serverAddress));
|
||||||
memset(&clientAddress, 0, sizeof(clientAddress));
|
memset(&clientAddress,0,sizeof(clientAddress));
|
||||||
// strcpy(hostname,host_ip_or_name);
|
// strcpy(hostname,host_ip_or_name);
|
||||||
|
|
||||||
strcpy(lastClientIP,"none");
|
strcpy(lastClientIP,"none");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//#ifndef __LOG_H__
|
#ifndef __LOG_H__
|
||||||
//#define __LOG_H__
|
#define __LOG_H__
|
||||||
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -20,108 +21,21 @@
|
|||||||
#define FILELOG_MAX_LEVEL logINFO
|
#define FILELOG_MAX_LEVEL logINFO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define REPORT_LEVEL logDEBUG5
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
|
||||||
#define TOSTRING(x) STRINGIFY(x)
|
|
||||||
#define MYCONCAT(x,y)
|
|
||||||
#define __AT__ string(__FILE__) + string("::") + string(__func__) + string("(): ")
|
|
||||||
#define __SHORT_FORM_OF_FILE__ \
|
|
||||||
(strrchr(__FILE__,'/') \
|
|
||||||
? strrchr(__FILE__,'/')+1 \
|
|
||||||
: __FILE__ \
|
|
||||||
)
|
|
||||||
#define __SHORT_AT__ string(__SHORT_FORM_OF_FILE__) + string("::") + string(__func__) + string("(): ")
|
|
||||||
|
|
||||||
//":" TOSTRING(__LINE__)
|
|
||||||
|
|
||||||
/*
|
|
||||||
void error(const char *location, const char *msg){
|
|
||||||
printf("Error at %s: %s\n", location, msg);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
inline std::string NowTime();
|
|
||||||
|
|
||||||
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
|
|
||||||
|
|
||||||
template <typename T> class Log{
|
|
||||||
public:
|
|
||||||
Log();
|
|
||||||
virtual ~Log();
|
|
||||||
std::ostringstream& Get(TLogLevel level = logINFO);
|
|
||||||
static TLogLevel& ReportingLevel();
|
|
||||||
static std::string ToString(TLogLevel level);
|
|
||||||
static TLogLevel FromString(const std::string& level);
|
|
||||||
protected:
|
|
||||||
std::ostringstream os;
|
|
||||||
TLogLevel lev;
|
|
||||||
private:
|
|
||||||
Log(const Log&);
|
|
||||||
Log& operator =(const Log&);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Output2FILE {
|
|
||||||
public:
|
|
||||||
static FILE*& Stream();
|
|
||||||
static void Output(const std::string& msg);
|
|
||||||
static void Output(const std::string& msg, TLogLevel level);
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
|
||||||
# if defined (BUILDING_FILELOG_DLL)
|
|
||||||
# define FILELOG_DECLSPEC __declspec (dllexport)
|
|
||||||
# elif defined (USING_FILELOG_DLL)
|
|
||||||
# define FILELOG_DECLSPEC __declspec (dllimport)
|
|
||||||
# else
|
|
||||||
# define FILELOG_DECLSPEC
|
|
||||||
# endif // BUILDING_DBSIMPLE_DLL
|
|
||||||
#else
|
|
||||||
# define FILELOG_DECLSPEC
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
class FILELOG_DECLSPEC FILELog : public Log<Output2FILE> {};
|
|
||||||
//typedef Log<Output2FILE> FILELog;
|
|
||||||
|
|
||||||
#ifdef REST
|
|
||||||
#define FILE_LOG(level) \
|
|
||||||
if (level > FILELOG_MAX_LEVEL) ; \
|
|
||||||
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
|
|
||||||
else FILELog().Get(level)
|
|
||||||
#else
|
|
||||||
#define FILE_LOG(level) \
|
|
||||||
if (level > FILELOG_MAX_LEVEL) ; \
|
|
||||||
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
|
|
||||||
else FILELog().Get(level)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline std::string NowTime()
|
|
||||||
|
|
||||||
{
|
|
||||||
const int MAX_LEN = 200;
|
|
||||||
char buffer[MAX_LEN];
|
|
||||||
if (GetTimeFormatA(LOCALE_USER_DEFAULT, 0, 0,
|
|
||||||
"HH':'mm':'ss", buffer, MAX_LEN) == 0)
|
|
||||||
return "Error in NowTime()";
|
|
||||||
|
|
||||||
char result[100] = {0};
|
|
||||||
static DWORD first = GetTickCount();
|
|
||||||
sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount() - first) % 1000);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
inline std::string NowTime()
|
|
||||||
{
|
class Logger {
|
||||||
|
public:
|
||||||
|
Logger(){};
|
||||||
|
|
||||||
|
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
|
||||||
|
|
||||||
|
|
||||||
|
static void FILE_LOG(TLogLevel level, char* msg)
|
||||||
|
{
|
||||||
char buffer[11];
|
char buffer[11];
|
||||||
const int buffer_len = sizeof(buffer);
|
const int buffer_len = sizeof(buffer);
|
||||||
time_t t;
|
time_t t;
|
||||||
@ -135,115 +49,38 @@ inline std::string NowTime()
|
|||||||
const int result_len = sizeof(result);
|
const int result_len = sizeof(result);
|
||||||
snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
||||||
result[result_len - 1] = 0;
|
result[result_len - 1] = 0;
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //WIN32
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T> Log<T>::Log():lev(logDEBUG){}
|
/*
|
||||||
|
const char* const slevel[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"};
|
||||||
|
ostringstream os;
|
||||||
|
os << "- " << string(result);
|
||||||
|
os << " " << string(slevel[level]) << ": ";
|
||||||
|
// if (level > logDEBUG)
|
||||||
|
// os << std::string(level - logDEBUG, '\t');
|
||||||
|
os << msg;
|
||||||
|
string smessage = os.str();
|
||||||
|
|
||||||
template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level)
|
|
||||||
{
|
|
||||||
lev = level;
|
|
||||||
os << "- " << NowTime();
|
|
||||||
os << " " << ToString(level) << ": ";
|
|
||||||
if (level > logDEBUG)
|
|
||||||
os << std::string(level - logDEBUG, '\t');
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> Log<T>::~Log()
|
|
||||||
{
|
|
||||||
os << std::endl;
|
|
||||||
#ifdef REST
|
|
||||||
T::Output( os.str());
|
|
||||||
#else
|
|
||||||
T::Output( os.str(),lev);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> TLogLevel& Log<T>::ReportingLevel()
|
|
||||||
{
|
|
||||||
static TLogLevel reportingLevel = logDEBUG5;
|
|
||||||
return reportingLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> std::string Log<T>::ToString(TLogLevel level)
|
|
||||||
{
|
|
||||||
static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"};
|
|
||||||
return buffer[level];
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
TLogLevel Log<T>::FromString(const std::string& level)
|
|
||||||
{
|
|
||||||
if (level == "DEBUG5")
|
|
||||||
return logDEBUG5;
|
|
||||||
if (level == "DEBUG4")
|
|
||||||
return logDEBUG4;
|
|
||||||
if (level == "DEBUG3")
|
|
||||||
return logDEBUG3;
|
|
||||||
if (level == "DEBUG2")
|
|
||||||
return logDEBUG2;
|
|
||||||
if (level == "DEBUG1")
|
|
||||||
return logDEBUG1;
|
|
||||||
if (level == "DEBUG")
|
|
||||||
return logDEBUG;
|
|
||||||
if (level == "INFO")
|
|
||||||
return logINFO;
|
|
||||||
if (level == "WARNING")
|
|
||||||
return logWARNING;
|
|
||||||
if (level == "ERROR")
|
|
||||||
return logERROR;
|
|
||||||
Log<T>().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default.";
|
|
||||||
return logINFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline FILE*& Output2FILE::Stream()
|
|
||||||
{
|
|
||||||
static FILE* pStream = stderr;
|
|
||||||
return pStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Output2FILE::Output(const std::string& msg)
|
|
||||||
{
|
|
||||||
FILE* pStream = Stream();
|
|
||||||
if (!pStream)
|
|
||||||
return;
|
|
||||||
fprintf(pStream, "%s", msg.c_str());
|
|
||||||
fflush(pStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Output2FILE::Output(const std::string& msg, TLogLevel level)
|
|
||||||
{
|
|
||||||
FILE* pStream = Stream();
|
|
||||||
if (!pStream)
|
|
||||||
return;
|
|
||||||
bool out = true;
|
|
||||||
switch(level){
|
switch(level){
|
||||||
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
|
case logERROR: cprintf(RED BOLD, "%s\n", smessage.c_str()); break;
|
||||||
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
|
case logWARNING: cprintf(YELLOW BOLD, "%s\n", smessage.c_str()); break;
|
||||||
case logINFO: cprintf(GRAY,"%s",msg.c_str());break;
|
case logINFO: cprintf(GRAY, "%s\n", smessage.c_str()); break;
|
||||||
// case logINFO: cprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
|
default: break;
|
||||||
default: fprintf(pStream,"%s",msg.c_str()); out = false; break;
|
|
||||||
}
|
}
|
||||||
fflush(out ? stdout : pStream);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
switch(level){
|
||||||
# if defined (BUILDING_FILELOG_DLL)
|
case logERROR: cprintf(RED BOLD, "- %s ERROR: %s", result, msg); break;
|
||||||
# define FILELOG_DECLSPEC __declspec (dllexport)
|
case logWARNING: cprintf(YELLOW BOLD,"- %s WARNING: %s", result, msg); break;
|
||||||
# elif defined (USING_FILELOG_DLL)
|
case logINFO: cprintf(GRAY, "- %s INFO: %s", result, msg); break;
|
||||||
# define FILELOG_DECLSPEC __declspec (dllimport)
|
default: break;
|
||||||
# else
|
}
|
||||||
# define FILELOG_DECLSPEC
|
|
||||||
# endif // BUILDING_DBSIMPLE_DLL
|
|
||||||
#else
|
|
||||||
# define FILELOG_DECLSPEC
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
//#endif //__LOG_H__
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__LOG_H__
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*@short creates the UDP and TCP class objects
|
*@short creates the UDP and TCP class objects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class slsReceiver : private virtual slsReceiverDefs {
|
class slsReceiver : public Logger, private virtual slsReceiverDefs {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*@short interface between receiver and client
|
*@short interface between receiver and client
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
class slsReceiverTCPIPInterface : public Logger, private virtual slsReceiverDefs {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@ using namespace std;
|
|||||||
* They access local cache of configuration or detector parameters *******
|
* They access local cache of configuration or detector parameters *******
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
UDPBaseImplementation::UDPBaseImplementation(){
|
UDPBaseImplementation::UDPBaseImplementation(){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
initializeMembers();
|
initializeMembers();
|
||||||
|
|
||||||
@ -33,9 +32,7 @@ UDPBaseImplementation::UDPBaseImplementation(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::initializeMembers(){
|
void UDPBaseImplementation::initializeMembers(){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "Info: Initializing base members";
|
|
||||||
//**detector parameters***
|
//**detector parameters***
|
||||||
myDetectorType = GENERIC;
|
myDetectorType = GENERIC;
|
||||||
strcpy(detHostname,"");
|
strcpy(detHostname,"");
|
||||||
@ -93,7 +90,6 @@ UDPBaseImplementation::~UDPBaseImplementation(){}
|
|||||||
|
|
||||||
/**initial parameters***/
|
/**initial parameters***/
|
||||||
char *UDPBaseImplementation::getDetectorHostname() const{
|
char *UDPBaseImplementation::getDetectorHostname() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
//not initialized
|
||||||
if(!strlen(detHostname))
|
if(!strlen(detHostname))
|
||||||
@ -106,7 +102,6 @@ char *UDPBaseImplementation::getDetectorHostname() const{
|
|||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::getFlippedData(int axis) const{
|
int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
if(axis<0 || axis > 1) return -1;
|
if(axis<0 || axis > 1) return -1;
|
||||||
return flippedData[axis];
|
return flippedData[axis];
|
||||||
}
|
}
|
||||||
@ -114,7 +109,6 @@ int UDPBaseImplementation::getFlippedData(int axis) const{
|
|||||||
|
|
||||||
/***file parameters***/
|
/***file parameters***/
|
||||||
char *UDPBaseImplementation::getFileName() const{
|
char *UDPBaseImplementation::getFileName() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
//not initialized
|
||||||
if(!strlen(fileName))
|
if(!strlen(fileName))
|
||||||
@ -127,7 +121,6 @@ char *UDPBaseImplementation::getFileName() const{
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *UDPBaseImplementation::getFilePath() const{
|
char *UDPBaseImplementation::getFilePath() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
//not initialized
|
//not initialized
|
||||||
if(!strlen(filePath))
|
if(!strlen(filePath))
|
||||||
@ -139,25 +132,24 @@ char *UDPBaseImplementation::getFilePath() const{
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getFileIndex() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileIndex;}
|
uint64_t UDPBaseImplementation::getFileIndex() const{ return fileIndex;}
|
||||||
|
|
||||||
int UDPBaseImplementation::getScanTag() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return scanTag;}
|
int UDPBaseImplementation::getScanTag() const{ return scanTag;}
|
||||||
|
|
||||||
bool UDPBaseImplementation::getFrameIndexEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameIndexEnable;}
|
bool UDPBaseImplementation::getFrameIndexEnable() const{ return frameIndexEnable;}
|
||||||
|
|
||||||
bool UDPBaseImplementation::getFileWriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileWriteEnable;}
|
bool UDPBaseImplementation::getFileWriteEnable() const{ return fileWriteEnable;}
|
||||||
|
|
||||||
bool UDPBaseImplementation::getOverwriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return overwriteEnable;}
|
bool UDPBaseImplementation::getOverwriteEnable() const{ return overwriteEnable;}
|
||||||
|
|
||||||
bool UDPBaseImplementation::getDataCompressionEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataCompressionEnable;}
|
bool UDPBaseImplementation::getDataCompressionEnable() const{ return dataCompressionEnable;}
|
||||||
|
|
||||||
/***acquisition count parameters***/
|
/***acquisition count parameters***/
|
||||||
uint64_t UDPBaseImplementation::getTotalFramesCaught() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return (totalPacketsCaught/packetsPerFrame);}
|
uint64_t UDPBaseImplementation::getTotalFramesCaught() const{ return (totalPacketsCaught/packetsPerFrame);}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getFramesCaught() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return (packetsCaught/packetsPerFrame);}
|
uint64_t UDPBaseImplementation::getFramesCaught() const{ return (packetsCaught/packetsPerFrame);}
|
||||||
|
|
||||||
int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(!totalPacketsCaught)
|
if(!totalPacketsCaught)
|
||||||
return -1;
|
return -1;
|
||||||
@ -166,12 +158,12 @@ int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
|||||||
|
|
||||||
|
|
||||||
/***connection parameters***/
|
/***connection parameters***/
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNumber() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[0];}
|
uint32_t UDPBaseImplementation::getUDPPortNumber() const{ return udpPortNum[0];}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[1];}
|
uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ return udpPortNum[1];}
|
||||||
|
|
||||||
char *UDPBaseImplementation::getEthernetInterface() const{
|
char *UDPBaseImplementation::getEthernetInterface() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH]();
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
strcpy(output,eth);
|
strcpy(output,eth);
|
||||||
@ -181,30 +173,30 @@ char *UDPBaseImplementation::getEthernetInterface() const{
|
|||||||
|
|
||||||
|
|
||||||
/***acquisition parameters***/
|
/***acquisition parameters***/
|
||||||
int UDPBaseImplementation::getShortFrameEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return shortFrameEnable;}
|
int UDPBaseImplementation::getShortFrameEnable() const{ return shortFrameEnable;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiFrequency;}
|
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ return frameToGuiFrequency;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFrameToGuiTimer() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiTimerinMS;}
|
uint32_t UDPBaseImplementation::getFrameToGuiTimer() const{ return frameToGuiTimerinMS;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getDataStreamEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataStreamEnable;}
|
uint32_t UDPBaseImplementation::getDataStreamEnable() const{ return dataStreamEnable;}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;}
|
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ return acquisitionPeriod;}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionTime() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionTime;}
|
uint64_t UDPBaseImplementation::getAcquisitionTime() const{ return acquisitionTime;}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return numberOfFrames;}
|
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ return numberOfFrames;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getDynamicRange() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dynamicRange;}
|
uint32_t UDPBaseImplementation::getDynamicRange() const{ return dynamicRange;}
|
||||||
|
|
||||||
bool UDPBaseImplementation::getTenGigaEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return tengigaEnable;}
|
bool UDPBaseImplementation::getTenGigaEnable() const{ return tengigaEnable;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getFifoDepth() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fifoDepth;}
|
uint32_t UDPBaseImplementation::getFifoDepth() const{ return fifoDepth;}
|
||||||
|
|
||||||
/***receiver status***/
|
/***receiver status***/
|
||||||
slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return status;}
|
slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ return status;}
|
||||||
|
|
||||||
int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return activated;}
|
int UDPBaseImplementation::getActivate() const{ return activated;}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -214,29 +206,35 @@ int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << "
|
|||||||
|
|
||||||
/**initial parameters***/
|
/**initial parameters***/
|
||||||
void UDPBaseImplementation::configure(map<string, string> config_map){
|
void UDPBaseImplementation::configure(map<string, string> config_map){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
if(axis<0 || axis>1) return;
|
if(axis<0 || axis>1) return;
|
||||||
flippedData[axis] = enable==0?0:1;
|
flippedData[axis] = enable==0?0:1;
|
||||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
|
||||||
|
ostringstream os;
|
||||||
|
os << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***file parameters***/
|
/***file parameters***/
|
||||||
void UDPBaseImplementation::setFileName(const char c[]){
|
void UDPBaseImplementation::setFileName(const char c[]){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(strlen(c))
|
if(strlen(c))
|
||||||
strcpy(fileName, c);
|
strcpy(fileName, c);
|
||||||
FILE_LOG(logINFO) << "File name:" << fileName;
|
|
||||||
|
ostringstream os;
|
||||||
|
os << "File name:" << fileName;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFilePath(const char c[]){
|
void UDPBaseImplementation::setFilePath(const char c[]){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(strlen(c)){
|
if(strlen(c)){
|
||||||
//check if filepath exists
|
//check if filepath exists
|
||||||
@ -245,55 +243,69 @@ void UDPBaseImplementation::setFilePath(const char c[]){
|
|||||||
strcpy(filePath,c);
|
strcpy(filePath,c);
|
||||||
else{
|
else{
|
||||||
strcpy(filePath,"");
|
strcpy(filePath,"");
|
||||||
FILE_LOG(logWARNING) << "FilePath does not exist:" << filePath;
|
ostringstream os;
|
||||||
|
os << "FilePath does not exist:" << filePath;
|
||||||
|
string message(os.str()); FILE_LOG(logWARNING, message);
|
||||||
}
|
}
|
||||||
strcpy(filePath, c);
|
strcpy(filePath, c);
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG) << "Info: File path:" << filePath;
|
/*FILE_LOG(logDEBUG) << "Info: File path:" << filePath;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileIndex(const uint64_t i){
|
void UDPBaseImplementation::setFileIndex(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fileIndex = i;
|
fileIndex = i;
|
||||||
FILE_LOG(logINFO) << "File Index:" << fileIndex;
|
ostringstream os;
|
||||||
|
os << "File Index:" << fileIndex;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: needed?
|
//FIXME: needed?
|
||||||
void UDPBaseImplementation::setScanTag(const int i){
|
void UDPBaseImplementation::setScanTag(const int i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
scanTag = i;
|
scanTag = i;
|
||||||
FILE_LOG(logINFO) << "Scan Tag:" << scanTag;
|
ostringstream os;
|
||||||
|
os << "Scan Tag:" << scanTag;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
frameIndexEnable = b;
|
frameIndexEnable = b;
|
||||||
FILE_LOG(logINFO) << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
ostringstream os;
|
||||||
|
os << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fileWriteEnable = b;
|
fileWriteEnable = b;
|
||||||
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable);
|
ostringstream os;
|
||||||
|
os << "File Write Enable: " << stringEnable(fileWriteEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
overwriteEnable = b;
|
overwriteEnable = b;
|
||||||
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
ostringstream os;
|
||||||
|
os << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dataCompressionEnable = b;
|
dataCompressionEnable = b;
|
||||||
FILE_LOG(logINFO) << "Data Compression : " << stringEnable(dataCompressionEnable);
|
ostringstream os;
|
||||||
|
os << "Data Compression : " << stringEnable(dataCompressionEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overridden methods might return FAIL
|
//overridden methods might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
@ -302,58 +314,72 @@ int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
|||||||
|
|
||||||
/***connection parameters***/
|
/***connection parameters***/
|
||||||
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
udpPortNum[0] = i;
|
udpPortNum[0] = i;
|
||||||
FILE_LOG(logINFO) << "UDP Port Number[0]:" << udpPortNum[0];
|
ostringstream os;
|
||||||
|
os << "UDP Port Number[0]:" << udpPortNum[0];
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
udpPortNum[1] = i;
|
udpPortNum[1] = i;
|
||||||
FILE_LOG(logINFO) << "UDP Port Number[1]:" << udpPortNum[1];
|
ostringstream os;
|
||||||
|
os << "UDP Port Number[1]:" << udpPortNum[1];
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setEthernetInterface(const char* c){
|
void UDPBaseImplementation::setEthernetInterface(const char* c){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
strcpy(eth, c);
|
strcpy(eth, c);
|
||||||
FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
|
ostringstream os;
|
||||||
|
os << "Ethernet Interface: " << eth;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***acquisition parameters***/
|
/***acquisition parameters***/
|
||||||
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
shortFrameEnable = i;
|
shortFrameEnable = i;
|
||||||
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
ostringstream os;
|
||||||
|
os << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
frameToGuiFrequency = freq;
|
frameToGuiFrequency = freq;
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << frameToGuiFrequency;
|
ostringstream os;
|
||||||
|
os << "Frame To Gui Frequency:" << frameToGuiFrequency;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
|
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
frameToGuiTimerinMS = time_in_ms;
|
frameToGuiTimerinMS = time_in_ms;
|
||||||
FILE_LOG(logINFO) << "Frame To Gui Timer:" << frameToGuiTimerinMS;
|
ostringstream os;
|
||||||
|
os << "Frame To Gui Timer:" << frameToGuiTimerinMS;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dataStreamEnable = enable;
|
dataStreamEnable = enable;
|
||||||
FILE_LOG(logINFO) << "Streaming Data from Receiver:" << dataStreamEnable;
|
ostringstream os;
|
||||||
|
os << "Streaming Data from Receiver:" << dataStreamEnable;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
@ -361,60 +387,72 @@ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
|||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
acquisitionPeriod = i;
|
acquisitionPeriod = i;
|
||||||
FILE_LOG(logINFO) << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s";
|
ostringstream os;
|
||||||
|
os << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s";
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
acquisitionTime = i;
|
acquisitionTime = i;
|
||||||
FILE_LOG(logINFO) << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s";
|
ostringstream os;
|
||||||
|
os << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s";
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
numberOfFrames = i;
|
numberOfFrames = i;
|
||||||
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
ostringstream os;
|
||||||
|
os << "Number of Frames:" << numberOfFrames;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
dynamicRange = i;
|
dynamicRange = i;
|
||||||
FILE_LOG(logINFO) << "Dynamic Range:" << dynamicRange;
|
ostringstream os;
|
||||||
|
os << "Dynamic Range:" << dynamicRange;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overrridden child classes might return FAIL
|
//overrridden child classes might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
tengigaEnable = b;
|
tengigaEnable = b;
|
||||||
FILE_LOG(logINFO) << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
ostringstream os;
|
||||||
|
os << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overridden functions might return FAIL
|
//overridden functions might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
fifoDepth = i;
|
fifoDepth = i;
|
||||||
FILE_LOG(logINFO) << "Fifo Depth: " << i;
|
ostringstream os;
|
||||||
|
os << "Fifo Depth: " << i;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
|
||||||
//overridden functions might return FAIL
|
//overridden functions might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
@ -428,79 +466,94 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
|||||||
|
|
||||||
/***initial functions***/
|
/***initial functions***/
|
||||||
int UDPBaseImplementation::setDetectorType(const detectorType d){
|
int UDPBaseImplementation::setDetectorType(const detectorType d){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
myDetectorType = d;
|
myDetectorType = d;
|
||||||
//if eiger, set numberofListeningThreads = 2;
|
//if eiger, set numberofListeningThreads = 2;
|
||||||
FILE_LOG(logINFO) << "Detector Type:" << getDetectorType(d);
|
ostringstream os;
|
||||||
|
os << "Detector Type:" << getDetectorType(d);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::initialize(const char *c){
|
void UDPBaseImplementation::initialize(const char *c){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(strlen(c))
|
if(strlen(c))
|
||||||
strcpy(detHostname, c);
|
strcpy(detHostname, c);
|
||||||
FILE_LOG(logINFO) << "Detector Hostname:" << detHostname;
|
ostringstream os;
|
||||||
|
os << "Detector Hostname:" << detHostname;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***acquisition functions***/
|
/***acquisition functions***/
|
||||||
void UDPBaseImplementation::resetAcquisitionCount(){
|
void UDPBaseImplementation::resetAcquisitionCount(){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
totalPacketsCaught = 0;
|
totalPacketsCaught = 0;
|
||||||
FILE_LOG(logINFO) << "totalPacketsCaught:" << totalPacketsCaught;
|
ostringstream os;
|
||||||
|
os << "totalPacketsCaught:" << totalPacketsCaught;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::startReceiver(char *c){
|
int UDPBaseImplementation::startReceiver(char *c){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::stopReceiver(){
|
void UDPBaseImplementation::stopReceiver(){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::startReadout(){
|
void UDPBaseImplementation::startReadout(){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::shutDownUDPSockets(){
|
int UDPBaseImplementation::shutDownUDPSockets(){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
|
|
||||||
//overridden functions might return FAIL
|
//overridden functions might return FAIL
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
|
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//FIXME: needed, isnt stopReceiver enough?
|
//FIXME: needed, isnt stopReceiver enough?
|
||||||
void UDPBaseImplementation::abort(){
|
void UDPBaseImplementation::abort(){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::closeFile(int ithread){
|
void UDPBaseImplementation::closeFile(int ithread){
|
||||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
ostringstream os;
|
||||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
os << " must be overridden by child classes";
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPBaseImplementation::setActivate(int enable){
|
int UDPBaseImplementation::setActivate(int enable){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
|
||||||
|
|
||||||
if(enable != -1){
|
if(enable != -1){
|
||||||
activated = enable;
|
activated = enable;
|
||||||
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
ostringstream os;
|
||||||
|
os << "Activation: " << stringEnable(activated);
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return activated;
|
return activated;
|
||||||
|
@ -23,17 +23,23 @@ using namespace std;
|
|||||||
UDPInterface * UDPInterface::create(string receiver_type){
|
UDPInterface * UDPInterface::create(string receiver_type){
|
||||||
|
|
||||||
if (receiver_type == "standard"){
|
if (receiver_type == "standard"){
|
||||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
ostringstream os;
|
||||||
|
os << "Starting " << receiver_type;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
return new UDPStandardImplementation();
|
return new UDPStandardImplementation();
|
||||||
}
|
}
|
||||||
#ifdef REST
|
#ifdef REST
|
||||||
else if (receiver_type == "REST"){
|
else if (receiver_type == "REST"){
|
||||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
ostringstream os;
|
||||||
|
os << "Starting " << receiver_type;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
return new UDPRESTImplementation();
|
return new UDPRESTImplementation();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else{
|
else{
|
||||||
FILE_LOG(logWARNING) << "[ERROR] UDP interface not supported, using standard implementation";
|
ostringstream os;
|
||||||
|
os << "[ERROR] UDP interface not supported, using standard implementation";
|
||||||
|
string message(os.str()); FILE_LOG(logWARNING, message);
|
||||||
return new UDPBaseImplementation();
|
return new UDPBaseImplementation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,6 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
//start tcp server thread
|
//start tcp server thread
|
||||||
if(receiver->start() == slsReceiverDefs::OK){
|
if(receiver->start() == slsReceiverDefs::OK){
|
||||||
FILE_LOG(logDEBUG1) << "DONE!" << endl;
|
|
||||||
string str;
|
string str;
|
||||||
cin>>str;
|
cin>>str;
|
||||||
//wait and look for an exit keyword
|
//wait and look for an exit keyword
|
||||||
|
@ -106,23 +106,31 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
|||||||
|
|
||||||
if( !fname.empty() ){
|
if( !fname.empty() ){
|
||||||
try{
|
try{
|
||||||
FILE_LOG(logINFO) << "config file name " << fname;
|
ostringstream os;
|
||||||
|
os << "config file name " << fname;
|
||||||
|
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||||
success = read_config_file(fname, &tcpip_port_no, &configuration_map);
|
success = read_config_file(fname, &tcpip_port_no, &configuration_map);
|
||||||
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
||||||
}
|
}
|
||||||
catch(...){
|
catch(...){
|
||||||
FILE_LOG(logERROR) << "Error opening configuration file " << fname ;
|
ostringstream os;
|
||||||
|
os << "Error opening configuration file " << fname ;
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
success = FAIL;
|
success = FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(success != OK){
|
if(success != OK){
|
||||||
FILE_LOG(logERROR) << "Failed: see output above for more information " ;
|
ostringstream os;
|
||||||
|
os << "Failed: see output above for more information " ;
|
||||||
|
string message(os.str()); FILE_LOG(logERROR, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success==OK){
|
if (success==OK){
|
||||||
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
|
ostringstream os;
|
||||||
|
os << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
|
||||||
|
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||||
#ifdef REST
|
#ifdef REST
|
||||||
udp_interface = UDPInterface::create(udp_interface_type);
|
udp_interface = UDPInterface::create(udp_interface_type);
|
||||||
udp_interface->configure(configuration_map);
|
udp_interface->configure(configuration_map);
|
||||||
|
@ -126,14 +126,22 @@ int slsReceiverTCPIPInterface::setPortNumber(int pn){
|
|||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::start(){
|
int slsReceiverTCPIPInterface::start(){
|
||||||
FILE_LOG(logDEBUG) << "Creating TCP Server Thread" << endl;
|
{
|
||||||
|
ostringstream os;
|
||||||
|
os << "Creating TCP Server Thread" << endl;
|
||||||
|
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||||
|
}
|
||||||
killTCPServerThread = 0;
|
killTCPServerThread = 0;
|
||||||
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
|
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
|
||||||
cout << "Could not create TCP Server thread" << endl;
|
cout << "Could not create TCP Server thread" << endl;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
//#ifdef VERYVERBOSE
|
//#ifdef VERYVERBOSE
|
||||||
FILE_LOG(logDEBUG) << "TCP Server thread created successfully." << endl;
|
{
|
||||||
|
ostringstream os;
|
||||||
|
os << "TCP Server thread created successfully." << endl;
|
||||||
|
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||||
|
}
|
||||||
//#endif
|
//#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -396,14 +404,18 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
|||||||
}
|
}
|
||||||
//#ifdef VERYVERBOSE
|
//#ifdef VERYVERBOSE
|
||||||
if(ret!=FAIL)
|
if(ret!=FAIL)
|
||||||
FILE_LOG(logDEBUG) << "detector type " << dr;
|
{
|
||||||
|
ostringstream os;
|
||||||
|
os << "detector type " << dr;
|
||||||
|
string message(os.str()); FILE_LOG(logDEBUG, message);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cprintf(RED, "%s\n", mess);
|
cprintf(RED, "%s\n", mess);
|
||||||
//#endif
|
//#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +482,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
|||||||
|
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +557,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +629,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +707,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,12 +771,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
receiverBase->setUDPPortNumber2(udpport2);
|
receiverBase->setUDPPortNumber2(udpport2);
|
||||||
//setup udpip
|
//setup udpip
|
||||||
//get ethernet interface or IP to listen to
|
//get ethernet interface or IP to listen to
|
||||||
FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0];
|
{
|
||||||
|
ostringstream os;
|
||||||
|
os << "Receiver UDP IP: " << args[0];
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
|
}
|
||||||
temp = genericSocket::ipToName(args[0]);
|
temp = genericSocket::ipToName(args[0]);
|
||||||
if(temp=="none"){
|
if(temp=="none"){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
||||||
FILE_LOG(logERROR) << mess;
|
FILE_LOG(logERROR, string(mess));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy(eth,temp.c_str());
|
strcpy(eth,temp.c_str());
|
||||||
@ -785,7 +801,9 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy(retval,temp.c_str());
|
strcpy(retval,temp.c_str());
|
||||||
FILE_LOG(logINFO) << "Reciever MAC Address: " << retval;
|
ostringstream os;
|
||||||
|
os << "Reciever MAC Address: " << retval;
|
||||||
|
string message(os.str()); FILE_LOG(logINFO, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -793,14 +811,14 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send answer
|
// send answer
|
||||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||||
if(ret==FAIL){
|
if(ret==FAIL){
|
||||||
FILE_LOG(logERROR) << mess;
|
FILE_LOG(logERROR, string(mess));
|
||||||
mySock->SendDataOnly(mess,sizeof(mess));
|
mySock->SendDataOnly(mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
mySock->SendDataOnly(retval,MAX_STR_LENGTH);
|
mySock->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||||
@ -849,7 +867,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,7 +915,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,7 +946,7 @@ int slsReceiverTCPIPInterface::get_status(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,7 +977,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
|||||||
}else retval=receiverBase->getTotalFramesCaught();
|
}else retval=receiverBase->getTotalFramesCaught();
|
||||||
#endif
|
#endif
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +1009,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,7 +1054,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,7 +1123,7 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,7 +1305,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1468,7 +1486,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1622,7 +1640,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1657,7 +1675,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
|||||||
|
|
||||||
int slsReceiverTCPIPInterface::eiger_read_frame(){
|
int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||||
ret=OK;
|
ret=OK;
|
||||||
/*
|
/*
|
||||||
char fName[MAX_STR_LENGTH]="";
|
char fName[MAX_STR_LENGTH]="";
|
||||||
int acquisitionIndex = -1;
|
int acquisitionIndex = -1;
|
||||||
int frameIndex= -1;
|
int frameIndex= -1;
|
||||||
@ -1889,7 +1907,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,7 +1928,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
|||||||
delete [] retval;
|
delete [] retval;
|
||||||
delete [] origVal;
|
delete [] origVal;
|
||||||
delete [] raw;
|
delete [] raw;
|
||||||
*/
|
*/
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2052,7 +2070,7 @@ int slsReceiverTCPIPInterface::jungfrau_read_frame(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2130,7 +2148,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2196,7 +2214,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2259,7 +2277,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2319,7 +2337,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2347,7 +2365,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(mySock->differentClients){
|
if(mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2371,43 +2389,43 @@ int64_t slsReceiverTCPIPInterface::getReceiverVersion(){
|
|||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::start_readout(){cprintf(BLUE,"In start readout!\n");
|
int slsReceiverTCPIPInterface::start_readout(){cprintf(BLUE,"In start readout!\n");
|
||||||
ret=OK;
|
ret=OK;
|
||||||
enum runStatus retval;
|
enum runStatus retval;
|
||||||
|
|
||||||
// execute action if the arguments correctly arrived
|
// execute action if the arguments correctly arrived
|
||||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||||
if (receiverBase == NULL){
|
if (receiverBase == NULL){
|
||||||
strcpy(mess,SET_RECEIVER_ERR_MESSAGE);
|
strcpy(mess,SET_RECEIVER_ERR_MESSAGE);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
/*else if(receiverBase->getStatus()!= IDLE){
|
/*else if(receiverBase->getStatus()!= IDLE){
|
||||||
strcpy(mess,"Can not start receiver readout while receiver not idle\n");
|
strcpy(mess,"Can not start receiver readout while receiver not idle\n");
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}*/
|
}*/
|
||||||
else{
|
else{
|
||||||
receiverBase->startReadout();
|
receiverBase->startReadout();
|
||||||
retval = receiverBase->getStatus();
|
retval = receiverBase->getStatus();
|
||||||
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
||||||
ret = OK;
|
ret = OK;
|
||||||
else
|
else
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send answer
|
// send answer
|
||||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||||
if(ret==FAIL){
|
if(ret==FAIL){
|
||||||
cprintf(RED,"%s\n",mess);
|
cprintf(RED,"%s\n",mess);
|
||||||
mySock->SendDataOnly(mess,sizeof(mess));
|
mySock->SendDataOnly(mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||||
//return ok/fail
|
//return ok/fail
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2483,7 +2501,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2555,7 +2573,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2621,7 +2639,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2722,7 +2740,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2790,7 +2808,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2860,7 +2878,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2932,7 +2950,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3006,7 +3024,7 @@ int slsReceiverTCPIPInterface::set_activate() {
|
|||||||
|
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3070,7 +3088,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ret==OK && mySock->differentClients){
|
if(ret==OK && mySock->differentClients){
|
||||||
FILE_LOG(logDEBUG) << "Force update";
|
FILE_LOG(logDEBUG,"Force update" );
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user