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 |
|
---|
20 | #include "FADBoard.h"
|
---|
21 |
|
---|
22 | const int DEFAULT_NUM_CALIB_EVENTS = 100;
|
---|
23 |
|
---|
24 | enum ModeType {idle, acalib, tcalib};
|
---|
25 |
|
---|
26 | class FAD: public EvidenceServer {
|
---|
27 |
|
---|
28 | pthread_t MainThread;
|
---|
29 | DimCommand *Command;
|
---|
30 | DimService *ConsoleOut;
|
---|
31 | char *ConsoleText;
|
---|
32 | std::vector<std::string> Parameter;
|
---|
33 | ModeType Mode;
|
---|
34 | volatile bool Cancel;
|
---|
35 | void PrintUsage();
|
---|
36 | void commandHandler();
|
---|
37 | bool Match(std::string, const char *);
|
---|
38 | void AmplitudeCalibration();
|
---|
39 | static void LaunchAmplitudeCalibration(class FAD *);
|
---|
40 | void EventThread();
|
---|
41 | static void LaunchEventThread(class FAD *);
|
---|
42 | pthread_t Thread;
|
---|
43 | int EventUpdateDelay;
|
---|
44 |
|
---|
45 | int NumCalibEvents;
|
---|
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(); void cmd_dac();
|
---|
73 | void cmd_roi(); void cmd_address();
|
---|
74 | void cmd_phase(); void cmd_send();
|
---|
75 | void cmd_cancel(); void cmd_update();
|
---|
76 |
|
---|
77 | void EnableDomino();
|
---|
78 | void DisableDomino();
|
---|
79 | void SoftTrigger();
|
---|
80 | void SetDOMINOMode(int);
|
---|
81 | void SetDOMINOReadMode(int);
|
---|
82 | void SetDOMINOWaveMode(int);
|
---|
83 | bool ReadCalibration();
|
---|
84 | void PrintMessage(const char*, ...);
|
---|
85 | };
|
---|
86 |
|
---|
87 | #endif
|
---|