source: hvcontrol/src/ProcessIO.h@ 2962

Last change on this file since 2962 was 264, checked in by ogrimm, 14 years ago
Removed mutex locking in hvcontrol, use lockf() in Communicate()
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 pthread_t HVMonitor; // exit function sends signal to these threads
57 int NumHVBoards;
58 int FirstBoard;
59 int LastBoard;
60 state_enum state;
61
62 // Methods
63 ProcessIO();
64 ~ProcessIO();
65
66 void PrintMessage(const char *, ...);
67 void CommandControl(char*);
68 bool RampVoltage(unsigned int, int, int, int);
69 void Monitor();
70 void PrintBoardStatus(int);
71
72 void cmd_board(); void cmd_hv();
73 void cmd_status(); void cmd_config();
74 void cmd_load(); void cmd_save();
75 void cmd_exit(); void cmd_rate();
76 void cmd_timeout(); void cmd_reset();
77 void cmd_start(); void cmd_stop();
78 void cmd_uptime(); void cmd_help();
79};
80
81bool Match(std::string, const char *);
82bool ConvertToDouble(std::string, double *);
83bool ConvertToInt(std::string, int *);
84
85#endif
Note: See TracBrowser for help on using the repository browser.