Ryan Malloy dc6078b296 Fix firmware for ESP-IDF v5.3 and hardware-verified operation
- Switch UART0 for protocol I/O (USB bridge), disable ESP-IDF console
- Wire all 21 command handlers into dispatch table (was only 4)
- Add configure command handler (name, io_cap, device_class)
- Add bt_classic_is_enabled()/bt_ble_is_enabled() for live status
- Fix cJSON_False misuse in get_status (type constant, not boolean)
- Fix esp_bt_gap_set_cod() to use esp_bt_cod_t bitfield struct
- Fix auth_cmpl.auth_mode → lk_type for ESP-IDF v5.3
- Replace deprecated esp_bt_dev_set_device_name with stack-specific API
- Remove unused bytes_to_hex, obsolete kconfig symbols
- Use large partition table (1.5MB) for dual-mode BT stack

Verified on ESP32-D0WD-V3 rev 3.1, /dev/ttyUSB4, all commands tested.
2026-02-02 15:30:54 -07:00

68 lines
2.2 KiB
C

#pragma once
#include "driver/uart.h"
/* UART configuration */
#define PROTO_UART_NUM UART_NUM_0
#define PROTO_BAUD_RATE 115200
#define PROTO_TX_BUF_SIZE 4096
#define PROTO_RX_BUF_SIZE 4096
#define PROTO_MAX_LINE 2048
/* Message types */
#define MSG_TYPE_CMD "cmd"
#define MSG_TYPE_RESP "resp"
#define MSG_TYPE_EVENT "event"
/* Response status */
#define STATUS_OK "ok"
#define STATUS_ERROR "error"
/* System commands */
#define CMD_PING "ping"
#define CMD_RESET "reset"
#define CMD_GET_INFO "get_info"
#define CMD_GET_STATUS "get_status"
/* Configuration commands */
#define CMD_CONFIGURE "configure"
#define CMD_LOAD_PERSONA "load_persona"
#define CMD_LIST_PERSONAS "list_personas"
#define CMD_CLASSIC_SET_SSP_MODE "classic_set_ssp_mode"
/* Classic BT commands */
#define CMD_CLASSIC_ENABLE "classic_enable"
#define CMD_CLASSIC_DISABLE "classic_disable"
#define CMD_CLASSIC_SET_DISCOVERABLE "classic_set_discoverable"
#define CMD_CLASSIC_PAIR_RESPOND "classic_pair_respond"
/* BLE commands */
#define CMD_BLE_ENABLE "ble_enable"
#define CMD_BLE_DISABLE "ble_disable"
#define CMD_BLE_ADVERTISE "ble_advertise"
#define CMD_BLE_SET_ADV_DATA "ble_set_adv_data"
/* GATT commands */
#define CMD_GATT_ADD_SERVICE "gatt_add_service"
#define CMD_GATT_ADD_CHARACTERISTIC "gatt_add_characteristic"
#define CMD_GATT_SET_VALUE "gatt_set_value"
#define CMD_GATT_NOTIFY "gatt_notify"
#define CMD_GATT_CLEAR "gatt_clear"
/* Events */
#define EVT_BOOT "boot"
#define EVT_PAIR_REQUEST "pair_request"
#define EVT_PAIR_COMPLETE "pair_complete"
#define EVT_CONNECT "connect"
#define EVT_DISCONNECT "disconnect"
#define EVT_GATT_READ "gatt_read"
#define EVT_GATT_WRITE "gatt_write"
#define EVT_GATT_SUBSCRIBE "gatt_subscribe"
/* SSP IO capabilities */
#define IO_CAP_DISPLAY_ONLY "display_only"
#define IO_CAP_DISPLAY_YESNO "display_yesno"
#define IO_CAP_KEYBOARD_ONLY "keyboard_only"
#define IO_CAP_NO_IO "no_io"
#define IO_CAP_KEYBOARD_DISPLAY "keyboard_display"