Classes | |
class | pw::rpc::ChannelOutput |
Functions | |
Result< uint32_t > | pw::rpc::ExtractChannelId (ConstByteSpan packet) |
template<uint32_t kNewChannelId> | |
Status | pw::rpc::ChangeEncodedChannelId (ByteSpan rpc_packet) |
Status | pw::rpc::ChangeEncodedChannelId (ByteSpan rpc_packet, uint32_t new_channel_id) |
constexpr size_t | pw::rpc::MaxSafePayloadSize (size_t encode_buffer_size=cfg::kEncodingBufferSizeBytes) |
Rewrites an encoded packet's channel ID in place. Both channel IDs MUST be less than 128.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: Successfully replaced the channel ID * * DATA_LOSS: parsing the packet failed * * OUT_OF_RANGE: the encoded packet's channel ID was 128 or larger * *
Version of ChangeEncodedChannelId
with a runtime variable channel ID. Prefer the template parameter version when possible to avoid a runtime check on the new channel ID.
Result< uint32_t > pw::rpc::ExtractChannelId | ( | ConstByteSpan | packet | ) |
Extracts the channel ID from a pw_rpc packet.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: returns the channel ID in the packet * * DATA_LOSS: the packet is corrupt and the channel ID could not be found. * *
|
constexpr |
Returns the maximum payload size of an RPC packet for RPC endpoints as configured. This can be used when allocating response encode buffers for RPC services. If the RPC encode buffer is too small to fit RPC packet headers, this returns zero.
By default, this function uses PW_RPC_ENCODING_BUFFER_SIZE_BYTES
to determine the largest supported payload, even when dynamic allocation is enabled.
MaxSafePayloadSize
does NOT account for the channel MTU, which may be smaller. Call MaxWriteSizeBytes()
on an RPC's call object (reader/writer) to account for channel MTU.