Pigweed
 
Loading...
Searching...
No Matches
Pw_rpc_channel_functions

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)
 

Detailed Description

Function Documentation

◆ ChangeEncodedChannelId() [1/2]

template<uint32_t kNewChannelId>
Status pw::rpc::ChangeEncodedChannelId ( ByteSpan  rpc_packet)

Rewrites an encoded packet's channel ID in place. Both channel IDs MUST be less than 128.

Returns
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
* 
*  

◆ ChangeEncodedChannelId() [2/2]

Status pw::rpc::ChangeEncodedChannelId ( ByteSpan  rpc_packet,
uint32_t  new_channel_id 
)
inline

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.

◆ ExtractChannelId()

Result< uint32_t > pw::rpc::ExtractChannelId ( ConstByteSpan  packet)

Extracts the channel ID from a pw_rpc packet.

Returns
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.
* 
*