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
46
48 void *context;
49};
50
51#define SHELL_DUMMY_DEFINE(_name) \
52 static struct shell_dummy _name##_shell_dummy; \
53 struct shell_transport _name = { \
54 .api = &shell_dummy_transport_api, \
55 .ctx = (struct shell_dummy *)&_name##_shell_dummy \
56 }
57
68
78const char *shell_backend_dummy_get_output(const struct shell *sh,
79 size_t *sizep);
80
87
99int shell_backend_dummy_push_input(const struct shell *sh, const char *data, size_t len);
100
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* ZEPHYR_INCLUDE_SHELL_DUMMY_H_ */
void(* shell_transport_handler_t)(enum shell_transport_evt evt, void *context)
Definition shell.h:806
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
void * context
Event handler context.
Definition shell_dummy.h:48
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
shell_transport_handler_t handler
Event handler.
Definition shell_dummy.h:45
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:829
Shell instance internals.
Definition shell.h:1076