Time & date, system events and much more (#152)
## Time & Date - Added time to statusbar widget - Added Time & Date Settings app - Added TimeZone app for selecting TimeZone - Added `tt::time` namespace with timezone code ## Other changes - Added `SystemEvent` to publish/subscribe to system wide (e.g. for init code, but also for time settings changes) - Changed the way the statusbar widget works: now there's only 1 that gets shown/hidden, instead of 1 instance per app instance. - Moved `lowercase()` function to new namespace: `tt::string` - Increased T-Deck flash & PSRAM SPI frequencies to 120 MHz (from 80 MHz) - Temporary work-around (+ TODO item) for LVGL stack size (issue with WiFi app) - Suppress T-Deck keystroke debugging to debug level (privacy issue) - Improved SDL dependency wiring in various `CMakeLists.txt` - `Loader` service had some variables renamed to the newer C++ style (from previous C style)
This commit is contained in:
committed by
GitHub
parent
4f360741a1
commit
bf91e7530d
@@ -54,6 +54,8 @@ namespace app {
|
||||
namespace settings { extern const AppManifest manifest; }
|
||||
namespace systeminfo { extern const AppManifest manifest; }
|
||||
namespace textviewer { extern const AppManifest manifest; }
|
||||
namespace timedatesettings { extern const AppManifest manifest; }
|
||||
namespace timezone { extern const AppManifest manifest; }
|
||||
namespace usbsettings { extern const AppManifest manifest; }
|
||||
namespace wifiapsettings { extern const AppManifest manifest; }
|
||||
namespace wificonnect { extern const AppManifest manifest; }
|
||||
@@ -87,6 +89,8 @@ static const std::vector<const app::AppManifest*> system_apps = {
|
||||
&app::selectiondialog::manifest,
|
||||
&app::systeminfo::manifest,
|
||||
&app::textviewer::manifest,
|
||||
&app::timedatesettings::manifest,
|
||||
&app::timezone::manifest,
|
||||
&app::usbsettings::manifest,
|
||||
&app::wifiapsettings::manifest,
|
||||
&app::wificonnect::manifest,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "lvgl.h"
|
||||
#include "Tactility.h"
|
||||
#include "hal/usb/Usb.h"
|
||||
#include "kernel/SystemEvents.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "kernel/PanicHandler.h"
|
||||
@@ -35,6 +36,8 @@ struct Data {
|
||||
static int32_t bootThreadCallback(TT_UNUSED void* context) {
|
||||
TickType_t start_time = kernel::getTicks();
|
||||
|
||||
kernel::systemEventPublish(kernel::SystemEvent::BootSplash);
|
||||
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
tt_assert(lvgl_display != nullptr);
|
||||
auto* hal_display = (hal::Display*)lv_display_get_user_data(lvgl_display);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "TactilityCore.h"
|
||||
#include <cstring>
|
||||
#include <bits/stdc++.h>
|
||||
#include <StringUtils.h>
|
||||
|
||||
namespace tt::app::files {
|
||||
|
||||
@@ -69,25 +70,13 @@ bool isSupportedExecutableFile(const std::string& filename) {
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::basic_string<T> lowercase(const std::basic_string<T>& input) {
|
||||
std::basic_string<T> output = input;
|
||||
std::transform(
|
||||
output.begin(),
|
||||
output.end(),
|
||||
output.begin(),
|
||||
[](const T character) { return static_cast<T>(std::tolower(character)); }
|
||||
);
|
||||
return std::move(output);
|
||||
}
|
||||
|
||||
bool isSupportedImageFile(const std::string& filename) {
|
||||
// Currently only the PNG library is built into Tactility
|
||||
return lowercase(filename).ends_with(".png");
|
||||
return string::lowercase(filename).ends_with(".png");
|
||||
}
|
||||
|
||||
bool isSupportedTextFile(const std::string& filename) {
|
||||
std::string filename_lower = lowercase(filename);
|
||||
std::string filename_lower = string::lowercase(filename);
|
||||
return filename_lower.ends_with(".txt") ||
|
||||
filename_lower.ends_with(".ini") ||
|
||||
filename_lower.ends_with(".json") ||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
#include <StringUtils.h>
|
||||
#include "lvgl.h"
|
||||
#include "lvgl/Toolbar.h"
|
||||
#include "service/loader/Loader.h"
|
||||
#include "app/timezone/TimeZone.h"
|
||||
#include "Assets.h"
|
||||
#include "Tactility.h"
|
||||
#include "time/Time.h"
|
||||
#include "lvgl/LvglSync.h"
|
||||
|
||||
#define TAG "text_viewer"
|
||||
|
||||
namespace tt::app::timedatesettings {
|
||||
|
||||
extern const AppManifest manifest;
|
||||
|
||||
struct Data {
|
||||
Mutex mutex = Mutex(Mutex::TypeRecursive);
|
||||
lv_obj_t* regionLabelWidget = nullptr;
|
||||
};
|
||||
|
||||
/** 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<Data> _Nullable optData() {
|
||||
app::AppContext* app = service::loader::getCurrentApp();
|
||||
if (app->getManifest().id == manifest.id) {
|
||||
return std::static_pointer_cast<Data>(app->getData());
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void onConfigureTimeZonePressed(TT_UNUSED lv_event_t* event) {
|
||||
timezone::start();
|
||||
}
|
||||
|
||||
static void onTimeFormatChanged(lv_event_t* event) {
|
||||
auto* widget = lv_event_get_target_obj(event);
|
||||
bool show_24 = lv_obj_has_state(widget, LV_STATE_CHECKED);
|
||||
time::setTimeFormat24Hour(show_24);
|
||||
}
|
||||
|
||||
static void onShow(AppContext& app, lv_obj_t* parent) {
|
||||
auto data = std::static_pointer_cast<Data>(app.getData());
|
||||
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
lvgl::toolbar_create(parent, app);
|
||||
|
||||
auto* main_wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_flex_flow(main_wrapper, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_width(main_wrapper, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(main_wrapper, 1);
|
||||
|
||||
auto* region_wrapper = lv_obj_create(main_wrapper);
|
||||
lv_obj_set_width(region_wrapper, LV_PCT(100));
|
||||
lv_obj_set_height(region_wrapper, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_pad_all(region_wrapper, 0, 0);
|
||||
lv_obj_set_style_border_width(region_wrapper, 0, 0);
|
||||
|
||||
auto* region_prefix_label = lv_label_create(region_wrapper);
|
||||
lv_label_set_text(region_prefix_label, "Region: ");
|
||||
lv_obj_align(region_prefix_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
auto* region_label = lv_label_create(region_wrapper);
|
||||
std::string timeZoneName = time::getTimeZoneName();
|
||||
if (timeZoneName.empty()) {
|
||||
timeZoneName = "not set";
|
||||
}
|
||||
data->regionLabelWidget = region_label;
|
||||
lv_label_set_text(region_label, timeZoneName.c_str());
|
||||
// TODO: Find out why Y offset is needed
|
||||
lv_obj_align_to(region_label, region_prefix_label, LV_ALIGN_OUT_RIGHT_MID, 0, 8);
|
||||
|
||||
auto* region_button = lv_button_create(region_wrapper);
|
||||
lv_obj_align(region_button, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||
auto* region_button_image = lv_image_create(region_button);
|
||||
lv_obj_add_event_cb(region_button, onConfigureTimeZonePressed, LV_EVENT_SHORT_CLICKED, nullptr);
|
||||
lv_image_set_src(region_button_image, LV_SYMBOL_SETTINGS);
|
||||
|
||||
auto* time_format_wrapper= lv_obj_create(main_wrapper);
|
||||
lv_obj_set_width(time_format_wrapper, LV_PCT(100));
|
||||
lv_obj_set_height(time_format_wrapper, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_pad_all(time_format_wrapper, 0, 0);
|
||||
lv_obj_set_style_border_width(time_format_wrapper, 0, 0);
|
||||
|
||||
auto* time_24h_label = lv_label_create(time_format_wrapper);
|
||||
lv_label_set_text(time_24h_label, "24-hour clock");
|
||||
lv_obj_align(time_24h_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
auto* time_24h_switch = lv_switch_create(time_format_wrapper);
|
||||
lv_obj_align(time_24h_switch, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_obj_add_event_cb(time_24h_switch, onTimeFormatChanged, LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
if (time::isTimeFormat24Hour()) {
|
||||
lv_obj_add_state(time_24h_switch, LV_STATE_CHECKED);
|
||||
} else {
|
||||
lv_obj_remove_state(time_24h_switch, LV_STATE_CHECKED);
|
||||
}
|
||||
}
|
||||
|
||||
static void onStart(AppContext& app) {
|
||||
auto data = std::make_shared<Data>();
|
||||
app.setData(data);
|
||||
}
|
||||
|
||||
static void onResult(AppContext& app, Result result, const Bundle& bundle) {
|
||||
if (result == ResultOk) {
|
||||
auto data = std::static_pointer_cast<Data>(app.getData());
|
||||
auto name = timezone::getResultName(bundle);
|
||||
auto code = timezone::getResultCode(bundle);
|
||||
TT_LOG_I(TAG, "Result name=%s code=%s", name.c_str(), code.c_str());
|
||||
time::setTimeZone(name, code);
|
||||
|
||||
if (!name.empty()) {
|
||||
if (lvgl::lock(100 / portTICK_PERIOD_MS)) {
|
||||
lv_label_set_text(data->regionLabelWidget, name.c_str());
|
||||
lvgl::unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern const AppManifest manifest = {
|
||||
.id = "TimeDateSettings",
|
||||
.name = "Time & Date",
|
||||
.icon = TT_ASSETS_APP_ICON_TIME_DATE_SETTINGS,
|
||||
.type = TypeSettings,
|
||||
.onStart = onStart,
|
||||
.onShow = onShow,
|
||||
.onResult = onResult
|
||||
};
|
||||
|
||||
void start() {
|
||||
service::loader::startApp(manifest.id);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace tt::app::timedatesettings {
|
||||
|
||||
void start();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
#include "TimeZone.h"
|
||||
#include "app/AppManifest.h"
|
||||
#include "app/AppContext.h"
|
||||
#include "service/loader/Loader.h"
|
||||
#include "lvgl.h"
|
||||
#include "lvgl/Toolbar.h"
|
||||
#include "Partitions.h"
|
||||
#include "TactilityHeadless.h"
|
||||
#include "lvgl/LvglSync.h"
|
||||
#include "service/gui/Gui.h"
|
||||
#include <memory>
|
||||
#include <StringUtils.h>
|
||||
#include <Timer.h>
|
||||
|
||||
namespace tt::app::timezone {
|
||||
|
||||
#define TAG "timezone_select"
|
||||
|
||||
#define RESULT_BUNDLE_CODE_INDEX "code"
|
||||
#define RESULT_BUNDLE_NAME_INDEX "name"
|
||||
|
||||
extern const AppManifest manifest;
|
||||
|
||||
struct TimeZoneEntry {
|
||||
std::string name;
|
||||
std::string code;
|
||||
};
|
||||
|
||||
struct Data {
|
||||
Mutex mutex;
|
||||
std::vector<TimeZoneEntry> entries;
|
||||
std::unique_ptr<Timer> updateTimer;
|
||||
lv_obj_t* listWidget = nullptr;
|
||||
lv_obj_t* filterTextareaWidget = nullptr;
|
||||
};
|
||||
|
||||
static void updateList(std::shared_ptr<Data>& data);
|
||||
|
||||
static bool parseEntry(const std::string& input, std::string& outName, std::string& outCode) {
|
||||
std::string partial_strip = input.substr(1, input.size() - 3);
|
||||
auto first_end_quote = partial_strip.find('"');
|
||||
if (first_end_quote == std::string::npos) {
|
||||
return false;
|
||||
} else {
|
||||
outName = partial_strip.substr(0, first_end_quote);
|
||||
outCode = partial_strip.substr(first_end_quote + 3);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// region Result
|
||||
|
||||
std::string getResultName(const Bundle& bundle) {
|
||||
std::string result;
|
||||
bundle.optString(RESULT_BUNDLE_NAME_INDEX, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string getResultCode(const Bundle& bundle) {
|
||||
std::string result;
|
||||
bundle.optString(RESULT_BUNDLE_CODE_INDEX, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void setResultName(std::shared_ptr<Bundle>& bundle, const std::string& name) {
|
||||
bundle->putString(RESULT_BUNDLE_NAME_INDEX, name);
|
||||
}
|
||||
|
||||
void setResultCode(std::shared_ptr<Bundle>& bundle, const std::string& code) {
|
||||
bundle->putString(RESULT_BUNDLE_CODE_INDEX, code);
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
static void onUpdateTimer(std::shared_ptr<void> context) {
|
||||
auto data = std::static_pointer_cast<Data>(context);
|
||||
updateList(data);
|
||||
}
|
||||
|
||||
static void onTextareaValueChanged(TT_UNUSED lv_event_t* e) {
|
||||
auto* app = service::loader::getCurrentApp();
|
||||
auto app_data = app->getData();
|
||||
auto data = std::static_pointer_cast<Data>(app_data);
|
||||
|
||||
if (data->mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
if (data->updateTimer->isRunning()) {
|
||||
data->updateTimer->stop();
|
||||
}
|
||||
|
||||
data->updateTimer->start(500 / portTICK_PERIOD_MS);
|
||||
|
||||
data->mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void onListItemSelected(lv_event_t* e) {
|
||||
auto index = reinterpret_cast<std::size_t>(lv_event_get_user_data(e));
|
||||
TT_LOG_I(TAG, "Selected item at index %zu", index);
|
||||
auto* app = service::loader::getCurrentApp();
|
||||
auto data = std::static_pointer_cast<Data>(app->getData());
|
||||
|
||||
auto& entry = data->entries[index];
|
||||
|
||||
auto bundle = std::make_shared<Bundle>();
|
||||
setResultName(bundle, entry.name);
|
||||
setResultCode(bundle, entry.code);
|
||||
app->setResult(app::ResultOk, bundle);
|
||||
|
||||
service::loader::stopApp();
|
||||
}
|
||||
|
||||
static void createListItem(lv_obj_t* list, const std::string& title, size_t index) {
|
||||
lv_obj_t* btn = lv_list_add_button(list, nullptr, title.c_str());
|
||||
lv_obj_add_event_cb(btn, &onListItemSelected, LV_EVENT_SHORT_CLICKED, (void*)index);
|
||||
}
|
||||
|
||||
static void readTimeZones(const std::shared_ptr<Data>& data, std::string filter) {
|
||||
auto path = std::string(MOUNT_POINT_SYSTEM) + "/timezones.csv";
|
||||
auto* file = fopen(path.c_str(), "rb");
|
||||
if (file == nullptr) {
|
||||
TT_LOG_E(TAG, "Failed to open %s", path.c_str());
|
||||
return;
|
||||
}
|
||||
char line[96];
|
||||
std::string name;
|
||||
std::string code;
|
||||
uint32_t count = 0;
|
||||
std::vector<TimeZoneEntry> entries;
|
||||
while (fgets(line, 96, file)) {
|
||||
if (parseEntry(line, name, code)) {
|
||||
if (tt::string::lowercase(name).find(filter) != std::string::npos) {
|
||||
count++;
|
||||
entries.push_back({
|
||||
.name = name,
|
||||
.code = code
|
||||
});
|
||||
|
||||
// Safety guard
|
||||
if (count > 50) {
|
||||
// TODO: Show warning that we're not displaying a complete list
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Parse error at line %lu", count);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
if (data->mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
data->entries = std::move(entries);
|
||||
data->mutex.unlock();
|
||||
} else {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "Processed %lu entries", count);
|
||||
}
|
||||
|
||||
static void updateList(std::shared_ptr<Data>& data) {
|
||||
if (lvgl::lock(100 / portTICK_PERIOD_MS)) {
|
||||
std::string filter = tt::string::lowercase(std::string(lv_textarea_get_text(data->filterTextareaWidget)));
|
||||
readTimeZones(data, filter);
|
||||
lvgl::unlock();
|
||||
} else {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||
return;
|
||||
}
|
||||
|
||||
if (lvgl::lock(100 / portTICK_PERIOD_MS)) {
|
||||
if (data->mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
lv_obj_clean(data->listWidget);
|
||||
|
||||
uint32_t index = 0;
|
||||
for (auto& entry : data->entries) {
|
||||
createListItem(data->listWidget, entry.name, index);
|
||||
index++;
|
||||
}
|
||||
|
||||
data->mutex.unlock();
|
||||
}
|
||||
|
||||
lvgl::unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void onShow(AppContext& app, lv_obj_t* parent) {
|
||||
auto data = std::static_pointer_cast<Data>(app.getData());
|
||||
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lvgl::toolbar_create(parent, app);
|
||||
|
||||
auto* search_wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_size(search_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(search_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(search_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START);
|
||||
lv_obj_set_style_pad_all(search_wrapper, 0, 0);
|
||||
lv_obj_set_style_border_width(search_wrapper, 0, 0);
|
||||
|
||||
auto* icon = lv_image_create(search_wrapper);
|
||||
lv_obj_set_style_margin_left(icon, 8, 0);
|
||||
lv_obj_set_style_image_recolor_opa(icon, 255, 0);
|
||||
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);
|
||||
|
||||
std::string icon_path = app.getPaths()->getSystemPathLvgl("search.png");
|
||||
lv_image_set_src(icon, icon_path.c_str());
|
||||
lv_obj_set_style_image_recolor(icon, lv_theme_get_color_primary(parent), 0);
|
||||
|
||||
auto* textarea = lv_textarea_create(search_wrapper);
|
||||
lv_textarea_set_placeholder_text(textarea, "e.g. Europe/Amsterdam");
|
||||
lv_textarea_set_one_line(textarea, true);
|
||||
lv_obj_add_event_cb(textarea, onTextareaValueChanged, LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
data->filterTextareaWidget = textarea;
|
||||
lv_obj_set_flex_grow(textarea, 1);
|
||||
service::gui::keyboardAddTextArea(textarea);
|
||||
|
||||
auto* list = lv_list_create(parent);
|
||||
lv_obj_set_width(list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(list, 1);
|
||||
lv_obj_set_style_border_width(list, 0, 0);
|
||||
data->listWidget = list;
|
||||
}
|
||||
|
||||
static void onStart(AppContext& app) {
|
||||
auto data = std::make_shared<Data>();
|
||||
data->updateTimer = std::make_unique<Timer>(Timer::TypeOnce, onUpdateTimer, data);
|
||||
app.setData(data);
|
||||
}
|
||||
|
||||
extern const AppManifest manifest = {
|
||||
.id = "TimeZone",
|
||||
.name = "Select timezone",
|
||||
.type = TypeHidden,
|
||||
.onStart = onStart,
|
||||
.onShow = onShow,
|
||||
};
|
||||
|
||||
void start() {
|
||||
service::loader::startApp(manifest.id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Bundle.h"
|
||||
|
||||
namespace tt::app::timezone {
|
||||
|
||||
void start();
|
||||
|
||||
std::string getResultName(const Bundle& bundle);
|
||||
std::string getResultCode(const Bundle& bundle);
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "hal/Keyboard.h"
|
||||
#include "lvgl/LvglKeypad.h"
|
||||
#include "lvgl/Lvgl.h"
|
||||
#include "kernel/SystemEvents.h"
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
@@ -76,6 +77,8 @@ bool initKeyboard(hal::Display* display, hal::Keyboard* keyboard) {
|
||||
void init(const hal::Configuration& config) {
|
||||
TT_LOG_I(TAG, "Starting");
|
||||
|
||||
kernel::systemEventPublish(kernel::SystemEvent::BootInitLvglBegin);
|
||||
|
||||
if (config.initLvgl != nullptr && !config.initLvgl()) {
|
||||
TT_LOG_E(TAG, "LVGL init failed");
|
||||
return;
|
||||
@@ -98,6 +101,8 @@ void init(const hal::Configuration& config) {
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "Finished");
|
||||
|
||||
kernel::systemEventPublish(kernel::SystemEvent::BootInitLvglEnd);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <Timer.h>
|
||||
#include "Statusbar.h"
|
||||
|
||||
#include "Mutex.h"
|
||||
@@ -8,11 +10,15 @@
|
||||
|
||||
#include "LvglSync.h"
|
||||
#include "lvgl.h"
|
||||
#include "kernel/SystemEvents.h"
|
||||
#include "time/Time.h"
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
#define TAG "statusbar"
|
||||
|
||||
static void onUpdateTime(TT_UNUSED std::shared_ptr<void> context);
|
||||
|
||||
struct StatusbarIcon {
|
||||
std::string image;
|
||||
bool visible = false;
|
||||
@@ -23,12 +29,18 @@ struct StatusbarData {
|
||||
Mutex mutex = Mutex(Mutex::TypeRecursive);
|
||||
std::shared_ptr<PubSub> pubsub = std::make_shared<PubSub>();
|
||||
StatusbarIcon icons[STATUSBAR_ICON_LIMIT] = {};
|
||||
Timer* time_update_timer = new Timer(Timer::TypeOnce, onUpdateTime, nullptr);
|
||||
uint8_t time_hours = 0;
|
||||
uint8_t time_minutes = 0;
|
||||
bool time_set = false;
|
||||
kernel::SystemEventSubscription systemEventSubscription = 0;
|
||||
};
|
||||
|
||||
static StatusbarData statusbar_data;
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t* time;
|
||||
lv_obj_t* icons[STATUSBAR_ICON_LIMIT];
|
||||
lv_obj_t* battery_icon;
|
||||
PubSubSubscription* pubsub_subscription;
|
||||
@@ -46,8 +58,40 @@ static void statusbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj);
|
||||
static void statusbar_destructor(const lv_obj_class_t* class_p, lv_obj_t* obj);
|
||||
static void statusbar_event(const lv_obj_class_t* class_p, lv_event_t* event);
|
||||
|
||||
static void update_time(Statusbar* statusbar);
|
||||
static void update_main(Statusbar* statusbar);
|
||||
|
||||
static TickType_t getNextUpdateTime() {
|
||||
time_t now = ::time(nullptr);
|
||||
struct tm* tm_struct = localtime(&now);
|
||||
uint32_t seconds_to_wait = 60U - tm_struct->tm_sec;
|
||||
TT_LOG_I(TAG, "Update in %lu s", seconds_to_wait);
|
||||
return pdMS_TO_TICKS(seconds_to_wait * 1000U);
|
||||
}
|
||||
|
||||
static void onUpdateTime(TT_UNUSED std::shared_ptr<void> context) {
|
||||
time_t now = ::time(nullptr);
|
||||
struct tm* tm_struct = localtime(&now);
|
||||
|
||||
if (statusbar_data.mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
if (tm_struct->tm_year >= (2025 - 1900)) {
|
||||
statusbar_data.time_hours = tm_struct->tm_hour;
|
||||
statusbar_data.time_minutes = tm_struct->tm_min;
|
||||
statusbar_data.time_set = true;
|
||||
|
||||
// Reschedule
|
||||
statusbar_data.time_update_timer->start(getNextUpdateTime());
|
||||
|
||||
// Notify widget
|
||||
tt_pubsub_publish(statusbar_data.pubsub, nullptr);
|
||||
} else {
|
||||
statusbar_data.time_update_timer->start(pdMS_TO_TICKS(60000U));
|
||||
}
|
||||
|
||||
statusbar_data.mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static const lv_obj_class_t statusbar_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = &statusbar_constructor,
|
||||
@@ -73,6 +117,15 @@ static void statusbar_pubsub_event(TT_UNUSED const void* message, void* obj) {
|
||||
}
|
||||
}
|
||||
|
||||
static void onNetworkConnected(TT_UNUSED kernel::SystemEvent event) {
|
||||
if (statusbar_data.mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
statusbar_data.time_update_timer->stop();
|
||||
statusbar_data.time_update_timer->start(5);
|
||||
|
||||
statusbar_data.mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void statusbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
LV_TRACE_OBJ_CREATE("begin");
|
||||
@@ -80,6 +133,14 @@ static void statusbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj)
|
||||
LV_TRACE_OBJ_CREATE("finished");
|
||||
auto* statusbar = (Statusbar*)obj;
|
||||
statusbar->pubsub_subscription = tt_pubsub_subscribe(statusbar_data.pubsub, &statusbar_pubsub_event, statusbar);
|
||||
|
||||
if (!statusbar_data.time_update_timer->isRunning()) {
|
||||
statusbar_data.time_update_timer->start(50 / portTICK_PERIOD_MS);
|
||||
statusbar_data.systemEventSubscription = kernel::systemEventAddListener(
|
||||
kernel::SystemEvent::Time,
|
||||
onNetworkConnected
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void statusbar_destructor(TT_UNUSED const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
@@ -108,15 +169,21 @@ lv_obj_t* statusbar_create(lv_obj_t* parent) {
|
||||
obj_set_style_no_padding(obj);
|
||||
lv_obj_center(obj);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
|
||||
lv_obj_t* left_spacer = lv_obj_create(obj);
|
||||
statusbar->time = lv_label_create(obj);
|
||||
lv_obj_set_style_text_color(statusbar->time, lv_color_white(), 0);
|
||||
lv_obj_set_style_margin_left(statusbar->time, 4, 0);
|
||||
update_time(statusbar);
|
||||
|
||||
auto* left_spacer = lv_obj_create(obj);
|
||||
lv_obj_set_size(left_spacer, 1, 1);
|
||||
obj_set_style_bg_invisible(left_spacer);
|
||||
lv_obj_set_flex_grow(left_spacer, 1);
|
||||
|
||||
statusbar_lock(TtWaitForever);
|
||||
for (int i = 0; i < STATUSBAR_ICON_LIMIT; ++i) {
|
||||
lv_obj_t* image = lv_image_create(obj);
|
||||
auto* image = lv_image_create(obj);
|
||||
lv_obj_set_size(image, STATUSBAR_ICON_SIZE, STATUSBAR_ICON_SIZE);
|
||||
obj_set_style_no_padding(image);
|
||||
obj_set_style_bg_blacken(image);
|
||||
@@ -129,7 +196,19 @@ lv_obj_t* statusbar_create(lv_obj_t* parent) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void update_time(Statusbar* statusbar) {
|
||||
if (statusbar_data.time_set) {
|
||||
bool format24 = time::isTimeFormat24Hour();
|
||||
int hours = format24 ? statusbar_data.time_hours : statusbar_data.time_hours % 12;
|
||||
lv_label_set_text_fmt(statusbar->time, "%d:%02d", hours, statusbar_data.time_minutes);
|
||||
} else {
|
||||
lv_label_set_text(statusbar->time, "");
|
||||
}
|
||||
}
|
||||
|
||||
static void update_main(Statusbar* statusbar) {
|
||||
update_time(statusbar);
|
||||
|
||||
if (statusbar_lock(50 / portTICK_PERIOD_MS)) {
|
||||
for (int i = 0; i < STATUSBAR_ICON_LIMIT; ++i) {
|
||||
update_icon(statusbar->icons[i], &(statusbar_data.icons[i]));
|
||||
@@ -150,8 +229,6 @@ static void statusbar_event(TT_UNUSED const lv_obj_class_t* class_p, lv_event_t*
|
||||
|
||||
if (code == LV_EVENT_VALUE_CHANGED) {
|
||||
lv_obj_invalidate(obj);
|
||||
} else if (code == LV_EVENT_DRAW_MAIN) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "Tactility.h"
|
||||
#include "service/gui/Gui_i.h"
|
||||
#include "service/loader/Loader_i.h"
|
||||
#include "lvgl/LvglKeypad.h"
|
||||
#include "lvgl/LvglSync.h"
|
||||
#include "RtosCompat.h"
|
||||
#include "lvgl/Style.h"
|
||||
#include "lvgl/Statusbar.h"
|
||||
|
||||
namespace tt::service::gui {
|
||||
|
||||
@@ -11,11 +12,11 @@ namespace tt::service::gui {
|
||||
|
||||
// Forward declarations
|
||||
void redraw(Gui*);
|
||||
static int32_t gui_main(void*);
|
||||
static int32_t guiMain(TT_UNUSED void* p);
|
||||
|
||||
Gui* gui = nullptr;
|
||||
|
||||
void loader_callback(const void* message, TT_UNUSED void* context) {
|
||||
void onLoaderMessage(const void* message, TT_UNUSED void* context) {
|
||||
auto* event = static_cast<const loader::LoaderEvent*>(message);
|
||||
if (event->type == loader::LoaderEventTypeApplicationShowing) {
|
||||
app::AppContext& app = event->app_showing.app;
|
||||
@@ -32,13 +33,34 @@ Gui* gui_alloc() {
|
||||
instance->thread = new Thread(
|
||||
"gui",
|
||||
4096, // Last known minimum was 2800 for launching desktop
|
||||
&gui_main,
|
||||
&guiMain,
|
||||
nullptr
|
||||
);
|
||||
instance->loader_pubsub_subscription = tt_pubsub_subscribe(loader::getPubsub(), &loader_callback, instance);
|
||||
instance->loader_pubsub_subscription = tt_pubsub_subscribe(loader::getPubsub(), &onLoaderMessage, instance);
|
||||
tt_check(lvgl::lock(1000 / portTICK_PERIOD_MS));
|
||||
instance->keyboard_group = lv_group_create();
|
||||
instance->lvgl_parent = lv_scr_act();
|
||||
instance->keyboardGroup = lv_group_create();
|
||||
auto* screen_root = lv_scr_act();
|
||||
|
||||
lvgl::obj_set_style_bg_blacken(screen_root);
|
||||
|
||||
lv_obj_t* vertical_container = lv_obj_create(screen_root);
|
||||
lv_obj_set_size(vertical_container, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_flex_flow(vertical_container, LV_FLEX_FLOW_COLUMN);
|
||||
lvgl::obj_set_style_no_padding(vertical_container);
|
||||
lvgl::obj_set_style_bg_blacken(vertical_container);
|
||||
|
||||
instance->statusbarWidget = lvgl::statusbar_create(vertical_container);
|
||||
|
||||
auto* app_container = lv_obj_create(vertical_container);
|
||||
lvgl::obj_set_style_no_padding(app_container);
|
||||
lv_obj_set_style_border_width(app_container, 0, 0);
|
||||
lvgl::obj_set_style_bg_blacken(app_container);
|
||||
lv_obj_set_width(app_container, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(app_container, 1);
|
||||
lv_obj_set_flex_flow(app_container, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
instance->appRootWidget = app_container;
|
||||
|
||||
lvgl::unlock();
|
||||
|
||||
return instance;
|
||||
@@ -48,9 +70,9 @@ void gui_free(Gui* instance) {
|
||||
tt_assert(instance != nullptr);
|
||||
delete instance->thread;
|
||||
|
||||
lv_group_delete(instance->keyboard_group);
|
||||
lv_group_delete(instance->keyboardGroup);
|
||||
tt_check(lvgl::lock(1000 / portTICK_PERIOD_MS));
|
||||
lv_group_del(instance->keyboard_group);
|
||||
lv_group_del(instance->keyboardGroup);
|
||||
lvgl::unlock();
|
||||
|
||||
delete instance;
|
||||
@@ -74,15 +96,15 @@ void requestDraw() {
|
||||
|
||||
void showApp(app::AppContext& app, ViewPortShowCallback on_show, ViewPortHideCallback on_hide) {
|
||||
lock();
|
||||
tt_check(gui->app_view_port == nullptr);
|
||||
gui->app_view_port = view_port_alloc(app, on_show, on_hide);
|
||||
tt_check(gui->appViewPort == nullptr);
|
||||
gui->appViewPort = view_port_alloc(app, on_show, on_hide);
|
||||
unlock();
|
||||
requestDraw();
|
||||
}
|
||||
|
||||
void hideApp() {
|
||||
lock();
|
||||
ViewPort* view_port = gui->app_view_port;
|
||||
ViewPort* view_port = gui->appViewPort;
|
||||
tt_check(view_port != nullptr);
|
||||
|
||||
// We must lock the LVGL port, because the viewport hide callbacks
|
||||
@@ -92,11 +114,11 @@ void hideApp() {
|
||||
lvgl::unlock();
|
||||
|
||||
view_port_free(view_port);
|
||||
gui->app_view_port = nullptr;
|
||||
gui->appViewPort = nullptr;
|
||||
unlock();
|
||||
}
|
||||
|
||||
static int32_t gui_main(TT_UNUSED void* p) {
|
||||
static int32_t guiMain(TT_UNUSED void* p) {
|
||||
tt_check(gui);
|
||||
Gui* local_gui = gui;
|
||||
|
||||
|
||||
@@ -9,27 +9,14 @@ namespace tt::service::gui {
|
||||
|
||||
#define TAG "gui"
|
||||
|
||||
static lv_obj_t* create_app_views(Gui* gui, lv_obj_t* parent, app::AppContext& app) {
|
||||
lvgl::obj_set_style_bg_blacken(parent);
|
||||
|
||||
lv_obj_t* vertical_container = lv_obj_create(parent);
|
||||
lv_obj_set_size(vertical_container, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_flex_flow(vertical_container, LV_FLEX_FLOW_COLUMN);
|
||||
lvgl::obj_set_style_no_padding(vertical_container);
|
||||
lvgl::obj_set_style_bg_blacken(vertical_container);
|
||||
|
||||
// TODO: Move statusbar into separate ViewPort
|
||||
app::Flags flags = app.getFlags();
|
||||
if (flags.showStatusbar) {
|
||||
lvgl::statusbar_create(vertical_container);
|
||||
}
|
||||
|
||||
lv_obj_t* child_container = lv_obj_create(vertical_container);
|
||||
static lv_obj_t* createAppViews(Gui* gui, lv_obj_t* parent, app::AppContext& app) {
|
||||
lv_obj_send_event(gui->statusbarWidget, LV_EVENT_DRAW_MAIN, nullptr);
|
||||
lv_obj_t* child_container = lv_obj_create(parent);
|
||||
lv_obj_set_width(child_container, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(child_container, 1);
|
||||
|
||||
if (keyboardIsEnabled()) {
|
||||
gui->keyboard = lv_keyboard_create(vertical_container);
|
||||
gui->keyboard = lv_keyboard_create(parent);
|
||||
lv_obj_add_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
gui->keyboard = nullptr;
|
||||
@@ -45,12 +32,20 @@ void redraw(Gui* gui) {
|
||||
lock();
|
||||
|
||||
if (lvgl::lock(1000)) {
|
||||
lv_obj_clean(gui->lvgl_parent);
|
||||
lv_obj_clean(gui->appRootWidget);
|
||||
|
||||
ViewPort* view_port = gui->app_view_port;
|
||||
ViewPort* view_port = gui->appViewPort;
|
||||
if (view_port != nullptr) {
|
||||
app::AppContext& app = view_port->app;
|
||||
lv_obj_t* container = create_app_views(gui, gui->lvgl_parent, app);
|
||||
|
||||
app::Flags flags = app.getFlags();
|
||||
if (flags.showStatusbar) {
|
||||
lv_obj_remove_flag(gui->statusbarWidget, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
lv_obj_add_flag(gui->statusbarWidget, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
lv_obj_t* container = createAppViews(gui, gui->appRootWidget, app);
|
||||
view_port_show(view_port, container);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "nothing to draw");
|
||||
|
||||
@@ -54,9 +54,9 @@ void keyboardAddTextArea(lv_obj_t* textarea) {
|
||||
}
|
||||
|
||||
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
|
||||
lv_group_add_obj(gui->keyboard_group, textarea);
|
||||
lv_group_add_obj(gui->keyboardGroup, textarea);
|
||||
|
||||
lvgl::keypad_activate(gui->keyboard_group);
|
||||
lvgl::keypad_activate(gui->keyboardGroup);
|
||||
|
||||
lvgl::unlock();
|
||||
unlock();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#else
|
||||
#include "lvgl/LvglSync.h"
|
||||
#include "TactilityHeadless.h"
|
||||
#endif
|
||||
|
||||
namespace tt::service::loader {
|
||||
@@ -42,7 +41,7 @@ static void loader_free() {
|
||||
loader_singleton = nullptr;
|
||||
}
|
||||
|
||||
void startApp(const std::string& id, bool blocking, std::shared_ptr<const Bundle> parameters) {
|
||||
void startApp(const std::string& id, bool blocking, const std::shared_ptr<const Bundle>& parameters) {
|
||||
TT_LOG_I(TAG, "Start app %s", id.c_str());
|
||||
tt_assert(loader_singleton);
|
||||
|
||||
@@ -67,7 +66,7 @@ void stopApp() {
|
||||
app::AppContext* _Nullable getCurrentApp() {
|
||||
tt_assert(loader_singleton);
|
||||
if (loader_singleton->mutex.lock(10 / portTICK_PERIOD_MS)) {
|
||||
app::AppInstance* app = loader_singleton->app_stack.top();
|
||||
app::AppInstance* app = loader_singleton->appStack.top();
|
||||
loader_singleton->mutex.unlock();
|
||||
return dynamic_cast<app::AppContext*>(app);
|
||||
} else {
|
||||
@@ -80,7 +79,7 @@ std::shared_ptr<PubSub> getPubsub() {
|
||||
// it's safe to return pubsub without locking
|
||||
// because it's never freed and loader is never exited
|
||||
// also the loader instance cannot be obtained until the pubsub is created
|
||||
return loader_singleton->pubsub_external;
|
||||
return loader_singleton->pubsubExternal;
|
||||
}
|
||||
|
||||
static const char* appStateToString(app::State state) {
|
||||
@@ -129,7 +128,7 @@ static void transitionAppToState(app::AppInstance& app, app::State state) {
|
||||
.app = app
|
||||
}
|
||||
};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_external, &event_showing);
|
||||
tt_pubsub_publish(loader_singleton->pubsubExternal, &event_showing);
|
||||
app.setState(app::StateShowing);
|
||||
break;
|
||||
}
|
||||
@@ -140,7 +139,7 @@ static void transitionAppToState(app::AppInstance& app, app::State state) {
|
||||
.app = app
|
||||
}
|
||||
};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_external, &event_hiding);
|
||||
tt_pubsub_publish(loader_singleton->pubsubExternal, &event_hiding);
|
||||
app.setState(app::StateHiding);
|
||||
break;
|
||||
}
|
||||
@@ -167,11 +166,11 @@ static LoaderStatus startAppWithManifestInternal(
|
||||
return LoaderStatusErrorInternal;
|
||||
}
|
||||
|
||||
auto previous_app = !loader_singleton->app_stack.empty() ? loader_singleton->app_stack.top() : nullptr;
|
||||
auto previous_app = !loader_singleton->appStack.empty() ? loader_singleton->appStack.top() : nullptr;
|
||||
auto new_app = new app::AppInstance(*manifest, parameters);
|
||||
new_app->mutableFlags().showStatusbar = (manifest->type != app::TypeBoot);
|
||||
|
||||
loader_singleton->app_stack.push(new_app);
|
||||
loader_singleton->appStack.push(new_app);
|
||||
transitionAppToState(*new_app, app::StateInitial);
|
||||
transitionAppToState(*new_app, app::StateStarted);
|
||||
|
||||
@@ -183,7 +182,7 @@ static LoaderStatus startAppWithManifestInternal(
|
||||
transitionAppToState(*new_app, app::StateShowing);
|
||||
|
||||
LoaderEventInternal event_internal = {.type = LoaderEventTypeApplicationStarted};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_internal, &event_internal);
|
||||
tt_pubsub_publish(loader_singleton->pubsubInternal, &event_internal);
|
||||
|
||||
LoaderEvent event_external = {
|
||||
.type = LoaderEventTypeApplicationStarted,
|
||||
@@ -191,7 +190,7 @@ static LoaderStatus startAppWithManifestInternal(
|
||||
.app = *new_app
|
||||
}
|
||||
};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_external, &event_external);
|
||||
tt_pubsub_publish(loader_singleton->pubsubExternal, &event_external);
|
||||
|
||||
return LoaderStatusOk;
|
||||
}
|
||||
@@ -228,7 +227,7 @@ static void stopAppInternal() {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t original_stack_size = loader_singleton->app_stack.size();
|
||||
size_t original_stack_size = loader_singleton->appStack.size();
|
||||
|
||||
if (original_stack_size == 0) {
|
||||
TT_LOG_E(TAG, "Stop app: no app running");
|
||||
@@ -236,7 +235,7 @@ static void stopAppInternal() {
|
||||
}
|
||||
|
||||
// Stop current app
|
||||
app::AppInstance* app_to_stop = loader_singleton->app_stack.top();
|
||||
app::AppInstance* app_to_stop = loader_singleton->appStack.top();
|
||||
|
||||
if (original_stack_size == 1 && app_to_stop->getManifest().type != app::TypeBoot) {
|
||||
TT_LOG_E(TAG, "Stop app: can't stop root app");
|
||||
@@ -249,7 +248,7 @@ static void stopAppInternal() {
|
||||
transitionAppToState(*app_to_stop, app::StateHiding);
|
||||
transitionAppToState(*app_to_stop, app::StateStopped);
|
||||
|
||||
loader_singleton->app_stack.pop();
|
||||
loader_singleton->appStack.pop();
|
||||
delete app_to_stop;
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
@@ -259,8 +258,8 @@ static void stopAppInternal() {
|
||||
app::AppOnResult on_result = nullptr;
|
||||
app::AppInstance* app_to_resume = nullptr;
|
||||
// If there's a previous app, resume it
|
||||
if (!loader_singleton->app_stack.empty()) {
|
||||
app_to_resume = loader_singleton->app_stack.top();
|
||||
if (!loader_singleton->appStack.empty()) {
|
||||
app_to_resume = loader_singleton->appStack.top();
|
||||
tt_assert(app_to_resume);
|
||||
transitionAppToState(*app_to_resume, app::StateShowing);
|
||||
|
||||
@@ -272,7 +271,7 @@ static void stopAppInternal() {
|
||||
// WARNING: After this point we cannot change the app states from this method directly anymore as we don't have a lock!
|
||||
|
||||
LoaderEventInternal event_internal = {.type = LoaderEventTypeApplicationStopped};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_internal, &event_internal);
|
||||
tt_pubsub_publish(loader_singleton->pubsubInternal, &event_internal);
|
||||
|
||||
LoaderEvent event_external = {
|
||||
.type = LoaderEventTypeApplicationStopped,
|
||||
@@ -280,7 +279,7 @@ static void stopAppInternal() {
|
||||
.manifest = manifest
|
||||
}
|
||||
};
|
||||
tt_pubsub_publish(loader_singleton->pubsub_external, &event_external);
|
||||
tt_pubsub_publish(loader_singleton->pubsubExternal, &event_external);
|
||||
|
||||
if (on_result != nullptr && app_to_resume != nullptr) {
|
||||
if (result_holder != nullptr) {
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef enum {
|
||||
* @param[in] blocking whether this call is blocking or not. You cannot call this from an LVGL thread.
|
||||
* @param[in] parameters optional parameters to pass onto the application
|
||||
*/
|
||||
void startApp(const std::string& id, bool blocking = false, std::shared_ptr<const Bundle> _Nullable parameters = nullptr);
|
||||
void startApp(const std::string& id, bool blocking = false, const std::shared_ptr<const Bundle>& _Nullable parameters = nullptr);
|
||||
|
||||
/** @brief Stop the currently showing app. Show the previous app if any app was still running. */
|
||||
void stopApp();
|
||||
|
||||
Reference in New Issue
Block a user