module documentation

WiFi Server - Host a web server over WiFi.

Class Server Simple HTTP Server for MicroPython WiFi Devices
Function run Run the app.
Function start Start the app and begin serving.
Function stop Stop the app and clean up.
Constant SERVER_FOLDER Undocumented
Constant SERVER_INFO Undocumented
Constant STATE_MENU_ADD_PAGE Undocumented
Constant STATE_MENU_EDIT Undocumented
Constant STATE_MENU_EDIT_PAGE Undocumented
Constant STATE_MENU_MAIN Undocumented
Constant STATE_MENU_SETTINGS Undocumented
Constant STATE_MENU_VIEW_PAGES Undocumented
Constant STATE_PAGE_DELETE Undocumented
Constant STATE_PAGE_HTML Undocumented
Constant STATE_PAGE_MENU Undocumented
Constant STATE_PAGE_METHOD Undocumented
Constant STATE_PAGE_SCRIPT Undocumented
Constant STATE_PAGE_URL Undocumented
Constant STATE_RUNNING Undocumented
Constant STATE_SETTINGS_MODE Undocumented
Constant STATE_SETTINGS_PASSWORD Undocumented
Constant STATE_SETTINGS_SSID Undocumented
Variable box Undocumented
Variable current_page_index Undocumented
Variable current_page_info Undocumented
Variable just_started_editing Undocumented
Variable menu Undocumented
Variable save_requested Undocumented
Variable server Undocumented
Variable settings_info Undocumented
Function __add_page Add a new page to the server.
Function __add_page_callback Callback for when a page field is saved during add page.
Function __box_start Start the textbox for server output.
Function __callback_edit_save Callback for when a page field is saved.
Function __delete_page Delete a page from the server info file.
Function __edit_page Edit a page field given its index.
Function __edit_setting Edit a setting using the keyboard.
Function __get_current_pages Get the list of current pages from the server info file.
Function __get_page_info_index Get the page info for a given index from the server info file.
Function __get_setting Get a setting from the server info file.
Function __menu_run Run the server.
Function __menu_start Show a menu to select from options.
Function __save_setting Save a setting to the server info file.
Function __server_start Start the server app.
Function __setting_callback Callback for when a setting is saved.
Function __toggle_mode Toggle between AP and STA mode.
def run(view_manager):

Run the app.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
def start(view_manager) -> bool:

Start the app and begin serving.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
Returns
boolTrue if the app started, False on failure.
def stop(view_manager):

Stop the app and clean up.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
SERVER_FOLDER: str =

Undocumented

Value
'picoware/wifi/server'
SERVER_INFO: str =

Undocumented

Value
'picoware/wifi/server/server_info.json'
STATE_MENU_ADD_PAGE =

Undocumented

Value
const(3)
STATE_MENU_EDIT =

Undocumented

Value
const(1)
STATE_MENU_EDIT_PAGE =

Undocumented

Value
const(6)
STATE_MENU_MAIN =

Undocumented

Value
const(0)
STATE_MENU_SETTINGS =

Undocumented

Value
const(5)
STATE_MENU_VIEW_PAGES =

Undocumented

Value
const(4)
STATE_PAGE_DELETE =

Undocumented

Value
const(4)
STATE_PAGE_HTML =

Undocumented

Value
const(1)
STATE_PAGE_MENU =

Undocumented

Value
const((-1))
STATE_PAGE_METHOD =

Undocumented

Value
const(2)
STATE_PAGE_SCRIPT =

Undocumented

Value
const(3)
STATE_PAGE_URL =

Undocumented

Value
const(0)
STATE_RUNNING =

Undocumented

Value
const(2)
STATE_SETTINGS_MODE =

Undocumented

Value
const(7)
STATE_SETTINGS_PASSWORD =

Undocumented

Value
const(9)
STATE_SETTINGS_SSID =

Undocumented

Value
const(8)
box =

Undocumented

current_page_index: int =

Undocumented

current_page_info: dict =

Undocumented

just_started_editing: bool =

Undocumented

menu =

Undocumented

save_requested: bool =

Undocumented

server =

Undocumented

settings_info: dict =

Undocumented

def __add_page(view_manager) -> bool:

Add a new page to the server.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
Returns
boolTrue if editing continues or the page was saved, False otherwise.
def __add_page_callback(result: str):

Callback for when a page field is saved during add page.

Parameters
result:strThe saved field value.
def __box_start(view_manager):

Start the textbox for server output.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
def __callback_edit_save(result: str):

Callback for when a page field is saved.

Parameters
result:strThe saved field value.
def __delete_page(view_manager, index: int):

Delete a page from the server info file.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
index:intThe page index to delete.
def __edit_page(view_manager, index: int, key: str, return_status: bool = True, return_state: int = STATE_PAGE_MENU) -> bool:

Edit a page field given its index.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
index:intThe page index to edit.
key:strThe field key to edit.
return_status:boolWhether to return to the edit page menu after saving. Defaults to True.
return_state:intThe state to return to after saving. Defaults to STATE_PAGE_MENU.
Returns
boolTrue if editing continues, False otherwise.
def __edit_setting(view_manager, setting_key: str) -> bool:

Edit a setting using the keyboard.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
setting_key:strThe setting key to edit.
Returns
boolTrue if editing continues or the setting was saved, False otherwise.
def __get_current_pages(view_manager) -> list[str]:

Get the list of current pages from the server info file.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
Returns
list[str]The page URLs.
def __get_page_info_index(view_manager, index: int) -> dict:

Get the page info for a given index from the server info file.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
index:intThe page index.
Returns
dictThe page info.
def __get_setting(view_manager, key: str, default: str = '') -> str:

Get a setting from the server info file.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
key:strThe setting key.
default:strThe value returned if the key is missing. Defaults to "".
Returns
strThe setting value.
def __menu_run(view_manager):

Run the server.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
def __menu_start(view_manager):

Show a menu to select from options.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
def __save_setting(view_manager, key: str, value: str):

Save a setting to the server info file.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
key:strThe setting key.
value:strThe setting value.
def __server_start(view_manager) -> bool:

Start the server app.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
Returns
boolTrue if the server started, False otherwise.
def __setting_callback(result: str):

Callback for when a setting is saved.

Parameters
result:strThe saved setting value.
def __toggle_mode(view_manager, selection: int):

Toggle between AP and STA mode.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
selection:int0 for AP mode, otherwise STA mode.