diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 9d55103a8..626dafe91 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -21,7 +21,7 @@ public: qDefs(){}; //------------------------------------------------------------------------------------------------------------------------------------------------- -#define GUI_VERSION 0.13 +#define GUI_VERSION 0.14 //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 9f13468ce..3d7e47962 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -222,6 +222,10 @@ static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileI * */ int MeasurementFinished(int currentMeasurementIndex, int fileIndex); +/** This is called by the detector class to send progress if receiver is online */ +static int GetProgressCallBack(double currentProgress, void *this_pointer); + + /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); /** Sets the style of the 1d plot */ diff --git a/slsDetectorGui/slsDetectorGui.pro b/slsDetectorGui/slsDetectorGui.pro index a7cdd16a4..20c459da6 100644 --- a/slsDetectorGui/slsDetectorGui.pro +++ b/slsDetectorGui/slsDetectorGui.pro @@ -37,6 +37,7 @@ INCLUDEPATH += \ forms/include\ ../slsDetectorSoftware/commonFiles\ ../slsDetectorSoftware/MySocketTCP\ + ../slsDetectorSoftware/slsReceiverInterface\ ../slsDetectorSoftware/slsDetector\ ../slsDetectorSoftware/slsDetectorAnalysis\ ../slsDetectorSoftware/multiSlsDetector\ diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index 22bc37466..6b5a57a96 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -193,7 +193,7 @@ double g[]={0.00, 0.81, 1.00, 0.20, 0.00}; double b[] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; QColor c1,c2,c; - c1.setRgbF(r[0],g[0],b[0]); + c1.setRgbF(r[0],g[0],b[0],0); c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]); QwtLinearColorMap* copyMap = new QwtLinearColorMap(Qt::lightGray, c2); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index bd9ce2b7b..0bd923ddb 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -194,7 +194,8 @@ void qDrawPlot::SetupWidgetWindow(){ myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); //Setting the callback function to alert when each measurement finished from detector class myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); - + //Setting the callback function to get progress from detector class(using receivers) + myDet->registerProgressCallback(&(GetProgressCallBack),this); } @@ -511,9 +512,20 @@ void qDrawPlot::SetupMeasurement(int currentIndex){ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ - cout << "before acquire ...." << endl; + bool receiver=(((qDrawPlot*)this_pointer)->myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG); + if(receiver){ + if(((qDrawPlot*)this_pointer)->myDet->startReceiver()==slsDetectorDefs::OK) + usleep(2000000); + else{ + qDefs::Message(qDefs::CRITICAL,"could not start receiver","Plot"); + return this_pointer; + } + } ((qDrawPlot*)this_pointer)->myDet->acquire(1); - cout << "after acquire ...." << endl; + if(receiver){ + usleep(0); + ((qDrawPlot*)this_pointer)->myDet->stopReceiver(); + } return this_pointer; } @@ -813,6 +825,15 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer){ + ((qDrawPlot*)this_pointer)->progress= currentProgress; + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ if(!alreadyDisplayed){ alreadyDisplayed = true; diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index cf295660e..7301f2aeb 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -318,6 +318,11 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); Enable(1); + + if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ + usleep(0); + myDet->stopReceiver(); + } } }