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:" 00035 << "\n nx : " << pData->npoints 00036 << "\n ny : " << pData->npy 00037 << "\n Frame number : " << iframe << std::endl; 00038 } 00039 00040 00049 int main(int argc, char **argv) { 00051 int id=0; 00052 if (argc>=4) 00053 id=atoi(argv[3]); 00054 00055 00057 slsDetectorUsers *pDetector = new slsDetectorUsers (id); 00058 00059 00061 if (argc>=2){ 00062 pDetector->readConfigurationFile(argv[1]); 00063 std::cout << "Detector configured" << std::endl; 00064 } 00065 00067 pDetector->setOnline(1); 00068 00070 pDetector->setReceiverOnline(1); 00071 00073 pDetector->registerDataCallback(&dataCallback, NULL); 00075 pDetector->enableDataStreamingFromReceiver(1); 00077 pDetector->enableDataStreamingToClient(1); 00078 00079 00080 00082 int status = pDetector->getDetectorStatus(); 00083 if (status != 0){ 00084 std::cout << "Detector not ready: " << slsDetectorUsers::runStatusType(status) << std::endl; 00085 return 1; 00086 } 00087 00089 if (argc>=3){ 00090 pDetector->retrieveDetectorSetup(argv[2]); 00091 std::cout << "Detector measurement set-up done" << std::endl; 00092 } 00093 00094 00096 pDetector->startMeasurement(); 00097 std::cout << "measurement finished" << std::endl; 00098 00102 delete pDetector; 00103 00104 return 0; 00105 } 00106