Skip to content
Snippets Groups Projects
Commit 8875dfd2 authored by fxk8y's avatar fxk8y :spider:
Browse files

ST: Moar ServiceManager stuff

parent 37d04dad
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@
// #include <qthing>
const char* TAG = "ServiceManager";
static const char* TAG = "ServiceManager";
namespace SiliconTorch {
......@@ -24,13 +24,29 @@ namespace SiliconTorch {
namespace ServiceManager {
void registerSiliconTorchServices(ServiceManager* mgr);
ServiceManager::ServiceManager() {
registerSiliconTorchServices(this);
// TODO: implement!
}
void ServiceManager::registerService(Service* s) {
s->init();
s->postInit();
services[s->getName()] = s;
ESP_LOGI(TAG, "Registered service[ %s ]", s->getName().c_str());
}
}
}
......@@ -24,7 +24,7 @@ namespace SiliconTorch {
extern const str NVSStateKey;
using ServiceMap = std::map<str, Service>;
using ServiceMap = std::map<str, Service*>;
class ServiceManager {
......@@ -32,7 +32,7 @@ namespace SiliconTorch {
ServiceManager();
void registerService(Service s);
void registerService(Service* s);
private:
......
......@@ -6,17 +6,18 @@
// #include <functional>
// ESP32 specific
#include "esp_log.h"
// #include "esp_log.h"
// project specific
#include <Types.hpp>
#include "FxCyanF.hpp"
// #include <Types.hpp>
// #include "SiliconTorch/NVSExplorer.hpp"
// qthing stuff
// #include <qthing>
const char* TAG = "ServiceManager";
// const char* TAG = "ServiceManager";
namespace SiliconTorch {
......@@ -24,10 +25,9 @@ namespace SiliconTorch {
namespace ServiceManager {
void registerSiliconTorchServices(ServiceManager& mgr) {
// TODO: implement!
void registerSiliconTorchServices(ServiceManager* mgr) {
mgr->registerService(new SiliconTorch::Service::FxCyanF());
}
......
#pragma once
// C++ system level
// #include <cstring> // memset, strncmp
// #include <cstdlib> // TODO: is this for memcpy?
// #include <functional>
// ESP32 specific
#include "esp_log.h"
// project specific
#include <Types.hpp>
#include "Service.hpp"
// qthing stuff
// #include <qthing>
namespace SiliconTorch {
namespace ServiceManager {
extern const str NVSStateKey;
}
}
......@@ -19,6 +19,7 @@
#include "SiliconTorch/Service/FxCyanF.hpp"
#include "SiliconTorch/Service/Service.hpp"
#include "SiliconTorch/Service/ServiceManager.hpp"
......@@ -28,6 +29,7 @@ CyanLight::CyanLightControl* ctrl = NULL;
SiliconTorch::ServiceManager::Service* fxCyan = NULL;
SiliconTorch::ServiceManager::ServiceManager* mgr = NULL;
......@@ -52,9 +54,13 @@ void device_main() {
SiliconTorch::NVSExplorer::NVSExplorer::instance();
fxCyan = new SiliconTorch::Service::FxCyanF();
mgr = new SiliconTorch::ServiceManager::ServiceManager();
fxCyan->start();
// fxCyan = new SiliconTorch::Service::FxCyanF();
// fxCyan->start();
xSemaphoreGive(mutex000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment