aboutsummaryrefslogtreecommitdiff
path: root/pw_hdlc
diff options
context:
space:
mode:
Diffstat (limited to 'pw_hdlc')
-rw-r--r--pw_hdlc/public/pw_hdlc/rpc_packets.h9
-rw-r--r--pw_hdlc/rpc_packets.cc10
2 files changed, 17 insertions, 2 deletions
diff --git a/pw_hdlc/public/pw_hdlc/rpc_packets.h b/pw_hdlc/public/pw_hdlc/rpc_packets.h
index ed8898a67..2913021fa 100644
--- a/pw_hdlc/public/pw_hdlc/rpc_packets.h
+++ b/pw_hdlc/public/pw_hdlc/rpc_packets.h
@@ -27,6 +27,15 @@ inline constexpr uint8_t kDefaultRpcAddress = 'R';
// Reads HDLC frames with sys_io::ReadByte, using decode_buffer to store frames.
// HDLC frames sent to rpc_address are passed to the RPC server.
Status ReadAndProcessPackets(rpc::Server& server,
+ span<std::byte> decode_buffer,
+ unsigned rpc_address = kDefaultRpcAddress);
+
+// Reads HDLC frames with sys_io::ReadByte, using decode_buffer to store frames.
+// HDLC frames sent to rpc_address are passed to the RPC server.
+//
+// Note: this overload (with the `ChannelOutput` argument) is deprecated and
+// will be removed.
+Status ReadAndProcessPackets(rpc::Server& server,
rpc::ChannelOutput& output,
span<std::byte> decode_buffer,
unsigned rpc_address = kDefaultRpcAddress);
diff --git a/pw_hdlc/rpc_packets.cc b/pw_hdlc/rpc_packets.cc
index d3261fbc6..fd429686f 100644
--- a/pw_hdlc/rpc_packets.cc
+++ b/pw_hdlc/rpc_packets.cc
@@ -20,7 +20,6 @@
namespace pw::hdlc {
Status ReadAndProcessPackets(rpc::Server& server,
- rpc::ChannelOutput& output,
span<std::byte> decode_buffer,
unsigned rpc_address) {
Decoder decoder(decode_buffer);
@@ -32,11 +31,18 @@ Status ReadAndProcessPackets(rpc::Server& server,
if (auto result = decoder.Process(data); result.ok()) {
Frame& frame = result.value();
if (frame.address() == rpc_address) {
- server.ProcessPacket(frame.data(), output)
+ server.ProcessPacket(frame.data())
.IgnoreError(); // TODO(b/242598609): Handle Status properly
}
}
}
}
+Status ReadAndProcessPackets(rpc::Server& server,
+ rpc::ChannelOutput&,
+ span<std::byte> decode_buffer,
+ unsigned rpc_address) {
+ return ReadAndProcessPackets(server, decode_buffer, rpc_address);
+}
+
} // namespace pw::hdlc