Changeset 13915


Ignore:
Timestamp:
05/26/12 14:45:53 (12 years ago)
Author:
tbretz
Message:
Moved state definition to HeadersrateControl.h
Location:
trunk/FACT++/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/ratecontrol.cc

    r13894 r13915  
    1616
    1717#include "HeadersFTM.h"
     18#include "HeadersRateControl.h"
    1819
    1920namespace ba    = boost::asio;
     
    3334{
    3435private:
    35     enum states_t
    36     {
    37         kStateDimNetworkNA = 1,
    38         kStateDisconnected,
    39         kStateConnecting,
    40         kStateConnected,
    41 
    42         kStateSettingGlobalThreshold,
    43         kStateGlobalThresholdSet,
    44 
    45         kStateInProgress,
    46     };
    47 
    4836    bool fTriggerOn;
    4937
     
    351339        const FTM::DimTriggerRates &sdata = *static_cast<const FTM::DimTriggerRates*>(evt.GetData());
    352340
    353         if (GetCurrentState()==kStateSettingGlobalThreshold)
     341        if (GetCurrentState()==RateControl::State::kSettingGlobalThreshold)
    354342            ProcessCamera(sdata);
    355343
    356         if (GetCurrentState()==kStateInProgress)
     344        if (GetCurrentState()==RateControl::State::kInProgress)
    357345            ProcessPatches(sdata);
    358346
     
    365353        {
    366354            Info("Trigger not switched on... CALIBRATE command ignored.");
    367             return kStateGlobalThresholdSet;
     355            return RateControl::State::kGlobalThresholdSet;
    368356        }
    369357
     
    382370        Info(out);
    383371
    384         return kStateSettingGlobalThreshold;
     372        return RateControl::State::kSettingGlobalThreshold;
    385373    }
    386374
     
    458446
    459447        if (!fDim.online())
    460             return kStateDimNetworkNA;
     448            return RateControl::State::kDimNetworkNA;
    461449
    462450        // All subsystems are not connected
    463         if (fDimFTM.state()<FTM::kConnected)
    464             return kStateDisconnected;
    465 
    466         if (GetCurrentState()==kStateSettingGlobalThreshold)
     451        if (fDimFTM.state()<FTM::State::kConnected)
     452            return RateControl::State::kDisconnected;
     453
     454        if (GetCurrentState()==RateControl::State::kSettingGlobalThreshold)
    467455        {
    468456            if (fTriggerRate<0 || fTriggerRate>fTargetRate)
    469                 return kStateSettingGlobalThreshold;
    470 
    471             return kStateGlobalThresholdSet;
    472         }
    473 
    474         if (GetCurrentState()==kStateGlobalThresholdSet)
     457                return RateControl::State::kSettingGlobalThreshold;
     458
     459            return RateControl::State::kGlobalThresholdSet;
     460        }
     461
     462        if (GetCurrentState()==RateControl::State::kGlobalThresholdSet)
    475463        {
    476464            if (!fTriggerOn)
    477                 return kStateGlobalThresholdSet;
    478             //return kStateInProgress;
     465                return RateControl::State::kGlobalThresholdSet;
     466            //return RateControl::State::kInProgress;
    479467        }
    480468
    481469        // At least one subsystem is not connected
    482470        //        if (fDimFTM.state()>=FTM::kConnected)
    483         return fTriggerOn && fEnabled && fDimRS.state()<5 ? kStateInProgress : kStateConnected;
     471        return fTriggerOn && fEnabled && fDimRS.state()<5 ? RateControl::State::kInProgress : RateControl::State::kConnected;
    484472    }
    485473
     
    507495
    508496        // State names
    509         AddStateName(kStateDimNetworkNA, "DimNetworkNotAvailable",
     497        AddStateName(RateControl::State::kDimNetworkNA, "DimNetworkNotAvailable",
    510498                     "The Dim DNS is not reachable.");
    511499
    512         AddStateName(kStateDisconnected, "Disconnected",
     500        AddStateName(RateControl::State::kDisconnected, "Disconnected",
    513501                     "The Dim DNS is reachable, but the required subsystems are not available.");
    514502
    515         AddStateName(kStateConnected, "Connected",
     503        AddStateName(RateControl::State::kConnected, "Connected",
    516504                     "All needed subsystems are connected to their hardware, no action is performed.");
    517505
    518         AddStateName(kStateSettingGlobalThreshold, "Calibrating", "");
    519         AddStateName(kStateGlobalThresholdSet, "GlobalThresholdSet", "");
    520 
    521         AddStateName(kStateInProgress, "InProgress",
     506        AddStateName(RateControl::State::kSettingGlobalThreshold, "Calibrating", "");
     507        AddStateName(RateControl::State::kGlobalThresholdSet, "GlobalThresholdSet", "");
     508
     509        AddStateName(RateControl::State::kInProgress, "InProgress",
    522510                     "Rate scan in progress.");
    523511
Note: See TracChangeset for help on using the changeset viewer.