source: hvcontrol/src/ProcessIO.h@ 257

Last change on this file since 257 was 230, checked in by ogrimm, 14 years ago
Command reception logged by drsdaq and hvcontrol
File size: 1.7 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#include <string>
10
11#define SERVER_NAME "Bias" // Name to use in DIM
12#include "Evidence.h"
13
14#include "HVCalib.h"
15#include "HV.h"
16#include "../pixelmap/PixelMap.h"
17
18#define MAX_COM_SIZE 5000
19#define NUM_CHAINS 4
20#define NUM_CHANNELS 32
21
22#define MIN_TIMEOUT 0.01
23#define MAX_TIMEOUT 5.0
24
25#define MIN_RATE 0.01
26#define MAX_RATE 50.0
27
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 float fTimeOut;
49 float fStatusRefreshRate;
50 int DACMin;
51 int DACMax;
52 float fHVCalibOffset;
53 float fHVCalibSlope;
54 unsigned int fHVMaxDiff;
55
56 // Status variables
57 pthread_t HVMonitor; // exit function sends signal to these threads
58 pthread_mutex_t Mutex;
59
60 int NumHVBoards;
61 int FirstBoard;
62 int LastBoard;
63 state_enum state;
64
65 // Methods
66 ProcessIO();
67 ~ProcessIO();
68
69 void PrintMessage(const char *, ...);
70 void CommandControl(char*);
71 bool RampVoltage(unsigned int, int, int, int);
72 void Monitor();
73 void ResetBoard(int);
74 void PrintBoardStatus(int);
75
76 void cmd_board(); void cmd_hv();
77 void cmd_status(); void cmd_config();
78 void cmd_load(); void cmd_save();
79 void cmd_exit(); void cmd_rate();
80 void cmd_timeout(); void cmd_reset();
81 void cmd_start(); void cmd_stop();
82 void cmd_uptime(); void cmd_help();
83};
84
85bool Match(std::string, const char *);
86bool ConvertToDouble(std::string, double *);
87bool ConvertToInt(std::string, int *);
88
89#endif
Note: See TracBrowser for help on using the repository browser.