Project restructuring (fixes macOS builds) (#198)

- Create `Include/` folder for all main projects
- Fix some issues here and there (found while moving things)
- All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
This commit is contained in:
Ken Van Hoeylandt
2025-02-01 18:13:20 +01:00
committed by GitHub
parent 7856827ecf
commit c87200a80d
350 changed files with 967 additions and 870 deletions
+8 -6
View File
@@ -1,10 +1,12 @@
#include "Tactility.h"
#include "Tactility/Tactility.h"
#include "app/ManifestRegistry.h"
#include "service/ServiceRegistry.h"
#include "service/loader/Loader.h"
#include "TactilityHeadless.h"
#include "lvgl/Init_i.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/lvgl/Init_i.h"
#include "Tactility/service/ServiceManifest.h"
#include <Tactility/TactilityHeadless.h>
#include <Tactility/service/ServiceRegistry.h>
#include <Tactility/service/loader/Loader.h>
namespace tt {
-40
View File
@@ -1,40 +0,0 @@
#pragma once
#include "app/AppManifest.h"
#include "hal/Configuration.h"
#include "service/ServiceManifest.h"
#include "TactilityConfig.h"
namespace tt {
namespace app::launcher { extern const app::AppManifest manifest; }
/** @brief The configuration for the operating system
* It contains the hardware configuration, apps and services
*/
struct Configuration {
/** HAL configuration (drivers) */
const hal::Configuration* hardware = nullptr;
/** List of user applications */
const std::vector<const app::AppManifest*> apps = {};
/** List of user services */
const std::vector<const service::ServiceManifest*> services = {};
/** Optional app to start automatically after the splash screen. */
const std::string launcherAppId = app::launcher::manifest.id;
/** Optional app to start automatically after the splash screen. */
const std::string autoStartAppId = {};
};
/**
* Attempts to initialize Tactility and all configured hardware.
* @param[in] config
*/
void run(const Configuration& config);
/**
* While technically nullable, this instance is always set if tt_init() succeeds.
* @return the Configuration instance that was passed on to tt_init() if init is successful
*/
const Configuration* _Nullable getConfiguration();
} // namespace
-14
View File
@@ -1,14 +0,0 @@
#pragma once
#ifdef ESP_PLATFORM
#include "sdkconfig.h"
#endif
#define TT_CONFIG_FORCE_ONSCREEN_KEYBOARD false // for development/debug purposes
#define TT_SCREENSHOT_MODE false // for taking screenshots (e.g. forces SD card presence and Files tree on simulator)
#ifdef ESP_PLATFORM
#define TT_FEATURE_SCREENSHOT_ENABLED (CONFIG_LV_USE_SNAPSHOT == 1 && CONFIG_SPIRAM_USE_MALLOC == 1)
#else // Sim
#define TT_FEATURE_SCREENSHOT_ENABLED true
#endif
+3 -2
View File
@@ -1,5 +1,6 @@
#include "App.h"
#include "service/loader/Loader.h"
#include "Tactility/app/App.h"
#include <Tactility/service/loader/Loader.h>
namespace tt::app {
-95
View File
@@ -1,95 +0,0 @@
#pragma once
#include "AppContext.h"
#include "Bundle.h"
#include <Mutex.h>
#include <string>
// Forward declarations
typedef struct _lv_obj_t lv_obj_t;
namespace tt::app {
// Forward declarations
class AppContext;
enum class Result;
class App {
private:
Mutex mutex;
struct ResultHolder {
Result result;
std::unique_ptr<Bundle> resultData;
explicit ResultHolder(Result result) : result(result), resultData(nullptr) {}
ResultHolder(Result result, std::unique_ptr<Bundle> resultData) :
result(result),
resultData(std::move(resultData)) {}
};
std::unique_ptr<ResultHolder> resultHolder;
public:
App() = default;
virtual ~App() = default;
virtual void onCreate(AppContext& appContext) {}
virtual void onDestroy(AppContext& appContext) {}
virtual void onShow(AppContext& appContext, lv_obj_t* parent) {}
virtual void onHide(AppContext& appContext) {}
virtual void onResult(AppContext& appContext, Result result, std::unique_ptr<Bundle> _Nullable resultData) {}
Mutex& getMutex() { return mutex; }
bool hasResult() const { return resultHolder != nullptr; }
void setResult(Result result, std::unique_ptr<Bundle> resultData = nullptr) {
auto lockable = getMutex().scoped();
lockable->lock(portMAX_DELAY);
resultHolder = std::make_unique<ResultHolder>(result, std::move(resultData));
}
/**
* Used by system to extract the result data when this application is finished.
* Note that this removes the data from the class!
*/
bool moveResult(Result& outResult, std::unique_ptr<Bundle>& outBundle) {
auto lockable = getMutex().scoped();
lockable->lock(portMAX_DELAY);
if (resultHolder != nullptr) {
outResult = resultHolder->result;
outBundle = std::move(resultHolder->resultData);
resultHolder = nullptr;
return true;
} else {
return false;
}
}
};
template<typename T>
std::shared_ptr<App> create() { return std::shared_ptr<T>(new T); }
/**
* @brief Start an app
* @param[in] id application name or id
* @param[in] parameters optional parameters to pass onto the application
*/
void start(const std::string& id, 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 stop();
/** @return the currently running app context (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext();
/** @return the currently running app (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::App> _Nullable getCurrentApp();
}
-101
View File
@@ -1,101 +0,0 @@
#pragma once
#include "Bundle.h"
#include <memory>
namespace tt::app {
// Forward declarations
class App;
class Paths;
struct AppManifest;
enum class Result;
typedef union {
struct {
bool showStatusbar : 1;
};
unsigned char flags;
} Flags;
/**
* The public representation of an application instance.
* @warning Do not store references or pointers to these! You can retrieve them via the service registry.
*/
class AppContext {
protected:
virtual ~AppContext() = default;
public:
virtual const AppManifest& getManifest() const = 0;
virtual std::shared_ptr<const Bundle> getParameters() const = 0;
virtual std::unique_ptr<Paths> getPaths() const = 0;
virtual std::shared_ptr<App> getApp() const = 0;
};
class Paths {
public:
Paths() = default;
virtual ~Paths() = default;
/**
* Returns the directory path for the data location for an app.
* The data directory is intended to survive OS upgrades.
* The path will not end with a "/".
*/
virtual std::string getDataDirectory() const = 0;
/**
* @see getDataDirectory(), but with LVGL prefix.
*/
virtual std::string getDataDirectoryLvgl() const = 0;
/**
* Returns the full path for an entry inside the data location for an app.
* The data directory is intended to survive OS upgrades.
* Configuration data should be stored here.
* @param[in] childPath the path without a "/" prefix
*/
virtual std::string getDataPath(const std::string& childPath) const = 0;
/**
* @see getDataPath(), but with LVGL prefix.
*/
virtual std::string getDataPathLvgl(const std::string& childPath) const = 0;
/**
* Returns the directory path for the system location for an app.
* The system directory is not intended to survive OS upgrades.
* You should not store configuration data here.
* The path will not end with a "/".
* This is mainly used for core apps (system/boot/settings type).
*/
virtual std::string getSystemDirectory() const = 0;
/**
* @see getSystemDirectory(), but with LVGL prefix.
*/
virtual std::string getSystemDirectoryLvgl() const = 0;
/**
* Returns the full path for an entry inside the system location for an app.
* The data directory is not intended to survive OS upgrades.
* You should not store configuration data here.
* This is mainly used for core apps (system/boot/settings type).
* @param[in] childPath the path without a "/" prefix
*/
virtual std::string getSystemPath(const std::string& childPath) const = 0;
/**
* @see getSystemPath(), but with LVGL prefix.
*/
virtual std::string getSystemPathLvgl(const std::string& childPath) const = 0;
};
}
+2 -2
View File
@@ -1,5 +1,5 @@
#include "app/AppInstance.h"
#include "app/AppInstancePaths.h"
#include "Tactility/app/AppInstance.h"
#include "Tactility/app/AppInstancePaths.h"
namespace tt::app {
+3 -2
View File
@@ -1,5 +1,6 @@
#include "app/AppInstancePaths.h"
#include "Partitions.h"
#include "Tactility/app/AppInstancePaths.h"
#include <Tactility/Partitions.h>
#define LVGL_PATH_PREFIX std::string("A:/")
#ifdef ESP_PLATFORM
-86
View File
@@ -1,86 +0,0 @@
#pragma once
#include "CoreDefines.h"
#include "ManifestRegistry.h"
#include <Bundle.h>
#include <string>
// Forward declarations
typedef struct _lv_obj_t lv_obj_t;
namespace tt::app {
class App;
class AppContext;
/** Application types */
enum class Type {
/** Boot screen, shown before desktop is launched. */
Boot,
/** A launcher app sits at the root of the app stack after the boot splash is finished */
Launcher,
/** Apps that generally aren't started from the desktop (e.g. image viewer) */
Hidden,
/** Standard apps, provided by the system. */
System,
/** The apps that are launched/shown by the Settings app. The Settings app itself is of type AppTypeSystem. */
Settings,
/** User-provided apps. */
User
};
/** Result status code for application result callback. */
enum class Result {
Ok = 0U,
Cancelled = 1U,
Error = 2U
};
class Location {
private:
std::string path;
Location() = default;
explicit Location(const std::string& path) : path(path) {}
public:
static Location internal() { return {}; }
static Location external(const std::string& path) {
return Location(path);
}
bool isInternal() const { return path.empty(); }
bool isExternal() const { return !path.empty(); }
const std::string& getPath() const { return path; }
};
typedef std::shared_ptr<App>(*CreateApp)();
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 = Type::User;
/** Where the app is located */
Location location = Location::internal();
/** Create the instance of the app */
CreateApp createApp = nullptr;
};
struct {
bool operator()(const std::shared_ptr<AppManifest>& left, const std::shared_ptr<AppManifest>& right) const { return left->name < right->name; }
} SortAppManifestByName;
} // namespace
+7 -6
View File
@@ -1,12 +1,13 @@
#ifdef ESP_PLATFORM
#include "ElfApp.h"
#include "Log.h"
#include "StringUtils.h"
#include "TactilityCore.h"
#include "Tactility/app/ElfApp.h"
#include "Tactility/file/File.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Log.h>
#include <Tactility/StringUtils.h>
#include "esp_elf.h"
#include "file/File.h"
#include "service/loader/Loader.h"
#include <string>
#include <utility>
-42
View File
@@ -1,42 +0,0 @@
#pragma once
#include "AppManifest.h"
#ifdef ESP_PLATFORM
namespace tt::app {
typedef void* (*CreateData)();
typedef void (*DestroyData)(void* data);
typedef void (*OnCreate)(void* appContext, void* _Nullable data);
typedef void (*OnDestroy)(void* appContext, void* _Nullable data);
typedef void (*OnShow)(void* appContext, void* _Nullable data, lv_obj_t* parent);
typedef void (*OnHide)(void* appContext, void* _Nullable data);
typedef void (*OnResult)(void* appContext, void* _Nullable data, Result result, Bundle* resultData);
void setElfAppManifest(
const char* name,
const char* _Nullable icon,
CreateData _Nullable createData,
DestroyData _Nullable destroyData,
OnCreate _Nullable onCreate,
OnDestroy _Nullable onDestroy,
OnShow _Nullable onShow,
OnHide _Nullable onHide,
OnResult _Nullable onResult
);
/**
* @return the app ID based on the executable's file path.
*/
std::string getElfAppId(const std::string& filePath);
/**
* @return true when registration was done, false when app was already registered
*/
bool registerElfApp(const std::string& filePath);
std::shared_ptr<App> createElfApp(const std::shared_ptr<AppManifest>& manifest);
}
#endif // ESP_PLATFORM
+5 -3
View File
@@ -1,6 +1,8 @@
#include "ManifestRegistry.h"
#include "Mutex.h"
#include "AppManifest.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/app/AppManifest.h"
#include <Tactility/Mutex.h>
#include <unordered_map>
#define TAG "app"
-23
View File
@@ -1,23 +0,0 @@
#pragma once
#include "App.h"
#include <string>
#include <vector>
namespace tt::app {
struct AppManifest;
/** Register an application with its manifest */
void addApp(const AppManifest& manifest);
/** Find an application manifest by its id
* @param[in] id the manifest id
* @return the application manifest if it was found
*/
_Nullable std::shared_ptr<AppManifest> findAppById(const std::string& id);
/** @return a list of all registered apps. This includes user and system apps. */
std::vector<std::shared_ptr<AppManifest>> getApps();
} // namespace
@@ -1,9 +1,12 @@
#include "AlertDialog.h"
#include "lvgl.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include <StringUtils.h>
#include <TactilityCore.h>
#include "Tactility/app/alertdialog/AlertDialog.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/StringUtils.h>
#include <Tactility/TactilityCore.h>
#include <lvgl.h>
namespace tt::app::alertdialog {
@@ -1,29 +0,0 @@
#pragma once
#include <string>
#include <vector>
#include "Bundle.h"
/**
* Start the app by its ID and provide:
* - a title
* - a text
* - 0, 1 or more buttons
*/
namespace tt::app::alertdialog {
/**
* Show a dialog with the provided title, message and 0, 1 or more buttons.
* @param[in] title the title to show in the toolbar
* @param[in] message the message to display
* @param[in] buttonLabels the buttons to show
*/
void start(const std::string& title, const std::string& message, const std::vector<std::string>& buttonLabels);
/**
* Get the index of the button that the user selected.
*
* @return a value greater than 0 when a selection was done, or -1 when the app was closed clicking one of the selection buttons.
*/
int32_t getResultIndex(const Bundle& bundle);
}
+8 -6
View File
@@ -1,10 +1,12 @@
#include "app/ManifestRegistry.h"
#include "Assets.h"
#include "Check.h"
#include "lvgl.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/Assets.h>
#include <Tactility/Check.h>
#include <lvgl.h>
#include <algorithm>
#include "service/loader/Loader.h"
#include "lvgl/Toolbar.h"
namespace tt::app::applist {
+15 -14
View File
@@ -1,21 +1,22 @@
#include "TactilityCore.h"
#include "Tactility/TactilityCore.h"
#include "app/AppContext.h"
#include "app/display/DisplaySettings.h"
#include "app/launcher/Launcher.h"
#include "hal/Display.h"
#include "service/loader/Loader.h"
#include "lvgl/Style.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/app/display/DisplaySettings.h"
#include "Tactility/app/launcher/Launcher.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Style.h"
#include "lvgl.h"
#include "Tactility.h"
#include "hal/usb/Usb.h"
#include "kernel/SystemEvents.h"
#include <Tactility/Tactility.h>
#include <Tactility/hal/Display.h>
#include <Tactility/hal/usb/Usb.h>
#include <Tactility/kernel/SystemEvents.h>
#include <lvgl.h>
#ifdef ESP_PLATFORM
#include "kernel/PanicHandler.h"
#include "sdkconfig.h"
#include "app/crashdiagnostics/CrashDiagnostics.h"
#include "Tactility/app/crashdiagnostics/CrashDiagnostics.h"
#include <Tactility/kernel/PanicHandler.h>
#include <sdkconfig.h>
#else
#define CONFIG_TT_SPLASH_DURATION 0
#endif
@@ -1,12 +1,13 @@
#ifdef ESP_PLATFORM
#include "app/crashdiagnostics/QrHelpers.h"
#include "app/crashdiagnostics/QrUrl.h"
#include "app/launcher/Launcher.h"
#include "lvgl.h"
#include "lvgl/Statusbar.h"
#include "qrcode.h"
#include "service/loader/Loader.h"
#include "Tactility/app/crashdiagnostics/QrHelpers.h"
#include "Tactility/app/crashdiagnostics/QrUrl.h"
#include "Tactility/app/launcher/Launcher.h"
#include "Tactility/lvgl/Statusbar.h"
#include "Tactility/service/loader/Loader.h"
#include <lvgl.h>
#include <qrcode.h>
#define TAG "crash_diagnostics"
@@ -1,11 +0,0 @@
#pragma once
#ifdef ESP_PLATFORM
namespace tt::app::crashdiagnostics {
void start();
}
#endif
@@ -1,4 +1,5 @@
#include "app/crashdiagnostics/QrHelpers.h"
#include "Tactility/app/crashdiagnostics/QrHelpers.h"
#include <cstdint>
/**
@@ -1,9 +1,8 @@
#ifdef ESP_PLATFORM
#include "app/crashdiagnostics/QrUrl.h"
#include "Tactility/app/crashdiagnostics/QrUrl.h"
#include "kernel/PanicHandler.h"
#include "Log.h"
#include <Tactility/kernel/PanicHandler.h>
#include <sstream>
#include <esp_cpu_utils.h>
+9 -9
View File
@@ -1,10 +1,12 @@
#include "app/AppContext.h"
#include "Assets.h"
#include "DisplaySettings.h"
#include "Tactility.h"
#include "lvgl/Toolbar.h"
#include "lvgl.h"
#include "hal/Display.h"
#include "Tactility/app/display/DisplaySettings.h"
#include "Tactility/hal/Display.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/Assets.h>
#include <Tactility/Tactility.h>
#include <lvgl.h>
namespace tt::app::display {
@@ -13,7 +15,6 @@ namespace tt::app::display {
static bool backlight_duty_set = false;
static uint8_t backlight_duty = 255;
static bool gamma_set = false;
static uint8_t gamma = 255;
#define ROTATION_DEFAULT 0
@@ -49,7 +50,6 @@ static void onGammaSliderEvent(lv_event_t* event) {
int32_t slider_value = lv_slider_get_value(slider);
gamma = (uint8_t)slider_value;
gamma_set = true;
hal_display->setGammaCurve(gamma);
}
@@ -1,5 +1,6 @@
#include "DisplaySettings.h"
#include "Preferences.h"
#include "Tactility/app/display/DisplaySettings.h"
#include <Tactility/Preferences.h>
namespace tt::app::display {
@@ -1,12 +0,0 @@
#pragma once
#include <src/display/lv_display.h>
namespace tt::app::display {
void setBacklightDuty(uint8_t value);
uint8_t getBacklightDuty();
void setRotation(lv_display_rotation_t rotation);
lv_display_rotation_t getRotation();
} // namespace
+4 -3
View File
@@ -1,8 +1,9 @@
#include "app/files/FileUtils.h"
#include "Tactility/app/files/FileUtils.h"
#include <Tactility/StringUtils.h>
#include <Tactility/TactilityCore.h>
#include "TactilityCore.h"
#include <cstring>
#include <StringUtils.h>
namespace tt::app::files {
+5 -5
View File
@@ -1,9 +1,9 @@
#include "app/files/View.h"
#include "app/files/State.h"
#include "Tactility/app/files/View.h"
#include "Tactility/app/files/State.h"
#include "Tactility/app/AppContext.h"
#include "app/AppContext.h"
#include "Assets.h"
#include "service/loader/Loader.h"
#include <Tactility/Assets.h>
#include <Tactility/service/loader/Loader.h>
#include <memory>
-15
View File
@@ -1,15 +0,0 @@
#pragma once
#include "View.h"
#include "State.h"
#include "app/AppManifest.h"
#include <lvgl.h>
#include <dirent.h>
#include <memory>
namespace tt::app::files {
void start();
} // namespace
+7 -7
View File
@@ -1,11 +1,11 @@
#include "app/files/State.h"
#include "app/files/FileUtils.h"
#include "Tactility/app/files/State.h"
#include "Tactility/app/files/FileUtils.h"
#include "Log.h"
#include "Partitions.h"
#include "TactilityHeadless.h"
#include "hal/SdCard.h"
#include "kernel/Kernel.h"
#include <Tactility/Log.h>
#include <Tactility/Partitions.h>
#include <Tactility/TactilityHeadless.h>
#include <Tactility/hal/SdCard.h>
#include <Tactility/kernel/Kernel.h>
#include <unistd.h>
+14 -12
View File
@@ -1,20 +1,22 @@
#include "app/files/FileUtils.h"
#include "app/files/View.h"
#include "Tactility/app/files/FileUtils.h"
#include "Tactility/app/files/View.h"
#include "Tactility/app/alertdialog/AlertDialog.h"
#include "Tactility/app/imageviewer/ImageViewer.h"
#include "Tactility/app/inputdialog/InputDialog.h"
#include "Tactility/app/textviewer/TextViewer.h"
#include "Tactility/app/ElfApp.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/Tactility.h>
#include <Tactility/StringUtils.h>
#include "app/alertdialog/AlertDialog.h"
#include "app/imageviewer/ImageViewer.h"
#include "app/inputdialog/InputDialog.h"
#include "app/textviewer/TextViewer.h"
#include "app/ElfApp.h"
#include "lvgl/Toolbar.h"
#include "lvgl/LvglSync.h"
#include "Tactility.h"
#include "StringUtils.h"
#include <cstring>
#include <unistd.h>
#ifdef ESP_PLATFORM
#include "service/loader/Loader.h"
#include "Tactility/service/loader/Loader.h"
#endif
#define TAG "files_app"
+7 -7
View File
@@ -1,11 +1,11 @@
#include "Mutex.h"
#include "Thread.h"
#include "service/loader/Loader.h"
#include "lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Toolbar.h"
#include "GpioHal.h"
#include "lvgl/LvglSync.h"
#include "Timer.h"
#include <Tactility/app/gpio/GpioHal.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/Mutex.h>
#include <Tactility/Thread.h>
#include <Tactility/Timer.h>
namespace tt::app::gpio {
-13
View File
@@ -1,13 +0,0 @@
#pragma once
#ifdef ESP_PLATFORM
#include "driver/gpio.h"
#define GPIO_NUM_MIN GPIO_NUM_0
#else
#define GPIO_NUM_MIN 0
#define GPIO_NUM_MAX 50
#endif
#ifndef ESP_PLATFORM
int gpio_get_level(int gpio_num);
#endif
@@ -1,6 +1,8 @@
#include "app/i2cscanner/I2cHelpers.h"
#include "Tactility.h"
#include "StringUtils.h"
#include "Tactility/app/i2cscanner/I2cHelpers.h"
#include <Tactility/Tactility.h>
#include <Tactility/StringUtils.h>
#include <iomanip>
#include <vector>
#include <sstream>
+11 -9
View File
@@ -1,13 +1,15 @@
#include "app/i2cscanner/I2cScannerPrivate.h"
#include "app/i2cscanner/I2cScannerThread.h"
#include "app/i2cscanner/I2cHelpers.h"
#include "Tactility/app/i2cscanner/I2cScannerPrivate.h"
#include "Tactility/app/i2cscanner/I2cScannerThread.h"
#include "Tactility/app/i2cscanner/I2cHelpers.h"
#include "Assets.h"
#include "Tactility.h"
#include "app/AppContext.h"
#include "lvgl/LvglSync.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Assets.h>
#include <Tactility/Tactility.h>
#include <Tactility/Timer.h>
#define START_SCAN_TEXT "Scan"
#define STOP_SCAN_TEXT "Stop scan"
@@ -1,15 +0,0 @@
#pragma once
#include <TactilityCore.h>
#include <Mutex.h>
#include <Thread.h>
#include "lvgl.h"
#include "hal/i2c/I2c.h"
#include "Timer.h"
#include <memory>
namespace tt::app::i2cscanner {
void start();
}
@@ -1,9 +1,11 @@
#include "Assets.h"
#include "hal/i2c/I2c.h"
#include "Tactility.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "lvgl.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/Assets.h>
#include <Tactility/hal/i2c/I2c.h>
#include <Tactility/Tactility.h>
#include <lvgl.h>
namespace tt::app::i2csettings {
@@ -1,9 +1,11 @@
#include <TactilityCore.h>
#include "lvgl.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "StringUtils.h"
#include "service/loader/Loader.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/TactilityCore.h>
#include <Tactility/StringUtils.h>
#include <lvgl.h>
namespace tt::app::imageviewer {
@@ -1,7 +0,0 @@
#pragma once
namespace tt::app::imageviewer {
void start(const std::string& file);
};
@@ -1,10 +1,12 @@
#include "InputDialog.h"
#include "lvgl.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "service/gui/Gui.h"
#include <StringUtils.h>
#include <TactilityCore.h>
#include "Tactility/app/inputdialog/InputDialog.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/service/gui/Gui.h"
#include <Tactility/TactilityCore.h>
#include <lvgl.h>
namespace tt::app::inputdialog {
@@ -1,20 +0,0 @@
#pragma once
#include <string>
#include <vector>
#include "Bundle.h"
/**
* Start the app by its ID and provide:
* - a title
* - a text
*/
namespace tt::app::inputdialog {
void start(const std::string& title, const std::string& message, const std::string& prefilled = "");
/**
* @return the text that was in the field when OK was pressed, or otherwise empty string
*/
std::string getResult(const Bundle& bundle);
}
+8 -6
View File
@@ -1,9 +1,11 @@
#include "Check.h"
#include "Tactility.h"
#include "app/AppContext.h"
#include "app/ManifestRegistry.h"
#include "lvgl.h"
#include "service/loader/Loader.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Check.h>
#include <Tactility/Tactility.h>
#include <lvgl.h>
#define TAG "launcher"
-7
View File
@@ -1,7 +0,0 @@
#pragma once
namespace tt::app::launcher {
void start();
}
+7 -6
View File
@@ -1,14 +1,15 @@
#include "lvgl.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "app/selectiondialog/SelectionDialog.h"
#include "service/loader/Loader.h"
#include "lvgl/LvglSync.h"
#include "Tactility/app/selectiondialog/SelectionDialog.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/service/loader/Loader.h"
#include <sstream>
#include <vector>
#include <ranges>
#include <lvgl.h>
#define TAG "text_viewer"
namespace tt::app::log {
+11 -9
View File
@@ -1,12 +1,14 @@
#include "app/AppContext.h"
#include "Assets.h"
#include "lvgl.h"
#include "Tactility.h"
#include "Timer.h"
#include "lvgl/LvglSync.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Assets.h>
#include <Tactility/Tactility.h>
#include <Tactility/Timer.h>
#include <lvgl.h>
namespace tt::app::power {
+13 -11
View File
@@ -1,17 +1,19 @@
#include "TactilityConfig.h"
#include <Timer.h>
#include <kernel/Kernel.h>
#include "Tactility/TactilityConfig.h"
#include <Tactility/Timer.h>
#include <Tactility/kernel/Kernel.h>
#if TT_FEATURE_SCREENSHOT_ENABLED
#include "TactilityHeadless.h"
#include "app/App.h"
#include "app/AppManifest.h"
#include "lvgl/LvglSync.h"
#include "lvgl/Toolbar.h"
#include "service/gui/Gui.h"
#include "service/loader/Loader.h"
#include "service/screenshot/Screenshot.h"
#include "Tactility/app/App.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/gui/Gui.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/service/screenshot/Screenshot.h"
#include <Tactility/TactilityHeadless.h>
#define TAG "screenshot"
@@ -1,9 +1,12 @@
#include "SelectionDialog.h"
#include "lvgl.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include <StringUtils.h>
#include <TactilityCore.h>
#include "Tactility/app/selectiondialog/SelectionDialog.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/StringUtils.h>
#include <Tactility/TactilityCore.h>
#include <lvgl.h>
namespace tt::app::selectiondialog {
@@ -1,25 +0,0 @@
#pragma once
#include <string>
#include <vector>
#include "Bundle.h"
/**
* Start the app by its ID and provide:
* - an optional title
* - 2 or more items
*
* If you provide 0 items, the app will auto-close.
* If you provide 1 item, the app will auto-close with result index 0
*/
namespace tt::app::selectiondialog {
void start(const std::string& title, const std::vector<std::string>& items);
/**
* Get the index of the item that the user selected.
*
* @return a value greater than 0 when a selection was done, or -1 when the app was closed without selecting an item.
*/
int32_t getResultIndex(const Bundle& bundle);
}
+8 -6
View File
@@ -1,9 +1,11 @@
#include "app/ManifestRegistry.h"
#include "Assets.h"
#include "Check.h"
#include "service/loader/Loader.h"
#include "lvgl/Toolbar.h"
#include "lvgl.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Assets.h>
#include <Tactility/Check.h>
#include <lvgl.h>
#include <algorithm>
namespace tt::app::settings {
@@ -1,7 +1,9 @@
#include "Assets.h"
#include "lvgl.h"
#include "Tactility.h"
#include "lvgl/Toolbar.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/Assets.h>
#include <Tactility/Tactility.h>
#include <lvgl.h>
namespace tt::app::systeminfo {
@@ -1,10 +1,11 @@
#include <TactilityCore.h>
#include "TextViewer.h"
#include "lvgl.h"
#include "lvgl/LabelUtils.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "Tactility/lvgl/LabelUtils.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/TactilityCore.h>
#include <lvgl.h>
#define TAG "text_viewer"
#define TEXT_VIEWER_FILE_ARGUMENT "file"
@@ -1,7 +0,0 @@
#pragma once
namespace tt::app::textviewer {
void start(const std::string& file);
}
@@ -1,11 +1,11 @@
#include <StringUtils.h>
#include "lvgl.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "app/timezone/TimeZone.h"
#include "Assets.h"
#include "time/Time.h"
#include "lvgl/LvglSync.h"
#include "Tactility/app/timezone/TimeZone.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/Assets.h>
#include <Tactility/time/Time.h>
#include <lvgl.h>
#define TAG "text_viewer"
@@ -1,7 +0,0 @@
#pragma once
namespace tt::app::timedatesettings {
void start();
}
+13 -12
View File
@@ -1,16 +1,17 @@
#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 "Tactility/app/AppContext.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/app/timezone/TimeZone.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/service/gui/Gui.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/Partitions.h>
#include <Tactility/StringUtils.h>
#include <Tactility/Timer.h>
#include <lvgl.h>
#include <memory>
#include <StringUtils.h>
#include <Timer.h>
namespace tt::app::timezone {
-12
View File
@@ -1,12 +0,0 @@
#pragma once
#include "Bundle.h"
namespace tt::app::timezone {
void start();
std::string getResultName(const Bundle& bundle);
std::string getResultCode(const Bundle& bundle);
}
@@ -1,9 +1,11 @@
#include "CoreDefines.h"
#include "app/App.h"
#include "app/AppManifest.h"
#include "hal/usb/Usb.h"
#include "lvgl.h"
#include "lvgl/Toolbar.h"
#include "Tactility/app/App.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/lvgl/Toolbar.h"
#include <Tactility/CoreDefines.h>
#include <Tactility/hal/usb/Usb.h>
#include <lvgl.h>
#define TAG "usb_settings"
@@ -1,12 +1,15 @@
#include "WifiApSettings.h"
#include "TactilityCore.h"
#include "app/AppContext.h"
#include "app/alertdialog/AlertDialog.h"
#include "lvgl.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "service/wifi/WifiSettings.h"
#include "Tactility/app/wifiapsettings/WifiApSettings.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/app/alertdialog/AlertDialog.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/TactilityCore.h>
#include <Tactility/service/wifi/WifiSettings.h>
#include <lvgl.h>
namespace tt::app::wifiapsettings {
@@ -1,11 +0,0 @@
#pragma once
#include "Bundle.h"
#include "Mutex.h"
#include "service/wifi/Wifi.h"
namespace tt::app::wifiapsettings {
void start(const std::string& ssid);
} // namespace
+2 -1
View File
@@ -1,4 +1,5 @@
#include "app/wificonnect/State.h"
#include "Tactility/app/wificonnect/State.h"
#include <cstring>
namespace tt::app::wificonnect {
+11 -10
View File
@@ -1,14 +1,15 @@
#include "app/wificonnect/View.h"
#include "app/wificonnect/WifiConnectPrivate.h"
#include "WifiConnect.h"
#include "Tactility/app/wificonnect/View.h"
#include "Tactility/app/wificonnect/WifiConnect.h"
#include "lvgl.h"
#include "service/gui/Gui.h"
#include "service/wifi/WifiSettings.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "lvgl/Spinner.h"
#include <TactilityCore.h>
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/Spinner.h"
#include "Tactility/service/gui/Gui.h"
#include <Tactility/TactilityCore.h>
#include <Tactility/service/wifi/WifiSettings.h>
#include <lvgl.h>
#include <cstring>
namespace tt::app::wificonnect {
@@ -1,10 +1,9 @@
#include "app/wificonnect/WifiConnectPrivate.h"
#include "Tactility/app/wificonnect/WifiConnect.h"
#include "app/AppContext.h"
#include "TactilityCore.h"
#include "service/loader/Loader.h"
#include "service/wifi/Wifi.h"
#include "lvgl/LvglSync.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/service/wifi/Wifi.h"
#include "Tactility/lvgl/LvglSync.h"
namespace tt::app::wificonnect {
@@ -1,12 +0,0 @@
#pragma once
#include <string>
namespace tt::app::wificonnect {
/**
* Start the app with optional pre-filled fields.
*/
void start(const std::string& ssid = "", const std::string& password = "");
} // namespace
+1 -1
View File
@@ -1,4 +1,4 @@
#include "app/wifimanage/WifiManagePrivate.h"
#include "Tactility/app/wifimanage/WifiManagePrivate.h"
namespace tt::app::wifimanage {
+8 -7
View File
@@ -1,11 +1,12 @@
#include "app/wifimanage/View.h"
#include "app/wifimanage/WifiManagePrivate.h"
#include "Tactility/app/wifimanage/View.h"
#include "Tactility/app/wifimanage/WifiManagePrivate.h"
#include "Log.h"
#include "service/wifi/Wifi.h"
#include "lvgl/Style.h"
#include "lvgl/Toolbar.h"
#include "lvgl/Spinner.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Toolbar.h"
#include "Tactility/lvgl/Spinner.h"
#include <Tactility/Log.h>
#include <Tactility/service/wifi/Wifi.h>
#include <string>
#include <set>
+8 -10
View File
@@ -1,14 +1,12 @@
#include "app/wifimanage/WifiManagePrivate.h"
#include "app/wifimanage/View.h"
#include "app/wifimanage/State.h"
#include "Tactility/app/wifimanage/WifiManagePrivate.h"
#include "Tactility/app/wifimanage/View.h"
#include "app/AppContext.h"
#include "app/wifiapsettings/WifiApSettings.h"
#include "TactilityCore.h"
#include "service/loader/Loader.h"
#include "service/wifi/WifiSettings.h"
#include "lvgl/LvglSync.h"
#include "app/wificonnect/WifiConnect.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/app/wifiapsettings/WifiApSettings.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/service/wifi/WifiSettings.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/app/wificonnect/WifiConnect.h"
namespace tt::app::wifimanage {
@@ -1,12 +0,0 @@
#pragma once
#include "Mutex.h"
#include "app/wifimanage/View.h"
#include "app/wifimanage/State.h"
#include "service/wifi/Wifi.h"
namespace tt::app::wifimanage {
void start();
} // namespace
+10 -9
View File
@@ -1,12 +1,13 @@
#include "app/display/DisplaySettings.h"
#include "lvgl.h"
#include "hal/Configuration.h"
#include "hal/Display.h"
#include "hal/Touch.h"
#include "hal/Keyboard.h"
#include "lvgl/LvglKeypad.h"
#include "lvgl/LvglDisplay.h"
#include "kernel/SystemEvents.h"
#include "Tactility/app/display/DisplaySettings.h"
#include "Tactility/lvgl/LvglKeypad.h"
#include "Tactility/lvgl/LvglDisplay.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/hal/Keyboard.h>
#include <Tactility/hal/Touch.h>
#include <Tactility/kernel/SystemEvents.h>
#include <lvgl.h>
namespace tt::lvgl {
+2 -2
View File
@@ -1,5 +1,5 @@
#include "LabelUtils.h"
#include "file/File.h"
#include <Tactility/lvgl/LabelUtils.h>
#include <Tactility/file/File.h>
namespace tt::lvgl {
-9
View File
@@ -1,9 +0,0 @@
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
bool label_set_text_file(lv_obj_t* label, const char* filepath);
} // namespace
+3 -2
View File
@@ -1,5 +1,6 @@
#include "lvgl/LvglDisplay.h"
#include "Check.h"
#include "Tactility/lvgl/LvglDisplay.h"
#include <Tactility/Check.h>
namespace tt::lvgl {
-7
View File
@@ -1,7 +0,0 @@
#pragma once
#include "hal/Display.h"
namespace tt::lvgl {
hal::Display* getDisplay();
}
+6 -6
View File
@@ -1,11 +1,11 @@
#include "LvglKeypad.h"
#include "Tactility/lvgl/LvglKeypad.h"
namespace tt::lvgl {
static lv_indev_t* keyboard_device = NULL;
static lv_indev_t* keyboard_device = nullptr;
bool keypad_is_available() {
return keyboard_device != NULL;
return keyboard_device != nullptr;
}
void keypad_set_indev(lv_indev_t* device) {
@@ -13,14 +13,14 @@ void keypad_set_indev(lv_indev_t* device) {
}
void keypad_activate(lv_group_t* group) {
if (keyboard_device != NULL) {
if (keyboard_device != nullptr) {
lv_indev_set_group(keyboard_device, group);
}
}
void keypad_deactivate() {
if (keyboard_device != NULL) {
lv_indev_set_group(keyboard_device, NULL);
if (keyboard_device != nullptr) {
lv_indev_set_group(keyboard_device, nullptr);
}
}
-34
View File
@@ -1,34 +0,0 @@
/**
* This code relates to the hardware keyboard support also known as "keypads" in LVGL.
*/
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
/**
* @return true if LVGL is configured with a keypad
*/
bool keypad_is_available();
/**
* Set the keypad.
* @param device the keypad device
*/
void keypad_set_indev(lv_indev_t* device);
/**
* Activate the keypad for a widget group.
* @param group
*/
void keypad_activate(lv_group_t* group);
/**
* Deactivate the keypad for the current widget group (if any).
* You don't have to call this after calling _activate() because widget
* cleanup automatically removes itself from the group it belongs to.
*/
void keypad_deactivate();
} // namespace
+3 -2
View File
@@ -1,5 +1,6 @@
#include <Mutex.h>
#include "LvglSync.h"
#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/Mutex.h>
namespace tt::lvgl {
-30
View File
@@ -1,30 +0,0 @@
#pragma once
#include "Lockable.h"
#include <memory>
namespace tt::lvgl {
/**
* LVGL locking function
* @param[in] timeoutMillis timeout in milliseconds. waits forever when 0 is passed.
* @warning this works with milliseconds, as opposed to every other FreeRTOS function that works in ticks!
* @warning when passing zero, we wait forever, as this is the default behaviour for esp_lvgl_port, and we want it to remain consistent
*/
typedef bool (*LvglLock)(uint32_t timeoutMillis);
typedef void (*LvglUnlock)();
void syncSet(LvglLock lock, LvglUnlock unlock);
/**
* LVGL locking function
* @param[in] timeout as ticks
* @warning when passing zero, we wait forever, as this is the default behaviour for esp_lvgl_port, and we want it to remain consistent
*/
bool lock(TickType_t timeout);
void unlock();
std::shared_ptr<Lockable> getLvglSyncLockable();
} // namespace
+5 -4
View File
@@ -1,9 +1,10 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include "Assets.h"
#include "CoreDefines.h"
#include "Log.h"
#include "lvgl.h"
#include <Tactility/Assets.h>
#include <Tactility/CoreDefines.h>
#include <Tactility/Log.h>
#include <lvgl.h>
namespace tt::lvgl {
-12
View File
@@ -1,12 +0,0 @@
#include "lvgl.h"
namespace tt::lvgl {
/**
* Create the Tactility spinner widget
* @param parent pointer to an object, it will be the parent of the new spinner.
* @return the created spinner
*/
lv_obj_t* spinner_create(lv_obj_t* parent);
}
+12 -11
View File
@@ -1,17 +1,18 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include <Timer.h>
#include "Statusbar.h"
#include "Tactility/lvgl/Statusbar.h"
#include "Mutex.h"
#include "PubSub.h"
#include "TactilityCore.h"
#include "lvgl/Style.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/LvglSync.h"
#include "LvglSync.h"
#include "lvgl.h"
#include "kernel/SystemEvents.h"
#include "time/Time.h"
#include <Tactility/kernel/SystemEvents.h>
#include <Tactility/Mutex.h>
#include <Tactility/PubSub.h>
#include <Tactility/TactilityCore.h>
#include <Tactility/Timer.h>
#include <Tactility/time/Time.h>
#include <lvgl.h>
namespace tt::lvgl {
@@ -46,7 +47,7 @@ typedef struct {
PubSub::SubscriptionHandle pubsub_subscription;
} Statusbar;
static bool statusbar_lock(uint32_t timeoutTicks = portMAX_DELAY) {
static bool statusbar_lock(TickType_t timeoutTicks = portMAX_DELAY) {
return statusbar_data.mutex.lock(timeoutTicks);
}
-19
View File
@@ -1,19 +0,0 @@
#pragma once
#include "lvgl.h"
#include "app/AppContext.h"
namespace tt::lvgl {
#define STATUSBAR_ICON_LIMIT 8
#define STATUSBAR_ICON_SIZE 20
#define STATUSBAR_HEIGHT (STATUSBAR_ICON_SIZE + 4) // 4 extra pixels for border and outline
lv_obj_t* statusbar_create(lv_obj_t* parent);
int8_t statusbar_icon_add(const std::string& image);
int8_t statusbar_icon_add();
void statusbar_icon_remove(int8_t id);
void statusbar_icon_set_image(int8_t id, const std::string& image);
void statusbar_icon_set_visibility(int8_t id, bool visible);
} // namespace
+1 -1
View File
@@ -1,4 +1,4 @@
#include "Style.h"
#include "Tactility/lvgl/Style.h"
namespace tt::lvgl {
-20
View File
@@ -1,20 +0,0 @@
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
void obj_set_style_bg_blacken(lv_obj_t* obj);
void obj_set_style_bg_invisible(lv_obj_t* obj);
void obj_set_style_no_padding(lv_obj_t* obj);
/**
* This is to create automatic padding depending on the screen size.
* The larger the screen, the more padding it gets.
* TODO: It currently only applies a single basic padding, but will be improved later.
*
* @param obj
*/
void obj_set_style_auto_padding(lv_obj_t* obj);
} // namespace
+4 -4
View File
@@ -1,10 +1,10 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include "Toolbar.h"
#include "Tactility/lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "lvgl/Style.h"
#include "Spinner.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Spinner.h"
namespace tt::lvgl {
-20
View File
@@ -1,20 +0,0 @@
#pragma once
#include "lvgl.h"
#include "app/AppContext.h"
namespace tt::lvgl {
#define TOOLBAR_HEIGHT 40
#define TOOLBAR_TITLE_FONT_HEIGHT 18
#define TOOLBAR_ACTION_LIMIT 4
lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title);
lv_obj_t* toolbar_create(lv_obj_t* parent, const app::AppContext& app);
void toolbar_set_title(lv_obj_t* obj, const std::string& title);
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj);
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj);
} // namespace
+9 -8
View File
@@ -1,10 +1,11 @@
#include "Tactility.h"
#include "service/gui/Gui_i.h"
#include "service/loader/Loader_i.h"
#include "lvgl/LvglSync.h"
#include "RtosCompat.h"
#include "lvgl/Style.h"
#include "lvgl/Statusbar.h"
#include "Tactility/service/gui/Gui_i.h"
#include "Tactility/service/loader/Loader_i.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Statusbar.h"
#include <Tactility/Tactility.h>
#include <Tactility/RtosCompat.h>
namespace tt::service::gui {
@@ -120,7 +121,7 @@ static int32_t guiMain(TT_UNUSED void* p) {
Gui* local_gui = gui;
while (true) {
uint32_t flags = Thread::awaitFlags(GUI_THREAD_FLAG_ALL, EventFlag::WaitAny, portMAX_DELAY);
uint32_t flags = Thread::awaitFlags(GUI_THREAD_FLAG_ALL, EventFlag::WaitAny, (uint32_t)portMAX_DELAY);
// Process and dispatch draw call
if (flags & GUI_THREAD_FLAG_DRAW) {
-51
View File
@@ -1,51 +0,0 @@
#pragma once
#include "app/AppInstance.h"
#include "app/AppContext.h"
namespace tt::service::gui {
typedef struct Gui Gui;
/**
* Set the app viewport in the gui state and request the gui to draw it.
* @param[in] app
*/
void showApp(std::shared_ptr<app::AppContext> app);
/**
* Hide the current app's viewport.
* Does not request a re-draw because after hiding the current app,
* we always show the previous app, and there is always at least 1 app running.
*/
void hideApp();
/**
* Show the on-screen keyboard.
* @param[in] textarea the textarea to focus the input for
*/
void keyboardShow(lv_obj_t* textarea);
/**
* Hide the on-screen keyboard.
* Has no effect when the keyboard is not visible.
*/
void keyboardHide();
/**
* The on-screen keyboard is only shown when both of these conditions are true:
* - there is no hardware keyboard
* - TT_CONFIG_FORCE_ONSCREEN_KEYBOARD is set to true in tactility_config.h
* @return if we should show a on-screen keyboard for text input inside our apps
*/
bool keyboardIsEnabled();
/**
* Glue code for the on-screen keyboard and the hardware keyboard:
* - Attach automatic hide/show parameters for the on-screen keyboard.
* - Registers the textarea to the default lv_group_t for hardware keyboards.
* @param[in] textarea
*/
void keyboardAddTextArea(lv_obj_t* textarea);
} // namespace
+7 -6
View File
@@ -1,9 +1,10 @@
#include "Check.h"
#include "Log.h"
#include "service/gui/Gui_i.h"
#include "lvgl/LvglSync.h"
#include "lvgl/Statusbar.h"
#include "lvgl/Style.h"
#include "Tactility/service/gui/Gui_i.h"
#include "Tactility/lvgl/LvglSync.h"
#include "Tactility/lvgl/Statusbar.h"
#include "Tactility/lvgl/Style.h"
#include <Tactility/Check.h>
#include <Tactility/Log.h>
namespace tt::service::gui {
+6 -5
View File
@@ -1,8 +1,9 @@
#include "Check.h"
#include "TactilityConfig.h"
#include "service/gui/Gui_i.h"
#include "lvgl/LvglKeypad.h"
#include "lvgl/LvglSync.h"
#include "Tactility/Check.h"
#include "Tactility/service/gui/Gui_i.h"
#include "Tactility/lvgl/LvglKeypad.h"
#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/TactilityConfig.h>
namespace tt::service::gui {
+11 -11
View File
@@ -1,17 +1,17 @@
#include "app/AppManifest.h"
#include "app/ManifestRegistry.h"
#include "service/ServiceManifest.h"
#include "service/gui/Gui.h"
#include "service/loader/Loader_i.h"
#include "RtosCompat.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/app/ManifestRegistry.h"
#include "Tactility/service/gui/Gui.h"
#include "Tactility/service/loader/Loader_i.h"
#include <Tactility/service/ServiceManifest.h>
#include <Tactility/RtosCompat.h>
#ifdef ESP_PLATFORM
#include "TactilityHeadless.h"
#include "app/ElfApp.h"
#include "esp_heap_caps.h"
#include "Tactility/app/ElfApp.h"
#include <Tactility/TactilityHeadless.h>
#include <esp_heap_caps.h>
#else
#include "lvgl/LvglSync.h"
#include "Tactility/lvgl/LvglSync.h"
#endif
namespace tt::service::loader {
-47
View File
@@ -1,47 +0,0 @@
#pragma once
#include "Bundle.h"
#include "PubSub.h"
#include "app/AppManifest.h"
#include "service/ServiceManifest.h"
#include <memory>
namespace tt::service::loader {
// region LoaderEvent for PubSub
typedef enum {
LoaderEventTypeApplicationStarted,
LoaderEventTypeApplicationShowing,
LoaderEventTypeApplicationHiding,
LoaderEventTypeApplicationStopped
} LoaderEventType;
struct LoaderEvent {
LoaderEventType type;
};
// endregion LoaderEvent for PubSub
/**
* @brief Start an app
* @param[in] id application name or id
* @param[in] parameters optional parameters to pass onto the application
*/
void startApp(const std::string& id, 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();
/** @return the currently running app context (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext();
/** @return the currently running app (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::App> _Nullable getCurrentApp();
/**
* @brief PubSub for LoaderEvent
*/
std::shared_ptr<PubSub> getPubsub();
} // namespace
@@ -1,12 +1,13 @@
#include "TactilityConfig.h"
#include <Tactility/TactilityConfig.h>
#if TT_FEATURE_SCREENSHOT_ENABLED
#include "Screenshot.h"
#include <memory>
#include "Tactility/service/screenshot/Screenshot.h"
#include "service/ServiceContext.h"
#include "service/ServiceRegistry.h"
#include <Tactility/service/ServiceContext.h>
#include <Tactility/service/ServiceRegistry.h>
#include <memory>
namespace tt::service::screenshot {
@@ -1,55 +0,0 @@
#pragma once
#include "TactilityConfig.h"
#if TT_FEATURE_SCREENSHOT_ENABLED
#include "Mutex.h"
#include "ScreenshotTask.h"
#include "service/Service.h"
#include <cstdint>
namespace tt::service::screenshot {
enum class Mode {
None,
Timed,
Apps
};
class ScreenshotService final : public Service {
private:
Mutex mutex;
std::unique_ptr<ScreenshotTask> task;
Mode mode = Mode::None;
public:
bool isTaskStarted();
/** The state of the service. */
Mode getMode() const;
/** @brief Start taking screenshot whenever an app is started
* @param[in] path the path to store the screenshots at
*/
void startApps(const std::string& path);
/** @brief Start taking screenshots after a certain delay
* @param[in] path the path to store the screenshots at
* @param[in] delayInSeconds the delay before starting (and between successive screenshots)
* @param[in] amount 0 = indefinite, >0 for a specific
*/
void startTimed(const std::string& path, uint8_t delayInSeconds, uint8_t amount);
/** @brief Stop taking screenshots */
void stop();
};
std::shared_ptr<ScreenshotService> _Nullable optScreenshotService();
} // namespace
#endif
@@ -1,14 +1,16 @@
#include "TactilityConfig.h"
#include "Tactility/TactilityConfig.h"
#if TT_FEATURE_SCREENSHOT_ENABLED
#include "ScreenshotTask.h"
#include "lv_screenshot.h"
#include <format>
#include "Tactility/service/screenshot/ScreenshotTask.h"
#include "TactilityCore.h"
#include "service/loader/Loader.h"
#include "lvgl/LvglSync.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/LvglSync.h"
#include <lv_screenshot.h>
#include <Tactility/TactilityCore.h>
#include <format>
namespace tt::service::screenshot {
@@ -1,63 +0,0 @@
#include "TactilityConfig.h"
#if TT_FEATURE_SCREENSHOT_ENABLED
#pragma once
#include <cstdint>
#include <Thread.h>
#include <Mutex.h>
namespace tt::service::screenshot {
#define TASK_WORK_TYPE_DELAY 1
#define TASK_WORK_TYPE_APPS 2
class ScreenshotTask {
struct ScreenshotTaskWork {
int type = TASK_WORK_TYPE_DELAY ;
uint8_t delay_in_seconds = 0;
uint8_t amount = 0;
std::string path;
};
Thread* thread = nullptr;
Mutex mutex = Mutex(Mutex::Type::Recursive);
bool interrupted = false;
bool finished = false;
ScreenshotTaskWork work;
public:
ScreenshotTask() = default;
~ScreenshotTask();
/** @brief Start taking screenshots after a certain delay
* @param[in] path the path to store the screenshots at
* @param[in] delayInSeconds the delay before starting (and between successive screenshots)
* @param[in] amount 0 = indefinite, >0 for a specific
*/
void startTimed(const std::string& path, uint8_t delayInSeconds, uint8_t amount);
/** @brief Start taking screenshot whenever an app is started
* @param[in] path the path to store the screenshots at
*/
void startApps(const std::string& path);
/** @brief Stop taking screenshots */
void stop();
void taskMain();
bool isFinished();
private:
bool isInterrupted();
void setFinished();
void taskStart();
};
}
#endif
@@ -1,15 +1,15 @@
#include "Mutex.h"
#include "Timer.h"
#include "Tactility.h"
#include "Tactility/lvgl/Statusbar.h"
#include "Tactility/lvgl/LvglSync.h"
#include "hal/Power.h"
#include "hal/SdCard.h"
#include "lvgl/Statusbar.h"
#include "service/ServiceContext.h"
#include "service/wifi/Wifi.h"
#include "service/ServiceRegistry.h"
#include "TactilityHeadless.h"
#include "lvgl/LvglSync.h"
#include <Tactility/Mutex.h>
#include <Tactility/Timer.h>
#include <Tactility/hal/Power.h>
#include <Tactility/hal/SdCard.h>
#include <Tactility/service/ServiceContext.h>
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/service/ServiceRegistry.h>
#include <Tactility/Tactility.h>
#include <Tactility/TactilityHeadless.h>
namespace tt::service::statusbar {