集成接口 开始执行任务的领域层和数据层和UI层的开发啊(待测试)

集成功能 暂停 取消功能 恢复功能的接口的领域层和数据层的开发 下一步待集成到页面上
优化功能,优化了接口异常和未知异常对页面渲染的影响对用户的体验的不好情况。具体通过弹窗友好提示!
优化更新了tcp指示灯点击出现机器状态中添加选中设备的编号 方便用户使用的明白明了!。
优化更新关闭了tcp重连操作内链条中的获取用户设备和切换设备操作项。
调整了获取无人机状态信息的更新频率 为14秒一次
This commit is contained in:
2026-06-16 17:34:00 +08:00
parent 52fe17c0d5
commit 71aea48d9f
61 changed files with 2896 additions and 1648 deletions

View File

@@ -623,4 +623,53 @@ class DevicesCubit extends Cubit<DevicesState> {
//print('🔄 [DevicesCubit] 已重置到达位置');
_logger.logWithLevel('🔄 [DevicesCubit] 已重置到达位置');
}
/// 🔥 获取当前选中的设备
DeviceEntity? getSelectedDevice() {
return state.selectedDevice;
}
/// 🔥 异步获取当前选中的设备(兼容 RemoteControlCubit 接口)
Future<DeviceEntity?> getDevice() async {
return state.selectedDevice;
}
/// 🔥 判断是否有选中设备
bool hasSelectedDevice() {
return state.selectedDevice != null;
}
/// 🔥 获取选中设备名称(安全获取,返回空字符串而非null)
String getSelectedDeviceName() {
return state.selectedDevice?.deviceName ?? '';
}
/// 🔥 获取选中设备ID(安全获取,返回空字符串而非null)
String getSelectedDeviceId() {
return state.selectedDevice?.deviceName ?? '';
}
/// 🔥 清除选中设备
void clearSelectedDevice() {
debugPrint('🧹 [DevicesCubit] 清除选中设备');
_logger.logWithLevel('🧹 [DevicesCubit] 清除选中设备');
emit(state.copyWith(selectedDevice: null));
}
/// 🔥 检查设备是否在列表中
bool isDeviceInList(String deviceName) {
return state.devices.any((device) => device.deviceName == deviceName);
}
/// 🔥 根据设备名称查找设备
DeviceEntity? findDeviceByName(String deviceName) {
try {
return state.devices.firstWhere(
(device) => device.deviceName == deviceName,
orElse: () => throw Exception('Device not found'),
);
} catch (e) {
return null;
}
}
}