Frelon.h 1.62 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
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef FRELON_H
#define FRELON_H

#include "EspiaSerialLine.h"
#include <string>
#include <map>

namespace lima
{

class Frelon
{
 public:
	enum Reg {
		NrFrames,	ExpTime,	ShutCloseTime,	LatencyTime,
		RoiLineBegin,	RoiLineWidth,	RoiPixelBegin,	RoiPixelWidth,
		ChanMode,	TimeUnit,	RoiEnable,	RoiFast, 
		AntiBloom,	BinVert,	BinHorz,	ConfigHD,
		RoiKinetic,	ShutEnable,	HardTrigDisable,
		PixelFreq,	LineFreq,	Flip,		IntCalib,
		DisplayImage,	AdcFloatDiode,	AdcSignal,	
		DarkPixelCalib,	DarkPixelMode,	ChanControl,	Mire,
		AoiLineBegin,	AoiLineWidth,	AoiPixelBegin,	AoiPixelWidth,
		AoiImageHeight,	AoiImageWidth,	ChanOnImage,	ChanOnCcd,
		Version,	SerNr,		Warn,
	};

	enum Cmd {
		Reset,		Start,		Stop,		Save,
	};

	enum MultiLineCmd {
		Help,		Config,		Dac,		Volt,
		Aoi,
	};

	class SerialLine : public HwSerialLine
	{
	public:
		enum MsgPart {
			MsgSync, MsgCmd, MsgVal, MsgReq, MsgTerm, 
		};

44
45
46
		static const double TimeoutSingle, TimeoutNormal, TimeoutMax, 
				    TimeoutReset;

47
48
49
50
51
		SerialLine(EspiaSerialLine& espia_ser_line);
	
		virtual void write(const std::string& buffer, 
				   bool no_wait = false);
		virtual void read(std::string& buffer, int len, 
52
				  double timeout = TimeoutDefault);
53
		virtual void readStr(std::string& buffer, int len, 
54
				     double timeout = TimeoutDefault);
55
56
57
58

		virtual void getNumAvailBytes(int &avail);

		void splitMsg(const std::string& msg, 
59
			      std::map<MsgPart, std::string>& msg_parts) const;
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

	private:
		EspiaSerialLine& m_espia_ser_line;
		bool m_multi_line_cmd;
	};


	Frelon(EspiaSerialLine& espia_ser_line);


 private:
	SerialLine m_ser_line;
};


} // namespace lima

#endif // FRELON_H