Du hast auf den Branch anon-test2 2026-04-12 20:50:35 +00:00 gepusht
Neuer Pull-Request
Dateien
Soft-LTS/CLAUDE.md
2026-04-12 22:35:18 +02:00

2.9 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build & Run Commands

dotnet build          # Build
dotnet run            # Run
dotnet build -c Release
dotnet restore        # Restore NuGet packages

No tests, no linting configured. TEST

Architecture

WPF desktop application (.NET 8.0, C#) that monitors 3 contact states on industrial label printers and pushes state changes to TCP clients. Runs as a tray application — starts minimized to system tray, window opens on demand.

Three Monitored States

Per printer, exactly 3 boolean states:

  1. LTS Sensor — Label Take-away Sensor
  2. Druckerklappe — Printhead flap open/closed
  3. Keine Etiketten — Paper/labels empty

Push-Based TCP Protocol

Each printer gets its own TCP port (tcpPort in config). On state change, broadcasts "ABC\n" (3 chars, each 0/1) to all connected clients. On connect, client receives current state immediately.

Printer Drivers

  • CabSquix (Monitors/CabSquixMonitor.cs): OPC UA via SquixOpcUaClient from ../OPC UA Test/. Batch-reads 3 nodes in one call via ReadAllSensors().
  • Zebra (Monitors/ZebraMonitor.cs): TCP/JSON on port 9200. Sends {}{"sensor.peeler":null,"head.latch":null,"media.status":null}, parses response values (clear/not clear, ok/open, ok/out).

App Lifecycle (Tray Icon)

  • App.xaml: ShutdownMode="OnExplicitShutdown" — app runs until explicit exit
  • App.xaml.cs: Creates TaskbarIcon (Hardcodet.NotifyIcon.Wpf.NetCore), starts PrinterService in background
  • Double-click tray → opens MainWindow; closing window → hides to tray
  • Right-click tray → "Anzeigen" / "Beenden"
  • MainWindow.OnClosing cancels close and hides instead

Data Flow

  1. appsettings.jsonPrinterService.StartAsync() spawns per-printer: polling loop + TcpPushServer
  2. Poll returns SimplePrinterState (3 bools, immutable, IEquatable)
  3. Change detection → TcpPushServer.BroadcastStateAsync() on change
  4. DashboardViewModel refreshes every 500ms from status cache

GUI

  • Tab "Status": DashboardView with DataGrid (Name, Typ, Online, LTS, Klappe, Etiketten, TCP Port, Clients)
  • Tab "Einstellungen": SettingsView for printer CRUD, saves to appsettings.json (requires restart)

Key Dependencies

  • ../OPC UA Test/CabSquixOpcUaClient.csproj — OPC UA client (OPCFoundation.NetStandard.Opc.Ua)
  • Hardcodet.NotifyIcon.Wpf.NetCore — System tray icon

Conventions

  • Language: UI text, comments, and XML docs are in German
  • Nullable reference types enabled project-wide
  • Async/await with CancellationToken throughout
  • Configuration in appsettings.json (camelCase keys), editable via GUI or directly
  • Adding a new printer type: implement IPrinterMonitor, register in PrinterService.CreateMonitor()