Commit Graph

76 Commits

Author SHA1 Message Date
99e7ed4809 feat: do not store each infos of each node 2025-10-01 20:45:55 +02:00
dbb3b5bfd3 Merge pull request 'feature/streaming' (#10) from feature/streaming into main
Reviewed-on: #10
2025-09-29 06:29:11 +02:00
2aa887a037 docs(streaming): add 'Things to consider' on high-frequency WS usage and throttling
Notes on heap fragmentation, UDP saturation, throttling/coalescing, buffer reuse, yielding, and payload sizing for reliable streaming/broadcast.
2025-09-28 22:10:18 +02:00
49fe0dabf4 remove node_modules 2025-09-28 22:07:07 +02:00
c0bf16fecb chore(test): remove accidentally committed test/node_modules and ignore it 2025-09-28 21:50:39 +02:00
af46b5c2f4 feat: update logging, add high performance example 2025-09-28 21:48:53 +02:00
7a37901fb2 feat(streaming): suppress WS echo via origin tagging
Inject _origin=ws:<clientId> into JSON payloads on inbound WS messages and strip it on broadcast while skipping the origin client. Documents behavior in StreamingAPI.md.
2025-09-28 21:23:05 +02:00
3cc5405292 feat(streaming): introduce WebSocket Streaming API bridging event bus
ApiServer: add AsyncWebSocket at /ws; accept JSON {event, payload} (string or object) and dispatch via ctx.fire; mirror all local events to clients using NodeContext::onAny.\nNodeContext: add onAny subscriber API.\nNeoPatternService: add api/neopattern/color event to set solid color.\nCluster: centralize cluster/broadcast sending in core; services delegate.\nAPI: add generic /api/node/event and /api/cluster/event endpoints in respective services.\nTests: add ws-color-client, ws-cluster-broadcast-color, http-cluster-broadcast-color.\nDocs: add StreamingAPI.md; update README and test/README.\nFixes: robust WS JSON parsing on ESP8266 and payload handling.
2025-09-28 21:10:26 +02:00
f0df84dc87 feat(api): add generic event endpoints in NodeService and ClusterService
NodeService: add POST /api/node/event to fire local events (params: event, payload).\nClusterService: add POST /api/cluster/event to broadcast events via cluster/broadcast (params: event, payload).\nApiServer: remove inline generic endpoints; services own their registrations.\nUnifies event dispatch through service layer and keeps core server lean.
2025-09-28 17:26:20 +02:00
950142bf7f docs(readme): add Cluster Broadcast section and link to detailed guide
Documents centralized cluster broadcasting flow: service fires local event, core sends UDP CLUSTER_EVENT, peers re-fire locally. Includes usage example and notes; links to docs/ClusterBroadcast.md.
2025-09-28 13:49:48 +02:00
b9b91d71b5 docs: add ClusterBroadcast guide for CLUSTER_EVENT and cluster/broadcast flow
Documents centralized cluster broadcasting: service -> ctx.fire("cluster/broadcast", eventJson) -> UDP CLUSTER_EVENT -> peer ctx.fire(event, data). Includes message format, service/core responsibilities, logging, networking notes, and troubleshooting.
2025-09-28 13:45:10 +02:00
0e6adc999f Merge pull request 'feature/cluster-message' (#9) from feature/cluster-message into main
Reviewed-on: #9
2025-09-28 13:43:53 +02:00
f4ccb1c7ef feat(cluster): centralize cluster/broadcast event for UDP CLUSTER_EVENT send
Register core handler ctx.on("cluster/broadcast") in ClusterManager to send CLUSTER_EVENT via subnet-directed UDP broadcast; services now delegate broadcasting by firing this event. Fix lambda to reference this->ctx inside handler. Update NeoPatternService to fire cluster/broadcast with event JSON instead of sending UDP directly. Improves consistency and removes duplicated UDP code in services.
2025-09-28 13:35:42 +02:00
8da9f77441 refactor(neopattern): unify control handling via event-based single path
Build control payload once from request params and apply locally through ctx.fire("api/neopattern"). If broadcast=true, send the same payload as a CLUSTER_EVENT over UDP.\n\nChanges:\n- Remove duplicated per-parameter setters in REST handler\n- Always fire local event to update state consistently\n- Broadcast reuses same payload; logs retained\n\nImpact:\n- Less duplication, clearer flow, identical behavior for local/remote updates, and simpler maintenance.
2025-09-28 13:27:02 +02:00
cabf857bbd feat(cluster, neopattern): add CLUSTER_EVENT and broadcast handling
Add CLUSTER_EVENT message type and end-to-end handling across cluster and NeoPattern example.\n\nCluster protocol / core:\n- Add ClusterProtocol::CLUSTER_EVENT_MSG\n- ClusterManager: register predicate/handler for CLUSTER_EVENT\n- Robust parsing: accept data as string or nested JSON; serialize nested data to string before firing\n- Add defensive null-termination for full UDP reads; log unknown message head if no handler matches\n- Logging: source IP, payload length, missing fields, and pre-fire event details\n\nNeoPatternService:\n- Constructor now accepts NodeContext and registers ctx.on(api/neopattern) handler\n- /api/neopattern: add optional boolean 'broadcast' flag\n- If broadcast=true: build event payload and send CLUSTER_EVENT over UDP (subnet-directed broadcast); log target and payload size; also fire locally so sender applies immediately\n- Implement applyControlParams with robust ArduinoJson is<T>() checks (replaces deprecated containsKey()) and flexible string/number parsing for color, brightness, steps, interval\n- Minor fixes: include Globals for ClusterProtocol, include ESP8266WiFi for broadcast IP calc, safer brightness clamping\n\nExample:\n- Update neopattern main to pass NodeContext into NeoPatternService\n\nResult:\n- Nodes receive and process CLUSTER_EVENT (api/neopattern) via ctx.fire/ctx.on\n- Broadcast reliably reaches peers; parsing handles both stringified and nested JSON data\n- Additional logs aid diagnosis of delivery/format issues and remove deprecation warnings
2025-09-28 13:18:25 +02:00
2bb0742850 Merge pull request 'feature/node-info-sync' (#8) from feature/node-info-sync into main
Reviewed-on: #8
2025-09-28 12:26:38 +02:00
69bc3fc829 docs: update 2025-09-25 22:47:28 +02:00
eaeb9bbea8 config: more frequent cluster_listen 2025-09-25 22:07:22 +02:00
096cf12704 feat: measure latency 2025-09-25 21:54:25 +02:00
356ec3d381 feat: simplify udp listen 2025-09-25 20:44:31 +02:00
51bd7bd909 feat: introduce udp state machine 2025-09-24 21:23:00 +02:00
921eec3848 docs: update 2025-09-24 21:12:22 +02:00
921e2c7152 feat(cluster): move member info sync to UDP heartbeat; remove HTTP polling
Broadcast CLUSTER_HEARTBEAT every 5s; peers reply with CLUSTER_NODE_INFO containing resources and labels. Update memberList from received node info and set status/lastSeen; keep UDP discovery responses.

Disable HTTP-based updateAllMembersInfoTaskCallback loop to reduce network and memory overhead.

Add protocol constants HEARTBEAT_MSG and NODE_INFO_MSG; increase UDP buffer to 512 bytes.

Set default heartbeat_interval_ms to 5000 ms.

Fix sdkVersion JSON fallback by converting to const char* before assigning to String.
2025-09-23 22:11:49 +02:00
c11652c123 feat: optimize neopattern example 2025-09-20 22:05:52 +02:00
51d4d4bc94 feat: remove hostname from labels 2025-09-20 15:04:11 +02:00
e95eb09a11 feat: introduce new param type numberRange 2025-09-19 21:49:59 +02:00
4727405be1 feat: rewrite NeoPattern example 2025-09-19 21:02:26 +02:00
93f09c3bb4 feat: unified monitoring service 2025-09-16 20:09:48 +02:00
83d87159fc Merge pull request 'feature/relay-example-ui' (#6) from feature/relay-example-ui into main
Reviewed-on: #6
2025-09-16 18:14:58 +02:00
f7f5918509 fix: builds 2025-09-16 18:14:41 +02:00
95a7e3167e fix: revert low mem treshold 2025-09-16 17:06:14 +02:00
702eec5a13 feat: releay ui example, simplify logging 2025-09-16 15:32:49 +02:00
2d85f560bb feat: serve static files, relay example 2025-09-16 12:12:27 +02:00
0b63efece0 Merge pull request 'feat: logging service' (#5) from feature/logging into main
Reviewed-on: #5
2025-09-16 10:11:27 +02:00
8a2988cb50 feat: logging service 2025-09-16 10:10:23 +02:00
6a30dc0dc1 Merge pull request 'feature/web' (#4) from feature/web into main
Reviewed-on: #4
2025-09-16 08:29:04 +02:00
5229848600 chore: cleanup 2025-09-16 08:28:28 +02:00
adde7a3676 docs: add FS and FileService info 2025-09-16 08:27:05 +02:00
dd0c7cca78 fix: ldscript in all envs 2025-09-16 08:20:45 +02:00
d160630f1d fix: partition layout 2025-09-16 08:10:22 +02:00
98fdc3e1ae WIP: service and broken partitions 2025-09-15 20:33:15 +02:00
089f938796 Merge pull request 'feat: implement Spore framework class as main orchestration layer' (#3) from feature/spore into main
Reviewed-on: #3
2025-09-14 12:24:24 +02:00
4d808938ee fix: update remaining build filters for NeoPixel and NeoPattern environments
- Update build_src_filter for esp01_1m_neopixel, d1_mini_neopixel environments
- Update build_src_filter for esp01_1m_neopattern, d1_mini_neopattern environments
- All environments now compile successfully with new folder structure
2025-09-13 21:42:46 +02:00
554c6ff38d refactor: reorganize project structure with modern C++ namespace organization
- Restructure include/ and src/ directories with logical grouping
- Move core components to spore/core/ (NodeContext, NetworkManager, TaskManager, ClusterManager, ApiServer)
- Move services to spore/services/ (NodeService, NetworkService, ClusterService, TaskService)
- Move types to spore/types/ (NodeInfo, ApiTypes, Config)
- Move internal components to spore/internal/ (Globals)
- Update all #include statements to use new namespace paths
- Update platformio.ini build filters for all environments
- Update all example files to use new include paths
- Maintain backward compatibility for public API
- Improve code organization, maintainability, and scalability

This reorganization follows modern C++ project structure patterns and provides
clear separation between public API, internal implementation, and utilities.
All examples compile successfully with the new structure.
2025-09-13 21:30:07 +02:00
bf17684dc6 feat: implement Spore framework class as main orchestration layer
- Add Spore class as unified interface for all core framework functionality
- Implement setup() and begin() methods for flexible initialization pattern
- Add service registration with addService() for both raw and smart pointers
- Provide accessor methods for core components (getTaskManager, getContext, etc.)
- Automatically include core services (Node, Network, Cluster, Task)
- Update all examples to use simplified Spore framework approach
- Fix circular dependency issues in include structure
- Remove setHostname and setApiPort configuration methods
- Add comprehensive documentation and usage examples

The Spore class encapsulates all core functionality from the base example
and provides a clean, unified API for the entire framework. Examples now
use just spore.setup() -> add services -> spore.begin() -> spore.loop().
2025-09-13 21:17:54 +02:00
72b559e047 refactor: simplify endpoint and capabilities 2025-09-13 19:15:07 +02:00
12caeb0be6 feat: services (#2) 2025-09-13 13:45:24 +02:00
fe045804cb feat: set labels in NodeContext/Info 2025-08-29 20:21:11 +02:00
d3a9802ec9 feat: add labels to NodeInfo 2025-08-29 13:30:08 +02:00
f8e5a9c66f feat: add NeoPixel example 2025-08-28 21:21:04 +02:00