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