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;
}
