File wsh_shell_promptwait.h
FileList > src > wsh_shell_promptwait.h
Go to the source code of this file
One-time user input waiting mechanism for WshShell. More...
#include "wsh_shell_cfg.h"#include "wsh_shell_io.h"
Classes
| Type | Name |
|---|---|
| struct | WshShellPromptWait Prompt-wait control structure. |
Public Types
| Type | Name |
|---|---|
| typedef WshShell_Bool_t(* | WshShellPromptWait_Handler_t Function pointer type for prompt-wait callbacks. |
| typedef struct WshShellPromptWait | WshShellPromptWait_t Prompt-wait control structure. |
Public Functions
| Type | Name |
|---|---|
| void | WshShellPromptWait_Attach (WshShellPromptWait_t * pWait, WshShellPromptWait_Handler_t handler, void * pCtx) Attach a one-time input handler. |
| WshShell_Bool_t | WshShellPromptWait_Enter (WshShell_Char_t symbol, WshShellPromptWait_t * pWait) User input handler for prompt-wait mode. |
| void | WshShellPromptWait_Flush (WshShellPromptWait_t * pWait) Flush the current prompt-wait mode. |
| WSH_SHELL_RET_STATE_t | WshShellPromptWait_Handle (WshShellPromptWait_t * pWait, WshShell_Char_t symbol) Handle a symbol when in prompt-wait mode. |
| WshShell_Bool_t | WshShellPromptWait_YesNo (WshShell_Char_t symbol, WshShellPromptWait_t * pWait) |
Detailed Description
This module allows the shell to temporarily override normal input handling to wait for a specific key press (e.g., <Enter>, Y/N confirmation, etc.).
Once the input is received, the registered callback is executed, and normal shell behavior resumes.
Author:
Whoosh Embedded Team
Copyright:
Copyright (c) 2025
Public Types Documentation
typedef WshShellPromptWait_Handler_t
Function pointer type for prompt-wait callbacks.
Parameters:
symbolThe character that was entered by the user.pCtxOptional user context passed to the handler.
typedef WshShellPromptWait_t
Prompt-wait control structure.
Holds the active handler and optional context pointer. If Handler is NULL, no prompt-wait is active.
Public Functions Documentation
function WshShellPromptWait_Attach
Attach a one-time input handler.
Replaces normal shell input handling with a temporary callback. The callback will receive the first character entered by the user, after which it should typically disable itself by calling WshShellPromptWait_Flush().
Parameters:
pWaitPointer to prompt-wait control object.handlerCallback function to invoke on user input.pCtxOptional pointer to user context.
function WshShellPromptWait_Enter
User input handler for prompt-wait mode.
Processes a character entered by the user while waiting for specific input (e.g., Enter key, Y/N confirmation, etc.).
Parameters:
symbolThe character entered by the user.pWaitPointer to the prompt-wait control structure.
Returns:
WshShell_Bool_t * true if the input was handled and waiting can end; * false if waiting should continue.
function WshShellPromptWait_Flush
Flush the current prompt-wait mode.
Resets the handler to NULL so that normal shell input is processed.
Parameters:
pWaitPointer to prompt-wait control object.
function WshShellPromptWait_Handle
Handle a symbol when in prompt-wait mode.
If a handler is set, it is called with the given symbol and context.
Parameters:
pWaitPointer to prompt-wait control object.symbolCharacter entered by the user.
Returns:
WSH_SHELL_RET_STATE_ERR_PARAM if some problems with input params WSH_SHELL_RET_STATE_ERR_EMPTY if there are no handler attached WSH_SHELL_RET_STATE_ERR_BUSY if normal shell processing should continue WSH_SHELL_RET_STATE_SUCCESS if the symbol was handled by the prompt-wait mechanism
function WshShellPromptWait_YesNo
The documentation for this class was generated from the following file src/wsh_shell_promptwait.h