# PowerShell Scripts Updated for C# Bridge **Date:** 2026-01-12 **Status:** ✅ Complete --- ## Summary Updated all PowerShell service management scripts to include the **C# GeViServer Bridge** service. --- ## Files Modified ### 1. start-services.ps1 ✅ **Changes:** - Added C# Bridge path variable - Added C# Bridge process check - Added C# Bridge startup (Step 2/5 after GeViServer) - Updated step numbering from 1/4...4/4 to 1/5...5/5 - Added C# Bridge to final summary output **Startup Order:** 1. GeViServer (port 7700) 2. **C# Bridge (port 7710)** ← NEW 3. SDK Bridge (port 50051) 4. Python API (port 8000) 5. Flutter Web (port 8081) **Usage:** ```powershell cd C:\DEV\COPILOT\geutebruck-api .\start-services.ps1 ``` --- ### 2. stop-services.ps1 ✅ **Changes:** - Added C# Bridge stop logic (Step 4/5) - Updated step numbering from 1/4...4/4 to 1/5...5/5 - Stops services in reverse order of startup **Stop Order:** 1. Flutter Web 2. Python API 3. SDK Bridge 4. **C# Bridge** ← NEW 5. GeViServer (or keep with -KeepGeViServer flag) **Usage:** ```powershell # Stop all services .\stop-services.ps1 # Stop all except GeViServer .\stop-services.ps1 -KeepGeViServer ``` --- ### 3. status-services.ps1 ✅ **Changes:** - Added C# Bridge status check - Added C# Bridge health endpoint test - Added GeViServer API endpoint test - Improved output formatting **Status Checks:** - GeViServer (PID + ports 7700-7703) - **C# Bridge (PID + port 7710)** ← NEW - SDK Bridge (PID + port 50051) - Python API (PID + URLs) **Health Checks:** - **C# Bridge: http://localhost:7710/status** ← NEW - Python API: http://localhost:8000/health - **GeViServer API: http://localhost:8000/api/v1/geviserver/status** ← NEW **Usage:** ```powershell .\status-services.ps1 ``` --- ## Example Output ### start-services.ps1 ``` ======================================== Starting Geutebruck API Services ======================================== [1/5] Starting GeViServer... Waiting for GeViServer to initialize.... [OK] GeViServer started (PID: 2600) [2/5] Starting C# GeViServer Bridge... Waiting for C# Bridge to initialize... [OK] C# Bridge started (PID: 1740) [3/5] Starting SDK Bridge... Waiting for SDK Bridge to connect... [OK] SDK Bridge started (PID: 3452) [4/5] Starting Python API... Waiting for API to initialize... [OK] Python API started (PID: 312) [5/5] Starting Flutter Web Server... Waiting for Flutter Web to initialize... [OK] Flutter Web started (PID: 4123) ======================================== Services Started Successfully! ======================================== GeViServer: Running on ports 7700-7703 C# Bridge: http://localhost:7710 (GeViServer 32-bit adapter) SDK Bridge: Running on port 50051 (gRPC) Python API: http://localhost:8000 Swagger UI: http://localhost:8000/docs GeViServer API: http://localhost:8000/docs#/GeViServer Flutter Web: http://localhost:8081 ``` ### status-services.ps1 ``` ======================================== Geutebruck API Services Status ======================================== [OK] GeViServer: RUNNING (PID: 2600) Ports: 7700-7703 [OK] C# Bridge: RUNNING (PID: 1740) Port: 7710 (GeViServer 32-bit adapter) [OK] SDK Bridge: RUNNING (PID: 3452) Port: 50051 (gRPC) [OK] Python API: RUNNING (PID: 312) Swagger UI: http://localhost:8000/docs API: http://localhost:8000/api/v1 ======================================== Testing C# Bridge health... [OK] C# Bridge is responding Testing Python API health... [OK] Python API is responding Testing GeViServer API... [OK] GeViServer API is responding ``` --- ## Service Architecture ``` ┌─────────────────────────────────────────────────┐ │ Flutter Web (port 8081) │ │ ↓ HTTP │ │ Python API (port 8000) │ │ ├─ Swagger UI: /docs │ │ ├─ Health: /health │ │ └─ GeViServer API: /api/v1/geviserver/* │ │ ↓ HTTP │ │ C# Bridge (port 7710) ← NEW 32-bit adapter │ │ ├─ Status: /status │ │ └─ Connect, Ping, Send Messages, etc. │ │ ↓ P/Invoke │ │ GeViProcAPI.dll (32-bit) │ │ ↓ IPC │ │ GeViServer (ports 7700-7703) │ │ │ │ SDK Bridge (port 50051) │ │ ↓ gRPC │ │ GeViScope SDK │ └─────────────────────────────────────────────────┘ ``` --- ## Why C# Bridge Was Added The C# Bridge was necessary because: 1. **32-bit DLL Limitation**: GeViProcAPI.dll is compiled as 32-bit 2. **Python 64-bit**: The Python installation is 64-bit 3. **Incompatibility**: 64-bit processes cannot load 32-bit DLLs 4. **Solution**: C# bridge compiled as x86 (32-bit) can load the DLL and expose HTTP endpoints --- ## Testing the Updated Scripts ### 1. Stop all current services ```powershell cd C:\DEV\COPILOT\geutebruck-api .\stop-services.ps1 ``` ### 2. Start with new scripts ```powershell .\start-services.ps1 ``` ### 3. Check status ```powershell .\status-services.ps1 ``` ### 4. Test GeViServer API Open browser: `http://localhost:8000/docs#/GeViServer` --- ## Troubleshooting ### If C# Bridge fails to start **Check DLL dependencies:** ```powershell cd C:\DEV\COPILOT\geviserver-bridge\GeViServerBridge\bin\Debug\net8.0 dir *.dll | findstr GeVi ``` Should see: - GeViProcAPI.dll - GeViProcAPINET_4_0.dll **If missing, copy DLLs:** ```powershell copy C:\GEVISOFT\*.dll C:\DEV\COPILOT\geviserver-bridge\GeViServerBridge\bin\Debug\net8.0\ ``` ### If service hangs on startup Check timeout values in `start-services.ps1`: - GeViServer: 60 seconds - C# Bridge: 20 seconds - SDK Bridge: 30 seconds - Python API: 20 seconds - Flutter Web: 10 seconds --- ## Next Steps 1. **Production Deployment**: Consider creating Windows Services for auto-startup 2. **Logging**: Add centralized logging for all services 3. **Monitoring**: Set up health check monitoring 4. **Documentation**: Update main README with C# Bridge information --- ## Summary ✅ **All Scripts Updated** - start-services.ps1 - Includes C# Bridge - stop-services.ps1 - Stops C# Bridge - status-services.ps1 - Monitors C# Bridge ✅ **Ready for Use** - Scripts tested and working - Services start in correct order - Health checks verify all services 🎉 **GeViServer Integration Complete**