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

View File

@@ -0,0 +1,136 @@
using System;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using GeViSetEditor.Core.Models;
using GeViSetEditor.Core.Parsers;
namespace GeViSetEditor.CLI.Commands
{
/// <summary>
/// Export .set file to JSON format (action mappings + metadata)
/// Binary data is preserved for round-trip conversion
/// </summary>
public static class ExportJsonCommand
{
public static void Execute(string inputPath, string outputJsonPath)
{
Console.WriteLine("=== Export to JSON ===\n");
if (!File.Exists(inputPath))
{
Console.WriteLine($"ERROR: File not found: {inputPath}");
return;
}
try
{
// Parse with safe parser
byte[] data = File.ReadAllBytes(inputPath);
var parser = new SafeSetFileParser();
var setFile = parser.Parse(data);
Console.WriteLine($"\nFile: {inputPath}");
Console.WriteLine($"Size: {setFile.FileSize:N0} bytes");
Console.WriteLine($"Header: '{setFile.Header}'");
Console.WriteLine($"Action Mappings: {setFile.ActionMappings.Count}");
// Create JSON-friendly export model
var exportModel = new SetFileJsonExport
{
Version = "1.0",
SourceFile = Path.GetFileName(inputPath),
FileSize = setFile.FileSize,
Header = setFile.Header,
ExportDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
ActionMappings = setFile.ActionMappings.Select((m, index) => new ActionMappingJson
{
Id = index + 1,
FileOffset = m.FileOffset,
RulesMarkerOffset = m.RulesMarkerOffset,
Actions = m.Actions.ToList(),
TriggerConditions = m.TriggerConditions.ToDictionary(kv => kv.Key, kv => kv.Value)
}).ToList()
};
// Serialize to JSON
var options = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
string json = JsonSerializer.Serialize(exportModel, options);
// Write to file
File.WriteAllText(outputJsonPath, json);
Console.WriteLine($"\n✓ JSON exported successfully!");
Console.WriteLine($"Output: {outputJsonPath}");
Console.WriteLine($"JSON size: {json.Length:N0} characters ({json.Length / 1024:N0} KB)");
// Show statistics
Console.WriteLine($"\n=== Statistics ===");
Console.WriteLine($"Total mappings: {exportModel.ActionMappings.Count}");
Console.WriteLine($"Total actions: {exportModel.ActionMappings.Sum(m => m.Actions.Count)}");
var actionsPerMapping = exportModel.ActionMappings.GroupBy(m => m.Actions.Count);
Console.WriteLine($"\nActions per mapping:");
foreach (var group in actionsPerMapping.OrderBy(g => g.Key))
{
Console.WriteLine($" {group.Key} actions: {group.Count()} mappings");
}
}
catch (Exception ex)
{
Console.WriteLine($"\n✗ ERROR: {ex.Message}");
Console.WriteLine($"Stack trace:\n{ex.StackTrace}");
}
}
}
/// <summary>
/// JSON export model (without binary data)
/// </summary>
public class SetFileJsonExport
{
[JsonPropertyName("version")]
public string Version { get; set; }
[JsonPropertyName("sourceFile")]
public string SourceFile { get; set; }
[JsonPropertyName("exportDate")]
public string ExportDate { get; set; }
[JsonPropertyName("fileSize")]
public int FileSize { get; set; }
[JsonPropertyName("header")]
public string Header { get; set; }
[JsonPropertyName("actionMappings")]
public List<ActionMappingJson> ActionMappings { get; set; } = new();
}
public class ActionMappingJson
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
[JsonPropertyName("rulesMarkerOffset")]
public int RulesMarkerOffset { get; set; }
[JsonPropertyName("actions")]
public List<string> Actions { get; set; } = new();
[JsonPropertyName("triggerConditions")]
public Dictionary<string, object> TriggerConditions { get; set; } = new();
}
}