1 #include <TApplication.h>
5 #include <TObjString.h>
8 #include <TRootEmbeddedCanvas.h>
17 using namespace Diana;
25 fEcanvas =
new TRootEmbeddedCanvas (
"Ecanvas",
this,w,h);
26 AddFrame(
fEcanvas,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
27 TGHorizontalFrame *hframe=
new TGHorizontalFrame(
this, 200,40);
28 TGTextButton *exit =
new TGTextButton(hframe,
"&Exit");
29 exit->Connect(
"Clicked()",
"QGDMainFrame",
this,
"Exit()");
30 hframe->AddFrame(exit,
new TGLayoutHints(kLHintsCenterX,5,5,3,4));
31 AddFrame(hframe,
new TGLayoutHints(kLHintsCenterX,2,2,2,2));
33 SetWindowName(
"DianaGUI (driver)");
49 gApplication->Terminate(0);
54 std::string sstatus =
"";
57 sstatus =
"Status: STOP";
60 sstatus =
"Status: WAITCLIENT";
63 sstatus =
"Status: CONNECTED";
67 sstatus =
"Status: UNKNOWN";
76 std::vector<QGDCommand::Id>::const_iterator avCom = cmdList.
fCommands.begin();
78 cout<<
"Avalaible commands:"<<endl;
91 cout<<
" EventNumber > ";
92 std::string evnum; cin>>evnum;
96 cout<<
" Module index > ";
97 std::string modInd; cin>>modInd;
101 cout<<
" Module index > ";
102 std::string modInd; cin>>modInd;
105 cout<<
" Parameter name > ";
106 std::string parName; cin>>parName;
107 cout<<
" Parameter value > ";
108 std::string parValue; cin>>parValue;
112 cout<<
" Data type (QGlobal, QEvent, QRunData) > ";
113 std::string parValue; cin>>parValue;
121 cout<<
" List of enabled modules:"<<endl;
122 for(
size_t i = 0; i < modList.
fModules.size(); i++) {
123 cout<<
" ["<<i<<
"] "<<modList.
fModules[i]<<endl;
129 cout<<
" List of parameters of current module:"<<endl;
130 for(
size_t i = 0; i < paramList.
fParameters.size(); i++) {
134 <<
" ("<<char(paramList.
fParameters[i].fType)<<
")"<<endl;
139 if(
dynamic_cast<TMap*
>(obj) && strcmp(obj->GetName(),
"QEvent") == 0 )
141 TMap* qev = (TMap*)obj;
144 while((key = it.Next())) {
145 QObject* qobj =
dynamic_cast<QObject*
>(qev->GetValue(key));
146 TObjString* lab =
dynamic_cast<TObjString*
>(key);
147 cout<<
" Info : Arrived "<<lab->GetString()<<endl;;
149 QVector samples = pulse->GetSamples();
151 TCanvas *fCanvas =
fEcanvas->GetCanvas();
154 cout<<
" Info : Pulse displayed"<<std::endl;
158 cout<<
" Info : Dump() :"<<str.str()<<endl;
161 }
else if(
dynamic_cast<TMap*
>(obj) && strcmp(obj->GetName(),
"QGlobal") == 0 ) {
162 TMap* qev = (TMap*)obj;
165 while((key = it.Next())) {
166 QObject* qobj =
dynamic_cast<QObject*
>(qev->GetValue(key));
167 TObjString* lab =
dynamic_cast<TObjString*
>(key);
168 cout<<
" Info : Arrived "<<lab->GetString()<<endl;;
170 QVector samples = pulse->GetSamples();
172 TCanvas *fCanvas =
fEcanvas->GetCanvas();
175 cout<<
" Info : Pulse displayed"<<std::endl;
179 cout<<
" Info : Dump() :"<<str.str()<<endl;
183 cout<<
" Info : Arrived QRunData"<<endl;
184 cout<<
" Run : "<<runData->fNumber<<endl;
185 }
else if(QObject* qobj =
dynamic_cast<QObject*
>(obj)){
188 cout<<
" Info : Arrived QObject"<<endl;
189 cout<<
" Dump : "<<strstr.str()<<endl;
191 cout<<
"Error : something not recognized arrived"<<endl;
std::vector< QGDCommand::Id > fCommands
Main window of the interactive gui.
TRootEmbeddedCanvas * fEcanvas
void DisplayModuleList(const QGDModuleList &modList)
void NotifyReceiverStatus(QGDReceiver::Status status)
QGDMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
virtual QGDCommand GetCommand(const QGDCommandList &cmdList)
void DisplayModuleParameters(const QGDModuleParameterList ¶mList)
void Start(Int_t port=1130)
std::vector< std::string > fModules
std::vector< QGDParameter > fParameters
Raw event: sampled waveform.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...
std::string IdToString(QGDCommand::Id id)
std::string Resize(const std::string &s, size_t len)
resize a string to len, adding spaces if necessary