Files
geutebruck/geutebruck-api/SCRIPTS_USAGE.md
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

5.0 KiB

Service Management Scripts

Simple PowerShell scripts to manage the Geutebruck API services.

Quick Start

Start Both Services

.\start-services.ps1

Stop Both Services

.\stop-services.ps1

Restart Both Services

.\restart-services.ps1

Check Status

.\status-services.ps1

What Each Script Does

start-services.ps1

  • Starts SDK Bridge (GeViScopeBridge.exe)
  • Starts Python API (uvicorn)
  • Checks if already running (won't start duplicates)
  • Runs both in background
  • Shows PIDs and URLs

stop-services.ps1

  • Stops SDK Bridge
  • Stops Python API
  • Safe to run even if not running

restart-services.ps1

  • Stops both services
  • Waits 2 seconds
  • Starts both services

status-services.ps1

  • Shows running status
  • Shows PIDs
  • Shows URLs
  • Tests API health endpoint

Running as Windows Services (Optional)

If you want the services to start automatically on boot, use NSSM (Non-Sucking Service Manager):

1. Install NSSM

# Using Chocolatey
choco install nssm

# Or download from: https://nssm.cc/download

2. Install SDK Bridge Service

nssm install GeutebruckSDKBridge "C:\DEV\COPILOT\geutebruck-api\src\sdk-bridge\GeViScopeBridge\bin\Release\net8.0\GeViScopeBridge.exe"
nssm set GeutebruckSDKBridge AppDirectory "C:\DEV\COPILOT\geutebruck-api\src\sdk-bridge\GeViScopeBridge\bin\Release\net8.0"
nssm set GeutebruckSDKBridge Description "Geutebruck SDK Bridge - gRPC server for GeViScope/GeViSoft"
nssm set GeutebruckSDKBridge Start SERVICE_AUTO_START
nssm start GeutebruckSDKBridge

3. Install Python API Service

nssm install GeutebruckAPI "C:\DEV\COPILOT\geutebruck-api\.venv\Scripts\uvicorn.exe"
nssm set GeutebruckAPI AppParameters "main:app --host 0.0.0.0 --port 8000"
nssm set GeutebruckAPI AppDirectory "C:\DEV\COPILOT\geutebruck-api\src\api"
nssm set GeutebruckAPI Description "Geutebruck REST API - FastAPI service"
nssm set GeutebruckAPI Start SERVICE_AUTO_START
nssm set GeutebruckAPI DependOnService GeutebruckSDKBridge
nssm start GeutebruckAPI

4. Manage Windows Services

# Start
nssm start GeutebruckSDKBridge
nssm start GeutebruckAPI

# Stop
nssm stop GeutebruckAPI
nssm stop GeutebruckSDKBridge

# Restart
nssm restart GeutebruckSDKBridge
nssm restart GeutebruckAPI

# Remove
nssm remove GeutebruckAPI confirm
nssm remove GeutebruckSDKBridge confirm

# Check status
nssm status GeutebruckSDKBridge
nssm status GeutebruckAPI

Alternative: Task Scheduler (Auto-start on Login)

If you don't want full Windows services but want auto-start on login:

Create Scheduled Task

$action = New-ScheduledTaskAction -Execute "PowerShell.exe" `
    -Argument "-ExecutionPolicy Bypass -File C:\DEV\COPILOT\geutebruck-api\start-services.ps1" `
    -WorkingDirectory "C:\DEV\COPILOT\geutebruck-api"

$trigger = New-ScheduledTaskTrigger -AtLogOn

$principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -RunLevel Highest

Register-ScheduledTask -TaskName "Geutebruck API Services" `
    -Action $action `
    -Trigger $trigger `
    -Principal $principal `
    -Description "Start Geutebruck API services on login"

Remove Scheduled Task

Unregister-ScheduledTask -TaskName "Geutebruck API Services" -Confirm:$false

Troubleshooting

Services Won't Start

  1. Check if ports are already in use:

    netstat -ano | findstr "8000"
    netstat -ano | findstr "50051"
    
  2. Check GeViServer and GSCServer are running:

    Get-Process -Name "GeViServer","GSCServer"
    
  3. Check logs:

    • SDK Bridge: C:\DEV\COPILOT\geutebruck-api\src\sdk-bridge\GeViScopeBridge\bin\Release\net8.0\logs\
    • Python API: Check console output or add logging

Can't Stop Services

# Force kill by name
Stop-Process -Name "GeViScopeBridge" -Force
Stop-Process -Name "uvicorn" -Force

# Or by port
$process = Get-NetTCPConnection -LocalPort 8000 | Select-Object -ExpandProperty OwningProcess
Stop-Process -Id $process -Force

Execution Policy Error

# Allow scripts for current user
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Or run with bypass
PowerShell -ExecutionPolicy Bypass -File .\start-services.ps1

For Development:

  • Use start-services.ps1 / stop-services.ps1 scripts
  • Keep --reload flag for auto-reload on code changes

For Production:

  • Use NSSM to create Windows services
  • Remove --reload flag from uvicorn
  • Configure services to auto-start
  • Set up service recovery options in NSSM

Quick Reference

Command Purpose
.\start-services.ps1 Start both services
.\stop-services.ps1 Stop both services
.\restart-services.ps1 Restart both services
.\status-services.ps1 Check service status
http://localhost:8000/docs Swagger UI
http://localhost:8000/health Health check