few receiver functionalities implemented

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@784 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2014-03-14 11:00:31 +00:00
parent 91c59ce65e
commit f6b9f58721
3 changed files with 46 additions and 34 deletions

View File

@ -1,7 +1,5 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "slsDetectorServer_funcs.h" #include "slsDetectorServer_funcs.h"
#include "slsDetectorFunctionList.h" #include "slsDetectorFunctionList.h"
#include "communication_funcs.h" #include "communication_funcs.h"
@ -17,8 +15,7 @@ extern char lastClientIP[INET_ADDRSTRLEN];
extern char thisClientIP[INET_ADDRSTRLEN]; extern char thisClientIP[INET_ADDRSTRLEN];
extern int differentClients; extern int differentClients;
//#if defined(EIGERD) || defined(GOTTHARDD)
//#endif
// Global variables // Global variables
int (*flist[256])(int); int (*flist[256])(int);
@ -580,7 +577,7 @@ int set_number_of_modules(int file_des) {
} }
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
if (ret==OK) { if (ret==OK) {
dim=(dimension)arg[0]; dim=arg[0];
nm=arg[1]; nm=arg[1];
/* execute action */ /* execute action */
@ -693,7 +690,7 @@ int set_external_signal_flag(int file_des) {
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
if (ret==OK) { if (ret==OK) {
signalindex=arg[0]; signalindex=arg[0];
flag=(externalSignalFlag)arg[1]; flag=arg[1];
/* execute action */ /* execute action */
switch (flag) { switch (flag) {
case GET_EXTERNAL_SIGNAL_FLAG: case GET_EXTERNAL_SIGNAL_FLAG:
@ -1017,7 +1014,7 @@ int set_dac(int file_des) {
int imod; int imod;
int n; int n;
int val; int val;
enum detDacIndex idac=(detDacIndex)0; enum detDacIndex idac=0;
sprintf(mess,"Can't set DAC\n"); sprintf(mess,"Can't set DAC\n");
@ -1027,7 +1024,7 @@ int set_dac(int file_des) {
sprintf(mess,"Error reading from socket\n"); sprintf(mess,"Error reading from socket\n");
ret=FAIL; ret=FAIL;
} }
ind=(dacIndex)arg[0]; ind=arg[0];
imod=arg[1]; imod=arg[1];
n = receiveData(file_des,&val,sizeof(val),INT32); n = receiveData(file_des,&val,sizeof(val),INT32);
@ -1081,52 +1078,52 @@ int set_dac(int file_des) {
#endif #endif
#ifdef EIGERD #ifdef EIGERD
case E_SvP: case E_SvP:
idac = (detDacIndex)SVP; idac = SVP;
break; break;
case E_SvN: case E_SvN:
idac = (detDacIndex)SVN; idac = SVN;
break; break;
case E_Vtr: case E_Vtr:
idac = (detDacIndex)VTR; idac = VTR;
break; break;
case E_Vrf: case E_Vrf:
idac = (detDacIndex)VRF; idac = VRF;
break; break;
case E_Vrs: case E_Vrs:
idac = (detDacIndex)VRS; idac = VRS;
break; break;
case E_Vtgstv: case E_Vtgstv:
idac = (detDacIndex)VTGSTV; idac = VTGSTV;
break; break;
case E_Vcmp_ll: case E_Vcmp_ll:
idac = (detDacIndex)VCMP_LL; idac = VCMP_LL;
break; break;
case E_Vcmp_lr: case E_Vcmp_lr:
idac = (detDacIndex)VCMP_LR; idac = VCMP_LR;
break; break;
case E_cal: case E_cal:
idac = (detDacIndex)CAL; idac = CAL;
break; break;
case E_Vcmp_rl: case E_Vcmp_rl:
idac = (detDacIndex)VCMP_RL; idac = VCMP_RL;
break; break;
case E_Vcmp_rr: case E_Vcmp_rr:
idac = (detDacIndex)VCMP_RR; idac = VCMP_RR;
break; break;
case E_rxb_rb: case E_rxb_rb:
idac = (detDacIndex)RXB_RB; idac = RXB_RB;
break; break;
case E_rxb_lb: case E_rxb_lb:
idac = (detDacIndex)RXB_LB; idac = RXB_LB;
break; break;
case E_Vcp: case E_Vcp:
idac = (detDacIndex)VCP; idac = VCP;
break; break;
case E_Vcn: case E_Vcn:
idac = (detDacIndex)VCN; idac = VCN;
break; break;
case E_Vis: case E_Vis:
idac = (detDacIndex)VIS; idac = VIS;
break; break;
#endif #endif
default: default:
@ -1191,7 +1188,7 @@ int get_adc(int file_des) {
enum dacIndex ind; enum dacIndex ind;
int imod; int imod;
int n; int n;
enum detDacIndex idac=(detDacIndex)0; enum detDacIndex idac=0;
sprintf(mess,"Can't read ADC\n"); sprintf(mess,"Can't read ADC\n");
@ -1201,7 +1198,7 @@ int get_adc(int file_des) {
sprintf(mess,"Error reading from socket\n"); sprintf(mess,"Error reading from socket\n");
ret=FAIL; ret=FAIL;
} }
ind=(dacIndex)arg[0]; ind=arg[0];
imod=arg[1]; imod=arg[1];
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
@ -1213,7 +1210,7 @@ int get_adc(int file_des) {
switch (ind) { switch (ind) {
#ifdef GOTTHARDD #ifdef GOTTHARDD
case TEMPERATURE_FPGA: //dac = (detDacIndex)TEMP_FPGA; case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
break; break;
case TEMPERATURE_ADC: case TEMPERATURE_ADC:
break; break;
@ -1915,7 +1912,7 @@ int set_settings(int file_des) {
ret=FAIL; ret=FAIL;
} }
imod=arg[1]; imod=arg[1];
isett=(detectorSettings)arg[0]; isett=arg[0];
printf("isett:%d, imod =%d\n",isett,imod); printf("isett:%d, imod =%d\n",isett,imod);
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
@ -2041,7 +2038,7 @@ int set_threshold_energy(int file_des) {
#if defined(MYTHEND) || defined(EIGERD) #if defined(MYTHEND) || defined(EIGERD)
ethr=arg[0]; ethr=arg[0];
imod=arg[1]; imod=arg[1];
isett=(detectorSettings)arg[2]; isett=arg[2];
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
if (imod>=getTotalNumberOfModules()) { if (imod>=getTotalNumberOfModules()) {
ret=FAIL; ret=FAIL;
@ -2635,7 +2632,7 @@ int set_roi(int file_des) {
n = receiveData(file_des,&arg[i].ymax,sizeof(int),INT32); n = receiveData(file_des,&arg[i].ymax,sizeof(int),INT32);
} }
//n = receiveData(file_des,arg,nroi*sizeof(ROI)); //n = receiveData(file_des,arg,nroi*sizeof(ROI));
if ((unsigned int)n != (nroi*sizeof(ROI))) { if (n != (nroi*sizeof(ROI))) {
sprintf(mess,"Received wrong number of bytes for ROI\n"); sprintf(mess,"Received wrong number of bytes for ROI\n");
ret=FAIL; ret=FAIL;
} }

View File

@ -7,6 +7,7 @@
#include "slsReceiverFunctionList.h" #include "slsReceiverFunctionList.h"
#include "svnInfoReceiver.h" #include "svnInfoReceiver.h"
#include "slsReceiverUsers.h" #include "slsReceiverUsers.h"
#include "slsDetectorBase.h"
#include <signal.h> //SIGINT #include <signal.h> //SIGINT
#include <stdlib.h> //EXIT #include <stdlib.h> //EXIT
@ -718,6 +719,9 @@ int slsReceiverFuncs::setup_udp(){
int slsReceiverFuncs::start_receiver(){ int slsReceiverFuncs::start_receiver(){
ret=OK; ret=OK;
ret=OK;
enum runStatus s;
char cstatus[15];
strcpy(mess,"Could not start receiver\n"); strcpy(mess,"Could not start receiver\n");
// execute action if the arguments correctly arrived // execute action if the arguments correctly arrived
@ -732,8 +736,17 @@ int slsReceiverFuncs::start_receiver(){
ret = FAIL; ret = FAIL;
} }
*/ */
else if(slsReceiverList->getStatus()==IDLE) else {
ret=slsReceiverList->startReceiver(mess); s = slsReceiverList->getStatus();
strcpy(cstatus, slsDetectorBase::runStatusType(s).c_str());
if(s == IDLE)
ret=slsReceiverList->startReceiver(mess);
else{
sprintf(mess,"Cannot start Receiver as it is in %s state\n",cstatus);
ret=FAIL;
}
}
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
@ -1443,7 +1456,7 @@ int slsReceiverFuncs::set_timer() {
strcpy(mess,"Error reading from socket\n"); strcpy(mess,"Error reading from socket\n");
ret = FAIL; ret = FAIL;
} }
cout<<"index[0]"<<index[0]<<" index[1]:"<<index[1]<<endl;
// execute action if the arguments correctly arrived // execute action if the arguments correctly arrived
#ifdef SLS_RECEIVER_FUNCTION_LIST #ifdef SLS_RECEIVER_FUNCTION_LIST
if (ret==OK) { if (ret==OK) {
@ -1767,10 +1780,12 @@ int slsReceiverFuncs::send_update() {
//index //index
#ifdef SLS_RECEIVER_FUNCTION_LIST #ifdef SLS_RECEIVER_FUNCTION_LIST
#ifndef EIGER_RECEIVER
ind=slsReceiverList->getFileIndex(); ind=slsReceiverList->getFileIndex();
#endif #endif
socket->SendDataOnly(&ind,sizeof(ind)); socket->SendDataOnly(&ind,sizeof(ind));
#endif
//filepath //filepath
#ifdef SLS_RECEIVER_FUNCTION_LIST #ifdef SLS_RECEIVER_FUNCTION_LIST