29#include "pw_async2/dispatcher.h"
30#include "pw_async2/poll.h"
31#include "pw_channel/channel.h"
32#include "pw_containers/vector.h"
33#include "pw_hdlc/decoder.h"
34#include "pw_multibuf/allocator.h"
35#include "pw_multibuf/multibuf.h"
36#include "pw_status/status.h"
57 : io_channel_(io_channel), decoder_(decode_buffer) {}
98 uint64_t receive_address,
99 uint64_t send_address);
115 uint64_t receive_address,
116 uint64_t send_address);
132 constexpr static size_t kSomeNumberOfChannels = 16;
137 uint64_t receive_address_arg,
138 uint64_t send_address_arg)
139 : channel(&channel_arg),
140 receive_address(receive_address_arg),
141 send_address(send_address_arg) {}
143 ChannelData(
const ChannelData&) =
delete;
144 ChannelData& operator=(
const ChannelData&) =
delete;
145 ChannelData(ChannelData&&) =
default;
146 ChannelData& operator=(ChannelData&&) =
default;
152 uint64_t receive_address;
156 uint64_t send_address;
161 ChannelData* FindChannelForReceiveAddress(uint64_t receive_address);
183 void RemoveClosedChannels();
207 std::optional<pw::hdlc::Frame> decoded_frame_;
213 struct OutgoingBuffer {
215 size_t hdlc_encoded_size;
216 uint64_t target_address;
220 std::optional<OutgoingBuffer> buffer_to_encode_and_send_;
225 size_t next_first_read_index_ = 0;
Definition: dispatcher_base.h:52
pw::async2::Poll PendClose(pw::async2::Context &cx)
Closes all underlying channels, attempting to flush any data.
Status AddChannel(pw::channel::DatagramReaderWriter &channel, uint64_t receive_address, uint64_t send_address)
Router(pw::channel::ByteReaderWriter &io_channel, ByteSpan decode_buffer)
Definition: router.h:56
Status RemoveChannel(pw::channel::DatagramReaderWriter &channel, uint64_t receive_address, uint64_t send_address)
pw::async2::Poll Pend(pw::async2::Context &cx)
Definition: multibuf.h:245