// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include "JFJochReader.h" #include "../common/BrokerStatus.h" #include "../common/ImageBuffer.h" #include "../common/ROIDefinition.h" class JFJochHttpReader : public JFJochReader { mutable std::mutex http_mutex; std::string addr; std::optional last_image_buffer_counter; bool last_op_http_sync = false; ImageBufferStatus GetImageBufferStatus() const; bool LoadImage_i(std::shared_ptr &dataset, DataMessage& message, std::vector &buffer, int64_t image_number, bool update_dataset) override; std::shared_ptr UpdateDataset_i(); std::vector GetPlot_i(const std::string &plot_type, float fill_value = 0.0) const; public: ~JFJochHttpReader() override = default; void ReadURL(const std::string& url); uint64_t GetNumberOfImages() const override; void Close() override; // Refresh dataset/plots if the image buffer changed since the last poll (returns nullptr if // unchanged). Always writes the current number of images to num_images_out. Does not load an image. std::shared_ptr RefreshDatasetIfChanged(int64_t &num_images_out); void UploadUserMask(const std::vector& mask); [[nodiscard]] ROIDefinition GetROIDefinitions() const; // GET /config/roi void UploadROIDefinitions(const ROIDefinition &rois) const; // PUT /config/roi BrokerStatus GetBrokerStatus() const; std::shared_ptr GetRawImage(int64_t image_number) override; std::vector ReadSpots(int64_t image) const override; };