SlsDetectorModel.cpp 2.92 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
26
27
28
29
30
//###########################################################################
// 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/>.
//###########################################################################

#include "SlsDetectorCamera.h"

using namespace std;
using namespace lima;
using namespace lima::SlsDetector;


Model::Model(Camera *cam, Type type)
31
	: m_cam(cam), m_type(type), m_det(m_cam->m_det)
32
33
34
{
	DEB_CONSTRUCTOR();
	DEB_PARAM() << DEB_VAR1(type);
35
36

	m_nb_det_modules = m_cam->getNbDetModules();
37
38
39
40
	sls::Result<int> res;
	EXC_CHECK(res = m_det->getNumberofUDPInterfaces());
	const char *err_msg = "Numbers of UDP interfaces are different";
	EXC_CHECK(m_nb_udp_ifaces = res.tsquash(err_msg));
41
42
43
44
45
46
47
48
49
50
51
52
53
}

Model::~Model()
{
	DEB_DESTRUCTOR();

	if (m_cam)
		m_cam->setModel(NULL);
}

void Model::updateCameraModel()
{
	DEB_MEMBER_FUNCT();
54
	m_cam->setModel(this);
55
56
}

57
58
59
60
61
62
void Model::updateCameraImageSize()
{
	DEB_MEMBER_FUNCT();
	m_cam->updateImageSize();
}

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
void Model::setNbUDPInterfaces(int nb_udp_ifaces)
{
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR1(nb_udp_ifaces);
	if (nb_udp_ifaces != m_nb_udp_ifaces)
		THROW_HW_ERROR(NotSupported)
			<< "Invalid number of UDP interfaces: " << nb_udp_ifaces
			<< ", only " << m_nb_udp_ifaces << " supported";
}

void Model::getNbUDPInterfaces(int& nb_udp_ifaces)
{
	DEB_MEMBER_FUNCT();
	nb_udp_ifaces = m_nb_udp_ifaces;
	DEB_RETURN() << DEB_VAR1(nb_udp_ifaces);
}


81
void Model::updateCameraTimeRanges()
82
83
84
85
86
{
	DEB_MEMBER_FUNCT();
	m_cam->updateTimeRanges();
}

87
88
89
90
91
92
93
94
95
96
97
98
void Model::putCmd(const string& s, int idx)
{
	DEB_MEMBER_FUNCT();
	m_cam->putCmd(s, idx);
}

string Model::getCmd(const string& s, int idx)
{
	DEB_MEMBER_FUNCT();
	return m_cam->getCmd(s, idx);
}

99
100
101
102
103
BufferMgr *Model::getBuffer()
{
	return m_cam->getBuffer();
}

104
void Model::getAcqFrameDim(FrameDim& frame_dim, bool raw)
105
{
106
107
108
109
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR1(raw);
	getFrameDim(frame_dim, raw);
	DEB_RETURN() << DEB_VAR1(frame_dim);
110
}
111

112
113
#include "SlsDetectorReceiver.h"

114
115
116
117
118
119
120
bool Model::isAcqActive()
{
	DEB_MEMBER_FUNCT();
	bool acq_active = (m_cam->getDetStatus() == Defs::Running);
	DEB_RETURN() << DEB_VAR1(acq_active);
	return acq_active;
}
121
122
123
124
125
126

Reconstruction *Model::getReconstruction()
{
	DEB_MEMBER_FUNCT();
	return NULL;
}