mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
3fde5c5b55 | |||
3e5f546ebe | |||
4d6346e678 | |||
dc7e448759 | |||
3be045f9b6 | |||
8fae982802 | |||
128ec88b5f | |||
d5fc158330 | |||
864e6e4c81 | |||
343d96ff16 | |||
b9275646ad | |||
9e2f2697c7 | |||
b6b0df62b6 | |||
0ba537e479 | |||
75ddf535dc | |||
b1de501bef | |||
0f3a63f101 | |||
3b4b2d707f | |||
f405aa1733 | |||
df0fdb7ecb | |||
91b7a87557 |
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 7a0a1ee8734440dc4e1e638d6fec1eaa9d2404ae
|
||||
Revision: 1348
|
||||
Branch: 2.3.1
|
||||
Repsitory UUID: 41acb4c1ab89fe85b049c329adb539c3ad5b107a
|
||||
Revision: 1350
|
||||
Branch: 2.3.2
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1348
|
||||
Last Changed Date: 2017-04-11 13:39:28 +0200
|
||||
Last Changed Rev: 1350
|
||||
Last Changed Date: 2017-04-19 10:17:30 +0200
|
||||
|
@ -5158,26 +5158,36 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
|
||||
|
||||
int multiSlsDetector::getData(const int isocket, const bool masking, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename){
|
||||
|
||||
zmq_msg_t message;
|
||||
bool data = true;
|
||||
zmq_msg_t header_message;
|
||||
|
||||
//scan header-------------------------------------------------------------------
|
||||
zmq_msg_init (&message);
|
||||
zmq_msg_init (&header_message);
|
||||
//cprintf(BLUE,"%d going to receive message\n", isocket);
|
||||
int len = zmq_msg_recv(&message, zmqsocket[isocket], 0);
|
||||
int len = zmq_msg_recv(&header_message, zmqsocket[isocket], 0);
|
||||
if (len == -1) {
|
||||
cprintf(BG_RED,"Could not read header for socket %d\n",isocket);
|
||||
zmq_msg_close(&message);
|
||||
zmq_msg_close(&header_message);
|
||||
cprintf(RED, "%d message null\n",isocket);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
// error if you print it
|
||||
// cprintf(BLUE,"%d header len:%d value:%s\n",isocket, len, (char*)zmq_msg_data(&message));
|
||||
//cprintf(BLUE,"%d header %d\n",isocket,len);
|
||||
//cprintf(BLUE,"%d header len:%d value:%s\n",isocket, len, (char*)zmq_msg_data(&header_message));
|
||||
|
||||
rapidjson::Document d;
|
||||
d.Parse( (char*)zmq_msg_data(&message), zmq_msg_size(&message));
|
||||
rapidjson::ParseResult result = d.Parse( (char*)zmq_msg_data(&header_message), len);
|
||||
if (!result) {
|
||||
cprintf(RED,"%d Could not parse. len:%d: Message:%s \n", isocket, len, (char*)zmq_msg_data(&header_message) );
|
||||
fflush( stdout );
|
||||
char* buf = (char*)zmq_msg_data(&header_message);
|
||||
for(int i= 0;i < len; ++i) {
|
||||
cprintf(RED,"%02x ",buf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
fflush( stdout );
|
||||
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
// htype is an array of strings
|
||||
rapidjson::Value::Array htype = d["htype"].GetArray();
|
||||
@ -5193,37 +5203,48 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
cout << isocket << "type: " << d["type"].GetString() << endl;
|
||||
|
||||
#endif
|
||||
if(d["acqIndex"].GetUint64()!= (long long unsigned int)-1){ //!isocket &&
|
||||
int temp = d["data"].GetUint64();
|
||||
data = temp?true:false;
|
||||
if(data){ //!isocket &&
|
||||
acqIndex = d["acqIndex"].GetUint64();
|
||||
frameIndex = d["fIndex"].GetUint64();
|
||||
subframeIndex = -1;
|
||||
if(d["bitmode"].GetInt()==32 && d["detType"].GetUint()== EIGER) {
|
||||
subframeIndex = d["expLength"].GetUint();
|
||||
}
|
||||
filename = d["fname"].GetString();
|
||||
filename.assign(d["fname"].GetString());
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Acquisition index: " << acqIndex << endl;
|
||||
cout << "Frame index: " << frameIndex << endl;
|
||||
cout << "Subframe index: " << subframeIndex << endl;
|
||||
cout << "File name: " << filename << endl;
|
||||
#endif
|
||||
if(frameIndex == (long long unsigned int)-1) cprintf(RED,"multi frame index -1!!\n");
|
||||
// if(frameIndex == (long long unsigned int)-1) cprintf(RED,"multi frame index -1!!\n");
|
||||
}
|
||||
// close the message
|
||||
zmq_msg_close(&message);
|
||||
zmq_msg_close(&header_message);
|
||||
|
||||
|
||||
//scan data-------------------------------------------------------------------
|
||||
zmq_msg_init (&message);
|
||||
len = zmq_msg_recv(&message, zmqsocket[isocket], 0);
|
||||
//cprintf(BLUE,"%d data %d\n",isocket,len);
|
||||
|
||||
//end of socket ("end")
|
||||
if(len == 3){
|
||||
//end of acquisition
|
||||
if(!data){
|
||||
//cprintf(RED,"%d Received end of acquisition \n", isocket);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
//scan data-------------------------------------------------------------------
|
||||
zmq_msg_t data_message;
|
||||
zmq_msg_init (&data_message);
|
||||
len = zmq_msg_recv(&data_message, zmqsocket[isocket], 0);
|
||||
//cprintf(GREEN,"%d data %d\n",isocket,len); fflush(stdout);
|
||||
|
||||
//end of socket ("end\0")
|
||||
/* if(len == 4){
|
||||
zmq_msg_close(&data_message); // close the message
|
||||
//cprintf(RED,"%d Received end of acquisition len:%d\n", isocket, len);
|
||||
return FAIL;
|
||||
}*/
|
||||
|
||||
//crappy image
|
||||
if (len < size ) {
|
||||
cprintf(RED,"Received weird packet size %d in socket for %d\n", len, isocket);
|
||||
@ -5232,8 +5253,8 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
//actual image
|
||||
else{
|
||||
//actual data
|
||||
//cprintf(BLUE,"%d actual dataaa\n",isocket);
|
||||
memcpy((char*)image,(char*)zmq_msg_data(&message),size);
|
||||
// cprintf(GREEN,"%d actual dataaa\n",isocket);
|
||||
memcpy((char*)image,(char*)zmq_msg_data(&data_message),size);
|
||||
|
||||
//jungfrau masking adcval
|
||||
if(masking){
|
||||
@ -5244,7 +5265,7 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
}
|
||||
}
|
||||
|
||||
zmq_msg_close(&message); // close the message
|
||||
zmq_msg_close(&data_message); // close the message
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUIDLIB "7a0a1ee8734440dc4e1e638d6fec1eaa9d2404ae"
|
||||
//#define SVNREV 0x1348
|
||||
#define SVNREPUUIDLIB "41acb4c1ab89fe85b049c329adb539c3ad5b107a"
|
||||
//#define SVNREV 0x1350
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||
#define SVNREVLIB 0x1348
|
||||
#define SVNDATELIB 0x20170411
|
||||
#define SVNREVLIB 0x1350
|
||||
#define SVNDATELIB 0x20170419
|
||||
//
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||
Repsitory UUID: db080a125daed36a1fa85b00df7a239e22ae5130
|
||||
Revision: 521
|
||||
Branch: 2.3.1
|
||||
Repsitory UUID: 239415ea0db2b9cdccd9bce80f0c78216115ffea
|
||||
Revision: 527
|
||||
Branch: 2.3.2
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 521
|
||||
Last Changed Date: 2017-04-11 13:39:35 +0200
|
||||
Last Changed Rev: 527
|
||||
Last Changed Date: 2017-04-20 08:26:16 +0200
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
class UDPInterface {
|
||||
class UDPInterface: public Logger {
|
||||
|
||||
|
||||
/* abstract class that defines the UDP interface of an sls detector data receiver.
|
||||
|
@ -832,6 +832,7 @@ private:
|
||||
pthread_mutex_t progressMutex;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ using namespace std;
|
||||
#define DEFAULT_BACKLOG 5
|
||||
#define DEFAULT_UDP_PORTNO 50001
|
||||
#define DEFAULT_GUI_PORTNO 65000
|
||||
#define DEFAULT_ZMQ_PORTNO 70001
|
||||
#define DEFAULT_ZMQ_PORTNO 40001
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,6 @@ enum communicationProtocol{
|
||||
|
||||
|
||||
genericSocket(const char* const host_ip_or_name, unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE) :
|
||||
// portno(port_number),
|
||||
protocol(p),
|
||||
is_a_server(0),
|
||||
socketDescriptor(-1),
|
||||
@ -109,11 +108,15 @@ enum communicationProtocol{
|
||||
nsending(0),
|
||||
nsent(0),
|
||||
total_sent(0),// sender (client): where to? ip
|
||||
header_packet_size(0)
|
||||
header_packet_size(0),
|
||||
portno(port_number)
|
||||
{
|
||||
memset(&serverAddress, 0,sizeof(serverAddress));
|
||||
memset(&clientAddress,0,sizeof(clientAddress));
|
||||
// strcpy(hostname,host_ip_or_name);
|
||||
memset(lastClientIP, 0, INET_ADDRSTRLEN);
|
||||
memset(thisClientIP, 0, INET_ADDRSTRLEN);
|
||||
memset(dummyClientIP, 0, INET_ADDRSTRLEN);
|
||||
|
||||
strcpy(lastClientIP,"none");
|
||||
strcpy(thisClientIP,"none1");
|
||||
@ -164,7 +167,6 @@ enum communicationProtocol{
|
||||
*/
|
||||
|
||||
genericSocket(unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE, const char *eth=NULL, int hsize=0):
|
||||
//portno(port_number),
|
||||
protocol(p),
|
||||
is_a_server(1),
|
||||
socketDescriptor(-1),
|
||||
@ -173,7 +175,8 @@ enum communicationProtocol{
|
||||
nsending(0),
|
||||
nsent(0),
|
||||
total_sent(0),
|
||||
header_packet_size(hsize)
|
||||
header_packet_size(hsize),
|
||||
portno(port_number)
|
||||
{
|
||||
|
||||
memset(&serverAddress, 0, sizeof(serverAddress));
|
||||
@ -181,7 +184,9 @@ enum communicationProtocol{
|
||||
/* // you can specify an IP address: */
|
||||
/* // or you can let it automatically select one: */
|
||||
/* myaddr.sin_addr.s_addr = INADDR_ANY; */
|
||||
|
||||
memset(lastClientIP, 0, INET_ADDRSTRLEN);
|
||||
memset(thisClientIP, 0, INET_ADDRSTRLEN);
|
||||
memset(dummyClientIP, 0, INET_ADDRSTRLEN);
|
||||
|
||||
strcpy(lastClientIP,"none");
|
||||
strcpy(thisClientIP,"none1");
|
||||
@ -610,6 +615,7 @@ enum communicationProtocol{
|
||||
|
||||
break;
|
||||
case UDP:
|
||||
|
||||
if (socketDescriptor<0) return -1;
|
||||
//if length given, listens to length, else listens for packetsize till length is reached
|
||||
if(length){
|
||||
@ -632,12 +638,30 @@ enum communicationProtocol{
|
||||
else{
|
||||
//normal
|
||||
nsending=packet_size;
|
||||
/* if(portno%2){
|
||||
cprintf(BLUE,"%d total_sent set to zero:%d\n",portno, total_sent);fflush(stdout);
|
||||
}else{
|
||||
cprintf(GREEN,"%d total_sent set to zero:%d\n",portno, total_sent);fflush(stdout);
|
||||
}*/
|
||||
while(1){
|
||||
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
|
||||
if(nsent<=0 || nsent == packet_size)
|
||||
/* if(portno%2){
|
||||
cprintf(BLUE,"%d nsent:%d total_sent:%d\n", portno, nsent, total_sent);fflush(stdout);
|
||||
}else{
|
||||
cprintf(GREEN,"%d nsent:%d total_sent:%d\n", portno, nsent, total_sent);fflush(stdout);
|
||||
}*/
|
||||
if((nsent<=0) || (nsent == packet_size)) {
|
||||
|
||||
/* if(portno%2){
|
||||
cprintf(BLUE,"%d breaking out of loop %d\n",portno, nsent);fflush(stdout);
|
||||
}else{
|
||||
cprintf(GREEN,"%d breaking out of loop %d\n",portno, nsent);fflush(stdout);
|
||||
}*/
|
||||
break;
|
||||
if(nsent != packet_size && nsent != header_packet_size)
|
||||
cprintf(RED,"Incomplete Packet size %d\n",nsent);
|
||||
}
|
||||
if(nsent != packet_size && nsent != header_packet_size){
|
||||
cprintf(RED,"%d Incomplete Packet size %d\n",portno, nsent);fflush(stdout);
|
||||
}
|
||||
}
|
||||
//nsent = 1040;
|
||||
total_sent+=nsent;
|
||||
@ -649,8 +673,13 @@ enum communicationProtocol{
|
||||
#ifdef VERY_VERBOSE
|
||||
cout << "sent "<< total_sent << " Bytes" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
/*if(protocol == UDP){
|
||||
if(portno%2){
|
||||
cprintf(BLUE,"%d exiting total sent %d\n",portno, total_sent);fflush(stdout);
|
||||
}else{
|
||||
cprintf(GREEN,"%d exiting total sent %d\n",portno, total_sent);fflush(stdout);
|
||||
}
|
||||
}*/
|
||||
return total_sent;
|
||||
|
||||
|
||||
@ -723,11 +752,11 @@ enum communicationProtocol{
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int nsending;
|
||||
int nsent;
|
||||
int total_sent;
|
||||
volatile int nsending;
|
||||
volatile int nsent;
|
||||
volatile int total_sent;
|
||||
int header_packet_size;
|
||||
const int portno;
|
||||
|
||||
|
||||
// pthread_mutex_t mp;
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "db080a125daed36a1fa85b00df7a239e22ae5130"
|
||||
//#define SVNREV 0x521
|
||||
#define SVNREPUUID "239415ea0db2b9cdccd9bce80f0c78216115ffea"
|
||||
//#define SVNREV 0x527
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x521
|
||||
#define SVNDATE 0x20170411
|
||||
#define SVNREV 0x527
|
||||
#define SVNDATE 0x20170420
|
||||
//
|
||||
|
@ -1,5 +1,6 @@
|
||||
//#ifndef __LOG_H__
|
||||
//#define __LOG_H__
|
||||
#ifndef __LOG_H__
|
||||
#define __LOG_H__
|
||||
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -13,115 +14,31 @@
|
||||
#elif VERYVERBOSE
|
||||
#define FILELOG_MAX_LEVEL logDEBUG4
|
||||
#elif VERBOSE
|
||||
#define FILELOG_MAX_LEVEL logDEBUG
|
||||
#define FILELOG_MAX_LEVEL logDEBUG1
|
||||
#endif
|
||||
|
||||
#ifndef FILELOG_MAX_LEVEL
|
||||
#define FILELOG_MAX_LEVEL logINFO
|
||||
#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>
|
||||
|
||||
inline std::string NowTime()
|
||||
|
||||
class Logger {
|
||||
public:
|
||||
Logger(){};
|
||||
|
||||
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
|
||||
|
||||
|
||||
static void FILE_LOG(TLogLevel level, char const* msg)
|
||||
{
|
||||
|
||||
if(level > FILELOG_MAX_LEVEL) return;
|
||||
|
||||
char buffer[11];
|
||||
const int buffer_len = sizeof(buffer);
|
||||
time_t t;
|
||||
@ -135,115 +52,38 @@ inline std::string NowTime()
|
||||
const int result_len = sizeof(result);
|
||||
snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
||||
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){
|
||||
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
|
||||
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
|
||||
case logINFO: cprintf(GRAY,"%s",msg.c_str());break;
|
||||
// case logINFO: cprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
|
||||
default: fprintf(pStream,"%s",msg.c_str()); out = false; break;
|
||||
case logERROR: cprintf(RED BOLD, "%s\n", smessage.c_str()); break;
|
||||
case logWARNING: cprintf(YELLOW BOLD, "%s\n", smessage.c_str()); break;
|
||||
case logINFO: cprintf(GRAY, "%s\n", smessage.c_str()); break;
|
||||
default: break;
|
||||
}
|
||||
fflush(out ? stdout : pStream);
|
||||
*/
|
||||
|
||||
switch(level){
|
||||
case logERROR: cprintf(RED BOLD, "- %s ERROR: %s \n", result, msg); break;
|
||||
case logWARNING: cprintf(YELLOW BOLD,"- %s WARNING: %s \n", result, msg); break;
|
||||
case logINFO: cprintf(GRAY, "- %s INFO: %s \n", result, msg); break;
|
||||
default: cprintf(GRAY, "- %s DEBUG: %s \n", result, msg); break;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
//#endif //__LOG_H__
|
||||
#endif //__LOG_H__
|
||||
|
@ -18,7 +18,7 @@
|
||||
*@short creates the UDP and TCP class objects
|
||||
*/
|
||||
|
||||
class slsReceiver : private virtual slsReceiverDefs {
|
||||
class slsReceiver : public Logger, private virtual slsReceiverDefs {
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
*@short interface between receiver and client
|
||||
*/
|
||||
|
||||
class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
class slsReceiverTCPIPInterface : public Logger, private virtual slsReceiverDefs {
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -19,7 +19,6 @@ using namespace std;
|
||||
* They access local cache of configuration or detector parameters *******
|
||||
*************************************************************************/
|
||||
UDPBaseImplementation::UDPBaseImplementation(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
initializeMembers();
|
||||
|
||||
@ -33,12 +32,10 @@ UDPBaseImplementation::UDPBaseImplementation(){
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::initializeMembers(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
FILE_LOG(logDEBUG) << "Info: Initializing base members";
|
||||
//**detector parameters***
|
||||
myDetectorType = GENERIC;
|
||||
strcpy(detHostname,"");
|
||||
memset(detHostname,0,MAX_STR_LENGTH);
|
||||
packetsPerFrame = 0;
|
||||
acquisitionPeriod = 0;
|
||||
acquisitionTime = 0;
|
||||
@ -54,14 +51,15 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
activated = true;
|
||||
|
||||
//***connection parameters***
|
||||
strcpy(eth,"");
|
||||
memset(eth,0,MAX_STR_LENGTH);
|
||||
for(int i=0;i<MAX_NUMBER_OF_LISTENING_THREADS;i++){
|
||||
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
||||
}
|
||||
|
||||
//***file parameters***
|
||||
strcpy(fileName,"run");
|
||||
strcpy(filePath,"");
|
||||
memset(fileName,0,MAX_STR_LENGTH);
|
||||
snprintf(fileName,MAX_STR_LENGTH,"run");
|
||||
memset(filePath,0,MAX_STR_LENGTH);
|
||||
fileIndex = 0;
|
||||
scanTag = 0;
|
||||
frameIndexEnable = false;
|
||||
@ -93,20 +91,19 @@ UDPBaseImplementation::~UDPBaseImplementation(){}
|
||||
|
||||
/**initial parameters***/
|
||||
char *UDPBaseImplementation::getDetectorHostname() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
//not initialized
|
||||
if(!strlen(detHostname))
|
||||
return NULL;
|
||||
|
||||
char* output = new char[MAX_STR_LENGTH]();
|
||||
strcpy(output,detHostname);
|
||||
memset(output,0,MAX_STR_LENGTH);
|
||||
snprintf(output,MAX_STR_LENGTH,detHostname);
|
||||
//freed by calling function
|
||||
return output;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
if(axis<0 || axis > 1) return -1;
|
||||
return flippedData[axis];
|
||||
}
|
||||
@ -114,50 +111,49 @@ int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||
|
||||
/***file parameters***/
|
||||
char *UDPBaseImplementation::getFileName() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
//not initialized
|
||||
if(!strlen(fileName))
|
||||
return NULL;
|
||||
|
||||
char* output = new char[MAX_STR_LENGTH]();
|
||||
strcpy(output,fileName);
|
||||
memset(output,0,MAX_STR_LENGTH);
|
||||
snprintf(output,MAX_STR_LENGTH,fileName);
|
||||
//freed by calling function
|
||||
return output;
|
||||
}
|
||||
|
||||
char *UDPBaseImplementation::getFilePath() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
//not initialized
|
||||
if(!strlen(filePath))
|
||||
return NULL;
|
||||
|
||||
char* output = new char[MAX_STR_LENGTH]();
|
||||
strcpy(output,filePath);
|
||||
memset(output,0,MAX_STR_LENGTH);
|
||||
snprintf(output,MAX_STR_LENGTH,filePath);
|
||||
//freed by calling function
|
||||
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***/
|
||||
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{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(!totalPacketsCaught)
|
||||
return -1;
|
||||
@ -166,45 +162,46 @@ int64_t UDPBaseImplementation::getAcquisitionIndex() const{
|
||||
|
||||
|
||||
/***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{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
|
||||
char* output = new char[MAX_STR_LENGTH]();
|
||||
strcpy(output,eth);
|
||||
memset(output,0,MAX_STR_LENGTH);
|
||||
snprintf(output,MAX_STR_LENGTH,eth);
|
||||
//freed by calling function
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/***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***/
|
||||
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,86 +211,103 @@ int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << "
|
||||
|
||||
/**initial parameters***/
|
||||
void UDPBaseImplementation::configure(map<string, string> config_map){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Flipped Data: %d , %d ", flippedData[0], flippedData[1]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
/***file parameters***/
|
||||
void UDPBaseImplementation::setFileName(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(strlen(c))
|
||||
strcpy(fileName, c);
|
||||
FILE_LOG(logINFO) << "File name:" << fileName;
|
||||
if(strlen(c)){
|
||||
memset(fileName,0,MAX_STR_LENGTH);
|
||||
snprintf(fileName,MAX_STR_LENGTH,c);
|
||||
}
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "File name: %s ", fileName);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFilePath(const char c[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(strlen(c)){
|
||||
//check if filepath exists
|
||||
struct stat st;
|
||||
if(stat(c,&st) == 0)
|
||||
strcpy(filePath,c);
|
||||
else{
|
||||
strcpy(filePath,"");
|
||||
FILE_LOG(logWARNING) << "FilePath does not exist:" << filePath;
|
||||
if(stat(c,&st) == 0){
|
||||
memset(filePath,0,MAX_STR_LENGTH);
|
||||
snprintf(filePath,MAX_STR_LENGTH,c);
|
||||
}else{
|
||||
memset(filePath,0,MAX_STR_LENGTH);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "FilePath does not exist: %s ", filePath);
|
||||
FILE_LOG(logWARNING, cstreambuf);
|
||||
}
|
||||
strcpy(filePath, c);
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "Info: File path:" << filePath;
|
||||
/*{
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "File path:: %s ", filePath);
|
||||
FILE_LOG(logDEBUG, cstreambuf);
|
||||
}*/
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFileIndex(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
fileIndex = i;
|
||||
FILE_LOG(logINFO) << "File Index:" << fileIndex;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "File Index: %lu ", fileIndex);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
//FIXME: needed?
|
||||
void UDPBaseImplementation::setScanTag(const int i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
scanTag = i;
|
||||
FILE_LOG(logINFO) << "Scan Tag:" << scanTag;
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Scan Tag: %d ", scanTag);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
frameIndexEnable = b;
|
||||
FILE_LOG(logINFO) << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Frame Index Enable: %s ", stringEnable(frameIndexEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
fileWriteEnable = b;
|
||||
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "File Write Enable: %s ", stringEnable(fileWriteEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setOverwriteEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
overwriteEnable = b;
|
||||
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Overwrite Enable: %s ", stringEnable(overwriteEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
dataCompressionEnable = b;
|
||||
FILE_LOG(logINFO) << "Data Compression : " << stringEnable(dataCompressionEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Data Compression: %s ", stringEnable(dataCompressionEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden methods might return FAIL
|
||||
return OK;
|
||||
@ -302,58 +316,65 @@ int UDPBaseImplementation::setDataCompressionEnable(const bool b){
|
||||
|
||||
/***connection parameters***/
|
||||
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
udpPortNum[0] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[0]:" << udpPortNum[0];
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "UDP Port Number[0]: %u ", udpPortNum[0]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
udpPortNum[1] = i;
|
||||
FILE_LOG(logINFO) << "UDP Port Number[1]:" << udpPortNum[1];
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "UDP Port Number[1]: %u ", udpPortNum[1]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setEthernetInterface(const char* c){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
strcpy(eth, c);
|
||||
FILE_LOG(logINFO) << "Ethernet Interface: " << eth;
|
||||
memset(eth,0, MAX_STR_LENGTH);
|
||||
snprintf(eth,MAX_STR_LENGTH, c);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Ethernet Interface: %s ", eth);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
void UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
shortFrameEnable = i;
|
||||
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Short Frame Enable: %d ", shortFrameEnable);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
frameToGuiFrequency = freq;
|
||||
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << frameToGuiFrequency;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Frame To Gui Frequency: %u ", frameToGuiFrequency);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
frameToGuiTimerinMS = time_in_ms;
|
||||
FILE_LOG(logINFO) << "Frame To Gui Timer:" << frameToGuiTimerinMS;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Frame To Gui Timer: %u ", frameToGuiTimerinMS);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
|
||||
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
dataStreamEnable = enable;
|
||||
FILE_LOG(logINFO) << "Streaming Data from Receiver:" << dataStreamEnable;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Streaming Data from Receiver: %d ", dataStreamEnable);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
@ -361,60 +382,66 @@ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
|
||||
|
||||
|
||||
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
acquisitionPeriod = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s";
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Acquisition Period: %f s ", (double)acquisitionPeriod/(1E9));
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
acquisitionTime = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s";
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Acquisition Time: %f s ", (double)acquisitionTime/(1E9));
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
numberOfFrames = i;
|
||||
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Number of Frames: %lu ", numberOfFrames);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
dynamicRange = i;
|
||||
FILE_LOG(logINFO) << "Dynamic Range:" << dynamicRange;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Dynamic Range: %u ", dynamicRange);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setTenGigaEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
tengigaEnable = b;
|
||||
FILE_LOG(logINFO) << "Ten Giga Enable: " << stringEnable(tengigaEnable);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Ten Giga Enable: %s ", stringEnable(tengigaEnable).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
fifoDepth = i;
|
||||
FILE_LOG(logINFO) << "Fifo Depth: " << i;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Fifo Depth: %u ", i);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
@ -428,79 +455,90 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||
|
||||
/***initial functions***/
|
||||
int UDPBaseImplementation::setDetectorType(const detectorType d){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
myDetectorType = d;
|
||||
//if eiger, set numberofListeningThreads = 2;
|
||||
FILE_LOG(logINFO) << "Detector Type:" << getDetectorType(d);
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Detector Type: %s ", getDetectorType(d).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::initialize(const char *c){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(strlen(c))
|
||||
strcpy(detHostname, c);
|
||||
FILE_LOG(logINFO) << "Detector Hostname:" << detHostname;
|
||||
if(strlen(c)){
|
||||
memset(detHostname,0,MAX_STR_LENGTH);
|
||||
snprintf(detHostname, MAX_STR_LENGTH, c);
|
||||
}
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Detector Hostname: %s ", detHostname);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***acquisition functions***/
|
||||
void UDPBaseImplementation::resetAcquisitionCount(){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
|
||||
totalPacketsCaught = 0;
|
||||
FILE_LOG(logINFO) << "totalPacketsCaught:" << totalPacketsCaught;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Total Packets Caught: %lu ", totalPacketsCaught);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::startReceiver(char *c){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::stopReceiver(){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::startReadout(){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::shutDownUDPSockets(){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
|
||||
//overridden functions might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
|
||||
//FIXME: needed, isnt stopReceiver enough?
|
||||
void UDPBaseImplementation::abort(){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::closeFile(int ithread){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
|
||||
FILE_LOG(logERROR, " must be overridden by child classes");
|
||||
}
|
||||
|
||||
|
||||
int UDPBaseImplementation::setActivate(int enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
if(enable != -1){
|
||||
activated = enable;
|
||||
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
snprintf(cstreambuf, MAX_STR_LENGTH, "Activation: %s ", stringEnable(activated).c_str());
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
|
||||
return activated;
|
||||
|
@ -22,18 +22,21 @@ using namespace std;
|
||||
|
||||
UDPInterface * UDPInterface::create(string receiver_type){
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Starting %s ", receiver_type.c_str());
|
||||
|
||||
if (receiver_type == "standard"){
|
||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
return new UDPStandardImplementation();
|
||||
}
|
||||
#ifdef REST
|
||||
else if (receiver_type == "REST"){
|
||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
return new UDPRESTImplementation();
|
||||
}
|
||||
#endif
|
||||
else{
|
||||
FILE_LOG(logWARNING) << "[ERROR] UDP interface not supported, using standard implementation";
|
||||
FILE_LOG(logWARNING, "[ERROR] UDP interface not supported, using standard implementation");
|
||||
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
|
||||
if(receiver->start() == slsReceiverDefs::OK){
|
||||
FILE_LOG(logDEBUG1) << "DONE!" << endl;
|
||||
string str;
|
||||
cin>>str;
|
||||
//wait and look for an exit keyword
|
||||
|
@ -106,23 +106,32 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
|
||||
|
||||
if( !fname.empty() ){
|
||||
try{
|
||||
FILE_LOG(logINFO) << "config file name " << fname;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "config file name : %s ",fname.c_str());
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
|
||||
success = read_config_file(fname, &tcpip_port_no, &configuration_map);
|
||||
//VERBOSE_PRINT("Read configuration file of " + iline + " lines");
|
||||
}
|
||||
catch(...){
|
||||
FILE_LOG(logERROR) << "Error opening configuration file " << fname ;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Error opening configuration file : %s ",fname.c_str());
|
||||
FILE_LOG(logERROR, cstreambuf);
|
||||
|
||||
success = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(success != OK){
|
||||
FILE_LOG(logERROR) << "Failed: see output above for more information " ;
|
||||
FILE_LOG(logERROR, "Failed: see output above for more information ");
|
||||
}
|
||||
|
||||
if (success==OK){
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "SLS Receiver starting %s on port %d ",udp_interface_type.c_str(), tcpip_port_no);
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
#ifdef REST
|
||||
udp_interface = UDPInterface::create(udp_interface_type);
|
||||
udp_interface->configure(configuration_map);
|
||||
|
@ -126,14 +126,17 @@ int slsReceiverTCPIPInterface::setPortNumber(int pn){
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::start(){
|
||||
FILE_LOG(logDEBUG) << "Creating TCP Server Thread" << endl;
|
||||
|
||||
FILE_LOG(logDEBUG1, "Creating TCP Server Thread");
|
||||
|
||||
killTCPServerThread = 0;
|
||||
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
|
||||
cout << "Could not create TCP Server thread" << endl;
|
||||
return FAIL;
|
||||
}
|
||||
//#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG) << "TCP Server thread created successfully." << endl;
|
||||
FILE_LOG(logDEBUG1, "TCP Server thread created successfully.");
|
||||
|
||||
//#endif
|
||||
return OK;
|
||||
}
|
||||
@ -396,14 +399,18 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
}
|
||||
//#ifdef VERYVERBOSE
|
||||
if(ret!=FAIL)
|
||||
FILE_LOG(logDEBUG) << "detector type " << dr;
|
||||
{
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Detector Type %d ", (int)dr);
|
||||
FILE_LOG(logDEBUG1, cstreambuf);
|
||||
}
|
||||
else
|
||||
cprintf(RED, "%s\n", mess);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -470,7 +477,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
|
||||
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -545,7 +552,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -617,7 +624,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -695,7 +702,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -759,12 +766,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
receiverBase->setUDPPortNumber2(udpport2);
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0];
|
||||
{
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Receiver UDP IP: %s ",args[0]);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
temp = genericSocket::ipToName(args[0]);
|
||||
if(temp=="none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
FILE_LOG(logERROR, "Failed to get ethernet interface or IP ");
|
||||
}
|
||||
else{
|
||||
strcpy(eth,temp.c_str());
|
||||
@ -785,7 +796,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
}
|
||||
else{
|
||||
strcpy(retval,temp.c_str());
|
||||
FILE_LOG(logINFO) << "Reciever MAC Address: " << retval;
|
||||
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "Reciever MAC Address: %s ",retval);
|
||||
FILE_LOG(logINFO, cstreambuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -793,14 +807,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
// send answer
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL){
|
||||
FILE_LOG(logERROR) << mess;
|
||||
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
|
||||
sprintf(cstreambuf, "%s ", mess);
|
||||
FILE_LOG(logERROR, cstreambuf);
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
mySock->SendDataOnly(retval,MAX_STR_LENGTH);
|
||||
@ -849,7 +865,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -897,7 +913,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -928,7 +944,7 @@ int slsReceiverTCPIPInterface::get_status(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -959,7 +975,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
||||
}else retval=receiverBase->getTotalFramesCaught();
|
||||
#endif
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -991,7 +1007,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1036,7 +1052,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1105,7 +1121,7 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1287,7 +1303,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1468,7 +1484,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1622,7 +1638,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -1889,7 +1905,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2052,7 +2068,7 @@ int slsReceiverTCPIPInterface::jungfrau_read_frame(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2130,7 +2146,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2196,7 +2212,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2259,7 +2275,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2319,7 +2335,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2347,7 +2363,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
||||
#endif
|
||||
|
||||
if(mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2395,7 +2411,7 @@ int slsReceiverTCPIPInterface::start_readout(){cprintf(BLUE,"In start readout!\n
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2483,7 +2499,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2555,7 +2571,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2621,7 +2637,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2722,7 +2738,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2790,7 +2806,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2860,7 +2876,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -2932,7 +2948,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -3006,7 +3022,7 @@ int slsReceiverTCPIPInterface::set_activate() {
|
||||
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
@ -3070,7 +3086,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
|
||||
#endif
|
||||
|
||||
if(ret==OK && mySock->differentClients){
|
||||
FILE_LOG(logDEBUG) << "Force update";
|
||||
FILE_LOG(logDEBUG1,"Force update" );
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user