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

2.9 KiB

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

  • 1.0 Setup Project Structure and Dependencies
    • 1.1 Verify existing B24SiemensEmulator project configuration
    • 1.2 Add required NuGet packages (Newtonsoft.Json for JSON serialization)
    • 1.3 Update project references and using statements
  • 2.0 Implement PLCPacket Data Structure and Communication
    • 2.1 Copy PLCPacket class from B24SiemensPlugin project
    • 2.2 Implement PLCPacket serialization/deserialization methods
    • 2.3 Add validation methods for PLCPacket fields
  • 3.0 Create Windows Forms User Interface
    • 3.1 Design main form layout with input and output panels
    • 3.2 Add input controls for all PLCPacket fields (checkboxes, numeric inputs, text input)
    • 3.3 Add read-only output controls to display response packet
    • 3.4 Add control buttons (Start/Stop, Save/Load Config)
    • 3.5 Add status display and error message areas
  • 4.0 Implement TCP Client Network Communication
    • 4.1 Create TCP client class for connecting to localhost:42010
    • 4.2 Implement asynchronous packet sending every 1 second
    • 4.3 Implement response packet receiving and parsing
    • 4.4 Add connection error handling with automatic retry
    • 4.5 Integrate network communication with UI controls
  • 5.0 Add Configuration Management (JSON Save/Load)
    • 5.1 Create configuration data model for PLCPacket fields
    • 5.2 Implement JSON serialization for configuration saving
    • 5.3 Implement JSON deserialization for configuration loading
    • 5.4 Add file dialog integration for save/load operations
    • 5.5 Add error handling and validation for JSON operations
  • 6.0 Add Apply Button for Packet Configuration
    • 6.1 Add Apply button to input section UI
    • 6.2 Implement currentPacket storage separate from UI values
    • 6.3 Update TCP client to use applied packet instead of live UI values
    • 6.4 Add visual feedback for Apply button action