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>
6.7 KiB
Server CRUD Implementation
Overview
Full CRUD (Create, Read, Update, Delete) implementation for GeViSoft G-Core server management via gRPC SDK Bridge and REST API.
Critical Implementation Details
Boolean Type Fix
Issue: Initial implementation used int32 type for boolean fields (Enabled, DeactivateEcho, DeactivateLiveCheck), causing servers to be written but not recognized by GeViSet.
Solution: Changed to proper bool type (type code 1) instead of int32 (type code 4).
Affected Files:
src/sdk-bridge/GeViScopeBridge/Services/ConfigurationServiceImplementation.cs- Lines 1062-1078: CreateServer method
- Lines 1194-1200: UpdateServer method
- Lines 1344-1383: UpdateOrAddChild helper (added bool handling)
Field Order Requirements
Server configuration nodes must have fields in specific order:
- Alias (string)
- DeactivateEcho (bool)
- DeactivateLiveCheck (bool)
- Enabled (bool)
- Host (string)
- Password (string)
- User (string)
Reference: Working implementation in C:\DEV\COPILOT_codex\geviset_parser.py lines 389-404
Auto-Increment Server IDs
Implementation: server_manager.py demonstrates proper ID management:
- Reads existing servers from configuration
- Finds highest numeric server ID
- Increments by 1 for new server ID
- Skips non-numeric IDs gracefully
def get_next_server_id(servers):
numeric_ids = []
for server in servers:
try:
numeric_ids.append(int(server['id']))
except ValueError:
pass
if not numeric_ids:
return "1"
return str(max(numeric_ids) + 1)
API Endpoints
REST API (FastAPI)
Base Path: /api/v1/configuration
GET /servers- List all G-Core serversGET /servers/{server_id}- Get single server by IDPOST /servers- Create new serverPUT /servers/{server_id}- Update existing serverDELETE /servers/{server_id}- Delete server
Implementation: src/api/routers/configuration.py lines 278-460
gRPC API
Service: ConfigurationService
Methods:
CreateServer(CreateServerRequest)→ServerOperationResponseUpdateServer(UpdateServerRequest)→ServerOperationResponseDeleteServer(DeleteServerRequest)→ServerOperationResponseReadConfigurationTree()→ Configuration tree with all servers
Implementation: src/sdk-bridge/GeViScopeBridge/Services/ConfigurationServiceImplementation.cs
Server Data Structure
message ServerData {
string id = 1; // Server ID (numeric string recommended)
string alias = 2; // Display name
string host = 3; // IP address or hostname
string user = 4; // Username (default: "admin")
string password = 5; // Password
bool enabled = 6; // Enable/disable server
bool deactivate_echo = 7; // Deactivate echo (default: false)
bool deactivate_live_check = 8; // Deactivate live check (default: false)
}
Test Scripts
Production Scripts
-
server_manager.py - Complete server lifecycle management
- Lists existing servers
- Auto-increments IDs
- Creates, deletes servers
- Manages action mappings
- Cleanup functionality
-
cleanup_to_base.py - Restore configuration to base state
- Deletes test servers (2, 3)
- Preserves original server (1)
- Quick reset for testing
-
add_claude_test_data.py - Add test data with "Claude" prefix
- Creates 3 servers: Claude Server Alpha/Beta/Gamma
- Creates 2 action mappings
- All identifiable by "Claude" prefix
-
check_and_add_mapping.py - Verify and add action mappings
- Lists existing Claude mappings
- Adds missing mappings
- Ensures complete test data
Legacy Test Scripts
test_server_creation.py- Direct gRPC server creation testadd_server_and_mapping.py- Combined server and mapping creation
Verification Process
Testing Workflow
-
Start Services:
cd C:\GEVISOFT start GeViServer.exe console cd C:\DEV\COPILOT\geutebruck-api\src\sdk-bridge\GeViScopeBridge\bin\Debug\net8.0 start GeViScopeBridge.exe -
Run Test Script:
python server_manager.py -
Stop Services (required before GeViSet connection):
Stop-Process -Name GeViScopeBridge -Force Stop-Process -Name python -Force Stop-Process -Name GeViServer -Force -
Verify in GeViSet:
- Connect to GeViServer
- Check Configuration → GeViGCoreServer
- Verify servers appear with correct bool values
Known Issues & Solutions
Issue: Port 50051 (gRPC) in use
- Solution: Stop SDK Bridge process
Issue: SetupClient connection refused (Error 307)
- Cause: GeViSet already connected (only one SetupPort client allowed)
- Solution: Disconnect GeViSet, retry SetupClient
Issue: Servers created but not visible in GeViSet
- Root Cause: Using int32 instead of bool type
- Solution: Use proper bool type as documented above
CRITICAL Issue: Cascade deletion when deleting multiple action mappings
- Root Cause: Deleting in ascending order causes IDs to shift, deleting wrong mappings
- Solution: Always delete in REVERSE order (highest ID first)
- Status: FIXED in comprehensive_crud_test.py (2025-12-16)
- Details: See CRITICAL_BUG_FIX_DELETE.md
Action Mapping CRUD
Action mappings can also be managed via the same ConfigurationService.
Endpoints:
GET /api/v1/configuration/action-mappings- List all mappingsGET /api/v1/configuration/action-mappings/{mapping_id}- Get single mappingPOST /api/v1/configuration/action-mappings- Create mappingPUT /api/v1/configuration/action-mappings/{mapping_id}- Update mappingDELETE /api/v1/configuration/action-mappings/{mapping_id}- Delete mapping
Note: Mapping IDs are 1-based ordinal positions in the MappingRules list.
Dependencies
- GeViServer must be running
- SDK Bridge requires GeViServer connection
- REST API requires SDK Bridge on localhost:50051
- GeViSet requires exclusive SetupPort (7703) access
Success Metrics
✅ Servers persist correctly in GeViSoft configuration ✅ Servers visible in GeViSet with correct boolean values ✅ Auto-increment ID logic prevents conflicts ✅ All CRUD operations functional via gRPC and REST ✅ Action mappings create, read, update, delete working ✅ Configuration changes survive GeViServer restart
References
- Working Python parser:
C:\DEV\COPILOT_codex\geviset_parser.py - SDK Bridge implementation:
src/sdk-bridge/GeViScopeBridge/Services/ConfigurationServiceImplementation.cs - REST API:
src/api/routers/configuration.py - Protocol definitions:
src/api/protos/configuration.proto