Files
esp32-lua-api/lua/api/core/sys.lua
T
evan 75b3a2c490 refactor(api)!: one namespace per feature, screen split out
Namespaces were shared across features: `settings` was written by core, the
panel and touch, and `input` by touch and buttons. That made "does this
firmware implement the whole feature?" a question no pointer could answer.

Each namespace now belongs to exactly one feature or to core, so a feature is
a provider pointer and the compiler validates completeness:

  gui, node       -> screen, tree, under the screen feature
  settings        -> screen (rotation, theme), sys (timezone),
                     touch (calibration)
  input           -> touch, buttons

Runtime::open() no longer requires a GuiProvider; a firmware without one runs
with no screen/tree globals and reports sys.hasFeature("screen") false.
Rotation is one value again: GuiProvider::setRotation applies and persists, so
an app rotating the panel transiently puts the old value back itself.
2026-08-05 10:26:38 -04:00

75 lines
2.2 KiB
Lua

---@meta
-- Generated from native/src/bindings/core/sys.cpp. Do not edit.
---@alias Feature "screen"|"touch"|"buttons"
---@class SysLib
sys = {}
---Returns the implemented API contract version.
---@return integer
function sys.getAPIVersion() end
---Whether the firmware implements a complete optional feature contract.
---@param feature Feature
---@return boolean
function sys.hasFeature(feature) end
---Returns monotonic milliseconds since boot.
---@return integer
function sys.getMillis() end
---Returns the immutable first path component of the running app.
---@return string
function sys.getAppID() end
---Returns the running app title, initially the app ID.
---@return string
function sys.getAppTitle() end
---Returns the current app's guaranteed-existing persistent data directory.
---@return string Absolute path under /.lua/data, preserved across app updates.
function sys.getAppDataPath() end
---Changes the running app's display title.
---@param title string
function sys.setAppTitle(title) end
---Launches a route, which main.lua resolves, and pushes the current one.
---@param path string App-relative route; traversal is rejected.
---@param arg? string Passed to main.start(route, arg).
function sys.launch(path, arg) end
---Launches a route without retaining the current one.
---@param path string App-relative route; traversal is rejected.
---@param arg? string Passed to main.start(route, arg).
function sys.replace(path, arg) end
---Returns to the previous app, or the launcher when history is empty.
function sys.back() end
---Whether sys.back() would return somewhere rather than land on the launcher, which is what chrome needs to decide whether to offer a back control.
---@return boolean
function sys.canGoBack() end
---Returns heap statistics.
---@return integer freeBytes
---@return integer totalBytes
---@return integer largestFreeBlock
function sys.getMemory() end
---Whether network time synchronization has completed.
---@return boolean
function sys.isClockSynced() end
---Returns the active POSIX timezone rule.
---@return string
function sys.getTimezone() end
---Applies and persists a POSIX timezone rule.
---@param timezone string
---@return true? ok
---@return string? error
function sys.setTimezone(timezone) end