FrelonInterface.h 10.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef FRELONINTERFACE_H
#define FRELONINTERFACE_H

#include "HwInterface.h"
#include "EspiaBufferMgr.h"
#include "FrelonCamera.h"

namespace lima
{

namespace Frelon
{

class Interface;

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*******************************************************************
 * \class AcqEndCallback
 * \brief Class executing camera commands at the end of acq.
 *******************************************************************/

class AcqEndCallback : public Espia::AcqEndCallback
{
	DEB_CLASS_NAMESPC(DebModCamera, "AcqEndCallback", "Frelon");

 public:
	AcqEndCallback(Camera& cam);
	virtual ~AcqEndCallback();

 protected:
	virtual void acqFinished(const HwFrameInfoType& /*finfo*/);

 private:
	Camera& m_cam;
};


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*******************************************************************
 * \class EventCallback
 * \brief Bridge class transfering events from Acq -> HwEventCtrlObj
 *******************************************************************/

class EventCallback : public lima::EventCallback
{
	DEB_CLASS_NAMESPC(DebModCamera, "EventCallback", "Frelon");

 public:
	EventCallback(HwEventCtrlObj& ctrl_obj);
	virtual ~EventCallback();

 protected:
	virtual void processEvent(Event *event);

 private:
	HwEventCtrlObj& m_ctrl_obj;
};


79
80
81
82
83
84
85
/*******************************************************************
 * \class DetInfoCtrlObj
 * \brief Control object providing Frelon detector info interface
 *******************************************************************/

class DetInfoCtrlObj : public HwDetInfoCtrlObj
{
86
87
	DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "Frelon");

88
89
90
91
92
93
94
95
96
97
98
 public:
	DetInfoCtrlObj(Camera& cam);
	virtual ~DetInfoCtrlObj();

	virtual void getMaxImageSize(Size& max_image_size);
	virtual void getDetectorImageSize(Size& det_image_size);

	virtual void getDefImageType(ImageType& def_image_type);
	virtual void getCurrImageType(ImageType& curr_image_type);
	virtual void setCurrImageType(ImageType  curr_image_type);

99
	virtual void getPixelSize(double& x_size, double& y_size);
100
101
102
	virtual void getDetectorType(std::string& det_type);
	virtual void getDetectorModel(std::string& det_model);

ahoms's avatar
ahoms committed
103
104
105
106
	virtual void registerMaxImageSizeCallback(
					HwMaxImageSizeCallback& cb);
	virtual void unregisterMaxImageSizeCallback(
					HwMaxImageSizeCallback& cb);
107
108
109
110
111
112
113
114
115
116
117
118
119

 private:
	Camera& m_cam;
};


/*******************************************************************
 * \class BufferCtrlObj
 * \brief Control object providing Frelon buffering interface
 *******************************************************************/

class BufferCtrlObj : public HwBufferCtrlObj
{
120
121
	DEB_CLASS_NAMESPC(DebModCamera, "BufferCtrlObj", "Frelon");

122
123
124
125
126
 public:
	BufferCtrlObj(BufferCtrlMgr& buffer_mgr);
	virtual ~BufferCtrlObj();

	virtual void setFrameDim(const FrameDim& frame_dim);
127
	virtual void getFrameDim(      FrameDim& frame_dim);
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

	virtual void setNbBuffers(int  nb_buffers);
	virtual void getNbBuffers(int& nb_buffers);

	virtual void setNbConcatFrames(int  nb_concat_frames);
	virtual void getNbConcatFrames(int& nb_concat_frames);

	virtual void getMaxNbBuffers(int& max_nb_buffers);

	virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
	virtual void *getFramePtr(int acq_frame_nb);

	virtual void getStartTimestamp(Timestamp& start_ts);
	virtual void getFrameInfo(int acq_frame_nb, HwFrameInfoType& info);

	virtual void   registerFrameCallback(HwFrameCallback& frame_cb);
	virtual void unregisterFrameCallback(HwFrameCallback& frame_cb);

 private:
	BufferCtrlMgr& m_buffer_mgr;
};


/*******************************************************************
 * \class SyncCtrlObj
 * \brief Control object providing Frelon synchronization interface
 *******************************************************************/

class SyncCtrlObj : public HwSyncCtrlObj
{
158
159
	DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "Frelon");

160
 public:
161
	SyncCtrlObj(Espia::Acq& acq, Camera& cam);
162
163
	virtual ~SyncCtrlObj();

164
	virtual bool checkTrigMode(TrigMode trig_mode);
165
166
167
168
169
170
171
172
173
	virtual void setTrigMode(TrigMode  trig_mode);
	virtual void getTrigMode(TrigMode& trig_mode);

	virtual void setExpTime(double  exp_time);
	virtual void getExpTime(double& exp_time);

	virtual void setLatTime(double  lat_time);
	virtual void getLatTime(double& lat_time);

174
175
	virtual void setNbHwFrames(int  nb_frames);
	virtual void getNbHwFrames(int& nb_frames);
176
177
178
179
180
181
182
183
184
185
186

	virtual void getValidRanges(ValidRangesType& valid_ranges);

 private:
	Espia::Acq& m_acq;
	Camera& m_cam;
};


/*******************************************************************
 * \class BinCtrlObj
187
 * \brief Control object providing Frelon binning interface
188
189
 *******************************************************************/

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
class BinCtrlObj;

class BinChangedCallback 
{
	DEB_CLASS_NAMESPC(DebModCamera, "BinChangedCallback", "Frelon");

 public:
	BinChangedCallback();
	virtual ~BinChangedCallback();

 protected:
	virtual void hwBinChanged(const Bin& hw_bin) = 0;
	
 private:
	friend class BinCtrlObj;
	BinCtrlObj *m_bin_ctrl_obj;
};


209
210
class BinCtrlObj : public HwBinCtrlObj
{
211
212
	DEB_CLASS_NAMESPC(DebModCamera, "BinCtrlObj", "Frelon");

213
214
215
216
217
218
219
220
 public:
	BinCtrlObj(Camera& cam);
	virtual ~BinCtrlObj();

	virtual void setBin(const Bin& bin);
	virtual void getBin(Bin& bin);
	virtual void checkBin(Bin& bin);

221
222
223
	void registerBinChangedCallback  (BinChangedCallback& bin_chg_cb);
	void unregisterBinChangedCallback(BinChangedCallback& bin_chg_cb);

224
225
 private:
	Camera& m_cam;
226
	BinChangedCallback *m_bin_chg_cb;
227
228
229
};


230
231
232
233
234
/*******************************************************************
 * \class RoiCtrlObj
 * \brief Control object providing Frelon Roi interface
 *******************************************************************/

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
class RoiCtrlObj;

class RoiChangedCallback 
{
	DEB_CLASS_NAMESPC(DebModCamera, "RoiChangedCallback", "Frelon");

 public:
	RoiChangedCallback();
	virtual ~RoiChangedCallback();

 protected:
	virtual void hwRoiChanged(const Roi& hw_roi) = 0;

 private:
	friend class RoiCtrlObj;
	RoiCtrlObj *m_roi_ctrl_obj;
};


254
255
class RoiCtrlObj : public HwRoiCtrlObj
{
256
257
	DEB_CLASS_NAMESPC(DebModCamera, "RoiCtrlObj", "Frelon");

258
 public:
259
	RoiCtrlObj(Espia::Acq& acq, Camera& cam);
260
261
262
263
	virtual ~RoiCtrlObj();

	virtual void setRoi(const Roi& set_roi);
	virtual void getRoi(Roi& hw_roi);
264
265
	virtual void checkRoi(const Roi& set_roi, Roi& hw_roi);

266
267
268
	void registerRoiChangedCallback  (RoiChangedCallback& roi_chg_cb);
	void unregisterRoiChangedCallback(RoiChangedCallback& roi_chg_cb);

269
 private:
270
271
272
273
	void checkEspiaRoi(const Roi& set_roi, Roi& hw_roi, 
			   Size& det_frame_size, Roi& espia_roi);

	Espia::Acq& m_acq;
274
	Camera& m_cam;
275
	RoiChangedCallback *m_roi_chg_cb;
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
};


/*******************************************************************
 * \class FlipCtrlObj
 * \brief Control object providing Frelon flip interface
 *******************************************************************/

class FlipCtrlObj : public HwFlipCtrlObj
{
	DEB_CLASS_NAMESPC(DebModCamera, "FlipCtrlObj", "Frelon");

 public:
	FlipCtrlObj(Camera& cam);
	virtual ~FlipCtrlObj();

	virtual void setFlip(const Flip& flip);
	virtual void getFlip(Flip& flip);
	virtual void checkFlip(Flip& flip);
295
296
297
298
299
300

 private:
	Camera& m_cam;
};


301
302
303
304
305
306
307
308
309
310
311
312
313
/*******************************************************************
 * \class ShutterCtrlObj
 * \brief Control object providing Frelon shutter interface
 *******************************************************************/

class ShutterCtrlObj : public HwShutterCtrlObj
{
	DEB_CLASS(DebModCamera, "ShutterCtrlObj");

public:
	ShutterCtrlObj(Camera& cam);
	virtual ~ShutterCtrlObj();

314
315
316
317
	virtual bool checkMode(ShutterMode shut_mode) const;
	virtual void getModeList(ShutterModeList&  mode_list) const;
	virtual void setMode(ShutterMode  shut_mode);
	virtual void getMode(ShutterMode& shut_mode) const;
318

319
	virtual void setState(bool  shut_open);
320
	virtual void getState(bool& shut_open) const;
321
322

	virtual void setOpenTime (double  shut_open_time);
323
	virtual void getOpenTime (double& shut_open_time) const;
324
	virtual void setCloseTime(double  shut_close_time);
325
	virtual void getCloseTime(double& shut_close_time) const;
326
327
328
329
330

 private:
	Camera& m_cam;
};

331
332
333
334
335
336
337
338
339
340
341
342
343
344
/*******************************************************************
 * \class EventCtrlObj
 * \brief Control object providing Frelon event interface
 *******************************************************************/

class EventCtrlObj : public HwEventCtrlObj
{
	DEB_CLASS(DebModCamera, "EventCtrlObj");

public:
	EventCtrlObj();
	virtual ~EventCtrlObj();
};

345
346
347
348
349
350
351
/*******************************************************************
 * \class Interface
 * \brief Frelon hardware interface
 *******************************************************************/

class Interface : public HwInterface
{
352
353
	DEB_CLASS_NAMESPC(DebModCamera, "Interface", "Frelon");

354
355
356
357
 public:
	Interface(Espia::Acq& acq, BufferCtrlMgr& buffer_mgr, Camera& cam);
	virtual ~Interface();

358
	virtual void getCapList(CapList&) const;
359
360
361
362
363
364

	virtual void reset(ResetLevel reset_level);
	virtual void prepareAcq();
	virtual void startAcq();
	virtual void stopAcq();
	virtual void getStatus(StatusType& status);
365
	virtual int getNbHwAcquiredFrames();
366
367
368
369
370
371
372
373
374
375
376

 private:
	Espia::Acq&    m_acq;
	BufferCtrlMgr& m_buffer_mgr;
	Camera&        m_cam;

	CapList m_cap_list;
	DetInfoCtrlObj m_det_info;
	BufferCtrlObj  m_buffer;
	SyncCtrlObj    m_sync;
	BinCtrlObj     m_bin;
377
	RoiCtrlObj     m_roi;
378
	FlipCtrlObj    m_flip;
379
	ShutterCtrlObj m_shutter;
380
381
382
383
	EventCtrlObj   m_event;

	Frelon::AcqEndCallback m_acq_end_cb;
	Frelon::EventCallback  m_event_cb;
384
385
386
387
388
389
390
391
392
393
};




} // namespace Frelon

} // namespace lima

#endif // FRELONINTERFACE_H