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>
This commit is contained in:
Administrator
2025-12-31 18:10:54 +01:00
commit 14893e62a5
4189 changed files with 1395076 additions and 0 deletions

141
test_create_mapping.py Normal file
View File

@@ -0,0 +1,141 @@
"""
Test script for creating an action mapping via the REST API
"""
import requests
import json
import sys
import io
# Set UTF-8 encoding for Windows console
if sys.platform == 'win32':
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
# API configuration
BASE_URL = "http://localhost:8000"
USERNAME = "admin"
PASSWORD = "admin"
def test_create_action_mapping():
"""Test creating a new action mapping"""
print("=" * 60)
print("TESTING ACTION MAPPING CREATION")
print("=" * 60)
# Step 1: Login to get token
print("\n1. Logging in...")
login_response = requests.post(
f"{BASE_URL}/api/v1/auth/login",
json={"username": USERNAME, "password": PASSWORD}
)
if login_response.status_code != 200:
print(f"❌ Login failed: {login_response.status_code}")
print(login_response.text)
return False
token = login_response.json()["access_token"]
print(f"✅ Login successful, token: {token[:20]}...")
headers = {"Authorization": f"Bearer {token}"}
# Step 2: Get current count of mappings
print("\n2. Getting current mappings count...")
get_response = requests.get(f"{BASE_URL}/api/v1/action-mappings", headers=headers)
if get_response.status_code != 200:
print(f"❌ GET failed: {get_response.status_code}")
print(get_response.text)
return False
current_mappings = get_response.json()
initial_count = len(current_mappings)
print(f"✅ Current mapping count: {initial_count}")
# Step 3: Create a new mapping
print("\n3. Creating new action mapping...")
new_mapping = {
"name": "TEST_FOLDER_TREE_MAPPING",
"output_actions": [
{
"action": "GCoreDataBase",
"parameters": [
{"name": "PreAlarm", "value": "10"},
{"name": "Alarm", "value": "60"}
]
},
{
"action": "GscMail",
"parameters": [
{"name": "Receiver", "value": "test@example.com"},
{"name": "Subject", "value": "Test Alert"}
]
}
]
}
print(f" Payload: {json.dumps(new_mapping, indent=2)}")
create_response = requests.post(
f"{BASE_URL}/api/v1/action-mappings",
headers=headers,
json=new_mapping
)
print(f" Status Code: {create_response.status_code}")
print(f" Response: {create_response.text}")
if create_response.status_code != 201:
print(f"❌ CREATE failed: {create_response.status_code}")
return False
print("✅ CREATE returned 201 Created")
# Step 4: Verify persistence by reading back
print("\n4. Verifying persistence...")
verify_response = requests.get(f"{BASE_URL}/api/v1/action-mappings", headers=headers)
if verify_response.status_code != 200:
print(f"❌ Verification GET failed: {verify_response.status_code}")
return False
updated_mappings = verify_response.json()
final_count = len(updated_mappings)
print(f" Initial count: {initial_count}")
print(f" Final count: {final_count}")
if final_count == initial_count + 1:
print("✅ Mapping count increased by 1 - SUCCESS!")
else:
print(f"❌ Mapping count did NOT increase! Expected {initial_count + 1}, got {final_count}")
return False
# Step 5: Find the new mapping
print("\n5. Searching for new mapping...")
found = False
for mapping in updated_mappings:
if mapping.get("name") == "TEST_FOLDER_TREE_MAPPING":
found = True
print(f"✅ Found new mapping: {json.dumps(mapping, indent=2)}")
break
if not found:
print("❌ New mapping NOT found in list!")
return False
print("\n" + "=" * 60)
print("🎉 ALL TESTS PASSED!")
print("=" * 60)
return True
if __name__ == "__main__":
try:
success = test_create_action_mapping()
exit(0 if success else 1)
except Exception as e:
print(f"\n❌ EXCEPTION: {e}")
import traceback
traceback.print_exc()
exit(1)