FACT++  1.0
void FactGui::handleStateChanged ( const Time time,
const string &  server,
const State s 
)
inlineprivate

Definition at line 2513 of file FactGui.h.

References State::comment, State::index, Feedback::State::kCalibrated, Feedback::State::kCalibrating, FTM::State::kConfigError1, MCP::State::kConfigured, FTM::State::kConfigured1, FTM::State::kConfigured2, FTM::State::kConfiguring1, FTM::State::kConfiguring2, Agilent::State::kConnected, FSC::State::kConnected, Drive::State::kConnected, MagicWeather::State::kConnected, MCP::State::kConnected, RateControl::State::kConnected, RateScan::State::kConnected, Feedback::State::kConnected, FTM::State::kConnected, MCP::State::kConnecting, Feedback::State::kConnecting, RateControl::State::kConnecting, BIAS::State::kConnecting, Agilent::State::kDisconnected, FSC::State::kDisconnected, Drive::State::kDisconnected, RateControl::State::kDisconnected, MCP::State::kDisconnected, Feedback::State::kDisconnected, BIAS::State::kDisconnected, FTM::State::kDisconnected, BIAS::State::kExpertMode, RateControl::State::kGlobalThresholdSet, MCP::State::kIdle, FTM::State::kIdle, Drive::State::kInitialized, BIAS::State::kInitializing, RateControl::State::kInProgress, Feedback::State::kInProgress, BIAS::State::kLocked, Drive::State::kMoving, BIAS::State::kNotReferenced, Drive::State::kOnTrack, BIAS::State::kOverCurrent, Drive::State::kParking, BIAS::State::kRamping, MagicWeather::State::kReceiving, RateControl::State::kSettingGlobalThreshold, Drive::State::kTracking, FTM::State::kTriggerOn, FTM::State::kValid, BIAS::State::kVoltageOff, BIAS::State::kVoltageOn, Feedback::State::kWaitingForData, and State::name.

Referenced by IndicateStateChange().

2515  {
2516  // FIXME: Prefix tooltip with time
2517  if (server=="MCP")
2518  {
2519  // FIXME: Enable FTU page!!!
2520  fStatusMCPLabel->setText(s.name.c_str());
2521  fStatusMCPLabel->setToolTip(s.comment.c_str());
2522 
2523  if (s.index<MCP::State::kDisconnected) // No Dim connection
2524  SetLedColor(fStatusMCPLed, kLedGray, time);
2525  if (s.index==MCP::State::kDisconnected) // Disconnected
2526  SetLedColor(fStatusMCPLed, kLedRed, time);
2527  if (s.index==MCP::State::kConnecting) // Connecting
2528  SetLedColor(fStatusMCPLed, kLedOrange, time);
2529  if (s.index==MCP::State::kConnected) // Connected
2530  SetLedColor(fStatusMCPLed, kLedYellow, time);
2531  if (s.index==MCP::State::kIdle || s.index>=MCP::State::kConfigured) // Idle, TriggerOn, TakingData
2532  SetLedColor(fStatusMCPLed, kLedGreen, time);
2533 
2535  SetLedColor(fStatusMCPLed, kLedGreenBar, time);
2536 
2537  fMcpStartRun->setEnabled(s.index>=MCP::State::kIdle);
2538  fMcpStopRun->setEnabled(s.index>=MCP::State::kIdle);
2539  fMcpReset->setEnabled(s.index>=MCP::State::kIdle && MCP::State::kConfigured);
2540  }
2541 
2542  if (server=="FTM_CONTROL")
2543  {
2544  // FIXME: Enable FTU page!!!
2545  fStatusFTMLabel->setText(s.name.c_str());
2546  fStatusFTMLabel->setToolTip(s.comment.c_str());
2547 
2548  bool enable = false;
2549  const bool configuring =
2554 
2555  if (s.index<FTM::State::kDisconnected) // No Dim connection
2556  SetLedColor(fStatusFTMLed, kLedGray, time);
2557  if (s.index==FTM::State::kDisconnected) // Dim connection / FTM disconnected
2558  SetLedColor(fStatusFTMLed, kLedYellow, time);
2559  if (s.index==FTM::State::kConnected ||
2560  s.index==FTM::State::kIdle ||
2562  configuring) // Dim connection / FTM connected
2563  SetLedColor(fStatusFTMLed, kLedGreen, time);
2564  if (s.index==FTM::State::kTriggerOn) // Dim connection / FTM connected
2565  SetLedColor(fStatusFTMLed, kLedGreenCheck, time);
2566  if (s.index==FTM::State::kConnected ||
2567  s.index==FTM::State::kIdle ||
2568  s.index==FTM::State::kValid) // Dim connection / FTM connected
2569  enable = true;
2570  if (s.index>=FTM::State::kConfigError1) // Dim connection / FTM connected
2571  SetLedColor(fStatusFTMLed, kLedGreenWarn, time);
2572 
2573  fFtmStartRun->setEnabled(!configuring && enable && s.index!=FTM::State::kTriggerOn);
2574  fFtmStopRun->setEnabled(!configuring && !enable);
2575 
2576  fTriggerWidget->setEnabled(enable);
2577  fFtuGroupEnable->setEnabled(enable);
2578  fRatesControls->setEnabled(enable);
2579  fFtuWidget->setEnabled(s.index>FTM::State::kDisconnected);
2580 
2582  SetFtuStatusLed(time);
2583  else
2584  {
2585  SetLedColor(fStatusFTULed, kLedGray, time);
2586  fStatusFTULabel->setText("Offline");
2587  fStatusFTULabel->setToolTip("FTM is not online.");
2588  }
2589  }
2590 
2591  if (server=="FAD_CONTROL")
2592  {
2593  fStatusFADLabel->setText(s.name.c_str());
2594  fStatusFADLabel->setToolTip(s.comment.c_str());
2595 
2596  bool enable = false;
2597 
2598  if (s.index<FAD::State::kOffline) // No Dim connection
2599  {
2600  SetLedColor(fStatusFADLed, kLedGray, time);
2601 
2602  // Timing problem - sometimes they stay gray :(
2603  //for (int i=0; i<40; i++)
2604  // SetLedColor(fFadLED[i], kLedGray, time);
2605 
2606  /*
2607  fStatusEventBuilderLabel->setText("Offline");
2608  fStatusEventBuilderLabel->setToolTip("No connection to fadctrl.");
2609  fEvtBldWidget->setEnabled(false);
2610 
2611  SetLedColor(fStatusEventBuilderLed, kLedGray, time);
2612  */
2613  }
2614  if (s.index==FAD::State::kOffline) // Dim connection / FTM disconnected
2615  SetLedColor(fStatusFADLed, kLedRed, time);
2616  if (s.index==FAD::State::kDisconnected) // Dim connection / FTM disconnected
2617  SetLedColor(fStatusFADLed, kLedOrange, time);
2618  if (s.index==FAD::State::kConnecting) // Dim connection / FTM disconnected
2619  {
2620  SetLedColor(fStatusFADLed, kLedYellow, time);
2621  // FIXME FIXME FIXME: The LEDs are not displayed when disabled!
2622  enable = true;
2623  }
2624  if (s.index>=FAD::State::kConnected) // Dim connection / FTM connected
2625  {
2626  SetLedColor(fStatusFADLed, kLedGreen, time);
2627  enable = true;
2628  }
2629 
2630  fFadWidget->setEnabled(enable);
2631 
2632  fFadStart->setEnabled (s.index==FAD::State::kOffline);
2633  fFadStop->setEnabled (s.index >FAD::State::kOffline);
2634  fFadAbort->setEnabled (s.index >FAD::State::kOffline);
2635  fFadSoftReset->setEnabled(s.index >FAD::State::kOffline);
2636  fFadHardReset->setEnabled(s.index >FAD::State::kOffline);
2637  }
2638 
2639  if (server=="FSC_CONTROL")
2640  {
2641  fStatusFSCLabel->setText(s.name.c_str());
2642  fStatusFSCLabel->setToolTip(s.comment.c_str());
2643 
2644  bool enable = false;
2645 
2646  if (s.index<FSC::State::kDisconnected) // No Dim connection
2647  SetLedColor(fStatusFSCLed, kLedGray, time);
2648  if (s.index==FSC::State::kDisconnected) // Dim connection / FTM disconnected
2649  SetLedColor(fStatusFSCLed, kLedRed, time);
2650  if (s.index>=FSC::State::kConnected) // Dim connection / FTM disconnected
2651  {
2652  SetLedColor(fStatusFSCLed, kLedGreen, time);
2653  enable = true;
2654  }
2655 
2656  fAuxWidget->setEnabled(enable);
2657  }
2658 
2659  if (server=="DRIVE_CONTROL")
2660  {
2661  fStatusDriveLabel->setText(s.name.c_str());
2662  fStatusDriveLabel->setToolTip(s.comment.c_str());
2663 
2664  if (s.index<Drive::State::kDisconnected) // No Dim connection
2665  SetLedColor(fStatusDriveLed, kLedGray, time);
2666  if (s.index==Drive::State::kDisconnected) // Dim connection / No connection to cosy
2667  SetLedColor(fStatusDriveLed, kLedRed, time);
2669  //if (s.index==Drive::State::kConnected || /*s.index==Drive::State::kNotReady ||*/ s.index==Drive::State::kLocked) // Not Ready
2670  SetLedColor(fStatusDriveLed, kLedGreenBar, time);
2671  if (s.index==Drive::State::kInitialized) // Connected / Armed
2672  SetLedColor(fStatusDriveLed, kLedGreen, time);
2674  SetLedColor(fStatusDriveLed, kLedInProgress, time);
2675  if (s.index==Drive::State::kTracking || s.index==Drive::State::kOnTrack) // Tracking
2676  SetLedColor(fStatusDriveLed, kLedGreenCheck, time);
2677  if (s.index>0xff) // Error
2678  SetLedColor(fStatusDriveLed, kLedGreenWarn, time);
2679  }
2680 
2681  if (server=="BIAS_CONTROL")
2682  {
2683  fStatusBiasLabel->setText(s.name.c_str());
2684  fStatusBiasLabel->setToolTip(s.comment.c_str());
2685 
2686  if (s.index<1) // No Dim connection
2687  SetLedColor(fStatusBiasLed, kLedGray, time);
2688  if (s.index==BIAS::State::kDisconnected) // Dim connection / FTM disconnected
2689  SetLedColor(fStatusBiasLed, kLedRed, time);
2690  if (s.index==BIAS::State::kConnecting || s.index==BIAS::State::kInitializing) // Connecting / Initializing
2691  SetLedColor(fStatusBiasLed, kLedOrange, time);
2692  if (s.index==BIAS::State::kVoltageOff || BIAS::State::kLocked) // At reference
2693  SetLedColor(fStatusBiasLed, kLedGreenBar, time);
2694  if (s.index==BIAS::State::kNotReferenced) // At reference
2695  SetLedColor(fStatusBiasLed, kLedGreenWarn, time);
2696  if (s.index==BIAS::State::kRamping) // Ramping
2697  SetLedColor(fStatusBiasLed, kLedInProgress, time);
2698  if (s.index==BIAS::State::kVoltageOn) // At reference
2699  SetLedColor(fStatusBiasLed, kLedGreenCheck, time);
2700  if (s.index==BIAS::State::kOverCurrent) // Over current
2701  SetLedColor(fStatusBiasLed, kLedWarnBorder, time);
2702  if (s.index==BIAS::State::kExpertMode) // ExpertMode
2703  SetLedColor(fStatusBiasLed, kLedWarnTriangleBorder, time);
2704 
2705  fBiasWidget->setEnabled(s.index>=BIAS::State::kInitializing);
2706  }
2707 
2708  if (server=="FEEDBACK")
2709  {
2710  fStatusFeedbackLabel->setText(s.name.c_str());
2711  fStatusFeedbackLabel->setToolTip(s.comment.c_str());
2712 
2713  const bool connected = s.index> Feedback::State::kConnecting;
2715 
2716  if (s.index<=Feedback::State::kConnecting) // NoDim / Disconnected
2717  SetLedColor(fStatusFeedbackLed, kLedRed, time);
2718  if (s.index<Feedback::State::kDisconnected) // No Dim connection
2719  SetLedColor(fStatusFeedbackLed, kLedGray, time);
2720  if (s.index==Feedback::State::kConnecting) // Connecting
2721  SetLedColor(fStatusFeedbackLed, kLedOrange, time);
2722  if (connected) // Connected
2723  SetLedColor(fStatusFeedbackLed, kLedYellow, time);
2724  if (idle)
2725  SetLedColor(fStatusFeedbackLed, kLedGreen, time);
2727  SetLedColor(fStatusFeedbackLed, kLedGreenCheck, time);
2729  SetLedColor(fStatusFeedbackLed, kLedInProgress, time);
2730 
2731  fFeedbackWidget->setEnabled(connected);
2732 
2733  fFeedbackCalibrate->setEnabled(s.index==Feedback::State::kConnected || s.index==Feedback::State::kCalibrated);
2734  fFeedbackStart->setEnabled(s.index==Feedback::State::kCalibrated);
2735  fFeedbackStop->setEnabled(s.index>Feedback::State::kCalibrated);
2736  fFeedbackOvervoltage->setEnabled(connected);
2737 
2738  const bool enable = s.index>=Feedback::State::kCalibrated;
2739 
2740  fFeedbackFrameLeft->setEnabled(enable);
2741  fFeedbackCanvLeft->setEnabled(enable);
2742 
2743  fStateFeedback = s.index;
2744  }
2745 
2746  if (server=="RATE_CONTROL")
2747  {
2748  fStatusRateControlLabel->setText(s.name.c_str());
2749  fStatusRateControlLabel->setToolTip(s.comment.c_str());
2750 
2752  SetLedColor(fStatusRateControlLed, kLedGreenCheck, time);
2754  SetLedColor(fStatusRateControlLed, kLedGreen, time);
2756  SetLedColor(fStatusRateControlLed, kLedInProgress, time);
2758  SetLedColor(fStatusRateControlLed, kLedGreenBar, time);
2760  SetLedColor(fStatusRateControlLed, kLedOrange, time);
2762  SetLedColor(fStatusRateControlLed, kLedRed, time);
2764  SetLedColor(fStatusRateControlLed, kLedGray, time);
2765  }
2766 
2767  if (server=="DATA_LOGGER")
2768  {
2769  fStatusLoggerLabel->setText(s.name.c_str());
2770  fStatusLoggerLabel->setToolTip(s.comment.c_str());
2771 
2772  bool enable = true;
2773 
2774  if (s.index<30) // Ready/Waiting
2775  SetLedColor(fStatusLoggerLed, kLedYellow, time);
2776  if (s.index==30) // Ready/Waiting
2777  SetLedColor(fStatusLoggerLed, kLedGreen, time);
2778  if (s.index<-1) // Offline
2779  {
2780  SetLedColor(fStatusLoggerLed, kLedGray, time);
2781  enable = false;
2782  }
2783  if (s.index>=0x100) // Error
2784  SetLedColor(fStatusLoggerLed, kLedRed, time);
2785  if (s.index==40) // Logging
2786  SetLedColor(fStatusLoggerLed, kLedGreen, time);
2787 
2788  fLoggerWidget->setEnabled(enable);
2789  fLoggerStart->setEnabled(s.index>-1 && s.index<30);
2790  fLoggerStop->setEnabled(s.index>=30);
2791  }
2792 
2793  if (server=="MAGIC_WEATHER")
2794  {
2795  fStatusWeatherLabel->setText(s.name.c_str());
2796 
2798  SetLedColor(fStatusWeatherLed, kLedGreen, time);
2800  SetLedColor(fStatusWeatherLed, kLedRed, time);
2802  SetLedColor(fStatusWeatherLed, kLedGray, time);
2803  }
2804 
2805  if (server=="CHAT")
2806  {
2807  fStatusChatLabel->setText(s.name.c_str());
2808 
2809  fChatOnline = s.index==0;
2810 
2811  SetLedColor(fStatusChatLed, fChatOnline ? kLedGreen : kLedGray, time);
2812 
2813  fChatSend->setEnabled(fChatOnline);
2814  fChatMessage->setEnabled(fChatOnline);
2815  }
2816 
2817  if (server=="RATESCAN")
2818  fRateScanControls->setEnabled(s.index>=RateScan::State::kConnected);
2819 
2820  if (server=="SCHEDULER")
2821  {
2822  fStatusSchedulerLabel->setText(s.name.c_str());
2823 
2824  SetLedColor(fStatusSchedulerLed, s.index>=0 ? kLedGreen : kLedRed, time);
2825  }
2826  }
std::string comment
Name (e.g. &#39;Connected&#39;)
Definition: State.h:13
void SetFtuStatusLed(const Time &t)
Definition: FactGui.h:1899
int index
Definition: State.h:11
void SetLedColor(QPushButton *button, LedColor_t col, const Time &t)
Definition: FactGui.h:156
int fStateFeedback
Definition: FactGui.h:2477
std::string name
Index (e.g. 1)
Definition: State.h:12
bool fChatOnline
Definition: FactGui.h:2511

+ Here is the caller graph for this function: