feat(provisioning): add mini-program BLE Wi-Fi setup
This commit is contained in:
@@ -137,6 +137,35 @@ typedef struct {
|
||||
int status_code;
|
||||
} platform_https_response_t;
|
||||
|
||||
#define PLATFORM_BLE_UUID128_LEN 16
|
||||
#define PLATFORM_BLE_GATT_NAME_MAX_LEN 31
|
||||
#define PLATFORM_BLE_GATT_VALUE_MAX_LEN 512
|
||||
|
||||
typedef struct {
|
||||
uint8_t bytes[PLATFORM_BLE_UUID128_LEN];
|
||||
} platform_ble_uuid128_t;
|
||||
|
||||
typedef enum {
|
||||
PLATFORM_BLE_GATT_NOTIFY_VALUE = 0,
|
||||
PLATFORM_BLE_GATT_READ_NOTIFY_VALUE,
|
||||
} platform_ble_gatt_notify_target_t;
|
||||
|
||||
typedef void (*platform_ble_gatt_write_callback_t)(const uint8_t *data,
|
||||
size_t data_len,
|
||||
void *user_data);
|
||||
|
||||
typedef struct {
|
||||
const char *advertised_name;
|
||||
platform_ble_uuid128_t service_uuid;
|
||||
platform_ble_uuid128_t write_uuid;
|
||||
platform_ble_uuid128_t notify_uuid;
|
||||
platform_ble_uuid128_t read_notify_uuid;
|
||||
const uint8_t *read_value;
|
||||
size_t read_value_len;
|
||||
platform_ble_gatt_write_callback_t on_write;
|
||||
void *user_data;
|
||||
} platform_ble_gatt_server_config_t;
|
||||
|
||||
esp_err_t platform_init(void);
|
||||
esp_err_t platform_prepare_storage(void);
|
||||
bool platform_storage_is_ready(void);
|
||||
@@ -225,6 +254,23 @@ esp_err_t platform_https_post_json(const platform_https_post_json_request_t *req
|
||||
platform_https_response_t *response);
|
||||
bool platform_https_is_connect_error(esp_err_t err);
|
||||
|
||||
/** Start a generic single-service BLE GATT peripheral. */
|
||||
esp_err_t platform_ble_gatt_server_start(const platform_ble_gatt_server_config_t *config);
|
||||
|
||||
/** Send a payload to a subscribed GATT notification characteristic. */
|
||||
esp_err_t platform_ble_gatt_server_notify(platform_ble_gatt_notify_target_t target,
|
||||
const uint8_t *data,
|
||||
size_t data_len);
|
||||
|
||||
/**
|
||||
* Stop the platform-owned NimBLE runtime. A positive timeout bounds the wait;
|
||||
* zero requests cooperative teardown without waiting.
|
||||
*/
|
||||
esp_err_t platform_ble_gatt_server_stop(int timeout_ms);
|
||||
|
||||
/** Read the running application version into caller-owned storage. */
|
||||
esp_err_t platform_read_firmware_version(char *out, size_t out_len);
|
||||
|
||||
/**
|
||||
* @brief Rotate stepper synchronously with a bounded timeout.
|
||||
*
|
||||
@@ -259,7 +305,11 @@ esp_err_t platform_wifi_portal_start_config_ap(const char *ssid_prefix);
|
||||
* - On timeout/failure, no hidden destructive continuation is started after return.
|
||||
*/
|
||||
esp_err_t platform_wifi_portal_connect_sta(int timeout_ms);
|
||||
esp_err_t platform_wifi_portal_connect_sta_with_credentials(const char *ssid,
|
||||
const char *password,
|
||||
int timeout_ms);
|
||||
esp_err_t platform_wifi_portal_reconnect_sta(int timeout_ms);
|
||||
esp_err_t platform_wifi_portal_stop_sta(void);
|
||||
esp_err_t platform_wifi_portal_save_credentials(const char *ssid, const char *password);
|
||||
esp_err_t platform_wifi_portal_clear_saved_credentials(void);
|
||||
bool platform_wifi_connect_error_keeps_credentials(esp_err_t err);
|
||||
|
||||
Reference in New Issue
Block a user