- Main Page
- Classes
- Files

- File List
- File Members

# mainClient.cpp

Go to the documentation of this file.

    00001
    00019 #include "slsDetectorUsers.h"
    00020 #include "detectorData.h"
    00021 #include <iostream>
    00022 #include <cstdlib>
    00023
    00032 int dataCallback(detectorData *pData, int iframe, int isubframe, void *pArg)
    00033 {
    00034         std::cout  << "dataCallback: " << pData->npoints  << " "  << pData->npy  << "Frame number: " << iframe << std::endl;
    00035 }
    00036
    00037
    00046 int main(int argc,  char **argv) {
    00048         int id=0;
    00049         if (argc>=4)
    00050                 id=atoi(argv[3]);
    00051
    00052
    00054         slsDetectorUsers *pDetector = new  slsDetectorUsers (id);
    00055
    00056
    00058         if (argc>=2){
    00059                 pDetector->readConfigurationFile(argv[1]);
    00060                 std::cout << "Detector configured" << std::endl;
    00061         }
    00062
    00063
    00065         pDetector->registerDataCallback(&dataCallback, NULL);
    00067         pDetector->enableDataStreamingFromReceiver(1);
    00068
    00069
    00071         int status = pDetector->getDetectorStatus();
    00072         if (status  !=  0){
    00073                 std::cout << "Detector not ready: " << slsDetectorUsers::runStatusType(status) << std::endl;
    00074                 return 1;
    00075         }
    00076
    00078         if (argc>=3){
    00079                 pDetector->retrieveDetectorSetup(argv[2]);
    00080                 std::cout << "Detector measurement set-up done" << std::endl;
    00081         }
    00082
    00083
    00085         pDetector->startMeasurement();
    00086         std::cout << "measurement finished" << std::endl;
    00087
    00091         delete pDetector;
    00092
    00093         return 0;
    00094 }
    00095

All Classes Files Functions Variables Defines