Commit 54acb255 authored by akari's avatar akari

feat: 添加蓝牙控制打印日志

parent 74d50b40
...@@ -5,6 +5,7 @@ import 'package:hydrated_bloc/hydrated_bloc.dart'; ...@@ -5,6 +5,7 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'device_control_event.dart'; import 'device_control_event.dart';
import 'device_control_state.dart'; import 'device_control_state.dart';
import 'package:laki_icu_app/models/bo/device_control_bo.dart'; import 'package:laki_icu_app/models/bo/device_control_bo.dart';
import 'package:laki_icu_app/models/bo/bluetooth_read_model.dart';
import 'package:laki_icu_app/utils/bluetooth/index.dart'; import 'package:laki_icu_app/utils/bluetooth/index.dart';
import 'package:laki_icu_app/utils/event_bus.dart'; import 'package:laki_icu_app/utils/event_bus.dart';
import 'package:laki_icu_app/utils/logger.dart'; import 'package:laki_icu_app/utils/logger.dart';
...@@ -181,6 +182,11 @@ class DeviceControlBloc ...@@ -181,6 +182,11 @@ class DeviceControlBloc
); );
if (reports.isEmpty || isClosed) return; if (reports.isEmpty || isClosed) return;
final latestReport = reports.last; final latestReport = reports.last;
eventBus.emit(
BluetoothReadInfoChangedEvent(
BluetoothReadModel.fromMcuReport(latestReport),
),
);
eventBus.emit(McuReportChangedEvent(latestReport)); eventBus.emit(McuReportChangedEvent(latestReport));
} catch (e) { } catch (e) {
Log.warn('🔥🔥🔥 BLE_READ_DEBUG device_control_parse_error error=$e'); Log.warn('🔥🔥🔥 BLE_READ_DEBUG device_control_parse_error error=$e');
...@@ -210,19 +216,31 @@ class DeviceControlBloc ...@@ -210,19 +216,31 @@ class DeviceControlBloc
sn: report.sn.isEmpty ? state.data.sn : report.sn, sn: report.sn.isEmpty ? state.data.sn : report.sn,
cabinTemp: state.data.cabinTemp.copyWith( cabinTemp: state.data.cabinTemp.copyWith(
currentValue: _formatTemperature(report.mainTemperature), currentValue: _formatTemperature(report.mainTemperature),
setValue: _formatTemperature(report.temperatureSetting), setValue: _formatTemperatureOrKeep(
report.temperatureSetting,
state.data.cabinTemp.setValue,
),
), ),
cabinHumidity: state.data.cabinHumidity.copyWith( cabinHumidity: state.data.cabinHumidity.copyWith(
currentValue: _formatInt(report.humidity), currentValue: _formatInt(report.humidity),
setValue: _formatInt(report.humiditySetting), setValue: _formatIntOrKeep(
report.humiditySetting,
state.data.cabinHumidity.setValue,
),
), ),
oxygenConcentration: state.data.oxygenConcentration.copyWith( oxygenConcentration: state.data.oxygenConcentration.copyWith(
currentValue: _formatInt(report.oxygenConcentration), currentValue: _formatInt(report.oxygenConcentration),
setValue: _formatInt(report.oxygenSetting), setValue: _formatIntOrKeep(
report.oxygenSetting,
state.data.oxygenConcentration.setValue,
),
), ),
co2Concentration: state.data.co2Concentration.copyWith( co2Concentration: state.data.co2Concentration.copyWith(
currentValue: _formatInt(report.co2Measurement), currentValue: _formatInt(report.co2Measurement),
alarmThreshold: _formatInt(report.co2Setting), alarmThreshold: _formatIntOrKeep(
report.co2Setting,
state.data.co2Concentration.alarmThreshold,
),
), ),
); );
emit(state.copyWith(data: newData, clearError: true)); emit(state.copyWith(data: newData, clearError: true));
...@@ -287,6 +305,10 @@ class DeviceControlBloc ...@@ -287,6 +305,10 @@ class DeviceControlBloc
) async { ) async {
final currentValue = int.tryParse(state.data.cabinTemp.setValue) ?? 0; final currentValue = int.tryParse(state.data.cabinTemp.setValue) ?? 0;
final nextValue = (currentValue + event.step).clamp(0, 99); final nextValue = (currentValue + event.step).clamp(0, 99);
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG cabin_temp_adjust '
'current=$currentValue step=${event.step} next=$nextValue',
);
await _setCabinTempSetValue('$nextValue', emit); await _setCabinTempSetValue('$nextValue', emit);
} }
...@@ -304,6 +326,9 @@ class DeviceControlBloc ...@@ -304,6 +326,9 @@ class DeviceControlBloc
userSettings: state.userSettings.copyWith(cabinTempSetValue: setValue), userSettings: state.userSettings.copyWith(cabinTempSetValue: setValue),
clearError: true, clearError: true,
)); ));
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG cabin_temp_set_value value=$setValue',
);
await _writeControlValueToBluetooth( await _writeControlValueToBluetooth(
identifier: 0x02, identifier: 0x02,
setValue: setValue, setValue: setValue,
...@@ -361,6 +386,10 @@ class DeviceControlBloc ...@@ -361,6 +386,10 @@ class DeviceControlBloc
) async { ) async {
final currentValue = int.tryParse(state.data.cabinHumidity.setValue) ?? 0; final currentValue = int.tryParse(state.data.cabinHumidity.setValue) ?? 0;
final nextValue = (currentValue + event.step).clamp(0, 100); final nextValue = (currentValue + event.step).clamp(0, 100);
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG cabin_humidity_adjust '
'current=$currentValue step=${event.step} next=$nextValue',
);
await _setCabinHumiditySetValue('$nextValue', emit); await _setCabinHumiditySetValue('$nextValue', emit);
} }
...@@ -379,6 +408,9 @@ class DeviceControlBloc ...@@ -379,6 +408,9 @@ class DeviceControlBloc
state.userSettings.copyWith(cabinHumiditySetValue: setValue), state.userSettings.copyWith(cabinHumiditySetValue: setValue),
clearError: true, clearError: true,
)); ));
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG cabin_humidity_set_value value=$setValue',
);
await _writeControlValueToBluetooth( await _writeControlValueToBluetooth(
identifier: 0x04, identifier: 0x04,
setValue: setValue, setValue: setValue,
...@@ -436,6 +468,10 @@ class DeviceControlBloc ...@@ -436,6 +468,10 @@ class DeviceControlBloc
final currentValue = final currentValue =
int.tryParse(state.data.oxygenConcentration.setValue) ?? 0; int.tryParse(state.data.oxygenConcentration.setValue) ?? 0;
final nextValue = (currentValue + event.step).clamp(0, 100); final nextValue = (currentValue + event.step).clamp(0, 100);
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG oxygen_concentration_adjust '
'current=$currentValue step=${event.step} next=$nextValue',
);
await _setOxygenConcentrationSetValue('$nextValue', emit); await _setOxygenConcentrationSetValue('$nextValue', emit);
} }
...@@ -454,6 +490,9 @@ class DeviceControlBloc ...@@ -454,6 +490,9 @@ class DeviceControlBloc
state.userSettings.copyWith(oxygenConcentrationSetValue: setValue), state.userSettings.copyWith(oxygenConcentrationSetValue: setValue),
clearError: true, clearError: true,
)); ));
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG oxygen_concentration_set_value value=$setValue',
);
await _writeControlValueToBluetooth( await _writeControlValueToBluetooth(
identifier: 0x05, identifier: 0x05,
setValue: setValue, setValue: setValue,
...@@ -512,6 +551,10 @@ class DeviceControlBloc ...@@ -512,6 +551,10 @@ class DeviceControlBloc
final currentValue = final currentValue =
int.tryParse(state.data.co2Concentration.alarmThreshold) ?? 0; int.tryParse(state.data.co2Concentration.alarmThreshold) ?? 0;
final nextValue = (currentValue + event.step).clamp(0, 9999); final nextValue = (currentValue + event.step).clamp(0, 9999);
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG co2_alarm_threshold_adjust '
'current=$currentValue step=${event.step} next=$nextValue',
);
await _setCO2ConcentrationAlarmThreshold('$nextValue', emit); await _setCO2ConcentrationAlarmThreshold('$nextValue', emit);
} }
...@@ -530,6 +573,10 @@ class DeviceControlBloc ...@@ -530,6 +573,10 @@ class DeviceControlBloc
state.userSettings.copyWith(co2AlarmThreshold: alarmThreshold), state.userSettings.copyWith(co2AlarmThreshold: alarmThreshold),
clearError: true, clearError: true,
)); ));
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG co2_alarm_threshold_set_value '
'value=$alarmThreshold',
);
await _writeControlValueToBluetooth( await _writeControlValueToBluetooth(
identifier: 0x31, identifier: 0x31,
setValue: alarmThreshold, setValue: alarmThreshold,
...@@ -860,6 +907,13 @@ class DeviceControlBloc ...@@ -860,6 +907,13 @@ class DeviceControlBloc
await _bluetoothManager.connectToDeviceId(deviceId); await _bluetoothManager.connectToDeviceId(deviceId);
} }
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG send_control '
'identifier=0x${identifier.toRadixString(16).padLeft(2, '0').toUpperCase()} '
'value=$setValue scale=$scale '
'hex=${BleBluetoothManager.bytesToHex(command)} '
'isConnected=${_bluetoothManager.isConnected}',
);
await _bluetoothManager.writeData(command); await _bluetoothManager.writeData(command);
} catch (e) { } catch (e) {
emit(state.copyWith(error: '$errorPrefix发送失败: $e')); emit(state.copyWith(error: '$errorPrefix发送失败: $e'));
...@@ -893,10 +947,18 @@ class DeviceControlBloc ...@@ -893,10 +947,18 @@ class DeviceControlBloc
return fixed.endsWith('.0') ? fixed.substring(0, fixed.length - 2) : fixed; return fixed.endsWith('.0') ? fixed.substring(0, fixed.length - 2) : fixed;
} }
String _formatTemperatureOrKeep(double value, String fallback) {
return value.isNaN ? fallback : _formatTemperature(value);
}
String _formatInt(int value) { String _formatInt(int value) {
return value < 0 ? '--' : '$value'; return value < 0 ? '--' : '$value';
} }
String _formatIntOrKeep(int value, String fallback) {
return value < 0 ? fallback : '$value';
}
@override @override
Future<void> close() async { Future<void> close() async {
await _mcuReportSub.cancel(); await _mcuReportSub.cancel();
......
...@@ -376,6 +376,15 @@ class BleBluetoothManager<T> { ...@@ -376,6 +376,15 @@ class BleBluetoothManager<T> {
return; return;
} }
final hex = bytesToHex(data);
Log.warn(
'🔥🔥🔥 BLE_WRITE_DEBUG write_data '
'deviceId=${characteristic.deviceId} '
'service=${characteristic.serviceId} '
'characteristic=${characteristic.characteristicId} '
'withoutResponse=$withoutResponse '
'hex=$hex',
);
try { try {
if (withoutResponse) { if (withoutResponse) {
await _ble.writeCharacteristicWithoutResponse( await _ble.writeCharacteristicWithoutResponse(
...@@ -385,9 +394,11 @@ class BleBluetoothManager<T> { ...@@ -385,9 +394,11 @@ class BleBluetoothManager<T> {
} else { } else {
await _ble.writeCharacteristicWithResponse(characteristic, value: data); await _ble.writeCharacteristicWithResponse(characteristic, value: data);
} }
_notifyMessage('蓝牙数据发送成功: ${bytesToHex(data)}'); Log.warn('🔥🔥🔥 BLE_WRITE_DEBUG write_success hex=$hex');
_notifyMessage('蓝牙数据发送成功: $hex');
_sendResultController.add(true); _sendResultController.add(true);
} catch (error) { } catch (error) {
Log.warn('🔥🔥🔥 BLE_WRITE_DEBUG write_error hex=$hex error=$error');
_notifyMessage('蓝牙数据发送失败: $error'); _notifyMessage('蓝牙数据发送失败: $error');
_sendResultController.add(false); _sendResultController.add(false);
} }
......
...@@ -34,6 +34,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -34,6 +34,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
StreamSubscription<BluetoothConnectionStatus>? _bluetoothStateSub; StreamSubscription<BluetoothConnectionStatus>? _bluetoothStateSub;
StreamSubscription<String>? _bluetoothMessageSub; StreamSubscription<String>? _bluetoothMessageSub;
StreamSubscription<BluetoothDataPacket>? _bluetoothDataSub; StreamSubscription<BluetoothDataPacket>? _bluetoothDataSub;
StreamSubscription<BluetoothReadInfoChangedEvent>? _bluetoothReadInfoSub;
StreamSubscription<McuReportChangedEvent>? _mcuReportChangedSub; StreamSubscription<McuReportChangedEvent>? _mcuReportChangedSub;
StreamSubscription<LakiMqttConnectionState>? _mqttStateSub; StreamSubscription<LakiMqttConnectionState>? _mqttStateSub;
StreamSubscription<LakiMqttMessage>? _mqttMessageSub; StreamSubscription<LakiMqttMessage>? _mqttMessageSub;
...@@ -62,6 +63,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -62,6 +63,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
_listenWebrtcState(); _listenWebrtcState();
_listenP2pState(); _listenP2pState();
_listenBluetoothState(); _listenBluetoothState();
_listenBluetoothReadInfo();
_listenMcuReportChanged(); _listenMcuReportChanged();
_loadBoundBluetoothDevice(); _loadBoundBluetoothDevice();
loadData(); loadData();
...@@ -170,13 +172,40 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -170,13 +172,40 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
void _listenMcuReportChanged() { void _listenMcuReportChanged() {
_mcuReportChangedSub = eventBus.on<McuReportChangedEvent>().listen((event) { _mcuReportChangedSub = eventBus.on<McuReportChangedEvent>().listen((event) {
if (isClosed) return; if (isClosed) return;
final metrics = _metricsFromBluetoothReport(event.report);
Log.warn(
'🔥🔥🔥 BLE_READ_DEBUG index_metrics_from_report '
'${_metricsLogText(metrics)}',
);
emit(state.copyWith( emit(state.copyWith(
latestMcuReport: event.report, latestMcuReport: event.report,
metrics: _metricsFromBluetoothReport(event.report), metrics: metrics,
)); ));
}); });
} }
void _listenBluetoothReadInfo() {
_bluetoothReadInfoSub =
eventBus.on<BluetoothReadInfoChangedEvent>().listen((event) {
if (isClosed) return;
final metrics = _metricsFromBluetoothReadInfo(event.info);
if (metrics == null) {
Log.warn(
'🔥🔥🔥 BLE_READ_DEBUG index_read_info_no_metrics '
'sn=${event.info.sn} temp=${event.info.mainTemperature} '
'humidity=${event.info.humidity} o2=${event.info.oxygenConcentration} '
'co2=${event.info.co2Measurement}',
);
return;
}
Log.warn(
'🔥🔥🔥 BLE_READ_DEBUG index_metrics_from_read_info '
'${_metricsLogText(metrics)}',
);
emit(state.copyWith(metrics: metrics));
});
}
String _appendBluetoothSideToSn(String sn) { String _appendBluetoothSideToSn(String sn) {
final cleanSn = sn.trim(); final cleanSn = sn.trim();
if (cleanSn.isEmpty) return ''; if (cleanSn.isEmpty) return '';
...@@ -232,8 +261,8 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -232,8 +261,8 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
)); ));
try { try {
final metrics = await _monitoringService.getMetrics(); // final metrics = await _monitoringService.getMetrics();
if (isClosed) return; // if (isClosed) return;
final patientInfo = await _monitoringService.getPatientInfo(); final patientInfo = await _monitoringService.getPatientInfo();
if (isClosed) return; if (isClosed) return;
final alerts = await _monitoringService.getAlerts(); final alerts = await _monitoringService.getAlerts();
...@@ -242,7 +271,6 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -242,7 +271,6 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
emit(state.copyWith( emit(state.copyWith(
status: MonitoringIndexStatus.success, status: MonitoringIndexStatus.success,
isLoading: false, isLoading: false,
metrics: metrics,
patientInfo: patientInfo, patientInfo: patientInfo,
alerts: alerts, alerts: alerts,
error: null, error: null,
...@@ -347,8 +375,8 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -347,8 +375,8 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
Future<void> refreshData() async { Future<void> refreshData() async {
try { try {
final metrics = await _monitoringService.getMetrics(); // final metrics = await _monitoringService.getMetrics();
if (isClosed) return; // if (isClosed) return;
final patientInfo = await _monitoringService.getPatientInfo(); final patientInfo = await _monitoringService.getPatientInfo();
if (isClosed) return; if (isClosed) return;
final alerts = await _monitoringService.getAlerts(); final alerts = await _monitoringService.getAlerts();
...@@ -356,7 +384,6 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -356,7 +384,6 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
emit(state.copyWith( emit(state.copyWith(
status: MonitoringIndexStatus.success, status: MonitoringIndexStatus.success,
metrics: metrics,
patientInfo: patientInfo, patientInfo: patientInfo,
alerts: alerts, alerts: alerts,
error: null, error: null,
...@@ -666,36 +693,98 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -666,36 +693,98 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
_mqttClient = null; _mqttClient = null;
} }
List<MonitoringMetricBO> _metricsFromBluetoothReport(McuReport report) { List<MonitoringMetricBO> _metricsFromBluetoothReport(
McuReport report, {
List<MonitoringMetricBO>? baseMetrics,
}) {
final metrics = baseMetrics ?? state.metrics;
final replacements = <String, MonitoringMetricBO>{
'舱内温度': _replaceMetricValue(
'舱内温度',
_formatReportTemperatureOrKeep(report.mainTemperature, '舱内温度'),
fallbackUnit: '℃',
baseMetrics: metrics,
),
'舱内湿度': _replaceMetricValue(
'舱内湿度',
_formatReportIntOrKeep(report.humidity, '舱内湿度'),
fallbackUnit: 'RH',
baseMetrics: metrics,
),
'氧气浓度': _replaceMetricValue(
'氧气浓度',
_formatReportIntOrKeep(report.oxygenConcentration, '氧气浓度'),
fallbackUnit: '%',
baseMetrics: metrics,
),
'二氧化碳': _replaceMetricValue(
'二氧化碳',
_formatReportIntOrKeep(report.co2Measurement, '二氧化碳'),
fallbackUnit: 'ppm',
baseMetrics: metrics,
),
};
if (metrics.isEmpty) {
return replacements.values.toList();
}
return [
for (final metric in metrics) replacements[metric.label] ?? metric,
];
}
List<MonitoringMetricBO>? _metricsFromBluetoothReadInfo(
BluetoothReadModel info,
) {
final hasMetric = info.mainTemperature != null ||
info.humidity != null ||
info.oxygenConcentration != null ||
info.co2Measurement != null;
if (!hasMetric) return null;
final metrics = state.metrics;
final replacements = <String, MonitoringMetricBO>{ final replacements = <String, MonitoringMetricBO>{
'舱内温度': _replaceMetricValue( '舱内温度': _replaceMetricValue(
'舱内温度', '舱内温度',
_formatReportTemperature(report.mainTemperature), info.mainTemperature == null
? _existingMetricValue('舱内温度') ?? '--'
: _formatReportTemperature(info.mainTemperature!),
fallbackUnit: '℃', fallbackUnit: '℃',
baseMetrics: metrics,
), ),
'舱内湿度': _replaceMetricValue( '舱内湿度': _replaceMetricValue(
'舱内湿度', '舱内湿度',
_formatReportInt(report.humidity), info.humidity == null
? _existingMetricValue('舱内湿度') ?? '--'
: '${info.humidity}',
fallbackUnit: 'RH', fallbackUnit: 'RH',
baseMetrics: metrics,
), ),
'氧气浓度': _replaceMetricValue( '氧气浓度': _replaceMetricValue(
'氧气浓度', '氧气浓度',
_formatReportInt(report.oxygenConcentration), info.oxygenConcentration == null
? _existingMetricValue('氧气浓度') ?? '--'
: '${info.oxygenConcentration}',
fallbackUnit: '%', fallbackUnit: '%',
baseMetrics: metrics,
), ),
'二氧化碳': _replaceMetricValue( '二氧化碳': _replaceMetricValue(
'二氧化碳', '二氧化碳',
_formatReportInt(report.co2Measurement), info.co2Measurement == null
? _existingMetricValue('二氧化碳') ?? '--'
: '${info.co2Measurement}',
fallbackUnit: 'ppm', fallbackUnit: 'ppm',
baseMetrics: metrics,
), ),
}; };
if (state.metrics.isEmpty) { if (metrics.isEmpty) {
return replacements.values.toList(); return replacements.values.toList();
} }
return [ return [
for (final metric in state.metrics) replacements[metric.label] ?? metric, for (final metric in metrics) replacements[metric.label] ?? metric,
]; ];
} }
...@@ -703,9 +792,11 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -703,9 +792,11 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
String label, String label,
String value, { String value, {
required String fallbackUnit, required String fallbackUnit,
List<MonitoringMetricBO>? baseMetrics,
}) { }) {
final metrics = baseMetrics ?? state.metrics;
MonitoringMetricBO? existing; MonitoringMetricBO? existing;
for (final metric in state.metrics) { for (final metric in metrics) {
if (metric.label == label) { if (metric.label == label) {
existing = metric; existing = metric;
break; break;
...@@ -733,8 +824,29 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -733,8 +824,29 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
return fixed.endsWith('.0') ? fixed.substring(0, fixed.length - 2) : fixed; return fixed.endsWith('.0') ? fixed.substring(0, fixed.length - 2) : fixed;
} }
String _formatReportInt(int value) { String _formatReportTemperatureOrKeep(double value, String label) {
return value < 0 ? '--' : '$value'; if (!value.isNaN) return _formatReportTemperature(value);
return _existingMetricValue(label) ?? '--';
}
String _formatReportIntOrKeep(int value, String label) {
if (value >= 0) return '$value';
return _existingMetricValue(label) ?? '--';
}
String? _existingMetricValue(String label) {
for (final metric in state.metrics) {
if (metric.label == label && metric.value != '--') {
return metric.value;
}
}
return null;
}
String _metricsLogText(List<MonitoringMetricBO> metrics) {
return metrics
.map((item) => '${item.label}=${item.value}${item.unit}')
.join(' ');
} }
/// 清空宠物信息(出舱) /// 清空宠物信息(出舱)
...@@ -777,6 +889,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -777,6 +889,7 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
_bluetoothStateSub?.cancel(); _bluetoothStateSub?.cancel();
_bluetoothMessageSub?.cancel(); _bluetoothMessageSub?.cancel();
_bluetoothDataSub?.cancel(); _bluetoothDataSub?.cancel();
_bluetoothReadInfoSub?.cancel();
_mcuReportChangedSub?.cancel(); _mcuReportChangedSub?.cancel();
_webrtcService.dispose(); _webrtcService.dispose();
_p2pVideoService.dispose(); _p2pVideoService.dispose();
......
...@@ -112,7 +112,7 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> { ...@@ -112,7 +112,7 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> {
children: [ children: [
Expanded( Expanded(
flex: 32, flex: 32,
child: state.metrics.isEmpty ? _buildMetricsEmpty() : _buildMetrics(state.metrics), child: _buildMetrics(state.metrics),
), ),
SizedBox(height: 24.h), SizedBox(height: 24.h),
Expanded( Expanded(
...@@ -149,6 +149,7 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> { ...@@ -149,6 +149,7 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> {
); );
} }
// ignore: unused_element
Widget _buildMetricsEmpty() { Widget _buildMetricsEmpty() {
return Container( return Container(
width: double.infinity, width: double.infinity,
......
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