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

101 lines
4.3 KiB
Python

"""
Dump the complete folder tree structure of a working mapping to understand
how input actions are stored.
"""
import grpc
import sys
import io
import json
sys.path.append(r'C:\DEV\COPILOT\geutebruck-api\src\api')
if sys.platform == 'win32':
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
from protos import configuration_pb2
from protos import configuration_pb2_grpc
print("="*70)
print("DUMPING WORKING MAPPING STRUCTURE")
print("="*70)
channel = grpc.insecure_channel('localhost:50051')
stub = configuration_pb2_grpc.ConfigurationServiceStub(channel)
# Export full configuration as JSON to examine structure
print("\n1. Exporting configuration as JSON...")
export_request = configuration_pb2.ExportJsonRequest()
export_response = stub.ExportConfigurationJson(export_request)
if not export_response.success:
print(f" [ERROR] {export_response.error_message}")
sys.exit(1)
print(f" JSON size: {export_response.json_size} bytes")
# Parse JSON
config = json.loads(export_response.json_data)
# Find MappingRules
if "children" in config:
for child in config["children"]:
if child.get("name") == "MappingRules" and child.get("type") == "folder":
print("\n2. Found MappingRules folder")
mapping_rules = child
# Look for a working mapping (one with "CrossSwitch" in the name)
if "children" in mapping_rules:
for rule in mapping_rules["children"]:
if rule.get("type") == "folder":
# Get the caption (@ field)
caption = None
if "children" in rule:
for field in rule["children"]:
if field.get("name") == "@" and field.get("type") == "string":
caption = field.get("stringValue")
break
# If this looks like a working mapping (has "CrossSwitch" or "M")
if caption and ("CrossSwitch" in caption or "C_" in caption):
print(f"\n3. Found working mapping: '{caption}'")
print(f" Rule ID: {rule.get('name')}")
print(f"\n Complete structure:")
print(json.dumps(rule, indent=2))
# Also print a simplified view
print(f"\n Simplified field list:")
if "children" in rule:
for field in rule["children"]:
field_type = field.get("type")
field_name = field.get("name")
if field_type == "folder":
print(f" - {field_name}/ (folder with {len(field.get('children', []))} children)")
elif field_type == "string":
print(f" - {field_name} = \"{field.get('stringValue')}\"")
elif field_type == "int32":
print(f" - {field_name} = {field.get('intValue')}")
else:
print(f" - {field_name} ({field_type})")
print("\n" + "="*70)
print("DONE - Examine the structure above")
print("="*70)
sys.exit(0)
print("\n[WARNING] No working mapping found with 'CrossSwitch' in name")
print("Listing all mappings:")
if "children" in mapping_rules:
for rule in mapping_rules["children"]:
if rule.get("type") == "folder":
caption = None
if "children" in rule:
for field in rule["children"]:
if field.get("name") == "@" and field.get("type") == "string":
caption = field.get("stringValue")
break
print(f" - Rule {rule.get('name')}: {caption}")
print("\n[ERROR] MappingRules folder not found")