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