mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
Merge branch 'developer' into moenchUpdated
This commit is contained in:
@ -34,4 +34,5 @@ deploy:
|
|||||||
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||||
on:
|
on:
|
||||||
branch: developer
|
branch: developer
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
|||||||
project(slsDetectorPackage)
|
project(slsDetectorPackage)
|
||||||
set(PROJECT_VERSION 5.0.0)
|
set(PROJECT_VERSION 5.0.0)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
include(cmake/project_version.cmake)
|
include(cmake/project_version.cmake)
|
||||||
@ -44,6 +44,9 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
|
|||||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||||
option(SLS_BUILD_DOCS "docs" OFF)
|
option(SLS_BUILD_DOCS "docs" OFF)
|
||||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||||
|
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
@ -111,6 +114,11 @@ if(SLS_USE_SANITIZER)
|
|||||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SLS_TUNE_LOCAL)
|
||||||
|
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#rapidjson
|
#rapidjson
|
||||||
add_library(rapidjson INTERFACE)
|
add_library(rapidjson INTERFACE)
|
||||||
target_include_directories(rapidjson INTERFACE
|
target_include_directories(rapidjson INTERFACE
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
package:
|
package:
|
||||||
name: sls_detector_software
|
name: sls_detector_software
|
||||||
version: "developer"
|
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||||
|
|
||||||
source:
|
source:
|
||||||
- path: ..
|
- path: ..
|
||||||
|
|
||||||
build:
|
build:
|
||||||
number: 1
|
number: 2
|
||||||
binary_relocation: True
|
binary_relocation: True
|
||||||
rpaths:
|
rpaths:
|
||||||
- lib/
|
- lib/
|
||||||
|
@ -663,8 +663,10 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
cout <<"Registering data callback" << endl;
|
cout <<"Registering data callback" << endl;
|
||||||
try {
|
try {
|
||||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||||
|
try {
|
||||||
|
myDet->setRxZmqDataStream(true);
|
||||||
|
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||||
cout <<"Done" << endl;
|
cout <<"Done" << endl;
|
||||||
|
|
||||||
// mgAdcs=new TMultiGraph();
|
// mgAdcs=new TMultiGraph();
|
||||||
@ -1153,8 +1155,20 @@ void ctbAcquisition::Draw(){
|
|||||||
void ctbAcquisition::changePlot(){
|
void ctbAcquisition::changePlot(){
|
||||||
if (rbPlotOff->IsOn()) {
|
if (rbPlotOff->IsOn()) {
|
||||||
adcPlot=0;
|
adcPlot=0;
|
||||||
dbitPlot=0;
|
dbitPlot=0;
|
||||||
|
try {
|
||||||
|
myDet->registerDataCallback(nullptr, this);
|
||||||
|
} CATCH_DISPLAY ("Could not get unregister call back.", "ctbAcquisition::ctbAcquisition")
|
||||||
|
try {
|
||||||
|
myDet->setRxZmqDataStream(false);
|
||||||
|
} CATCH_DISPLAY ("Could not get unset RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||||
|
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||||
|
try {
|
||||||
|
myDet->setRxZmqDataStream(true);
|
||||||
|
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||||
adcPlot=0;
|
adcPlot=0;
|
||||||
dbitPlot=0;
|
dbitPlot=0;
|
||||||
for (int ii=0; ii<NADCS; ii++)
|
for (int ii=0; ii<NADCS; ii++)
|
||||||
|
@ -440,8 +440,8 @@ patwaittime2 0
|
|||||||
### edit with 10 Gbs IP of your server
|
### edit with 10 Gbs IP of your server
|
||||||
############################################
|
############################################
|
||||||
#zmqip 129.129.202.110
|
#zmqip 129.129.202.110
|
||||||
rx_zmqip 10.1.1.102
|
#rx_zmqip 10.1.1.102
|
||||||
rx_zmqport 30001
|
#rx_zmqport 30001
|
||||||
#############################################
|
#############################################
|
||||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||||
############################################
|
############################################
|
||||||
@ -456,8 +456,8 @@ rx_zmqport 30001
|
|||||||
|
|
||||||
tengiga 1
|
tengiga 1
|
||||||
|
|
||||||
#rx_datastream 1
|
rx_datastream 1
|
||||||
#rx_readfreq 1
|
rx_readfreq 1
|
||||||
|
|
||||||
|
|
||||||
dac 6 800
|
dac 6 800
|
||||||
|
@ -3,9 +3,9 @@ import sys
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||||
|
|
||||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||||
from sls_detector import dacIndex, readoutMode
|
from slsdet import dacIndex, readoutMode
|
||||||
from sls_detector.lookup import view, find
|
from slsdet.lookup import view, find
|
||||||
|
|
||||||
d = Detector()
|
d = Detector()
|
||||||
# e = Eiger()
|
# e = Eiger()
|
||||||
|
@ -4,10 +4,11 @@ out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.ge
|
|||||||
cmd = out.stdout.splitlines()
|
cmd = out.stdout.splitlines()
|
||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
|
|
||||||
from sls_detector import Detector, Eiger, Ctb
|
from slsdet import Detector, Eiger, Ctb
|
||||||
|
|
||||||
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
||||||
|
|
||||||
|
#Add commands that we should not expect as direct commands in python
|
||||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
|
"""
|
||||||
|
Utility to find and list which command line functions have tests and
|
||||||
|
where the tests are located
|
||||||
|
"""
|
||||||
|
#local import for for parsing c++
|
||||||
import parse
|
import parse
|
||||||
from pathlib import Path
|
|
||||||
|
#General python stuff
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
import argparse
|
import argparse
|
||||||
path = Path('../../slsDetectorSoftware/tests/')
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
#Realative path from this dir
|
||||||
|
path = Path('../../slsDetectorSoftware/tests/')
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -15,15 +23,12 @@ tested = []
|
|||||||
for fname in files:
|
for fname in files:
|
||||||
with open(path/fname) as f:
|
with open(path/fname) as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
data = parse.remove_comments(data)
|
data = parse.remove_comments(data)
|
||||||
data = data.splitlines()
|
data = data.splitlines()
|
||||||
|
|
||||||
|
|
||||||
for line in data:
|
for line in data:
|
||||||
if 'TEST_CASE' in line or 'SECTION' in line:
|
if 'TEST_CASE' in line or 'SECTION' in line:
|
||||||
cmd = line.split("\"")[1]
|
cmd = line.split("\"")[1]
|
||||||
tested.append(cmd)
|
tested.append([cmd, fname])
|
||||||
|
|
||||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||||
all_cmd = out.stdout.splitlines()
|
all_cmd = out.stdout.splitlines()
|
||||||
@ -33,18 +38,18 @@ all_cmd.pop(0)
|
|||||||
|
|
||||||
if args.startswith is not None:
|
if args.startswith is not None:
|
||||||
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
||||||
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
|
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)]
|
||||||
|
|
||||||
|
tn = [cmd[0] for cmd in tested]
|
||||||
|
|
||||||
|
not_tested = [cmd for cmd in all_cmd if cmd not in tn]
|
||||||
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
|
misnamed = [cmd for cmd in tn if cmd not in all_cmd]
|
||||||
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
|
tested = [cmd for cmd in tested if cmd[0] in all_cmd]
|
||||||
tested = [cmd for cmd in tested if cmd in all_cmd]
|
|
||||||
|
|
||||||
|
|
||||||
print("\nThe following commands are tested:")
|
print("\nThe following commands are tested:")
|
||||||
for cmd in tested:
|
for cmd in tested:
|
||||||
print(cmd)
|
print(f'{cmd[0]:>18} : {cmd[1]}')
|
||||||
|
|
||||||
print("\nThe following commands are NOT tested:")
|
print("\nThe following commands are NOT tested:")
|
||||||
for cmd in not_tested:
|
for cmd in not_tested:
|
||||||
|
@ -8,7 +8,7 @@ import sys
|
|||||||
import setuptools
|
import setuptools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
__version__ = 'udp'
|
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
|
||||||
|
|
||||||
|
|
||||||
def get_conda_path():
|
def get_conda_path():
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from .detector import Detector
|
from .detector import Detector
|
||||||
|
|
||||||
def view(name):
|
def view(name, det = Detector):
|
||||||
names = find(name)
|
names = find(name, det)
|
||||||
for n in names:
|
for n in names:
|
||||||
print(n)
|
print(n)
|
||||||
|
|
||||||
def find(name):
|
def find(name, det = Detector):
|
||||||
return [n for n in dir(Detector) if name in n]
|
return [n for n in dir(det) if name.lower() in n.lower()]
|
@ -428,6 +428,13 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getNumberOfBursts", &Detector::getNumberOfBursts,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setNumberOfBursts", &Detector::setNumberOfBursts, py::arg())
|
||||||
|
.def("getBurstPeriod", &Detector::getBurstPeriod,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setBurstPeriod", &Detector::setBurstPeriod, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getInjectChannel", &Detector::getInjectChannel,
|
.def("getInjectChannel", &Detector::getInjectChannel,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
||||||
@ -441,6 +448,14 @@ void init_det(py::module &m) {
|
|||||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getCurrentSource", &Detector::getCurrentSource,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setCurrentSource", &Detector::setCurrentSource, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("getTimingSource", &Detector::getTimingSource,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setTimingSource", &Detector::setTimingSource, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getCounterMask", &Detector::getCounterMask,
|
.def("getCounterMask", &Detector::getCounterMask,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||||
|
@ -284,4 +284,11 @@ void init_enums(py::module &m) {
|
|||||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||||
|
.value("TIMING_INTERNAL",
|
||||||
|
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||||
|
.value("TIMING_EXTERNAL",
|
||||||
|
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ int main(int argc, char *argv[]) {
|
|||||||
if (argc>=9) {
|
if (argc>=9) {
|
||||||
nframes=atoi(argv[8]);
|
nframes=atoi(argv[8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int xmin=0, xmax=nx, ymin=0, ymax=ny;
|
int xmin=0, xmax=nx, ymin=0, ymax=ny;
|
||||||
if (argc>=13) {
|
if (argc>=13) {
|
||||||
xmin=atoi(argv[9]);
|
xmin=atoi(argv[9]);
|
||||||
@ -185,6 +186,7 @@ int main(int argc, char *argv[]) {
|
|||||||
cout << "pedestal file is " << pedfile << endl;
|
cout << "pedestal file is " << pedfile << endl;
|
||||||
if (thr>0)
|
if (thr>0)
|
||||||
cout << "threshold is " << thr << endl;
|
cout << "threshold is " << thr << endl;
|
||||||
|
cout << "Nframes is " << nframes << endl;
|
||||||
|
|
||||||
uint32 nnx, nny;
|
uint32 nnx, nny;
|
||||||
double *gmap;
|
double *gmap;
|
||||||
|
@ -1,38 +1,14 @@
|
|||||||
/**
|
/* Creates the slsMultiReceiver for running multiple receivers form a single binary */
|
||||||
\file mainReceiver.cpp
|
|
||||||
|
|
||||||
This file is an example of how to implement the Receiver 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 ]
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "Receiver.h"
|
#include "Receiver.h"
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
|
|
||||||
#include <csignal> //SIGINT
|
#include <csignal> //SIGINT
|
||||||
#include <cstdlib> //system
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cerrno>
|
|
||||||
#include <string>
|
|
||||||
#include <sys/types.h> //wait
|
|
||||||
#include <sys/wait.h> //wait
|
#include <sys/wait.h> //wait
|
||||||
#include <syscall.h> //tid
|
#include <syscall.h> //tid
|
||||||
#include <unistd.h> //usleep
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
/** Define Colors to print data call back in different colors for different recievers */
|
/** Define Colors to print data call back in different colors for different recievers */
|
||||||
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
|
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
|
||||||
@ -258,7 +234,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
|
|
||||||
/** - Print Ready and Instructions how to exit */
|
/** - Print Ready and Instructions how to exit */
|
||||||
cout << "Ready ... " << endl;
|
std::cout << "Ready ... \n";
|
||||||
cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n");
|
cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n");
|
||||||
|
|
||||||
/** - Parent process waits for all child processes to exit */
|
/** - Parent process waits for all child processes to exit */
|
||||||
@ -280,7 +256,7 @@ int main(int argc, char *argv[]) {
|
|||||||
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long int) childPid);
|
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long int) childPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Goodbye!" << endl;
|
std::cout << "Goodbye!\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,11 @@
|
|||||||
/* A simple server in the internet domain using TCP
|
/* slsReceiver */
|
||||||
The port number is passed as an argument */
|
|
||||||
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "Receiver.h"
|
#include "Receiver.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
|
|
||||||
#include <csignal> //SIGINT
|
#include <csignal> //SIGINT
|
||||||
#include <cstdlib> //system
|
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
|
||||||
#include <sys/types.h> //wait
|
|
||||||
#include <sys/wait.h> //wait
|
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <unistd.h> //usleep
|
|
||||||
#include <memory>
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
sem_t semaphore;
|
sem_t semaphore;
|
||||||
@ -23,47 +14,6 @@ void sigInterruptHandler(int p){
|
|||||||
sem_post(&semaphore);
|
sem_post(&semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Define Colors to print data call back in different colors for different recievers */
|
|
||||||
/*
|
|
||||||
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
|
|
||||||
|
|
||||||
int StartAcq(std::string filepath, std::string filename, uint64_t fileindex, uint32_t datasize, void*p){
|
|
||||||
FILE_LOG(logINFO) << "#### StartAcq: "
|
|
||||||
"filepath: " << filepath << "filename: " << filename <<
|
|
||||||
"fileindex: " << fileindex << "datasize: " << datasize << " ####";
|
|
||||||
FILE_LOG(logINFO) << "--StartAcq: returning 0";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AcquisitionFinished(uint64_t frames, void*p){
|
|
||||||
FILE_LOG(logINFO) << "#### AcquisitionFinished: frames:" << frames << " ####";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
|
||||||
slsDetectorDefs::sls_receiver_header* header = (slsDetectorDefs::sls_receiver_header*)metadata;
|
|
||||||
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
|
|
||||||
|
|
||||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
|
||||||
"#### %d GetData: ####\n"
|
|
||||||
"frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu"
|
|
||||||
"\t\ttimestamp: %lu\t\tmodId: %u\t\t"
|
|
||||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
|
||||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
|
||||||
//"\t\tpacketsMask:%s"
|
|
||||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
|
||||||
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
|
|
||||||
detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId,
|
|
||||||
(long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
|
||||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
|
||||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
|
||||||
detectorHeader.detType, detectorHeader.version,
|
|
||||||
//header->packetsMask.to_string().c_str(),
|
|
||||||
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
@ -99,45 +49,6 @@ int main(int argc, char *argv[]) {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
//register callbacks
|
|
||||||
|
|
||||||
/**
|
|
||||||
callback arguments are
|
|
||||||
filepath
|
|
||||||
filename
|
|
||||||
fileindex
|
|
||||||
datasize
|
|
||||||
|
|
||||||
return value is
|
|
||||||
0 raw data ready callback takes care of open,close,write file
|
|
||||||
1 callback writes file, we have to open, close it
|
|
||||||
2 we open, close, write file, callback does not do anything
|
|
||||||
|
|
||||||
registerCallBackStartAcquisition(int (*func)(std::string, std::string, int, int, void*),void *arg);
|
|
||||||
*/
|
|
||||||
//receiver->registerCallBackStartAcquisition(startAcquisitionCallBack,NULL);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
callback argument is
|
|
||||||
total farmes caught
|
|
||||||
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
|
||||||
*/
|
|
||||||
//receiver->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,NULL);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
args to raw data ready callback are
|
|
||||||
sls_receiver_header frame metadata
|
|
||||||
datapointer
|
|
||||||
file descriptor
|
|
||||||
guidatapointer (NULL, no data required)
|
|
||||||
NEVER DELETE THE DATA POINTER
|
|
||||||
REMEMBER THAT THE CALLBACK IS BLOCKING
|
|
||||||
registerCallBackRawDataReady(void (*func)(char*, char*, uint32_t, void*),void *arg);
|
|
||||||
*/
|
|
||||||
//receiver->registerCallBackRawDataReady(rawDataReadyCallBack,NULL);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]";
|
FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]";
|
||||||
sem_wait(&semaphore);
|
sem_wait(&semaphore);
|
||||||
sem_destroy(&semaphore);
|
sem_destroy(&semaphore);
|
||||||
|
Reference in New Issue
Block a user