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