feat: services #2
@@ -1,50 +0,0 @@
|
|||||||
#include <Arduino.h>
|
|
||||||
#include "NodeContext.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "ApiServer.h"
|
|
||||||
#include "TaskManager.h"
|
|
||||||
#include "ClusterManager.h"
|
|
||||||
|
|
||||||
// Services
|
|
||||||
#include "services/NodeService.h"
|
|
||||||
#include "services/ClusterService.h"
|
|
||||||
#include "services/TaskService.h"
|
|
||||||
#include "services/NetworkService.h"
|
|
||||||
|
|
||||||
NodeContext ctx({
|
|
||||||
{"app", "network"},
|
|
||||||
{"role", "demo"}
|
|
||||||
});
|
|
||||||
TaskManager taskManager(ctx);
|
|
||||||
NetworkManager networkManager(ctx);
|
|
||||||
ApiServer apiServer(ctx, taskManager);
|
|
||||||
ClusterManager cluster(ctx, taskManager);
|
|
||||||
|
|
||||||
// Create services
|
|
||||||
NodeService nodeService(ctx);
|
|
||||||
ClusterService clusterService(ctx);
|
|
||||||
TaskService taskService(taskManager);
|
|
||||||
NetworkService networkService(networkManager);
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
|
|
||||||
// Initialize networking
|
|
||||||
networkManager.setupWiFi();
|
|
||||||
|
|
||||||
taskManager.initialize();
|
|
||||||
|
|
||||||
// Setup API
|
|
||||||
apiServer.addService(nodeService);
|
|
||||||
apiServer.addService(clusterService);
|
|
||||||
apiServer.addService(taskService);
|
|
||||||
apiServer.addService(networkService);
|
|
||||||
apiServer.begin();
|
|
||||||
|
|
||||||
taskManager.printTaskStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
taskManager.execute();
|
|
||||||
yield();
|
|
||||||
}
|
|
||||||
@@ -116,37 +116,6 @@ build_src_filter =
|
|||||||
+<src/*.cpp>
|
+<src/*.cpp>
|
||||||
+<src/services/*.cpp>
|
+<src/services/*.cpp>
|
||||||
|
|
||||||
[env:esp01_1m_wifiscan]
|
|
||||||
platform = platformio/espressif8266@^4.2.1
|
|
||||||
board = esp01_1m
|
|
||||||
framework = arduino
|
|
||||||
upload_speed = 115200
|
|
||||||
monitor_speed = 115200
|
|
||||||
board_build.partitions = partitions_ota_1M.csv
|
|
||||||
board_build.flash_mode = dout
|
|
||||||
board_build.flash_size = 1M
|
|
||||||
lib_deps = ${common.lib_deps}
|
|
||||||
build_src_filter =
|
|
||||||
+<examples/wifiscan/*.cpp>
|
|
||||||
+<src/*.c>
|
|
||||||
+<src/*.cpp>
|
|
||||||
+<src/services/*.cpp>
|
|
||||||
|
|
||||||
[env:d1_mini_wifiscan]
|
|
||||||
platform = platformio/espressif8266@^4.2.1
|
|
||||||
board = d1_mini
|
|
||||||
framework = arduino
|
|
||||||
upload_speed = 115200
|
|
||||||
monitor_speed = 115200
|
|
||||||
board_build.flash_mode = dio
|
|
||||||
board_build.flash_size = 4M
|
|
||||||
lib_deps = ${common.lib_deps}
|
|
||||||
build_src_filter =
|
|
||||||
+<examples/wifiscan/*.cpp>
|
|
||||||
+<src/*.c>
|
|
||||||
+<src/*.cpp>
|
|
||||||
+<src/services/*.cpp>
|
|
||||||
|
|
||||||
[env:d1_mini_neopattern]
|
[env:d1_mini_neopattern]
|
||||||
platform = platformio/espressif8266@^4.2.1
|
platform = platformio/espressif8266@^4.2.1
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
|
|||||||
Reference in New Issue
Block a user