feat: GeViScope SDK integration with C# Bridge and Flutter app
- Add GeViScope Bridge (C# .NET 8.0) on port 7720 - Full SDK wrapper for camera control, PTZ, actions/events - 17 REST API endpoints for GeViScope server interaction - Support for MCS (Media Channel Simulator) with 16 test channels - Real-time action/event streaming via PLC callbacks - Add GeViServer Bridge (C# .NET 8.0) on port 7710 - Integration with GeViSoft orchestration layer - Input/output control and event management - Update Python API with new routers - /api/geviscope/* - Proxy to GeViScope Bridge - /api/geviserver/* - Proxy to GeViServer Bridge - /api/excel/* - Excel import functionality - Add Flutter app GeViScope integration - GeViScopeRemoteDataSource with 17 API methods - GeViScopeBloc for state management - GeViScopeScreen with PTZ controls - App drawer navigation to GeViScope - Add SDK documentation (extracted from PDFs) - GeViScope SDK docs (7 parts + action reference) - GeViSoft SDK docs (12 chunks) - Add .mcp.json for Claude Code MCP server config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:html' as html;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -12,7 +13,11 @@ import 'presentation/blocs/server/server_bloc.dart';
|
||||
import 'presentation/blocs/server/server_event.dart';
|
||||
import 'presentation/blocs/action_mapping/action_mapping_bloc.dart';
|
||||
import 'presentation/blocs/action_mapping/action_mapping_event.dart';
|
||||
import 'presentation/blocs/geviserver/geviserver_bloc.dart';
|
||||
import 'presentation/blocs/geviscope/geviscope_bloc.dart';
|
||||
import 'presentation/screens/auth/login_screen.dart';
|
||||
import 'presentation/screens/geviserver/geviserver_screen.dart';
|
||||
import 'presentation/screens/geviscope/geviscope_screen.dart';
|
||||
import 'presentation/screens/servers/server_list_screen.dart';
|
||||
import 'presentation/screens/servers/servers_management_screen.dart';
|
||||
import 'presentation/screens/servers/server_form_screen.dart';
|
||||
@@ -39,13 +44,34 @@ void main() async {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
late final AuthBloc _authBloc;
|
||||
late final GoRouter _router;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_authBloc = di.sl<AuthBloc>()..add(const CheckAuthStatus());
|
||||
_router = _createRouter(_authBloc);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_authBloc.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (_) => di.sl<AuthBloc>()..add(const CheckAuthStatus()),
|
||||
return BlocProvider.value(
|
||||
value: _authBloc,
|
||||
child: MaterialApp.router(
|
||||
title: 'GeViAPI - Video Management System',
|
||||
debugShowCheckedModeBanner: false,
|
||||
@@ -85,99 +111,124 @@ class MyApp extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
final _router = GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
builder: (context, state) => BlocProvider.value(
|
||||
value: context.read<AuthBloc>(),
|
||||
child: const LoginScreen(),
|
||||
GoRouter _createRouter(AuthBloc authBloc) {
|
||||
return GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
builder: (context, state) => BlocProvider.value(
|
||||
value: context.read<AuthBloc>(),
|
||||
child: const LoginScreen(),
|
||||
),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => BlocProvider.value(
|
||||
value: context.read<AuthBloc>(),
|
||||
child: const ServerListScreen(),
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => BlocProvider.value(
|
||||
value: context.read<AuthBloc>(),
|
||||
child: const ServerListScreen(),
|
||||
),
|
||||
),
|
||||
),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => BlocProvider(
|
||||
create: (_) => di.sl<ServerBloc>()..add(const LoadServers()),
|
||||
child: child,
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => BlocProvider(
|
||||
create: (_) => di.sl<ServerBloc>()..add(const LoadServers()),
|
||||
child: child,
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/servers',
|
||||
builder: (context, state) => const ServersManagementScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/servers/create',
|
||||
builder: (context, state) {
|
||||
final serverType = state.uri.queryParameters['type'] == 'geviscope'
|
||||
? ServerType.geviscope
|
||||
: ServerType.gcore;
|
||||
return ServerFormScreen(serverType: serverType);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/servers/edit/:id',
|
||||
builder: (context, state) {
|
||||
final server = state.extra as Server;
|
||||
return ServerFormScreen(server: server, serverType: server.type);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/servers',
|
||||
builder: (context, state) => const ServersManagementScreen(),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => BlocProvider(
|
||||
create: (_) => di.sl<ActionMappingBloc>()..add(const LoadActionMappings()),
|
||||
child: child,
|
||||
),
|
||||
GoRoute(
|
||||
path: '/servers/create',
|
||||
builder: (context, state) {
|
||||
final serverType = state.uri.queryParameters['type'] == 'geviscope'
|
||||
? ServerType.geviscope
|
||||
: ServerType.gcore;
|
||||
return ServerFormScreen(serverType: serverType);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/servers/edit/:id',
|
||||
builder: (context, state) {
|
||||
final server = state.extra as Server;
|
||||
return ServerFormScreen(server: server, serverType: server.type);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => BlocProvider(
|
||||
create: (_) => di.sl<ActionMappingBloc>()..add(const LoadActionMappings()),
|
||||
child: child,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/action-mappings',
|
||||
builder: (context, state) => const ActionMappingsListScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/action-mappings/create',
|
||||
builder: (context, state) => const ActionMappingFormScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/action-mappings/edit/:id',
|
||||
builder: (context, state) {
|
||||
final mapping = state.extra as ActionMapping;
|
||||
return ActionMappingFormScreen(mapping: mapping);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/action-mappings',
|
||||
builder: (context, state) => const ActionMappingsListScreen(),
|
||||
GoRoute(
|
||||
path: '/geviserver',
|
||||
builder: (context, state) => BlocProvider(
|
||||
create: (_) => di.sl<GeViServerBloc>(),
|
||||
child: const GeViServerScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/action-mappings/create',
|
||||
builder: (context, state) => const ActionMappingFormScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/geviscope',
|
||||
builder: (context, state) => BlocProvider(
|
||||
create: (_) => di.sl<GeViScopeBloc>(),
|
||||
child: const GeViScopeScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/action-mappings/edit/:id',
|
||||
builder: (context, state) {
|
||||
final mapping = state.extra as ActionMapping;
|
||||
return ActionMappingFormScreen(mapping: mapping);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
redirect: (context, state) {
|
||||
final authBloc = context.read<AuthBloc>();
|
||||
final authState = authBloc.state;
|
||||
),
|
||||
],
|
||||
redirect: (context, state) {
|
||||
final authState = authBloc.state;
|
||||
|
||||
final isLoginRoute = state.matchedLocation == '/login';
|
||||
final isLoginRoute = state.matchedLocation == '/login';
|
||||
|
||||
if (authState is Authenticated) {
|
||||
// If authenticated and trying to access login, redirect to home
|
||||
if (isLoginRoute) {
|
||||
return '/';
|
||||
if (authState is Authenticated) {
|
||||
// Check for post-import redirect flag
|
||||
final postImportRedirect = html.window.localStorage['post_import_redirect'];
|
||||
if (postImportRedirect != null && postImportRedirect.isNotEmpty) {
|
||||
// Clear the flag
|
||||
html.window.localStorage.remove('post_import_redirect');
|
||||
// Redirect to the saved path
|
||||
print('[Router] Post-import redirect to: $postImportRedirect');
|
||||
return postImportRedirect;
|
||||
}
|
||||
|
||||
// If authenticated and trying to access login, redirect to home
|
||||
if (isLoginRoute) {
|
||||
return '/';
|
||||
}
|
||||
} else {
|
||||
// If not authenticated and not on login page, redirect to login
|
||||
if (!isLoginRoute) {
|
||||
return '/login';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If not authenticated and not on login page, redirect to login
|
||||
if (!isLoginRoute) {
|
||||
return '/login';
|
||||
}
|
||||
}
|
||||
|
||||
// No redirect needed
|
||||
return null;
|
||||
},
|
||||
refreshListenable: GoRouterRefreshStream(
|
||||
di.sl<AuthBloc>().stream,
|
||||
),
|
||||
);
|
||||
// No redirect needed
|
||||
return null;
|
||||
},
|
||||
refreshListenable: GoRouterRefreshStream(
|
||||
authBloc.stream,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class GoRouterRefreshStream extends ChangeNotifier {
|
||||
GoRouterRefreshStream(Stream<dynamic> stream) {
|
||||
|
||||
Reference in New Issue
Block a user