source: hvcontrol/src/ProcessIO.h@ 226

Last change on this file since 226 was 226, checked in by ogrimm, 14 years ago
Small changes to mutex handling in hvcontrol and drsdaq
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 DimService *ConsoleOut;
36 char *ConsoleText;
37
38 void commandHandler();
39
40 public:
41 HVCalib *calib;
42 HVBoard **fHVBoard;
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 pthread_mutex_t Mutex;
60
61 int NumHVBoards;
62 int FirstBoard;
63 int LastBoard;
64 state_enum state;
65
66 // Methods
67 ProcessIO();
68 ~ProcessIO();
69
70 void PrintMessage(MsgTarget, const char *, ...);
71 void PrintMessage(const char *, ...);
72 void DoPrintMessage(const char *, va_list, MsgTarget);
73 void CommandControl(char*);
74 bool RampVoltage(unsigned int, int, int, int);
75 void Monitor();
76 void ResetBoard(int);
77 void PrintBoardStatus(int);
78
79 void cmd_board(); void cmd_hv();
80 void cmd_status(); void cmd_config();
81 void cmd_load(); void cmd_save();
82 void cmd_exit(); void cmd_rate();
83 void cmd_timeout(); void cmd_reset();
84 void cmd_start(); void cmd_stop();
85 void cmd_uptime(); void cmd_help();
86};
87
88bool Match(std::string, const char *);
89bool ConvertToDouble(std::string, double *);
90bool ConvertToInt(std::string, int *);
91
92#endif
Note: See TracBrowser for help on using the repository browser.