- 通用 BLE 健康设备识别(血压计/血糖仪/体重秤/血氧仪 标准 service UUID) - 蓝牙设备页静默自动同步:仅匹配已绑定的设备名+类型,收到数据后变绿 - 新增设备页:扫描所有支持类型设备 → 选连接 → 绑定 + 同步首次数据 - 修复 read 缓存导致的重复录入循环(删除主动 read,依赖 indicate 推送) - 修复 isConnected 缓存状态导致连接异常(强制先 disconnect 再 connect) - 录入弹窗:血压心率同等级展示、3 秒自动关闭/手动确认 - 顺手更新本机开发 IP 与清理过时设计文档
48 lines
1.1 KiB
Dart
48 lines
1.1 KiB
Dart
/// 血压测量数据模型
|
|
class BpReading {
|
|
final int systolic;
|
|
final int diastolic;
|
|
final int? pulse;
|
|
final DateTime timestamp;
|
|
final String? userId;
|
|
final bool isKpa;
|
|
final bool hasBodyMovement;
|
|
final bool hasIrregularPulse;
|
|
final bool hasDeviceTimestamp;
|
|
|
|
const BpReading({
|
|
required this.systolic,
|
|
required this.diastolic,
|
|
this.pulse,
|
|
required this.timestamp,
|
|
this.userId,
|
|
this.isKpa = false,
|
|
this.hasBodyMovement = false,
|
|
this.hasIrregularPulse = false,
|
|
this.hasDeviceTimestamp = false,
|
|
});
|
|
|
|
String get display => '$systolic/$diastolic';
|
|
|
|
Map<String, dynamic> toHealthRecord() => {
|
|
'type': 'BloodPressure',
|
|
'systolic': systolic,
|
|
'diastolic': diastolic,
|
|
'source': 'DeviceSync',
|
|
'unit': 'mmHg',
|
|
'recordedAt': timestamp.toUtc().toIso8601String(),
|
|
};
|
|
|
|
Map<String, dynamic>? toHeartRateRecord() {
|
|
final value = pulse;
|
|
if (value == null || value <= 0) return null;
|
|
return {
|
|
'type': 'HeartRate',
|
|
'value': value,
|
|
'source': 'DeviceSync',
|
|
'unit': 'bpm',
|
|
'recordedAt': timestamp.toUtc().toIso8601String(),
|
|
};
|
|
}
|
|
}
|