changed a few things in gotthardDetector.cpp and added 2 members to sls_detector_module in slsdetector.cpp to incorporate gotthards need of client ip address and client mac address to send data

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@55 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2011-11-21 16:11:28 +00:00
parent 19e2f2ef60
commit b2723feb47
3 changed files with 69 additions and 11 deletions

View File

@ -370,10 +370,10 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
ifstream infile; ifstream infile;
ostringstream oss; ostringstream oss;
int iline=0; int iline=0;
// string names[]={"Vref", "VcascN","VcascP", "Vout", "Vcasc", "Vin", "Vref_comp", "Vib_test", "config", "HV"}; string sargname,sargname2;
string sargname;
int ival; int ival;
int ichan=0, ichip=0, idac=0; int ichan=0, ichip=0, idac=0;
string::size_type pos=0;
@ -386,6 +386,7 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
#endif #endif
infile.open(myfname.c_str(), ios_base::in); infile.open(myfname.c_str(), ios_base::in);
if (infile.is_open()) { if (infile.is_open()) {
//dacs---------------
for (int iarg=0; iarg<thisDetector->nDacs; iarg++) { for (int iarg=0; iarg<thisDetector->nDacs; iarg++) {
getline(infile,str); getline(infile,str);
iline++; iline++;
@ -401,6 +402,7 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
idac++; idac++;
} }
//config---------------
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
@ -409,22 +411,65 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " (config) is " << ival << std::endl; std::cout<< sargname << " is " << ival << std::endl;
#endif #endif
int configval = ival;//myMod->dacs[idac]=ival; int configval = ival;//myMod->dacs[idac]=ival;
//HV---------------
getline(infile,str);
iline++;
#ifdef VERBOSE
std::cout<< str << std::endl;
#endif
ssstr.str(str);
ssstr >> sargname >> ival;
#ifdef VERBOSE
std::cout<< sargname << " is " << ival << std::endl;
#endif
int HVval = ival;//myMod->dacs[idac]=ival;
//mac address----------
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; std::cout<< str << std::endl;
#endif #endif
istringstream sstr(str); istringstream sstr(str);
sstr >> sargname >> ival; sstr >> sargname >> sargname2;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " (HV) is " << ival << std::endl; std::cout<< sargname << " is " << sargname2 << std::endl;
#endif #endif
int HVval = ival;//myMod->dacs[idac]=ival; //getting rid of dots
pos = sargname2.find(".");
while(pos != string::npos)
{
sargname2.erase( pos, 1 );
pos = sargname2.find(".");
}
strcpy(thisDetector->clientMacAddress,sargname2.c_str());
cout<<"macaddress:"<<thisDetector->clientMacAddress<<endl;
//ip address---------------
getline(infile,str);
iline++;
#ifdef VERBOSE
std::cout<< str << std::endl;
#endif
istringstream sssstr(str);
sssstr >> sargname >> sargname2;
#ifdef VERBOSE
std::cout<< sargname << " is " << sargname2 << std::endl;
#endif
//getting rid of dots
pos = sargname2.find(".");
while(pos != string::npos)
{
sargname2.erase( pos, 1 );
pos = sargname2.find(".");
}
strcpy(thisDetector->clientIPAddress,sargname2.c_str());
cout<<"ipaddress:"<<thisDetector->clientIPAddress<<endl;
infile.close(); infile.close();
@ -443,7 +488,7 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
int gotthardDetector::writeSettingsFile(string fname, sls_detector_module mod){ int gotthardDetector::writeSettingsFile(string fname, sls_detector_module mod){
ofstream outfile; ofstream outfile;
string names[]={"Vref", "VcascN","VcascP", "Vout", "Vcasc", "Vin", "Vref_comp", "Vib_test", "config", "HV"}; string names[]={"Vref", "VcascN","VcascP", "Vout", "Vcasc", "Vin", "Vref_comp", "Vib_test", "config", "HV", "macaddress","ipaddress"};
int iv, ichan, ichip; int iv, ichan, ichip;
int iv1, idac; int iv1, idac;
int nb; int nb;

View File

@ -322,6 +322,12 @@ int slsDetector::initializeDetectorSize(detectorType type) {
if (thisDetector->alreadyExisting==0) { if (thisDetector->alreadyExisting==0) {
/** set hostname to default */ /** set hostname to default */
strcpy(thisDetector->hostname,DEFAULT_HOSTNAME); strcpy(thisDetector->hostname,DEFAULT_HOSTNAME);
/** set client ip address */
strcpy(thisDetector->clientIPAddress,"none");
/** set client mac address */
strcpy(thisDetector->clientMacAddress,"none");
/** sets onlineFlag to OFFLINE_FLAG */ /** sets onlineFlag to OFFLINE_FLAG */
thisDetector->onlineFlag=OFFLINE_FLAG; thisDetector->onlineFlag=OFFLINE_FLAG;
/** set ports to defaults */ /** set ports to defaults */
@ -2562,9 +2568,9 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
detectorSettings slsDetector::setSettings( detectorSettings isettings, int imod){ detectorSettings slsDetector::setSettings( detectorSettings isettings, int imod){
//#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "slsDetector setSettings "<< std::endl; std::cout<< "slsDetector setSettings "<< std::endl;
//#endif #endif
sls_detector_module *myMod=createModule(); sls_detector_module *myMod=createModule();
int modmi=imod, modma=imod+1, im=imod; int modmi=imod, modma=imod+1, im=imod;
string settingsfname, calfname; string settingsfname, calfname;
@ -2629,7 +2635,9 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
case GOTTHARD: case GOTTHARD:
ostfn << thisDetector->settingsDir << ssettings <<"/settings.sn";// << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10); ostfn << thisDetector->settingsDir << ssettings <<"/settings.sn";// << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
oscfn << thisDetector->calDir << ssettings << "/calibration.sn";// << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10); oscfn << thisDetector->calDir << ssettings << "/calibration.sn";// << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
#ifdef VERBOSE
std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl; std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl;
#endif
break; break;
default: default:
ostfn << thisDetector->settingsDir << ssettings <<"/noise.sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10); ostfn << thisDetector->settingsDir << ssettings <<"/noise.sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
@ -2638,9 +2646,9 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
//oscfn << thisDetector->calDir << ssettings << "/calibration.sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10); //oscfn << thisDetector->calDir << ssettings << "/calibration.sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
settingsfname=ostfn.str(); settingsfname=ostfn.str();
//#ifdef VERBOSE #ifdef VERBOSE
cout << "the settings name is "<<settingsfname << endl; cout << "the settings name is "<<settingsfname << endl;
//#endif #endif
if (readSettingsFile(settingsfname,myMod)) { if (readSettingsFile(settingsfname,myMod)) {
calfname=oscfn.str(); calfname=oscfn.str();
#ifdef VERBOSE #ifdef VERBOSE

View File

@ -149,6 +149,11 @@ typedef struct sharedSlsDetector {
/** is the hostname (or IP address) of the detector. needs to be set before startin the communication */ /** is the hostname (or IP address) of the detector. needs to be set before startin the communication */
char hostname[MAX_STR_LENGTH]; char hostname[MAX_STR_LENGTH];
/** is the ip address of the client for gotthard to send data to **/
char clientIPAddress[MAX_STR_LENGTH];
/** is the mac address of the client for gotthard to send data to **/
char clientMacAddress[MAX_STR_LENGTH];
/** is the port used for control functions normally it should not be changed*/ /** is the port used for control functions normally it should not be changed*/
int controlPort; int controlPort;
/** is the port used to stop the acquisition normally it should not be changed*/ /** is the port used to stop the acquisition normally it should not be changed*/