pub struct Pipe { /* private fields */ }Expand description
A CFE Software Bus pipe.
When dropped, it automatically cleans up the underlying CFE resource.
Implementations§
Source§impl Pipe
impl Pipe
Sourcepub fn new(name: &str, depth: u16) -> Result<Self>
pub fn new(name: &str, depth: u16) -> Result<Self>
Creates a new software bus pipe.
§Arguments
name- A unique string to identify the pipe.depth- The maximum number of messages the pipe can hold.
Sourcepub fn subscribe_ex(&self, msg_id: MsgId, qos: Qos, msg_lim: u16) -> Result<()>
pub fn subscribe_ex(&self, msg_id: MsgId, qos: Qos, msg_lim: u16) -> Result<()>
Subscribes this pipe to messages with the specified MsgId and extended options.
§Arguments
msg_id: The message ID of the message to be subscribed to.qos: The requested Quality of Service.msg_lim: The maximum number of messages with this Message ID to allow in this pipe at the same time.
Sourcepub fn subscribe(&self, msg_id: MsgId) -> Result<()>
pub fn subscribe(&self, msg_id: MsgId) -> Result<()>
Subscribes this pipe to messages with the specified MsgId.
Subscriptions are added to the head of an internal linked list, so messages are delivered in LIFO order (last subscriber receives first).
§Arguments
msg_id: The message ID of the message to be subscribed to.
Sourcepub fn unsubscribe(&self, msg_id: MsgId) -> Result<()>
pub fn unsubscribe(&self, msg_id: MsgId) -> Result<()>
Unsubscribes this pipe from messages with the specified MsgId.
Sourcepub fn unsubscribe_local(&self, msg_id: MsgId) -> Result<()>
pub fn unsubscribe_local(&self, msg_id: MsgId) -> Result<()>
Unsubscribes this pipe from messages, keeping the request local to this CPU.
This is typically only used by a Software Bus Network (SBN) application.
Sourcepub fn timed_recv(&mut self, buf: &mut [u8], timeout: Timeout) -> Result<usize>
pub fn timed_recv(&mut self, buf: &mut [u8], timeout: Timeout) -> Result<usize>
Receives a message from this pipe, copying it into a user-provided buffer.
This method receives a message from the CFE-managed internal buffer and safely copies it into the provided buf.
§Arguments
timeout: Timeout in milliseconds. Usesb::pipe::PEND_FOREVERto block indefinitely orsb::pipe::POLLfor a non-blocking check.buffer- A mutable byte slice to copy the message into.
§Returns
A MessageRef containing the message data, tied to the lifetime of buffer.
§Errors
Returns Error::SbTimeOut or Error::SbNoMessage if no message is received within the timeout.
Returns Error::SbBadArgument if the timeout value is invalid.
Returns Error::OsErrInvalidSize if the received message is larger than buf.
Sourcepub fn set_opts(&self, opts: PipeOptions) -> Result<()>
pub fn set_opts(&self, opts: PipeOptions) -> Result<()>
Sets options for the pipe, see PipeOptions for the available options.
Sourcepub fn get_opts(&self) -> Result<PipeOptions>
pub fn get_opts(&self) -> Result<PipeOptions>
Gets the current options for the pipe, see PipeOptions for the available options.
Sourcepub fn get_id_by_name(name: &str) -> Result<PipeId>
pub fn get_id_by_name(name: &str) -> Result<PipeId>
Finds the PipeId for a pipe with the given name.
Sourcepub fn subscribe_local(&self, msg_id: MsgId, msg_lim: u16) -> Result<()>
pub fn subscribe_local(&self, msg_id: MsgId, msg_lim: u16) -> Result<()>
Subscribes this pipe to messages, keeping the request local to this CPU.
This is typically only used by a Software Bus Network (SBN) application.
§Arguments
msg_id: The message ID of the message to be subscribed to.msg_lim: The maximum number of messages with this Message ID to allow in this pipe at the same time.