nc_program_manager/.paul/codebase/INTEGRATIONS.md
dtrentin dabcf989d9 docs: map existing codebase
- STACK.md - Technologies and dependencies (.NET 4.7.2, NuGet, Costura.Fody)
- ARCHITECTURE.md - Layered CLI with ICncMachine factory pattern
- STRUCTURE.md - Directory layout and where to add new code
- CONVENTIONS.md - C# style, naming, result wrapper pattern
- TESTING.md - NUnit 3 + Moq, stubs, ignored FOCAS tests
- INTEGRATIONS.md - FOCAS, LSV2, FTP, RSA licensing
- CONCERNS.md - Blocking async, silent catch, no logging, Windows-only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 22:48:20 +02:00

87 lines
3.7 KiB
Markdown

# External Integrations
**Analysis Date:** 2026-05-18
## CNC Machine Protocols
**Fanuc FOCAS1/FOCAS2 (proprietary):**
- Used for: Program upload/download, tool data, work zero offset, machine state
- SDK/Client: `fwlib32.cs` (11,569 lines, P/Invoke wrapper, Fanuc copyright 2002-2014)
- Native DLLs: `Cnc/Fanuc/libs/Fwlib32.dll`, `fwlibe1.dll`, `fwlibNCG.dll`
- Transport: Ethernet TCP (port 8193 default) or HSSB (legacy serial bus)
- Main implementation: `Cnc/Fanuc/FanucMachine.cs`
- Dialect abstraction: `Cnc/Fanuc/IFocasDialect.cs``LegacyFocasDialect.cs` / `ModernFocasDialect.cs`
- Auto-detection: `Cnc/Fanuc/FanucDialectDetector.cs` (detects FOCAS version at connect time)
- Config: `Cnc/Fanuc/FanucConnectionConfig.cs` (IP, port, HSSB node, transport type)
- Platform: Windows only (DLL is 32-bit native)
**Heidenhain LSV2 (proprietary TCP protocol):**
- Used for: Program transfer to/from Heidenhain iTNC/TNC controllers
- Client: Custom TCP implementation `Cnc/Heidenhain/Lsv2Client.cs`
- Default port: 19000
- Auth: Username + password required
- Framing: STX, SIZE, CMD, data, CRC-16/CCITT
- Commands implemented: T_LS_SELECT, T_LS_LOG_IN, T_LS_LOG_OUT, T_R_FL (read file), T_S_FL (send file), T_FD
- Main implementation: `Cnc/Heidenhain/HeidenhainMachine.cs`
- Config: `Cnc/Heidenhain/HeidenhainConnectionConfig.cs`
- Note: ReadActiveProgramAsync / SelectMainProgram not implemented (LSV2 limitation)
**Siemens Sinumerik FTP:**
- Used for: Program transfer to/from Siemens Sinumerik controllers
- Protocol: Standard FTP (RFC 959) via `System.Net.FtpWebRequest`
- Default port: 21
- Default program dir: `/_N_MPF_DIR/`
- Auth: Username + password
- Client: `Cnc/Siemens/SiemensFtpClient.cs`
- Main implementation: `Cnc/Siemens/SiemensMachine.cs`
- Config: `Cnc/Siemens/SiemensConnectionConfig.cs`
- Requirement: Sinumerik FTP option must be enabled on machine
**Mitsubishi M-Series FTP:**
- Used for: Program transfer to/from Mitsubishi M-series controllers
- Protocol: Standard FTP (RFC 959) via `System.Net.FtpWebRequest`
- Default port: 21
- Default program dir: `/PRG/`
- Auth: Username + password
- Client: `Cnc/Mitsubishi/MitsubishiFtpClient.cs`
- Main implementation: `Cnc/Mitsubishi/MitsubishiMachine.cs`
- Config: `Cnc/Mitsubishi/MitsubishiConnectionConfig.cs`
## Licensing System
**RSA Offline License Validation:**
- Used for: Binding license to specific machine hardware
- Mechanism: RSA-SHA256 signature verification
- Public key: Embedded as const string in `Licensing/LicenseValidator.cs`
- Private key: Vendor-only, stored at `~/Documents/mine/c#/LicenseGenerator/private.key.xml` (gitignored)
- Machine fingerprint: WMI queries (CPU ID + motherboard serial) via `Licensing/MachineFingerprint.cs`
- License file: `license.lic` (Base64-encoded RSA signature) next to EXE
- Crypto: `RSACryptoServiceProvider` + `SHA256CryptoServiceProvider` (.NET 4.7.2 compatible)
- Generator tool: Separate repo `ssh://git@3nt-git.duckdns.org:222/davide.trentin/license-generator.git`
## Hardware Access
**WMI (Windows Management Instrumentation):**
- Used for: Machine fingerprinting in licensing
- Queries: `Win32_Processor` (processorID), `Win32_BaseBoard` (SerialNumber)
- Package: `System.Management 7.0.1`
- Files: `Licensing/MachineFingerprint.cs`
- Platform: Windows only
## Data Storage
**File System (local):**
- NC program files written/read from local path specified via `-pathprogramma=` CLI arg
- License file read from `AppDomain.CurrentDomain.BaseDirectory`
- No database, no cloud storage
## Monitoring & Observability
- No error tracking service (Sentry, etc.)
- No analytics
- Logging: `Console.WriteLine` only (no structured logging framework)
---
*Integrations analysis: 2026-05-18*
*Update when new protocols or services are added*