Add typed serial settings operations
Route bounded admin mutations through the existing administration dispatcher, covering apply, lifecycle, persistence, authorization, and result tracking. Add the browser controls, automatic result refresh, regression coverage, and phase documentation.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "linenoise/linenoise.h"
|
||||
#include "secure_random.h"
|
||||
#include "user_database.h"
|
||||
#include "web_serial_settings.h"
|
||||
|
||||
#define ADMIN_SSH_CONSOLE_MAX_SESSIONS 2U
|
||||
#define ADMIN_SSH_CONSOLE_OUTPUT_CAPACITY 4096U
|
||||
@@ -81,6 +82,7 @@ typedef enum {
|
||||
ADMIN_REQUEST_SSH = 0,
|
||||
ADMIN_REQUEST_UART0,
|
||||
ADMIN_REQUEST_DEFERRED,
|
||||
ADMIN_REQUEST_SERIAL_SETTINGS,
|
||||
} admin_request_origin_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -91,6 +93,7 @@ typedef struct {
|
||||
union {
|
||||
uint8_t line[ADMIN_SSH_CONSOLE_COMMAND_LINE_CAPACITY + 1U];
|
||||
admin_control_request_t deferred;
|
||||
uint32_t serial_settings_id;
|
||||
};
|
||||
} admin_request_t;
|
||||
|
||||
@@ -646,6 +649,16 @@ static void dispatch_registered_command(admin_request_t *request)
|
||||
|
||||
static void dispatch_deferred_request(admin_request_t *request);
|
||||
|
||||
esp_err_t admin_ssh_console_submit_serial_settings(uint32_t id)
|
||||
{
|
||||
taskENTER_CRITICAL(&s_lock);
|
||||
bool ready = s_dispatch_ready;
|
||||
taskEXIT_CRITICAL(&s_lock);
|
||||
if (!ready || !id) return ESP_ERR_INVALID_STATE;
|
||||
admin_request_t request = {.origin = ADMIN_REQUEST_SERIAL_SETTINGS, .serial_settings_id = id};
|
||||
return xQueueSend(s_request_queue, &request, 0U) == pdTRUE ? ESP_OK : ESP_ERR_TIMEOUT;
|
||||
}
|
||||
|
||||
static void worker_task(void *context)
|
||||
{
|
||||
(void)context;
|
||||
@@ -654,6 +667,11 @@ static void worker_task(void *context)
|
||||
if (xQueueReceive(s_request_queue, &request, portMAX_DELAY) != pdTRUE) {
|
||||
continue;
|
||||
}
|
||||
if (request.origin == ADMIN_REQUEST_SERIAL_SETTINGS) {
|
||||
web_serial_settings_execute(request.serial_settings_id);
|
||||
secure_wipe(&request, sizeof(request));
|
||||
continue;
|
||||
}
|
||||
if (request.origin == ADMIN_REQUEST_DEFERRED) {
|
||||
dispatch_deferred_request(&request);
|
||||
secure_wipe(&request, sizeof(request));
|
||||
|
||||
Reference in New Issue
Block a user