Files
geutebruck/test_final_fix_direct.py
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

98 lines
3.0 KiB
Python

"""
Direct test using working Python implementation
Creates FINAL_FIX_TEST mapping with GSC PanLeft and G-Core PanRight
"""
import sys
import os
from pathlib import Path
# Add COPILOT_codex to path for working implementation
sys.path.insert(0, r'C:\DEV\COPILOT_codex')
os.chdir(r'C:\DEV\COPILOT_codex')
from geviset_parser import load_set, save_set
from action_mapping_manager import add_action_mapping
print("=" * 80)
print("FINAL FIX TEST - Direct .set file manipulation")
print("=" * 80)
print()
# Load current configuration
set_file = Path(r"C:\DEV\COPILOT\TestMKS.set")
print(f"Loading configuration from: {set_file}")
tree = load_set(set_file)
# Prepare output actions with ALL fixes applied:
# 1. Camera parameter in action strings for BOTH GSC and G-Core
# 2. Action-specific @@ values from ActionIdLookup
# 3. Only 2 filter flags at mapping level
# 4. VideoInput = 0 at mapping level (camera in action string)
output_actions = [
{
"name": "GSC PanLeft",
"action": "PanLeft",
"parameters": {
"Caption": "GSC PanLeft",
"GscServer": "GEVISCOPE_01_UPDATED",
"PTZ head": "101027"
},
"is_gsc": True,
"action_id": 4198 # GSC:PanLeft @@ value
},
{
"name": "G-Core PanRight",
"action": "PanRight",
"parameters": {
"Caption": "G-Core PanRight",
"GCoreServer": "gscope-cdu-10",
"PTZ head": "101027"
},
"is_gsc": False,
"action_id": 9294 # G-Core:PanRight @@ value
}
]
print("Creating mapping with:")
print(f" Mapping name: FINAL_FIX_TEST")
print(f" Output actions: {len(output_actions)}")
for i, action in enumerate(output_actions, 1):
print(f" Action {i}: {action['name']} (@@={action['action_id']})")
for param_name, param_value in action['parameters'].items():
print(f" {param_name}: {param_value}")
print()
# Add mapping using working implementation
add_action_mapping(
tree,
mapping_name="FINAL_FIX_TEST",
output_actions=output_actions
)
# Save back to file
output_file = Path(r"C:\DEV\COPILOT\TestMKS.set")
print(f"Saving to: {output_file}")
save_set(tree, output_file)
print()
print("✓ Mapping created successfully!")
print()
print("=" * 80)
print("FIXES APPLIED IN PYTHON (same as C# code):")
print("=" * 80)
print("1. BuildActionString includes Camera parameter for BOTH GSC and G-Core")
print("2. Mapping-level VideoInput = 0 (camera is in action strings)")
print("3. Only 2 filter flags: .Temp and .VideoInput")
print("4. Action-specific @@ values (PanLeft: GSC=4198, PanRight: G-Core=9294)")
print("5. No mapping-level fields in output actions")
print()
print("=" * 80)
print("NEXT STEP: Upload TestMKS.set to GeViServer and verify in GeViSet")
print("=" * 80)
print()
print("Expected in GeViSet:")
print("- Mapping name: FINAL_FIX_TEST")
print("- Output Action 1: 'GSC PanLeft' (should show as PanLeft, NOT CrossSwitch)")
print("- Output Action 2: 'G-Core PanRight' (should show as PanRight, NOT CrossSwitch)")
print()