MIDAS
Loading...
Searching...
No Matches
fetest_tmfe.cxx File Reference
#include <stdio.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
#include "midas.h"
#include "tmfe.h"
Include dependency graph for fetest_tmfe.cxx:

Go to the source code of this file.

Classes

class  Myfe
 

Functions

static void usage ()
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 104 of file fetest_tmfe.cxx.

105{
106 setbuf(stdout, NULL);
107 setbuf(stderr, NULL);
108
109 signal(SIGPIPE, SIG_IGN);
110
111 std::string name = "";
112
113 if (argc == 2) {
114 name = argv[1];
115 } else {
116 usage(); // DOES NOT RETURN
117 }
118
119 TMFE* mfe = TMFE::Instance();
120
121 TMFeError err = mfe->Connect("fetest_tmfe", __FILE__);
122 if (err.error) {
123 printf("Cannot connect, bye.\n");
124 return 1;
125 }
126
127 //mfe->SetWatchdogSec(0);
128
129 TMFeCommon *common = new TMFeCommon();
130 common->EventID = 1;
131 common->LogHistory = 1;
132 //common->Buffer = "SYSTEM";
133
134 TMFeEquipment* eq = new TMFeEquipment(mfe, "tmfe", common);
135 eq->Init();
136 eq->SetStatus("Starting...", "white");
137 eq->ZeroStatistics();
138 eq->WriteStatistics();
139
140 mfe->RegisterEquipment(eq);
141
142 Myfe* myfe = new Myfe(mfe, eq);
143
144 mfe->RegisterRpcHandler(myfe);
145
146 //mfe->SetTransitionSequenceStart(910);
147 //mfe->SetTransitionSequenceStop(90);
148 //mfe->DeregisterTransitionPause();
149 //mfe->DeregisterTransitionResume();
150 //mfe->RegisterTransitionStartAbort();
151
152 myfe->Init();
153
154 mfe->RegisterPeriodicHandler(eq, myfe);
155
156 eq->SetStatus("Started...", "white");
157
158 while (!mfe->fShutdownRequested) {
159 mfe->PollMidas(10);
160 }
161
162 mfe->Disconnect();
163
164 return 0;
165}
void Init()
Definition tmfe.h:381
void RegisterRpcHandler(TMFeRpcHandlerInterface *handler)
RPC handlers are executed from the RPC thread, if started.
TMFeResult Connect(const char *progname=NULL, const char *hostname=NULL, const char *exptname=NULL)
Definition tmfe.cxx:65
static TMFE * Instance()
Definition tmfe.cxx:57
std::atomic_bool fShutdownRequested
shutdown was requested by Ctrl-C or by RPC command
Definition tmfe.h:398
void RegisterPeriodicHandler(TMFeEquipment *eq, TMFePeriodicHandlerInterface *handler)
periodic handlers are executed from the periodic thread, if started
TMFeResult Disconnect()
Definition tmfe.cxx:154
TMFeError RegisterEquipment(TMFeEquipment *eq)
void PollMidas(int millisec)
uint16_t EventID
Definition tmfe_rev0.h:105
int LogHistory
Definition tmfe_rev0.h:116
int error
Definition tmfe_rev0.h:87
static void usage()
std::vector< FMT_ID > eq
Definition mdump.cxx:55
#define name(x)
Definition midas_macro.h:24
Here is the call graph for this function:

◆ usage()

static void usage ( )
static

Definition at line 98 of file fetest_tmfe.cxx.

99{
100 fprintf(stderr, "Usage: fetest_tmfe ...\n");
101 exit(1);
102}
Here is the caller graph for this function: