diff --git a/acquisition_device/AcquisitionDevice.h b/acquisition_device/AcquisitionDevice.h index 14e6bc54..98305944 100644 --- a/acquisition_device/AcquisitionDevice.h +++ b/acquisition_device/AcquisitionDevice.h @@ -55,12 +55,6 @@ struct AcquisitionDeviceStatistics { std::vector packets_received_per_module; }; -struct AcquisitionDeviceNetConfig { - std::string mac_addr; - std::string ipv4_addr; - uint64_t udp_port; -}; - class AcquisitionDevice { std::vector buffer_err; diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 72b680d3..09ca495b 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -233,8 +233,6 @@ void ParseFacilityConfiguration(const nlohmann::json &input, const std::string& void ParseBrokerConfiguration(const nlohmann::json &input, const std::string& tag, JFJochBroker& broker) { if (CHECK_OBJECT(input, tag)) { auto j = input[tag]; - if (j.contains("receiver_addr")) - broker.Services().Receiver(GET_STR(j, "receiver_addr")); if (CHECK_ARRAY(j, "writer")) { for (const auto &iter: j["writer"]) { diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index a15fff74..2064c889 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -15,11 +15,13 @@ void JFJochServices::Start(const DiffractionExperiment& experiment, const JFCali } else writer_running = false; - logger.Info(" ... receiver start"); - if (experiment.GetDetectorMode() == DetectorMode::Conversion) - receiver.Start(experiment, &calibration); - else - receiver.Start(experiment, nullptr); + if (receiver != nullptr) { + logger.Info(" ... receiver start"); + if (experiment.GetDetectorMode() == DetectorMode::Conversion) + receiver->Start(experiment, &calibration); + else + receiver->Start(experiment, nullptr); + } if (!experiment.IsUsingInternalPacketGen()) { logger.Info(" ... detector start"); @@ -35,9 +37,10 @@ void JFJochServices::Off() { void JFJochServices::On(const DiffractionExperiment &x) { logger.Info("Detector on"); - JFJochProtoBuf::DetectorConfig config = x.DetectorConfig(receiver.GetNetworkConfig()); - - detector.On(config); + if (receiver != nullptr) { + JFJochProtoBuf::DetectorConfig config = x.DetectorConfig(receiver->GetNetworkConfig()); + detector.On(config); + } logger.Info(" ... done"); } @@ -46,26 +49,28 @@ JFJochServicesOutput JFJochServices::Stop(const JFCalibration &calibration) { std::unique_ptr exception; - try { - logger.Info("Wait for receiver done"); - ret.receiver_output = receiver.Stop(); + if (receiver != nullptr) { + try { + logger.Info("Wait for receiver done"); + ret.receiver_output = receiver->Stop(); - logger.Info(" ... Receiver efficiency: {} % Max delay: {} Compression ratio {}x", - static_cast(ret.receiver_output.efficiency()*100.0), - ret.receiver_output.max_receive_delay(), - static_cast(std::round(ret.receiver_output.compressed_ratio()))); - if (ret.receiver_output.efficiency() < 1.0) { - for (int i = 0; i < ret.receiver_output.received_packets_size(); i++) { - if (ret.receiver_output.received_packets(i) != ret.receiver_output.expected_packets(i)) - logger.Info(" ... Module: {} Packets received: {} out of {}", i, - ret.receiver_output.received_packets(i), ret.receiver_output.expected_packets(i)); + logger.Info(" ... Receiver efficiency: {} % Max delay: {} Compression ratio {}x", + static_cast(ret.receiver_output.efficiency * 100.0), + ret.receiver_output.max_receive_delay, + static_cast(std::round(ret.receiver_output.compressed_ratio))); + if (ret.receiver_output.efficiency < 1.0) { + for (int i = 0; i < ret.receiver_output.received_packets.size(); i++) { + if (ret.receiver_output.received_packets[i] != ret.receiver_output.expected_packets[i]) + logger.Info(" ... Module: {} Packets received: {} out of {}", i, + ret.receiver_output.received_packets[i], ret.receiver_output.expected_packets[i]); + } } + } catch (const JFJochException &e) { + logger.Error(" ... finished with error {}", e.what()); + exception = std::make_unique(e); } - } catch (const JFJochException &e) { - logger.Error(" ... finished with error {}",e.what()); - exception = std::make_unique(e); + logger.Info("Receiver finished with success"); } - logger.Info("Receiver finished with success"); if (writer_running) { logger.Info("Stopping writer"); @@ -100,7 +105,8 @@ void JFJochServices::Abort() { // Abort should try to achieve the best outcome possible // but it OK if things fail (for example lost connection) try { - receiver.Abort(); + if (receiver != nullptr) + receiver->Abort(); } catch (const std::exception &e) { logger.Error(e.what()); } @@ -108,12 +114,12 @@ void JFJochServices::Abort() { void JFJochServices::Cancel() { detector.Stop(); - receiver.Cancel(); + if (receiver != nullptr) + receiver->Cancel(); } -JFJochServices &JFJochServices::Receiver(const std::string &addr) { - receiver.Connect(addr); - logger.Info("Using receiver service with gRPC " + addr); +JFJochServices &JFJochServices::Receiver(JFJochReceiverService *input) { + receiver = input; return *this; } @@ -130,23 +136,31 @@ JFJochServices &JFJochServices::Detector(const std::string &addr) { return *this; } -JFJochProtoBuf::ReceiverStatus JFJochServices::GetReceiverStatus() { - return receiver.GetStatus(); +JFJochReceiverStatus JFJochServices::GetReceiverStatus() { + if (receiver == nullptr) + return {}; + return receiver->GetStatus(); } -JFJochProtoBuf::Plot JFJochServices::GetPlots(const JFJochProtoBuf::PlotRequest &request) { +Plot JFJochServices::GetPlots(const PlotRequest &request) { + if (receiver == nullptr) + return {}; + try { - return receiver.GetPlots(request); + return receiver->GetDataProcessingPlot(request); } catch (...) { - return JFJochProtoBuf::Plot(); + return {}; } } -JFJochProtoBuf::RadialIntegrationProfiles JFJochServices::GetRadialIntegrationProfiles() { +RadialIntegrationProfiles JFJochServices::GetRadialIntegrationProfiles() { + if (receiver == nullptr) + return {}; + try { - return receiver.GetRadialIntegrationProfiles(); + return receiver->GetRadialIntegrationProfiles(); } catch (...) { - return JFJochProtoBuf::RadialIntegrationProfiles(); + return {}; } } @@ -165,8 +179,10 @@ inline JFJochProtoBuf::DataProcessingSettings Convert(const DataProcessingSettin return ret; } + void JFJochServices::SetDataProcessingSettings(const DataProcessingSettings &settings) { - receiver.SetDataProcessingSettings(Convert(settings)); + if (receiver) + receiver->SetDataProcessingSettings(settings); } void JFJochServices::Trigger() { diff --git a/broker/JFJochServices.h b/broker/JFJochServices.h index b354715d..52d06649 100644 --- a/broker/JFJochServices.h +++ b/broker/JFJochServices.h @@ -6,16 +6,16 @@ #include "../common/DiffractionExperiment.h" #include "../jungfrau/JFCalibration.h" #include "../common/Logger.h" -#include "../grpc/JFJochReceiverClient.h" +#include "../receiver/JFJochReceiverService.h" #include "../grpc/JFJochWriterGroupClient.h" #include "../grpc/JFJochDetectorClient.h" struct JFJochServicesOutput { - JFJochProtoBuf::ReceiverOutput receiver_output; + JFJochReceiverOutput receiver_output; }; class JFJochServices { - JFJochReceiverClient receiver; + JFJochReceiverService *receiver = nullptr; JFJochWriterGroupClient writer; JFJochDetectorClient detector; @@ -32,12 +32,12 @@ public: void Cancel(); void Trigger(); - JFJochProtoBuf::ReceiverStatus GetReceiverStatus(); - JFJochProtoBuf::Plot GetPlots(const JFJochProtoBuf::PlotRequest &request); - JFJochProtoBuf::RadialIntegrationProfiles GetRadialIntegrationProfiles(); + JFJochReceiverStatus GetReceiverStatus(); + Plot GetPlots(const PlotRequest &request); + RadialIntegrationProfiles GetRadialIntegrationProfiles(); void SetDataProcessingSettings(const DataProcessingSettings &settings); - JFJochServices& Receiver(const std::string &addr); + JFJochServices& Receiver(JFJochReceiverService *input); JFJochServices& Writer(const std::string &addr, const std::string &zmq_push_addr); JFJochServices& Detector(const std::string &addr); diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 86dacb45..dfecea5d 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -35,28 +35,74 @@ inline JFJochProtoBuf::DataProcessingSettings Convert(const DataProcessingSettin return ret; } +inline PlotRequest Convert(const JFJochProtoBuf::PlotRequest& request) { + PlotRequest ret; + ret.binning = request.binning(); + switch (request.type()) { + case JFJochProtoBuf::BKG_ESTIMATE: + ret.type = PlotType::BkgEstimate; + break; + case JFJochProtoBuf::RAD_INT: + ret.type = PlotType::RadInt; + break; + case JFJochProtoBuf::SPOT_COUNT: + ret.type = PlotType::SpotCount; + break; + case JFJochProtoBuf::INDEXING_RATE: + ret.type = PlotType::IndexingRate; + break; + case JFJochProtoBuf::INDEXING_RATE_PER_FILE: + ret.type = PlotType::IndexingRatePerFile; + break; + default: + case JFJochProtoBuf::ADU_HISTOGRAM: + ret.type = PlotType::ADUHistorgram; + break; + } + return ret; +} + +inline JFJochProtoBuf::Plot Convert(const Plot& input) { + JFJochProtoBuf::Plot output; + if (!input.x.empty()) + *output.mutable_x() = {input.x.begin(), input.x.end()}; + if (!input.y.empty()) + *output.mutable_y() = {input.y.begin(), input.y.end()}; + return output; +} + +inline JFJochProtoBuf::RadialIntegrationProfiles Convert(const RadialIntegrationProfiles& input) { + JFJochProtoBuf::RadialIntegrationProfiles output; + for (const auto &i: input.profiles) { + auto tmp = output.add_profiles(); + tmp->set_title(i.title); + *tmp->mutable_plot() = Convert(i.plot); + } + return output; +} + JFJochStateMachine::JFJochStateMachine(JFJochServices &in_services, Logger &in_logger) : services(in_services), logger(in_logger), data_processing_settings(DiffractionExperiment::DefaultDataProcessingSettings()) { } -void JFJochStateMachine::ImportPedestalG0(const JFJochProtoBuf::ReceiverOutput &receiver_output) { - if (receiver_output.pedestal_result_size() != experiment.GetModulesNum() * experiment.GetStorageCellNumber()) +void JFJochStateMachine::ImportPedestalG0(const JFJochReceiverOutput &receiver_output) { + if (receiver_output.pedestal_result.size() != experiment.GetModulesNum() * experiment.GetStorageCellNumber()) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Mismatch in pedestal output"); for (int s = 0; s < experiment.GetStorageCellNumber(); s++) { for (int module = 0; module < experiment.GetModulesNum(); module++) calibration->Pedestal(module, 0, s) - = receiver_output.pedestal_result(module + s * experiment.GetModulesNum()); + = receiver_output.pedestal_result[module + s * experiment.GetModulesNum()]; } SetCalibrationStatistics(calibration->GetModuleStatistics()); } -void JFJochStateMachine::ImportPedestal(const JFJochProtoBuf::ReceiverOutput &receiver_output, size_t gain_level, +void JFJochStateMachine::ImportPedestal(const JFJochReceiverOutput &receiver_output, size_t gain_level, size_t storage_cell) { - for (int i = 0; i < receiver_output.pedestal_result_size(); i++) - calibration->Pedestal(i, gain_level, storage_cell) = receiver_output.pedestal_result(i); + for (int i = 0; i < receiver_output.pedestal_result.size(); i++) + calibration->Pedestal(i, gain_level, storage_cell) = receiver_output.pedestal_result[i]; SetCalibrationStatistics(calibration->GetModuleStatistics()); } @@ -339,14 +385,14 @@ void JFJochStateMachine::SetFullMeasurementOutput(const JFJochServicesOutput &ou tmp.set_detector_height(experiment.GetYPixelsNum()); tmp.set_detector_pixel_depth(experiment.GetPixelDepth()); - tmp.set_compression_ratio(output.receiver_output.compressed_ratio()); - tmp.set_collection_efficiency(output.receiver_output.efficiency()); - tmp.set_images_collected(output.receiver_output.images_sent()); - tmp.set_cancelled(output.receiver_output.cancelled()); - tmp.set_max_image_number_sent(output.receiver_output.max_image_number_sent()); - tmp.set_max_receive_delay(output.receiver_output.max_receive_delay()); - tmp.set_indexing_rate(output.receiver_output.indexing_rate()); - tmp.set_bkg_estimate(output.receiver_output.bkg_estimate()); + tmp.set_compression_ratio(output.receiver_output.compressed_ratio); + tmp.set_collection_efficiency(output.receiver_output.efficiency); + tmp.set_images_collected(output.receiver_output.images_sent); + tmp.set_cancelled(output.receiver_output.cancelled); + tmp.set_max_image_number_sent(output.receiver_output.max_image_number_sent); + tmp.set_max_receive_delay(output.receiver_output.max_receive_delay); + tmp.set_indexing_rate(output.receiver_output.indexing_rate); + tmp.set_bkg_estimate(output.receiver_output.bkg_estimate); measurement_statistics = tmp; } @@ -514,20 +560,20 @@ JFJochProtoBuf::BrokerStatus JFJochStateMachine::GetStatus() const { try { auto rcv_status = services.GetReceiverStatus(); - ret.set_progress(rcv_status.progress()); - ret.set_indexing_rate(rcv_status.indexing_rate()); - ret.set_receiver_send_buffers_avail(rcv_status.send_buffers_avail()); + ret.set_progress(rcv_status.progress); + ret.set_indexing_rate(rcv_status.indexing_rate); + ret.set_receiver_send_buffers_avail(rcv_status.send_buffers_avail); } catch (JFJochException &e) {} // ignore exception in getting receiver status (don't really care, e.g. if receiver is down) return ret; } JFJochProtoBuf::Plot JFJochStateMachine::GetPlots(const JFJochProtoBuf::PlotRequest &request) const { - return services.GetPlots(request); + return Convert(services.GetPlots(Convert(request))); } JFJochProtoBuf::RadialIntegrationProfiles JFJochStateMachine::GetRadialIntegrationProfiles() const { - return services.GetRadialIntegrationProfiles(); + return Convert(services.GetRadialIntegrationProfiles()); } void JFJochStateMachine::SetDataProcessingSettings(const JFJochProtoBuf::DataProcessingSettings &settings) { diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index f66855d3..92052a35 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -49,8 +49,8 @@ class JFJochStateMachine { // Private functions assume that lock m is acquired void SetDatasetDefaults(JFJochProtoBuf::DatasetSettings& settings); void WaitTillMeasurementDone(); - void ImportPedestal(const JFJochProtoBuf::ReceiverOutput &receiver_output, size_t gain_level, size_t storage_cell = 0); - void ImportPedestalG0(const JFJochProtoBuf::ReceiverOutput &receiver_output); + void ImportPedestal(const JFJochReceiverOutput &receiver_output, size_t gain_level, size_t storage_cell = 0); + void ImportPedestalG0(const JFJochReceiverOutput &receiver_output); void TakePedestalInternalAll(std::unique_lock &ul); void TakePedestalInternalG0(std::unique_lock &ul); diff --git a/common/DiffractionExperiment.cpp b/common/DiffractionExperiment.cpp index ac33e45e..08d30e0e 100644 --- a/common/DiffractionExperiment.cpp +++ b/common/DiffractionExperiment.cpp @@ -12,22 +12,6 @@ #define check_max(param, val, max) if ((val) > (max)) throw JFJochException(JFJochExceptionCategory::InputParameterAboveMax, param) #define check_min(param, val, min) if ((val) < (min)) throw JFJochException(JFJochExceptionCategory::InputParameterBelowMin, param) -DiffractionExperiment::DiffractionExperiment(const JFJochProtoBuf::JungfraujochSettings &settings) : DiffractionExperiment() { - Import(settings); -} - -DiffractionExperiment& DiffractionExperiment::Import(const JFJochProtoBuf::JungfraujochSettings &settings) { - internal = settings.internal(); - dataset = settings.dataset(); - return *this; -} - -DiffractionExperiment::operator JFJochProtoBuf::JungfraujochSettings() const { - JFJochProtoBuf::JungfraujochSettings settings; - *settings.mutable_dataset() = dataset; - *settings.mutable_internal() = internal; - return settings; -} DiffractionExperiment::DiffractionExperiment() : DiffractionExperiment(DetectorGeometry(8, 2)) {} @@ -798,9 +782,9 @@ DiffractionExperiment::operator JFJochProtoBuf::DetectorInput() const { return ret; } -JFJochProtoBuf::DetectorConfig DiffractionExperiment::DetectorConfig(const JFJochProtoBuf::ReceiverNetworkConfig &net_config) const { +JFJochProtoBuf::DetectorConfig DiffractionExperiment::DetectorConfig(const std::vector &net_config) const { JFJochProtoBuf::DetectorConfig ret; - if (net_config.device_size() < GetDataStreamsNum()) + if (net_config.size() < GetDataStreamsNum()) throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Number of FPGA boards in the receiver is less then necessary"); @@ -816,14 +800,14 @@ JFJochProtoBuf::DetectorConfig DiffractionExperiment::DetectorConfig(const JFJoc for (int d = 0; d < GetDataStreamsNum(); d++) { for (int m = 0; m < GetModulesNum(d); m++) { auto mod_cfg = ret.add_modules(); - mod_cfg->set_udp_dest_port_1(net_config.device(d).udp_port()); - mod_cfg->set_udp_dest_port_2(net_config.device(d).udp_port()); + mod_cfg->set_udp_dest_port_1(net_config[d].udp_port); + mod_cfg->set_udp_dest_port_2(net_config[d].udp_port); mod_cfg->set_ipv4_src_addr_1(IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m))); mod_cfg->set_ipv4_src_addr_2(IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m + 1))); - mod_cfg->set_ipv4_dest_addr_1(net_config.device(d).ipv4_addr()); - mod_cfg->set_ipv4_dest_addr_2(net_config.device(d).ipv4_addr()); - mod_cfg->set_mac_addr_dest_1(net_config.device(d).mac_addr()); - mod_cfg->set_mac_addr_dest_2(net_config.device(d).mac_addr()); + mod_cfg->set_ipv4_dest_addr_1(net_config[d].ipv4_addr); + mod_cfg->set_ipv4_dest_addr_2(net_config[d].ipv4_addr); + mod_cfg->set_mac_addr_dest_1(net_config[d].mac_addr); + mod_cfg->set_mac_addr_dest_2(net_config[d].mac_addr); mod_cfg->set_module_id_in_data_stream(m); } } diff --git a/common/DiffractionExperiment.h b/common/DiffractionExperiment.h index 5bf255c5..f84d6b68 100644 --- a/common/DiffractionExperiment.h +++ b/common/DiffractionExperiment.h @@ -22,6 +22,12 @@ enum class DetectorMode : int { Conversion, Raw, PedestalG0, PedestalG1, PedestalG2 }; +struct AcquisitionDeviceNetConfig { + std::string mac_addr; + std::string ipv4_addr; + uint64_t udp_port; +}; + class DiffractionExperiment { JFJochProtoBuf::DatasetSettings dataset; JFJochProtoBuf::InternalSettings internal; @@ -32,15 +38,12 @@ public: // Public methods are atomic DiffractionExperiment(); DiffractionExperiment(const DetectorSetup& geom); - explicit DiffractionExperiment(const JFJochProtoBuf::JungfraujochSettings &settings); // Methods below can be chained together DiffractionExperiment& Detector(const DetectorSetup& input); DiffractionExperiment& Mode(DetectorMode input); DiffractionExperiment& DataStreams(int64_t input); - DiffractionExperiment& Import(const JFJochProtoBuf::JungfraujochSettings &settings); - DiffractionExperiment& ImagesPerTrigger(int64_t input); DiffractionExperiment& NumTriggers(int64_t triggers); @@ -85,12 +88,11 @@ public: DiffractionExperiment& InstrumentNameShort(std::string input); DiffractionExperiment& ApplyPixelMaskInFPGA(bool input); - operator JFJochProtoBuf::JungfraujochSettings() const; operator JFJochProtoBuf::DetectorInput() const; void FillMessage(StartMessage &message) const; - JFJochProtoBuf::DetectorConfig DetectorConfig(const JFJochProtoBuf::ReceiverNetworkConfig& net_config) const; + JFJochProtoBuf::DetectorConfig DetectorConfig(const std::vector& net_config) const; void LoadDatasetSettings(const JFJochProtoBuf::DatasetSettings &settings); void LoadDetectorSettings(const JFJochProtoBuf::DetectorSettings &settings); JFJochProtoBuf::DetectorSettings GetDetectorSettings() const; diff --git a/grpc/CMakeLists.txt b/grpc/CMakeLists.txt index 965f128f..3d0b809d 100644 --- a/grpc/CMakeLists.txt +++ b/grpc/CMakeLists.txt @@ -47,7 +47,6 @@ TARGET_INCLUDE_DIRECTORIES(JFJochProtoBuf PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) TARGET_LINK_LIBRARIES(JFJochProtoBuf ${_GRPC_GRPCPP}) ADD_LIBRARY(gRPCClients STATIC - JFJochReceiverClient.cpp JFJochReceiverClient.h JFJochDetectorClient.cpp JFJochDetectorClient.h JFJochWriterClient.cpp JFJochWriterClient.h JFJochWriterGroupClient.cpp JFJochWriterGroupClient.h) diff --git a/grpc/JFJochReceiverClient.cpp b/grpc/JFJochReceiverClient.cpp deleted file mode 100644 index 9e62abaa..00000000 --- a/grpc/JFJochReceiverClient.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#include -#include "JFJochReceiverClient.h" -#include "../common/JFJochException.h" - -void JFJochReceiverClient::Connect(const std::string& addr) -{ - if (addr.empty()) _stub.reset(); - else { - grpc::ChannelArguments ch_args; - ch_args.SetMaxReceiveMessageSize(GRPC_MAX_MESSAGE_SIZE); - auto ch = grpc::CreateCustomChannel(addr, grpc::InsecureChannelCredentials(), ch_args); - _stub = std::make_unique(ch); - } -}; - -void JFJochReceiverClient::Start(const DiffractionExperiment &experiment, const JFCalibration *calibration) { - JFJochProtoBuf::ReceiverInput receiver_input; - - *receiver_input.mutable_jungfraujoch_settings() = experiment; - if (calibration != nullptr) - *receiver_input.mutable_calibration() = *calibration; - - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Start(&context, receiver_input, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } -}; - -void JFJochReceiverClient::Cancel() { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Cancel(&context, empty, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } -}; - -void JFJochReceiverClient::Abort() { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Abort(&context, empty, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } -}; - -JFJochProtoBuf::ReceiverOutput JFJochReceiverClient::Stop() { - JFJochProtoBuf::ReceiverOutput ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Stop(&context, empty, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } - return ret; -}; - -JFJochProtoBuf::ReceiverStatus JFJochReceiverClient::GetStatus() { - JFJochProtoBuf::ReceiverStatus ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->GetStatus(&context, empty, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } - return ret; -} - -void JFJochReceiverClient::SetDataProcessingSettings(const JFJochProtoBuf::DataProcessingSettings &settings) { - JFJochProtoBuf::Empty ret; - if (_stub) { - grpc::ClientContext context; - auto status = _stub->SetDataProcessingSettings(&context, settings, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } -} - -JFJochProtoBuf::ReceiverNetworkConfig JFJochReceiverClient::GetNetworkConfig() { - JFJochProtoBuf::ReceiverNetworkConfig ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->GetNetworkConfig(&context, empty, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } else { - // For tests to work, dummy receiver needs to replay with nonsense MAC addresses - auto d1 = ret.add_device(); - d1->set_mac_addr("00:00:00:00:00:00"); - d1->set_ipv4_addr("10.10.50.1"); - d1->set_udp_port(1234); - - auto d2 = ret.add_device(); - d2->set_mac_addr("00:00:00:00:00:01"); - d2->set_ipv4_addr("10.10.50.2"); - d2->set_udp_port(1234); - } - return ret; -} - -JFJochProtoBuf::Plot JFJochReceiverClient::GetPlots(const JFJochProtoBuf::PlotRequest &request) { - JFJochProtoBuf::Plot ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->GetDataProcessingPlots(&context, request, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } else { - // TODO: Write some dummy plots - } - return ret; -} - -JFJochProtoBuf::RadialIntegrationProfiles JFJochReceiverClient::GetRadialIntegrationProfiles() { - JFJochProtoBuf::RadialIntegrationProfiles ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->GetRadialIntegrationProfiles(&context, empty, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochReceiver: " + status.error_message()); - } else { - auto p = ret.add_profiles(); - p->set_title("dataset"); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 2.5, 0.2); - - p = ret.add_profiles(); - p->set_title("file0"); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 3.0, 0.2); - - p = ret.add_profiles(); - p->set_title("file1"); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 2.0, 0.2); - - p = ret.add_profiles(); - p->set_title("file2"); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 2.5, 0.1); - - p = ret.add_profiles(); - p->set_title("file3"); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 2.5, 0.5); - - for (int i = 4; i < 16; i++) { - p = ret.add_profiles(); - p->set_title("file" + std::to_string(i)); - *p->mutable_plot() = GenerateGaussianPlot(50, 0.1, 2.3, 0.1 + 0.02 * i); - } - - } - return ret; -} - -JFJochProtoBuf::Plot JFJochReceiverClient::GenerateGaussianPlot(uint64_t n_elements, float spacing, float mean, float std) { - - std::vector x(n_elements); - std::vector y(n_elements); - - constexpr float inv_sqrt_2pi = 0.3989422804; - - for (int i = 0; i < n_elements; i++) { - x[i] = spacing * i; - float a = (x[i] - mean) / std; - y[i] = inv_sqrt_2pi / std * expf(-0.5f * a * a);; - } - - JFJochProtoBuf::Plot ret; - if (n_elements > 0) { - *ret.mutable_x() = {x.begin(), x.end()}; - *ret.mutable_y() = {y.begin(), y.end()}; - } - return ret; -} - diff --git a/grpc/JFJochReceiverClient.h b/grpc/JFJochReceiverClient.h deleted file mode 100644 index 756bc4c0..00000000 --- a/grpc/JFJochReceiverClient.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#ifndef JUNGFRAUJOCH_JFJOCHRECEIVERCLIENT_H -#define JUNGFRAUJOCH_JFJOCHRECEIVERCLIENT_H - -#include -#include - -#include "../common/DiffractionExperiment.h" -#include "../jungfrau/JFCalibration.h" - -class JFJochReceiverClient { - std::unique_ptr _stub; - - static JFJochProtoBuf::Plot GenerateGaussianPlot(uint64_t n_elements, float spacing, float max, float std); -public: - void Connect(const std::string& addr); - void Start(const DiffractionExperiment &experiment, const JFCalibration *calibration); - void Abort(); - void Cancel(); - void SetDataProcessingSettings(const JFJochProtoBuf::DataProcessingSettings& settings); - JFJochProtoBuf::ReceiverOutput Stop(); - JFJochProtoBuf::ReceiverStatus GetStatus(); - JFJochProtoBuf::ReceiverNetworkConfig GetNetworkConfig(); - JFJochProtoBuf::Plot GetPlots(const JFJochProtoBuf::PlotRequest& request); - JFJochProtoBuf::RadialIntegrationProfiles GetRadialIntegrationProfiles(); -}; - - -#endif //JUNGFRAUJOCH_JFJOCHRECEIVERCLIENT_H diff --git a/grpc/jfjoch.proto b/grpc/jfjoch.proto index ab2f345d..410773e4 100644 --- a/grpc/jfjoch.proto +++ b/grpc/jfjoch.proto @@ -208,46 +208,6 @@ message JFCalibrationStatistics { } // Receiver - -message ReceiverInput { - JungfraujochSettings jungfraujoch_settings = 1; - JFCalibration calibration = 2; -} - -message ReceiverOutput { - uint64 max_receive_delay = 2; - uint64 compressed_size = 3; - float compressed_ratio = 4; - uint64 images_sent = 5; - uint64 start_time_ms = 6; - uint64 end_time_ms = 7; - float efficiency = 8; - uint64 max_image_number_sent = 9; - bool cancelled = 10; - string master_file_name = 11; - repeated JFPedestal pedestal_result = 12; - float indexing_rate = 13; - float bkg_estimate = 14; - repeated uint64 received_packets = 15; - repeated uint64 expected_packets = 16; -} - -message ReceiverNetworkConfigDevice { - string mac_addr = 1; - string ipv4_addr = 2; - uint64 udp_port = 3; -} - -message ReceiverNetworkConfig { - repeated ReceiverNetworkConfigDevice device = 1; -} - -message ReceiverStatus { - float progress = 1; - float indexing_rate = 3; - float send_buffers_avail = 4; -} - enum PlotType { BKG_ESTIMATE = 0; RAD_INT = 1; @@ -420,18 +380,6 @@ message DetectorSelection { int64 id = 1; } -service gRPC_JFJochReceiver { - rpc Start (ReceiverInput) returns (Empty) {} - rpc Abort (Empty) returns (Empty) {} - rpc Cancel (Empty) returns (Empty) {} - rpc Stop (Empty) returns (ReceiverOutput) {} - rpc GetStatus (Empty) returns (ReceiverStatus) {} - rpc SetDataProcessingSettings(DataProcessingSettings) returns (Empty) {} - rpc GetDataProcessingPlots(PlotRequest) returns (Plot) {} - rpc GetRadialIntegrationProfiles(Empty) returns (RadialIntegrationProfiles) {} - rpc GetNetworkConfig (Empty) returns (ReceiverNetworkConfig) {} -} - service gRPC_JFJochWriter { rpc Start (WriterInput) returns (Empty) {} rpc Abort (Empty) returns (Empty) {} diff --git a/python/jfjoch_pb2.py b/python/jfjoch_pb2.py index ed3aa3dd..79b02fc8 100644 --- a/python/jfjoch_pb2.py +++ b/python/jfjoch_pb2.py @@ -13,25 +13,25 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xb1\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12:\n\x11\x66pga_pixel_output\x18\x03 \x01(\x0e\x32\x1f.JFJochProtoBuf.FPGAPixelOutput\x12\x11\n\tsummation\x18\x04 \x01(\x03\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12+\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCell\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12 \n\x18rad_int_solid_angle_corr\x18\x12 \x01(\x08\x12!\n\x19rad_int_polarization_corr\x18\x13 \x01(\x08\x12#\n\x1brad_int_polarization_factor\x18\x14 \x01(\x02\x12\x18\n\x10save_calibration\x18\x15 \x01(\x08\"\x90\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x15\n\rcount_time_us\x18\x02 \x01(\x03\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1a\n\x12pedestal_g0_frames\x18\x06 \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\x07 \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x08 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\n \x01(\x03\"b\n\x16\x44\x65tectorModuleGeometry\x12\x0e\n\x06pixel0\x18\x01 \x01(\x03\x12\x1b\n\x13\x66\x61st_direction_step\x18\x02 \x01(\x03\x12\x1b\n\x13slow_direction_step\x18\x03 \x01(\x03\"z\n\x10\x44\x65tectorGeometry\x12\x11\n\twidth_pxl\x18\x01 \x01(\x03\x12\x12\n\nheight_pxl\x18\x02 \x01(\x03\x12?\n\x0fmodule_geometry\x18\x03 \x03(\x0b\x32&.JFJochProtoBuf.DetectorModuleGeometry\"\xb2\x01\n\x08\x44\x65tector\x12\x10\n\x08nmodules\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x15\n\rpixel_size_mm\x18\x03 \x01(\x02\x12\x17\n\x0fmodule_hostname\x18\x04 \x03(\t\x12\x32\n\x08geometry\x18\x05 \x01(\x0b\x32 .JFJochProtoBuf.DetectorGeometry\x12\x1b\n\x13udp_interface_count\x18\x07 \x01(\x03\"\xdf\x05\n\x10InternalSettings\x12\"\n\x1a\x66rame_time_pedestalG1G2_us\x18\x01 \x01(\x03\x12\x15\n\rframe_time_us\x18\x03 \x01(\x03\x12\x15\n\rcount_time_us\x18\x04 \x01(\x03\x12*\n\x08\x64\x65tector\x18\x05 \x01(\x0b\x32\x18.JFJochProtoBuf.Detector\x12\x14\n\x0cndatastreams\x18\x06 \x01(\x03\x12&\n\x1einternal_fpga_packet_generator\x18\t \x01(\x08\x12\x15\n\rstorage_cells\x18\n \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x0b \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\' \x01(\x03\x12\x1a\n\x12pedestal_g0_frames\x18\x0c \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\r \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x0e \x01(\x03\x12\x19\n\x11preview_period_us\x18\x0f \x01(\x03\x12*\n\x04mode\x18\x13 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x19\n\x11mask_module_edges\x18\x14 \x01(\x08\x12\x17\n\x0fmask_chip_edges\x18\x15 \x01(\x08\x12\x16\n\x0eipv4_base_addr\x18\x16 \x01(\x03\x12\r\n\x05low_q\x18\x1a \x01(\x02\x12\x0e\n\x06high_q\x18\x1b \x01(\x02\x12\x11\n\tq_spacing\x18\x1c \x01(\x02\x12\x10\n\x08git_sha1\x18\x1d \x01(\t\x12\x10\n\x08git_date\x18\x1e \x01(\t\x12\x13\n\x0bsource_name\x18 \x01(\t\x12\x19\n\x11source_name_short\x18! \x01(\t\x12\x17\n\x0finstrument_name\x18\" \x01(\t\x12\x1d\n\x15instrument_name_short\x18# \x01(\t\x12\x18\n\x10\x64\x65\x62ug_pixel_mask\x18& \x01(\x08\"|\n\x14JungfraujochSettings\x12\x30\n\x07\x64\x61taset\x18\x01 \x01(\x0b\x32\x1f.JFJochProtoBuf.DatasetSettings\x12\x32\n\x08internal\x18\x02 \x01(\x0b\x32 .JFJochProtoBuf.InternalSettings\"\x1e\n\nJFPedestal\x12\x10\n\x08pedestal\x18\x01 \x01(\x0c\"-\n\x11JFGainCalibration\x12\x18\n\x10gain_calibration\x18\x01 \x01(\x0c\"\xb2\x01\n\rJFCalibration\x12\x10\n\x08nmodules\x18\x01 \x01(\x04\x12\x16\n\x0enstorage_cells\x18\x02 \x01(\x04\x12,\n\x08pedestal\x18\x03 \x03(\x0b\x32\x1a.JFJochProtoBuf.JFPedestal\x12\x0c\n\x04mask\x18\x04 \x01(\x0c\x12;\n\x10gain_calibration\x18\x05 \x03(\x0b\x32!.JFJochProtoBuf.JFGainCalibration\"V\n\x17JFCalibrationStatistics\x12;\n\x11module_statistics\x18\x01 \x03(\x0b\x32 .JFJochProtoBuf.ModuleStatistics\"\x88\x01\n\rReceiverInput\x12\x43\n\x15jungfraujoch_settings\x18\x01 \x01(\x0b\x32$.JFJochProtoBuf.JungfraujochSettings\x12\x32\n\x0b\x63\x61libration\x18\x02 \x01(\x0b\x32\x1d.JFJochProtoBuf.JFCalibration\"\x95\x03\n\x0eReceiverOutput\x12\x19\n\x11max_receive_delay\x18\x02 \x01(\x04\x12\x17\n\x0f\x63ompressed_size\x18\x03 \x01(\x04\x12\x18\n\x10\x63ompressed_ratio\x18\x04 \x01(\x02\x12\x13\n\x0bimages_sent\x18\x05 \x01(\x04\x12\x15\n\rstart_time_ms\x18\x06 \x01(\x04\x12\x13\n\x0b\x65nd_time_ms\x18\x07 \x01(\x04\x12\x12\n\nefficiency\x18\x08 \x01(\x02\x12\x1d\n\x15max_image_number_sent\x18\t \x01(\x04\x12\x11\n\tcancelled\x18\n \x01(\x08\x12\x18\n\x10master_file_name\x18\x0b \x01(\t\x12\x33\n\x0fpedestal_result\x18\x0c \x03(\x0b\x32\x1a.JFJochProtoBuf.JFPedestal\x12\x15\n\rindexing_rate\x18\r \x01(\x02\x12\x14\n\x0c\x62kg_estimate\x18\x0e \x01(\x02\x12\x18\n\x10received_packets\x18\x0f \x03(\x04\x12\x18\n\x10\x65xpected_packets\x18\x10 \x03(\x04\"T\n\x1bReceiverNetworkConfigDevice\x12\x10\n\x08mac_addr\x18\x01 \x01(\t\x12\x11\n\tipv4_addr\x18\x02 \x01(\t\x12\x10\n\x08udp_port\x18\x03 \x01(\x04\"T\n\x15ReceiverNetworkConfig\x12;\n\x06\x64\x65vice\x18\x01 \x03(\x0b\x32+.JFJochProtoBuf.ReceiverNetworkConfigDevice\"U\n\x0eReceiverStatus\x12\x10\n\x08progress\x18\x01 \x01(\x02\x12\x15\n\rindexing_rate\x18\x03 \x01(\x02\x12\x1a\n\x12send_buffers_avail\x18\x04 \x01(\x02\"F\n\x0bPlotRequest\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.JFJochProtoBuf.PlotType\x12\x0f\n\x07\x62inning\x18\x02 \x01(\x04\"M\n\x18RadialIntegrationProfile\x12\r\n\x05title\x18\x01 \x01(\t\x12\"\n\x04plot\x18\x02 \x01(\x0b\x32\x14.JFJochProtoBuf.Plot\"W\n\x19RadialIntegrationProfiles\x12:\n\x08profiles\x18\x01 \x03(\x0b\x32(.JFJochProtoBuf.RadialIntegrationProfile\">\n\x0bWriterInput\x12\x1c\n\x14zmq_receiver_address\x18\x01 \x01(\t\x12\x11\n\tseries_id\x18\x02 \x01(\x03\"3\n\x12\x44\x61taFileStatistics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07nimages\x18\x02 \x01(\x03\"\x8d\x01\n\x0cWriterOutput\x12\x0f\n\x07nimages\x18\x01 \x01(\x03\x12\x17\n\x0fperformance_MBs\x18\x02 \x01(\x02\x12\x16\n\x0eperformance_Hz\x18\x03 \x01(\x02\x12;\n\x0f\x66ile_statistics\x18\x04 \x03(\x0b\x32\".JFJochProtoBuf.DataFileStatistics\"\x82\x02\n\x14\x44\x65tectorModuleConfig\x12\x17\n\x0fudp_dest_port_1\x18\x01 \x01(\x04\x12\x17\n\x0fudp_dest_port_2\x18\x02 \x01(\x04\x12\x17\n\x0fipv4_src_addr_1\x18\x03 \x01(\t\x12\x17\n\x0fipv4_src_addr_2\x18\x04 \x01(\t\x12\x18\n\x10ipv4_dest_addr_1\x18\x05 \x01(\t\x12\x18\n\x10ipv4_dest_addr_2\x18\x06 \x01(\t\x12\x17\n\x0fmac_addr_dest_1\x18\x07 \x01(\t\x12\x17\n\x0fmac_addr_dest_2\x18\x08 \x01(\t\x12 \n\x18module_id_in_data_stream\x18\t \x01(\x04\"}\n\x0e\x44\x65tectorConfig\x12\x35\n\x07modules\x18\x01 \x03(\x0b\x32$.JFJochProtoBuf.DetectorModuleConfig\x12\x17\n\x0fmodule_hostname\x18\x02 \x03(\t\x12\x1b\n\x13udp_interface_count\x18\x03 \x01(\x03\"\xfc\x01\n\rDetectorInput\x12\x13\n\x0bmodules_num\x18\x01 \x01(\x03\x12*\n\x04mode\x18\x02 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x12\n\nnum_frames\x18\x03 \x01(\x03\x12\x14\n\x0cnum_triggers\x18\x04 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x05 \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x06 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\x07 \x01(\x03\x12\x11\n\tperiod_us\x18\t \x01(\x03\x12\x15\n\rcount_time_us\x18\n \x01(\x03\"\x10\n\x0e\x44\x65tectorOutput\"b\n\x0e\x44\x65tectorStatus\x12$\n\x05state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x12\n\nfw_version\x18\x02 \x01(\x03\x12\x16\n\x0eserver_version\x18\x03 \x01(\t\"Q\n\x0e\x46PGAFIFOStatus\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0e\x32\".JFJochProtoBuf.FPGAFIFOStatusEnum\"\xbb\x02\n\x16\x44\x61taProcessingSettings\x12!\n\x19signal_to_noise_threshold\x18\x01 \x01(\x02\x12\x1e\n\x16photon_count_threshold\x18\x02 \x01(\x03\x12\x18\n\x10min_pix_per_spot\x18\x03 \x01(\x03\x12\x18\n\x10max_pix_per_spot\x18\x04 \x01(\x03\x12\x16\n\x0elocal_bkg_size\x18\x05 \x01(\x03\x12\x1d\n\x15high_resolution_limit\x18\x06 \x01(\x02\x12\x1c\n\x14low_resolution_limit\x18\x07 \x01(\x02\x12\x1a\n\x12\x62kg_estimate_low_q\x18\x08 \x01(\x02\x12\x1b\n\x13\x62kg_estimate_high_q\x18\t \x01(\x02\x12\x1c\n\x14preview_indexed_only\x18\n \x01(\x08\"\xed\x01\n\x10ModuleStatistics\x12\x15\n\rmodule_number\x18\x01 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x02 \x01(\x03\x12\x18\n\x10pedestal_g0_mean\x18\x03 \x01(\x02\x12\x18\n\x10pedestal_g1_mean\x18\x04 \x01(\x02\x12\x18\n\x10pedestal_g2_mean\x18\x05 \x01(\x02\x12\x14\n\x0cgain_g0_mean\x18\x06 \x01(\x02\x12\x14\n\x0cgain_g1_mean\x18\x07 \x01(\x02\x12\x14\n\x0cgain_g2_mean\x18\x08 \x01(\x02\x12\x15\n\rmasked_pixels\x18\t \x01(\x04\"I\n\x05Image\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\r\n\x05width\x18\x02 \x01(\x03\x12\x0e\n\x06height\x18\x03 \x01(\x03\x12\x13\n\x0bpixel_depth\x18\x04 \x01(\x03\".\n\nMaskToLoad\x12\x0c\n\x04mask\x18\x01 \x03(\r\x12\x12\n\nbit_to_set\x18\x02 \x01(\x05\"\xc9\x02\n\x15MeasurementStatistics\x12\x13\n\x0b\x66ile_prefix\x18\x01 \x01(\t\x12\x18\n\x10images_collected\x18\x02 \x01(\x03\x12\x1d\n\x15max_image_number_sent\x18\x03 \x01(\x03\x12\x1d\n\x15\x63ollection_efficiency\x18\x04 \x01(\x02\x12\x19\n\x11\x63ompression_ratio\x18\x05 \x01(\x02\x12\x11\n\tcancelled\x18\x06 \x01(\x08\x12\x19\n\x11max_receive_delay\x18\x07 \x01(\x03\x12\x15\n\rindexing_rate\x18\n \x01(\x02\x12\x16\n\x0e\x64\x65tector_width\x18\x0c \x01(\x03\x12\x17\n\x0f\x64\x65tector_height\x18\r \x01(\x03\x12\x1c\n\x14\x64\x65tector_pixel_depth\x18\x0e \x01(\x03\x12\x14\n\x0c\x62kg_estimate\x18\x10 \x01(\x02\"\x89\x01\n\x0c\x42rokerStatus\x12+\n\x0c\x62roker_state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x10\n\x08progress\x18\x02 \x01(\x02\x12\x15\n\rindexing_rate\x18\x03 \x01(\x02\x12#\n\x1breceiver_send_buffers_avail\x18\x04 \x01(\x02\"H\n\x13\x44\x65tectorListElement\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x10\n\x08nmodules\x18\x02 \x01(\x03\x12\n\n\x02id\x18\x03 \x01(\x03\"v\n\x0c\x44\x65tectorList\x12\x35\n\x08\x64\x65tector\x18\x01 \x03(\x0b\x32#.JFJochProtoBuf.DetectorListElement\x12\x12\n\ncurrent_id\x18\x02 \x01(\x03\x12\x1b\n\x13\x63urrent_description\x18\x03 \x01(\t\"\x1f\n\x11\x44\x65tectorSelection\x12\n\n\x02id\x18\x01 \x01(\x03*T\n\x0b\x43ompression\x12\r\n\tBSHUF_LZ4\x10\x00\x12\x0e\n\nBSHUF_ZSTD\x10\x01\x12\x12\n\x0e\x42SHUF_ZSTD_RLE\x10\x02\x12\x12\n\x0eNO_COMPRESSION\x10\x03*Z\n\x0c\x44\x65tectorMode\x12\x0e\n\nCONVERSION\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x0f\n\x0bPEDESTAL_G0\x10\x02\x12\x0f\n\x0bPEDESTAL_G1\x10\x03\x12\x0f\n\x0bPEDESTAL_G2\x10\x04*6\n\x12\x46PGAFIFOStatusEnum\x12\t\n\x05\x45MPTY\x10\x00\x12\x08\n\x04\x46ULL\x10\x01\x12\x0b\n\x07PARTIAL\x10\x02*^\n\x05State\x12\x13\n\x0fNOT_INITIALIZED\x10\x00\x12\x08\n\x04IDLE\x10\x01\x12\x08\n\x04\x42USY\x10\x02\x12\x0c\n\x08PEDESTAL\x10\x03\x12\x13\n\x0f\x44\x41TA_COLLECTION\x10\x04\x12\t\n\x05\x45RROR\x10\x05*I\n\x0f\x46PGAPixelOutput\x12\x08\n\x04\x41UTO\x10\x00\x12\t\n\x05INT16\x10\x01\x12\n\n\x06UINT16\x10\x02\x12\t\n\x05INT32\x10\x03\x12\n\n\x06UINT32\x10\x04*{\n\x08PlotType\x12\x10\n\x0c\x42KG_ESTIMATE\x10\x00\x12\x0b\n\x07RAD_INT\x10\x01\x12\x0e\n\nSPOT_COUNT\x10\x02\x12\x11\n\rINDEXING_RATE\x10\x03\x12\x1a\n\x16INDEXING_RATE_PER_FILE\x10\x04\x12\x11\n\rADU_HISTOGRAM\x10\x05\x32\xb5\x05\n\x13gRPC_JFJochReceiver\x12?\n\x05Start\x12\x1d.JFJochProtoBuf.ReceiverInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x37\n\x05\x41\x62ort\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x38\n\x06\x43\x61ncel\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12?\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x1e.JFJochProtoBuf.ReceiverOutput\"\x00\x12\x44\n\tGetStatus\x12\x15.JFJochProtoBuf.Empty\x1a\x1e.JFJochProtoBuf.ReceiverStatus\"\x00\x12\\\n\x19SetDataProcessingSettings\x12&.JFJochProtoBuf.DataProcessingSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12M\n\x16GetDataProcessingPlots\x12\x1b.JFJochProtoBuf.PlotRequest\x1a\x14.JFJochProtoBuf.Plot\"\x00\x12\x62\n\x1cGetRadialIntegrationProfiles\x12\x15.JFJochProtoBuf.Empty\x1a).JFJochProtoBuf.RadialIntegrationProfiles\"\x00\x12R\n\x10GetNetworkConfig\x12\x15.JFJochProtoBuf.Empty\x1a%.JFJochProtoBuf.ReceiverNetworkConfig\"\x00\x32\xca\x01\n\x11gRPC_JFJochWriter\x12=\n\x05Start\x12\x1b.JFJochProtoBuf.WriterInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x37\n\x05\x41\x62ort\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12=\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.WriterOutput\"\x00\x32\x82\x03\n\x13gRPC_JFJochDetector\x12?\n\x05Start\x12\x1d.JFJochProtoBuf.DetectorInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x41\n\x06Status\x12\x15.JFJochProtoBuf.Empty\x1a\x1e.JFJochProtoBuf.DetectorStatus\"\x00\x12=\n\x02On\x12\x1e.JFJochProtoBuf.DetectorConfig\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x35\n\x03Off\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x32\xd4\x0c\n\x11gRPC_JFJochBroker\x12\x41\n\x05Start\x12\x1f.JFJochProtoBuf.DatasetSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12:\n\x08Pedestal\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nInitialize\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x38\n\x06\x43\x61ncel\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nDeactivate\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x42\n\tGetStatus\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.BrokerStatus\"\x00\x12\\\n\x18GetCalibrationStatistics\x12\x15.JFJochProtoBuf.Empty\x1a\'.JFJochProtoBuf.JFCalibrationStatistics\"\x00\x12P\n\x13GetDetectorSettings\x12\x15.JFJochProtoBuf.Empty\x1a .JFJochProtoBuf.DetectorSettings\"\x00\x12P\n\x13PutDetectorSettings\x12 .JFJochProtoBuf.DetectorSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12Z\n\x18GetMeasurementStatistics\x12\x15.JFJochProtoBuf.Empty\x1a%.JFJochProtoBuf.MeasurementStatistics\"\x00\x12\\\n\x19GetDataProcessingSettings\x12\x15.JFJochProtoBuf.Empty\x1a&.JFJochProtoBuf.DataProcessingSettings\"\x00\x12\\\n\x19PutDataProcessingSettings\x12&.JFJochProtoBuf.DataProcessingSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12?\n\x08GetPlots\x12\x1b.JFJochProtoBuf.PlotRequest\x1a\x14.JFJochProtoBuf.Plot\"\x00\x12\x62\n\x1cGetRadialIntegrationProfiles\x12\x15.JFJochProtoBuf.Empty\x1a).JFJochProtoBuf.RadialIntegrationProfiles\"\x00\x12?\n\rGetPedestalG0\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG1\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG2\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12\x39\n\x07GetMask\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12H\n\x0fGetDetectorList\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.DetectorList\"\x00\x12L\n\x0eSelectDetector\x12!.JFJochProtoBuf.DetectorSelection\x1a\x15.JFJochProtoBuf.Empty\"\x00\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xb1\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12:\n\x11\x66pga_pixel_output\x18\x03 \x01(\x0e\x32\x1f.JFJochProtoBuf.FPGAPixelOutput\x12\x11\n\tsummation\x18\x04 \x01(\x03\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12+\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCell\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12 \n\x18rad_int_solid_angle_corr\x18\x12 \x01(\x08\x12!\n\x19rad_int_polarization_corr\x18\x13 \x01(\x08\x12#\n\x1brad_int_polarization_factor\x18\x14 \x01(\x02\x12\x18\n\x10save_calibration\x18\x15 \x01(\x08\"\x90\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x15\n\rcount_time_us\x18\x02 \x01(\x03\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1a\n\x12pedestal_g0_frames\x18\x06 \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\x07 \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x08 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\n \x01(\x03\"b\n\x16\x44\x65tectorModuleGeometry\x12\x0e\n\x06pixel0\x18\x01 \x01(\x03\x12\x1b\n\x13\x66\x61st_direction_step\x18\x02 \x01(\x03\x12\x1b\n\x13slow_direction_step\x18\x03 \x01(\x03\"z\n\x10\x44\x65tectorGeometry\x12\x11\n\twidth_pxl\x18\x01 \x01(\x03\x12\x12\n\nheight_pxl\x18\x02 \x01(\x03\x12?\n\x0fmodule_geometry\x18\x03 \x03(\x0b\x32&.JFJochProtoBuf.DetectorModuleGeometry\"\xb2\x01\n\x08\x44\x65tector\x12\x10\n\x08nmodules\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x15\n\rpixel_size_mm\x18\x03 \x01(\x02\x12\x17\n\x0fmodule_hostname\x18\x04 \x03(\t\x12\x32\n\x08geometry\x18\x05 \x01(\x0b\x32 .JFJochProtoBuf.DetectorGeometry\x12\x1b\n\x13udp_interface_count\x18\x07 \x01(\x03\"\xdf\x05\n\x10InternalSettings\x12\"\n\x1a\x66rame_time_pedestalG1G2_us\x18\x01 \x01(\x03\x12\x15\n\rframe_time_us\x18\x03 \x01(\x03\x12\x15\n\rcount_time_us\x18\x04 \x01(\x03\x12*\n\x08\x64\x65tector\x18\x05 \x01(\x0b\x32\x18.JFJochProtoBuf.Detector\x12\x14\n\x0cndatastreams\x18\x06 \x01(\x03\x12&\n\x1einternal_fpga_packet_generator\x18\t \x01(\x08\x12\x15\n\rstorage_cells\x18\n \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x0b \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\' \x01(\x03\x12\x1a\n\x12pedestal_g0_frames\x18\x0c \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\r \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x0e \x01(\x03\x12\x19\n\x11preview_period_us\x18\x0f \x01(\x03\x12*\n\x04mode\x18\x13 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x19\n\x11mask_module_edges\x18\x14 \x01(\x08\x12\x17\n\x0fmask_chip_edges\x18\x15 \x01(\x08\x12\x16\n\x0eipv4_base_addr\x18\x16 \x01(\x03\x12\r\n\x05low_q\x18\x1a \x01(\x02\x12\x0e\n\x06high_q\x18\x1b \x01(\x02\x12\x11\n\tq_spacing\x18\x1c \x01(\x02\x12\x10\n\x08git_sha1\x18\x1d \x01(\t\x12\x10\n\x08git_date\x18\x1e \x01(\t\x12\x13\n\x0bsource_name\x18 \x01(\t\x12\x19\n\x11source_name_short\x18! \x01(\t\x12\x17\n\x0finstrument_name\x18\" \x01(\t\x12\x1d\n\x15instrument_name_short\x18# \x01(\t\x12\x18\n\x10\x64\x65\x62ug_pixel_mask\x18& \x01(\x08\"|\n\x14JungfraujochSettings\x12\x30\n\x07\x64\x61taset\x18\x01 \x01(\x0b\x32\x1f.JFJochProtoBuf.DatasetSettings\x12\x32\n\x08internal\x18\x02 \x01(\x0b\x32 .JFJochProtoBuf.InternalSettings\"\x1e\n\nJFPedestal\x12\x10\n\x08pedestal\x18\x01 \x01(\x0c\"-\n\x11JFGainCalibration\x12\x18\n\x10gain_calibration\x18\x01 \x01(\x0c\"\xb2\x01\n\rJFCalibration\x12\x10\n\x08nmodules\x18\x01 \x01(\x04\x12\x16\n\x0enstorage_cells\x18\x02 \x01(\x04\x12,\n\x08pedestal\x18\x03 \x03(\x0b\x32\x1a.JFJochProtoBuf.JFPedestal\x12\x0c\n\x04mask\x18\x04 \x01(\x0c\x12;\n\x10gain_calibration\x18\x05 \x03(\x0b\x32!.JFJochProtoBuf.JFGainCalibration\"V\n\x17JFCalibrationStatistics\x12;\n\x11module_statistics\x18\x01 \x03(\x0b\x32 .JFJochProtoBuf.ModuleStatistics\"F\n\x0bPlotRequest\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.JFJochProtoBuf.PlotType\x12\x0f\n\x07\x62inning\x18\x02 \x01(\x04\"M\n\x18RadialIntegrationProfile\x12\r\n\x05title\x18\x01 \x01(\t\x12\"\n\x04plot\x18\x02 \x01(\x0b\x32\x14.JFJochProtoBuf.Plot\"W\n\x19RadialIntegrationProfiles\x12:\n\x08profiles\x18\x01 \x03(\x0b\x32(.JFJochProtoBuf.RadialIntegrationProfile\">\n\x0bWriterInput\x12\x1c\n\x14zmq_receiver_address\x18\x01 \x01(\t\x12\x11\n\tseries_id\x18\x02 \x01(\x03\"3\n\x12\x44\x61taFileStatistics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07nimages\x18\x02 \x01(\x03\"\x8d\x01\n\x0cWriterOutput\x12\x0f\n\x07nimages\x18\x01 \x01(\x03\x12\x17\n\x0fperformance_MBs\x18\x02 \x01(\x02\x12\x16\n\x0eperformance_Hz\x18\x03 \x01(\x02\x12;\n\x0f\x66ile_statistics\x18\x04 \x03(\x0b\x32\".JFJochProtoBuf.DataFileStatistics\"\x82\x02\n\x14\x44\x65tectorModuleConfig\x12\x17\n\x0fudp_dest_port_1\x18\x01 \x01(\x04\x12\x17\n\x0fudp_dest_port_2\x18\x02 \x01(\x04\x12\x17\n\x0fipv4_src_addr_1\x18\x03 \x01(\t\x12\x17\n\x0fipv4_src_addr_2\x18\x04 \x01(\t\x12\x18\n\x10ipv4_dest_addr_1\x18\x05 \x01(\t\x12\x18\n\x10ipv4_dest_addr_2\x18\x06 \x01(\t\x12\x17\n\x0fmac_addr_dest_1\x18\x07 \x01(\t\x12\x17\n\x0fmac_addr_dest_2\x18\x08 \x01(\t\x12 \n\x18module_id_in_data_stream\x18\t \x01(\x04\"}\n\x0e\x44\x65tectorConfig\x12\x35\n\x07modules\x18\x01 \x03(\x0b\x32$.JFJochProtoBuf.DetectorModuleConfig\x12\x17\n\x0fmodule_hostname\x18\x02 \x03(\t\x12\x1b\n\x13udp_interface_count\x18\x03 \x01(\x03\"\xfc\x01\n\rDetectorInput\x12\x13\n\x0bmodules_num\x18\x01 \x01(\x03\x12*\n\x04mode\x18\x02 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x12\n\nnum_frames\x18\x03 \x01(\x03\x12\x14\n\x0cnum_triggers\x18\x04 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x05 \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x06 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\x07 \x01(\x03\x12\x11\n\tperiod_us\x18\t \x01(\x03\x12\x15\n\rcount_time_us\x18\n \x01(\x03\"\x10\n\x0e\x44\x65tectorOutput\"b\n\x0e\x44\x65tectorStatus\x12$\n\x05state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x12\n\nfw_version\x18\x02 \x01(\x03\x12\x16\n\x0eserver_version\x18\x03 \x01(\t\"Q\n\x0e\x46PGAFIFOStatus\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0e\x32\".JFJochProtoBuf.FPGAFIFOStatusEnum\"\xbb\x02\n\x16\x44\x61taProcessingSettings\x12!\n\x19signal_to_noise_threshold\x18\x01 \x01(\x02\x12\x1e\n\x16photon_count_threshold\x18\x02 \x01(\x03\x12\x18\n\x10min_pix_per_spot\x18\x03 \x01(\x03\x12\x18\n\x10max_pix_per_spot\x18\x04 \x01(\x03\x12\x16\n\x0elocal_bkg_size\x18\x05 \x01(\x03\x12\x1d\n\x15high_resolution_limit\x18\x06 \x01(\x02\x12\x1c\n\x14low_resolution_limit\x18\x07 \x01(\x02\x12\x1a\n\x12\x62kg_estimate_low_q\x18\x08 \x01(\x02\x12\x1b\n\x13\x62kg_estimate_high_q\x18\t \x01(\x02\x12\x1c\n\x14preview_indexed_only\x18\n \x01(\x08\"\xed\x01\n\x10ModuleStatistics\x12\x15\n\rmodule_number\x18\x01 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x02 \x01(\x03\x12\x18\n\x10pedestal_g0_mean\x18\x03 \x01(\x02\x12\x18\n\x10pedestal_g1_mean\x18\x04 \x01(\x02\x12\x18\n\x10pedestal_g2_mean\x18\x05 \x01(\x02\x12\x14\n\x0cgain_g0_mean\x18\x06 \x01(\x02\x12\x14\n\x0cgain_g1_mean\x18\x07 \x01(\x02\x12\x14\n\x0cgain_g2_mean\x18\x08 \x01(\x02\x12\x15\n\rmasked_pixels\x18\t \x01(\x04\"I\n\x05Image\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\r\n\x05width\x18\x02 \x01(\x03\x12\x0e\n\x06height\x18\x03 \x01(\x03\x12\x13\n\x0bpixel_depth\x18\x04 \x01(\x03\".\n\nMaskToLoad\x12\x0c\n\x04mask\x18\x01 \x03(\r\x12\x12\n\nbit_to_set\x18\x02 \x01(\x05\"\xc9\x02\n\x15MeasurementStatistics\x12\x13\n\x0b\x66ile_prefix\x18\x01 \x01(\t\x12\x18\n\x10images_collected\x18\x02 \x01(\x03\x12\x1d\n\x15max_image_number_sent\x18\x03 \x01(\x03\x12\x1d\n\x15\x63ollection_efficiency\x18\x04 \x01(\x02\x12\x19\n\x11\x63ompression_ratio\x18\x05 \x01(\x02\x12\x11\n\tcancelled\x18\x06 \x01(\x08\x12\x19\n\x11max_receive_delay\x18\x07 \x01(\x03\x12\x15\n\rindexing_rate\x18\n \x01(\x02\x12\x16\n\x0e\x64\x65tector_width\x18\x0c \x01(\x03\x12\x17\n\x0f\x64\x65tector_height\x18\r \x01(\x03\x12\x1c\n\x14\x64\x65tector_pixel_depth\x18\x0e \x01(\x03\x12\x14\n\x0c\x62kg_estimate\x18\x10 \x01(\x02\"\x89\x01\n\x0c\x42rokerStatus\x12+\n\x0c\x62roker_state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x10\n\x08progress\x18\x02 \x01(\x02\x12\x15\n\rindexing_rate\x18\x03 \x01(\x02\x12#\n\x1breceiver_send_buffers_avail\x18\x04 \x01(\x02\"H\n\x13\x44\x65tectorListElement\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x10\n\x08nmodules\x18\x02 \x01(\x03\x12\n\n\x02id\x18\x03 \x01(\x03\"v\n\x0c\x44\x65tectorList\x12\x35\n\x08\x64\x65tector\x18\x01 \x03(\x0b\x32#.JFJochProtoBuf.DetectorListElement\x12\x12\n\ncurrent_id\x18\x02 \x01(\x03\x12\x1b\n\x13\x63urrent_description\x18\x03 \x01(\t\"\x1f\n\x11\x44\x65tectorSelection\x12\n\n\x02id\x18\x01 \x01(\x03*T\n\x0b\x43ompression\x12\r\n\tBSHUF_LZ4\x10\x00\x12\x0e\n\nBSHUF_ZSTD\x10\x01\x12\x12\n\x0e\x42SHUF_ZSTD_RLE\x10\x02\x12\x12\n\x0eNO_COMPRESSION\x10\x03*Z\n\x0c\x44\x65tectorMode\x12\x0e\n\nCONVERSION\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x0f\n\x0bPEDESTAL_G0\x10\x02\x12\x0f\n\x0bPEDESTAL_G1\x10\x03\x12\x0f\n\x0bPEDESTAL_G2\x10\x04*6\n\x12\x46PGAFIFOStatusEnum\x12\t\n\x05\x45MPTY\x10\x00\x12\x08\n\x04\x46ULL\x10\x01\x12\x0b\n\x07PARTIAL\x10\x02*^\n\x05State\x12\x13\n\x0fNOT_INITIALIZED\x10\x00\x12\x08\n\x04IDLE\x10\x01\x12\x08\n\x04\x42USY\x10\x02\x12\x0c\n\x08PEDESTAL\x10\x03\x12\x13\n\x0f\x44\x41TA_COLLECTION\x10\x04\x12\t\n\x05\x45RROR\x10\x05*I\n\x0f\x46PGAPixelOutput\x12\x08\n\x04\x41UTO\x10\x00\x12\t\n\x05INT16\x10\x01\x12\n\n\x06UINT16\x10\x02\x12\t\n\x05INT32\x10\x03\x12\n\n\x06UINT32\x10\x04*{\n\x08PlotType\x12\x10\n\x0c\x42KG_ESTIMATE\x10\x00\x12\x0b\n\x07RAD_INT\x10\x01\x12\x0e\n\nSPOT_COUNT\x10\x02\x12\x11\n\rINDEXING_RATE\x10\x03\x12\x1a\n\x16INDEXING_RATE_PER_FILE\x10\x04\x12\x11\n\rADU_HISTOGRAM\x10\x05\x32\xca\x01\n\x11gRPC_JFJochWriter\x12=\n\x05Start\x12\x1b.JFJochProtoBuf.WriterInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x37\n\x05\x41\x62ort\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12=\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.WriterOutput\"\x00\x32\x82\x03\n\x13gRPC_JFJochDetector\x12?\n\x05Start\x12\x1d.JFJochProtoBuf.DetectorInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x41\n\x06Status\x12\x15.JFJochProtoBuf.Empty\x1a\x1e.JFJochProtoBuf.DetectorStatus\"\x00\x12=\n\x02On\x12\x1e.JFJochProtoBuf.DetectorConfig\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x35\n\x03Off\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x32\xd4\x0c\n\x11gRPC_JFJochBroker\x12\x41\n\x05Start\x12\x1f.JFJochProtoBuf.DatasetSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12:\n\x08Pedestal\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nInitialize\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x38\n\x06\x43\x61ncel\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nDeactivate\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x42\n\tGetStatus\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.BrokerStatus\"\x00\x12\\\n\x18GetCalibrationStatistics\x12\x15.JFJochProtoBuf.Empty\x1a\'.JFJochProtoBuf.JFCalibrationStatistics\"\x00\x12P\n\x13GetDetectorSettings\x12\x15.JFJochProtoBuf.Empty\x1a .JFJochProtoBuf.DetectorSettings\"\x00\x12P\n\x13PutDetectorSettings\x12 .JFJochProtoBuf.DetectorSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12Z\n\x18GetMeasurementStatistics\x12\x15.JFJochProtoBuf.Empty\x1a%.JFJochProtoBuf.MeasurementStatistics\"\x00\x12\\\n\x19GetDataProcessingSettings\x12\x15.JFJochProtoBuf.Empty\x1a&.JFJochProtoBuf.DataProcessingSettings\"\x00\x12\\\n\x19PutDataProcessingSettings\x12&.JFJochProtoBuf.DataProcessingSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12?\n\x08GetPlots\x12\x1b.JFJochProtoBuf.PlotRequest\x1a\x14.JFJochProtoBuf.Plot\"\x00\x12\x62\n\x1cGetRadialIntegrationProfiles\x12\x15.JFJochProtoBuf.Empty\x1a).JFJochProtoBuf.RadialIntegrationProfiles\"\x00\x12?\n\rGetPedestalG0\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG1\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG2\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12\x39\n\x07GetMask\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12H\n\x0fGetDetectorList\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.DetectorList\"\x00\x12L\n\x0eSelectDetector\x12!.JFJochProtoBuf.DetectorSelection\x1a\x15.JFJochProtoBuf.Empty\"\x00\x62\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'jfjoch_pb2', globals()) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None - _COMPRESSION._serialized_start=6316 - _COMPRESSION._serialized_end=6400 - _DETECTORMODE._serialized_start=6402 - _DETECTORMODE._serialized_end=6492 - _FPGAFIFOSTATUSENUM._serialized_start=6494 - _FPGAFIFOSTATUSENUM._serialized_end=6548 - _STATE._serialized_start=6550 - _STATE._serialized_end=6644 - _FPGAPIXELOUTPUT._serialized_start=6646 - _FPGAPIXELOUTPUT._serialized_end=6719 - _PLOTTYPE._serialized_start=6721 - _PLOTTYPE._serialized_end=6844 + _COMPRESSION._serialized_start=5510 + _COMPRESSION._serialized_end=5594 + _DETECTORMODE._serialized_start=5596 + _DETECTORMODE._serialized_end=5686 + _FPGAFIFOSTATUSENUM._serialized_start=5688 + _FPGAFIFOSTATUSENUM._serialized_end=5742 + _STATE._serialized_start=5744 + _STATE._serialized_end=5838 + _FPGAPIXELOUTPUT._serialized_start=5840 + _FPGAPIXELOUTPUT._serialized_end=5913 + _PLOTTYPE._serialized_start=5915 + _PLOTTYPE._serialized_end=6038 _EMPTY._serialized_start=32 _EMPTY._serialized_end=39 _UNITCELL._serialized_start=41 @@ -64,64 +64,52 @@ if _descriptor._USE_C_DESCRIPTORS == False: _JFCALIBRATION._serialized_end=2695 _JFCALIBRATIONSTATISTICS._serialized_start=2697 _JFCALIBRATIONSTATISTICS._serialized_end=2783 - _RECEIVERINPUT._serialized_start=2786 - _RECEIVERINPUT._serialized_end=2922 - _RECEIVEROUTPUT._serialized_start=2925 - _RECEIVEROUTPUT._serialized_end=3330 - _RECEIVERNETWORKCONFIGDEVICE._serialized_start=3332 - _RECEIVERNETWORKCONFIGDEVICE._serialized_end=3416 - _RECEIVERNETWORKCONFIG._serialized_start=3418 - _RECEIVERNETWORKCONFIG._serialized_end=3502 - _RECEIVERSTATUS._serialized_start=3504 - _RECEIVERSTATUS._serialized_end=3589 - _PLOTREQUEST._serialized_start=3591 - _PLOTREQUEST._serialized_end=3661 - _RADIALINTEGRATIONPROFILE._serialized_start=3663 - _RADIALINTEGRATIONPROFILE._serialized_end=3740 - _RADIALINTEGRATIONPROFILES._serialized_start=3742 - _RADIALINTEGRATIONPROFILES._serialized_end=3829 - _WRITERINPUT._serialized_start=3831 - _WRITERINPUT._serialized_end=3893 - _DATAFILESTATISTICS._serialized_start=3895 - _DATAFILESTATISTICS._serialized_end=3946 - _WRITEROUTPUT._serialized_start=3949 - _WRITEROUTPUT._serialized_end=4090 - _DETECTORMODULECONFIG._serialized_start=4093 - _DETECTORMODULECONFIG._serialized_end=4351 - _DETECTORCONFIG._serialized_start=4353 - _DETECTORCONFIG._serialized_end=4478 - _DETECTORINPUT._serialized_start=4481 - _DETECTORINPUT._serialized_end=4733 - _DETECTOROUTPUT._serialized_start=4735 - _DETECTOROUTPUT._serialized_end=4751 - _DETECTORSTATUS._serialized_start=4753 - _DETECTORSTATUS._serialized_end=4851 - _FPGAFIFOSTATUS._serialized_start=4853 - _FPGAFIFOSTATUS._serialized_end=4934 - _DATAPROCESSINGSETTINGS._serialized_start=4937 - _DATAPROCESSINGSETTINGS._serialized_end=5252 - _MODULESTATISTICS._serialized_start=5255 - _MODULESTATISTICS._serialized_end=5492 - _IMAGE._serialized_start=5494 - _IMAGE._serialized_end=5567 - _MASKTOLOAD._serialized_start=5569 - _MASKTOLOAD._serialized_end=5615 - _MEASUREMENTSTATISTICS._serialized_start=5618 - _MEASUREMENTSTATISTICS._serialized_end=5947 - _BROKERSTATUS._serialized_start=5950 - _BROKERSTATUS._serialized_end=6087 - _DETECTORLISTELEMENT._serialized_start=6089 - _DETECTORLISTELEMENT._serialized_end=6161 - _DETECTORLIST._serialized_start=6163 - _DETECTORLIST._serialized_end=6281 - _DETECTORSELECTION._serialized_start=6283 - _DETECTORSELECTION._serialized_end=6314 - _GRPC_JFJOCHRECEIVER._serialized_start=6847 - _GRPC_JFJOCHRECEIVER._serialized_end=7540 - _GRPC_JFJOCHWRITER._serialized_start=7543 - _GRPC_JFJOCHWRITER._serialized_end=7745 - _GRPC_JFJOCHDETECTOR._serialized_start=7748 - _GRPC_JFJOCHDETECTOR._serialized_end=8134 - _GRPC_JFJOCHBROKER._serialized_start=8137 - _GRPC_JFJOCHBROKER._serialized_end=9757 + _PLOTREQUEST._serialized_start=2785 + _PLOTREQUEST._serialized_end=2855 + _RADIALINTEGRATIONPROFILE._serialized_start=2857 + _RADIALINTEGRATIONPROFILE._serialized_end=2934 + _RADIALINTEGRATIONPROFILES._serialized_start=2936 + _RADIALINTEGRATIONPROFILES._serialized_end=3023 + _WRITERINPUT._serialized_start=3025 + _WRITERINPUT._serialized_end=3087 + _DATAFILESTATISTICS._serialized_start=3089 + _DATAFILESTATISTICS._serialized_end=3140 + _WRITEROUTPUT._serialized_start=3143 + _WRITEROUTPUT._serialized_end=3284 + _DETECTORMODULECONFIG._serialized_start=3287 + _DETECTORMODULECONFIG._serialized_end=3545 + _DETECTORCONFIG._serialized_start=3547 + _DETECTORCONFIG._serialized_end=3672 + _DETECTORINPUT._serialized_start=3675 + _DETECTORINPUT._serialized_end=3927 + _DETECTOROUTPUT._serialized_start=3929 + _DETECTOROUTPUT._serialized_end=3945 + _DETECTORSTATUS._serialized_start=3947 + _DETECTORSTATUS._serialized_end=4045 + _FPGAFIFOSTATUS._serialized_start=4047 + _FPGAFIFOSTATUS._serialized_end=4128 + _DATAPROCESSINGSETTINGS._serialized_start=4131 + _DATAPROCESSINGSETTINGS._serialized_end=4446 + _MODULESTATISTICS._serialized_start=4449 + _MODULESTATISTICS._serialized_end=4686 + _IMAGE._serialized_start=4688 + _IMAGE._serialized_end=4761 + _MASKTOLOAD._serialized_start=4763 + _MASKTOLOAD._serialized_end=4809 + _MEASUREMENTSTATISTICS._serialized_start=4812 + _MEASUREMENTSTATISTICS._serialized_end=5141 + _BROKERSTATUS._serialized_start=5144 + _BROKERSTATUS._serialized_end=5281 + _DETECTORLISTELEMENT._serialized_start=5283 + _DETECTORLISTELEMENT._serialized_end=5355 + _DETECTORLIST._serialized_start=5357 + _DETECTORLIST._serialized_end=5475 + _DETECTORSELECTION._serialized_start=5477 + _DETECTORSELECTION._serialized_end=5508 + _GRPC_JFJOCHWRITER._serialized_start=6041 + _GRPC_JFJOCHWRITER._serialized_end=6243 + _GRPC_JFJOCHDETECTOR._serialized_start=6246 + _GRPC_JFJOCHDETECTOR._serialized_end=6632 + _GRPC_JFJOCHBROKER._serialized_start=6635 + _GRPC_JFJOCHBROKER._serialized_end=8255 # @@protoc_insertion_point(module_scope) diff --git a/python/jfjoch_pb2_grpc.py b/python/jfjoch_pb2_grpc.py index 5286f9ec..79328e11 100644 --- a/python/jfjoch_pb2_grpc.py +++ b/python/jfjoch_pb2_grpc.py @@ -5,331 +5,6 @@ import grpc import jfjoch_pb2 as jfjoch__pb2 -class gRPC_JFJochReceiverStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Start = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/Start', - request_serializer=jfjoch__pb2.ReceiverInput.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Abort = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/Abort', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Cancel = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/Cancel', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Stop = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/Stop', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.ReceiverOutput.FromString, - ) - self.GetStatus = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/GetStatus', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.ReceiverStatus.FromString, - ) - self.SetDataProcessingSettings = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/SetDataProcessingSettings', - request_serializer=jfjoch__pb2.DataProcessingSettings.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.GetDataProcessingPlots = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/GetDataProcessingPlots', - request_serializer=jfjoch__pb2.PlotRequest.SerializeToString, - response_deserializer=jfjoch__pb2.Plot.FromString, - ) - self.GetRadialIntegrationProfiles = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/GetRadialIntegrationProfiles', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.RadialIntegrationProfiles.FromString, - ) - self.GetNetworkConfig = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochReceiver/GetNetworkConfig', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.ReceiverNetworkConfig.FromString, - ) - - -class gRPC_JFJochReceiverServicer(object): - """Missing associated documentation comment in .proto file.""" - - def Start(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Abort(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Cancel(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Stop(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetStatus(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetDataProcessingSettings(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetDataProcessingPlots(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetRadialIntegrationProfiles(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetNetworkConfig(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_gRPC_JFJochReceiverServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Start': grpc.unary_unary_rpc_method_handler( - servicer.Start, - request_deserializer=jfjoch__pb2.ReceiverInput.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Abort': grpc.unary_unary_rpc_method_handler( - servicer.Abort, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Cancel': grpc.unary_unary_rpc_method_handler( - servicer.Cancel, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Stop': grpc.unary_unary_rpc_method_handler( - servicer.Stop, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.ReceiverOutput.SerializeToString, - ), - 'GetStatus': grpc.unary_unary_rpc_method_handler( - servicer.GetStatus, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.ReceiverStatus.SerializeToString, - ), - 'SetDataProcessingSettings': grpc.unary_unary_rpc_method_handler( - servicer.SetDataProcessingSettings, - request_deserializer=jfjoch__pb2.DataProcessingSettings.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'GetDataProcessingPlots': grpc.unary_unary_rpc_method_handler( - servicer.GetDataProcessingPlots, - request_deserializer=jfjoch__pb2.PlotRequest.FromString, - response_serializer=jfjoch__pb2.Plot.SerializeToString, - ), - 'GetRadialIntegrationProfiles': grpc.unary_unary_rpc_method_handler( - servicer.GetRadialIntegrationProfiles, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.RadialIntegrationProfiles.SerializeToString, - ), - 'GetNetworkConfig': grpc.unary_unary_rpc_method_handler( - servicer.GetNetworkConfig, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.ReceiverNetworkConfig.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'JFJochProtoBuf.gRPC_JFJochReceiver', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class gRPC_JFJochReceiver(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def Start(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/Start', - jfjoch__pb2.ReceiverInput.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Abort(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/Abort', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Cancel(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/Cancel', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Stop(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/Stop', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.ReceiverOutput.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetStatus(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/GetStatus', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.ReceiverStatus.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def SetDataProcessingSettings(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/SetDataProcessingSettings', - jfjoch__pb2.DataProcessingSettings.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetDataProcessingPlots(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/GetDataProcessingPlots', - jfjoch__pb2.PlotRequest.SerializeToString, - jfjoch__pb2.Plot.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetRadialIntegrationProfiles(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/GetRadialIntegrationProfiles', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.RadialIntegrationProfiles.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def GetNetworkConfig(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochReceiver/GetNetworkConfig', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.ReceiverNetworkConfig.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - class gRPC_JFJochWriterStub(object): """Missing associated documentation comment in .proto file.""" diff --git a/receiver/CMakeLists.txt b/receiver/CMakeLists.txt index 7191c836..ec8c51f5 100644 --- a/receiver/CMakeLists.txt +++ b/receiver/CMakeLists.txt @@ -5,10 +5,6 @@ ADD_LIBRARY(JFJochReceiver STATIC TARGET_LINK_LIBRARIES(JFJochReceiver ImageAnalysis JungfraujochAcqusitionDevice CommonFunctions HLSSimulation) -ADD_EXECUTABLE(jfjoch_receiver jfjoch_receiver.cpp) -TARGET_LINK_LIBRARIES(jfjoch_receiver JFJochReceiver) -INSTALL(TARGETS jfjoch_receiver RUNTIME) - ADD_EXECUTABLE(jfjoch_action_test jfjoch_action_test.cpp) TARGET_LINK_LIBRARIES(jfjoch_action_test JungfraujochHost JFJochReceiver) INSTALL(TARGETS jfjoch_action_test RUNTIME) diff --git a/receiver/JFJochReceiverService.cpp b/receiver/JFJochReceiverService.cpp index 29f01ac2..7afea292 100644 --- a/receiver/JFJochReceiverService.cpp +++ b/receiver/JFJochReceiverService.cpp @@ -2,71 +2,12 @@ #include "JFJochReceiverService.h" -inline PlotRequest Convert(const JFJochProtoBuf::PlotRequest& request) { - PlotRequest ret; - ret.binning = request.binning(); - switch (request.type()) { - case JFJochProtoBuf::BKG_ESTIMATE: - ret.type = PlotType::BkgEstimate; - break; - case JFJochProtoBuf::RAD_INT: - ret.type = PlotType::RadInt; - break; - case JFJochProtoBuf::SPOT_COUNT: - ret.type = PlotType::SpotCount; - break; - case JFJochProtoBuf::INDEXING_RATE: - ret.type = PlotType::IndexingRate; - break; - case JFJochProtoBuf::INDEXING_RATE_PER_FILE: - ret.type = PlotType::IndexingRatePerFile; - break; - default: - case JFJochProtoBuf::ADU_HISTOGRAM: - ret.type = PlotType::ADUHistorgram; - break; - } - return ret; -} - -inline void Convert(const Plot& input, JFJochProtoBuf::Plot &output) { - if (!input.x.empty()) - *output.mutable_x() = {input.x.begin(), input.x.end()}; - if (!input.y.empty()) - *output.mutable_y() = {input.y.begin(), input.y.end()}; - -} - -inline DataProcessingSettings Convert(const JFJochProtoBuf::DataProcessingSettings &input) { - DataProcessingSettings ret; - ret.signal_to_noise_threshold = input.signal_to_noise_threshold(); - ret.photon_count_threshold = input.photon_count_threshold(); - ret.min_pix_per_spot = input.min_pix_per_spot(); - ret.max_pix_per_spot = input.max_pix_per_spot(); - ret.local_bkg_size = input.local_bkg_size(); - ret.high_resolution_limit = input.high_resolution_limit(); - ret.low_resolution_limit = input.low_resolution_limit(); - ret.bkg_estimate_low_q = input.bkg_estimate_low_q(); - ret.bkg_estimate_high_q = input.bkg_estimate_high_q(); - ret.preview_indexed_only = input.preview_indexed_only(); - return ret; -} - -void Convert(const RadialIntegrationProfiles& input, JFJochProtoBuf::RadialIntegrationProfiles& output) { - for (const auto &i: input.profiles) { - auto tmp = output.add_profiles(); - tmp->set_title(i.title); - Convert(i.plot, *tmp->mutable_plot()); - } -} - JFJochReceiverService::JFJochReceiverService(AcquisitionDeviceGroup &in_aq_devices, Logger &in_logger, ImagePusher &pusher) : logger(in_logger), aq_devices(in_aq_devices), image_pusher(pusher), data_processing_settings(DiffractionExperiment::DefaultDataProcessingSettings()) { } - JFJochReceiverService& JFJochReceiverService::NumThreads(int64_t input) { if (input <= 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Thread number must be above zero"); @@ -96,23 +37,6 @@ JFJochReceiverService &JFJochReceiverService::NUMAPolicy(const std::string &poli return *this; } -grpc::Status JFJochReceiverService::Start(grpc::ServerContext *context, const JFJochProtoBuf::ReceiverInput *request, - JFJochProtoBuf::Empty *response) { - experiment = std::make_unique(request->jungfraujoch_settings()); - if (request->has_calibration()) - calibration = std::make_unique(request->calibration()); - else - calibration.reset(); - - try { - Start(*experiment, calibration.get()); - return grpc::Status::OK; - } catch (const JFJochException &e) { - logger.ErrorException(e); - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - void JFJochReceiverService::FinalizeMeasurement() { receiver->StopReceiver(); { @@ -122,55 +46,6 @@ void JFJochReceiverService::FinalizeMeasurement() { } } -grpc::Status JFJochReceiverService::Stop(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::ReceiverOutput *response) { - try { - auto output = Stop(); - response->set_max_receive_delay(output.max_receive_delay); - response->set_compressed_size(output.compressed_size); - response->set_compressed_ratio(output.compressed_ratio); - response->set_images_sent(output.images_sent); - response->set_start_time_ms(output.start_time_ms); - response->set_end_time_ms(output.end_time_ms); - response->set_efficiency(output.efficiency); - response->set_max_image_number_sent(output.max_image_number_sent); - response->set_cancelled(output.cancelled); - response->set_master_file_name(output.master_file_name); - if (!output.pedestal_result.empty()) - *response->mutable_pedestal_result() = {output.pedestal_result.begin(), output.pedestal_result.end()}; - response->set_indexing_rate(output.indexing_rate); - response->set_bkg_estimate(output.bkg_estimate); - for (const auto &i: output.received_packets) - response->add_received_packets(i); - for (const auto &i: output.expected_packets) - response->add_expected_packets(i); - return grpc::Status::OK; - } catch (JFJochException &e) { - logger.ErrorException(e); - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochReceiverService::Cancel(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) { - try { - Cancel(); - return grpc::Status::OK; - } catch (std::exception &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochReceiverService::Abort(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) { - try { - Abort(); - return grpc::Status::OK; - } catch (std::exception &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - JFJochReceiverStatus JFJochReceiverService::GetStatus() { // Need to hold mutex, as receiver might not exist here, if state is idle std::unique_lock ul(state_mutex); @@ -185,63 +60,6 @@ JFJochReceiverStatus JFJochReceiverService::GetStatus() { }; } -grpc::Status JFJochReceiverService::GetStatus(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::ReceiverStatus *response) { - auto tmp = GetStatus(); - response->set_send_buffers_avail(tmp.send_buffers_avail); - response->set_indexing_rate(tmp.indexing_rate); - response->set_progress(tmp.progress); - return grpc::Status::OK; -} - -grpc::Status JFJochReceiverService::GetDataProcessingPlots(grpc::ServerContext *context, - const JFJochProtoBuf::PlotRequest *request, - JFJochProtoBuf::Plot *response) { - // Need to hold mutex, as receiver might not exist here, if state is idle - try { - Convert(GetDataProcessingPlot(Convert(*request)), *response); - return grpc::Status::OK; - } catch (std::exception &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochReceiverService::GetRadialIntegrationProfiles(grpc::ServerContext *context, - const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::RadialIntegrationProfiles *response) { - // Need to hold mutex, as receiver might not exist here, if state is idle - try { - Convert(GetRadialIntegrationProfiles(), *response); - return grpc::Status::OK; - } catch (std::exception &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochReceiverService::SetDataProcessingSettings(grpc::ServerContext *context, - const JFJochProtoBuf::DataProcessingSettings *request, - JFJochProtoBuf::Empty *response) { - try { - SetDataProcessingSettings(Convert(*request)); - return grpc::Status::OK; - } catch (std::exception &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochReceiverService::GetNetworkConfig(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::ReceiverNetworkConfig *response) { - auto v = GetNetworkConfig(); - - for (const auto &i: v) { - auto dev_net_cfg = response->add_device(); - dev_net_cfg->set_mac_addr(i.mac_addr); - dev_net_cfg->set_ipv4_addr(i.ipv4_addr); - dev_net_cfg->set_udp_port(i.udp_port); - } - return grpc::Status::OK; -} - void JFJochReceiverService::Start(const DiffractionExperiment &experiment, const JFCalibration *calibration) { std::unique_lock ul_state(state_mutex); if (state != ReceiverState::Idle) diff --git a/receiver/JFJochReceiverService.h b/receiver/JFJochReceiverService.h index df2d43bc..52c9ca98 100644 --- a/receiver/JFJochReceiverService.h +++ b/receiver/JFJochReceiverService.h @@ -3,19 +3,15 @@ #ifndef JUNGFRAUJOCH_JFJOCHRECEIVERSERVICE_H #define JUNGFRAUJOCH_JFJOCHRECEIVERSERVICE_H -#include "JFJochReceiver.h" -#include "jfjoch.grpc.pb.h" - #include +#include "JFJochReceiver.h" #include "../common/NUMAHWPolicy.h" -class JFJochReceiverService final : public JFJochProtoBuf::gRPC_JFJochReceiver::Service { +class JFJochReceiverService { NUMAHWPolicy numa_policy; std::unique_ptr receiver; AcquisitionDeviceGroup &aq_devices; - std::unique_ptr calibration; - std::unique_ptr experiment; Logger &logger; ImagePusher &image_pusher; @@ -49,25 +45,6 @@ public: RadialIntegrationProfiles GetRadialIntegrationProfiles(); JFJochReceiverStatus GetStatus(); std::vector GetNetworkConfig(); - - grpc::Status Start(grpc::ServerContext* context, const JFJochProtoBuf::ReceiverInput* request, - JFJochProtoBuf::Empty* response) override; - grpc::Status Abort(grpc::ServerContext* context, const JFJochProtoBuf::Empty* request, - JFJochProtoBuf::Empty* response) override; - grpc::Status Cancel(grpc::ServerContext* context, const JFJochProtoBuf::Empty* request, - JFJochProtoBuf::Empty* response) override; - grpc::Status Stop(grpc::ServerContext* context, const JFJochProtoBuf::Empty* request, - JFJochProtoBuf::ReceiverOutput* response) override; - grpc::Status GetStatus(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::ReceiverStatus *response) override; - grpc::Status SetDataProcessingSettings(grpc::ServerContext *context, const JFJochProtoBuf::DataProcessingSettings *request, - JFJochProtoBuf::Empty *response) override; - grpc::Status GetNetworkConfig(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::ReceiverNetworkConfig *response) override; - grpc::Status GetDataProcessingPlots(grpc::ServerContext *context, const JFJochProtoBuf::PlotRequest *request, - JFJochProtoBuf::Plot *response) override; - grpc::Status GetRadialIntegrationProfiles(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::RadialIntegrationProfiles *response) override; }; diff --git a/receiver/JFJochReceiverTest.cpp b/receiver/JFJochReceiverTest.cpp index 0b739dd9..6b1dd308 100644 --- a/receiver/JFJochReceiverTest.cpp +++ b/receiver/JFJochReceiverTest.cpp @@ -27,7 +27,6 @@ JFJochReceiverOutput RunJFJochReceiverTest(AcquisitionDeviceGroup &aq_devices, I settings.local_bkg_size = 5; service.SetDataProcessingSettings(settings); - grpc::ServerContext grpc_context; service.Start(x, &calib); if (x.GetImageNum() > 0) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36871cfc..3e3a7508 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,7 +11,7 @@ ADD_EXECUTABLE(CatchTest FrameTransformationTest.cpp HDF5WritingTest.cpp PedestalCalcTest.cpp ZMQImagePusherTest.cpp StreamWriterTest.cpp - CoordTest.cpp JFJochBrokerTest.cpp gRPCServerTest.cpp + CoordTest.cpp JFJochBrokerTest.cpp JFJochReceiverIntegrationTest.cpp AcquisitionCountersTest.cpp JFJochFullIntegrationTest.cpp diff --git a/tests/DiffractionExperimentTest.cpp b/tests/DiffractionExperimentTest.cpp index 0d828b2d..84f7e68b 100644 --- a/tests/DiffractionExperimentTest.cpp +++ b/tests/DiffractionExperimentTest.cpp @@ -158,17 +158,6 @@ TEST_CASE("DiffractionExperiment_UnitCell","[DiffractionExperiment]") { REQUIRE_NOTHROW(x.SetUnitCell()); REQUIRE(!x.HasUnitCell()); REQUIRE_NOTHROW(x.SetUnitCell(cell)); - - JFJochProtoBuf::JungfraujochSettings settings = x; - - DiffractionExperiment y(settings); - - REQUIRE(y.GetUnitCell().a == x.GetUnitCell().a); - REQUIRE(y.GetUnitCell().b == x.GetUnitCell().b); - REQUIRE(y.GetUnitCell().c == x.GetUnitCell().c); - REQUIRE(y.GetUnitCell().alpha == x.GetUnitCell().alpha); - REQUIRE(y.GetUnitCell().beta == x.GetUnitCell().beta); - REQUIRE(y.GetUnitCell().gamma == x.GetUnitCell().gamma); } TEST_CASE("DiffractionExperiment_IPv4Address","[DiffractionExperiment]") { @@ -453,47 +442,6 @@ TEST_CASE("DiffractionExperiment_FrameCountTime","[DiffractionExperiment]") { REQUIRE(x.GetImageCountTime() == std::chrono::microseconds(7*567)); } */ -TEST_CASE("DiffractionExperiment_ExportProtobuf","[DiffractionExperiment]") { - DiffractionExperiment x(DetectorGeometry(16, 4, 0, 0, false)),y; - x.DataStreams(3); - - std::vector v = {DetectorMode::Raw, DetectorMode::Conversion, - DetectorMode::PedestalG0, DetectorMode::PedestalG1, DetectorMode::PedestalG2}; - for (auto &i : v) { - x.Mode(i).FilePrefix("z").ImagesPerTrigger(20).NumTriggers(5).PedestalG0Frames(1345) - .PedestalG1Frames(1876).PedestalG2Frames(654) - .PhotonEnergy_keV(16.0).BeamX_pxl(566).BeamY_pxl(1234).DetectorDistance_mm(145) - .FrameTime(std::chrono::microseconds(765), std::chrono::microseconds(10)) - .PedestalG1G2FrameTime(std::chrono::milliseconds(10)) - .IPv4BaseAddr("2.2.2.2").MaskModuleEdges(true); - - JFJochProtoBuf::JungfraujochSettings settings_in_protobuf = x; - REQUIRE_NOTHROW(y.Import(settings_in_protobuf)); - - REQUIRE(y.GetFilePrefix() == x.GetFilePrefix()); - REQUIRE(x.GetDataStreamsNum() == y.GetDataStreamsNum()); - REQUIRE(x.GetXPixelsNum() == y.GetXPixelsNum()); - REQUIRE(x.GetModulesNum(2) == y.GetModulesNum(2)); - REQUIRE(x.GetDetectorMode() == y.GetDetectorMode()); - - REQUIRE(y.GetPedestalG1Frames() == 1876); - REQUIRE(y.GetPedestalG2Frames() == 654); - REQUIRE(y.GetPhotonEnergy_keV() == 16.0); - REQUIRE(y.GetBeamX_pxl() == 566); - REQUIRE(y.GetBeamY_pxl() == 1234); - REQUIRE(y.GetDetectorDistance_mm() == 145); - - REQUIRE(x.GetFrameNum() == y.GetFrameNum()); - REQUIRE(x.GetImageTime() == y.GetImageTime()); - REQUIRE(y.GetFrameCountTime().count() == x.GetFrameCountTime().count()); - - REQUIRE(y.GetSrcIPv4Address(0, 0) == 0x02020202); - REQUIRE(y.GetPedestalG0Frames() == x.GetPedestalG0Frames()); - REQUIRE(y.GetMaskModuleEdges() == x.GetMaskModuleEdges()); - REQUIRE(y.GetMaskChipEdges() == x.GetMaskChipEdges()); - } -} - TEST_CASE("DiffractionExperiment_InternalPacketGenerator", "[DiffractionExperiment]") { DiffractionExperiment x; @@ -871,17 +819,17 @@ TEST_CASE("DiffractionExperiment_DetectorModuleHostname","[DiffractionExperiment DiffractionExperiment x(DetectorSetup(3, "X", h)); JFJochProtoBuf::DetectorConfig det_cfg; - JFJochProtoBuf::ReceiverNetworkConfig net_cfg; + std::vector net_cfg; - auto d1 = net_cfg.add_device(); - d1->set_mac_addr("00:00:00:00:00:00"); - d1->set_ipv4_addr("10.10.50.1"); - d1->set_udp_port(1234); + net_cfg.push_back(AcquisitionDeviceNetConfig{ + .mac_addr = "00:00:00:00:00:00", + .ipv4_addr = "10.10.50.1", + .udp_port = 1234}); - auto d2 = net_cfg.add_device(); - d2->set_mac_addr("00:00:00:00:00:01"); - d2->set_ipv4_addr("10.10.50.2"); - d2->set_udp_port(1234); + net_cfg.push_back(AcquisitionDeviceNetConfig{ + .mac_addr = "00:00:00:00:00:01", + .ipv4_addr = "10.10.50.2", + .udp_port = 1234}); std::vector h_out; REQUIRE_NOTHROW(x.GetDetectorModuleHostname(h_out)); diff --git a/tests/JFJochFullIntegrationTest.cpp b/tests/JFJochFullIntegrationTest.cpp index a0077ea9..0c8b3f13 100644 --- a/tests/JFJochFullIntegrationTest.cpp +++ b/tests/JFJochFullIntegrationTest.cpp @@ -22,21 +22,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ", "[JFJochReceiver]") { int64_t ndatastream = 2; int64_t nmodules = 4; - JFJochServices services(logger); - JFJochStateMachine state_machine(services, logger); - - REQUIRE(!state_machine.GetMeasurementStatistics().has_value()); - state_machine.AddDetectorSetup(DetectorGeometry(ndatastream * nmodules, 2, 8, 36)); - - state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); - state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); - - logger.Verbose(true); - - std::vector image(RAW_MODULE_SIZE); - - AcquisitionDeviceGroup aq_devices; + AcquisitionDeviceGroup aq_devices; for (int i = 0; i < ndatastream; i++) { auto test = std::make_unique(i, 256); @@ -45,10 +31,23 @@ TEST_CASE("JFJochIntegrationTest_ZMQ", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + + JFJochServices services(logger); + JFJochStateMachine state_machine(services, logger); + + REQUIRE(!state_machine.GetMeasurementStatistics().has_value()); + state_machine.AddDetectorSetup(DetectorGeometry(ndatastream * nmodules, 2, 8, 36)); + + state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); + state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); + services.Writer("unix:writer_test", "inproc://#1").Receiver(&fpga_receiver); + + logger.Verbose(true); + + std::vector image(RAW_MODULE_SIZE); JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -96,7 +95,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ", "[JFJochReceiver]") { REQUIRE(statistics.detector_width() == 2068); REQUIRE(statistics.detector_height() == 2164); REQUIRE(statistics.detector_pixel_depth() == 2); - fpga_receiver_server->Shutdown(); writer_server->Shutdown(); } @@ -110,34 +108,33 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_save_calibration", "[JFJochReceiver]") { int64_t nimages = 5; int64_t ndatastream = 2; int64_t nmodules = 4; - - JFJochServices services(logger); - JFJochStateMachine state_machine(services, logger); - - REQUIRE(!state_machine.GetMeasurementStatistics().has_value()); - state_machine.AddDetectorSetup(DetectorGeometry(ndatastream * nmodules, 2, 8, 36)); - - state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); - state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); - - logger.Verbose(true); - - std::vector image(RAW_MODULE_SIZE); - - AcquisitionDeviceGroup aq_devices; + + AcquisitionDeviceGroup aq_devices; for (int i = 0; i < ndatastream; i++) { auto test = std::make_unique(i, 256); aq_devices.Add(std::move(test)); } - + ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + + JFJochServices services(logger); + JFJochStateMachine state_machine(services, logger); + + REQUIRE(!state_machine.GetMeasurementStatistics().has_value()); + state_machine.AddDetectorSetup(DetectorGeometry(ndatastream * nmodules, 2, 8, 36)); + + state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); + state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); + services.Writer("unix:writer_test", "inproc://#1").Receiver(&fpga_receiver); + + logger.Verbose(true); + + std::vector image(RAW_MODULE_SIZE);; JFJochWriterService writer(zmq_context, logger); - - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); + auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -186,7 +183,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_save_calibration", "[JFJochReceiver]") { REQUIRE(statistics.detector_width() == 2068); REQUIRE(statistics.detector_height() == 2164); REQUIRE(statistics.detector_pixel_depth() == 2); - fpga_receiver_server->Shutdown(); writer_server->Shutdown(); } @@ -200,6 +196,16 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_2DataStreams_4Devices", "[JFJochReceiver]") int64_t ndatastream = 2; int64_t nmodules = 4; + AcquisitionDeviceGroup aq_devices; + + for (int i = 0; i < 4; i++) { + auto test = std::make_unique(i, 256); + aq_devices.Add(std::move(test)); + } + + ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); + JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + JFJochServices services(logger); JFJochStateMachine state_machine(services, logger); @@ -209,25 +215,14 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_2DataStreams_4Devices", "[JFJochReceiver]") state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1").Receiver(&fpga_receiver); logger.Verbose(true); std::vector image(RAW_MODULE_SIZE); - AcquisitionDeviceGroup aq_devices; - - for (int i = 0; i < 4; i++) { - auto test = std::make_unique(i, 256); - aq_devices.Add(std::move(test)); - } - - ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); - JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); - JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -276,7 +271,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_2DataStreams_4Devices", "[JFJochReceiver]") REQUIRE(statistics.detector_height() == 2164); REQUIRE(statistics.detector_pixel_depth() == 2); - fpga_receiver_server->Shutdown(); writer_server->Shutdown(); } @@ -298,7 +292,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_RAW", "[JFJochReceiver]") { state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().Mode(DetectorMode::Conversion); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -313,9 +307,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_RAW", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); + JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); JFJochProtoBuf::DetectorSettings detector_settings; @@ -367,7 +362,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_RAW", "[JFJochReceiver]") { REQUIRE(statistics.detector_height() == 8 * 512); REQUIRE(statistics.detector_pixel_depth() == 2); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } @@ -391,8 +386,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_3Writers", "[JFJochReceiver]") { services .Writer("unix:writer_test_0", "inproc://#0") .Writer("unix:writer_test_1", "inproc://#1") - .Writer("unix:writer_test_2", "inproc://#2") - .Receiver("unix:fpga_receiver_test"); + .Writer("unix:writer_test_2", "inproc://#2"); logger.Verbose(true); @@ -407,12 +401,12 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_3Writers", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#0", "inproc://#1", "inproc://#2"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); JFJochWriterService writer_0(zmq_context, logger); JFJochWriterService writer_1(zmq_context, logger); JFJochWriterService writer_2(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server_0 = gRPCServer("unix:writer_test_0", writer_0); auto writer_server_1 = gRPCServer("unix:writer_test_1", writer_1); auto writer_server_2 = gRPCServer("unix:writer_test_2", writer_2); @@ -457,7 +451,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_3Writers", "[JFJochReceiver]") { REQUIRE(statistics.collection_efficiency() == 1.0); REQUIRE(statistics.images_collected() == nimages); - fpga_receiver_server->Shutdown(); + writer_server_0->Shutdown(); writer_server_1->Shutdown(); writer_server_2->Shutdown(); @@ -481,7 +475,7 @@ TEST_CASE("JFJochIntegrationTest_Cancel", "[JFJochReceiver]") { state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -501,9 +495,10 @@ TEST_CASE("JFJochIntegrationTest_Cancel", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); + JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -534,7 +529,7 @@ TEST_CASE("JFJochIntegrationTest_Cancel", "[JFJochReceiver]") { REQUIRE(statistics.max_image_number_sent() == 4); REQUIRE(statistics.cancelled()); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } @@ -554,7 +549,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview", "[JFJochReceiver]") { state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0).PreviewPeriod( 5ms); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -576,6 +571,8 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); + JFJochWriterService writer(zmq_context, logger); ZMQPreviewPublisher preview(zmq_context, "inproc://#2"); @@ -585,7 +582,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview", "[JFJochReceiver]") { REQUIRE_NOTHROW(rcv_preview_socket.Connect("inproc://#2")); rcv_preview_socket.SubscribeAll(); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -637,7 +633,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview", "[JFJochReceiver]") { REQUIRE(statistics.collection_efficiency() == 1.0); REQUIRE(statistics.images_collected() == 5); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } @@ -657,7 +653,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview_no_writer", "[JFJochReceiver]" state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0).PreviewPeriod( 5ms); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -678,6 +674,8 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview_no_writer", "[JFJochReceiver]" ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); + JFJochWriterService writer(zmq_context, logger); ZMQPreviewPublisher preview(zmq_context, "inproc://#2"); @@ -687,7 +685,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview_no_writer", "[JFJochReceiver]" REQUIRE_NOTHROW(rcv_preview_socket.Connect("inproc://#2")); rcv_preview_socket.SubscribeAll(); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -737,7 +734,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_with_preview_no_writer", "[JFJochReceiver]" REQUIRE(statistics.collection_efficiency() == 1.0); REQUIRE(statistics.images_collected() == 5); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } @@ -756,7 +753,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot", "[JFJochReceiver]") { state_machine.AddDetectorSetup(DetectorGeometry(ndatastream * nmodules, 2, 8, 36)); state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -797,9 +794,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); + services.Receiver(&fpga_receiver); + JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -844,8 +842,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot", "[JFJochReceiver]") { REQUIRE(statistics.collection_efficiency() == 1.0); REQUIRE(statistics.images_collected() == 1); - - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } /* @@ -865,7 +862,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index", "[JFJochReceiver] state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0) .SpotFindingPeriod(10ms); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1").Receiver(&fpga_receiver); logger.Verbose(true); @@ -913,7 +910,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index", "[JFJochReceiver] JFJochReceiverService fpga_receiver(tmp_devices, logger, pusher); JFJochWriterService writer(zmq_context, logger);; - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -961,7 +957,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index", "[JFJochReceiver] REQUIRE(statistics.collection_efficiency() == 1.0); REQUIRE(statistics.images_collected() == nimages); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); }*/ @@ -983,7 +979,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_rad_int", "[JFJochReceiver]") { state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0); state_machine.NotThreadSafe_Experiment().LowQForRadialInt_recipA(0.5).HighQForRadialInt_recipA(3.5) .QSpacingForRadialInt_recipA(1.0); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1"); logger.Verbose(true); @@ -1029,9 +1025,9 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_rad_int", "[JFJochReceiver]") { ZMQImagePusher pusher(zmq_context, {"inproc://#1"}); JFJochReceiverService fpga_receiver(aq_devices, logger, pusher); - JFJochWriterService writer(zmq_context, logger);; + services.Receiver(&fpga_receiver); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); + JFJochWriterService writer(zmq_context, logger); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -1074,10 +1070,10 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_rad_int", "[JFJochReceiver]") { CHECK(plot_map[0].title() == "dataset"); CHECK(plot_map[0].plot().x_size() == 3); - - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); } + /* TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum", "[JFJochReceiver]") { Logger logger("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum"); @@ -1095,7 +1091,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum", "[JFJochRecei state_machine.NotThreadSafe_Experiment().DataStreams(ndatastream); state_machine.NotThreadSafe_Experiment().PedestalG0Frames(0).PedestalG1Frames(0).PedestalG2Frames(0) .SpotFindingPeriod(10ms); - services.Writer("unix:writer_test", "inproc://#1").Receiver("unix:fpga_receiver_test"); + services.Writer("unix:writer_test", "inproc://#1").Receiver(&fpga_receiver); logger.Verbose(true); @@ -1145,7 +1141,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum", "[JFJochRecei JFJochReceiverService fpga_receiver(tmp_devices, logger, pusher); JFJochWriterService writer(zmq_context, logger); - auto fpga_receiver_server = gRPCServer("unix:fpga_receiver_test", fpga_receiver); auto writer_server = gRPCServer("unix:writer_test", writer); REQUIRE_NOTHROW(state_machine.Initialize()); @@ -1194,7 +1189,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_sum", "[JFJochRecei REQUIRE(statistics.has_indexing_rate()); REQUIRE(statistics.indexing_rate() == 1.0); - fpga_receiver_server->Shutdown(); + writer_server->Shutdown(); }*/ //#endif \ No newline at end of file diff --git a/tests/StreamWriterTest.cpp b/tests/StreamWriterTest.cpp index fa1fa3bf..ee77ceff 100644 --- a/tests/StreamWriterTest.cpp +++ b/tests/StreamWriterTest.cpp @@ -24,9 +24,6 @@ TEST_CASE("StreamWriterTest_ZMQ","[JFJochWriter]") { x.FilePrefix("subdir/JFJochWriterTest").NumTriggers(1).ImagesPerTrigger(5) .UseInternalPacketGenerator(true).Mode(DetectorMode::Raw).PedestalG0Frames(0); - JFJochProtoBuf::ReceiverInput receiver_input; - *receiver_input.mutable_jungfraujoch_settings() = x; - JFModuleGainCalibration gain; AcquisitionDeviceGroup aq_devices; for (int i = 0; i < x.GetDataStreamsNum(); i++) @@ -34,19 +31,19 @@ TEST_CASE("StreamWriterTest_ZMQ","[JFJochWriter]") { ZMQImagePusher pusher (context, {zmq_addr}); JFJochReceiverService fpga_receiver_service(aq_devices, logger, pusher); -; - JFJochProtoBuf::ReceiverOutput receiver_output; + + JFJochReceiverOutput receiver_output; std::unique_ptr writer; REQUIRE(x.GetImageNum() == 5); REQUIRE_NOTHROW(writer = std::make_unique(context, logger, zmq_addr)); - REQUIRE(fpga_receiver_service.Start(&grpc_context, &receiver_input, &empty).ok()); + REQUIRE_NOTHROW(fpga_receiver_service.Start(x, nullptr)); REQUIRE_NOTHROW(writer->Run()); - REQUIRE(fpga_receiver_service.Stop(&grpc_context, &empty, &receiver_output).ok()); - CHECK(receiver_output.images_sent() == 5); + REQUIRE_NOTHROW(receiver_output = fpga_receiver_service.Stop()); + CHECK(receiver_output.images_sent == 5); // HDF5 file can be opened std::unique_ptr file; @@ -84,9 +81,6 @@ TEST_CASE("JFJochWriterServiceTest_ZMQ","[JFJochWriter]") { .UseInternalPacketGenerator(true) .Mode(DetectorMode::Raw).PedestalG0Frames(0); - JFJochProtoBuf::ReceiverInput receiver_input; - *receiver_input.mutable_jungfraujoch_settings() = x; - JFModuleGainCalibration empty_gain; AcquisitionDeviceGroup aq_devices; @@ -99,14 +93,14 @@ TEST_CASE("JFJochWriterServiceTest_ZMQ","[JFJochWriter]") { JFJochProtoBuf::WriterInput writer_input; writer_input.set_zmq_receiver_address(zmq_addr); - JFJochProtoBuf::ReceiverOutput receiver_output; + JFJochReceiverOutput receiver_output; JFJochProtoBuf::WriterOutput writer_output; REQUIRE(x.GetImageNum() == 5); REQUIRE(writer.Start(&grpc_context, &writer_input, &empty).ok()); - REQUIRE(fpga_receiver_service.Start(&grpc_context, &receiver_input, &empty).ok()); - REQUIRE(fpga_receiver_service.Stop(&grpc_context, &empty, &receiver_output).ok()); + REQUIRE_NOTHROW(fpga_receiver_service.Start(x, nullptr)); + REQUIRE_NOTHROW(receiver_output = fpga_receiver_service.Stop()); REQUIRE(writer.Stop(&grpc_context, &empty, &writer_output).ok()); REQUIRE(writer_output.nimages() == 5); diff --git a/tests/gRPCServerTest.cpp b/tests/gRPCServerTest.cpp deleted file mode 100644 index a7d8c51a..00000000 --- a/tests/gRPCServerTest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#include - -#include "../grpc/gRPCServer_Template.h" - -#include "../common/Logger.h" -#include "../receiver/JFJochReceiverService.h" -#include "../grpc/JFJochReceiverClient.h" -#include "../acquisition_device/HLSSimulatedDevice.h" - -#include -#include "../../common/ZMQImagePusher.h" - -TEST_CASE("JFJochReceiver_gRPC_server", "[gRPC]") { - DiffractionExperiment x(DetectorGeometry(4, 2)); - - AcquisitionDeviceGroup aq_devices; - aq_devices.AddHLSDevice(64); - - ZMQContext zmq_context; - Logger logger("receiver"); - - ZMQImagePusher pusher(zmq_context, {"inproc://1"}); - JFJochReceiverService service(aq_devices, logger, pusher); - - auto server = gRPCServer("unix:receiver_test", service); - { - JFJochReceiverClient client; - REQUIRE_NOTHROW(client.Connect("unix:receiver_test")); - } - - server->Shutdown(); -} \ No newline at end of file