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,110 @@
import 'package:dio/dio.dart';
import '../../../core/constants/api_constants.dart';
import '../../../core/errors/exceptions.dart';
import '../../models/action_mapping_model.dart';
/// Abstract interface for remote action mapping data operations
abstract class ActionMappingRemoteDataSource {
Future<List<ActionMappingModel>> getAllActionMappings();
Future<ActionMappingModel> getActionMappingById(String id);
Future<void> createActionMapping(ActionMappingModel mapping);
Future<void> updateActionMapping(String id, ActionMappingModel mapping);
Future<void> deleteActionMapping(String id);
}
/// Implementation of remote action mapping data source using Dio
class ActionMappingRemoteDataSourceImpl implements ActionMappingRemoteDataSource {
final Dio dio;
ActionMappingRemoteDataSourceImpl({required this.dio});
@override
Future<List<ActionMappingModel>> getAllActionMappings() async {
try {
final response = await dio.get(ApiConstants.actionMappingsEndpoint);
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
final List<dynamic> mappingsList = data['mappings'] as List<dynamic>;
return mappingsList.map((json) => ActionMappingModel.fromJson(json)).toList();
} else {
throw ActionMappingException('Failed to fetch action mappings');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<ActionMappingModel> getActionMappingById(String id) async {
try {
final response = await dio.get('${ApiConstants.actionMappingsEndpoint}/$id');
if (response.statusCode == 200) {
return ActionMappingModel.fromJson(response.data);
} else {
throw ActionMappingException('Failed to fetch action mapping');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> createActionMapping(ActionMappingModel mapping) async {
try {
final response = await dio.post(
ApiConstants.actionMappingsEndpoint,
data: mapping.toJson(),
);
if (response.statusCode != 200 && response.statusCode != 201) {
throw ActionMappingException('Failed to create action mapping');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> updateActionMapping(String id, ActionMappingModel mapping) async {
try {
final response = await dio.put(
'${ApiConstants.actionMappingsEndpoint}/$id',
data: mapping.toJson(),
);
if (response.statusCode != 200) {
throw ActionMappingException('Failed to update action mapping');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> deleteActionMapping(String id) async {
try {
final response = await dio.delete('${ApiConstants.actionMappingsEndpoint}/$id');
if (response.statusCode != 200 && response.statusCode != 204) {
throw ActionMappingException('Failed to delete action mapping');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
Exception _handleDioException(DioException e) {
if (e.type == DioExceptionType.connectionTimeout ||
e.type == DioExceptionType.receiveTimeout) {
return NetworkException('Connection timeout');
} else if (e.type == DioExceptionType.connectionError) {
return NetworkException('No internet connection');
} else if (e.response?.statusCode == 401) {
return AuthenticationException('Unauthorized');
} else {
return ActionMappingException('Server error: ${e.message}');
}
}
}

View File

@@ -0,0 +1,54 @@
import 'package:dio/dio.dart';
import '../../../core/constants/api_constants.dart';
import '../../../core/errors/exceptions.dart';
import '../../models/auth_model.dart';
abstract class AuthRemoteDataSource {
Future<AuthResponseModel> login(String username, String password);
Future<void> logout();
}
class AuthRemoteDataSourceImpl implements AuthRemoteDataSource {
final Dio dio;
AuthRemoteDataSourceImpl({required this.dio});
@override
Future<AuthResponseModel> login(String username, String password) async {
try {
final response = await dio.post(
ApiConstants.loginEndpoint,
data: {
'username': username,
'password': password,
},
);
if (response.statusCode == 200) {
return AuthResponseModel.fromJson(response.data);
} else {
throw ServerException('Login failed: ${response.statusMessage}');
}
} on DioException catch (e) {
if (e.response?.statusCode == 401) {
throw AuthenticationException('Invalid credentials');
} else if (e.type == DioExceptionType.connectionTimeout ||
e.type == DioExceptionType.receiveTimeout) {
throw NetworkException('Connection timeout');
} else if (e.type == DioExceptionType.connectionError) {
throw NetworkException('No internet connection');
} else {
throw ServerException('Server error: ${e.message}');
}
} catch (e) {
throw ServerException('Unexpected error: $e');
}
}
@override
Future<void> logout() async {
// In this implementation, logout is handled locally (clearing tokens)
// If the API has a logout endpoint, implement it here
return;
}
}

View File

@@ -0,0 +1,33 @@
import '../../../core/errors/exceptions.dart';
import '../../models/auth_model.dart';
import 'auth_remote_data_source.dart';
/// Mock implementation of AuthRemoteDataSource for development/testing
/// Accepts hardcoded credentials: admin/admin123
class AuthRemoteDataSourceMock implements AuthRemoteDataSource {
@override
Future<AuthResponseModel> login(String username, String password) async {
// Simulate network delay
await Future.delayed(const Duration(milliseconds: 500));
// Check credentials
if (username == 'admin' && password == 'admin123') {
// Return mock successful auth response
return const AuthResponseModel(
accessToken: 'mock_access_token_12345',
refreshToken: 'mock_refresh_token_67890',
username: 'admin',
role: 'Administrator',
);
} else {
// Invalid credentials
throw AuthenticationException('Invalid username or password');
}
}
@override
Future<void> logout() async {
// Mock logout - nothing to do
await Future.delayed(const Duration(milliseconds: 200));
}
}

View File

@@ -0,0 +1,177 @@
import 'package:dio/dio.dart';
import '../../../core/constants/api_constants.dart';
import '../../../core/errors/exceptions.dart';
import '../../models/server_model.dart';
abstract class ServerRemoteDataSource {
Future<List<ServerModel>> getAllServers();
Future<List<ServerModel>> getGCoreServers();
Future<List<ServerModel>> getGeViScopeServers();
Future<ServerModel> getServerById(String id, String type);
Future<void> createServer(ServerModel server);
Future<void> updateServer(ServerModel server);
Future<void> deleteServer(String id, String type);
}
class ServerRemoteDataSourceImpl implements ServerRemoteDataSource {
final Dio dio;
ServerRemoteDataSourceImpl({required this.dio});
@override
Future<List<ServerModel>> getAllServers() async {
try {
final response = await dio.get(ApiConstants.serversEndpoint);
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
final List<ServerModel> servers = [];
// Parse gcore servers
if (data['gcore_servers'] != null) {
final gcoreList = data['gcore_servers'] as List<dynamic>;
servers.addAll(
gcoreList.map((json) => ServerModel.fromJson(json, 'gcore')),
);
}
// Parse geviscope servers
if (data['geviscope_servers'] != null) {
final geviscopeList = data['geviscope_servers'] as List<dynamic>;
servers.addAll(
geviscopeList.map((json) => ServerModel.fromJson(json, 'geviscope')),
);
}
return servers;
} else {
throw ServerException('Failed to fetch servers');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<List<ServerModel>> getGCoreServers() async {
try {
final response = await dio.get(ApiConstants.gcoreServersEndpoint);
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
final List<dynamic> serversList = data['servers'] as List<dynamic>;
return serversList.map((json) => ServerModel.fromJson(json, 'gcore')).toList();
} else {
throw ServerException('Failed to fetch G-Core servers');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<List<ServerModel>> getGeViScopeServers() async {
try {
final response = await dio.get(ApiConstants.geviscopeServersEndpoint);
if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
final List<dynamic> serversList = data['servers'] as List<dynamic>;
return serversList.map((json) => ServerModel.fromJson(json, 'geviscope')).toList();
} else {
throw ServerException('Failed to fetch GeViScope servers');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<ServerModel> getServerById(String id, String type) async {
try {
final endpoint = type == 'gcore'
? '${ApiConstants.gcoreServersEndpoint}/$id'
: '${ApiConstants.geviscopeServersEndpoint}/$id';
final response = await dio.get(endpoint);
if (response.statusCode == 200) {
return ServerModel.fromJson(response.data, type);
} else {
throw ServerException('Failed to fetch server');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> createServer(ServerModel server) async {
try {
final endpoint = server.serverType == 'gcore'
? ApiConstants.gcoreServersEndpoint
: ApiConstants.geviscopeServersEndpoint;
final response = await dio.post(
endpoint,
data: server.toJson(),
);
if (response.statusCode != 200 && response.statusCode != 201) {
throw ServerException('Failed to create server');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> updateServer(ServerModel server) async {
try {
final endpoint = server.serverType == 'gcore'
? '${ApiConstants.gcoreServersEndpoint}/${server.id}'
: '${ApiConstants.geviscopeServersEndpoint}/${server.id}';
final response = await dio.put(
endpoint,
data: server.toJson(),
);
if (response.statusCode != 200) {
throw ServerException('Failed to update server');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
@override
Future<void> deleteServer(String id, String type) async {
try {
final endpoint = type == 'gcore'
? '${ApiConstants.gcoreServersEndpoint}/$id'
: '${ApiConstants.geviscopeServersEndpoint}/$id';
final response = await dio.delete(endpoint);
if (response.statusCode != 200 && response.statusCode != 204) {
throw ServerException('Failed to delete server');
}
} on DioException catch (e) {
throw _handleDioException(e);
}
}
Exception _handleDioException(DioException e) {
if (e.type == DioExceptionType.connectionTimeout ||
e.type == DioExceptionType.receiveTimeout) {
return NetworkException('Connection timeout');
} else if (e.type == DioExceptionType.connectionError) {
return NetworkException('No internet connection');
} else if (e.response?.statusCode == 401) {
return AuthenticationException('Unauthorized');
} else {
return ServerException('Server error: ${e.message}');
}
}
}