# mainClient.cpp File Reference

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

Go to the source code of this file.

## Functions
int | dataCallback (detectorData *pData, int iframe, int isubframe, 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

g++ mainClient.cpp -L lib -lSlsDetector -L/usr/lib64/ -L lib2 -lzmq -pthread -lrt -lm -lstdc++

where,

lib is the location of libSlsDetector.so

lib2 is the location of the libzmq.a. [ libzmq.a is required only when using data call backs and enabling data streaming from receiver to client. It is linked in manual/manual-api from slsReceiverSoftware/include ]

Definition in file mainClient.cpp.

## Function Documentation

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

Data Call back function defined

Parameters:

  | pData | pointer to data structure received from the call back
  | iframe | frame number of data passed
  | isubframe | sub frame number of data passed ( only valid for EIGER in 32 bit mode)
  | pArg | pointer to object

Returns:
  integer that is currently ignored

Definition at line 32 of file mainClient.cpp.

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

Example of a main program using the slsDetectorUsers class

- Arguments are optional
  - argv[1] : Configuration File
  - argv[2] : Measurement Setup File
  - argv[3] : Detector Id (default is zero)

- if specified, set ID from argv[3]

- slsDetectorUsers Object is instantiated with appropriate ID

- if specified, load configuration file (necessary at least the first time it is called to properly configure advanced settings in the shared memory)

- registering data callback

- if receiver exists, enable data streaming from receiver to get the data

- ensuring detector status is idle before starting acquisition. exiting if not idle

- if provided, load detector settings

- start measurement

- returning when acquisition is finished or data are avilable

- delete slsDetectorUsers object

Definition at line 46 of file mainClient.cpp.

All Classes Files Functions Variables Defines