source: fact/FADctrl/FADBoard.h@ 10120

Last change on this file since 10120 was 10120, checked in by ogrimm, 14 years ago
Moved OpenOtherSockets() to FADBoard class
File size: 1.5 KB
Line 
1#ifndef FADBoard_H_SEEN
2#define FADBoard_H_SEEN
3
4#include <ctype.h>
5#include <time.h>
6#include <math.h>
7#include <errno.h>
8#include <unistd.h>
9#include <dirent.h>
10#include <sys/time.h>
11
12#include <stdlib.h>
13#include <string.h>
14#include <iostream>
15#include <sys/socket.h>
16#include <netdb.h>
17
18#include "FAD.h"
19#include "FADFormat.h"
20
21const unsigned int READ_BUFFER_SIZE = 1000000;
22
23class FADBoard {
24
25 class FAD *m;
26 int Socket;
27 pthread_t Thread, OtherThread;
28 pthread_mutex_t Mutex;
29 DimService *DIM_Name, *DIM_ID, *DIM_Temp, *DIM_ROI, *DIM_DAC;
30
31 void ReadLoop();
32 static void LaunchThread(class FADBoard *);
33 static void OpenOtherSockets(char *);
34
35 public:
36 FADBoard(std::string, unsigned short, class FAD *, unsigned int);
37 ~FADBoard();
38
39 struct BoardStatus {
40 unsigned short BoardID;
41 unsigned short FirmwareRevision;
42 unsigned long TriggerID;
43 unsigned char TriggerType;
44 unsigned short TriggerCell[NChips];
45 unsigned short ROI[NChips][NChannels];
46 unsigned short DAC[NDAC];
47 float Temp[NTemp];
48 struct timeval Update;
49 } Status;
50
51 short Data[NChips][NChannels][NBins];
52 long int Sum[NChips][NChannels][NBins];
53 short Baseline[NChips][NChannels][NBins];
54 double Gain[NChips][NChannels][NBins];
55 double SecondaryBaseline[NChips][NChannels][NBins];
56 float ACalibTemp;
57 time_t ACalibTime;
58
59
60 void Send(const void *, size_t);
61 void Send(unsigned short);
62 struct BoardStatus GetStatus();
63 void AmplitudeCalibration();
64 void Lock();
65 void Unlock();
66
67 char *Name;
68 bool InitOK;
69 bool CommError;
70 bool Active;
71 bool Continue;
72 pthread_cond_t CondVar;
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.