refactor(modbus): switch to native Modbus TCP protocol
Switch from Modbus RTU over TCP to native Modbus TCP based on hardware testing. Uses standard MBAP header (no CRC16), port 502, and TCP-only tokio-modbus feature for simpler implementation. Updated: Cargo.toml, plan.md, research.md, tasks.md
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
**Technical Approach**:
|
||||
- **Architecture**: Pragmatic Balance (Service Layer Pattern) - Hexagonal architecture with domain/application/infrastructure/presentation layers
|
||||
- **Backend**: Rust with tokio-modbus 0.17.0 for Modbus RTU over TCP, Poem 3.1 for HTTP API with OpenAPI
|
||||
- **Backend**: Rust with tokio-modbus 0.17.0 for Modbus TCP, Poem 3.1 for HTTP API with OpenAPI
|
||||
- **Frontend**: Vue 3 + TypeScript with HTTP polling (2-second intervals), deployed to Cloudflare Pages
|
||||
- **Reverse Proxy**: Traefik on Raspberry Pi with Authelia middleware for authentication and HTTPS termination
|
||||
- **Persistence**: SQLite for relay labels
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
**Language/Version**: Rust 1.75+
|
||||
**Primary Dependencies**:
|
||||
- tokio-modbus 0.17.0 (Modbus RTU over TCP)
|
||||
- tokio-modbus 0.17.0 with TCP feature only (Modbus TCP protocol)
|
||||
- Poem 3.1 + poem-openapi 5.1 (HTTP API with OpenAPI)
|
||||
- Tokio 1.48 (async runtime)
|
||||
- sqlx 0.8 (SQLite persistence with compile-time verification)
|
||||
@@ -184,7 +184,7 @@ sta/ (repository root)
|
||||
**Action**: Add the following dependencies:
|
||||
```toml
|
||||
[dependencies]
|
||||
tokio-modbus = { version = "0.17.0", features = ["rtu", "tcp"] }
|
||||
tokio-modbus = { version = "0.17.0", default-features = false, features = ["tcp"] }
|
||||
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"] }
|
||||
mockall = "0.13"
|
||||
async-trait = "0.1"
|
||||
@@ -904,7 +904,7 @@ impl RelayLabelRepository for SqliteRelayLabelRepository {
|
||||
|
||||
### Phase 4: Infrastructure - Real Modbus Client (1.5 days)
|
||||
|
||||
**Objective**: Implement real Modbus RTU over TCP communication using tokio-modbus.
|
||||
**Objective**: Implement real Modbus TCP communication using tokio-modbus.
|
||||
|
||||
**Prerequisites**: Phase 1 complete (controller trait), hardware available for testing
|
||||
|
||||
@@ -2014,7 +2014,7 @@ tests/
|
||||
```toml
|
||||
[dependencies]
|
||||
# Existing dependencies...
|
||||
tokio-modbus = { version = "0.17.0", features = ["rtu", "tcp"] }
|
||||
tokio-modbus = { version = "0.17.0", default-features = false, features = ["tcp"] }
|
||||
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"] }
|
||||
mockall = "0.13"
|
||||
async-trait = "0.1"
|
||||
|
||||
Reference in New Issue
Block a user