Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
I will recommend breaking the wire_codec into smaller pieces.
- may call this remote_plugin_protocol or remote_frame_builder top level?
- I am not sure we need so many types here. Maybe just keep the Frame type sufficient. The rests are utility functions around the frame builders and frame parsers for different types of data input and output. So the enum and string conversion are just part inside the builder and parser utility function.
There was a problem hiding this comment.
Done in the "split frame layer from payload codecs" commit:
- protocol_frame.* (header/Frame/stamp/split),
- protocol_payloads.* (builders/parsers),
- namespace
remote_plugin_protocol;
one-field payloads (open-hand, error, ping) are now plain values in the builder/parser signatures and to_string(FrameType) is gone. I kept structs only for the multi-field payloads (Hello, HelloAck, the three samples, Pong) since the parsers have to return several fields
Addresses the #1321 review: the codec becomes remote_plugin_protocol. - protocol_frame.{hpp,cpp}: header constants, FrameType, FrameHeader, Frame, DecodeError, encode_header/decode_header, encode_frame, stamp_header, split_frame. - protocol_payloads.{hpp,cpp}: one named builder/parser pair per frame type (encode_hello/decode_hello, ...), plus the sample frame builders. - protocol_io.hpp (private): the little-endian Writer/Reader shared by both. - Single-field payload structs are gone: OPEN_HAND, ERROR and PING build from and parse to XrHandEXT, std::string and int64_t. - to_string(FrameType) is private to protocol_payloads.cpp, where parsers use it to name the frame in DecodeError messages. - WristSample carries XrHandEXT instead of bool is_left; its wire byte keeps its meaning (1 = left). The 24-byte header and every payload layout are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
fe5f90f to
6452f88
Compare
Add the Teleop::remote_plugin_session library with its only serialization point: little-endian frames of a 24-byte header plus payload, 14 frame types (HELLO/ACK, OPEN_*, CLOSE, hand/schema/wrist samples, HEARTBEAT, ERROR, PING/PONG). Schema samples carry the plugin's FlatBuffer bytes opaquely. The library links only pusherio, never the OpenXR loader, and is gated by BUILD_PLUGIN_REMOTE_DEVICE_BRIDGE (default ON, skipped on Windows). Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
PluginSessionRequirements::wrist_tracking_pull is now an optional<WristTrackingSourceConfig>, so HELLO carries the wrist config (mode + both aim-to-wrist poses, same layout as OPEN_WRIST) behind its presence byte instead of a bool. HELLO proto_version goes 1 -> 2 and decode_hello rejects older versions, whose payload layout differs. The 24-byte frame header and kProtocolVersion are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
Addresses the #1321 review: the codec becomes remote_plugin_protocol. - protocol_frame.{hpp,cpp}: header constants, FrameType, FrameHeader, Frame, DecodeError, encode_header/decode_header, encode_frame, stamp_header, split_frame. - protocol_payloads.{hpp,cpp}: one named builder/parser pair per frame type (encode_hello/decode_hello, ...), plus the sample frame builders. - protocol_io.hpp (private): the little-endian Writer/Reader shared by both. - Single-field payload structs are gone: OPEN_HAND, ERROR and PING build from and parse to XrHandEXT, std::string and int64_t. - to_string(FrameType) is private to protocol_payloads.cpp, where parsers use it to name the frame in DecodeError messages. - WristSample carries XrHandEXT instead of bool is_left; its wire byte keeps its meaning (1 = left). The 24-byte header and every payload layout are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
Applied the fact-checked (VERIFIED) findings on code this branch adds: - Frame layer: kHeaderSize is derived from its fields; encode_header is a private detail that writes in place with named offsets; stamp_header takes the frame vector and only touches the header; decode_header's type bound follows kLastFrameType; FrameHeader::type has no default; split_frame's doc says the payload keeps the message buffer. - PONG t3 stamping moves out of the frame layer into set_pong_t3, called where the pong is sent. - Payload layer: FrameType comments keep only direction (layouts live with the builders); parsers pass the frame name to the reader directly, so the unreachable to_string is gone; builders share build_payload; HELLO accepts exactly kHelloVersion; history and future-tense comments go; size constants used only by tests move into the test; own private header first. - Build: the remote_device_bridge block sits with the other gated plugins; the session CMake comment duplicating AGENTS.md is gone; the test target does not re-link pusherio; AGENTS.md describes the split accurately. - Tests: no constant-against-literal checks; header goldens go through encode_frame + stamp_header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
pr00's sessions build the wrist source at construction from PluginSessionRequirements::wrist_tracking_pull, which HELLO now carries in full. OPEN_WRIST would only repeat that config, so frame type 6 is unassigned and the parser rejects it; the wrist config codec remains as part of HELLO. Other frame numbers, the 24-byte header and kProtocolVersion are unchanged; HELLO version 2 already fences off older peers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
Applied the fact-checked (VERIFIED) findings on code this branch adds: - FrameHeader drops the version field (always kProtocolVersion) and value-initializes type to 0, which no frame uses. - Hello drops proto_version; encode_hello writes kHelloVersion and decode_hello compares against it. - Writer/Reader gain boolean(); encoders no longer spell out "? 1 : 0" and the parsers' to_bool helper is gone. - store_le lives once in protocol_io.hpp; set_pong_t3 uses it. - The ERROR comment no longer describes bridge behaviour; AGENTS.md keeps just the rule. - Tests use kHeaderSize instead of 24; the nested test CMakeLists drops cmake_minimum_required. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
Applied the fact-checked (VERIFIED) findings on code this branch adds: - decode_header takes a std::span and checks its length; valid frame types come from an exhaustive switch, so no kLastFrameType or unassigned-type constant has to be kept in step with the enum. - Header offsets are tied to the layout with a static_assert. - Writer/Reader share store_le/load_le instead of three hand loops each. - PONG fields are named ping_sent_ns / ping_received_ns / pong_sent_ns and set_pong_t3 becomes set_pong_sent_time. - Own private header first in both protocol sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonghyun Kim <jonghyunk@nvidia.com>
6452f88 to
c43a9c9
Compare
|
Update (Oct 30): rebased onto the reviewed #1320. Per the review comment, wire_codec is split into a frame layer (header/Frame/stamp/split) and payload codecs; one-field payload structs are plain values; to_string(FrameType) is gone (only error messages used it). HELLO is now v2 and carries the optional wrist config; OPEN_WRIST (type 6) is removed; the 24-byte header and all other payloads are unchanged. Run through the review skill locally (3 rounds) before pushing. |
Summary
First layer of the remote plugin session: a wire codec so a plugin can drive an
IPluginSessionthat lives in another process.What changes
Teleop::remote_plugin_sessionlibrary (src/plugins/remote_device_bridge/session/) withwire_codec.{hpp,cpp}as the single serialization point: 24-byte little-endian header + payload, 14 frame types (HELLO/ACK, OPEN_*, CLOSE, hand/schema/wrist samples, HEARTBEAT, ERROR, PING/PONG)BUILD_PLUGIN_REMOTE_DEVICE_BRIDGE(default ON, skipped on Windows), wired insrc/plugins/CMakeLists.txtWhat does not change
No plugin or runtime behavior; the library links only pusherio, never the OpenXR loader.
Testing
test_wire_codec.cpp(12 cases: round-trips, malformed input, contiguous builders). Fresh build: ctest 266/266 (pr00: 254/254).Depends on
#1320