1 |
|
---|
2 | #ifndef PROCESSIO_H_SEEN
|
---|
3 | #define PROCESSIO_H_SEEN
|
---|
4 |
|
---|
5 | #include <stdarg.h>
|
---|
6 | #include <errno.h>
|
---|
7 | #include <math.h>
|
---|
8 | #include <signal.h>
|
---|
9 | #include <string>
|
---|
10 | #include <pthread.h>
|
---|
11 | #include <limits>
|
---|
12 |
|
---|
13 | #define SERVER_NAME "Bias" // Name to use in DIM
|
---|
14 | #include "Evidence.h"
|
---|
15 |
|
---|
16 | #include "Crate.h"
|
---|
17 | #include "../pixelmap/PixelMap.h"
|
---|
18 |
|
---|
19 | #define MAX_COM_SIZE 5000
|
---|
20 |
|
---|
21 | #define MIN_RATE 0.01
|
---|
22 | #define MAX_RATE 50.0
|
---|
23 |
|
---|
24 | class User: public EvidenceServer {
|
---|
25 |
|
---|
26 | enum RunMode {mode_static, mode_dynamic};
|
---|
27 |
|
---|
28 | PixelMap *PixMap;
|
---|
29 | DimCommand *DIMCommand;
|
---|
30 | DimService *ConsoleOut;
|
---|
31 | char *ConsoleText;
|
---|
32 | pthread_t MainThread, Thread;
|
---|
33 | std::vector<std::string> Parameter;
|
---|
34 | RunMode Mode;
|
---|
35 |
|
---|
36 | std::vector<class Crate *> Crates;
|
---|
37 | std::vector<double> DefaultVoltage;
|
---|
38 |
|
---|
39 | void commandHandler();
|
---|
40 |
|
---|
41 | struct Range {
|
---|
42 | int Min;
|
---|
43 | int Max;
|
---|
44 | };
|
---|
45 |
|
---|
46 | bool Match(std::string, const char *);
|
---|
47 | bool ConvertToDouble(std::string, double *);
|
---|
48 | bool ConvertToInt(std::string, int *);
|
---|
49 | bool ConvertToRange(std::string, struct Range &);
|
---|
50 |
|
---|
51 | public:
|
---|
52 | double fTimeOut;
|
---|
53 | float fStatusRefreshRate;
|
---|
54 | double fMaxDiff;
|
---|
55 | unsigned int ActiveCrate;
|
---|
56 |
|
---|
57 | User();
|
---|
58 | ~User();
|
---|
59 |
|
---|
60 | void PrintMessage(const char *, ...);
|
---|
61 | unsigned int RampVoltages(int, std::map<unsigned int, double>);
|
---|
62 | void Monitor();
|
---|
63 | static void LaunchMonitor(User *);
|
---|
64 |
|
---|
65 | void cmd_hv(); void cmd_synch();
|
---|
66 | void cmd_status(); void cmd_gs();
|
---|
67 | void cmd_load(); void cmd_save();
|
---|
68 | void cmd_exit(); void cmd_rate();
|
---|
69 | void cmd_timeout(); void cmd_reset();
|
---|
70 | void cmd_help(); void cmd_mode();
|
---|
71 | void cmd_crate(); void cmd_shell();
|
---|
72 | };
|
---|
73 |
|
---|
74 | #endif
|
---|