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

合并

parent cb552db0
......@@ -614,7 +614,7 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
try {
await _bluetoothManager.scanForDevices(
namePrefixes: const ['CNA'],
namePrefixes: const [],
timeout: const Duration(seconds: 10),
);
} catch (e) {
......@@ -925,20 +925,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
alarmId: alarm.alarmId,
);
// 按告警标题去重:相同标题 → 原地覆盖;不同标题 → 插入头部
final existingIndex =
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],
));
}
// 摄像头告警只保留最新一条,新消息直接覆盖
emit(state.copyWith(cameraAlerts: [alert]));
}
/// 处理 MQTT pet/bind 宠物绑定消息
......@@ -1113,12 +1101,14 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
// TODO: 待确认 BLE identifier 后补充
case 'redLightDuration':
debugPrint('[IcuCommand] redLightDuration=$value — 待确认 BLE identifier');
debugPrint(
'[IcuCommand] redLightDuration=$value — 待确认 BLE identifier');
break;
// TODO: 待确认 BLE identifier 后补充
case 'redLightInterval':
debugPrint('[IcuCommand] redLightInterval=$value — 待确认 BLE identifier');
debugPrint(
'[IcuCommand] redLightInterval=$value — 待确认 BLE identifier');
break;
// TODO: 待确认 BLE identifier 后补充
......@@ -1552,12 +1542,8 @@ class MonitoringIndexCubit extends HydratedCubit<MonitoringIndexState> {
if (client == null ||
!client.isConnected ||
deviceSn == null ||
deviceSn.isEmpty) {
return;
}
if (alert.alarmId == null) {
return;
}
deviceSn.isEmpty) return;
if (alert.alarmId == null) return;
try {
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