Refactor LVGL code into kernel module (#472)
* **New Features** * Added a standalone LVGL module and enabled LVGL support in the simulator for richer local UI testing. * **Refactor** * HAL and LVGL split into distinct modules; startup and device attach/detach flows reorganized for clearer lifecycle management. * Public APIs tightened with clearer nullability/documentation. * **Bug Fixes** * More consistent LVGL start/stop and device attach/detach behavior for improved stability.
This commit is contained in:
committed by
GitHub
parent
3fe1dc0312
commit
9f721e6655
@@ -5,7 +5,7 @@ namespace tt::app {
|
||||
|
||||
constexpr auto* TAG = "App";
|
||||
|
||||
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters) {
|
||||
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> parameters) {
|
||||
const auto service = service::loader::findLoaderService();
|
||||
assert(service != nullptr);
|
||||
return service->start(id, std::move(parameters));
|
||||
@@ -35,15 +35,15 @@ bool isRunning(const std::string& id) {
|
||||
return service->isRunning(id);
|
||||
}
|
||||
|
||||
std::shared_ptr<AppContext> _Nullable getCurrentAppContext() {
|
||||
std::shared_ptr<AppContext> getCurrentAppContext() {
|
||||
const auto service = service::loader::findLoaderService();
|
||||
assert(service != nullptr);
|
||||
return service->getCurrentAppContext();
|
||||
}
|
||||
|
||||
std::shared_ptr<App> _Nullable getCurrentApp() {
|
||||
std::shared_ptr<App> getCurrentApp() {
|
||||
const auto app_context = getCurrentAppContext();
|
||||
return (app_context != nullptr) ? app_context->getApp() : nullptr;
|
||||
return (app_context != nullptr) ? app_context->getApp() : nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ bool removeAppManifest(const std::string& id) {
|
||||
return app_manifest_map.erase(id) == 1;
|
||||
}
|
||||
|
||||
_Nullable std::shared_ptr<AppManifest> findAppManifestById(const std::string& id) {
|
||||
std::shared_ptr<AppManifest> findAppManifestById(const std::string& id) {
|
||||
hash_mutex.lock();
|
||||
auto result = app_manifest_map.find(id);
|
||||
hash_mutex.unlock();
|
||||
|
||||
@@ -34,13 +34,13 @@ class ElfApp final : public App {
|
||||
public:
|
||||
|
||||
struct Parameters {
|
||||
CreateData _Nullable createData = nullptr;
|
||||
DestroyData _Nullable destroyData = nullptr;
|
||||
OnCreate _Nullable onCreate = nullptr;
|
||||
OnDestroy _Nullable onDestroy = nullptr;
|
||||
OnShow _Nullable onShow = nullptr;
|
||||
OnHide _Nullable onHide = nullptr;
|
||||
OnResult _Nullable onResult = nullptr;
|
||||
CreateData createData = nullptr;
|
||||
DestroyData destroyData = nullptr;
|
||||
OnCreate onCreate = nullptr;
|
||||
OnDestroy onDestroy = nullptr;
|
||||
OnShow onShow = nullptr;
|
||||
OnHide onHide = nullptr;
|
||||
OnResult onResult = nullptr;
|
||||
};
|
||||
|
||||
static void setParameters(const Parameters& parameters) {
|
||||
@@ -202,13 +202,13 @@ size_t ElfApp::staticParametersSetCount = 0;
|
||||
std::shared_ptr<Lock> ElfApp::staticParametersLock = std::make_shared<Mutex>();
|
||||
|
||||
void setElfAppParameters(
|
||||
CreateData _Nullable createData,
|
||||
DestroyData _Nullable destroyData,
|
||||
OnCreate _Nullable onCreate,
|
||||
OnDestroy _Nullable onDestroy,
|
||||
OnShow _Nullable onShow,
|
||||
OnHide _Nullable onHide,
|
||||
OnResult _Nullable onResult
|
||||
CreateData createData,
|
||||
DestroyData destroyData,
|
||||
OnCreate onCreate,
|
||||
OnDestroy onDestroy,
|
||||
OnShow onShow,
|
||||
OnHide onHide,
|
||||
OnResult onResult
|
||||
) {
|
||||
ElfApp::setParameters({
|
||||
.createData = createData,
|
||||
|
||||
@@ -30,7 +30,7 @@ class AppHubApp final : public App {
|
||||
std::vector<AppHubEntry> entries;
|
||||
Mutex mutex;
|
||||
|
||||
static std::shared_ptr<AppHubApp> _Nullable findAppInstance() {
|
||||
static std::shared_ptr<AppHubApp> findAppInstance() {
|
||||
auto app_context = getCurrentAppContext();
|
||||
if (app_context->getManifest().appId != manifest.appId) {
|
||||
return nullptr;
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
};
|
||||
|
||||
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
|
||||
std::shared_ptr<I2cScannerApp> _Nullable optApp() {
|
||||
std::shared_ptr<I2cScannerApp> optApp() {
|
||||
auto appContext = getCurrentAppContext();
|
||||
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
|
||||
return std::static_pointer_cast<I2cScannerApp>(appContext->getApp());
|
||||
|
||||
@@ -20,7 +20,7 @@ extern const AppManifest manifest;
|
||||
class PowerApp;
|
||||
|
||||
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
|
||||
std::shared_ptr<PowerApp> _Nullable optApp() {
|
||||
std::shared_ptr<PowerApp> optApp() {
|
||||
auto appContext = getCurrentAppContext();
|
||||
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
|
||||
return std::static_pointer_cast<PowerApp>(appContext->getApp());
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
|
||||
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
|
||||
std::shared_ptr<ScreenshotApp> _Nullable optApp() {
|
||||
std::shared_ptr<ScreenshotApp> optApp() {
|
||||
auto appContext = getCurrentAppContext();
|
||||
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
|
||||
return std::static_pointer_cast<ScreenshotApp>(appContext->getApp());
|
||||
|
||||
@@ -274,7 +274,7 @@ extern const AppManifest manifest;
|
||||
|
||||
class SystemInfoApp;
|
||||
|
||||
static std::shared_ptr<SystemInfoApp> _Nullable optApp() {
|
||||
static std::shared_ptr<SystemInfoApp> optApp() {
|
||||
auto appContext = getCurrentAppContext();
|
||||
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
|
||||
return std::static_pointer_cast<SystemInfoApp>(appContext->getApp());
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace tt::app::wifimanage {
|
||||
|
||||
static const auto LOGGER = Logger("WifiManageView");
|
||||
|
||||
std::shared_ptr<WifiManage> _Nullable optWifiManage();
|
||||
std::shared_ptr<WifiManage> optWifiManage();
|
||||
|
||||
static uint8_t mapRssiToPercentage(int rssi) {
|
||||
auto abs_rssi = std::abs(rssi);
|
||||
|
||||
Reference in New Issue
Block a user