Zephyr API Documentation 4.3.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
9#ifndef ZEPHYR_INCLUDE_SHELL_DUMMY_H_
10#define ZEPHYR_INCLUDE_SHELL_DUMMY_H_
11
12#include <zephyr/shell/shell.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
19
22
24 size_t len;
25
27 char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
28
30 size_t input_len;
31
33 size_t input_pos;
34
36 char input_buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
37};
38
39#define SHELL_DUMMY_DEFINE(_name) \
40 static struct shell_dummy _name##_shell_dummy; \
41 struct shell_transport _name = { \
42 .api = &shell_dummy_transport_api, \
43 .ctx = (struct shell_dummy *)&_name##_shell_dummy \
44 }
45
56
66const char *shell_backend_dummy_get_output(const struct shell *sh,
67 size_t *sizep);
68
75
87int shell_backend_dummy_push_input(const struct shell *sh, const char *data, size_t len);
88
95
96#ifdef __cplusplus
97}
98#endif
99
100#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:20
char input_buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE]
input buffer for simulating user input
Definition shell_dummy.h:36
bool initialized
Definition shell_dummy.h:21
size_t len
current number of bytes in output buffer (0 if no output)
Definition shell_dummy.h:24
char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE]
output buffer to collect shell output
Definition shell_dummy.h:27
size_t input_len
current number of bytes in input buffer
Definition shell_dummy.h:30
size_t input_pos
current read position in input buffer
Definition shell_dummy.h:33
Unified shell transport interface.
Definition shell.h:818
Shell instance internals.
Definition shell.h:1063