Commit 4dff6ccd authored by 张宏's avatar 张宏

合并

parent cb552db0
...@@ -614,7 +614,7 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -614,7 +614,7 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
try { try {
await _bluetoothManager.scanForDevices( await _bluetoothManager.scanForDevices(
namePrefixes: const ['CNA'], namePrefixes: const [],
timeout: const Duration(seconds: 10), timeout: const Duration(seconds: 10),
); );
} catch (e) { } catch (e) {
...@@ -925,20 +925,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -925,20 +925,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
alarmId: alarm.alarmId, alarmId: alarm.alarmId,
); );
// 按告警标题去重:相同标题 → 原地覆盖;不同标题 → 插入头部 // 摄像头告警只保留最新一条,新消息直接覆盖
final existingIndex = emit(state.copyWith(cameraAlerts: [alert]));
state.cameraAlerts.indexWhere((a) => a.title == title);
if (existingIndex >= 0) {
// 已存在相同标题 → 原地替换
final updatedAlerts = List<AlertInfoBO>.from(state.cameraAlerts);
updatedAlerts[existingIndex] = alert;
emit(state.copyWith(cameraAlerts: updatedAlerts));
} else {
// 不存在 → 插入头部
emit(state.copyWith(
cameraAlerts: [alert, ...state.cameraAlerts],
));
}
} }
/// 处理 MQTT pet/bind 宠物绑定消息 /// 处理 MQTT pet/bind 宠物绑定消息
...@@ -1113,12 +1101,14 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -1113,12 +1101,14 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
// TODO: 待确认 BLE identifier 后补充 // TODO: 待确认 BLE identifier 后补充
case 'redLightDuration': case 'redLightDuration':
debugPrint('[IcuCommand] redLightDuration=$value — 待确认 BLE identifier'); debugPrint(
'[IcuCommand] redLightDuration=$value — 待确认 BLE identifier');
break; break;
// TODO: 待确认 BLE identifier 后补充 // TODO: 待确认 BLE identifier 后补充
case 'redLightInterval': case 'redLightInterval':
debugPrint('[IcuCommand] redLightInterval=$value — 待确认 BLE identifier'); debugPrint(
'[IcuCommand] redLightInterval=$value — 待确认 BLE identifier');
break; break;
// TODO: 待确认 BLE identifier 后补充 // TODO: 待确认 BLE identifier 后补充
...@@ -1552,12 +1542,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> { ...@@ -1552,12 +1542,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
if (client == null || if (client == null ||
!client.isConnected || !client.isConnected ||
deviceSn == null || deviceSn == null ||
deviceSn.isEmpty) { deviceSn.isEmpty) return;
return; if (alert.alarmId == null) return;
}
if (alert.alarmId == null) {
return;
}
try { try {
client.publishCameraAlarmResult( client.publishCameraAlarmResult(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment