included more options in user client example, included these in the Makefile

This commit is contained in:
Maliakal Dhanya 2014-05-23 14:46:15 +02:00
parent 6a3ee7fa77
commit 188697b6da
3 changed files with 41 additions and 30 deletions

View File

@ -1,11 +1,28 @@
DESTDIR?=../docs
INCLUDES = -I .
SRC_DET = mainClient.cpp
SRC_REC = mainReceiver.cpp
LIBDIR = ../../bin
LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
DESTDIR ?= ../docs
#all: clean detUser detReceiver
all: docs
all:
docs:
doxygen slsDetectorUsers.doxy
detUser:$(SRC_DET)
echo "creating client"
g++ -o detUser $(SRC_DET) $(INCLUDES) $(LDFLAG_DET) -lm -lstdc++
detReceiver:$(SRC_REC)
echo "creating receiver"
g++ -o detReceiver $(SRC_REC) $(INCLUDES) $(LDFLAG_REC) -lm -lstdc++
clean:
rm -rf slsDetectorUsers
echo "cleaning"
rm -rf detUser detReceiver slsDetectorUsersDocs

View File

@ -14,6 +14,7 @@ where lib is the location of libSlsDetector.so
#include "slsDetectorUsers.h"
#include "detectorData.h"
/** Definition of the data callback which simply prints out the number of points received and teh frame number */
int dataCallback(detectorData *pData, int iframe, void *pArg)
{
@ -22,8 +23,9 @@ int dataCallback(detectorData *pData, int iframe, void *pArg)
/**example of a main program using the slsDetectorUsers class */
int main(int argc, char **argv) {
int main(int argc, char *argv[]) {
int id=0;
int status;
/** if specified, argv[2] is used as detector ID (default is 0)*/
if (argc>=3)
id=atoi(argv[2]);
@ -40,6 +42,11 @@ int main(int argc, char **argv) {
/** Setting the detector online (should be by default */
pDetector->setOnline(1);
/** Load setup file if argv[2] specified */
if (argc>=3)
pDetector->retrieveDetectorSetup( argv[2]);
else{
/** defining the detector size */
int minX, minY=0, sizeX, sizeY=1;
pDetector->getDetectorSize(minX, minY, sizeX, sizeY);
@ -52,7 +59,7 @@ int main(int argc, char **argv) {
pDetector->registerDataCallback(&dataCallback, NULL);
/** checking detector status and exiting if not idle */
int status = pDetector->getDetectorStatus();
status = pDetector->getDetectorStatus();
if (status != 0){
std::cout << "Detector not ready: " << slsDetectorUsers::runStatusType(status) << std::endl;
return 1;
@ -60,7 +67,7 @@ int main(int argc, char **argv) {
/** checking and setting detector settings */
std::cout << "settings: " << slsDetectorUsers::getDetectorSettings(pDetector->setSettings()) << std::endl;
pDetector->setSettings(slsDetectorUsers::getDetectorSettings("standard"));
pDetector->setSettings(slsDetectorUsers::getDetectorSettings("veryhighgain"));
std::cout << "settings: " << slsDetectorUsers::getDetectorSettings(pDetector->setSettings()) << std::endl;
/** Settings exposure time to 10ms */
@ -71,7 +78,7 @@ int main(int argc, char **argv) {
/** Settingsnumber of frames to 30 */
pDetector->setNumberOfFrames(30);
}
/** start measurement */
pDetector->startMeasurement();
@ -81,8 +88,10 @@ int main(int argc, char **argv) {
if (status == 0 || status == 1|| status == 3)
break;
}
/** returning when acquisition is finished or data are avilable */
char *temp[] = {"rx_tcpport", "1957", NULL};
/** returning when acquisition is finished or data are avilable */
std::cout << "answer to a get command:" << pDetector->putCommand(2,temp,0) << std::endl;
delete pDetector;

View File

@ -18,21 +18,9 @@ where lib is the location of libSlsDetector.so
#include "slsReceiverUsers.h"
#include <signal.h> //SIGINT
#include <cstdlib> //EXIT
#include <iostream>
using namespace std;
/**
close file if receiver process is interrupted
*/
void closeFile(int p){
cout<<"close file in receiver"<<endl;
slsReceiverUsers::closeFile(p);
exit(0);
}
int main(int argc, char *argv[]) {
int ret = 0;
@ -51,9 +39,6 @@ int main(int argc, char *argv[]) {
return -1;
/* Catch signal SIGINT to close files properly */
signal(SIGINT,closeFile);
/*register callbacks */