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
+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 {