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>
228 lines
6.7 KiB
Python
228 lines
6.7 KiB
Python
"""
|
|
Deep investigation of the CrossSwitch bug
|
|
Traces the full path from API to GeViServer and back
|
|
"""
|
|
import requests
|
|
import json
|
|
|
|
BASE_URL = "http://localhost:8000"
|
|
|
|
def authenticate():
|
|
response = requests.post(f'{BASE_URL}/api/v1/auth/login', json={
|
|
'username': 'admin',
|
|
'password': 'admin123'
|
|
})
|
|
return response.json()['access_token']
|
|
|
|
def test_step1_check_current_mapping():
|
|
"""Step 1: Check what the API currently has for TEST_TESTESEN"""
|
|
print("\n" + "="*80)
|
|
print("STEP 1: Check current TEST_TESTESEN mapping in API")
|
|
print("="*80)
|
|
|
|
token = authenticate()
|
|
headers = {'Authorization': f'Bearer {token}'}
|
|
|
|
response = requests.get(
|
|
f'{BASE_URL}/api/v1/configuration/action-mappings',
|
|
headers=headers
|
|
)
|
|
|
|
mappings = response.json()['mappings']
|
|
test_mapping = None
|
|
for mapping in mappings:
|
|
if mapping['name'] == 'TEST_TESTESEN':
|
|
test_mapping = mapping
|
|
break
|
|
|
|
if not test_mapping:
|
|
print("ERROR: TEST_TESTESEN mapping not found!")
|
|
print(f"Available mappings: {[m['name'] for m in mappings[:10]]}")
|
|
return None
|
|
|
|
print(f"Found mapping ID: {test_mapping['id']}")
|
|
print(f"\nOutput actions ({len(test_mapping.get('output_actions', []))}):")
|
|
for i, action in enumerate(test_mapping.get('output_actions', []), 1):
|
|
print(f"\nAction {i}:")
|
|
print(f" action: {action['action']}")
|
|
print(f" parameters: {json.dumps(action.get('parameters', {}), indent=4)}")
|
|
|
|
return test_mapping
|
|
|
|
def test_step2_download_from_geviserver():
|
|
"""Step 2: Download configuration from GeViServer via SDK Bridge"""
|
|
print("\n" + "="*80)
|
|
print("STEP 2: Download configuration directly from GeViServer")
|
|
print("="*80)
|
|
|
|
token = authenticate()
|
|
headers = {'Authorization': f'Bearer {token}'}
|
|
|
|
# Download full configuration
|
|
response = requests.get(
|
|
f'{BASE_URL}/api/v1/configuration/download',
|
|
headers=headers
|
|
)
|
|
|
|
if response.status_code != 200:
|
|
print(f"ERROR: Download failed with status {response.status_code}")
|
|
print(response.text)
|
|
return None
|
|
|
|
config = response.json()
|
|
|
|
# Find TEST_TESTESEN in the configuration
|
|
test_mapping = None
|
|
for mapping in config.get('actionMappings', {}).get('mappings', []):
|
|
if mapping.get('name') == 'TEST_TESTESEN':
|
|
test_mapping = mapping
|
|
break
|
|
|
|
if not test_mapping:
|
|
print("ERROR: TEST_TESTESEN not found in GeViServer configuration!")
|
|
return None
|
|
|
|
print(f"Found TEST_TESTESEN in GeViServer config")
|
|
print(f"\nRaw data from GeViServer:")
|
|
print(json.dumps(test_mapping, indent=2))
|
|
|
|
return test_mapping
|
|
|
|
def test_step3_create_test_mapping():
|
|
"""Step 3: Create a fresh test mapping with known data"""
|
|
print("\n" + "="*80)
|
|
print("STEP 3: Create fresh test mapping with PanLeft actions")
|
|
print("="*80)
|
|
|
|
token = authenticate()
|
|
headers = {'Authorization': f'Bearer {token}'}
|
|
|
|
# Delete existing if present
|
|
response = requests.get(
|
|
f'{BASE_URL}/api/v1/configuration/action-mappings',
|
|
headers=headers
|
|
)
|
|
|
|
for mapping in response.json()['mappings']:
|
|
if mapping['name'] == 'BACKEND_TEST_PANLEFT':
|
|
print(f"Deleting existing BACKEND_TEST_PANLEFT (ID: {mapping['id']})")
|
|
requests.delete(
|
|
f"{BASE_URL}/api/v1/configuration/action-mappings/{mapping['id']}",
|
|
headers=headers
|
|
)
|
|
|
|
# Create new mapping with explicit PanLeft action
|
|
new_mapping = {
|
|
"name": "BACKEND_TEST_PANLEFT",
|
|
"input_action": "TestInput",
|
|
"output_actions": [
|
|
{
|
|
"action": "PanLeft",
|
|
"parameters": {
|
|
"GscServer": "gscope-cdx-3",
|
|
"PTZ head": "101027",
|
|
"Caption": "GSC PanLeft Test"
|
|
}
|
|
}
|
|
],
|
|
"enabled": True
|
|
}
|
|
|
|
print("\nCreating mapping with data:")
|
|
print(json.dumps(new_mapping, indent=2))
|
|
|
|
response = requests.post(
|
|
f'{BASE_URL}/api/v1/configuration/action-mappings',
|
|
headers=headers,
|
|
json=new_mapping
|
|
)
|
|
|
|
if response.status_code not in [200, 201]:
|
|
print(f"ERROR: Failed to create mapping: {response.status_code}")
|
|
print(response.text)
|
|
return None
|
|
|
|
result = response.json()
|
|
print(f"\nMapping created successfully")
|
|
print(f"Mapping ID: {result.get('mapping', {}).get('id')}")
|
|
|
|
return result
|
|
|
|
def test_step4_verify_after_upload():
|
|
"""Step 4: Upload to GeViServer and verify what gets stored"""
|
|
print("\n" + "="*80)
|
|
print("STEP 4: Upload to GeViServer and check what gets stored")
|
|
print("="*80)
|
|
|
|
token = authenticate()
|
|
headers = {'Authorization': f'Bearer {token}'}
|
|
|
|
# Trigger upload
|
|
print("Uploading configuration to GeViServer...")
|
|
response = requests.post(
|
|
f'{BASE_URL}/api/v1/configuration/upload',
|
|
headers=headers
|
|
)
|
|
|
|
if response.status_code != 200:
|
|
print(f"ERROR: Upload failed: {response.status_code}")
|
|
print(response.text)
|
|
return False
|
|
|
|
print("Upload successful")
|
|
|
|
# Now download it back
|
|
print("\nDownloading back from GeViServer...")
|
|
response = requests.get(
|
|
f'{BASE_URL}/api/v1/configuration/download',
|
|
headers=headers
|
|
)
|
|
|
|
config = response.json()
|
|
|
|
# Find our test mapping
|
|
test_mapping = None
|
|
for mapping in config.get('actionMappings', {}).get('mappings', []):
|
|
if mapping.get('name') == 'BACKEND_TEST_PANLEFT':
|
|
test_mapping = mapping
|
|
break
|
|
|
|
if not test_mapping:
|
|
print("ERROR: BACKEND_TEST_PANLEFT not found after upload!")
|
|
return False
|
|
|
|
print("\nWhat GeViServer stored:")
|
|
print(json.dumps(test_mapping, indent=2))
|
|
|
|
# Check if it's CrossSwitch
|
|
actions = test_mapping.get('actions', [])
|
|
if actions:
|
|
first_action = actions[0]
|
|
print(f"\nFirst output action: {first_action}")
|
|
|
|
if 'CrossSwitch' in str(first_action):
|
|
print("\n!!! BUG CONFIRMED: Action stored as CrossSwitch !!!")
|
|
return False
|
|
elif 'PanLeft' in str(first_action):
|
|
print("\n[OK] Action correctly stored as PanLeft")
|
|
return True
|
|
|
|
return False
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
print("="*80)
|
|
print("INVESTIGATING CROSSSWITCH BUG")
|
|
print("="*80)
|
|
|
|
# Run all test steps
|
|
test_step1_check_current_mapping()
|
|
test_step2_download_from_geviserver()
|
|
test_step3_create_test_mapping()
|
|
test_step4_verify_after_upload()
|
|
|
|
except Exception as e:
|
|
print(f"\nERROR: {str(e)}")
|
|
import traceback
|
|
traceback.print_exc()
|