From 5d17ad5229aa446c0ecd94bcd8566b3815eda77a Mon Sep 17 00:00:00 2001 From: crosstyan Date: Fri, 6 Mar 2026 10:41:18 +0800 Subject: [PATCH] refactor(protocol): switch runtime to protocol wire codec paths Point the build and dummy runtime producer at the canonical protocol module so runtime ownership matches the refactored directory structure. - compile src/protocol/wire_codec.cpp - update frame source to include and use protocol::wire_codec - remove remaining sim/wire usage from runtime code Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- CMakeLists.txt | 2 +- src/core/frame_source.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13fce2b..6f48e12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ add_library(cvmmap_streamer_common STATIC src/core/frame_source.cpp src/core/ingest_runtime.cpp src/ipc/contracts.cpp - src/sim/wire.cpp + src/protocol/wire_codec.cpp lib/cvmmap-client-cpp/app_cvmmap_client.cpp lib/cvmmap-client-cpp/app_cvmmap_parser.cpp src/metrics/latency_tracker.cpp diff --git a/src/core/frame_source.cpp b/src/core/frame_source.cpp index 7d894c2..0cb6153 100644 --- a/src/core/frame_source.cpp +++ b/src/core/frame_source.cpp @@ -1,7 +1,7 @@ #include "cvmmap_streamer/core/frame_source.hpp" #include "cvmmap_streamer/ipc/contracts.hpp" -#include "cvmmap_streamer/sim/wire.hpp" +#include "cvmmap_streamer/protocol/wire_codec.hpp" #include @@ -32,6 +32,7 @@ namespace cvmmap_streamer::core { namespace { namespace ipc = cvmmap_streamer::ipc; +namespace wire_codec = cvmmap_streamer::protocol::wire_codec; [[nodiscard]] std::string resolve_client_target(const RuntimeConfig &config) { @@ -328,10 +329,10 @@ private: } void send_status( - std::array &buffer, + std::array &buffer, ipc::ModuleStatus status, std::uint32_t frame_count) const { - sim::write_module_status_message(buffer, config_.dummy.label, status); + wire_codec::write_module_status_message(buffer, config_.dummy.label, status); publisher_->send(zmq::buffer(buffer), zmq::send_flags::none); if (status == ipc::ModuleStatus::Offline || status == ipc::ModuleStatus::Online) { spdlog::info("dummy source status={} frame_count={}", static_cast(status), frame_count); @@ -339,8 +340,8 @@ private: } void run_producer_loop() const { - std::array sync_buffer{}; - std::array status_buffer{}; + std::array sync_buffer{}; + std::array status_buffer{}; const auto payload_bytes = static_cast(config_.dummy.width) * static_cast(config_.dummy.height) * @@ -362,9 +363,9 @@ private: while (!stop_requested_.load(std::memory_order_relaxed)) { frame_count += 1; auto payload = shm_->payload(payload_bytes); - sim::write_deterministic_payload(payload, frame_count, config_.dummy.width, config_.dummy.height, config_.dummy.channels); + wire_codec::write_deterministic_payload(payload, frame_count, config_.dummy.width, config_.dummy.height, config_.dummy.channels); - sim::write_frame_metadata( + wire_codec::write_frame_metadata( shm_->metadata(), ipc::FrameInfo{ .width = config_.dummy.width, @@ -376,7 +377,7 @@ private: frame_count, timestamp_ns); - sim::write_sync_message(sync_buffer, config_.dummy.label, frame_count, timestamp_ns); + wire_codec::write_sync_message(sync_buffer, config_.dummy.label, frame_count, timestamp_ns); publisher_->send(zmq::buffer(sync_buffer), zmq::send_flags::none); if (config_.dummy.emit_reset_at && *config_.dummy.emit_reset_at == frame_count) {