00001
00007 #ifndef _Q_PULSER_CONTROLLER_HH_
00008 #define _Q_PULSER_CONTROLLER_HH_
00009
00010 #include "QTimer.hh"
00011
00012 #include <map>
00013 #include <vector>
00014
00015
00016 #include "QPulserDefs.hh"
00017
00018 class QPulserChannel;
00019 class QPulserGroup;
00020 class QSlowControlClient;
00021 class QBaseDigitalController;
00022
00023 class QPulserController
00024 {
00025 public:
00027 QPulserController();
00028
00030 virtual ~QPulserController();
00031
00036 void Init(int settingsBasket);
00037
00039 int Run();
00040
00045 void Fire();
00046
00050
00051
00055 void PrepareNext();
00056
00058 void HandleTimeOut();
00059
00061 void StartDelayTimers();
00062
00063
00064 private:
00065 QTimer<QPulserController> fBaseTimer;
00066
00067 QSlowControlClient *fSlowClient;
00068 QBaseDigitalController *fDioCtrl;
00069
00070 unsigned long fTimeBase;
00071 unsigned short fNextGroupId;
00072 long fDelay;
00073
00074 std::vector<QPulserGroup*> fGroups;
00075 std::vector<QPulserGroup*>::const_iterator fGroupsIt;
00076
00077
00079 void BuildGroups(int settingsBasket);
00080
00082 void BuildDelayIndexes(const std::map<unsigned short,QPulserChannel*>&
00083 pChans);
00084
00085 void ApplySlowConfig(const unsigned short& pulseId,
00086 const QPulserConfig_t* config);
00087
00088
00089 void PrepareDigital(const unsigned short& pulseId,
00090 const QPulserConfig_t* config);
00091
00093 void ConnectDelayTimers();
00094
00095 };
00096
00097 #endif