pub struct App { /* private fields */ }Expand description
Standard cFS application with automatic boilerplate.
Handles pipe creation, topic subscriptions, EVS registration, NoOp (fcn 0), and Reset Counters (fcn 1).
HK wakeups are surfaced as Event::Hk so the app
controls what telemetry to publish.
§Example
let mut app = App::builder()
.name("MY_APP")
.cmd_topic(MY_CMD_TOPIC)
.send_hk_topic(SEND_HK_TOPIC)
.hk_tlm_topic(MY_HK_TLM_TOPIC)
.version("1.0.0")
.build()?;
let mut buf = [0u8; 256];
loop {
match app.recv(&mut buf).await? {
Event::Hk => app.send_hk(&my_hk)?,
Event::Command(msg) => app.reject(msg)?,
}
}Implementations§
Source§impl App
impl App
Sourcepub fn builder() -> AppBuilder
pub fn builder() -> AppBuilder
Creates a new cFS application.
Registers with EVS, creates a Software Bus pipe, and subscribes to command and HK wakeup topics.
Both cmd_topic and send_hk_topic are treated
as local command topic IDs. hk_tlm_topic is a
local telemetry topic ID.
Source§impl App
impl App
Sourcepub async fn run(&mut self) -> Result<()>
pub async fn run(&mut self) -> Result<()>
Processes commands and HK in a loop.
Publishes base HK (cmd/err counters) on wakeup,
rejects unrecognized commands. For custom HK or
app-specific commands, use recv.
Sourcepub async fn recv<'a>(&mut self, buf: &'a mut [u8]) -> Result<Event<'a>>
pub async fn recv<'a>(&mut self, buf: &'a mut [u8]) -> Result<Event<'a>>
Receives the next event from the Software Bus.
Automatically handles NoOp (fcn 0) and Reset (fcn 1).
Returns Event::Hk on HK wakeup so the app can
publish its own telemetry. Returns Event::Command
for app-specific commands.
Sourcepub fn ack(&mut self)
pub fn ack(&mut self)
Acknowledges successful command processing.
Increments the command counter.
Sourcepub fn reject(&mut self, _msg: MessageRef<'_>) -> Result<()>
pub fn reject(&mut self, _msg: MessageRef<'_>) -> Result<()>
Rejects an unrecognized command.
Increments the error counter and sends an error event.