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 | const char CALIB_DIRECTORY[] = "~/";
|
---|
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 | float EventUpdateDelay;
|
---|
45 |
|
---|
46 | int NumCalibEvents;
|
---|
47 |
|
---|
48 | std::vector<std::string> BoardList;
|
---|
49 | std::vector<class FADBoard *> Boards;
|
---|
50 |
|
---|
51 | struct Range {
|
---|
52 | int Min;
|
---|
53 | int Max;
|
---|
54 | };
|
---|
55 |
|
---|
56 | bool ConvertToDouble(std::string, double *);
|
---|
57 | bool ConvertToInt(std::string, int *);
|
---|
58 | bool ConvertToRange(std::string, struct Range &);
|
---|
59 |
|
---|
60 | public:
|
---|
61 | FAD();
|
---|
62 | ~FAD();
|
---|
63 |
|
---|
64 | void cmd_exit(); void cmd_help();
|
---|
65 | void cmd_board(); void cmd_status();
|
---|
66 | void cmd_acalib(); void cmd_serial();
|
---|
67 | void cmd_trigger(); void cmd_socketmode();
|
---|
68 | void cmd_srclk(); void cmd_sclk();
|
---|
69 | void cmd_dwrite(); void cmd_domino();
|
---|
70 | void cmd_wmode(); void cmd_rmode();
|
---|
71 | void cmd_dmode(); void cmd_dac();
|
---|
72 | void cmd_roi(); void cmd_address();
|
---|
73 | void cmd_phase(); void cmd_send();
|
---|
74 | void cmd_cancel(); void cmd_update();
|
---|
75 |
|
---|
76 | void EnableDomino();
|
---|
77 | void DisableDomino();
|
---|
78 | void SoftTrigger();
|
---|
79 | void SetDOMINOMode(int);
|
---|
80 | void SetDOMINOReadMode(int);
|
---|
81 | void SetDOMINOWaveMode(int);
|
---|
82 | bool ReadCalibration();
|
---|
83 | void PrintMessage(const char*, ...);
|
---|
84 | };
|
---|
85 |
|
---|
86 | #endif
|
---|