43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
/*******************************************************************************
|
|
* @file cmd.h
|
|
* @brief VivaMayo Command Handler Interface
|
|
* @author Charles KWON <charleskwon@medithings.co.kr>
|
|
* @date 2025-01-30
|
|
* @copyright (c) 2025 Medithings Inc. All rights reserved.
|
|
*
|
|
* @details Firmware-specific command interface for VivaMayo.
|
|
* Core types (ParsedCmd, CmdEntry) are defined in parser.h
|
|
* Command table (g_cmd_table) is defined in cmd.c
|
|
******************************************************************************/
|
|
|
|
#ifndef CMD_H
|
|
#define CMD_H
|
|
|
|
/* Include parser.h for ParsedCmd, CmdEntry, cmd_handler_t types */
|
|
#include "parser.h"
|
|
|
|
/*==============================================================================
|
|
* @section UTIL Utility Functions (for use by handlers)
|
|
* @brief Convenience wrappers for parser utility functions
|
|
*============================================================================*/
|
|
|
|
/**
|
|
* @brief Extract uint16 from ParsedCmd data (little endian)
|
|
* @param cmd Parsed command
|
|
* @param word_index Word index (0-based)
|
|
* @param out Output value
|
|
* @return true on success
|
|
*/
|
|
bool cmd_get_u16(const ParsedCmd *cmd, uint8_t word_index, uint16_t *out);
|
|
|
|
/**
|
|
* @brief Extract ASCII string from ParsedCmd data
|
|
* @param cmd Parsed command
|
|
* @param offset Byte offset in data
|
|
* @param out Output buffer
|
|
* @param max_len Maximum length
|
|
*/
|
|
void cmd_get_ascii(const ParsedCmd *cmd, uint8_t offset, char *out, uint8_t max_len);
|
|
|
|
#endif /* CMD_H */
|