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
@@ -1,10 +1,12 @@
#pragma once
#include "Bundle.h"
#include "Mutex.h"
#include "app/AppContext.h"
#include "app/AppManifest.h"
#include "app/ElfApp.h"
#include "Tactility/app/AppContext.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/app/ElfApp.h"
#include <Tactility/Bundle.h>
#include <Tactility/Mutex.h>
#include <memory>
#include <utility>
@@ -1,6 +1,6 @@
#pragma once
#include "app/AppInstance.h"
#include "Tactility/app/AppInstance.h"
namespace tt::app {
@@ -0,0 +1,11 @@
#pragma once
#ifdef ESP_PLATFORM
namespace tt::app::crashdiagnostics {
void start();
}
#endif
@@ -1,9 +1,10 @@
#pragma once
#include <Tactility/Mutex.h>
#include <string>
#include <vector>
#include <dirent.h>
#include "Mutex.h"
namespace tt::app::files {
@@ -2,7 +2,8 @@
#include "./State.h"
#include "app/AppManifest.h"
#include "Tactility/app/AppManifest.h"
#include <lvgl.h>
#include <memory>
@@ -0,0 +1,13 @@
#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
@@ -0,0 +1,15 @@
#pragma once
#include <TactilityCore.h>
#include <Mutex.h>
#include <Thread.h>
#include "lvgl.h"
#include <Tactility/hal/i2c/I2c.h>
#include "Timer.h"
#include <memory>
namespace tt::app::i2cscanner {
void start();
}
@@ -1,11 +1,12 @@
#pragma once
#include <TactilityCore.h>
#include <Mutex.h>
#include <Thread.h>
#include "lvgl.h"
#include "hal/i2c/I2c.h"
#include "Timer.h"
#include <Tactility/hal/i2c/I2c.h>
#include <Tactility/Mutex.h>
#include <Tactility/TactilityCore.h>
#include <Tactility/Thread.h>
#include <Tactility/Timer.h>
#include <lvgl.h>
#include <memory>
namespace tt::app::i2cscanner {
@@ -0,0 +1,7 @@
#pragma once
namespace tt::app::launcher {
void start();
}
@@ -0,0 +1,7 @@
#pragma once
namespace tt::app::timedatesettings {
void start();
}
@@ -0,0 +1,12 @@
#pragma once
#include <Tactility/Bundle.h>
namespace tt::app::timezone {
void start();
std::string getResultName(const Bundle& bundle);
std::string getResultCode(const Bundle& bundle);
}
@@ -0,0 +1,11 @@
#pragma once
#include <Tactility/Bundle.h>
#include <Tactility/Mutex.h>
#include <Tactility/service/wifi/Wifi.h>
namespace tt::app::wifiapsettings {
void start(const std::string& ssid);
} // namespace
@@ -1,6 +1,6 @@
#pragma once
#include "service/wifi/WifiSettings.h"
#include "Tactility/service/wifi/WifiSettings.h"
namespace tt::app::wificonnect {
@@ -1,8 +1,8 @@
#pragma once
#include "Mutex.h"
#include "service/wifi/Wifi.h"
#include "service/wifi/WifiSettings.h"
#include <Tactility/Mutex.h>
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/service/wifi/WifiSettings.h>
namespace tt::app::wificonnect {
@@ -1,10 +1,11 @@
#pragma once
#include "Bindings.h"
#include "State.h"
#include "./Bindings.h"
#include "./State.h"
#include "app/AppContext.h"
#include "lvgl.h"
#include "Tactility/app/AppContext.h"
#include <lvgl.h>
namespace tt::app::wificonnect {
@@ -1,12 +1,12 @@
#pragma once
#include "app/App.h"
#include "app/wificonnect/Bindings.h"
#include "app/wificonnect/State.h"
#include "app/wificonnect/View.h"
#include "Tactility/app/App.h"
#include "Tactility/app/wificonnect/Bindings.h"
#include "Tactility/app/wificonnect/State.h"
#include "Tactility/app/wificonnect/View.h"
#include "Mutex.h"
#include "service/wifi/Wifi.h"
#include <Tactility/Mutex.h>
#include <Tactility/service/wifi/Wifi.h>
namespace tt::app::wificonnect {
@@ -43,7 +43,13 @@ public:
void requestViewUpdate();
};
/**
* Start the app with optional pre-filled fields.
*/
void start(const std::string& ssid = "", const std::string& password = "");
bool optSsidParameter(const std::shared_ptr<const Bundle>& bundle, std::string& ssid);
bool optPasswordParameter(const std::shared_ptr<const Bundle>& bundle, std::string& password);
} // namespace
@@ -1,7 +1,7 @@
#pragma once
#include "service/wifi/Wifi.h"
#include "Mutex.h"
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/Mutex.h>
namespace tt::app::wifimanage {
@@ -1,9 +1,11 @@
#pragma once
#include "app/AppContext.h"
#include "./Bindings.h"
#include "./State.h"
#include "lvgl.h"
#include "Tactility/app/AppContext.h"
#include <lvgl.h>
namespace tt::app::wifimanage {
@@ -1,10 +1,13 @@
#pragma once
#include "app/App.h"
#include "Mutex.h"
#include "./View.h"
#include "./State.h"
#include "service/wifi/Wifi.h"
#include "Tactility/app/App.h"
#include <Tactility/PubSub.h>
#include <Tactility/Mutex.h>
#include <Tactility/service/wifi/Wifi.h>
namespace tt::app::wifimanage {
@@ -1,6 +1,6 @@
#pragma once
#include "hal/Configuration.h"
#include <Tactility/hal/Configuration.h>
namespace tt::lvgl {
@@ -1,10 +1,12 @@
#pragma once
#include "MessageQueue.h"
#include "Mutex.h"
#include "PubSub.h"
#include "service/gui/Gui.h"
#include <Tactility/MessageQueue.h>
#include <Tactility/Mutex.h>
#include <Tactility/PubSub.h>
#include <Tactility/service/gui/Gui.h>
#include <cstdio>
#include <lvgl.h>
namespace tt::service::gui {
@@ -1,14 +1,16 @@
#pragma once
#include "EventFlag.h"
#include "MessageQueue.h"
#include "PubSub.h"
#include "RtosCompatSemaphore.h"
#include "Thread.h"
#include "app/AppInstance.h"
#include "app/AppManifest.h"
#include "service/loader/Loader.h"
#include <DispatcherThread.h>
#include "Tactility/app/AppInstance.h"
#include "Tactility/app/AppManifest.h"
#include "Tactility/service/loader/Loader.h"
#include <Tactility/DispatcherThread.h>
#include <Tactility/EventFlag.h>
#include <Tactility/MessageQueue.h>
#include <Tactility/PubSub.h>
#include <Tactility/RtosCompatSemaphore.h>
#include <Tactility/Thread.h>
#include <stack>
#include <utility>
@@ -0,0 +1,55 @@
#pragma once
#include "Tactility/TactilityConfig.h"
#if TT_FEATURE_SCREENSHOT_ENABLED
#include "ScreenshotTask.h"
#include <Tactility/Mutex.h>
#include <Tactility/service/Service.h>
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
@@ -0,0 +1,62 @@
#include "Tactility/TactilityConfig.h"
#if TT_FEATURE_SCREENSHOT_ENABLED
#pragma once
#include <Tactility/Thread.h>
#include <Tactility/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