1 | #ifndef FAD_H_SEEN
|
---|
2 | #define FAD_H_SEEN
|
---|
3 |
|
---|
4 | #define SERVER_NAME "FADctrl" // Name to use in DIM
|
---|
5 | #include "Evidence.h"
|
---|
6 |
|
---|
7 | #include <readline/readline.h>
|
---|
8 |
|
---|
9 | #include <stdlib.h>
|
---|
10 | #include <stdarg.h>
|
---|
11 | #include <ctype.h>
|
---|
12 | #include <time.h>
|
---|
13 | #include <math.h>
|
---|
14 | #include <errno.h>
|
---|
15 | #include <unistd.h>
|
---|
16 | #include <dirent.h>
|
---|
17 | #include <sys/time.h>
|
---|
18 | #include <sys/stat.h>
|
---|
19 | #include <limits>
|
---|
20 | #include <fcntl.h>
|
---|
21 |
|
---|
22 | #include "FADBoard.h"
|
---|
23 | #include "../drsdaq/RawDataCTX.h"
|
---|
24 |
|
---|
25 | const unsigned int PORT = 5000;
|
---|
26 | const int DEFAULT_NUM_CALIB_EVENTS = 100;
|
---|
27 | const char CALIB_DIRECTORY[] = "~/";
|
---|
28 |
|
---|
29 |
|
---|
30 | class FAD: public EvidenceServer {
|
---|
31 |
|
---|
32 | public:
|
---|
33 | enum ModeType {idle, datarun, acalib};
|
---|
34 | ModeType Mode;
|
---|
35 |
|
---|
36 | private:
|
---|
37 | pthread_t MainThread;
|
---|
38 | DimCommand *Command;
|
---|
39 | DimService *ConsoleOut;
|
---|
40 | char *ConsoleText;
|
---|
41 | std::vector<std::string> Parameter;
|
---|
42 | void PrintUsage();
|
---|
43 | void commandHandler();
|
---|
44 | virtual void exitHandler(int);
|
---|
45 | bool Match(std::string, const char *);
|
---|
46 | void EventThread();
|
---|
47 | static void LaunchEventThread(class FAD *);
|
---|
48 | pthread_t Thread;
|
---|
49 | float TimeForDIMUpdate;
|
---|
50 |
|
---|
51 | int Datafile;
|
---|
52 | int NumEvents; // Number of event taken
|
---|
53 |
|
---|
54 | std::vector<class FADBoard *> Boards;
|
---|
55 |
|
---|
56 | struct Range {
|
---|
57 | int Min;
|
---|
58 | int Max;
|
---|
59 | };
|
---|
60 |
|
---|
61 | void ExecuteCommand();
|
---|
62 | bool ConvertToDouble(std::string, double *);
|
---|
63 | bool ConvertToInt(std::string, int *);
|
---|
64 | bool ConvertToRange(std::string, struct Range &);
|
---|
65 |
|
---|
66 | public:
|
---|
67 | FAD(std::vector<std::string>);
|
---|
68 | ~FAD();
|
---|
69 |
|
---|
70 | void cmd_exit(); void cmd_help();
|
---|
71 | void cmd_board(); void cmd_status();
|
---|
72 | void cmd_acalib(); void cmd_serial();
|
---|
73 | void cmd_trigger(); void cmd_socketmode();
|
---|
74 | void cmd_runnumber(); void cmd_reset();
|
---|
75 | void cmd_execute();
|
---|
76 | void cmd_srclk(); void cmd_sclk();
|
---|
77 | void cmd_dwrite(); void cmd_domino();
|
---|
78 | void cmd_wmode(); void cmd_rmode();
|
---|
79 | void cmd_dmode(); void cmd_dac();
|
---|
80 | void cmd_roi(); void cmd_address();
|
---|
81 | void cmd_phase(); void cmd_send();
|
---|
82 | void cmd_stop(); void cmd_update();
|
---|
83 | void cmd_take();
|
---|
84 |
|
---|
85 | void EnableDomino();
|
---|
86 | void DisableDomino();
|
---|
87 | void SoftTrigger();
|
---|
88 | //void SetDOMINOMode(int);
|
---|
89 | //void SetDOMINOReadMode(int);
|
---|
90 | //void SetDOMINOWaveMode(int);
|
---|
91 | void SaveAmplitudeCalibration();
|
---|
92 | void PrintMessage(const char*, ...);
|
---|
93 |
|
---|
94 | int Pipe[2];
|
---|
95 | int NumEventsRequested; // Number of events requested
|
---|
96 | float EventUpdateDelay;
|
---|
97 | std::vector<std::string> BoardList;
|
---|
98 | };
|
---|
99 |
|
---|
100 | #endif
|
---|