My Project
 All Classes Files Functions Variables Macros
Functions
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
pDatapointer to data structure received from the call back
iframeframe number of data passed
isubframesub frame number of data passed ( only valid for EIGER in 32 bit mode)
pArgpointer 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)
  • set detector in shared memory online (in case no config file was used)
  • set receiver in shared memory online (in case no config file was used)
  • registering data callback
  • 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 49 of file mainClient.cpp.