mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
* skeleton of structure for callbacks and funcitons updated * updated callback header structures and implemented in receiver * fixed bugs * minor * formatting * wip: draft of frame synchronizer, semaphores not done yet * signal handler not affecting semaphore inside lambda function * finally works with sem * install targets cmake error fix * removed modified callback and instead passing by reference instead of value to the oriignal receiver data callback * reducing the number of data call backs. incoming from developer * added json header to receiver start acquiistion call back * WIP: of synchronisation (#969) * WIP of synchronisation * working so far if everything goes right * added all information into json headers * valid json * allow frame synchronizer to have access to static libzmq when compiling on conda (libzeromq-devel not installed by default * upto date with multirecieverapp for invalid arguments and help * formatting * remove warnings * changes to print * removed prints * no need for print frames to be called * minor * commnet * adding json header in start callback, imagesize in data callback and formatted * startcallback returns an unused int (changed to exceptions and forgotten in last modification to callbacks likely) * fixed sanitizer issues. 1 left for ctrl+C - zmq_msg_t should be deleted, not freed. Same with the char arrays and semaphores. * fixed sanitizer issues and made it more readable * moving clearing old frames to new startacq just in case it has to process soem frames before the callback * fix cherry-pick merge of fixing sanitizer thread issues but has start callbacks signature change.fixed --------- Co-authored-by: Felix Engelmann <felix-github@nlogn.org>
77 lines
2.3 KiB
C++
77 lines
2.3 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#pragma once
|
|
#include "sls/sls_detector_defs.h"
|
|
#include <memory>
|
|
|
|
namespace sls {
|
|
|
|
class ClientInterface;
|
|
|
|
class Receiver : private virtual slsDetectorDefs {
|
|
|
|
public:
|
|
/**
|
|
* Constructor
|
|
* Starts up a Receiver server. Reads configuration file, options, and
|
|
* assembles a Receiver using TCP and UDP detector interfaces
|
|
* throws an exception in case of failure
|
|
* @param argc from command line
|
|
* @param argv from command line
|
|
*/
|
|
Receiver(int argc, char *argv[]);
|
|
|
|
/**
|
|
* Constructor
|
|
* Starts up a Receiver server. Reads configuration file, options, and
|
|
* assembles a Receiver using TCP and UDP detector interfaces
|
|
* throws an exception in case of failure
|
|
* @param tcpip_port_no TCP/IP port number
|
|
*/
|
|
Receiver(uint16_t tcpip_port_no = 1954);
|
|
|
|
~Receiver();
|
|
|
|
/**
|
|
* get get Receiver Version
|
|
\returns id
|
|
*/
|
|
std::string getReceiverVersion();
|
|
|
|
/**
|
|
* Start Acquisition Call back (slsMultiReceiver writes data if file write
|
|
* enabled) if registerCallBackRawDataReady or
|
|
* registerCallBackRawDataModifyReady registered
|
|
* Call back arguments are:
|
|
* - startCallbackHeader metadata
|
|
*/
|
|
void registerCallBackStartAcquisition(
|
|
void (*func)(const startCallbackHeader, void *), void *arg);
|
|
|
|
/**
|
|
* Call back for acquisition finished
|
|
* callback argument is:
|
|
* - startCallbackHeader metadata
|
|
*/
|
|
void registerCallBackAcquisitionFinished(
|
|
void (*func)(const endCallbackHeader, void *), void *arg);
|
|
|
|
/**
|
|
* Call back for raw data
|
|
* args to raw data ready callback are:
|
|
* - sls_receiver_header frame metadata,
|
|
* - dataCallbackHeader metadata
|
|
* - pointer to data
|
|
* - image size in bytes. Can be modified to the new size to be
|
|
* written/streamed. (only smaller value allowed).
|
|
*/
|
|
void registerCallBackRawDataReady(void (*func)(sls_receiver_header &,
|
|
const dataCallbackHeader,
|
|
char *, size_t &, void *),
|
|
void *arg);
|
|
|
|
private:
|
|
std::unique_ptr<ClientInterface> tcpipInterface;
|
|
};
|
|
|
|
} // namespace sls
|