source: hvcontrol/src/ProcessIO.h@ 152

Last change on this file since 152 was 126, checked in by ogrimm, 15 years ago
Implemented DIM servers
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
10#define SERVER_NAME "BIAS" // Name to use in DIM
11#include "../../Evidence/Evidence.h"
12
13#include "HVConfig.h"
14#include "HVCalib.h"
15#include "HV.h"
16#include "../pixelmap/PixelMap.h"
17#include "../drsdaq/SlowData.h"
18
19#define MAX_NUM_TOKEN 10
20
21#define MsgToConsole 1
22#define MsgToLog 2
23#define MsgToSocket 4
24
25typedef enum stateenum { active, stopped, na } state_enum;
26
27class ProcessIO: public EvidenceServer {
28
29 time_t StartTime;
30 FILE *Logfile;
31 PixelMap *pm;
32
33 public:
34
35 HVConfig *config;
36 HVCalib *calib;
37 HVBoard **fHVBoard;
38 SlowData *SlowDataClass;
39
40 pthread_mutex_t control_mutex;
41
42 char Prompt[MAX_COM_SIZE];
43 const char *Param[MAX_NUM_TOKEN]; // For parser
44 int NParam;
45 bool CmdFromSocket;
46
47 // Status variables
48 pthread_t HVMonitor; // exit function sends signal to these threads
49 pthread_t SocketThread;
50
51 bool Verbose;
52 int Socket; // -1 if not connected
53
54 int NumHVBoards;
55 int FirstBoard;
56 int LastBoard;
57 int FirstChain;
58 int LastChain;
59
60 float fStatusRefreshRate;
61 state_enum state;
62 bool Exit;
63
64 // Methods
65 ProcessIO(const char *);
66 ~ProcessIO();
67
68 void PrintMessage(int, const char *, ...);
69 void PrintMessage(const char *, ...);
70 void DoPrintMessage(const char *, va_list, int);
71 void CommandControl(char*);
72 bool RampVoltage(unsigned int, int, int, int);
73 void Monitor();
74 void ResetBoard(int);
75 void PrintBoardStatus(int);
76 int ParseInput(char*, const char *Param[]);
77};
78
79bool Match(const char *, const char *);
80bool ConvertToDouble(const char *, double *);
81bool ConvertToInt(const char *, int *);
82
83#endif
Note: See TracBrowser for help on using the repository browser.