Files
Ken Van Hoeylandt f620255c41 New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>`
- Changed default timezone to Europe/Amsterdam
- Fix for logic bug in unPhone hardware
- Fix for init/deinit in DRV2605 driver
- Other fixes
- Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
2026-01-06 22:35:39 +01:00

56 lines
1.3 KiB
C++

#include <Tactility/app/AppInstance.h>
#include <Tactility/app/AppPaths.h>
namespace tt::app {
void AppInstance::setState(State newState) {
mutex.lock();
state = newState;
mutex.unlock();
}
State AppInstance::getState() const {
mutex.lock();
auto result = state;
mutex.unlock();
return result;
}
/** TODO: Make this thread-safe.
* In practice, the bundle is writeable, so someone could be writing to it
* while it is being accessed from another thread.
* Consider creating MutableBundle vs Bundle.
* Consider not exposing bundle, but expose `app_get_bundle_int(key)` methods with locking in it.
*/
const AppManifest& AppInstance::getManifest() const {
assert(manifest != nullptr);
return *manifest;
}
Flags AppInstance::getFlags() const {
mutex.lock();
auto result = flags;
mutex.unlock();
return result;
}
void AppInstance::setFlags(Flags newFlags) {
mutex.lock();
flags = newFlags;
mutex.unlock();
}
std::shared_ptr<const Bundle> AppInstance::getParameters() const {
mutex.lock();
std::shared_ptr<const Bundle> result = parameters;
mutex.unlock();
return result;
}
std::unique_ptr<AppPaths> AppInstance::getPaths() const {
assert(manifest != nullptr);
return std::make_unique<AppPaths>(*manifest);
}
} // namespace