🫏 Adds getter for state

This commit is contained in:
Rune Harlyk
2024-11-23 12:54:15 +01:00
parent 852ff91b7d
commit 8792c06e8a
8 changed files with 49 additions and 48 deletions
@@ -1,7 +1,7 @@
#pragma once
#include <PsychicHttp.h>
#include <template/stateful_endpoint.h>
#include <template/stateful_service.h>
#include <functional>
@@ -160,14 +160,14 @@ class StatefulService {
}
}
protected:
T &state() { return _state; }
private:
T _state;
inline void beginTransaction() { xSemaphoreTakeRecursive(_accessMutex, portMAX_DELAY); }
inline void endTransaction() { xSemaphoreGiveRecursive(_accessMutex); }
private:
SemaphoreHandle_t _accessMutex;
std::list<StateUpdateHandlerInfo_t> _updateHandlers;
std::list<StateHookHandlerInfo_t> _hookHandlers;