Files
tuiche/lib/model/BleDeviceData.dart
2025-04-28 15:37:58 +08:00

38 lines
1006 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class BleDeviceData {
final int type; // 协议版本
final int sn; // 广播包序号低8位
final String deviceId; // 设备唯一地址6字节
final int bre; // 呼吸
final int ht; // 心率
final int active; // 体动等级
final int flag; // 设备属性
final int version; // 软件版本
final int qsn; // 广播帧序列号高16位
bool? bind = false; // 设备状态
String? name; //设备名称
int? rssi;
String? mac; //mac地址
BleDeviceData? slave;//从设备
BleDeviceData({
required this.type,
required this.sn,
required this.deviceId,
required this.bre,
required this.ht,
required this.active,
required this.flag,
required this.version,
required this.qsn,
});
int get fullSeq => qsn * 256 + sn;
bool get isOnline => (flag & 0x01) != 0;
bool get sensorError => (flag & 0x02) != 0;
bool get apnea => (flag & 0x04) != 0;
bool get inBed => (flag & 0x08) != 0;
bool get expired => (flag & 0x10) != 0;
}