Files
geutebruck/geutebruck-api/docs/architecture-components.puml
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

208 lines
5.4 KiB
Plaintext

@startuml Component Interactions
!theme plain
skinparam backgroundColor #FEFEFE
title Geutebruck API - Component Interactions & Data Flow
package "Python API (Port 8000)" {
[main.py\nFastAPI App] as main
package "Routers" {
[auth.py] as authrouter
[configuration.py\n✅ IMPLEMENTED] as configrouter
[cameras.py] as camrouter
[monitors.py] as monrouter
[crossswitch.py] as crossrouter
}
package "Services" {
[configuration_service.py\n✅ IMPLEMENTED] as configsvc
[camera_service.py] as camsvc
[monitor_service.py] as monsvc
[crossswitch_service.py] as crosssvc
}
package "Clients" {
[sdk_bridge_client.py\ngRPC Client] as grpcclient
}
package "Schemas (Pydantic)" {
[GCoreServer\nGCoreServerInput] as serverschema
[ActionMapping\nActionMappingInput] as mappingschema
[Camera, Monitor] as schemas
}
package "Proto (gRPC Generated)" {
[configuration_pb2.py\nconfiguration_pb2_grpc.py\n✅ FIXED IMPORTS] as configproto
[camera_pb2.py\nmonitor_pb2.py] as otherproto
}
}
package "C# SDK Bridge (Port 50051)" {
[Program.cs\ngRPC Server] as program
package "Services (gRPC)" {
[ConfigurationService.cs\n✅ IMPLEMENTED] as configgrpc
[CameraService.cs] as camgrpc
[MonitorService.cs] as mongrpc
[CrossSwitchService.cs] as crossgrpc
}
package "SDK Wrappers" {
[GeViDatabaseWrapper.cs] as dbwrapper
[GeViSetupClientWrapper.cs\n✅ IMPLEMENTED] as setupwrapper
[StateQueryHandler.cs] as statehandler
[ActionDispatcher.cs] as dispatcher
}
package "Configuration Handlers" {
[FolderTreeParser.cs\n✅ IMPLEMENTED] as parser
[FolderTreeWriter.cs\n✅ IMPLEMENTED] as writer
}
package "Proto (gRPC Generated)" {
[configuration.proto\nConfigurationService] as configdef
[camera.proto\nmonitor.proto] as otherdef
}
}
package "GeViServer (Ports 7700-7703)" {
[GeViServer.exe] as geviserver
package "SDK API (C++ DLL)" {
[GeViProcAPINET_4_0.dll\nGeViScope SDK] as sdk
}
package "Configuration" {
database "TestMKS.set\n(Binary)" as config {
folder "GeViGCoreServer" as serversfolder {
[Server_1\nServer_2\n...\nServer_13] as servers
}
folder "ActionMapping" as mappingfolder {
[Mapping rules\n64 entries] as mappings
}
}
}
}
' Python API Internal Flow
main --> authrouter
main --> configrouter
main --> camrouter
configrouter --> configsvc : Uses
configsvc --> serverschema : Validates
configsvc --> mappingschema : Validates
configsvc --> grpcclient : Calls
grpcclient --> configproto : Uses
' Python to C# Communication
configproto ..> configdef : gRPC\nPort 50051
otherproto ..> otherdef : gRPC
' C# SDK Bridge Internal Flow
program --> configgrpc : Hosts
program --> camgrpc : Hosts
configgrpc --> setupwrapper : Uses
setupwrapper --> parser : Downloads &\nparses config
setupwrapper --> writer : Builds &\nuploads config
camgrpc --> dbwrapper : Uses
camgrpc --> statehandler : Uses
' C# to GeViServer Communication
dbwrapper --> sdk : Calls\nSDK API
setupwrapper --> sdk : SetupClient\nprotocol
statehandler --> sdk : Query API
sdk --> geviserver : Ports\n7700-7703
geviserver --> config : Read/Write
note right of configrouter
**REST Endpoints:**
GET /api/v1/configuration/servers
POST /api/v1/configuration/servers
PUT /api/v1/configuration/servers/{id}
DELETE /api/v1/configuration/servers/{id}
GET /api/v1/configuration/action-mappings
POST /api/v1/configuration/action-mappings
PUT /api/v1/configuration/action-mappings/{id}
DELETE /api/v1/configuration/action-mappings/{id}
end note
note right of configgrpc
**gRPC Methods:**
CreateServer(ServerRequest)
GetAllServers(Empty)
GetServer(ServerIdRequest)
UpdateServer(ServerRequest) ⚠️
DeleteServer(ServerIdRequest)
CreateActionMapping(MappingRequest)
GetAllActionMappings(Empty)
GetActionMapping(MappingIdRequest)
UpdateActionMapping(MappingRequest)
DeleteActionMapping(MappingIdRequest)
ReadConfigurationTree(Empty)
end note
note right of parser
**FolderTreeParser:**
1. Receives binary .set file
2. Parses header and structure
3. Builds tree of FolderNode objects
4. Each node has:
- Name, Type, Value
- Children (recursive)
5. Returns navigable tree
end note
note right of writer
**FolderTreeWriter:**
1. Takes FolderNode tree
2. Validates structure
3. Serializes to binary format:
- Type codes (1=bool, 4=int32, etc)
- String lengths
- Nested structures
4. Returns binary .set data
5. Uploaded via SetupClient
end note
note bottom of config
**Binary Configuration:**
• Proprietary GeViSoft format
• Hierarchical folder/node structure
• Type-safe fields with type codes
• Critical: bool vs int32 type handling
• Must preserve field order
• Auto-save on change
end note
note as criticalfix
**Critical Bug Fix (2025-12-16):**
**Cascade Deletion Prevention**
- Problem: Deleting mappings by ID in ascending
order caused ID shifting, deleting wrong items
- Solution: Always delete in REVERSE order
(highest ID first)
- Impact: Prevented loss of ~54 mappings
- Status: FIXED in comprehensive_crud_test.py
end note
@enduml