- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# mainClient.cpp File Reference

`#include <iostream>`
`#include "slsDetectorUsers.h"`
`#include "detectorData.h"`

Go to the source code of this file.

## Functions
int | dataCallback (detectorData *pData, int iframe, void *pArg)
int | main (int argc, char *argv[])

## Detailed Description

This file is an example of how to implement the slsDetectorUsers class You can compile it linking it to the slsDetector library

gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread

where lib is the location of libSlsDetector.so

Definition in file mainClient.cpp.

## Function Documentation

int dataCallback | ( | detectorData * | pData,
|  | int | iframe,
|  | void * | pArg |
| ) |  |  |

Definition of the data callback which simply prints out the number of points received and teh frame number

Definition at line 19 of file mainClient.cpp.

References detectorData::npoints, and detectorData::npy.

Referenced by main().

int main | ( | int | argc,
|  | char * | argv[] |
| ) |  |  |

example of a main program using the slsDetectorUsers class

if specified, argv[2] is used as detector ID (default is 0)

slsDetectorUsers is instantiated

if specified, argv[1] is used as detector config file (necessary at least the first time it is called to properly configure advanced settings in the shared memory)

Setting the detector online (should be by default

Load setup file if argv[2] specified

defining the detector size

registering data callback

checking detector status and exiting if not idle

checking and setting detector settings

Settings exposure time to 10ms

Settings exposure time to 100ms

Settingsnumber of frames to 30

start measurement

returning when acquisition is finished or data are avilable

Definition at line 26 of file mainClient.cpp.

References dataCallback(), slsDetectorUsers::getCommand(), slsDetectorUsers::getDetectorDeveloper(), slsDetectorUsers::getDetectorSettings(), slsDetectorUsers::getDetectorSize(), slsDetectorUsers::getDetectorStatus(), slsDetectorUsers::readConfigurationFile(), slsDetectorUsers::registerDataCallback(), slsDetectorUsers::retrieveDetectorSetup(), slsDetectorUsers::runStatusType(), slsDetectorUsers::setDetectorSize(), slsDetectorUsers::setExposurePeriod(), slsDetectorUsers::setExposureTime(), slsDetectorUsers::setNumberOfFrames(), slsDetectorUsers::setOnline(), slsDetectorUsers::setSettings(), and slsDetectorUsers::startMeasurement().