diff --git a/Tactility/Include/Tactility/service/Service.h b/Tactility/Include/Tactility/service/Service.h index dfb81b877..12aef3587 100644 --- a/Tactility/Include/Tactility/service/Service.h +++ b/Tactility/Include/Tactility/service/Service.h @@ -1,15 +1,12 @@ #pragma once +#include + #include namespace tt::service { -enum class State { - Starting, - Started, - Stopping, - Stopped -}; +using State = ::ServiceState; // Forward declaration class ServiceContext; diff --git a/Tactility/Include/Tactility/service/ServicePaths.h b/Tactility/Include/Tactility/service/ServicePaths.h index ee4f8685b..a219b613b 100644 --- a/Tactility/Include/Tactility/service/ServicePaths.h +++ b/Tactility/Include/Tactility/service/ServicePaths.h @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/Tactility/Source/lvgl/Lvgl.cpp b/Tactility/Source/lvgl/Lvgl.cpp index 672ab46fb..48c596345 100644 --- a/Tactility/Source/lvgl/Lvgl.cpp +++ b/Tactility/Source/lvgl/Lvgl.cpp @@ -102,7 +102,7 @@ void attachDevices() { // We search for the manifest first, because during the initial start() during boot // the service won't be registered yet. if (service::findManifestById("Gui") != nullptr) { - if (service::getState("Gui") == service::State::Stopped) { + if (service::getState("Gui") == SERVICE_STATE_STOPPED) { service::startService("Gui"); } else { LOG_E(TAG, "Gui service is not in Stopped state"); @@ -112,7 +112,7 @@ void attachDevices() { // We search for the manifest first, because during the initial start() during boot // the service won't be registered yet. if (service::findManifestById("Statusbar") != nullptr) { - if (service::getState("Statusbar") == service::State::Stopped) { + if (service::getState("Statusbar") == SERVICE_STATE_STOPPED) { service::startService("Statusbar"); } else { LOG_E(TAG, "Statusbar service is not in Stopped state"); diff --git a/Tactility/Source/service/ServiceRegistration.cpp b/Tactility/Source/service/ServiceRegistration.cpp index 1254932d7..5cb53464d 100644 --- a/Tactility/Source/service/ServiceRegistration.cpp +++ b/Tactility/Source/service/ServiceRegistration.cpp @@ -13,16 +13,6 @@ namespace tt::service { constexpr auto* TAG = "ServiceRegistration"; -static State toCppState(ServiceState state) { - switch (state) { - case SERVICE_STATE_STARTING: return State::Starting; - case SERVICE_STATE_STARTED: return State::Started; - case SERVICE_STATE_STOPPING: return State::Stopping; - case SERVICE_STATE_STOPPED: - default: return State::Stopped; - } -} - // Bridges the kernel's context-free C ServiceManifest/Service callbacks to the // C++ Service instances they wrap. Declared extern "C" to match the linkage of // the C function-pointer types they're assigned to (see e.g. gpio_controller.cpp). @@ -136,7 +126,7 @@ bool stopService(const std::string& id) { } State getState(const std::string& id) { - return toCppState(service_registration_get_state(id.c_str())); + return service_registration_get_state(id.c_str()); } } // namespace