diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 6e1925a9..6e49bf91 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -9,6 +9,7 @@ #include "OpenAPIConvert.h" #include "Detector_type.h" #include "../image_pusher/NonePusher.h" +#include "../image_pusher/TcpStreamPusher.h" DetectorGeometryModular ParseStandardDetectorGeometry(const org::openapitools::server::model::Detector &j) { auto s = j.getStandardGeometry(); @@ -190,10 +191,27 @@ std::unique_ptr ParseZMQImagePusher(const org::openapitools::server return std::move(tmp); } +std::unique_ptr ParseTCPImagePusher(const org::openapitools::server::model::Jfjoch_settings &j) { + if (!j.zeromqIsSet()) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Socket settings must be provided"); + + std::optional send_buffer_size; + if (j.getZeromq().sendBufferSizeIsSet()) + send_buffer_size = j.getZeromq().getSendBufferSize(); + + auto tmp = std::make_unique(j.getZeromq().getImageSocket(), send_buffer_size); + + if (j.getZeromq().writerNotificationSocketIsSet()) + tmp->WriterNotificationSocket(j.getZeromq().getWriterNotificationSocket()); + return std::move(tmp); +} + std::unique_ptr ParseImagePusher(const org::openapitools::server::model::Jfjoch_settings &j) { switch (j.getImagePusher().getValue()) { case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::ZEROMQ: return ParseZMQImagePusher(j); + case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::TCP: + return ParseTCPImagePusher(j); case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::HDF5: return std::make_unique(); case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::NONE: diff --git a/broker/gen/model/Image_pusher_type.cpp b/broker/gen/model/Image_pusher_type.cpp index f083115d..f4424f62 100644 --- a/broker/gen/model/Image_pusher_type.cpp +++ b/broker/gen/model/Image_pusher_type.cpp @@ -84,6 +84,9 @@ void to_json(nlohmann::json& j, const Image_pusher_type& o) case Image_pusher_type::eImage_pusher_type::CBOR: j = "CBOR"; break; + case Image_pusher_type::eImage_pusher_type::TCP: + j = "TCP"; + break; case Image_pusher_type::eImage_pusher_type::NONE: j = "None"; break; @@ -103,6 +106,9 @@ void from_json(const nlohmann::json& j, Image_pusher_type& o) else if (s == "CBOR") { o.setValue(Image_pusher_type::eImage_pusher_type::CBOR); } + else if (s == "TCP") { + o.setValue(Image_pusher_type::eImage_pusher_type::TCP); + } else if (s == "None") { o.setValue(Image_pusher_type::eImage_pusher_type::NONE); } else { diff --git a/broker/gen/model/Image_pusher_type.h b/broker/gen/model/Image_pusher_type.h index 55e05f4e..6b3f3c7d 100644 --- a/broker/gen/model/Image_pusher_type.h +++ b/broker/gen/model/Image_pusher_type.h @@ -41,6 +41,7 @@ public: ZEROMQ, HDF5, CBOR, + TCP, NONE }; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 80169496..85b61615 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -1908,7 +1908,7 @@ components: image_pusher_type: type: string default: None - enum: [ZeroMQ, HDF5, CBOR, None] + enum: [ZeroMQ, HDF5, CBOR, TCP, None] standard_detector_geometry: type: object description: Regular rectangular geometry, first module is in the bottom left corner of the detector diff --git a/broker/redoc-static.html b/broker/redoc-static.html index bb8e5267..c54c3018 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -910,7 +910,7 @@ then image might be replaced in the buffer between calling /images and /image.cb