testsimulator.cpp 1.3 KB
Newer Older
1
2
3
4
5
6
7
#include "Simulator.h"

#include <iostream>

using namespace lima;
using namespace std;

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class TestFrameCallback : public HwFrameCallback
{
public:
	TestFrameCallback(Simulator& simu) : m_simu(simu) {}
protected:
	virtual bool newFrameReady(const FrameInfoType& frame_info);
private:
	Simulator& m_simu;
};

bool TestFrameCallback::newFrameReady(const FrameInfoType& frame_info)
{
	cout << "acq_frame_nb=" << frame_info.acq_frame_nb  << ", "
	     << "ts=" << frame_info.frame_timestamp << ", "
	     << "simu=" << m_simu  << endl;
	return true;
}


27
28
29
int main(int argc, char *argv[])
{
	Simulator simu;
30
31
32
33
34
35
36
37
38
	TestFrameCallback cb(simu);

	FrameDim frame_dim;
	simu.getFrameDim(frame_dim);

	BufferCtrlMgr& buffer_mgr = simu.getBufferMgr();
	buffer_mgr.setFrameDim(frame_dim);
	buffer_mgr.setNbBuffers(1);
	buffer_mgr.registerFrameCallback(&cb);
39
40
41
42
43
44
45

	cout << "simu=" << simu << endl;
	simu.startAcq();
	cout << "simu=" << simu << endl;
	simu.stopAcq();
	cout << "simu=" << simu << endl;

kirov's avatar
kirov committed
46
47
48
49
50
51
52
53
	simu.setExpTime(5);

	cout << "simu=" << simu << endl;
	simu.startAcq();
	cout << "simu=" << simu << endl;
	simu.stopAcq();
	cout << "simu=" << simu << endl;

54
55
56
57
58
59
60
61
62
	simu.setExpTime(2);
	simu.setNbFrames(3);

	cout << "simu=" << simu << endl;
	simu.startAcq();
	cout << "simu=" << simu << endl;
	simu.stopAcq();
	cout << "simu=" << simu << endl;

63
64
	return 0;
}