feat(application): implement US1 relay control use cases
Add GetAllRelaysUseCase (T043) for retrieving all 8 relay states with labels, coordinating controller reads and repository label lookups with comprehensive error handling and logging. Implement ToggleRelayUseCase (T041) for toggling individual relay states with read-before-write pattern, state validation, and label retrieval. Add use_cases module (T044) with trait-based dependency injection for testability, exposing both use cases for presentation layer integration. Comprehensive test coverage includes 7 toggle tests (state transitions, error handling, double-toggle idempotency) and 9 get-all tests (count, ordering, state correctness, label inclusion, error scenarios). Ref: T041 T042 T043 T044 (specs/001-modbus-relay-control/tasks.org)
This commit is contained in:
@@ -6,6 +6,7 @@ use super::types::{RelayId, RelayLabel, RelayState};
|
||||
///
|
||||
/// Encapsulates the relay's identity, current state, and optional human-readable label.
|
||||
/// This is the primary domain entity for relay control operations.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Relay {
|
||||
id: RelayId,
|
||||
state: RelayState,
|
||||
|
||||
Reference in New Issue
Block a user