Line | |
---|
1 | #ifndef COSY_Camera
|
---|
2 | #define COSY_Camera
|
---|
3 |
|
---|
4 | #ifndef ROOT_TMutex
|
---|
5 | #include <TMutex.h>
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TCondition
|
---|
8 | #include <TCondition.h>
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #ifdef __CINT__
|
---|
12 | typedef unsigned long int pthread_t;
|
---|
13 | struct timeval;
|
---|
14 | #else
|
---|
15 | #include <unistd.h>
|
---|
16 | #include <sys/time.h>
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | #include "PixGetter.h"
|
---|
20 | #include "PixClient.h"
|
---|
21 |
|
---|
22 | class Camera : public PixGetter
|
---|
23 | {
|
---|
24 | private:
|
---|
25 | //
|
---|
26 | // Geometry
|
---|
27 | //
|
---|
28 | static const int cols = 768;
|
---|
29 | static const int rows = 576;
|
---|
30 | static const int depth = 3;
|
---|
31 |
|
---|
32 | //
|
---|
33 | // Hardware Descriptors
|
---|
34 | //
|
---|
35 | int fd;
|
---|
36 | int iBufferSize;
|
---|
37 | int iOffsets[2];
|
---|
38 |
|
---|
39 | char *pMapBuffer;
|
---|
40 |
|
---|
41 | //
|
---|
42 | // Thread interface
|
---|
43 | //
|
---|
44 | unsigned long fNum;
|
---|
45 |
|
---|
46 | int fStop;
|
---|
47 | // int fRunning;
|
---|
48 |
|
---|
49 | char fImg[cols*rows];
|
---|
50 | struct timeval fTime;
|
---|
51 |
|
---|
52 | PixClient &fClient;
|
---|
53 |
|
---|
54 | pthread_t fThread;
|
---|
55 | TCondition fCond;
|
---|
56 | TMutex *fMutex;
|
---|
57 | //pthread_mutex_t fMux;
|
---|
58 | //pthread_cond_t fCond;
|
---|
59 |
|
---|
60 | //
|
---|
61 | // Hardware dependant functions
|
---|
62 | //
|
---|
63 | static void SigAlarm(int signal);
|
---|
64 |
|
---|
65 | int Ioctl(int req, void *opt, const char *str=NULL);
|
---|
66 |
|
---|
67 | void SigInit();
|
---|
68 | void Error(const char *str, int fatal=true);
|
---|
69 |
|
---|
70 | int StartGrab(unsigned int frame);
|
---|
71 |
|
---|
72 | char *GetImg(unsigned int frame);
|
---|
73 |
|
---|
74 | //
|
---|
75 | // Execution thread which processes the pictures
|
---|
76 | //
|
---|
77 | void Thread();
|
---|
78 | static void *MapThread(void *arg);
|
---|
79 |
|
---|
80 | void LoopStep(const unsigned long n);
|
---|
81 |
|
---|
82 | public:
|
---|
83 | Camera(PixClient &client, Int_t ch=0);
|
---|
84 | virtual ~Camera();
|
---|
85 |
|
---|
86 | //
|
---|
87 | // Starts, stops the execution
|
---|
88 | //
|
---|
89 | void Loop(const unsigned long nof=0);
|
---|
90 | void ExitLoop();
|
---|
91 | int IsRunning() const;
|
---|
92 |
|
---|
93 | //
|
---|
94 | // Execution of one frame - this function may be overloaded!
|
---|
95 | //
|
---|
96 | //virtual void ProcessFrame(const unsigned long n,
|
---|
97 | // byte *img, struct timeval *tm);
|
---|
98 |
|
---|
99 | //
|
---|
100 | // hardware features
|
---|
101 | //
|
---|
102 | void SetPicPar(int bright, int hue, int contrast);
|
---|
103 | void GetPicPar(int *bright, int *hue, int *contrast);
|
---|
104 |
|
---|
105 | ClassDef(Camera, 0)
|
---|
106 | };
|
---|
107 |
|
---|
108 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.