Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
shell_dummy.h
Go to the documentation of this file.
1/*
2 * Shell backend used for testing
3 *
4 * Copyright (c) 2018 Nordic Semiconductor ASA
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
14
15#ifndef ZEPHYR_INCLUDE_SHELL_DUMMY_H_
16#define ZEPHYR_INCLUDE_SHELL_DUMMY_H_
17
18#include <zephyr/shell/shell.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25
28
30 size_t len;
31
33 char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
34
36 size_t input_len;
37
39 size_t input_pos;
40
42 char input_buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
43};
44
45#define SHELL_DUMMY_DEFINE(_name) \
46 static struct shell_dummy _name##_shell_dummy; \
47 struct shell_transport _name = { \
48 .api = &shell_dummy_transport_api, \
49 .ctx = (struct shell_dummy *)&_name##_shell_dummy \
50 }
51
62
72const char *shell_backend_dummy_get_output(const struct shell *sh,
73 size_t *sizep);
74
81
93int shell_backend_dummy_push_input(const struct shell *sh, const char *data, size_t len);
94
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* ZEPHYR_INCLUDE_SHELL_DUMMY_H_ */
const struct shell * shell_backend_dummy_get_ptr(void)
This function shall not be used directly.
const struct shell_transport_api shell_dummy_transport_api
void shell_backend_dummy_clear_output(const struct shell *sh)
Clears the output buffer in the shell backend.
int shell_backend_dummy_push_input(const struct shell *sh, const char *data, size_t len)
Push input data to the dummy shell backend.
void shell_backend_dummy_clear_input(const struct shell *sh)
Clear the input buffer in the shell backend.
const char * shell_backend_dummy_get_output(const struct shell *sh, size_t *sizep)
Returns the buffered output in the shell and resets the pointer.
Definition shell_dummy.h:26
char input_buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE]
input buffer for simulating user input
Definition shell_dummy.h:42
bool initialized
Definition shell_dummy.h:27
size_t len
current number of bytes in output buffer (0 if no output)
Definition shell_dummy.h:30
char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE]
output buffer to collect shell output
Definition shell_dummy.h:33
size_t input_len
current number of bytes in input buffer
Definition shell_dummy.h:36
size_t input_pos
current read position in input buffer
Definition shell_dummy.h:39
Unified shell transport interface.
Definition shell.h:818
Shell instance internals.
Definition shell.h:1065