diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index d98208521..1f17bcd2f 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -2844,6 +2844,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti detectorSettings slsDetector::setSettings( detectorSettings isettings, int imod){ + std::cout<<"dfgfdgdgdf"<15)) - return ("IP Address should be VALID and in xxx.xxx.xxx.xxx format"); - else - sprintf(thisDetector->clientIP,clientIP.c_str()); - return thisDetector->clientIP; -}; + if(clientIP.length()==15){ + if((clientIP[3]==':')&&(clientIP[7]==':')&&(clientIP[11]==':')){ + int result = inet_pton(AF_INET, clientIP.c_str(), &(sa.sin_addr)); + if(result!=0){ + sprintf(thisDetector->clientIP,clientIP.c_str()); + wrongFormat=0; + } + } + } + if(!wrongFormat) + return thisDetector->clientIP; + else + return ("IP Address should be VALID and in xxx.xxx.xxx.xxx format"); +} char* slsDetector::setClientMAC(string clientMAC){ @@ -5092,6 +5101,20 @@ char* slsDetector::setClientMAC(string clientMAC){ + +int slsDetector::configureMAC(){ + if(!strcmp(getClientIP(),"none")) + return -1; + else if(!strcmp(getClientMAC(),"none")) + return -1; + + cout<<"\n\ndfgfdgklfdhgldf\n\n\n"; + + return 0; +} + + + string slsDetector::executeLine(int narg, char *args[], int action) { @@ -6349,10 +6372,11 @@ string slsDetector::executeLine(int narg, char *args[], int action) { sprintf(answer,"%d", setSpeed(TOT_DUTY_CYCLE)); return string(answer); //gotthard - }/*else if (var=="configuremac") { - configureMAC(); + }else if (var=="configuremac") { + if(configureMAC()==-1) + return string("client ip address/client mac address not valid"); return string("mac configuration completed"); - }*/ + } return ("Unknown command"); } @@ -7743,6 +7767,7 @@ int slsDetector::getPositions(float *pos){ + int slsDetector::readConfigurationFile(string const fname){ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 9e445ce49..4aeee57aa 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -360,6 +360,11 @@ typedef struct sharedSlsDetector { */ static int exists(int i); + /** + configures mac for gotthard readout + */ + int configureMAC(); + /** Purely virtual function Should be implemented in the specific detector class @@ -374,11 +379,6 @@ typedef struct sharedSlsDetector { */ virtual int writeConfigurationFile(string const fname); - /** - configures mac for gotthard readout - */ - int configureMAC(); - /* It should be possible to dump all the settings of the detector (including trimbits, threshold energy, gating/triggering, acquisition time etc. in a file and retrieve it for repeating the measurement with identicals ettings, if necessary