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,120 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace GeViSetEditor.Core.Models
{
/// <summary>
/// Complete representation of ALL configuration data in .set file
/// </summary>
public class ComprehensiveConfigFile
{
[JsonIgnore]
public byte[] OriginalData { get; set; }
[JsonPropertyName("fileSize")]
public int FileSize { get; set; }
[JsonPropertyName("header")]
public string Header { get; set; } = "";
[JsonPropertyName("headerNullPrefix")]
public bool HeaderNullPrefix { get; set; }
[JsonPropertyName("rootNodes")]
public List<ConfigNode> RootNodes { get; set; } = new();
[JsonPropertyName("statistics")]
public ComprehensiveConfigStatistics Statistics { get; set; }
/// <summary>
/// Get all properties (name-value pairs)
/// </summary>
[JsonIgnore]
public IEnumerable<ConfigNode> Properties =>
RootNodes.Where(n => n.NodeType == "property");
/// <summary>
/// Get all Rules markers with their actions
/// </summary>
[JsonIgnore]
public IEnumerable<ConfigNode> RulesSections =>
RootNodes.Where(n => n.NodeType == "marker" && n.Name == "Rules");
/// <summary>
/// Get property by name
/// </summary>
public IEnumerable<ConfigNode> GetProperties(string name) =>
Properties.Where(p => p.Name == name);
/// <summary>
/// Get copy of original data for writing
/// </summary>
public byte[] GetDataForWriting()
{
byte[] copy = new byte[OriginalData.Length];
System.Array.Copy(OriginalData, copy, OriginalData.Length);
return copy;
}
}
/// <summary>
/// A node in the configuration tree
/// </summary>
public class ConfigNode
{
[JsonPropertyName("startOffset")]
public int StartOffset { get; set; }
[JsonPropertyName("endOffset")]
public int EndOffset { get; set; }
[JsonPropertyName("nodeType")]
public string NodeType { get; set; } = "";
[JsonPropertyName("name")]
public string? Name { get; set; }
[JsonPropertyName("value")]
public object? Value { get; set; }
[JsonPropertyName("valueType")]
public string? ValueType { get; set; }
[JsonPropertyName("children")]
public List<ConfigNode> Children { get; set; } = new();
/// <summary>
/// Size in bytes
/// </summary>
[JsonIgnore]
public int Size => EndOffset - StartOffset;
}
/// <summary>
/// Statistics about parsed configuration (comprehensive version)
/// </summary>
public class ComprehensiveConfigStatistics
{
[JsonPropertyName("totalNodes")]
public int TotalNodes { get; set; }
[JsonPropertyName("propertyCount")]
public int PropertyCount { get; set; }
[JsonPropertyName("booleanCount")]
public int BooleanCount { get; set; }
[JsonPropertyName("integerCount")]
public int IntegerCount { get; set; }
[JsonPropertyName("stringCount")]
public int StringCount { get; set; }
[JsonPropertyName("markerCount")]
public int MarkerCount { get; set; }
[JsonPropertyName("rulesCount")]
public int RulesCount { get; set; }
}
}

View File

@@ -0,0 +1,134 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace GeViSetEditor.Core.Models
{
/// <summary>
/// Enhanced representation of .set file with full configuration structure
/// Preserves original binary data while exposing parsed configuration
/// </summary>
public class EnhancedSetFile
{
/// <summary>
/// Complete original file data - preserved for round-trip
/// </summary>
[JsonIgnore]
public byte[] OriginalData { get; set; }
/// <summary>
/// File size in bytes
/// </summary>
[JsonPropertyName("fileSize")]
public int FileSize { get; set; }
/// <summary>
/// Header string (usually "GeViSoft Parameters")
/// </summary>
[JsonPropertyName("header")]
public string Header { get; set; } = "";
/// <summary>
/// Configuration items (key-value pairs)
/// </summary>
[JsonPropertyName("configItems")]
public List<ConfigItemEntry> ConfigItems { get; set; } = new();
/// <summary>
/// Action mappings (trigger -> action rules)
/// </summary>
[JsonPropertyName("actionMappings")]
public List<ActionMappingEntry> ActionMappings { get; set; } = new();
/// <summary>
/// Section names found in the file
/// </summary>
[JsonPropertyName("sectionNames")]
public List<SectionNameEntry> SectionNames { get; set; } = new();
/// <summary>
/// Statistics about the parsed configuration
/// </summary>
[JsonPropertyName("statistics")]
public ConfigStatistics Statistics => new ConfigStatistics
{
TotalConfigItems = ConfigItems.Count,
TotalActionMappings = ActionMappings.Count,
TotalSectionNames = SectionNames.Count,
TotalActions = ActionMappings.Sum(m => m.Actions.Count),
ConfigItemsByType = ConfigItems
.GroupBy(i => i.ValueType)
.ToDictionary(g => g.Key, g => g.Count()),
ActionsPerMapping = ActionMappings
.GroupBy(m => m.Actions.Count)
.OrderBy(g => g.Key)
.ToDictionary(g => g.Key, g => g.Count())
};
/// <summary>
/// Get a clean copy of the original data for writing
/// </summary>
public byte[] GetDataForWriting()
{
byte[] copy = new byte[OriginalData.Length];
System.Array.Copy(OriginalData, copy, OriginalData.Length);
return copy;
}
}
/// <summary>
/// Configuration item (key-value pair)
/// </summary>
public class ConfigItemEntry
{
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
[JsonPropertyName("key")]
public string Key { get; set; } = "";
[JsonPropertyName("value")]
public object Value { get; set; }
[JsonPropertyName("valueType")]
public string ValueType { get; set; } = "";
}
/// <summary>
/// Section name found in the file
/// </summary>
public class SectionNameEntry
{
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; } = "";
}
/// <summary>
/// Statistics about parsed configuration
/// </summary>
public class ConfigStatistics
{
[JsonPropertyName("totalConfigItems")]
public int TotalConfigItems { get; set; }
[JsonPropertyName("totalActionMappings")]
public int TotalActionMappings { get; set; }
[JsonPropertyName("totalSectionNames")]
public int TotalSectionNames { get; set; }
[JsonPropertyName("totalActions")]
public int TotalActions { get; set; }
[JsonPropertyName("configItemsByType")]
public Dictionary<string, int> ConfigItemsByType { get; set; } = new();
[JsonPropertyName("actionsPerMapping")]
public Dictionary<int, int> ActionsPerMapping { get; set; } = new();
}
}

View File

@@ -0,0 +1,81 @@
using System.Collections.Generic;
namespace GeViSetEditor.Core.Models
{
/// <summary>
/// Represents the complete GeViSet configuration from a .set file
/// </summary>
public class GeViSetConfiguration
{
public string Header { get; set; } = "GeViSoft Parameters";
public List<Section> Sections { get; set; } = new();
/// <summary>
/// File format version (inferred from structure)
/// </summary>
public int FormatVersion { get; set; } = 1;
}
/// <summary>
/// Represents a configuration section (Alarms, Clients, GeViIO, etc.)
/// </summary>
public class Section
{
public string Name { get; set; } = "";
public List<ConfigItem> Items { get; set; } = new();
public List<ActionRule> Rules { get; set; } = new();
}
/// <summary>
/// Represents a configuration item (key-value pair)
/// </summary>
public class ConfigItem
{
public string Name { get; set; } = "";
public object Value { get; set; }
public ConfigValueType Type { get; set; }
public override string ToString() => $"{Name} = {Value}";
}
/// <summary>
/// Represents an action rule (trigger -> actions mapping)
/// </summary>
public class ActionRule
{
public int RuleId { get; set; }
public Dictionary<string, bool> TriggerProperties { get; set; } = new();
public string MainAction { get; set; } = "";
public List<ActionVariation> ActionVariations { get; set; } = new();
public override string ToString()
{
var triggers = string.Join(", ", TriggerProperties.Where(kv => kv.Value).Select(kv => kv.Key));
return $"Rule #{RuleId}: [{triggers}] -> {MainAction}";
}
}
/// <summary>
/// Represents platform-specific action variations (GSC, GNG, GCore)
/// </summary>
public class ActionVariation
{
public int VariationId { get; set; }
public string ActionString { get; set; } = "";
public string ActionType { get; set; } = ""; // GscAction, GCoreAction, etc.
public string FullCommand { get; set; } = "";
public string ServerType { get; set; } = ""; // GscServer, GCoreServer
public string ServerName { get; set; } = "";
public Dictionary<string, object> Metadata { get; set; } = new();
public override string ToString() => $"{ActionType}: {ActionString}";
}
public enum ConfigValueType
{
Boolean,
Integer,
String,
Binary
}
}

View File

@@ -0,0 +1,90 @@
using System.Collections.Generic;
namespace GeViSetEditor.Core.Models
{
/// <summary>
/// Safe representation of a .set file that preserves original binary data
/// Only parses action mappings, everything else stays as original bytes
/// </summary>
public class SafeSetFile
{
/// <summary>
/// Complete original file data - preserved for round-trip
/// </summary>
public byte[] OriginalData { get; set; }
/// <summary>
/// File size in bytes
/// </summary>
public int FileSize { get; set; }
/// <summary>
/// Header string (usually "GeViSoft Parameters")
/// </summary>
public string Header { get; set; } = "";
/// <summary>
/// Extracted action mappings with their file offsets
/// </summary>
public List<ActionMappingEntry> ActionMappings { get; set; } = new();
/// <summary>
/// Get a clean copy of the original data for writing
/// </summary>
public byte[] GetDataForWriting()
{
byte[] copy = new byte[OriginalData.Length];
System.Array.Copy(OriginalData, copy, OriginalData.Length);
return copy;
}
}
/// <summary>
/// Action mapping entry with its location in the file
/// </summary>
public class ActionMappingEntry
{
/// <summary>
/// File offset where this mapping starts
/// </summary>
public int FileOffset { get; set; }
/// <summary>
/// Offset of the "Rules" marker
/// </summary>
public int RulesMarkerOffset { get; set; }
/// <summary>
/// Offset where action data starts (after metadata)
/// </summary>
public int ActionDataStartOffset { get; set; }
/// <summary>
/// Offset where action data ends
/// </summary>
public int ActionDataEndOffset { get; set; }
/// <summary>
/// Original bytes for this entire mapping (for preservation)
/// </summary>
public byte[] OriginalBytes { get; set; }
/// <summary>
/// Extracted action strings
/// </summary>
public List<string> Actions { get; set; } = new();
/// <summary>
/// Optional: Parsed trigger conditions (if needed later)
/// </summary>
public Dictionary<string, object> TriggerConditions { get; set; } = new();
/// <summary>
/// Display-friendly description of this mapping
/// </summary>
public string GetDescription()
{
return $"Mapping at offset {FileOffset}: {Actions.Count} actions";
}
}
}

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace GeViSetEditor.Core.Models
{
/// <summary>
/// Complete representation of a .set file with full structure
/// Supports JSON serialization and round-trip conversion
/// </summary>
public class SetFileComplete
{
[JsonPropertyName("version")]
public string Version { get; set; } = "1.0";
[JsonPropertyName("fileSize")]
public int FileSize { get; set; }
[JsonPropertyName("headerNullByte")]
public bool HeaderNullByte { get; set; }
[JsonPropertyName("header")]
public string Header { get; set; } = "";
[JsonPropertyName("sections")]
public List<SectionComplete> Sections { get; set; } = new();
/// <summary>
/// Original raw data (not serialized to JSON)
/// </summary>
[JsonIgnore]
public byte[] RawData { get; set; }
/// <summary>
/// Get statistics about the configuration
/// </summary>
[JsonIgnore]
public ConfigStatisticsComplete Statistics => new ConfigStatisticsComplete
{
TotalSections = Sections.Count,
TotalItems = Sections.Sum(s => s.Items.Count),
TotalRules = Sections.Sum(s => s.Rules.Count),
TotalActions = Sections.Sum(s => s.Rules.Sum(r => r.Actions.Count)),
SectionTypes = Sections.GroupBy(s => s.Name)
.ToDictionary(g => g.Key, g => g.Count())
};
}
/// <summary>
/// Complete section with all items and rules
/// </summary>
public class SectionComplete
{
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
[JsonPropertyName("fileEndOffset")]
public int FileEndOffset { get; set; }
[JsonPropertyName("items")]
public List<ConfigItemComplete> Items { get; set; } = new();
[JsonPropertyName("rules")]
public List<ActionRuleComplete> Rules { get; set; } = new();
[JsonIgnore]
public int ByteSize => FileEndOffset - FileOffset;
}
/// <summary>
/// Configuration item (key-value pair)
/// </summary>
public class ConfigItemComplete
{
[JsonPropertyName("key")]
public string Key { get; set; } = "";
[JsonPropertyName("value")]
public object Value { get; set; }
[JsonPropertyName("valueType")]
public string ValueType { get; set; } = "";
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
}
/// <summary>
/// Action rule (trigger → actions)
/// </summary>
public class ActionRuleComplete
{
[JsonPropertyName("id")]
public int RuleId { get; set; }
[JsonPropertyName("fileOffset")]
public int FileOffset { get; set; }
[JsonPropertyName("triggers")]
public Dictionary<string, bool> Triggers { get; set; } = new();
[JsonPropertyName("actions")]
public List<string> Actions { get; set; } = new();
[JsonPropertyName("metadata")]
public Dictionary<string, object> Metadata { get; set; } = new();
}
/// <summary>
/// Configuration statistics (Complete parser version)
/// </summary>
public class ConfigStatisticsComplete
{
[JsonPropertyName("totalSections")]
public int TotalSections { get; set; }
[JsonPropertyName("totalItems")]
public int TotalItems { get; set; }
[JsonPropertyName("totalRules")]
public int TotalRules { get; set; }
[JsonPropertyName("totalActions")]
public int TotalActions { get; set; }
[JsonPropertyName("sectionTypes")]
public Dictionary<string, int> SectionTypes { get; set; } = new();
}
}