feat: 修复了插件需要外部Provider的问题;加上了一个简易的车控状态返回
This commit is contained in:
68
lib/bloc/command_state.dart
Normal file
68
lib/bloc/command_state.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import '../enums/vehicle_command_type.dart';
|
||||
|
||||
// AI Chat Command States
|
||||
enum AIChatCommandStatus {
|
||||
idle,
|
||||
executing,
|
||||
success,
|
||||
failure,
|
||||
cancelled,
|
||||
}
|
||||
|
||||
class AIChatCommandState {
|
||||
final String? commandId;
|
||||
final VehicleCommandType? commandType;
|
||||
final Map<String, dynamic>? params;
|
||||
final AIChatCommandStatus status;
|
||||
final String? errorMessage;
|
||||
final Map<String, dynamic>? result;
|
||||
final DateTime? timestamp;
|
||||
|
||||
const AIChatCommandState({
|
||||
this.commandId,
|
||||
this.commandType,
|
||||
this.params,
|
||||
this.status = AIChatCommandStatus.idle,
|
||||
this.errorMessage,
|
||||
this.result,
|
||||
this.timestamp,
|
||||
});
|
||||
|
||||
AIChatCommandState copyWith({
|
||||
String? commandId,
|
||||
VehicleCommandType? commandType,
|
||||
Map<String, dynamic>? params,
|
||||
AIChatCommandStatus? status,
|
||||
String? errorMessage,
|
||||
Map<String, dynamic>? result,
|
||||
DateTime? timestamp,
|
||||
}) {
|
||||
return AIChatCommandState(
|
||||
commandId: commandId ?? this.commandId,
|
||||
commandType: commandType ?? this.commandType,
|
||||
params: params ?? this.params,
|
||||
status: status ?? this.status,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
result: result ?? this.result,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other is AIChatCommandState &&
|
||||
other.commandId == commandId &&
|
||||
other.commandType == commandType &&
|
||||
other.status == status &&
|
||||
other.errorMessage == errorMessage;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return commandId.hashCode ^
|
||||
commandType.hashCode ^
|
||||
status.hashCode ^
|
||||
errorMessage.hashCode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user