# mainReceiver.cpp Source File

# mainReceiver.cpp

Go to the documentation of this file.

    00001 /* A simple server in the internet domain using TCP
    00002    The port number is passed as an argument
    00003 */
    00004
    00018 #include "slsReceiverUsers.h"
    00019
    00020
    00021 #include <iostream>
    00022 using namespace std;
    00023
    00024
    00025 int main(int argc, char *argv[]) {
    00026   int ret = 0;
    00027
    00028
    00029   /*
    00030       Instantiate the slsReceieverUsers class
    00031       The port number is passed as an argument
    00032 */
    00033   slsReceiverUsers *receiver = new slsReceiverUsers(argc, argv, ret);
    00034
    00035   /*
    00036       return if could not open TCP socket for interfacing to client
    00037   */
    00038   if(ret==1)
    00039     return -1;
    00040
    00041
    00042   /*register callbacks */
    00043
    00044
    00045         /*
    00046            callback arguments are
    00047            filepath
    00048            filename
    00049            fileindex
    00050            datasize
    00051
    00052            return value is
    00053            0 raw data ready callback takes care of open,close,write file
    00054            1 callback writes file, we have to open, close it
    00055            2 we open, close, write file, callback does not do anything
    00056
    00057
    00058            registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
    00059         */
    00060
    00061         //receiver->registerCallBackStartAcquisition(func,arg);
    00062
    00063
    00064         /*
    00065           callback argument is
    00066           total farmes caught
    00067           registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
    00068         */
    00069
    00070
    00071         //receiver->registerCallBackAcquisitionFinished(func,arg);
    00072
    00073
    00074
    00075         /*
    00076           args to raw data ready callback are
    00077           framenum
    00078           datapointer
    00079           file descriptor
    00080           guidatapointer (NULL, no data required)
    00081
    00082           NEVER DELETE THE DATA POINTER
    00083           REMEMBER THAT THE CALLBACK IS BLOCKING
    00084
    00085           registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
    00086
    00087         */
    00088
    00089         //receiver->registerCallBackRawDataReady(func,arg);
    00090
    00091
    00092   /* start receiver to listen for commands from the client (and data from detectors when expected */
    00093   receiver->start();
    00094
    00096   usleep(10000000);
    00097
    00099   receiver->stop();
    00100
    00101   return 0;
    00102 }
    00103