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