1 #ifndef _ots_FEVInterface_h_
2 #define _ots_FEVInterface_h_
4 #include "otsdaq-core/FiniteStateMachine/VStateMachine.h"
5 #include "otsdaq-core/WorkLoopManager/WorkLoop.h"
6 #include "otsdaq-core/ConfigurationInterface/Configurable.h"
7 #include "otsdaq-core/FECore/FESlowControlsWorkLoop.h"
11 #include "otsdaq-core/FECore/FESlowControlsChannel.h"
20 class FrontEndHardwareBase;
21 class FrontEndFirmwareBase;
22 class FEInterfaceConfigurationBase;
31 ,
Configurable (theXDAQContextConfigTree, configurationPath)
32 , interfaceUID_ (interfaceUID)
33 , interfaceType_ (theXDAQContextConfigTree_.getBackNode(theConfigurationPath_).getNode(
"FEInterfacePluginName").getValue<std::string>())
34 , daqHardwareType_ (
"NOT SET")
35 , firmwareType_ (
"NOT SET")
36 , slowControlsWorkLoop_ (interfaceUID +
"-SlowControls",
this)
41 virtual void initLocalGroup(
int local_group_comm_){std::cout << __PRETTY_FUNCTION__ << std::endl;}
46 void configureSlowControls(
void);
50 const std::string& getInterfaceUID (
void)
const {
return interfaceUID_;}
51 const std::string& getDaqHardwareType (
void)
const {
return daqHardwareType_;}
52 const std::string& getFirmwareType (
void)
const {
return firmwareType_;}
53 const std::string& getInterfaceType (
void)
const {
return interfaceType_;}
55 virtual int universalRead (
char* address,
char* returnValue) = 0;
56 virtual void universalWrite (
char* address,
char* writeValue) = 0;
57 const unsigned int& getUniversalAddressSize(
void) {
return universalAddressSize_;}
58 const unsigned int& getUniversalDataSize (
void) {
return universalDataSize_;}
63 FrontEndHardwareBase* getHardwareP(
void)
const {
return theFrontEndHardware_;}
64 FrontEndFirmwareBase* getFirmwareP(
void)
const {
return theFrontEndFirmware_;}
66 bool slowControlsRunning(
void);
67 void startSlowControlsWorkLooop(
void) {slowControlsWorkLoop_.startWorkLoop();}
68 void stopSlowControlsWorkLooop(
void) {slowControlsWorkLoop_.stopWorkLoop();}
71 using frontEndMacroInArg_t = std::pair<
const std::string ,
const std::string >;
72 using frontEndMacroInArgs_t =
const std::vector<frontEndMacroInArg_t> &;
73 using frontEndMacroOutArg_t = std::pair<
const std::string , std::string >;
74 using frontEndMacroOutArgs_t = std::vector<frontEndMacroOutArg_t> &;
75 using frontEndMacroFunction_t = void (
ots::FEVInterface::* )(frontEndMacroInArgs_t, frontEndMacroOutArgs_t);
79 const std::vector<std::string> &namesOfInputArgs,
80 const std::vector<std::string> &namesOfOutputArgs,
81 const uint8_t requiredUserPermissions)
82 :macroFunction_(feMacroFunction)
83 ,namesOfInputArguments_(namesOfInputArgs)
84 ,namesOfOutputArguments_(namesOfOutputArgs)
85 ,requiredUserPermissions_(requiredUserPermissions)
88 const frontEndMacroFunction_t macroFunction_;
89 const std::vector<std::string> namesOfInputArguments_, namesOfOutputArguments_;
90 const uint8_t requiredUserPermissions_;
92 const std::map<std::string, frontEndMacroStruct_t>& getMapOfFEMacroFunctions() {
return mapOfFEMacroFunctions_;}
95 bool workLoopThread(toolbox::task::WorkLoop* workLoop){continueWorkLoop_ = running();
return continueWorkLoop_;}
96 std::string interfaceUID_;
97 std::string interfaceType_;
100 std::string daqHardwareType_;
101 std::string firmwareType_;
103 FrontEndHardwareBase* theFrontEndHardware_ =
nullptr;
104 FrontEndFirmwareBase* theFrontEndFirmware_ =
nullptr;
106 unsigned int universalAddressSize_ = 0;
107 unsigned int universalDataSize_ = 0;
110 std::map<std::string, FESlowControlsChannel> mapOfSlowControlsChannels_;
111 FESlowControlsWorkLoop slowControlsWorkLoop_;
116 std::map<std::string, frontEndMacroStruct_t> mapOfFEMacroFunctions_;
117 std::array<std::string, 3> testarr_;
119 void registerFEMacroFunction(
const std::string &feMacroName, frontEndMacroFunction_t feMacroFunction,
const std::vector<std::string> &namesOfInputArgs,
const std::vector<std::string> &namesOfOutputArgs,uint8_t requiredUserPermissions);
120 const std::string& getFEMacroInputArgument(frontEndMacroInArgs_t &argsIn,
const std::string &argName);
121 std::string& getFEMacroOutputArgument(frontEndMacroOutArgs_t &argsOut,
const std::string& argName);