#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>
Go to the source code of this file.
Defines | |
#define | NUM_RECEIVERS 1 |
#define | START_TCP_PORT 1954 |
#define | PRINT_IN_COLOR(c, f,...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__) |
Functions | |
void | sigChildExitedHandler (int sig) |
void | sigInterruptHandler (int p) |
int | StartAcq (char *filepath, char *filename, uint64_t fileindex, uint32_t datasize, void *p) |
void | AcquisitionFinished (uint64_t frames, void *p) |
void | GetData (uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp, uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version, char *datapointer, uint32_t datasize, void *p) |
int | main (int argc, char *argv[]) |
Variables | |
pid_t | childPid [NUM_RECEIVERS] |
bool | keeprunning |
int | numrunning |
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 NUM_RECEIVERS 1 |
Definition at line 34 of 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.
#define START_TCP_PORT 1954 |
Define TCP Port of First Receiver, others are incremented by 1
Definition at line 36 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 93 of file mainReceiver.cpp.
void GetData | ( | uint64_t | frameNumber, | |
uint32_t | expLength, | |||
uint32_t | packetNumber, | |||
uint64_t | bunchId, | |||
uint64_t | timestamp, | |||
uint16_t | modId, | |||
uint16_t | xCoord, | |||
uint16_t | yCoord, | |||
uint16_t | zCoord, | |||
uint32_t | debug, | |||
uint16_t | roundRNumber, | |||
uint8_t | detType, | |||
uint8_t | version, | |||
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.
frameNumber | frame number | |
expLength | real time exposure length (in 100ns) or sub frame number (Eiger 32 bit mode only) | |
packetNumber | number of packets caught for this frame | |
bunchId | bunch id from beamline | |
timestamp | time stamp in 10MHz clock (not implemented for most) | |
modId | module id (not implemented for most) | |
xCoord | x coordinates (detector id in 1D) | |
yCoord | y coordinates (not implemented) | |
zCoord | z coordinates (not implemented) | |
debug | debug values if any | |
roundRNumber | (not implemented) | |
detType | detector type see :: detectorType | |
version | version of standard header (structure format) | |
datapointer | pointer to data | |
datasize | data size in bytes | |
p | pointer to object |
Definition at line 117 of file mainReceiver.cpp.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Example of main program using the slsReceiverUsers class
Definition at line 140 of file mainReceiver.cpp.
void sigChildExitedHandler | ( | int | sig | ) |
Child Exit Signal Interrupt Handler When a child process exits, this function is called, blocks until all child processes exit & decreases the variable indicating number of running processes
sig | signal enum |
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 65 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 80 of file mainReceiver.cpp.
pid_t childPid[NUM_RECEIVERS] |
Definition at line 41 of file mainReceiver.cpp.
bool keeprunning |
Variable is true to continue running, set to false upon interrupt
Definition at line 43 of file mainReceiver.cpp.
int numrunning |
Variable indicating number of child processes running
Definition at line 45 of file mainReceiver.cpp.