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 | #define MAX_COM_SIZE 10000
|
---|
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 | //const char *fCalibDataPath;
|
---|
47 | //char CalibInfoFilename[MAX_PATH];
|
---|
48 |
|
---|
49 | std::vector<std::string> BoardList;
|
---|
50 | std::vector<class FADBoard *> Boards;
|
---|
51 |
|
---|
52 | struct Range {
|
---|
53 | int Min;
|
---|
54 | int Max;
|
---|
55 | };
|
---|
56 |
|
---|
57 | bool ConvertToDouble(std::string, double *);
|
---|
58 | bool ConvertToInt(std::string, int *);
|
---|
59 | bool ConvertToRange(std::string, struct Range &);
|
---|
60 |
|
---|
61 | public:
|
---|
62 | FAD();
|
---|
63 | ~FAD();
|
---|
64 |
|
---|
65 | void cmd_exit(); void cmd_help();
|
---|
66 | void cmd_board(); void cmd_status();
|
---|
67 | void cmd_acalib(); void cmd_serial();
|
---|
68 | void cmd_trigger(); void cmd_socketmode();
|
---|
69 | void cmd_srclk(); void cmd_sclk();
|
---|
70 | void cmd_dwrite(); void cmd_domino();
|
---|
71 | void cmd_wmode(); void cmd_rmode();
|
---|
72 | void cmd_dmode();
|
---|
73 | void cmd_tcalib(); 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
|
---|