Zephyr Project API 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_SHELL_DUMMY_H_
16#define ZEPHYR_INCLUDE_SHELL_SHELL_DUMMY_H_
17
18#include <zephyr/shell/shell.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25extern const struct shell_transport_api shell_dummy_transport_api;
26
27struct shell_dummy {
28 bool initialized;
29
31 size_t len;
32
34 char buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
35
37 size_t input_len;
38
40 size_t input_pos;
41
43 char input_buf[CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE];
44
47
49 void *context;
50};
52
59
65#define SHELL_DUMMY_DEFINE(_name) \
66 static struct shell_dummy _name##_shell_dummy; \
67 struct shell_transport _name = { \
68 .api = &shell_dummy_transport_api, \
69 .ctx = (struct shell_dummy *)&_name##_shell_dummy \
70 }
71
82
92const char *shell_backend_dummy_get_output(const struct shell *sh,
93 size_t *sizep);
94
101
113int shell_backend_dummy_push_input(const struct shell *sh, const char *data, size_t len);
114
121
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif /* ZEPHYR_INCLUDE_SHELL_SHELL_DUMMY_H_ */
void(* shell_transport_handler_t)(enum shell_transport_evt evt, void *context)
Shell transport event handler callback.
Definition shell.h:831
const struct shell * shell_backend_dummy_get_ptr(void)
This function shall not be used directly.
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.
Header file for the shell subsystem.
Unified shell transport interface.
Definition shell.h:864
Shell instance internals.
Definition shell.h:1129