FrelonModel.h 3.44 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
#ifndef FRELONMODEL_H
#define FRELONMODEL_H

#include "Frelon.h"

namespace lima
{

namespace Frelon
{

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
class Firmware
{
	DEB_CLASS_NAMESPC(DebModCamera, "Firmware", "Frelon");

 public:
	Firmware();
	Firmware(const std::string& ver);
	~Firmware();

	void setVersionStr(const std::string& ver);
	void getVersionStr(std::string& ver) const;

	void reset();
	bool isValid() const;

	int getMajor() const; 
	int getMinor() const;
	std::string getRelease() const;

52
	static const Firmware v2_0c;
53 54
	static const Firmware v2_1b;
	static const Firmware v3_0i;
55
	static const Firmware v3_1c;
56

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
 private:
	void checkValid();

	int m_major;
	int m_minor;
	std::string m_rel;
};

inline bool operator ==(const Firmware& f1, const Firmware& f2)
{
	return ((f1.getMajor() == f2.getMajor()) && 
		(f1.getMinor() == f2.getMinor()) &&
		(f1.getRelease() == f2.getRelease()));
}

inline bool operator !=(const Firmware& f1, const Firmware& f2)
{
	return !(f1 == f2);
}

inline bool operator <(const Firmware& f1, const Firmware& f2)
{
	if (f1.getMajor() < f2.getMajor())
		return true;
	if (f1.getMajor() > f2.getMajor())
		return false;
	if (f1.getMinor() < f2.getMinor())
		return true;
	if (f1.getMinor() > f2.getMinor())
		return false;
	return (f1.getRelease() < f2.getRelease());
}

inline bool operator >(const Firmware& f1, const Firmware& f2)
{
	return !((f1 == f2) || (f1 < f2));
}

inline bool operator <=(const Firmware& f1, const Firmware& f2)
{
	return ((f1 == f2) || (f1 < f2));
}

inline bool operator >=(const Firmware& f1, const Firmware& f2)
{
	return !(f1 < f2);
}


106 107 108 109 110 111 112 113
class Model
{
	DEB_CLASS_NAMESPC(DebModCamera, "Model", "Frelon");

 public:
	Model();
	~Model();

114
	void setVersionStr(const std::string& ver);
115
	const Firmware& getFirmware();
116 117 118 119 120 121 122 123 124 125 126 127

	void setComplexSerialNb(int  complex_ser_nb);
	void getComplexSerialNb(int& complex_ser_nb);

	void reset();
	bool isValid();

	int  getSerialNb();
	bool isSPB1();
	bool isSPB2();
	int  getAdcBits();
	ChipType getChipType();
128
	bool isHama();
129
	bool hasTaper();
130 131
	bool hasModesAvail();
	bool hasTimeCalc();
132
	bool hasHTDCmd();
133
	bool hasGoodHTD();
134
	bool hasImagesPerEOF();
135 136 137 138 139 140

	double getPixelSize();

	std::string getName();

 private:
141
	void update();
142 143 144
	void checkValid();
	int getSerialNbParam(SerNbParam param);

145
	Firmware m_firmware;
146
	int m_complex_ser_nb;
147 148 149

	bool     m_valid;
	ChipType m_chip_type;
150
	bool     m_is_hama;
151 152
	bool     m_modes_avail;
	bool     m_time_calc;
153
	bool     m_htd_cmd;
154
	bool     m_good_htd;
155
	bool     m_images_per_eof;
156 157 158 159 160 161 162 163 164
};


} // namespace Frelon

} // namespace lima


#endif // FRELONMODEL_H