#include "sls_receiver_defs.h"
#include "slsReceiverUsers.h"
#include <iostream>
#include <string.h>
#include <signal.h>
#include <cstdlib>
#include <sys/types.h>
#include <sys/wait.h>
#include <string>
#include <unistd.h>
#include <errno.h>
#include <syscall.h>
Go to the source code of this file.
Macros | |
#define | PRINT_IN_COLOR(c, f,...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__) |
Functions | |
void | sigInterruptHandler (int p) |
void | printHelp () |
int | StartAcq (char *filepath, char *filename, uint64_t fileindex, uint32_t datasize, void *p) |
void | AcquisitionFinished (uint64_t frames, void *p) |
void | GetData (char *metadata, char *datapointer, uint32_t datasize, void *p) |
void | GetData (char *metadata, char *datapointer, uint32_t &revDatasize, void *p) |
int | main (int argc, char *argv[]) |
Variables | |
bool | keeprunning |
This file is an example of how to implement the slsReceiverUsers class You can compile it linking it to the slsReceiver library
g++ mainReceiver.cpp -L lib -lSlsReceiver -L/usr/lib64/ -L lib2 -lzmq -pthread -lrt -lm -lstdc++
where,
lib is the location of lSlsReceiver.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 mainReceiver.cpp.
#define PRINT_IN_COLOR | ( | c, | |
f, | |||
... | |||
) | printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__) |
Define Colors to print data call back in different colors for different recievers
Definition at line 38 of file mainReceiver.cpp.
void AcquisitionFinished | ( | uint64_t | frames, |
void * | p | ||
) |
Acquisition Finished Call back
frames | Number of frames caught |
p | pointer to object |
Definition at line 85 of file mainReceiver.cpp.
void GetData | ( | char * | metadata, |
char * | datapointer, | ||
uint32_t | datasize, | ||
void * | p | ||
) |
Get Receiver Data Call back Prints in different colors(for each receiver process) the different headers for each image call back.
metadata | sls_receiver_header metadata |
datapointer | pointer to data |
datasize | data size in bytes. |
p | pointer to object |
Definition at line 98 of file mainReceiver.cpp.
void GetData | ( | char * | metadata, |
char * | datapointer, | ||
uint32_t & | revDatasize, | ||
void * | p | ||
) |
Get Receiver Data Call back (modified) Prints in different colors(for each receiver process) the different headers for each image call back.
metadata | sls_receiver_header metadata |
datapointer | pointer to data |
datasize | data size in bytes. |
revDatasize | new data size in bytes after the callback. This will be the size written/streamed. (only smaller value is allowed). |
p | pointer to object |
Definition at line 132 of file mainReceiver.cpp.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Example of main program using the slsReceiverUsers class
- register callbacks. remember to set file write enable to 0 (using the client)if we should not write files and you will write data using the callbacks
Definition at line 167 of file mainReceiver.cpp.
void printHelp | ( | ) |
prints usage of this example program
Definition at line 55 of file mainReceiver.cpp.
void sigInterruptHandler | ( | int | p | ) |
Control+C Interrupt Handler Sets the variable keeprunning to false, to let all the processes know to exit properly
Definition at line 48 of file mainReceiver.cpp.
int StartAcq | ( | char * | filepath, |
char * | filename, | ||
uint64_t | fileindex, | ||
uint32_t | datasize, | ||
void * | p | ||
) |
Start Acquisition Call back slsReceiver writes data if file write enabled. Users get data to write using call back if registerCallBackRawDataReady is registered.
filepath | file path |
filename | file name |
fileindex | file index |
datasize | data size in bytes |
p | pointer to object |
Definition at line 72 of file mainReceiver.cpp.
bool keeprunning |
Variable is true to continue running, set to false upon interrupt
Definition at line 42 of file mainReceiver.cpp.