Firmware: - Add spp_connect, spp_disconnect, spp_data events - Add spp_send, spp_disconnect, spp_status commands - Track remote address for connected SPP peer - Report received data as hex + optional text decode Python MCP: - esp32_spp_send(data/data_hex) - send text or binary - esp32_spp_disconnect() - close SPP connection - esp32_spp_status() - query connection state Tested: Linux rfcomm connect → ESP32, bidirectional data transfer works
31 lines
935 B
C
31 lines
935 B
C
/*
|
|
* bt_classic.h -- Classic Bluetooth GAP/SSP + SPP peripheral.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "cJSON.h"
|
|
|
|
void bt_classic_init(void);
|
|
|
|
/* Command handlers (dispatched from cmd_dispatcher) */
|
|
void cmd_classic_enable(const char *id, cJSON *params);
|
|
void cmd_classic_disable(const char *id, cJSON *params);
|
|
void cmd_classic_set_discoverable(const char *id, cJSON *params);
|
|
void cmd_classic_pair_respond(const char *id, cJSON *params);
|
|
void cmd_classic_set_ssp_mode(const char *id, cJSON *params);
|
|
|
|
/* SPP command handlers */
|
|
void cmd_spp_send(const char *id, cJSON *params);
|
|
void cmd_spp_disconnect(const char *id, cJSON *params);
|
|
void cmd_spp_status(const char *id, cJSON *params);
|
|
|
|
/* State query */
|
|
bool bt_classic_is_enabled(void);
|
|
|
|
/* Called by configure command to set IO capabilities */
|
|
void bt_classic_set_io_cap(const char *io_cap_str);
|
|
void bt_classic_set_device_class(uint32_t cod_raw);
|