Commit Graph

26 Commits

Author SHA1 Message Date
Tony 8505958b65 Implement Matter Endpoint Plan Logic and Unit Tests
- Added `gateway_matter_plan.cpp` to define the logic for building Matter endpoint plans, including functions for inferring capabilities and managing allocations based on channel configurations.
- Introduced helper functions to determine the type of Matter endpoints and color methods based on device capabilities.
- Created `gateway_matter_plan_test.cpp` to validate the functionality of the endpoint plan logic with various test cases, ensuring correct behavior for different configurations and address handling.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-08-08 08:36:42 +08:00
Tony 555c2ec5bd Refactor GatewayController to integrate DaliGateway types
- Updated GatewayController to use DaliGateway types instead of GatewayCache types for channel flags, targets, and states.
- Modified methods to reflect changes in data structures, including flag checks and state management.
- Adjusted cache handling to utilize DaliGatewayCache for address and group management.
- Ensured compatibility with existing functionality while enhancing clarity and maintainability of the code.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-08-01 01:19:13 +08:00
Tony 886bda43a4 feat(gateway): integrate DALI controller and enhance network service
- Updated `CMakeLists.txt` to require `dali_cpp` for the gateway cache component.
- Enhanced `GatewayCache` class to include DALI state synchronization and management, including new methods for handling DALI address states, settings, and runtime statuses.
- Removed legacy application controller handling from `GatewayController`, simplifying the frame handling logic.
- Introduced `identify` method in `GatewayNetworkService` for Part 103 identity indication, along with task management for LED signaling.
- Added methods in `GatewaySettingsStore` and `GatewayRuntime` for managing application controller short addresses, improving configuration handling.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-07-29 06:05:27 +08:00
Tony 1e8bda56e0 feat: Add cache management and USB configuration support
- Implemented `setCacheEnabled` method in `GatewayCache` to enable/disable caching with state preservation.
- Added `setCacheEnabled` and `cacheEnabled` methods in `GatewayController` to manage cache settings.
- Enhanced `GatewayNetworkService` to include new JSON endpoints for getting and setting gateway settings, including cache and USB configurations.
- Introduced `GatewayUsbMode` enum and related methods for managing USB modes in `GatewayRuntime` and `GatewaySettingsStore`.
- Updated runtime configuration to persist USB mode and channel index.
- Added validation for configured channels in USB setup and Tridonic HID components to ensure proper channel usage.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-07-28 04:02:58 +08:00
Tony 2c96d6b097 feat: Add gateway group management and TCP control support
- Introduced gateway group functionality in GatewayController, allowing for grouping of gateways.
- Added methods to retrieve and set gateway groups for channels in GatewayRuntime and GatewaySettingsStore.
- Implemented TCP control task in GatewayNetworkService to handle control commands over TCP.
- Enhanced JSON handling for control frames, including discovery and configuration commands.
- Updated Ethernet configuration management to support new settings for gateway groups.
- Improved snapshot and reporting mechanisms to include gateway group information.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-27 02:16:57 +08:00
Tony c04fc6a856 feat: implement session management for 485 control bridge with enhanced command handling
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-27 01:35:35 +08:00
Tony 49dcd8785b feat: add readMemoryLocation method and update GatewayController for memory identity reads
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-15 17:01:27 +08:00
Tony fc4e9016cf Enhance Gateway Network and Runtime Functionality
- Added a check in GatewayNetworkService::handleDaliRawFrame to ensure raw reporting is enabled for the gateway before processing the frame.
- Extended the JSON snapshot in GatewayNetworkService::gatewaySnapshotJson to include additional operation-related fields for each channel, providing more detailed status information.
- Updated GatewayRuntime::classifyCommandPriority to include new opcodes (0x66 and 0x67) in the control command classification, improving command handling.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-13 20:13:33 +08:00
Tony 530f0ecf12 feat: add chip level command handling in GatewayController
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-13 14:43:47 +08:00
Tony be9ff9c2c9 feat: add KNX gateway snapshot and command transaction handling
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-13 01:47:36 +08:00
Tony 40a0e8e303 feat: implement device name handling and update gateway name features
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-12 01:26:31 +08:00
Tony dceede8602 feat: enhance gateway channel management with serial command handling and gateway ID updates
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-11 21:04:20 +08:00
Tony 6ffca719d9 feat: add application controller handling and DALI control device commands
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-11 18:46:32 +08:00
Tony 078c37a20f feat(gateway): enhance DALI and KNX handling with broadcast management support and configurable task stack size
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-27 21:06:58 +08:00
Tony 6d0b36b60a Refactor channel binding configuration and validation
- Introduced `NativeChannelConfig` and `SerialChannelConfig` functions to streamline the creation of `ChannelBindingConfig` instances.
- Replaced manual channel configuration with macros `GATEWAY_CONFIGURE_NATIVE_CHANNEL` and `GATEWAY_CONFIGURE_SERIAL_CHANNEL` for better maintainability.
- Updated `BuildChannelBindings` to utilize the new configuration functions, reducing redundancy.
- Enhanced `ValidateChannelBindings` to check for required TX and RX GPIO pins for native channels.
- Simplified `BindConfiguredChannels` to iterate over the built channel bindings, improving readability and reducing code duplication.
- Adjusted the handling of reserved UART ports in `app_main` to dynamically include all serial channels.
- Updated SDK configuration for channel 1 gateway ID and modified KNX-related configurations for enhanced functionality.
- Removed obsolete NVS flash initialization code and replaced it with a more streamlined approach for managing runtime data.
- Added a new command in `GatewayController` to publish gateway IDs when requested.
- Defined a constant for maximum KNX instance count to improve clarity in the codebase.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-27 18:08:53 +08:00
Tony 865bf8425a feat(gateway): enhance DALI host activity tracking and presence management
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-26 22:21:36 +08:00
Tony 0827befb06 feat(gateway_cache): enhance DALI state management and caching
- Increased flush interval to 10 seconds and added a refresh interval of 120 seconds in GatewayCacheConfig.
- Introduced a new boolean `stale` in GatewayCacheDaliRuntimeStatus to track stale states.
- Added methods for setting actual DALI levels and persisting DALI address states.
- Implemented functions to build and apply DALI state payloads, including handling scene levels.
- Enhanced the GatewayCache class to manage DALI states more effectively, including loading and persisting states.
- Updated GatewayController to support cache refresh operations, including handling cache commands and reporting cache status.
- Added mechanisms for periodic cache refresh based on idle time and configured intervals.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-21 15:34:26 +08:00
Tony 226855362b feat(gateway): integrate bridge service into gateway controller for transport handling
Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-19 05:52:36 +08:00
Tony fa2eae87cf feat(gateway): enhance DALI command handling with mirroring and new target types 2026-05-02 03:19:02 +08:00
Tony 639fdd860e feat(gateway): implement reconciliation mechanism and command prioritization
- Introduced a reconciliation job structure to manage the reconciliation process for gateway channels.
- Added methods to schedule and run reconciliation steps, including group, scene, and settings reconciliation.
- Implemented a locking mechanism to ensure thread safety during reconciliation operations.
- Enhanced command handling in GatewayRuntime to classify commands by priority (control, normal, maintenance).
- Updated command enqueueing and processing to respect command priorities, ensuring maintenance commands are handled appropriately.
- Added configuration options for enabling/disabling cache functionality in GatewayRuntime.
- Improved logging to include cache status during runtime initialization.

Co-authored-by: Copilot <copilot@github.com>
2026-05-02 03:04:06 +08:00
Tony 70c39ea1e1 Refactor GatewayController to integrate GatewayCache
- Updated CMakeLists.txt to require gateway_cache component.
- Modified gateway_controller.hpp to include GatewayCache and adjust constructor.
- Removed internal scene and group management logic from GatewayController, delegating to GatewayCache.
- Simplified scene and group operations by utilizing GatewayCache methods for enabling, setting details, and deleting.
- Eliminated NVS storage handling code, as scene and group data is now managed by GatewayCache.
- Updated command handling methods to use cached data instead of internal structures.

Co-authored-by: Copilot <copilot@github.com>
2026-05-01 04:39:58 +08:00
Tony 2c1aa28d4f feat(gateway): implement serial communication handling in DaliDomainService and GatewayController
Co-authored-by: Copilot <copilot@github.com>
2026-05-01 01:59:32 +08:00
Tony ae4669e1b3 feat(gateway): add ESP-Touch smartconfig provisioning support and enhance network management
Co-authored-by: Copilot <copilot@github.com>
2026-04-30 18:49:38 +08:00
Tony 4ce3513dd2 feat: Add DALI raw frame handling and USB setup bridge
- Introduced DaliRawFrame structure to encapsulate raw frame data.
- Enhanced DaliDomainService to manage raw frame sinks and processing.
- Implemented raw frame task for asynchronous handling of incoming DALI frames.
- Integrated raw frame handling in GatewayBleBridge and GatewayNetworkService.
- Added GatewayUsbSetupBridge to facilitate USB Serial/JTAG communication with DALI.
- Configured ESP-NOW for wireless communication and setup management.
- Updated GatewayRuntime to support clearing wireless credentials on boot button long press.
- Enhanced CMakeLists to include new components and dependencies.

Co-authored-by: Copilot <copilot@github.com>
2026-04-30 04:15:05 +08:00
Tony 3d8d00c3dd feat(gateway): enhance GatewayNetworkService with HTTP and UDP support, add status LED control
Co-authored-by: Copilot <copilot@github.com>
2026-04-30 00:54:53 +08:00
Tony 4433fe97c7 feat(gateway): implement GatewayController and enhance GatewayRuntime
- Added GatewayController class to manage gateway operations, including command handling, scene and group management, and BLE state management.
- Introduced methods for scene and group storage, including loading, saving, and deleting scenes/groups.
- Enhanced GatewayRuntime with BLE management capabilities, including methods to check and set BLE state, and to generate BLE gateway names.
- Implemented utility functions for string normalization and CSV parsing.
- Added notification sinks for various events in the GatewayController.

Co-authored-by: Copilot <copilot@github.com>
2026-04-29 23:02:40 +08:00