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>
78 lines
2.5 KiB
Dart
78 lines
2.5 KiB
Dart
import 'dart:convert';
|
|
import 'package:http/http.dart' as http;
|
|
import '../models/action_template.dart';
|
|
import '../../core/constants/api_constants.dart';
|
|
|
|
/// Service for fetching action templates and categories
|
|
/// Used by ActionPickerDialog to show available actions
|
|
class ActionTemplateService {
|
|
final String baseUrl;
|
|
final String? authToken;
|
|
|
|
ActionTemplateService({
|
|
required this.baseUrl,
|
|
this.authToken,
|
|
});
|
|
|
|
Map<String, String> get _headers => {
|
|
'Content-Type': 'application/json',
|
|
if (authToken != null) 'Authorization': 'Bearer $authToken',
|
|
};
|
|
|
|
/// Fetch all action categories
|
|
Future<ActionCategoriesResponse> getActionCategories() async {
|
|
final url = '$baseUrl/api/v1/configuration/action-categories';
|
|
final response = await http.get(
|
|
Uri.parse(url),
|
|
headers: _headers,
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
final json = jsonDecode(response.body) as Map<String, dynamic>;
|
|
return ActionCategoriesResponse.fromJson(json);
|
|
} else {
|
|
throw Exception('Failed to load action categories: ${response.statusCode}');
|
|
}
|
|
}
|
|
|
|
/// Fetch all action templates
|
|
Future<Map<String, ActionTemplate>> getActionTemplates() async {
|
|
final url = '$baseUrl/api/v1/configuration/action-types';
|
|
final response = await http.get(
|
|
Uri.parse(url),
|
|
headers: _headers,
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
final json = jsonDecode(response.body) as Map<String, dynamic>;
|
|
final actionTypesMap = json['action_types'] as Map<String, dynamic>;
|
|
|
|
return actionTypesMap.map((key, value) {
|
|
final templateJson = value as Map<String, dynamic>;
|
|
templateJson['action_name'] = key; // Add action name to the template
|
|
return MapEntry(key, ActionTemplate.fromJson(templateJson));
|
|
});
|
|
} else {
|
|
throw Exception('Failed to load action templates: ${response.statusCode}');
|
|
}
|
|
}
|
|
|
|
/// Fetch a specific action template by name
|
|
Future<ActionTemplate> getActionTemplate(String actionName) async {
|
|
final url = '$baseUrl/api/v1/configuration/action-types/$actionName';
|
|
final response = await http.get(
|
|
Uri.parse(url),
|
|
headers: _headers,
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
final json = jsonDecode(response.body) as Map<String, dynamic>;
|
|
return ActionTemplate.fromJson(json);
|
|
} else if (response.statusCode == 404) {
|
|
throw Exception('Action template "$actionName" not found');
|
|
} else {
|
|
throw Exception('Failed to load action template: ${response.statusCode}');
|
|
}
|
|
}
|
|
}
|