My Project
Main Page
Files
File List
File Members
All
Files
Functions
Variables
Macros
mainClient.cpp
Go to the documentation of this file.
1
19
#include "slsDetectorUsers.h"
20
#include "detectorData.h"
21
#include <iostream>
22
#include <cstdlib>
23
32
int
dataCallback
(detectorData *pData,
int
iframe,
int
isubframe,
void
*pArg)
33
{
34
std::cout <<
" DataCallback:"
35
<<
"\n nx : "
<< pData->npoints
36
<<
"\n ny : "
<< pData->npy
37
<<
"\n Frame number : "
<< iframe << std::endl;
38
}
39
40
49
int
main
(
int
argc,
char
**argv) {
51
int
id
=0;
52
if
(argc>=4)
53
id
=atoi(argv[3]);
54
55
57
int
ret = 1;
58
slsDetectorUsers *pDetector =
new
slsDetectorUsers (ret,
id
);
59
if
(ret == 1) {
60
std::cout <<
"Error: Could not instantiate slsDetectorUsers"
<< std::endl;
61
return
EXIT_FAILURE;
62
}
63
64
66
if
(argc>=2){
67
pDetector->readConfigurationFile(argv[1]);
68
std::cout <<
"Detector configured"
<< std::endl;
69
}
70
72
pDetector->setOnline(1);
73
75
pDetector->setReceiverOnline(1);
76
78
pDetector->registerDataCallback(&
dataCallback
, NULL);
79
80
82
int
status = pDetector->getDetectorStatus();
83
if
(status != 0){
84
std::cout <<
"Detector not ready: "
<< slsDetectorUsers::runStatusType(status) << std::endl;
85
return
1;
86
}
87
89
if
(argc>=3){
90
pDetector->retrieveDetectorSetup(argv[2]);
91
std::cout <<
"Detector measurement set-up done"
<< std::endl;
92
}
93
94
96
pDetector->startMeasurement();
97
std::cout <<
"measurement finished"
<< std::endl;
98
102
delete
pDetector;
103
104
return
0;
105
}
106
main
int main(int argc, char **argv)
Definition:
mainClient.cpp:49
dataCallback
int dataCallback(detectorData *pData, int iframe, int isubframe, void *pArg)
Definition:
mainClient.cpp:32
Generated by
1.8.5