Files
klas 40143734fc Initial commit: COPILOT D6 Flutter keyboard controller
Flutter web app replacing legacy WPF CCTV surveillance keyboard controller.
Includes wall overview, section view with monitor grid, camera input,
PTZ control, alarm/lock/sequence BLoCs, and legacy-matching UI styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 14:57:38 +01:00

44 lines
1.2 KiB
Dart

import 'package:equatable/equatable.dart';
enum ConnectionOverallStatus { disconnected, connecting, connected, partial }
class ConnectionState extends Equatable {
final ConnectionOverallStatus overallStatus;
final Map<String, bool> serverStatus;
final String? error;
const ConnectionState({
this.overallStatus = ConnectionOverallStatus.disconnected,
this.serverStatus = const {},
this.error,
});
/// Check if all servers are connected
bool get allConnected =>
serverStatus.isNotEmpty && serverStatus.values.every((v) => v);
/// Check if any server is connected
bool get anyConnected => serverStatus.values.any((v) => v);
/// Get count of connected servers
int get connectedCount => serverStatus.values.where((v) => v).length;
/// Get count of total servers
int get totalCount => serverStatus.length;
ConnectionState copyWith({
ConnectionOverallStatus? overallStatus,
Map<String, bool>? serverStatus,
String? error,
}) {
return ConnectionState(
overallStatus: overallStatus ?? this.overallStatus,
serverStatus: serverStatus ?? this.serverStatus,
error: error,
);
}
@override
List<Object?> get props => [overallStatus, serverStatus, error];
}