Files
HawkeyeVision/Plugins/Siemens/tasks/tasks-prd-b24-siemens-emulator.md
2025-07-28 09:52:29 +02:00

52 lines
2.9 KiB
Markdown

# Task List: B24SiemensEmulator Implementation
Based on the PRD for B24SiemensEmulator, here are the detailed tasks required to implement the feature:
## Relevant Files
- `B24SiemensEmulator/MainForm.cs` - Main Windows Forms interface with input/output panels and event handling
- `B24SiemensEmulator/PLCPacket.cs` - PLCPacket data structure with serialization and validation methods
- `B24SiemensEmulator/TcpClient.cs` - TCP client for connecting to B24SiemensPlugin with auto-reconnect
- `B24SiemensEmulator/ConfigurationManager.cs` - JSON save/load functionality for packet configurations
- `B24SiemensEmulator/Program.cs` - Application entry point that launches MainForm
- `B24SiemensEmulator/B24SiemensEmulator.csproj` - Project file with Newtonsoft.Json dependency
### Notes
- The existing B24SiemensEmulator project structure will be used as the foundation
- PLCPacket.cs should match the structure from B24SiemensPlugin exactly
- TCP communication must use localhost:42010 to connect to B24SiemensPlugin
## Tasks
- [x] 1.0 Setup Project Structure and Dependencies
- [x] 1.1 Verify existing B24SiemensEmulator project configuration
- [x] 1.2 Add required NuGet packages (Newtonsoft.Json for JSON serialization)
- [x] 1.3 Update project references and using statements
- [x] 2.0 Implement PLCPacket Data Structure and Communication
- [x] 2.1 Copy PLCPacket class from B24SiemensPlugin project
- [x] 2.2 Implement PLCPacket serialization/deserialization methods
- [x] 2.3 Add validation methods for PLCPacket fields
- [x] 3.0 Create Windows Forms User Interface
- [x] 3.1 Design main form layout with input and output panels
- [x] 3.2 Add input controls for all PLCPacket fields (checkboxes, numeric inputs, text input)
- [x] 3.3 Add read-only output controls to display response packet
- [x] 3.4 Add control buttons (Start/Stop, Save/Load Config)
- [x] 3.5 Add status display and error message areas
- [x] 4.0 Implement TCP Client Network Communication
- [x] 4.1 Create TCP client class for connecting to localhost:42010
- [x] 4.2 Implement asynchronous packet sending every 1 second
- [x] 4.3 Implement response packet receiving and parsing
- [x] 4.4 Add connection error handling with automatic retry
- [x] 4.5 Integrate network communication with UI controls
- [x] 5.0 Add Configuration Management (JSON Save/Load)
- [x] 5.1 Create configuration data model for PLCPacket fields
- [x] 5.2 Implement JSON serialization for configuration saving
- [x] 5.3 Implement JSON deserialization for configuration loading
- [x] 5.4 Add file dialog integration for save/load operations
- [x] 5.5 Add error handling and validation for JSON operations
- [x] 6.0 Add Apply Button for Packet Configuration
- [x] 6.1 Add Apply button to input section UI
- [x] 6.2 Implement currentPacket storage separate from UI values
- [x] 6.3 Update TCP client to use applied packet instead of live UI values
- [x] 6.4 Add visual feedback for Apply button action