无人机视频对接+支持无人机未在线时候5S执行一下查询操作。便于视频正常展示。
无人机视频的摄像头切换功能和参数切换功能(广角和红外 和等) 无人机航线任务创建页面的开发和接口对接 无人机航线任务搜索接口(支持时间过滤) 无人机执行航线任务功能开发和接口对接 无人机暂停执行任务功能开发和接口对接 无人机返航任务和取消返航功能开发和接口对接 无人机机场详情页中的展示信息的更正。
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../domain/usecases/get_drone_station_list_usecase.dart';
|
||||
import '../../domain/usecases/get_video_stream_usecase.dart';
|
||||
import '../../domain/usecases/get_uav_video_stream_usecase.dart';
|
||||
import 'drone_station_event.dart';
|
||||
import 'drone_station_state.dart';
|
||||
|
||||
@@ -8,16 +9,19 @@ class DroneStationBloc extends Bloc<DroneStationEvent, DroneStationState> {
|
||||
final GetDroneStationListUseCase getDroneStationListUseCase;
|
||||
final GetUAVDetailUseCase getUAVDetailUseCase;
|
||||
final GetVideoStreamUseCase getVideoStreamUseCase;
|
||||
final GetUavVideoStreamUseCase getUavVideoStreamUseCase;
|
||||
|
||||
DroneStationBloc(
|
||||
this.getDroneStationListUseCase,
|
||||
this.getUAVDetailUseCase,
|
||||
this.getVideoStreamUseCase,
|
||||
this.getUavVideoStreamUseCase,
|
||||
) : super(const DroneStationInitial()) {
|
||||
on<DroneStationLoadData>(_onLoadData);
|
||||
on<DroneStationRefresh>(_onRefresh);
|
||||
on<UAVDetailLoad>(_onUAVDetailLoad);
|
||||
on<VideoStreamLoad>(_onVideoStreamLoad);
|
||||
on<UavVideoStreamLoad>(_onUavVideoStreamLoad);
|
||||
}
|
||||
|
||||
Future<void> _onLoadData(
|
||||
@@ -79,4 +83,29 @@ class DroneStationBloc extends Bloc<DroneStationEvent, DroneStationState> {
|
||||
(videoStream) => emit(VideoStreamLoaded(videoStream, event.cameraPosition)),
|
||||
);
|
||||
}
|
||||
|
||||
/// 处理无人机实时视频流加载事件
|
||||
Future<void> _onUavVideoStreamLoad(
|
||||
UavVideoStreamLoad event,
|
||||
Emitter<DroneStationState> emit,
|
||||
) async {
|
||||
emit(const UavVideoStreamLoading());
|
||||
|
||||
final result = await getUavVideoStreamUseCase(
|
||||
sn: event.sn,
|
||||
cameraIndex: event.cameraIndex,
|
||||
lensType: event.lensType,
|
||||
qualityType: event.qualityType,
|
||||
videoExpire: event.videoExpire,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) => emit(UavVideoStreamError(failure.message)),
|
||||
(videoStream) => emit(UavVideoStreamLoaded(
|
||||
videoStream: videoStream,
|
||||
cameraIndex: event.cameraIndex,
|
||||
lensType: event.lensType,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../domain/entities/uav_video_stream_entity.dart';
|
||||
|
||||
abstract class DroneStationEvent extends Equatable {
|
||||
const DroneStationEvent();
|
||||
@@ -49,3 +50,23 @@ class VideoStreamLoad extends DroneStationEvent {
|
||||
@override
|
||||
List<Object?> get props => [sn, cameraIndex, cameraPosition];
|
||||
}
|
||||
|
||||
/// 加载无人机实时视频流事件
|
||||
class UavVideoStreamLoad extends DroneStationEvent {
|
||||
final String sn;
|
||||
final String cameraIndex;
|
||||
final UavLensType? lensType;
|
||||
final VideoQualityType qualityType;
|
||||
final int videoExpire;
|
||||
|
||||
const UavVideoStreamLoad({
|
||||
required this.sn,
|
||||
required this.cameraIndex,
|
||||
this.lensType,
|
||||
this.qualityType = VideoQualityType.adaptive,
|
||||
this.videoExpire = 720000000,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [sn, cameraIndex, lensType, qualityType, videoExpire];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import '../../domain/entities/drone_station_entity.dart';
|
||||
import '../../domain/entities/video_stream_entity.dart';
|
||||
import '../../domain/entities/uav_video_stream_entity.dart';
|
||||
|
||||
abstract class DroneStationState extends Equatable {
|
||||
const DroneStationState();
|
||||
@@ -76,6 +77,37 @@ class VideoStreamError extends DroneStationState {
|
||||
|
||||
const VideoStreamError(this.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
/// 无人机实时视频流加载状态
|
||||
class UavVideoStreamLoading extends DroneStationState {
|
||||
const UavVideoStreamLoading();
|
||||
}
|
||||
|
||||
/// 无人机实时视频流加载成功状态
|
||||
class UavVideoStreamLoaded extends DroneStationState {
|
||||
final UavVideoStreamEntity videoStream;
|
||||
final String cameraIndex;
|
||||
final UavLensType? lensType;
|
||||
|
||||
const UavVideoStreamLoaded({
|
||||
required this.videoStream,
|
||||
required this.cameraIndex,
|
||||
this.lensType,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [videoStream, cameraIndex, lensType];
|
||||
}
|
||||
|
||||
/// 无人机实时视频流加载失败状态
|
||||
class UavVideoStreamError extends DroneStationState {
|
||||
final String message;
|
||||
|
||||
const UavVideoStreamError(this.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
Reference in New Issue
Block a user