source: fact/FADctrl/FAD.h@ 10117

Last change on this file since 10117 was 10117, checked in by ogrimm, 14 years ago
Amplitude calibration integrated into event loop
File size: 2.0 KB
Line 
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
23const int DEFAULT_NUM_CALIB_EVENTS = 100;
24const char CALIB_DIRECTORY[] = "~/";
25
26
27class FAD: public EvidenceServer {
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 bool Match(std::string, const char *);
42 void EventThread();
43 static void LaunchEventThread(class FAD *);
44 pthread_t Thread;
45 float EventUpdateDelay;
46
47 int Datafile;
48 int NumEvents; // Number of event taken
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_stop(); void cmd_update();
77 void cmd_take();
78
79 void EnableDomino();
80 void DisableDomino();
81 void SoftTrigger();
82 //void SetDOMINOMode(int);
83 //void SetDOMINOReadMode(int);
84 //void SetDOMINOWaveMode(int);
85 void SaveAmplitudeCalibration();
86 void PrintMessage(const char*, ...);
87
88 int Pipe[2];
89 int NumEventsRequested; // Number of events requested
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.