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

119 lines
3.8 KiB
Python

"""
Test server creation offline using existing .set file
This tests the bool type fix without needing to connect to GeViServer
"""
import sys
sys.path.insert(0, r'C:\DEV\COPILOT\geutebruck-api\src\sdk-bridge\GeViScopeBridge\bin\Debug\net8.0')
from GeViScopeBridge.Services.FolderTreeParser import FolderTreeParser
from GeViScopeBridge.Services.FolderTreeWriter import FolderTreeWriter
from GeViScopeBridge.Models import FolderNode
import clr
def test_offline():
# Read existing .set file
input_file = r'C:\DEV\COPILOT_codex\TestMKS.set'
print(f"Reading {input_file}...")
with open(input_file, 'rb') as f:
data = f.read()
print(f"Read {len(data)} bytes")
# Parse the configuration
parser = FolderTreeParser()
root = parser.Parse(data)
print(f"Parsed configuration with {len(root.Children)} top-level nodes")
# Find GeViGCoreServer node
gcore_node = None
for child in root.Children:
if child.Name == "GeViGCoreServer":
gcore_node = child
break
if gcore_node is None:
print("ERROR: GeViGCoreServer node not found!")
return
print(f"Found GeViGCoreServer with {len(gcore_node.Children)} servers")
# Check if server 16 already exists
server_exists = any(c.Name == "16" for c in gcore_node.Children)
if server_exists:
print("Server 16 already exists, removing it first...")
gcore_node.Children = [c for c in gcore_node.Children if c.Name != "16"]
# Create new server with CORRECT bool types
print("\nCreating server 16 with BOOL types (not int32)...")
new_server = FolderNode()
new_server.Type = "folder"
new_server.Name = "16"
new_server.Children = []
# Add fields in correct order: Alias, DeactivateEcho, DeactivateLiveCheck, Enabled, Host, Password, User
alias_node = FolderNode()
alias_node.Type = "string"
alias_node.Name = "Alias"
alias_node.StringValue = "Test Server 16 - Bool Fix"
new_server.Children.append(alias_node)
echo_node = FolderNode()
echo_node.Type = "bool" # BOOL not int32!
echo_node.Name = "DeactivateEcho"
echo_node.BoolValue = False
new_server.Children.append(echo_node)
live_check_node = FolderNode()
live_check_node.Type = "bool" # BOOL not int32!
live_check_node.Name = "DeactivateLiveCheck"
live_check_node.BoolValue = False
new_server.Children.append(live_check_node)
enabled_node = FolderNode()
enabled_node.Type = "bool" # BOOL not int32!
enabled_node.Name = "Enabled"
enabled_node.BoolValue = True
new_server.Children.append(enabled_node)
host_node = FolderNode()
host_node.Type = "string"
host_node.Name = "Host"
host_node.StringValue = "192.168.1.116"
new_server.Children.append(host_node)
password_node = FolderNode()
password_node.Type = "string"
password_node.Name = "Password"
password_node.StringValue = "test123"
new_server.Children.append(password_node)
user_node = FolderNode()
user_node.Type = "string"
user_node.Name = "User"
user_node.StringValue = "admin"
new_server.Children.append(user_node)
# Add to GeViGCoreServer
gcore_node.Children.append(new_server)
print(f"Added server 16 to GeViGCoreServer (now {len(gcore_node.Children)} servers)")
# Write back to new file
output_file = r'C:\DEV\COPILOT\TestMKS_with_bool_server_16.set'
print(f"\nWriting to {output_file}...")
writer = FolderTreeWriter()
output_data = writer.Write(root)
with open(output_file, 'wb') as f:
f.write(output_data)
print(f"Successfully wrote {len(output_data)} bytes")
print(f"Size change: {len(output_data) - len(data):+d} bytes")
print("\nDone! You can now upload this .set file using GeViSet to test if server 16 appears correctly.")
if __name__ == "__main__":
test_offline()