oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
shell.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
14#pragma once
15
16#include <ove/shell.h>
17#include <ove/types.hpp>
18#include <ove/error.hpp>
19
20#ifdef CONFIG_OVE_SHELL
21
22namespace ove::shell
23{
24
37[[nodiscard]] inline Result<void> init() noexcept
38{
39 return from_rc(ove_shell_init());
40}
41
48[[nodiscard]] inline Result<void> register_cmd(const struct ove_shell_cmd *cmd) noexcept
49{
50 return from_rc(ove_shell_register_cmd(cmd));
51}
52
60inline void process_char(int c)
61{
62 ove_shell_process_char(c);
63}
64
69inline void process_line(const char *line)
70{
71 ove_shell_process_line(line);
72}
73
78inline void set_output_hook(ove_shell_output_hook_t hook)
79{
80 ove_shell_set_output_hook(hook);
81}
82
83} /* namespace ove::shell */
84
85#endif /* CONFIG_OVE_SHELL */
Strong ove::Error type, Result<T> alias, and std::error_code interop for the oveRTOS C++ binding.
Thin C++ wrappers around the oveRTOS interactive shell API.
Definition shell.hpp:23
void process_char(int c)
Feeds a single character into the shell input processor.
Definition shell.hpp:60
void process_line(const char *line)
Process a complete input line through the shell.
Definition shell.hpp:69
Result< void > init() noexcept
Initialises the shell subsystem.
Definition shell.hpp:37
Result< void > register_cmd(const struct ove_shell_cmd *cmd) noexcept
Registers a shell command.
Definition shell.hpp:48
void set_output_hook(ove_shell_output_hook_t hook)
Set a hook to capture shell output.
Definition shell.hpp:78
Result< void > from_rc(int rc) noexcept
Lifts a substrate rc-code into a Result<void>.
Definition error.hpp:254
std::expected< T, Error > Result
std::expected-based result alias.
Definition error.hpp:139
Common type definitions and concepts for the C++ wrapper layer.