- Rename `assets` and `config` partitions to `system` and `data` - Change partition type from `spiffs` to `fat`, so we can have sub-directories - Fix crash when doing WiFi scan: Increased system event task size to 3kB. - Free up IRAM on ESP32 (it was required for the Core2, but I also freed up the same amount for Yellow Board) - Introduced `Paths` objects that can be retrieved by `AppContext` and `ServiceContext`. Apps and services now have their own relative paths. Assets were re-arranged into the correct paths. - Rename simulator window title to "Tactility" - Refactored statusbar widget so it persists icon paths properly (it kept a const char* reference, but didn't copy it, so it crashed when the related std::string was destroyed) - Created `Partitions.h` to expose some useful variables - Moved USB config in various `sdkconfig` (it was part of the "default" section, but it shouldn't be) - Updated domain name
103 lines
2.9 KiB
C++
103 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include "AppManifest.h"
|
|
#include "Bundle.h"
|
|
#include <memory>
|
|
|
|
namespace tt::app {
|
|
|
|
class Paths;
|
|
|
|
typedef union {
|
|
struct {
|
|
bool showStatusbar : 1;
|
|
};
|
|
unsigned char flags;
|
|
} Flags;
|
|
|
|
/**
|
|
* A limited representation of the application instance.
|
|
* Do not store references or pointers to these!
|
|
*/
|
|
class AppContext {
|
|
|
|
protected:
|
|
|
|
virtual ~AppContext() = default;
|
|
|
|
public:
|
|
|
|
virtual const AppManifest& getManifest() const = 0;
|
|
virtual std::shared_ptr<void> _Nullable getData() const = 0;
|
|
virtual void setData(std::shared_ptr<void> data) = 0;
|
|
virtual std::shared_ptr<const Bundle> getParameters() const = 0;
|
|
virtual Flags getFlags() const = 0;
|
|
virtual void setResult(Result result) = 0;
|
|
virtual void setResult(Result result, std::shared_ptr<const Bundle> bundle)= 0;
|
|
virtual bool hasResult() const = 0;
|
|
virtual std::unique_ptr<Paths> getPaths() 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;
|
|
};
|
|
|
|
}
|