Version: 1.0
Base URL: http://<device-ip>/
- Returns an HTML page with sensor info and a file upload form for OTA.
- Success:
200 text/html
- Returns JSON with sensor metadata.
- Example response:
{
"sensor_type": "<type>",
"sensor_id": "<id>"
}
- Source:
ESP_32_OTA/src/main.cpp:244-251
- Health check endpoint.
- Response:
200 text/plainwith body"pong". - Source:
ESP_32_OTA/src/main.cpp:253-256
- Returns JSON with
idused for firmware selection. - Source:
ESP_32_OTA/src/main.cpp:257-263
- Form field:
update(firmware binary file). - Behavior: Streams chunks to flash using
Update.write. - Completion: Responds
OKorFAILbased onUpdate.hasError(), then restarts on success. - Source:
ESP_32_OTA/src/main.cpp:211-242
- Body: JSON
{
"size": <integer-bytes>
}
- Behavior: Initializes OTA write with
Update.begin(size); sets internal progress state. - Responses:
200 {"success":true}on init success400 {"success":false,"error":"bad_json"}on parse failure500 {"success":false}on init/write errors
- Source:
ESP_32_OTA/src/main.cpp:265-287
- Body: JSON
{
"offset": <integer>,
"size": <integer>,
"data": "<hex-encoded-chunk>"
}
- Behavior: Validates hex and size; streams bytes to flash via
Update.write. - Responses:
200 {"success":true}on write success400witherrorone of:bad_json,bad_hex,size_mismatch,not_in_progress500 {"success":false}on write failure
- Source:
ESP_32_OTA/src/main.cpp:288-321
- Body: none
- Behavior: Finalizes OTA with
Update.end(true); on success responds and restarts. - Responses:
200 {"success":true}then device restarts400 {"success":false,"error":"not_in_progress"}if no active session500 {"success":false}on finalize failure
- Source:
ESP_32_OTA/src/main.cpp:322-339
- Upload handler streams with
Update.write(data); finalizes withUpdate.end(true)and restarts. - Responses:
OKorFAIL(text/plain) based onUpdate.hasError(). - Source:
TOF_Firmware_bin_Generator/src/config_handler.cpp:212-241
- Request: UDP packet with ASCII
"LABEXPERT_DISCOVERY"to port8888. - Response: JSON to sender on port
8889. - Bootloader fields include:
device_id,ip_address,firmware_version = "OTA_BOOTLOADER",sensor_type,availability,magic. - Source:
ESP_32_OTA/src/main.cpp:341-389
400 Bad Request: JSON parse errors, invalid hex, size mismatch, or wrong state.500 Internal Server Error: Flash write or finalize failures.200 OK: Successful write or initialization.
- Authentication is not enforced; endpoints are accessible over HTTP.
- Ensure firmware size fits target partition; typical
ota_0/ota_1capacity ≈ 1.8 MB.