Files
tactility/Modules/app-module/include/app/loader.h
T
Ken Van Hoeylandt ab75d2022d Refactored events (#621)
Event handling:

- Added unified event handling for application, system, and Wi‑Fi events.
- Updated all apps to reflect event handling changes

Wi-Fi:

- Refactored event handling from listener interface to task & event group.
- Added direct Wi‑Fi radio controls and improved event subscriptions.
- Wi‑Fi screens now refresh asynchronously and handle unavailable devices more gracefully.
- Enabled Wi‑Fi by default on in dts files, but radio on/off is still done by code. The main reason was reliable event subscription and consistent devicetree states.
- Improved Wi‑Fi shutdown cleanup and radio-state handling.

Other:
- Renamed the Kernel Display app to Display.
2026-08-25 17:44:20 +02:00

61 lines
2.3 KiB
C

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <app/manifest.h>
#include <tactility/error.h>
#include <stdint.h>
#include "location.h"
#ifdef __cplusplus
extern "C" {
#endif
/** service-module id the AppLoaderApi implementation for AppManifest::location.type ==
* APP_LOCATION_MEMORY must register under. Implemented by app-module itself (source/app_internal_loader.cpp). */
#define APP_LOADER_MEMORY_SERVICE_ID "app-loader-memory"
/** service-module id the AppLoaderApi implementation for AppManifest::location.type ==
* APP_LOCATION_PATH must register under. Implemented by a platform module (e.g. app-esp32-module). */
#define APP_LOADER_PATH_SERVICE_ID "app-loader-path"
/**
* Entry point signature for an APP_LOCATION_MEMORY app: a function linked directly into this
* firmware binary. Called on the dedicated task app-module's scheduler spawns for this instance,
* blocking for the app's whole lifetime - same contract as an external app's main(). Use
* app_scheduler_current_app_id() to identify this running instance (e.g. with
* app_event_subscribe()/window_manager_create()/etc.). The instance closes when this function
* returns - no separate call is needed.
* AppManifest::location.location holds this cast to void*.
*/
typedef int32_t (*AppMainFn)(int argc, char* argv[]);
typedef void* AppRuntime;
/**
* Pluggable mechanism for loading and executing an app.
*/
struct AppLoaderApi {
/**
* Prepares an app instance for execution (e.g. read + relocate its binary).
* @param[in] location the location to load the elf from
* @param[out] out_runtime opaque handle to whatever load() allocated; passed back to run()/unload()
*/
error_t (*load)(struct AppLocation location, AppRuntime* out_runtime);
/**
* Blocking: runs the app to completion.
* @param[in] runtime handle produced by load()
* @param[in] app_instance_id the running instance's id
* @param[in] argc the amount of arguments in @a argv
* @param[in] argv the array of string pointers (can be NULL)
*/
int32_t (*run)(AppRuntime runtime, uint32_t app_instance_id, int argc, char* argv[]);
/** Releases whatever load() allocated. Called after run() returns. */
void (*unload)(AppRuntime runtime);
};
#ifdef __cplusplus
}
#endif