mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 00:50:42 +02:00
dhanya-got rid of temp, setgotthard, getgotthard functions
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@37 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
ef657a9218
commit
5ec765e41e
@ -254,14 +254,14 @@ enum dacIndex {
|
||||
VSH_POT, /**< chiptest board power supply vsh */
|
||||
VIO_POT, /**< chiptest board power supply va */
|
||||
HV_POT, /**< chiptest board high voltage */
|
||||
G_VREF_DS, /**< gotthard */
|
||||
G_VCASCN_PB, /**< gotthard */
|
||||
G_VCASCP_PB, /**< gotthard */
|
||||
G_VOUT_CM, /**< gotthard */
|
||||
G_VCASC_OUT, /**< gotthard */
|
||||
G_VIN_CM, /**< gotthard */
|
||||
G_VREF_COMP, /**< gotthard */
|
||||
G_IB_TESTC /**< gotthard */
|
||||
G_VREF_DS, /**< gotthard */
|
||||
G_VCASCN_PB, /**< gotthard */
|
||||
G_VCASCP_PB, /**< gotthard */
|
||||
G_VOUT_CM, /**< gotthard */
|
||||
G_VCASC_OUT, /**< gotthard */
|
||||
G_VIN_CM, /**< gotthard */
|
||||
G_VREF_COMP, /**< gotthard */
|
||||
G_IB_TESTC /**< gotthard */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -461,9 +461,6 @@ enum {
|
||||
|
||||
F_EXIT_SERVER, /**< turnoff detector server */
|
||||
|
||||
F_GET_TEMPERATURE,
|
||||
F_SET_GOTTHARD,
|
||||
F_GET_GOTTHARD,
|
||||
|
||||
F_GET_ACTUAL_TIME, /**< Gets the actual time of the detector's internal timer */
|
||||
F_GET_MEASUREMENT_TIME /**< Gets the time of the measurement from the detector (fifo) */
|
||||
|
@ -6,72 +6,6 @@
|
||||
//using namespace std;
|
||||
|
||||
|
||||
char* gotthardDetector::gotthardStringname(string name) {
|
||||
|
||||
char retval[100];
|
||||
int fnum, set=0;
|
||||
char val[100];
|
||||
|
||||
|
||||
if (name.length()==0){
|
||||
fnum=F_GET_GOTTHARD;
|
||||
}
|
||||
else
|
||||
{
|
||||
fnum=F_SET_GOTTHARD;
|
||||
set=1;
|
||||
strcpy(val,name.c_str());
|
||||
}
|
||||
int ret=FAIL;
|
||||
|
||||
|
||||
char mess[100];
|
||||
// int arg[1];
|
||||
// arg[0]=name;
|
||||
|
||||
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< std::endl;
|
||||
if(set)
|
||||
std::cout<< "Setting Stringname" << std::endl;
|
||||
else
|
||||
std::cout<< "Retreiving stringname" << std::endl;
|
||||
//#endif
|
||||
|
||||
|
||||
if (controlSocket) {
|
||||
std::cout<< "controlsocket worked\n";
|
||||
if (controlSocket->Connect()>=0) {
|
||||
std::cout<< "connectsocket worked\n";
|
||||
std::cout<<"fnum:"<<fnum<<endl;
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
//controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
if(set)
|
||||
controlSocket->SendDataOnly(val,sizeof(val));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==OK) {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "Stringname set to "<< retval << std::endl;
|
||||
//#endif
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "Setting/Getting stringname failed " << std::endl;
|
||||
}
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
string gotthardDetector::executeLine(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
@ -163,25 +97,7 @@ string gotthardDetector::executeLine(int narg, char *args[], int action) {
|
||||
return string("more questions? Refere to software documentation!");
|
||||
}
|
||||
|
||||
if (var=="gotthardString")
|
||||
{ setTCPSocket();
|
||||
if (action==PUT_ACTION)
|
||||
{
|
||||
sval=string(args[1]);
|
||||
std::cout<<"in setting\n";
|
||||
sval=string(args[1]);
|
||||
gotthardStringname(sval);
|
||||
}
|
||||
std::cout<<"in getting\n";
|
||||
strcpy(answer, gotthardStringname(""));
|
||||
return string(answer);
|
||||
} else if (var=="exitserver") {
|
||||
setTCPSocket();
|
||||
ival=exitServer();
|
||||
if(ival!=OK)
|
||||
return string("Closing Server..");
|
||||
else return string("Error closing server\n");
|
||||
} else if (var=="hostname") {
|
||||
if (var=="hostname") {
|
||||
if (action==PUT_ACTION) {
|
||||
setTCPSocket(args[1]);
|
||||
}
|
||||
@ -903,14 +819,7 @@ string gotthardDetector::executeLine(int narg, char *args[], int action) {
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
else if (var=="temp") {
|
||||
if (action==PUT_ACTION) {
|
||||
return string("cannot set");
|
||||
}
|
||||
sprintf(answer,"%f",getTemperature());
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////enter new stuff here if required
|
||||
//timers
|
||||
|
||||
else if (var=="exptime") {
|
||||
@ -3302,44 +3211,3 @@ int gotthardDetector::getPositions(float *pos){
|
||||
return thisDetector->numberOfPositions;
|
||||
};
|
||||
|
||||
|
||||
|
||||
float gotthardDetector::getTemperature(int imod){
|
||||
|
||||
float retval;
|
||||
int fnum=F_GET_TEMPERATURE;
|
||||
int ret=FAIL;
|
||||
char mess[100];
|
||||
//int arg = imod;
|
||||
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "GOTTHARD Getting Temperature of module "<< imod << std::endl;
|
||||
//#endif
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
|
||||
std::cout<< "onlineflag worked\n";
|
||||
if (controlSocket) {
|
||||
std::cout<< "controlsocket worked\n";
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==OK) {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "Temperature is "<< retval << std::endl;
|
||||
//#endif
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "Getting temperature failed " << std::endl;
|
||||
}
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ extern int nModX;
|
||||
extern int nModY;
|
||||
extern int dataBytes;
|
||||
extern int dynamicRange;
|
||||
extern int storeInRAM;
|
||||
extern int storeInRAM;
|
||||
|
||||
|
||||
/* global variables for optimized readout */
|
||||
@ -36,8 +36,6 @@ extern int *ram_values;
|
||||
char *dataretval=NULL;
|
||||
int nframes, iframes, dataret;
|
||||
char mess[1000];
|
||||
char stringname[100]="whatever i want it to be";
|
||||
float default_temperature = 999.99;
|
||||
|
||||
|
||||
|
||||
@ -150,9 +148,6 @@ int function_table() {
|
||||
flist[F_SET_SPEED]=&set_speed;
|
||||
flist[F_SET_READOUT_FLAGS]=&set_readout_flags;
|
||||
flist[F_EXECUTE_TRIMMING]=&execute_trimming;
|
||||
flist[F_GET_TEMPERATURE]=&get_temperature;
|
||||
flist[F_GET_GOTTHARD]=&getGotthard;
|
||||
flist[F_SET_GOTTHARD]=&setGotthard;
|
||||
#ifdef VERBOSE
|
||||
/* for (i=0;i<256;i++){
|
||||
printf("function %d located at %x\n",i,flist[i]);
|
||||
@ -2330,159 +2325,3 @@ int execute_trimming(int fnum) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
float get_temperature(int fnum) {
|
||||
|
||||
float retval;
|
||||
int ret=OK;
|
||||
int imod,n;
|
||||
|
||||
n = receiveDataOnly(&imod,sizeof(imod));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Getting Temperature of module %d \n", imod);
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (imod>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (imod<0)
|
||||
imod=ALLMOD;
|
||||
*/
|
||||
|
||||
/* execute action if the arguments correctly arrived*/
|
||||
if (ret==OK) {
|
||||
retval = default_temperature; //getTemperature(imod);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Temperature of module %d is %f \n",imod,retval);
|
||||
#endif
|
||||
|
||||
//validate somehow if the temperature read makes sense, else ret=FAIL
|
||||
ret=OK;
|
||||
strcpy(mess,"Getting temperature ERROR\n");
|
||||
|
||||
/* send ret */
|
||||
n = sendDataOnly(&ret,sizeof(ret));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
retval=FAIL;
|
||||
}
|
||||
if (ret==OK) {
|
||||
/* send return argument */
|
||||
n = sendDataOnly(&retval,sizeof(retval));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
ret=FAIL;
|
||||
}
|
||||
} else {
|
||||
n = sendDataOnly(mess,sizeof(mess));
|
||||
}
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int getGotthard(int fnum) {
|
||||
|
||||
int retval=OK;
|
||||
int ret=0;
|
||||
// char val[100];
|
||||
int n=0;
|
||||
printf("in getgotthard fn\n");
|
||||
/* receive arguments
|
||||
n = receiveDataOnly(val,sizeof(val));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
retval=FAIL;
|
||||
}
|
||||
*/
|
||||
/* execute action if the arguments correctly arrived*/
|
||||
if (retval==OK) {
|
||||
|
||||
printf("getting stringname %s\n", stringname);
|
||||
|
||||
}
|
||||
|
||||
/* send ret */
|
||||
n = sendDataOnly(&ret,sizeof(ret));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
/* send answer */
|
||||
n = sendDataOnly(stringname,sizeof(stringname));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
if(retval==FAIL)
|
||||
sendDataOnly(mess,sizeof(mess));
|
||||
|
||||
|
||||
|
||||
/*return ok/fail*/
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int setGotthard(int fnum) {
|
||||
int retval=OK;
|
||||
int ret=0;
|
||||
char val[100];
|
||||
int n=0;
|
||||
printf("in setgotthard fn\n");
|
||||
/* receive arguments */
|
||||
n = receiveDataOnly(val,sizeof(val));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
/* execute action if the arguments correctly arrived*/
|
||||
if (retval==OK) {
|
||||
|
||||
printf("setting stringname %s\n", val);
|
||||
|
||||
}
|
||||
|
||||
strcpy(stringname, val);
|
||||
|
||||
/* send ret */
|
||||
n = sendDataOnly(&ret,sizeof(ret));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
/* send answer */
|
||||
n = sendDataOnly(stringname,sizeof(stringname));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error writing to socket");
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
if(retval==FAIL)
|
||||
sendDataOnly(mess,sizeof(mess));
|
||||
|
||||
/*return ok/fail*/
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user