leodos_libcfs/cfe/sb/bus.rs
1//! Software Bus message transmission APIs.
2use crate::cfe::sb::msg::MessageRef;
3use crate::error::Result;
4use crate::ffi;
5use crate::status::check;
6
7/// A handle to the cFE Software Bus for message transmission.
8pub struct SoftwareBus;
9
10impl SoftwareBus {
11 /// Transmits a message by copying its contents into the Software Bus.
12 pub fn transmit_msg(msg: MessageRef, is_origination: bool) -> Result<()> {
13 check(unsafe {
14 ffi::CFE_SB_TransmitMsg(msg.as_slice().as_ptr() as *const _, is_origination)
15 })?;
16 Ok(())
17 }
18}