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

107 lines
4.9 KiB
Python

#!/usr/bin/env python3
"""Check G-Core server configuration to see if GeViSoft is connected to GeViScope"""
import asyncio
import sys
import os
# Add src/api to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src', 'api'))
import grpc
from protos import configuration_pb2, configuration_pb2_grpc
async def check_servers():
"""Check which G-Core servers are configured"""
# Connect to SDK Bridge
channel = grpc.aio.insecure_channel('localhost:50051')
stub = configuration_pb2_grpc.ConfigurationServiceStub(channel)
try:
# Read configuration tree
request = configuration_pb2.ReadConfigurationTreeRequest()
response = await stub.ReadConfigurationTree(request, timeout=10.0)
# Find GeViGCoreServer folder
gcore_servers = []
for child in response.root.children:
if child.name == "GeViGCoreServer":
for server in child.children:
if server.type == "folder":
server_dict = {node.name: node for node in server.children}
# Extract server details
server_info = {
'id': server.name.split('_')[1] if '_' in server.name else server.name,
'alias': server_dict.get('Alias', {}).string_value if 'Alias' in server_dict else 'N/A',
'host': server_dict.get('Host', {}).string_value if 'Host' in server_dict else 'N/A',
'enabled': None,
'user': server_dict.get('User', {}).string_value if 'User' in server_dict else 'N/A'
}
# Check enabled (can be bool or int32)
if 'Enabled' in server_dict:
enabled_node = server_dict['Enabled']
if hasattr(enabled_node, 'bool_value'):
server_info['enabled'] = enabled_node.bool_value
elif hasattr(enabled_node, 'int_value'):
server_info['enabled'] = bool(enabled_node.int_value)
gcore_servers.append(server_info)
print(f"\n{'='*70}")
print(f"G-Core Servers Configuration (GeViSoft → GeViScope connections)")
print(f"{'='*70}\n")
if not gcore_servers:
print("⚠️ NO G-CORE SERVERS CONFIGURED!")
print("\nThis means GeViSoft is NOT connected to any GeViScope servers.")
print("Cameras are on GeViScope servers, so you won't see any cameras.")
print("\nTo fix: Add a G-Core server pointing to your GeViScope:")
print(" POST /api/v1/configuration/servers")
print(" {")
print(' "alias": "Local GeViScope",')
print(' "host": "localhost", # or IP of GSCServer')
print(' "user": "gevisoft",')
print(' "password": "your_password",')
print(' "enabled": true')
print(" }")
else:
print(f"Found {len(gcore_servers)} G-Core server(s):\n")
for server in gcore_servers:
status = "✅ ENABLED" if server['enabled'] else "❌ DISABLED"
localhost_marker = " ← LOCAL GEVISCOPE!" if server['host'] in ['localhost', '127.0.0.1'] else ""
print(f" [{server['id']}] {server['alias']}")
print(f" Host: {server['host']}{localhost_marker}")
print(f" User: {server['user']}")
print(f" Status: {status}")
print()
# Check if localhost is in the list
has_localhost = any(s['host'] in ['localhost', '127.0.0.1'] for s in gcore_servers)
if not has_localhost:
print(f"\n⚠️ WARNING: No G-Core server pointing to 'localhost'!")
print(f" You have GSCServer.exe running locally but GeViSoft isn't configured to connect to it.")
print(f"\n To connect to your local GeViScope, add a server with host='localhost'")
else:
print(f"\n✅ Good: GeViSoft is configured to connect to local GeViScope (localhost)")
print(f"\n If cameras list is still empty, check:")
print(f" 1. Is GSCServer.exe actually running? (check with Task Manager)")
print(f" 2. Are cameras configured in the local GeViScope?")
print(f" 3. Is the G-Core server connection enabled?")
print(f" 4. Check GeViServer logs for connection errors")
await channel.close()
except Exception as e:
print(f"\n❌ Error: {e}")
print(f"\nMake sure:")
print(f" 1. SDK Bridge is running (port 50051)")
print(f" 2. GeViServer is running")
print(f" 3. Run: .\\status-services.ps1")
if __name__ == "__main__":
asyncio.run(check_servers())