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

160 lines
5.8 KiB
Python

"""
Parse GSC-specific actions from GeViScope SDK documentation
Extracts actions that are specific to GeViScope servers (like Imex)
"""
import json
import re
from typing import Dict, List, Any
def parse_gsc_actions_reference() -> Dict[str, Any]:
"""Parse GscActionsReference_EN.txt to extract all GSC actions"""
actions_catalog = {}
# Read the reference file
with open(r'C:\DEV\COPILOT\SOURCES\EXTRACTED_TEXT\CODEX\GeViScope\Additional documentation\GscActionsReference_EN.txt', 'r', encoding='utf-8', errors='ignore') as f:
content = f.read()
# GSC-specific action classes that don't overlap with base actions
# Based on the investigation, Imex is definitely GSC-specific
gsc_specific_categories = {
'Imex': 17, # Class ID from documentation
}
# Define Imex actions based on documentation
imex_actions = {
'ImexCapacityFileAutoDeleted': {
'parameters': ['Warning', 'Destination', 'TotalCapacity', 'FreeCapacity',
'AllocatedByImageFile', 'PercentFree', 'PercentAllocated',
'PercentAllocatedByImageFile', 'TotalFileSize', 'NumberOfFiles'],
'description': 'Imex capacity warning: file auto deleted',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
},
'ImexCapacityOutOfDiskSpace': {
'parameters': ['Warning', 'Destination', 'TotalCapacity', 'FreeCapacity',
'AllocatedByImageFile', 'PercentFree', 'PercentAllocated',
'PercentAllocatedByImageFile'],
'description': 'Imex capacity warning: out of disk space',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
},
'ImexCapacityWarning': {
'parameters': ['Warning', 'Destination', 'TotalCapacity', 'FreeCapacity',
'AllocatedByImageFile', 'PercentFree', 'PercentAllocated',
'PercentAllocatedByImageFile'],
'description': 'Imex capacity warning: capacity warning',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
},
'ImexExportEventImage': {
'parameters': ['EventID', 'TypeID', 'Destination', 'FilePath'],
'description': 'Imex export event image',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
},
'ImexExportImageFromDB': {
'parameters': ['Channel', 'Destination', 'FilePath', 'PictureTime'],
'description': 'Imex export image from database',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
},
'ImexExportImageFromLiveStream': {
'parameters': ['Channel', 'Destination', 'FilePath'],
'description': 'Imex export image from live stream',
'category': 'Imex',
'required_caption': True,
'supports_delay': True,
'gsc_specific': True,
'action_class': 17
}
}
actions_catalog.update(imex_actions)
return actions_catalog
def merge_with_base_catalog(gsc_actions: Dict[str, Any]) -> Dict[str, Any]:
"""Merge GSC-specific actions with existing base actions catalog"""
# Load existing catalog
with open(r'C:\DEV\COPILOT\all_actions_catalog.json', 'r', encoding='utf-8') as f:
base_catalog = json.load(f)
# Add GSC-specific flag to base actions
for action_name in base_catalog:
if 'gsc_specific' not in base_catalog[action_name]:
base_catalog[action_name]['gsc_specific'] = False
base_catalog[action_name]['gcore_specific'] = False
# Merge GSC actions
for action_name, action_data in gsc_actions.items():
if action_name in base_catalog:
print(f"WARNING: {action_name} already exists in base catalog")
else:
base_catalog[action_name] = action_data
return base_catalog
def main():
print("="*80)
print("PARSING GSC-SPECIFIC ACTIONS")
print("="*80)
print()
# Parse GSC actions
gsc_actions = parse_gsc_actions_reference()
print(f"Parsed {len(gsc_actions)} GSC-specific actions")
# Show what was found
print("\nGSC-Specific Actions:")
for category in ['Imex']:
category_actions = [name for name, data in gsc_actions.items()
if data.get('category') == category]
if category_actions:
print(f"\n{category} ({len(category_actions)} actions):")
for action in sorted(category_actions):
print(f" - {action}")
# Merge with base catalog
print("\n" + "="*80)
print("MERGING WITH BASE CATALOG")
print("="*80)
complete_catalog = merge_with_base_catalog(gsc_actions)
# Count totals
total = len(complete_catalog)
base_count = sum(1 for a in complete_catalog.values() if not a.get('gsc_specific'))
gsc_count = sum(1 for a in complete_catalog.values() if a.get('gsc_specific'))
print(f"\nTotal actions: {total}")
print(f" Base actions: {base_count}")
print(f" GSC-specific: {gsc_count}")
# Save updated catalog
output_file = r'C:\DEV\COPILOT\all_actions_catalog_with_gsc.json'
with open(output_file, 'w', encoding='utf-8') as f:
json.dump(complete_catalog, f, indent=2)
print(f"\n[OK] Saved to: {output_file}")
print("="*80)
if __name__ == '__main__':
main()