mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
edited call backs in receiver, got rid of uhrix callback, expose receiver read freq to user, got rid of wait for receiver t finish
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@577 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
74bcbf0d9a
commit
666c73c988
@ -1,5 +1,5 @@
|
|||||||
CC = g++#powerpc-4xx-softfloat-g++
|
CC = g++#powerpc-4xx-softfloat-g++
|
||||||
CLAGS += -Wall -DDACS_INT -DSLS_DETECTOR_FUNCTION_LIST -DEIGERD #-DVIRTUAL
|
CLAGS += -Wall -DDACS_INT -DEIGERD #-DSLS_DETECTOR_FUNCTION_LIST #-DVIRTUAL
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServer
|
PROGS = eigerDetectorServer
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* slsDetectorServer_defs.h
|
||||||
|
*
|
||||||
|
* Created on: Jan 24, 2013
|
||||||
|
* Author: l_maliakal_d
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SLSDETECTORSERVER_DEFS_H_
|
||||||
|
#define SLSDETECTORSERVER_DEFS_H_
|
||||||
|
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define GOODBYE -200
|
||||||
|
|
||||||
|
|
||||||
|
/* examples
|
||||||
|
#define NCHAN 1
|
||||||
|
#define NCHIP 1
|
||||||
|
#define NDAC 1
|
||||||
|
#define NADC 1
|
||||||
|
#define NMAXMODX 1
|
||||||
|
#define NMAXMODY 1
|
||||||
|
#define NMAXMOD NMAXMODX*NMAXMODY
|
||||||
|
#define NCHANS NCHAN*NCHIP*NMAXMOD
|
||||||
|
#define NDACS NDAC*NMAXMOD
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/gotthardDetectorServer"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/gotthardDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x557
|
//#define SVNREV 0x565
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x557
|
#define SVNREV 0x565
|
||||||
#define SVNDATE 0x20130516
|
#define SVNDATE 0x20130517
|
||||||
//
|
//
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/moenchDetectorServer"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/moenchDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x563
|
//#define SVNREV 0x572
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x563
|
#define SVNREV 0x572
|
||||||
#define SVNDATE 0x20130517
|
#define SVNDATE 0x20130521
|
||||||
//
|
//
|
||||||
|
@ -4684,8 +4684,3 @@ int multiSlsDetector::setReadReceiverFrequency(int getFromReceiver,int i){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::waitForReceiverReadToFinish(){
|
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
|
||||||
if (detectors[idet])
|
|
||||||
detectors[idet]->waitForReceiverReadToFinish();
|
|
||||||
}
|
|
||||||
|
@ -1203,10 +1203,6 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
/** updates the multidetector offsets */
|
/** updates the multidetector offsets */
|
||||||
void updateOffsets();
|
void updateOffsets();
|
||||||
|
|
||||||
/**
|
|
||||||
* Waits for receiver read to finish after stopping acquisition
|
|
||||||
*/
|
|
||||||
void waitForReceiverReadToFinish();
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x557
|
//#define SVNREV 0x565
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x557
|
#define SVNREV 0x565
|
||||||
#define SVNDATE 0x20130516
|
#define SVNDATE 0x20130517
|
||||||
//
|
//
|
||||||
|
@ -6360,10 +6360,3 @@ int slsDetector::setReadReceiverFrequency(int getFromReceiver,int i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::waitForReceiverReadToFinish(){
|
|
||||||
if(dataSocket){
|
|
||||||
while(dataSocket->Connect() < 0)
|
|
||||||
usleep(1000);
|
|
||||||
dataSocket->Disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1603,10 +1603,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int setReadReceiverFrequency(int getFromReceiver, int i=-1);
|
int setReadReceiverFrequency(int getFromReceiver, int i=-1);
|
||||||
|
|
||||||
/**
|
|
||||||
* Waits for receiver read to finish after stopping acquisition
|
|
||||||
*/
|
|
||||||
void waitForReceiverReadToFinish();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -230,7 +230,9 @@ void slsDetectorUsers::finalizeDataset(double *a, double *v, double *e, int &np)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::setReceiverMode(int n){
|
||||||
|
return myDetector->setReadReceiverFrequency(1,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,6 +415,13 @@ class slsDetectorUsers
|
|||||||
*/
|
*/
|
||||||
string getDetectorType();
|
string getDetectorType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets the mode by which gui requests data from receiver
|
||||||
|
\param n is 0 for random requests for fast acquisitions and greater than 0 for nth read requests
|
||||||
|
\returns the mode set in the receiver
|
||||||
|
*/
|
||||||
|
int setReceiverMode(int n=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short register calbback for accessing detector final data
|
@short register calbback for accessing detector final data
|
||||||
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f.
|
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f.
|
||||||
|
@ -683,11 +683,6 @@ virtual ROI* getROI(int &n)=0;
|
|||||||
virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Waits for receiver read to finish after stopping acquisition
|
|
||||||
*/
|
|
||||||
virtual void waitForReceiverReadToFinish()=0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x564
|
//#define SVNREV 0x576
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "l_maliakal_d"
|
#define SVNAUTHLIB "l_maliakal_d"
|
||||||
#define SVNREVLIB 0x564
|
#define SVNREVLIB 0x576
|
||||||
#define SVNDATELIB 0x20130517
|
#define SVNDATELIB 0x20130523
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CLAGS += -Wall -DVIRTUAL -DDACS_INT -DSLS_DETECTOR_FUNCTION_LIST -DGENERIC
|
CLAGS += -Wall -DVIRTUAL -DDACS_INT -DGENERIC # -DSLS_DETECTOR_FUNCTION_LIST
|
||||||
LDLIBS += -lm
|
LDLIBS += -lm
|
||||||
|
|
||||||
PROGS = genericDetectorServer
|
PROGS = genericDetectorServer
|
||||||
|
@ -32,14 +32,19 @@ Here are the definitions, but the actual implementation should be done for each
|
|||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
int mapCSP0(void);
|
||||||
int initializeDetector();
|
int initializeDetector();
|
||||||
|
|
||||||
|
enum masterFlags setMaster(enum masterFlags arg);
|
||||||
|
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
||||||
|
|
||||||
int setNMod(int nm, enum dimension dim);
|
int setNMod(int nm, enum dimension dim);
|
||||||
int getNModBoard(enum dimension arg);
|
int getNModBoard(enum dimension arg);
|
||||||
|
|
||||||
|
enum externalSignalFlag getExtSignal(int signalindex);
|
||||||
|
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
||||||
|
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
||||||
|
|
||||||
int64_t getModuleId(enum idMode arg, int imod);
|
int64_t getModuleId(enum idMode arg, int imod);
|
||||||
int64_t getDetectorId(enum idMode arg);
|
int64_t getDetectorId(enum idMode arg);
|
||||||
int moduleTest( enum digitalTestMode arg, int imod);
|
int moduleTest( enum digitalTestMode arg, int imod);
|
||||||
@ -48,42 +53,46 @@ int detectorTest( enum digitalTestMode arg);
|
|||||||
|
|
||||||
double setDAC(enum dacIndex ind, double val, int imod);
|
double setDAC(enum dacIndex ind, double val, int imod);
|
||||||
double getADC(enum dacIndex ind, int imod);
|
double getADC(enum dacIndex ind, int imod);
|
||||||
|
bus_w()
|
||||||
|
bus_r()
|
||||||
int setChannel(sls_detector_channel myChan);
|
int setChannel(sls_detector_channel myChan);
|
||||||
int getChannel(sls_detector_channel *myChan);
|
int getChannel(sls_detector_channel *myChan);
|
||||||
int setChip(sls_detector_chip myChip);
|
int setChip(sls_detector_chip myChip);
|
||||||
int getChip(sls_detector_chip *myChip);
|
int getChip(sls_detector_chip *myChip);
|
||||||
int setModule(sls_detector_module myChan);
|
int setModule(sls_detector_module myChan);
|
||||||
int getModule(sls_detector_module *myChan);
|
int getModule(sls_detector_module *myChan);
|
||||||
|
|
||||||
|
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||||
int getThresholdEnergy(int imod);
|
int getThresholdEnergy(int imod);
|
||||||
int setThresholdEnergy(int thr, int imod);
|
int setThresholdEnergy(int thr, int imod);
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
|
||||||
|
|
||||||
|
|
||||||
int startStateMachine();
|
int startStateMachine();
|
||||||
int stopStateMachine();
|
int stopStateMachine();
|
||||||
int startReadOut();
|
int startReadOut();
|
||||||
enum runStatus getRunStatus();
|
enum runStatus getRunStatus();
|
||||||
char *readFrame(int *ret, char *mess);
|
char *readFrame(int *ret, char *mess);
|
||||||
|
|
||||||
|
|
||||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||||
int64_t getTimeLeft(enum timerIndex ind);
|
int64_t getTimeLeft(enum timerIndex ind);
|
||||||
|
|
||||||
int setDynamicRange(int dr);
|
int setDynamicRange(int dr);
|
||||||
|
|
||||||
|
|
||||||
int setROI(int mask); //////?????????????????
|
|
||||||
int getROI(int *mask); //////////?????????????????????
|
|
||||||
int setSpeed(enum speedVariable arg, int val);
|
|
||||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||||
|
int setROI(int mask);
|
||||||
|
int setSpeed(enum speedVariable arg, int val);
|
||||||
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||||
|
|
||||||
|
#ifdef GOTTHARDD
|
||||||
|
|
||||||
int configureMAC(int ipad, long long int imacadd, long long int iservermacadd, int dtb);
|
int configureMAC(int ipad, long long int imacadd, long long int iservermacadd, int dtb);
|
||||||
int loadImage(enum imageType index, char *imageVals);
|
int loadImage(enum imageType index, char *imageVals);
|
||||||
int readCounterBlock(int startACQ, char *counterVals);
|
int readCounterBlock(int startACQ, char *counterVals);
|
||||||
int resetCounterBlock(int startACQ);
|
int resetCounterBlock(int startACQ);
|
||||||
|
int startReceiver(int d);
|
||||||
|
int calibratePedestal(int frames);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int calculateDataBytes();
|
int calculateDataBytes();
|
||||||
|
|
||||||
int getTotalNumberOfChannels();
|
int getTotalNumberOfChannels();
|
||||||
int getTotalNumberOfChips();
|
int getTotalNumberOfChips();
|
||||||
int getTotalNumberOfModules();
|
int getTotalNumberOfModules();
|
||||||
@ -94,12 +103,6 @@ int getNumberOfDACsPerModule();
|
|||||||
int getNumberOfADCsPerModule();
|
int getNumberOfADCsPerModule();
|
||||||
|
|
||||||
|
|
||||||
enum externalSignalFlag getExtSignal(int signalindex);
|
|
||||||
enum externalSignalFlag setExtSignal(int signalindex, enum externalSignalFlag flag);
|
|
||||||
enum externalCommunicationMode setTiming( enum externalCommunicationMode arg);
|
|
||||||
enum masterFlags setMaster(enum masterFlags arg);
|
|
||||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//#if defined(EIGERD) || defined(GOTHARDD) break;
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
@ -36,11 +37,12 @@ const enum detectorType myDetectorType=GENERIC;
|
|||||||
|
|
||||||
|
|
||||||
//define in communication_funcs
|
//define in communication_funcs
|
||||||
|
/*
|
||||||
extern int lockStatus;
|
extern int lockStatus;
|
||||||
extern char lastClientIP[INET_ADDRSTRLEN];
|
extern char lastClientIP[INET_ADDRSTRLEN];
|
||||||
extern char thisClientIP[INET_ADDRSTRLEN];
|
extern char thisClientIP[INET_ADDRSTRLEN];
|
||||||
extern int differentClients;
|
extern int differentClients;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* global variables for optimized readout */
|
/* global variables for optimized readout */
|
||||||
@ -57,17 +59,16 @@ int init_detector(int b) {
|
|||||||
printf("This is a VIRTUAL detector\n");
|
printf("This is a VIRTUAL detector\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//mapCSP0();
|
mapCSP0();
|
||||||
//only for control server
|
//only for control server
|
||||||
if(b){
|
if(b){
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
//initializeDetector();
|
initializeDetector();
|
||||||
//testFpga();
|
//testFpga();
|
||||||
//testRAM();
|
//testRAM();
|
||||||
|
|
||||||
//setSettings(GET_SETTINGS,-1);
|
|
||||||
//Initialization
|
//Initialization
|
||||||
|
//setSettings(GET_SETTINGS,-1);
|
||||||
//setFrames(1);
|
//setFrames(1);
|
||||||
//setTrains(1);
|
//setTrains(1);
|
||||||
//setExposureTime(1e6);
|
//setExposureTime(1e6);
|
||||||
@ -90,7 +91,7 @@ int init_detector(int b) {
|
|||||||
|
|
||||||
int decode_function(int file_des) {
|
int decode_function(int file_des) {
|
||||||
int fnum,n;
|
int fnum,n;
|
||||||
int retval=FAIL;
|
int ret=FAIL;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf( "receive data\n");
|
printf( "receive data\n");
|
||||||
#endif
|
#endif
|
||||||
@ -109,10 +110,10 @@ int decode_function(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
if (fnum<0 || fnum>255)
|
if (fnum<0 || fnum>255)
|
||||||
fnum=255;
|
fnum=255;
|
||||||
retval=(*flist[fnum])(file_des);
|
ret=(*flist[fnum])(file_des);
|
||||||
if (retval==FAIL)
|
if (ret==FAIL)
|
||||||
printf( "Error executing the function = %d \n",fnum);
|
printf( "Error executing the function = %d \n",fnum);
|
||||||
return retval;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,18 +195,18 @@ int function_table() {
|
|||||||
|
|
||||||
int M_nofunc(int file_des){
|
int M_nofunc(int file_des){
|
||||||
|
|
||||||
int retval=FAIL;
|
int ret=FAIL;
|
||||||
sprintf(mess,"Unrecognized Function\n");
|
sprintf(mess,"Unrecognized Function\n");
|
||||||
printf(mess);
|
printf(mess);
|
||||||
sendDataOnly(file_des,&retval,sizeof(retval));
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
sendDataOnly(file_des,mess,sizeof(mess));
|
sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
return GOODBYE;
|
return GOODBYE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int exit_server(int file_des) {
|
int exit_server(int file_des) {
|
||||||
int retval=FAIL;
|
int ret=FAIL;
|
||||||
sendDataOnly(file_des,&retval,sizeof(retval));
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
printf("closing server.");
|
printf("closing server.");
|
||||||
sprintf(mess,"closing server");
|
sprintf(mess,"closing server");
|
||||||
sendDataOnly(file_des,mess,sizeof(mess));
|
sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
@ -215,7 +216,7 @@ int exit_server(int file_des) {
|
|||||||
int exec_command(int file_des) {
|
int exec_command(int file_des) {
|
||||||
char cmd[MAX_STR_LENGTH];
|
char cmd[MAX_STR_LENGTH];
|
||||||
char answer[MAX_STR_LENGTH];
|
char answer[MAX_STR_LENGTH];
|
||||||
int retval=OK;
|
int ret=OK;
|
||||||
int sysret=0;
|
int sysret=0;
|
||||||
int n=0;
|
int n=0;
|
||||||
|
|
||||||
@ -223,11 +224,11 @@ int exec_command(int file_des) {
|
|||||||
n = receiveDataOnly(file_des,cmd,MAX_STR_LENGTH);
|
n = receiveDataOnly(file_des,cmd,MAX_STR_LENGTH);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* execute action if the arguments correctly arrived*/
|
/* execute action if the arguments correctly arrived*/
|
||||||
if (retval==OK) {
|
if (ret==OK) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("executing command %s\n", cmd);
|
printf("executing command %s\n", cmd);
|
||||||
#endif
|
#endif
|
||||||
@ -241,23 +242,23 @@ int exec_command(int file_des) {
|
|||||||
sprintf(answer,"Detector locked by %s\n", lastClientIP);
|
sprintf(answer,"Detector locked by %s\n", lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
sprintf(answer,"Failed\n");
|
sprintf(answer,"Failed\n");
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(answer,"Could not receive the command\n");
|
sprintf(answer,"Could not receive the command\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(retval));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
n = sendDataOnly(file_des,answer,MAX_STR_LENGTH);
|
n = sendDataOnly(file_des,answer,MAX_STR_LENGTH);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error writing to socket");
|
sprintf(mess,"Error writing to socket");
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,6 +469,7 @@ int set_master(int file_des) {
|
|||||||
printf("setting master flags to %d\n",arg);
|
printf("setting master flags to %d\n",arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
@ -475,9 +477,11 @@ int set_master(int file_des) {
|
|||||||
retval=setMaster(arg);
|
retval=setMaster(arg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (retval==GET_MASTER) {
|
if (retval==GET_MASTER) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
n = sendDataOnly(file_des,mess,sizeof(mess));
|
n = sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
@ -513,15 +517,19 @@ int set_synchronization(int file_des) {
|
|||||||
printf("setting master flags to %d\n",arg);
|
printf("setting master flags to %d\n",arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
retval=setSynchronization(arg);
|
retval=setSynchronization(arg);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (retval==GET_SYNCHRONIZATION_MODE) {
|
if (retval==GET_SYNCHRONIZATION_MODE) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
n = sendDataOnly(file_des,mess,sizeof(mess));
|
n = sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
@ -539,15 +547,15 @@ int set_synchronization(int file_des) {
|
|||||||
|
|
||||||
int get_detector_type(int file_des) {
|
int get_detector_type(int file_des) {
|
||||||
int n=0;
|
int n=0;
|
||||||
enum detectorType ret;
|
enum detectorType retval;
|
||||||
int retval=OK;
|
int ret=OK;
|
||||||
|
|
||||||
sprintf(mess,"Can't return detector type\n");
|
sprintf(mess,"Can't return detector type\n");
|
||||||
|
|
||||||
|
|
||||||
/* receive arguments */
|
/* receive arguments */
|
||||||
/* execute action */
|
/* execute action */
|
||||||
ret=myDetectorType;
|
retval=myDetectorType;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Returning detector type %d\n",ret);
|
printf("Returning detector type %d\n",ret);
|
||||||
@ -558,15 +566,15 @@ int get_detector_type(int file_des) {
|
|||||||
if (differentClients==1)
|
if (differentClients==1)
|
||||||
retval=FORCE_UPDATE;
|
retval=FORCE_UPDATE;
|
||||||
|
|
||||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (retval!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -574,8 +582,8 @@ int get_detector_type(int file_des) {
|
|||||||
|
|
||||||
int set_number_of_modules(int file_des) {
|
int set_number_of_modules(int file_des) {
|
||||||
int n;
|
int n;
|
||||||
int arg[2], ret=0;
|
int arg[2], retval=0;
|
||||||
int retval=OK;
|
int ret=OK;
|
||||||
enum dimension dim;
|
enum dimension dim;
|
||||||
int nm;
|
int nm;
|
||||||
|
|
||||||
@ -585,9 +593,9 @@ int set_number_of_modules(int file_des) {
|
|||||||
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error reading from socket %d", n);
|
sprintf(mess,"Error reading from socket %d", n);
|
||||||
retval=GOODBYE;
|
ret=GOODBYE;
|
||||||
}
|
}
|
||||||
if (retval==OK) {
|
if (ret==OK) {
|
||||||
dim=arg[0];
|
dim=arg[0];
|
||||||
nm=arg[1];
|
nm=arg[1];
|
||||||
|
|
||||||
@ -596,43 +604,42 @@ int set_number_of_modules(int file_des) {
|
|||||||
printf("Setting the number of modules in dimension %d to %d\n",dim,nm );
|
printf("Setting the number of modules in dimension %d to %d\n",dim,nm );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (lockStatus==1 && differentClients==1 && nm!=GET_FLAG) {
|
if (lockStatus==1 && differentClients==1 && nm!=GET_FLAG) {
|
||||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
} else {
|
} else
|
||||||
ret=setNMod(nm, dim);
|
retval=setNMod(nm, dim);
|
||||||
if (ret==nm || nm==GET_FLAG) {
|
|
||||||
retval=OK;
|
|
||||||
if (differentClients==1)
|
|
||||||
retval=FORCE_UPDATE;
|
|
||||||
} else
|
|
||||||
retval=FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dataBytes=calculateDataBytes();
|
dataBytes=calculateDataBytes();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (retval==nm || nm==GET_FLAG) {
|
||||||
|
ret=OK;
|
||||||
|
if (differentClients==1)
|
||||||
|
ret=FORCE_UPDATE;
|
||||||
|
} else
|
||||||
|
ret=FAIL;
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(retval));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (retval!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
/*return ok/fail*/
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
|
/*return ok/fail*/
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int get_max_number_of_modules(int file_des) {
|
int get_max_number_of_modules(int file_des) {
|
||||||
int n;
|
int n;
|
||||||
int ret;
|
int retval;
|
||||||
int retval=OK;
|
int ret=OK;
|
||||||
enum dimension arg;
|
enum dimension arg;
|
||||||
|
|
||||||
sprintf(mess,"Can't get max number of modules\n");
|
sprintf(mess,"Can't get max number of modules\n");
|
||||||
@ -640,39 +647,37 @@ int get_max_number_of_modules(int file_des) {
|
|||||||
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
/* execute action */
|
/* execute action */
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Getting the max number of modules in dimension %d \n",arg);
|
printf("Getting the max number of modules in dimension %d \n",arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
|
||||||
ret=getNModBoard(arg);
|
retval=getNModBoard(arg);
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Max number of module in dimension %d is %d\n",arg,ret );
|
printf("Max number of module in dimension %d is %d\n",arg,retval );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (differentClients==1 && ret==OK) {
|
||||||
|
ret=FORCE_UPDATE;
|
||||||
if (differentClients==1 && retval==OK) {
|
|
||||||
retval=FORCE_UPDATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(retval));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (retval!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return retval;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -686,7 +691,7 @@ int set_external_signal_flag(int file_des) {
|
|||||||
int arg[2];
|
int arg[2];
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
int signalindex;
|
int signalindex;
|
||||||
enum externalSignalFlag flag, retval;
|
enum externalSignalFlag flag, retval=SIGNAL_OFF;
|
||||||
|
|
||||||
sprintf(mess,"Can't set external signal flag\n");
|
sprintf(mess,"Can't set external signal flag\n");
|
||||||
|
|
||||||
@ -696,7 +701,7 @@ int set_external_signal_flag(int file_des) {
|
|||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
retval=SIGNAL_OFF;
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
signalindex=arg[0];
|
signalindex=arg[0];
|
||||||
flag=arg[1];
|
flag=arg[1];
|
||||||
@ -705,7 +710,6 @@ int set_external_signal_flag(int file_des) {
|
|||||||
case GET_EXTERNAL_SIGNAL_FLAG:
|
case GET_EXTERNAL_SIGNAL_FLAG:
|
||||||
retval=getExtSignal(signalindex);
|
retval=getExtSignal(signalindex);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (differentClients==0 || lockStatus==0) {
|
if (differentClients==0 || lockStatus==0) {
|
||||||
retval=setExtSignal(signalindex,flag);
|
retval=setExtSignal(signalindex,flag);
|
||||||
@ -714,24 +718,20 @@ int set_external_signal_flag(int file_des) {
|
|||||||
sprintf(mess,"External signal %d flag should be 0x%04x but is 0x%04x\n", signalindex, flag, retval);
|
sprintf(mess,"External signal %d flag should be 0x%04x but is 0x%04x\n", signalindex, flag, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (lockStatus!=0) {
|
||||||
if (lockStatus!=0) {
|
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Setting external signal %d to flag %d\n",signalindex,flag );
|
printf("Setting external signal %d to flag %d\n",signalindex,flag );
|
||||||
printf("Set to flag %d\n",retval);
|
printf("Set to flag %d\n",retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret==OK && differentClients!=0)
|
if (ret==OK && differentClients!=0)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
@ -756,8 +756,8 @@ int set_external_signal_flag(int file_des) {
|
|||||||
|
|
||||||
int set_external_communication_mode(int file_des) {
|
int set_external_communication_mode(int file_des) {
|
||||||
int n;
|
int n;
|
||||||
enum externalCommunicationMode arg, ret=GET_EXTERNAL_COMMUNICATION_MODE;
|
enum externalCommunicationMode arg, retval=GET_EXTERNAL_COMMUNICATION_MODE;
|
||||||
int retval=OK;
|
int ret=OK;
|
||||||
|
|
||||||
sprintf(mess,"Can't set external communication mode\n");
|
sprintf(mess,"Can't set external communication mode\n");
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ int set_external_communication_mode(int file_des) {
|
|||||||
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
retval=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
enum externalCommunicationMode{
|
enum externalCommunicationMode{
|
||||||
@ -782,15 +782,16 @@ enum externalCommunicationMode{
|
|||||||
GATE_COINCIDENCE_WITH_INTERNAL_ENABLE
|
GATE_COINCIDENCE_WITH_INTERNAL_ENABLE
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
if (retval==OK) {
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
if (ret==OK) {
|
||||||
/* execute action */
|
/* execute action */
|
||||||
|
|
||||||
ret=setTiming(arg);
|
retval=setTiming(arg);
|
||||||
|
|
||||||
/* switch(arg) { */
|
/* switch(arg) { */
|
||||||
/* default: */
|
/* default: */
|
||||||
/* sprintf(mess,"The meaning of single signals should be set\n"); */
|
/* sprintf(mess,"The meaning of single signals should be set\n"); */
|
||||||
/* retval=FAIL; */
|
/* ret=FAIL; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
@ -799,19 +800,20 @@ enum externalCommunicationMode{
|
|||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(retval));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (retval!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&ret,sizeof(ret));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2929,7 +2931,6 @@ int reset_counter_block(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int start_receiver(int file_des) {
|
int start_receiver(int file_des) {
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
int n=0;
|
int n=0;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
CC = g++
|
CC = g++
|
||||||
CLAGS += -DSLS_RECEIVER_FUNCTION_LIST #-DUHRIXCALLBACK #-DTESTWRITE
|
CLAGS += -DSLS_RECEIVER_FUNCTION_LIST
|
||||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++
|
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++
|
||||||
|
|
||||||
|
|
||||||
#LDLIBS += -lm -lstdc++ -lpthread
|
#LDLIBS += -lm -lstdc++ -lpthread
|
||||||
LIBS?= -L$(LIBDIR) -lSlsDetector
|
LIBS?= -L$(LIBDIR) -lSlsDetector
|
||||||
|
|
||||||
INCLUDES ?= -I ../MySocketTCP -I ../commonFiles -I ../usersFunctions -I ../slsDetectorAnalysis -I .
|
INCLUDES ?= -I ../MySocketTCP -I ../commonFiles -I -I ../slsDetectorAnalysis -I .
|
||||||
SRC_CLNT = slsReceiver.cpp
|
SRC_CLNT = slsReceiver.cpp
|
||||||
#../MySocketTCP/MySocketTCP.cpp slsReceiver_funcs.cpp UHRIXCallback.cpp slsReceiverFunctionList.cpp ../usersFunctions/usersFunctions.cpp slsReceiverUsers.cpp
|
#../MySocketTCP/MySocketTCP.cpp slsReceiver_funcs.cpp UHRIXCallback.cpp slsReceiverFunctionList.cpp slsReceiverUsers.cpp
|
||||||
|
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
#include "UHRIXCallback.h"
|
|
||||||
|
|
||||||
|
|
||||||
int UHRIXCallbackDataFunc(char* d, int np, FILE* fd, void* p){
|
|
||||||
int i,j,jmax=6;
|
|
||||||
u_int16_t da;
|
|
||||||
|
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
|
||||||
//printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Receiver Data received \n");
|
|
||||||
if (d==NULL)
|
|
||||||
printf("no data received\n");
|
|
||||||
else{
|
|
||||||
// printf("received %d bytes of data\n",np);
|
|
||||||
// printf("index:%d\n",(int)(*(int*)d));
|
|
||||||
for ( i=0; i<(np-4)/2-jmax+1; i++)
|
|
||||||
{
|
|
||||||
//((int16_t *)d)[i+2] -= ((int16_t *)d)[i+3];
|
|
||||||
//((int16_t *)d)[i+2] *= ((int16_t *)d)[i+2];
|
|
||||||
for (j=1; j<jmax; j++) ((int16_t *)d)[i+2] += ((int16_t *)d)[i+2+j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Finished \n");
|
|
||||||
//#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
int UHRIXCallbackDataFunc(char* d, int np, FILE* fd, void* p);
|
|
@ -7,14 +7,6 @@
|
|||||||
|
|
||||||
#include "slsReceiverFunctionList.h"
|
#include "slsReceiverFunctionList.h"
|
||||||
|
|
||||||
#ifdef TESTWRITE
|
|
||||||
#include "usersFunctions.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UHRIXCALLBACK
|
|
||||||
#include "UHRIXCallback.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <signal.h> // SIGINT
|
#include <signal.h> // SIGINT
|
||||||
#include <sys/stat.h> // stat
|
#include <sys/stat.h> // stat
|
||||||
#include <sys/socket.h> // socket(), bind(), listen(), accept(), shut down
|
#include <sys/socket.h> // socket(), bind(), listen(), accept(), shut down
|
||||||
@ -58,8 +50,6 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit
|
|||||||
guiFileName(NULL),
|
guiFileName(NULL),
|
||||||
currframenum(0),
|
currframenum(0),
|
||||||
nFrameToGui(0),
|
nFrameToGui(0),
|
||||||
writeReceiverData(0),
|
|
||||||
pwriteReceiverDataArg(0),
|
|
||||||
startAcquisitionCallBack(NULL),
|
startAcquisitionCallBack(NULL),
|
||||||
pStartAcquisition(NULL),
|
pStartAcquisition(NULL),
|
||||||
acquisitionFinishedCallBack(NULL),
|
acquisitionFinishedCallBack(NULL),
|
||||||
@ -111,14 +101,7 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit
|
|||||||
|
|
||||||
if(withGotthard)
|
if(withGotthard)
|
||||||
cout << "Testing MOENCH Receiver with GOTTHARD Detector" << endl;
|
cout << "Testing MOENCH Receiver with GOTTHARD Detector" << endl;
|
||||||
#ifdef TESTWRITE
|
|
||||||
//to test write receiver data call back
|
|
||||||
registerWriteReceiverDataCallback(&defaultWriteReceiverDataFunc, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UHRIXCALLBACK
|
|
||||||
registerWriteReceiverDataCallback(&UHRIXCallbackDataFunc, latestData);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -443,7 +426,7 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
strcpy(guiFileName,"");
|
strcpy(guiFileName,"");
|
||||||
|
|
||||||
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
|
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
|
||||||
if (writeReceiverData)
|
if (rawDataReadyCallBack)
|
||||||
cout << "Note: Data Write has been defined exernally" << endl;
|
cout << "Note: Data Write has been defined exernally" << endl;
|
||||||
if(nFrameToGui)
|
if(nFrameToGui)
|
||||||
cout << "Sending every " << nFrameToGui << "th frame to gui" << endl;
|
cout << "Sending every " << nFrameToGui << "th frame to gui" << endl;
|
||||||
@ -510,13 +493,9 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
|
|
||||||
//cout<<"**************curreframenm:"<<currframenum<<endl;
|
//cout<<"**************curreframenm:"<<currframenum<<endl;
|
||||||
|
|
||||||
//write data call back
|
|
||||||
if (writeReceiverData) {
|
|
||||||
writeReceiverData(wbuf,bufferSize, sfilefd, pwriteReceiverDataArg);
|
|
||||||
}
|
|
||||||
//write data call back
|
//write data call back
|
||||||
if (cbAction < DO_EVERYTHING) {
|
if (cbAction < DO_EVERYTHING) {
|
||||||
rawDataReadyCallBack(currframenum, wbuf,sfilefd, guiData,pRawDataReady);
|
rawDataReadyCallBack(currframenum, wbuf, bufferSize, sfilefd, guiData,pRawDataReady);
|
||||||
}
|
}
|
||||||
//default writing to file
|
//default writing to file
|
||||||
else if(enableFileWrite){
|
else if(enableFileWrite){
|
||||||
|
@ -129,10 +129,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void resetTotalFramesCaught();
|
void resetTotalFramesCaught();
|
||||||
|
|
||||||
/**
|
|
||||||
* Close File
|
|
||||||
*/
|
|
||||||
//static void closeFile(int p);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts Receiver - starts to listen for packets
|
* Starts Receiver - starts to listen for packets
|
||||||
@ -193,12 +189,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
int setNFrameToGui(int i){if(i>=0) nFrameToGui = i; return nFrameToGui;};
|
int setNFrameToGui(int i){if(i>=0) nFrameToGui = i; return nFrameToGui;};
|
||||||
|
|
||||||
/**
|
|
||||||
* Register call back function to write receiver data
|
|
||||||
*/
|
|
||||||
void registerWriteReceiverDataCallback(int( *userCallback)(char*, int, FILE*, void*), void *pArg) {writeReceiverData = userCallback; pwriteReceiverDataArg = pArg;};
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** detector type */
|
/** detector type */
|
||||||
@ -314,11 +304,6 @@ private:
|
|||||||
int nFrameToGui;
|
int nFrameToGui;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** register for call back to get data */
|
|
||||||
int (*writeReceiverData)(char*,int,FILE*,void*);
|
|
||||||
void *pwriteReceiverDataArg;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
callback arguments are
|
callback arguments are
|
||||||
filepath
|
filepath
|
||||||
@ -348,10 +333,11 @@ private:
|
|||||||
args to raw data ready callback are
|
args to raw data ready callback are
|
||||||
framenum
|
framenum
|
||||||
datapointer
|
datapointer
|
||||||
|
datasize in bytes
|
||||||
file descriptor
|
file descriptor
|
||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
void (*rawDataReadyCallBack)(int, char*, FILE*, char*, void*);
|
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
|
||||||
void *pRawDataReady;
|
void *pRawDataReady;
|
||||||
|
|
||||||
/** The action which decides what the user and default responsibilites to save data are
|
/** The action which decides what the user and default responsibilites to save data are
|
||||||
@ -407,10 +393,11 @@ public:
|
|||||||
args to raw data ready callback are
|
args to raw data ready callback are
|
||||||
framenum
|
framenum
|
||||||
datapointer
|
datapointer
|
||||||
|
datasize in bytes
|
||||||
file descriptor
|
file descriptor
|
||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
void registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){rawDataReadyCallBack=func; pRawDataReady=arg;};
|
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){rawDataReadyCallBack=func; pRawDataReady=arg;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(int, voi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){
|
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){
|
||||||
receiver->registerCallBackRawDataReady(func,arg);
|
receiver->registerCallBackRawDataReady(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@sort register callback to be called when data are available (to process and/or save the data).
|
@sort register callback to be called when data are available (to process and/or save the data).
|
||||||
\param func raw data ready callback. arguments are framenum datapointer file descriptor guidatapointer (NULL, no data required)
|
\param func raw data ready callback. arguments are framenum datapointer datasize file descriptor guidatapointer (NULL, no data required)
|
||||||
\returns nothing
|
\returns nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, int datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -71,11 +71,12 @@ public:
|
|||||||
args to raw data ready callback are
|
args to raw data ready callback are
|
||||||
framenum
|
framenum
|
||||||
datapointer
|
datapointer
|
||||||
|
datasize in bytes
|
||||||
file descriptor
|
file descriptor
|
||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){slsReceiverList->registerCallBackRawDataReady(func,arg);};
|
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){slsReceiverList->registerCallBackRawDataReady(func,arg);};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x561
|
//#define SVNREV 0x568
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x561
|
#define SVNREV 0x568
|
||||||
#define SVNDATE 0x20130516
|
#define SVNDATE 0x20130521
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user