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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-06 10:41:18 +08:00
parent fb59695461
commit 5d17ad5229
2 changed files with 10 additions and 9 deletions
+9 -8
View File
@@ -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 <app/cvmmap/cvmmap_client.hpp>
@@ -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<std::uint8_t, sim::kModuleStatusMessageBytes> &buffer,
std::array<std::uint8_t, wire_codec::kModuleStatusMessageBytes> &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<std::int32_t>(status), frame_count);
@@ -339,8 +340,8 @@ private:
}
void run_producer_loop() const {
std::array<std::uint8_t, sim::kSyncMessageBytes> sync_buffer{};
std::array<std::uint8_t, sim::kModuleStatusMessageBytes> status_buffer{};
std::array<std::uint8_t, wire_codec::kSyncMessageBytes> sync_buffer{};
std::array<std::uint8_t, wire_codec::kModuleStatusMessageBytes> status_buffer{};
const auto payload_bytes = static_cast<std::size_t>(config_.dummy.width) *
static_cast<std::size_t>(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) {