/*==============================================================================
 * cmd_table.c - Command table definition
 *
 * This file is the only linkage point between parser.c and the cmd_*.c handler modules.
 * It pulls in every cmd_*.h to gather handler prototypes,
 * builds the CmdEntry array, and injects the table into the parser via dr_parser_init() inside cmd_table_init().
 *
 * Adding a new command:
 *  1) Implement the handler in the appropriate cmd_*.c
 *  2) Add the prototype to the matching cmd_*.h
 *  3) Append { "tag?", true, Cmd_xxx } to m_cmd_table[] below
 *============================================================================*/

#include "parser.h"
#include "cmd_table.h"
#include "cmd_device.h"
#include "cmd_info.h"
#include "cmd_sensor.h"
#include "cmd_piezo.h"

static const CmdEntry m_cmd_table[] = {
    /* A. Device state control */
    { "msq?", true, Cmd_msq },
    { "mss?", true, Cmd_mss },
#if FEATURE_SECURE_CONNECTION
    { "msr?", true, Cmd_msr },
#endif
    { "cmd?", true, Cmd_cmd },

    /* B. Device information */
    { "mfv?", true, Cmd_mfv },
    { "mid?", true, Cmd_mid },
    { "mwh?", true, Cmd_mwh },
    { "mws?", true, Cmd_mws },
    { "mrh?", true, Cmd_mrh },
    { "mrs?", true, Cmd_mrs },
    { "mpz?", true, Cmd_mpz },
    { "mqz?", true, Cmd_mqz },

    /* C. Sensor measurement */
    { "msn?", true, Cmd_msn },
    { "mst?", true, Cmd_mst },
    { "msp?", true, Cmd_msp },

    /* D. Piezo ultrasound */
    { "mpa?", true, Cmd_mpa },
    { "mpb?", true, Cmd_mpb },
    { "mpc?", true, Cmd_mpc },
    { "mec?", true, Cmd_mec },
    { "maa?", true, Cmd_maa },
    { "mbb?", true, Cmd_mbb },
    { "mab?", true, Cmd_mab }, // B-Mode Test
    { "mtb?", true, Cmd_mtb },
    { "mcf?", true, Cmd_mcf },
    { "mcs?", true, Cmd_mcs },

    /* E. LED control (handler in cmd_device.c) */
    { "mls?", true, Cmd_mls },
};

void cmd_table_init(void)
{
    dr_parser_init(m_cmd_table, sizeof(m_cmd_table) / sizeof(m_cmd_table[0]));
}
