Tactiliest/Tactility/Source/app/AppManifest.h
Ken Van Hoeylandt 4f360741a1
Merge develop into main (#150)
- Update `Configuration` to use C++ vector instead of C arrays
- Rename `Desktop` app to `Launcher`
- Fix for hard-coded app start of `Launcher` and `CrashDiagnostics` apps.
- Ensure `Launcher` icons are clickable, even if they're not loading.
- Don't show error scenario for SD card in statusbar when SD card status is unknown (this happens during Mutex timeout due to LVGL rendering delays)
- Cleanup deprecated `Mutex` methods.
- `hal::getConfiguration()` now returns a pointer instead of a reference, just like `tt:getConfiguration()`
2025-01-07 21:57:03 +01:00

77 lines
2.1 KiB
C++

#pragma once
#include <string>
#include <Bundle.h>
#include "CoreDefines.h"
// Forward declarations
typedef struct _lv_obj_t lv_obj_t;
namespace tt::app {
class AppContext;
/** Application types */
enum Type {
/** Boot screen, shown before desktop is launched. */
TypeBoot,
/** A launcher app sits at the root of the app stack after the boot splash is finished */
TypeLauncher,
/** Apps that generally aren't started from the desktop (e.g. image viewer) */
TypeHidden,
/** Standard apps, provided by the system. */
TypeSystem,
/** The apps that are launched/shown by the Settings app. The Settings app itself is of type AppTypeSystem. */
TypeSettings,
/** User-provided apps. */
TypeUser
};
/** Result status code for application result callback. */
typedef enum {
ResultOk,
ResultCancelled,
ResultError
} Result;
typedef void (*AppOnStart)(AppContext& app);
typedef void (*AppOnStop)(AppContext& app);
typedef void (*AppOnShow)(AppContext& app, lv_obj_t* parent);
typedef void (*AppOnHide)(AppContext& app);
typedef void (*AppOnResult)(AppContext& app, Result result, const Bundle& resultData);
struct AppManifest {
/** The identifier by which the app is launched by the system and other apps. */
std::string id;
/** The user-readable name of the app. Used in UI. */
std::string name;
/** Optional icon. */
std::string icon = {};
/** App type affects launch behaviour. */
Type type = TypeUser;
/** Non-blocking method to call when app is started. */
AppOnStart onStart = nullptr;
/** Non-blocking method to call when app is stopped. */
AppOnStop _Nullable onStop = nullptr;
/** Non-blocking method to create the GUI. */
AppOnShow _Nullable onShow = nullptr;
/** Non-blocking method, called before gui is destroyed. */
AppOnHide _Nullable onHide = nullptr;
/** Handle the result for apps that are launched. */
AppOnResult _Nullable onResult = nullptr;
};
struct {
bool operator()(const AppManifest* left, const AppManifest* right) const { return left->name < right->name; }
} SortAppManifestByName;
} // namespace