/*
 * Copyright (c) 2021-2022, Erich Styger
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef SHELL_H_
#define SHELL_H_

#include "McuShell.h"
#include "McuRTOS.h"

#define SHELL_CMD_IDENTIFY_SF "Splitflap Number:"
#define SHELL_CMD_POWEROFF_RPI "Shutdown RPI"

#define SHELL_CMD_QUEUE_LENGTH 5


typedef enum ShellCmd {
	Shell_Identify_SF,
	Shell_Powerof_rpi
}Shell_cmd_t;

typedef struct ShellCmd_s {
	Shell_cmd_t shellCmd;
	uint32_t value;
}Shell_cmd_s;



#ifdef __cplusplus
extern "C" {
#endif

QueueHandle_t SHELL_GetShellCmdQueueHandle();

/*!
 * \brief Send a string to all supported I/Os
 * \param str String to send
 */
void SHELL_SendString(const unsigned char *str);

/*!
 * \brief Send a character to all supported I/Os
 * \param ch Character to send
 */
void SHELL_SendChar(unsigned char ch);

/*!
 * \brief Parses a command with a given standard I/O channel
 * \param command Command to be parsed
 * \param io I/O to be used. If NULL, the standard default I/O will be used
 * \param silent If parsing shall be silent or not
 * \return Error code, ERR_OK for no error
 */
uint8_t SHELL_ParseCommandIO(const unsigned char *command, McuShell_ConstStdIOType *io, bool silent);

/*!
 * \brief Module de-initialization
 */
void SHELL_Deinit(void);

/*!
 * \brief Module Initialization
 */
void SHELL_Init(void);

#ifdef __cplusplus
}  /* extern "C" */
#endif

#endif /* SHELL_H_ */
