SlsDetectorInterface.h 6.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//###########################################################################
// 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/>.
//###########################################################################
#ifndef SLSDETECTORINTERFACE_H
#define SLSDETECTORINTERFACE_H

#include "lima/HwInterface.h"
26
#include "SlsDetectorCamera.h"
27
#include "SlsDetectorReconstruction.h"
28
29
30
31

namespace lima
{

32
namespace SlsDetector
33
34
35
36
37
38
39
40
41
42
43
{

class Interface;

/*******************************************************************
 * \class EventCallback
 * \brief Bridge class transfering events from Acq -> HwEventCtrlObj
 *******************************************************************/

class EventCallback : public lima::EventCallback
{
44
	DEB_CLASS_NAMESPC(DebModCamera, "EventCallback", "SlsDetector");
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

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

 protected:
	virtual void processEvent(Event *event);

 private:
	HwEventCtrlObj& m_ctrl_obj;
};


/*******************************************************************
 * \class DetInfoCtrlObj
60
 * \brief Control object providing SlsDetector detector info interface
61
62
63
64
 *******************************************************************/

class DetInfoCtrlObj : public HwDetInfoCtrlObj
{
65
	DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "SlsDetector");
66
67

 public:
68
	DetInfoCtrlObj(Camera& cam);
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	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);

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

	virtual void registerMaxImageSizeCallback(
					HwMaxImageSizeCallback& cb);
	virtual void unregisterMaxImageSizeCallback(
					HwMaxImageSizeCallback& cb);

 private:
88
	Camera& m_cam;
89
90
91
92
93
};


/*******************************************************************
 * \class SyncCtrlObj
94
 * \brief Control object providing SlsDetector synchronization interface
95
96
97
98
 *******************************************************************/

class SyncCtrlObj : public HwSyncCtrlObj
{
99
	DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "SlsDetector");
100
101

 public:
102
	SyncCtrlObj(Camera& cam);
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
	virtual ~SyncCtrlObj();

	virtual bool checkTrigMode(TrigMode trig_mode);
	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);

	virtual void setNbHwFrames(int  nb_frames);
	virtual void getNbHwFrames(int& nb_frames);

	virtual void getValidRanges(ValidRangesType& valid_ranges);

120
121
122
	typedef std::map<TrigMode, Camera::TrigMode> TrigModeMap;
	static TrigModeMap Lima2CamTrigModeMap;

123
 private:
124
	class TimeRangesChangedCallback : 
125
				public SlsDetector::TimeRangesChangedCallback
126
127
128
129
130
131
	{
		DEB_CLASS_NAMESPC(DebModCamera, "TimeRangesChangedCallback", 
				  "SlsDetector::SynCtrlObj");
	public:
		TimeRangesChangedCallback(SyncCtrlObj *sync);
	protected:
132
		virtual void timeRangesChanged(TimeRanges time_ranges);
133
134
135
136
137
	private:
		friend class SyncCtrlObj;
		SyncCtrlObj *m_sync;
	};

138
	Camera& m_cam;
139
	TimeRangesChangedCallback m_time_ranges_cb;
140
141
142
143
144
};


/*******************************************************************
 * \class EventCtrlObj
145
 * \brief Control object providing SlsDetector event interface
146
147
148
149
 *******************************************************************/

class EventCtrlObj : public HwEventCtrlObj
{
150
	DEB_CLASS_NAMESPC(DebModCamera, "EventCtrlObj", "SlsDetector");
151
152
153
154
155
156

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

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

/*******************************************************************
 * \class ReconstructionCtrlObj
 * \brief Control object providing SlsDetector reconstruction
 *******************************************************************/

class ReconstructionCtrlObj : public HwReconstructionCtrlObj
{
	DEB_CLASS_NAMESPC(DebModCamera, "ReconstructionCtrlObj", "SlsDetector");

public:
	void setReconstruction(Reconstruction *r);

	virtual LinkTask *getReconstructionTask();

private:
	class Proxy : public Reconstruction::CtrlObjProxy {
		DEB_CLASS_NAMESPC(DebModCamera, "ReconstructionCtrlObj::Proxy",
				  "SlsDetector");
	public:
		typedef ReconstructionCtrlObj Owner;

		Proxy(Owner *owner, Reconstruction *r);

		virtual void reconstructionChange(LinkTask *task);

	private:
		Owner *m_owner;
	};

	AutoPtr<Proxy> m_proxy;
};


191
192
/*******************************************************************
 * \class Interface
193
 * \brief SlsDetector hardware interface
194
195
196
197
 *******************************************************************/

class Interface : public HwInterface
{
198
	DEB_CLASS_NAMESPC(DebModCamera, "Interface", "SlsDetector");
199
200

 public:
201
	Interface(Camera& cam);
202
	Interface(const Interface& o) = delete;
203
204
205
206
207
208
209
210
211
212
213
214
215
	virtual ~Interface();

	virtual void getCapList(CapList&) const;

	virtual void reset(ResetLevel reset_level);
	virtual void prepareAcq();
	virtual void startAcq();
	virtual void stopAcq();
	virtual void getStatus(StatusType& status);
	virtual int getNbHwAcquiredFrames();

	void resetDefaults();

216
217
	void setReconstruction(Reconstruction *r);

218
 private:
219
	Camera& m_cam;
220

221
222
	CapList m_cap_list;
	DetInfoCtrlObj m_det_info;
223
	BufferCtrlObj m_buffer;
224
225
	SyncCtrlObj m_sync;
	EventCtrlObj m_event;
226
	ReconstructionCtrlObj m_reconstruction;
227

228
	SlsDetector::EventCallback  m_event_cb;
229
230
231
232
233
};




234
} // namespace SlsDetector
235
236
237
238

} // namespace lima

#endif // SLSDETECTORINTERFACE_H