MNE-CPP  beta 1.0
babymegsquidcontroldgl.cpp
Go to the documentation of this file.
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 #include <QPen>
41 #include <QGLWidget>
42 //#include "glwidget_OnDisp.h"
43 
44 #include <QDebug>
45 
46 
47 #include <iostream>
48 
49 #include "../babymeg.h"
50 #include "babymegsquidcontroldgl.h"
51 #include "ui_babymegsquidcontroldgl.h"
52 
53 //*************************************************************************************************************
54 //=============================================================================================================
55 // USED NAMESPACES
56 //=============================================================================================================
57 
58 using namespace BabyMEGPlugin;
59 
60 //*************************************************************************************************************
61 //=============================================================================================================
62 // DEFINE MEMBER METHODS
63 //=============================================================================================================
64 
65 BabyMEGSQUIDControlDgl::BabyMEGSQUIDControlDgl(BabyMEG* p_pBabyMEG,QWidget *parent) :
66  QDialog(parent)
67  , ui(new Ui::BabyMEGSQUIDControlDgl)
68  , m_pBabyMEG(p_pBabyMEG)
69 
70 {
71  connect(this,&BabyMEGSQUIDControlDgl::SendCMDToMEGSource,p_pBabyMEG,&BabyMEG::comFLL);
72  connect(m_pBabyMEG,&BabyMEG::DataToSquidCtrlGUI,this,&BabyMEGSQUIDControlDgl::TuneGraphDispProc);
73  connect(m_pBabyMEG,&BabyMEG::SendCMDDataToSQUIDControl,this,&BabyMEGSQUIDControlDgl::RcvCMDData);
74 
75  ui->setupUi(this);
76 
77  // button connects
78  connect(ui->m_Qbn_Cancel, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Cancel);
79  connect(ui->m_Qbn_SyncGUI,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::SyncGUI);
80 
81  connect(ui->m_Qbn_retune, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Retune);
82  connect(ui->m_Qbn_heat, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Heat);
83  connect(ui->m_Qbn_atune, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Atune);
84  connect(ui->m_Qbn_reset, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Reset);
85  connect(ui->m_Qbn_heatTune, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::HeatTune);
86  connect(ui->m_Qbn_save, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Save);
87  connect(ui->m_Qbn_save1, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Save1);
88  connect(ui->m_Qbn_groupheat, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::GroupHeat);
89  connect(ui->m_Qbn_last, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Last);
90  connect(ui->m_Qbn_default,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::Default);
91 
92  connect(ui->m_Qbn_tunecheck,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::TuneCheck);
93  connect(ui->m_Qbn_amp, &QPushButton::released, this, &BabyMEGSQUIDControlDgl::Amp);
94  connect(ui->m_Qbn_int_reset,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::IntReset);
95  connect(ui->m_Qbn_mirco_reset,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::MicroReset);
96 
97 
98  // combobox connects
99  connect(ui->m_Qcb_commtype,SIGNAL(activated(int)), this,SLOT(CommType(int)));
100  connect(ui->m_Qcb_channel,SIGNAL(activated(int)), this,SLOT(ChanSele(int)));
101  connect(ui->m_Qcb_opermode,SIGNAL(activated(int)), this,SLOT(OperMode(int)));
102  connect(ui->m_Qcb_hp,SIGNAL(activated(int)), this,SLOT(HighPass(int)));
103  connect(ui->m_Qcb_lp,SIGNAL(activated(int)), this,SLOT(LowPass1(int)));
104  connect(ui->m_Qcb_slew,SIGNAL(activated(int)), this,SLOT(SlewSele(int)));
105  connect(ui->m_Qcb_pregain,SIGNAL(activated(int)), this,SLOT(PreGaini(int)));
106  connect(ui->m_Qcb_postgain,SIGNAL(activated(int)), this,SLOT(PostGain(int)));
107  connect(ui->m_Qcb_auto_reset,SIGNAL(activated(int)), this,SLOT(AutoRest(int)));
108  connect(ui->m_Qcb_reset_lock,SIGNAL(activated(int)), this,SLOT(RestLock(int)));
109 
110  connect(ui->m_Qcb_bar_graph_select,SIGNAL(activated(int)), this,SLOT(BarGraph(int)));
111 
112  // spinbox-button connects
113  connect(ui->m_Qbn_heattime,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::HeatTime);
114  connect(ui->m_Qbn_cooltime,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::CoolTime);
115  connect(ui->m_Qbn_offset,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::AdOffset);
116  connect(ui->m_Qbn_bias,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::AdjuBias);
117  connect(ui->m_Qbn_mod,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::AdjuModu);
118 
119 
120  //connect(ui->m_Qbn_Init,&QPushButton::released, this, &BabyMEGSQUIDControlDgl::Init);
121 
122  setModal(false);
123 
124  // init the table for dispalying SQUID parameters
125  TableRows = 80;
126  TableCols = 10;
127  ui->tbw_parameters->setRowCount(TableRows);
128  ui->tbw_parameters->setColumnCount(TableCols);
129  for (int i=0; i<TableCols; i++)
130  ui->tbw_parameters->setColumnWidth(i,70);
131  //
132  ui->tbw_parameters->setHorizontalHeaderLabels(QString("Channel;Value;Channel;Value;Channel;Value;Channel;Value;Channel;Value;Channel;Value").split(";"));
133 
134  for (int i=0; i<TableRows;i++)
135  for(int j=0;j<TableCols;j++)
136  ui->tbw_parameters->setItem(i,j,new QTableWidgetItem(" "));
137 
138  ui->tbw_parameters->setCurrentCell(0,0);
139  // End of init parameter table
140 
141  // init the plot
142  initplotflag = false;
143 
144  d_timeplot = new plotter();
145  ui->lay_tune->addWidget(d_timeplot);
146 
147  //this->Init();
148 }
149 
150 BabyMEGSQUIDControlDgl::~BabyMEGSQUIDControlDgl()
151 {
152  delete d_timeplot;
153  delete ui;
154 }
155 
156 void BabyMEGSQUIDControlDgl::closeEvent(QCloseEvent *event)
157 {
158  Q_UNUSED(event)
159  SendCMD("CANC");
160 }
161 void BabyMEGSQUIDControlDgl::UpdateParaGraph()
162 {
163  int NumRect = m_GUISM.ParaGraph.size();
164 
165  for (int i=0; i< NumRect ; i++)
166  {
167  int ro = floor(i/(TableCols/2));
168  int co = i - ro*(TableCols/2);
169  ui->tbw_parameters->item(ro,1+2*co)->setText(tr("%1").arg(m_GUISM.ParaGraph.at(i)));
170  ui->tbw_parameters->item(ro,0+2*co)->setText(chanNames.at(i));
171  }
172 
173 }
174 
175 float BabyMEGSQUIDControlDgl::mmin(MatrixXf tmp,int chan)
176 {
177  int cols = tmp.cols();
178 
179  float ret = tmp(chan,0);
180  for (int i=0; i<cols; i++)
181  {
182  if (tmp(chan,i) < ret)
183  ret = tmp(chan,i);
184  }
185 
186  return ret;
187 }
188 
189 float BabyMEGSQUIDControlDgl::mmax(MatrixXf tmp,int chan)
190 {
191  int cols = tmp.cols();
192 
193  float ret = tmp(chan,0);
194  for (int i=0; i<cols; i++)
195  {
196  if (tmp(chan,i) > ret)
197  ret = tmp(chan,i);
198  }
199 
200  return ret;
201 }
202 void BabyMEGSQUIDControlDgl::TuneGraphDispProc(MatrixXf tmp)
203 {
204 // std::cout << "first ten elements \n" << tmp.block(0,0,1,10) << std::endl;
205 
206  int cols = tmp.cols();
207  int chanIndx = ui->m_Qcb_channel->currentIndex();//1;//
208  // plot the real time data here
209  settings.minX = 0.0;
210  settings.maxX = cols;
211  settings.minY = mmin(tmp,chanIndx);
212  settings.maxY = mmax(tmp,chanIndx);
213  settings.xlabel = QString("%1 samples/second").arg(m_pBabyMEG->sfreq) ;
214  settings.ylabel = QString("Amplitude [rel. unit]");
215 
216  d_timeplot->setPlotSettings(settings);
217 // qDebug()<<"minY"<<settings.minY<<"maxY"<<settings.maxY;
218 
219  QVector <QPointF> F;
220 
221  for(int i=0; i<cols;i++)
222  F.append(QPointF(i,tmp(chanIndx,i)));
223 
224  d_timeplot->setCurveData(0,F);
225  d_timeplot->show();
226 
227 }
228 
229 
230 void BabyMEGSQUIDControlDgl::TuneCheck()
231 {
232  int index;
233  index = 0;
234  ProcCmd("BUTNTUNECHEC",index,"TuneCheck is processing !");
235 }
236 void BabyMEGSQUIDControlDgl::Amp()
237 {
238  int index;
239  index = 0;
240  ProcCmd("BUTNDOOOOAMP",index,"Requiring Amp is processing !");
241 }
242 void BabyMEGSQUIDControlDgl::IntReset()
243 {
244  int index;
245  index = 0;
246  ProcCmd("BUTNINTRESET",index,"IntReset is processing !");
247 }
248 void BabyMEGSQUIDControlDgl::MicroReset()
249 {
250  int index;
251  index = 0;
252  ProcCmd("BUTNMICRESET",index,"MicroReset is processing !");
253 }
254 
255 void BabyMEGSQUIDControlDgl::Save()
256 {
257  int index;
258  index = 0;
259  ProcCmd("BUTNDOOOSAVE",index,"Save is processing !");
260 }
261 
262 void BabyMEGSQUIDControlDgl::Save1()
263 {
264  int index;
265  index = 0;
266  ProcCmd("BUTNDOOSAVE1",index,"Save1 is processing !");
267 }
268 
269 void BabyMEGSQUIDControlDgl::GroupHeat()
270 {
271  int index;
272  index = 0;
273  ProcCmd("BUTNGROUPHEA",index,"GroupHeat is processing !");
274 }
275 
276 void BabyMEGSQUIDControlDgl::Last()
277 {
278  int index;
279  index = 0;
280  ProcCmd("BUTNDOOOLAST",index,"Last is processing !");
281 }
282 
283 void BabyMEGSQUIDControlDgl::Default()
284 {
285  int index;
286  index = 0;
287  ProcCmd("BUTNDDEFAULT",index,"Default is processing !");
288 }
289 
290 
291 void BabyMEGSQUIDControlDgl::Retune()
292 {
293  int index;
294  index = 0;
295  ProcCmd("BUTNDORETUNE",index,"Retune is processing !");
296 }
297 
298 void BabyMEGSQUIDControlDgl::Heat()
299 {
300  int index;
301  index = 0;
302  ProcCmd("BUTNDOOOHEAT",index,"Heat is processing !");
303 }
304 void BabyMEGSQUIDControlDgl::Atune()
305 {
306  int index;
307  index = 0;
308  ProcCmd("BUTNDOOATUNE",index,"Atune is processing !");
309 }
310 void BabyMEGSQUIDControlDgl::Reset()
311 {
312  int index;
313  index = 0;
314  ProcCmd("BUTNDOIRESET",index,"Reset is processing !");
315 }
316 void BabyMEGSQUIDControlDgl::HeatTune()
317 {
318  int index;
319  index = 0;
320  ProcCmd("BUTNHEATTUNE",index,"HeatTune is processing !");
321 }
322 
323 
324 void BabyMEGSQUIDControlDgl::AdOffset()
325 {
326  int index;
327  index = ui->m_Qsb_offset->value();
328  ProcCmd("UPDEADOFFSET",index,"Offset is changed !");
329 
330 }
331 
332 void BabyMEGSQUIDControlDgl::AdjuBias()
333 {
334  int index;
335  index = ui->m_Qsb_bias->value();
336  ProcCmd("UPDEADJUBIAS",index,"Bias is changed !");
337 
338 }
339 
340 void BabyMEGSQUIDControlDgl::AdjuModu()
341 {
342  int index;
343  index = ui->m_Qsb_mod->value();
344  ProcCmd("UPDEADJUMODU",index,"Modulation is changed !");
345 
346 }
347 
348 void BabyMEGSQUIDControlDgl::HeatTime()
349 {
350  int index;
351  index = ui->m_Qsb_heattime->value();
352  ProcCmd("UPDEHEATTIME",index,"Heat Time is changed !");
353 }
354 
355 void BabyMEGSQUIDControlDgl::CoolTime()
356 {
357  int index;
358  index = ui->m_Qsb_cooltime->value();
359  ProcCmd("UPDECOOLTIME",index,"Cool Time is changed !");
360 }
361 
362 void BabyMEGSQUIDControlDgl::AutoRest(int index)
363 {
364  ProcCmd("UPDEAUTOREST",index,"Auto Reset is changed !");
365 }
366 void BabyMEGSQUIDControlDgl::RestLock(int index)
367 {
368  ProcCmd("UPDERESTLOCK",index,"Reset Lock is changed !");
369 }
370 
371 void BabyMEGSQUIDControlDgl::PreGaini(int index)
372 {
373  ProcCmd("UPDEPREGAINI",++index,"Pre Gain is changed !");
374 }
375 
376 void BabyMEGSQUIDControlDgl::PostGain(int index)
377 {
378  ProcCmd("UPDEPOSTGAIN",++index,"Post Gain is changed !");
379 }
380 
381 
382 void BabyMEGSQUIDControlDgl::SlewSele(int index)
383 {
384  ProcCmd("UPDESLEWSELE",++index,"Slew Selection is changed !");
385 }
386 
387 
388 void BabyMEGSQUIDControlDgl::LowPass1(int index)
389 {
390  ProcCmd("UPDELOWPASS1",index,"low pass filter is changed !");
391 }
392 
393 
394 void BabyMEGSQUIDControlDgl::HighPass(int index)
395 {
396  ProcCmd("UPDEHIGHPASS",index,"high pass filter is changed !");
397 }
398 
399 
400 void BabyMEGSQUIDControlDgl::OperMode(int index)
401 {
402  ProcCmd("UPDEOPERMODE",index,"Operate Mode is changed !");
403 }
404 
405 void BabyMEGSQUIDControlDgl::ChanSele(int index)
406 {
407  ProcCmd("UPDECHANSELE",index,"Channel is changed !");
408 }
409 
410 void BabyMEGSQUIDControlDgl::BarGraph(int index)
411 {
412  ProcCmd("UPDEBARGRAPH",index,"Bar graph select is changed !");
413 }
414 
415 void BabyMEGSQUIDControlDgl::CommType(int index)
416 {
417  QString A;
418  if (index==0) A = tr("255");
419  else if(index == 9) {A=tr("11");}
420  else if(index > 0 && index < 9){A = tr("%1").arg(index+130);}
421 
422  QString CMDStr = "UPDECOMMTYPE|"+A+"|";
423  QString newline = QString("Communication Type is changed!|"+CMDStr+"index"+tr("%1").arg(index));
424  UpdateInfo(newline);
425  SendCMD(CMDStr);
426 }
427 
428 void BabyMEGSQUIDControlDgl::UpdateInfo(QString newText)
429 {
430  QString content = ui->m_tx_info->toPlainText();
431  content = content + "\n" + newText;
432  ui->m_tx_info->setText(content);
433  ui->m_tx_info->verticalScrollBar()->setValue(ui->m_tx_info->verticalScrollBar()->maximum());
434 }
435 
436 void BabyMEGSQUIDControlDgl::Init()
437 {
438  // Send the init command to labview to call SQUID VI.
439  //SendCMD("INIC");
440  qDebug()<<"Send init command\n";
441  SendCMD("INIT");
442 }
443 
444 void BabyMEGSQUIDControlDgl::Cancel()
445 {
446  SendCMD("CANC");
447  this->close();
448 }
449 
450 void BabyMEGSQUIDControlDgl::SyncGUI()
451 {
452  SendCMD("SYNC");
453 }
454 
455 void BabyMEGSQUIDControlDgl::SendCMD(QString CMDSTR)
456 {
457  emit SendCMDToMEGSource(CMDSTR);
458 }
459 
460 void BabyMEGSQUIDControlDgl::RcvCMDData(QByteArray DATA)
461 {
462  QString t_sReply(DATA);
463 
464  QString newline = QString("Reply:")+t_sReply;
465  UpdateInfo(newline);
466 
467  ReplyCmdProc(t_sReply);
468 }
469 
470 void BabyMEGSQUIDControlDgl::ReplyCmdProc(QString sReply)
471 {
472 
473  QString cmd = sReply.left(4);
474  sReply.remove(0,4);
475  int fcmd = 0;
476  QList < QString > tmp;
477 
478  if (cmd == "INIT") fcmd = 1;
479  else if(cmd=="INIC") fcmd = 2;
480  else if(cmd=="SYNC") fcmd = 3;
481  else if(cmd=="UPDE") fcmd = 4;
482  else if(cmd=="BUTN") fcmd = 5;
483 
484  //qDebug() << "Reply Command String ------------------ \n" << sReply ;
485  //qDebug() << "Reply Command ------------------ \n" << cmd ;
486 
487  switch (fcmd)
488  {
489  case 1:
490  // if the reply is coming from INIT command, then initialize the FLL config.
491  tmp = sReply.split("#");
492 
493  //qDebug()<<"reply string:\n"<<tmp[0];
494  //get the channels
495  //load channel information from files
496  //tmp[1] = GenChnInfo(tmp[1]);
497 
498  InitChannels(tmp[2]);
499 
500  //init GUI controls
501  InitGUIConfig(tmp[0]);
502  UpdateGUI();
503  break;
504  case 2:
505  // get the channels
506  InitChannels(sReply);
507  break;
508  case 3:
509  InitGUIConfig(sReply);
510  UpdateGUI();
511  break;
512  case 4://UPDE
513  InitGUIConfig(sReply);
514  UpdateGUI();
515  break;
516  case 5://BUTN - button press
517 
518  break;
519  default:
520  break;
521  }
522 }
523 QString BabyMEGSQUIDControlDgl::GenChnInfo(QString nChan)
524 {
525  QString chaninfo;
526  for (int i=0;i<nChan.toInt();i++){
527  chaninfo += "MEG_"+tr("%1").arg(i+1)+"|";
528  }
529  return chaninfo;
530 }
531 
532 void BabyMEGSQUIDControlDgl::InitChannels(QString sReply)
533 {
534 // QList < QString > tmp = sReply.split("|");
535 // ui->m_Qcb_channel->addItems(tmp);
536 
537 // chanNames = sReply.split("|");
538 // ui->m_Qcb_channel->addItems(chanNames);
539 
540  // select the MEG channels we need
541  QList <QString> t_chanNames = sReply.split("|");
542 
543  chanNames.clear();
544 
545  for (int i=0;i<t_chanNames.size();i++)
546  {
547  QString T = t_chanNames.at(i);
548  if (T.left(3)=="MEG")
549  chanNames.push_back(T);
550  }
551 
552 
553  ui->m_Qcb_channel->addItems(chanNames);
554 
555 }
556 
557 void BabyMEGSQUIDControlDgl::UpdateGUI()
558 {
559  // according to m_GUISM to set the items status in the GUI
560  //set CommType 255-group, 11-single channel
561  int curindex = 0;
562 
563  switch (m_GUISM.CommType){
564  case 255:
565  curindex = 0;
566  break;
567  case 11:
568  curindex = 9;
569  break;
570  default:
571  curindex = m_GUISM.CommType - 130;
572  break;
573  }
574 
575  ui->m_Qcb_commtype->setCurrentIndex( curindex );
576 
577  //set Channel
578  ui->m_Qcb_channel->setCurrentIndex( m_GUISM.ChannelSel );
579 
580  QString newline = QString("Debug: ChannelStat = ")+tr("%1").arg(m_GUISM.ChannelStat);
581  UpdateInfo(newline);
582 
583  if (m_GUISM.ChannelStat == 0)
584  ui->m_Qcb_channel->setEnabled(true);
585  else
586  ui->m_Qcb_channel->setDisabled(true);
587 
588  //set operate mode
589  ui->m_Qcb_opermode->setCurrentIndex( m_GUISM.OperMode );
590 
591  //set Retune
592  if(m_GUISM.Retune == 0)
593  ui->m_Qbn_retune->setEnabled(true);
594  else
595  ui->m_Qbn_retune->setDisabled(true);
596  //set Heat this
597  if(m_GUISM.HeatThis == 0)
598  ui->m_Qbn_heat->setEnabled(true);
599  else
600  ui->m_Qbn_heat->setDisabled(true);
601 
602  //Atune
603  if(m_GUISM.Atune == 0)
604  ui->m_Qbn_atune->setEnabled(true);
605  else
606  ui->m_Qbn_atune->setDisabled(true);
607 
608  //reset
609  if(m_GUISM.Reset == 0)
610  ui->m_Qbn_reset->setEnabled(true);
611  else
612  ui->m_Qbn_reset->setDisabled(true);
613  //Heat&Tune
614  if(m_GUISM.HeatAndTune == 0)
615  ui->m_Qbn_heatTune->setEnabled(true);
616  else
617  ui->m_Qbn_heatTune->setDisabled(true);
618 
619  //save
620  if(m_GUISM.Save == 0)
621  ui->m_Qbn_save->setEnabled(true);
622  else
623  ui->m_Qbn_save->setDisabled(true);
624 
625  //_save --- %$save
626  if(m_GUISM._Save == 0)
627  ui->m_Qbn_save1->setEnabled(true);
628  else
629  ui->m_Qbn_save1->setDisabled(true);
630 
631  //Group Heat
632  if(m_GUISM.GroupHeat == 0)
633  ui->m_Qbn_groupheat->setEnabled(true);
634  else
635  ui->m_Qbn_groupheat->setDisabled(true);
636 
637  //Last
638  if(m_GUISM.Last == 0)
639  ui->m_Qbn_last->setEnabled(true);
640  else
641  ui->m_Qbn_last->setDisabled(true);
642 
643  //Default
644  if(m_GUISM.Default == 0)
645  ui->m_Qbn_default->setEnabled(true);
646  else
647  ui->m_Qbn_default->setDisabled(true);
648 
649  // high pass
650  ui->m_Qcb_hp->setCurrentIndex( m_GUISM.HighPass );
651  // low pass
652  ui->m_Qcb_lp->setCurrentIndex( m_GUISM.LowPass );
653  //pregain
654  ui->m_Qcb_pregain->setCurrentIndex( m_GUISM.PreGain-1 );
655  //postgain
656  ui->m_Qcb_postgain->setCurrentIndex( m_GUISM.PostGain-1 );
657  //slew
658  ui->m_Qcb_slew->setCurrentIndex( m_GUISM.Slew-1);
659 
660  //heattime
661  ui->m_Qsb_heattime->setValue(m_GUISM.HeatTime);
662  //cooltime
663  ui->m_Qsb_cooltime->setValue(m_GUISM.CoolTime);
664  //offset
665  ui->m_Qsb_offset->setValue(m_GUISM.offset);
666  //bias
667  ui->m_Qsb_bias->setValue(m_GUISM.bias);
668  //modulation
669  ui->m_Qsb_mod->setValue(m_GUISM.modulation);
670  //autoreset
671  ui->m_Qcb_auto_reset->setCurrentIndex(m_GUISM.AutoRest);
672  //resetlock
673  ui->m_Qcb_reset_lock->setCurrentIndex(m_GUISM.ResetLock);
674 
675  //tunecheck
676  if(m_GUISM.TuneCheck == 0)
677  ui->m_Qbn_tunecheck->setEnabled(true);
678  else
679  ui->m_Qbn_tunecheck->setDisabled(true);
680  //amp
681  if(m_GUISM.Amp == 0)
682  ui->m_Qbn_amp->setEnabled(true);
683  else
684  ui->m_Qbn_amp->setDisabled(true);
685 // //integrator Reset
686 // if(m_GUISM.IntegratorReset == 0)
687 // ui->m_Qbn_int_reset->setEnabled(true);
688 // else
689 // ui->m_Qbn_int_reset->setDisabled(true);
690 // //MicroReset
691 // if(m_GUISM.MicroReset == 0)
692 // ui->m_Qbn_mirco_reset->setEnabled(true);
693 // else
694 // ui->m_Qbn_mirco_reset->setDisabled(true);
695 
696  //set Bar Graph
697  //slew
698  ui->m_Qcb_bar_graph_select->setCurrentIndex( m_GUISM.BarGraphSelect);
699 
700  //Update Bar Graph -- m_GUISM.ParaGraph
701  //std::cout << "Start Update Para Graph ------------------ \n" <<std::endl;
702  UpdateParaGraph();
703  //std::cout << "End Update Para Graph ------------------ \n" <<std::endl;
704 
705 }
706 void BabyMEGSQUIDControlDgl::InitGUIConfig(QString sReply)
707 {
708  QList < QString > tmp = sReply.split("|");
709 
710  int ind = 0;
711  // Set the current status of GUI Status Machine
712  m_GUISM.CommType = tmp[ind].toInt();
713  m_GUISM.ChannelSel = tmp[ind+1].toInt();
714  m_GUISM.ChannelStat = tmp[ind+2].toInt();
715  m_GUISM.OperMode = tmp[ind+3].toInt();
716 
717  m_GUISM.Retune = tmp[ind+4].toInt();
718  m_GUISM.HeatThis = tmp[ind+5].toInt();
719  m_GUISM.Atune = tmp[ind+6].toInt();
720  m_GUISM.Reset = tmp[ind+7].toInt();
721  m_GUISM.HeatAndTune = tmp[ind+8].toInt();
722  m_GUISM.GroupHeat = tmp[ind+9].toInt();
723  m_GUISM.Last = tmp[ind+10].toInt();
724  m_GUISM.Default = tmp[ind+11].toInt();
725  m_GUISM.Save = tmp[ind+12].toInt();
726  m_GUISM._Save = tmp[ind+13].toInt();
727 
728 
729  m_GUISM.HighPass = tmp[ind+14].toInt();
730  m_GUISM.LowPass = tmp[ind+15].toInt();
731  m_GUISM.Slew = tmp[ind+16].toInt();
732  m_GUISM.PreGain = tmp[ind+17].toInt();
733  m_GUISM.PostGain= tmp[ind+18].toInt();
734  m_GUISM.AutoRest= tmp[ind+19].toInt();
735  m_GUISM.ResetLock=tmp[ind+20].toInt();
736 
737  m_GUISM.offset = tmp[ind+21].toFloat();
738  m_GUISM.bias = tmp[ind+22].toFloat();
739  m_GUISM.modulation = tmp[ind+23].toFloat();
740  m_GUISM.HeatTime = tmp[ind+24].toFloat();
741  m_GUISM.CoolTime = tmp[ind+25].toFloat();
742 
743  m_GUISM.TuneCheck = tmp[ind+26].toInt();
744  m_GUISM.Amp = tmp[ind+27].toInt();
745  m_GUISM.IntegratorReset = tmp[ind+28].toInt();
746  m_GUISM.MicroReset = tmp[ind+29].toInt();
747 
748  // get the status of Bar graph select
749  m_GUISM.BarGraphSelect = tmp[ind+30].toInt();
750  //get the graph wave data
751  int count = tmp[ind+31].toInt();
752  //set ParaGraph
753  if (m_GUISM.ParaGraph.size()>0) m_GUISM.ParaGraph.clear();
754  for (int i=0;i<count;i++)
755  m_GUISM.ParaGraph.append(tmp[ind+32+i].toFloat());
756 
757 }
758 
759 void BabyMEGSQUIDControlDgl::ProcCmd(QString cmd, int index, QString Info)
760 {
761  QString A = tr("%1").arg(index);
762  QString CMDStr = cmd+"|"+A+"|";
763  QString newline = Info+"|"+CMDStr+"index"+A;
764  UpdateInfo(newline);
765  SendCMD(CMDStr);
766 }
Definition: aboutwindow.h:52
The BabyMEG class provides a Fiff data simulator.
Definition: babymeg.h:101
void DataToSquidCtrlGUI(MatrixXf tmp)
void SendCMDDataToSQUIDControl(QByteArray DATA)
Contains the declaration of the BabyMEGSQUIDControlDGL class.
The BabyMEGSQUIDControlDgl class provides the SQUID control dialog.