#pragma once
/*
 * cmd_exec.h — ESP-NOW CMD executor for the PLIP voice annex (D5 contract).
 *
 * Handles JSON CMD frames: { "op": "play"|"screen"|"evt"|"led", "a": {...} }
 * Routing:
 *   play   → audio_play_async(a.p)
 *   screen → log only (no display on PLIP)
 *   evt    → log only
 *   led    → log only
 */

#include "esp_err.h"
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Parse and dispatch a CMD JSON payload received from the master via ESP-NOW.
 * `data` is a NUL-terminated JSON string of `len` bytes.
 * Returns ESP_OK on success, ESP_ERR_INVALID_ARG on parse error,
 * ESP_ERR_NOT_SUPPORTED for unknown ops. */
esp_err_t cmd_exec_handle(const char *data, size_t len);

#ifdef __cplusplus
}
#endif
