xref: /aosp_15_r20/external/libwebsockets/READMEs/README.esp32.md (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1*1c60b9acSAndroid Build Coastguard WorkerESP32 Support
2*1c60b9acSAndroid Build Coastguard Worker=============
3*1c60b9acSAndroid Build Coastguard Worker
4*1c60b9acSAndroid Build Coastguard WorkerSee \ref esp32 for details on how to build lws as a component in an ESP-IDF project.
5*1c60b9acSAndroid Build Coastguard Worker
6*1c60b9acSAndroid Build Coastguard WorkerLws provides a "factory" application
7*1c60b9acSAndroid Build Coastguard Worker
8*1c60b9acSAndroid Build Coastguard Workerhttps://github.com/warmcat/lws-esp32-factory
9*1c60b9acSAndroid Build Coastguard Worker
10*1c60b9acSAndroid Build Coastguard Workerand a test application which implements the generic lws server test apps
11*1c60b9acSAndroid Build Coastguard Worker
12*1c60b9acSAndroid Build Coastguard Workerhttps://github.com/warmcat/lws-esp32-test-server-demos
13*1c60b9acSAndroid Build Coastguard Worker
14*1c60b9acSAndroid Build Coastguard WorkerThe behaviours of the generic factory are are quite rich, and cover uploading SSL certs through factory and user configuration, AP selection and passphrase entry, and managing a switch to allow the user to force entry to user setup mode at boot subsequently.
15*1c60b9acSAndroid Build Coastguard Worker
16*1c60b9acSAndroid Build Coastguard WorkerThe factory app comes with partitioning for a 1MB factory partition containing that app and data, and a single 2.9MB OTA partition containing the main app.
17*1c60b9acSAndroid Build Coastguard Worker
18*1c60b9acSAndroid Build Coastguard WorkerThe factory app is able to do OTA updates for both the factory and OTA partition slots; updating the factory slot first writes the new image to the OTA slot and copies it into place at the next boot, after which the user can reload the OTA slot.
19*1c60b9acSAndroid Build Coastguard Worker
20*1c60b9acSAndroid Build Coastguard WorkerState|Image|AP SSID|Port|URL|Mode
21*1c60b9acSAndroid Build Coastguard Worker---|---|---|---|---|---
22*1c60b9acSAndroid Build Coastguard WorkerFactory Reset or Uninitialized|Factory|AP: ESP_012345|80|http://192.168.4.1|factory.html - to set certificates and serial
23*1c60b9acSAndroid Build Coastguard WorkerUser configuration|Factory|AP: config-model-serial|443|https://192.168.4.1|index.html - user set up his AP information
24*1c60b9acSAndroid Build Coastguard WorkerOperation|OTA|Station only|443|https://model-serial.local|OTA application
25*1c60b9acSAndroid Build Coastguard Worker
26*1c60b9acSAndroid Build Coastguard Worker## Basic Auth
27*1c60b9acSAndroid Build Coastguard Worker
28*1c60b9acSAndroid Build Coastguard WorkerThe lws-esp32-test-server-demos app also demos basic auth.
29*1c60b9acSAndroid Build Coastguard Worker
30*1c60b9acSAndroid Build Coastguard WorkerOn a normal platform this is done by binding a mount to a text file somewhere in the filesystem, which
31*1c60b9acSAndroid Build Coastguard Workercontains user:password information one per line.
32*1c60b9acSAndroid Build Coastguard Worker
33*1c60b9acSAndroid Build Coastguard WorkerOn ESP32 there is not necessarily any generic VFS in use.  So instead, the basic auth lookup is bound to
34*1c60b9acSAndroid Build Coastguard Workera given nvs domain, where the username is the key and the password the value.  main/main.c in the test
35*1c60b9acSAndroid Build Coastguard Workerdemos app shows how to both make the mount use basic auth, and how to set a user:password combination
36*1c60b9acSAndroid Build Coastguard Workerusing nvs.
37*1c60b9acSAndroid Build Coastguard Worker
38