source: hvcontrol/src/ProcessIO.h@ 222

Last change on this file since 222 was 220, checked in by ogrimm, 16 years ago
hv command allows array of voltages (for use by feedback)
File size: 1.9 KB
Line 
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
10#define SERVER_NAME "Bias" // Name to use in DIM
11#include "Evidence.h"
12
13#include "HVCalib.h"
14#include "HV.h"
15#include "../pixelmap/PixelMap.h"
16
17#define MAX_COM_SIZE 5000
18#define NUM_CHAINS 4
19#define NUM_CHANNELS 32
20
21#define MIN_TIMEOUT 0.01
22#define MAX_TIMEOUT 5.0
23
24#define MIN_RATE 0.01
25#define MAX_RATE 50.0
26
27enum MsgTarget {Console=1, Log=2, All=7};
28typedef enum stateenum {active, stopped, na} state_enum;
29
30class ProcessIO: public EvidenceServer {
31
32 time_t StartTime;
33 PixelMap *pm;
34 DimCommand *Command;
35
36 void commandHandler();
37
38 public:
39 HVCalib *calib;
40 HVBoard **fHVBoard;
41
42 pthread_mutex_t control_mutex;
43
44 char Prompt[MAX_COM_SIZE];
45 std::vector<std::string> Parameter;
46
47 // Configuration data
48 char *fPixMapTable;
49 float fTimeOut;
50 float fStatusRefreshRate;
51 int DACMin;
52 int DACMax;
53 float fHVCalibOffset;
54 float fHVCalibSlope;
55 unsigned int fHVMaxDiff;
56
57 // Status variables
58 pthread_t HVMonitor; // exit function sends signal to these threads
59
60 int NumHVBoards;
61 int FirstBoard;
62 int LastBoard;
63 int FirstChain;
64 int LastChain;
65
66 state_enum state;
67 bool Exit;
68
69 // Methods
70 ProcessIO();
71 ~ProcessIO();
72
73 void PrintMessage(MsgTarget, const char *, ...);
74 void PrintMessage(const char *, ...);
75 void DoPrintMessage(const char *, va_list, MsgTarget);
76 void CommandControl(char*);
77 bool RampVoltage(unsigned int, int, int, int);
78 void Monitor();
79 void ResetBoard(int);
80 void PrintBoardStatus(int);
81
82 void cmd_board(); void cmd_hv();
83 void cmd_status(); void cmd_config();
84 void cmd_load(); void cmd_save();
85 void cmd_exit(); void cmd_rate();
86 void cmd_timeout(); void cmd_reset();
87 void cmd_start(); void cmd_stop();
88 void cmd_uptime(); void cmd_help();
89 void cmd_chain();
90};
91
92bool Match(std::string, const char *);
93bool ConvertToDouble(std::string, double *);
94bool ConvertToInt(std::string, int *);
95
96#endif
Note: See TracBrowser for help on using the repository browser.