初始提交
This commit is contained in:
11
bin/enum/BedStatus.dart
Normal file
11
bin/enum/BedStatus.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
enum BedStatus {
|
||||
using(0, "使用中"), //使用中
|
||||
no_using(1, "未使用"); //未使用
|
||||
|
||||
// 枚举的值
|
||||
final int code; // 整数值
|
||||
final String description; // 字符串描述
|
||||
|
||||
// 构造函数
|
||||
const BedStatus(this.code, this.description);
|
||||
}
|
||||
11
bin/enum/DeviceStatus.dart
Normal file
11
bin/enum/DeviceStatus.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
enum DeviceStatus {
|
||||
OFFLONE(0, "离线"), //离线
|
||||
ONLINE(1, "在线"); //在线
|
||||
|
||||
// 枚举的值
|
||||
final int code; // 整数值
|
||||
final String description; // 字符串描述
|
||||
|
||||
// 构造函数
|
||||
const DeviceStatus(this.code, this.description);
|
||||
}
|
||||
13
bin/enum/MessageStatus.dart
Normal file
13
bin/enum/MessageStatus.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
enum MessageStatus {
|
||||
//消息状态 0:无需处理 1:待处理 2:已处理
|
||||
notify(0, "无需处理"),
|
||||
waring(1, "待处理"),
|
||||
dealed(2, "已处理");
|
||||
|
||||
// 枚举的值
|
||||
final int code; // 整数值
|
||||
final String description; // 字符串描述
|
||||
|
||||
// 构造函数
|
||||
const MessageStatus(this.code, this.description);
|
||||
}
|
||||
80
bin/enum/ReportStatus.dart
Normal file
80
bin/enum/ReportStatus.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
/// 报告状态枚举
|
||||
enum ReportStatus {
|
||||
experienceing, // 0 - 体验中 ok
|
||||
generating, // 1 - 生成报告中 ok
|
||||
appNormalClose, // 2 - APP正常关闭 ok
|
||||
appAbnormalClose, // 3 - APP异常关闭 ok 可以捕获到的异常
|
||||
appActiveClose, // 4 - APP主动关闭 ok
|
||||
reportExceptionClose,// 5 - 报告生成异常关闭 ok
|
||||
completed, // 9 - 完成
|
||||
//网络断掉了怎么办?todo websocket心跳 弹窗提示 微信视频结束之后要将微信标志重置 监听网络状态
|
||||
//网络 蓝牙 视频播放 设备连接
|
||||
//todo 监听网络状态 失败了停止播放视频
|
||||
//todo 监听蓝牙状态 断掉就停止播放视频并且发送异常关闭
|
||||
//todo 重新打开app
|
||||
}
|
||||
|
||||
/// 扩展方法,提供数字映射和文本描述
|
||||
extension ReportStatusExtension on ReportStatus {
|
||||
/// 获取对应的数字状态值
|
||||
int get value {
|
||||
switch (this) {
|
||||
case ReportStatus.experienceing:
|
||||
return 0;
|
||||
case ReportStatus.generating:
|
||||
return 1;
|
||||
case ReportStatus.appNormalClose:
|
||||
return 2;
|
||||
case ReportStatus.appAbnormalClose:
|
||||
return 3;
|
||||
case ReportStatus.appActiveClose:
|
||||
return 4;
|
||||
case ReportStatus.reportExceptionClose:
|
||||
return 5;
|
||||
case ReportStatus.completed:
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取文本描述
|
||||
String get label {
|
||||
switch (this) {
|
||||
case ReportStatus.experienceing:
|
||||
return "体验中";
|
||||
case ReportStatus.generating:
|
||||
return "生成报告中";
|
||||
case ReportStatus.appNormalClose:
|
||||
return "APP正常关闭";
|
||||
case ReportStatus.appAbnormalClose:
|
||||
return "APP异常关闭";
|
||||
case ReportStatus.appActiveClose:
|
||||
return "APP主动关闭";
|
||||
case ReportStatus.reportExceptionClose:
|
||||
return "报告生成异常关闭";
|
||||
case ReportStatus.completed:
|
||||
return "完成";
|
||||
}
|
||||
}
|
||||
|
||||
/// 根据数字获取枚举
|
||||
static ReportStatus fromValue(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return ReportStatus.experienceing;
|
||||
case 1:
|
||||
return ReportStatus.generating;
|
||||
case 2:
|
||||
return ReportStatus.appNormalClose;
|
||||
case 3:
|
||||
return ReportStatus.appAbnormalClose;
|
||||
case 4:
|
||||
return ReportStatus.appActiveClose;
|
||||
case 5:
|
||||
return ReportStatus.reportExceptionClose;
|
||||
case 9:
|
||||
return ReportStatus.completed;
|
||||
default:
|
||||
throw Exception("未知报告状态: $value");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
bin/enum/StatisticsResultType.dart
Normal file
11
bin/enum/StatisticsResultType.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
enum StatisticsResultType {
|
||||
score(1, "睡眠评分统计"),
|
||||
hrv(2, "hrv统计");
|
||||
|
||||
// 枚举的值
|
||||
final int code; // 整数值
|
||||
final String description; // 字符串描述
|
||||
|
||||
// 构造函数
|
||||
const StatisticsResultType(this.code, this.description);
|
||||
}
|
||||
12
bin/enum/StatisticsType.dart
Normal file
12
bin/enum/StatisticsType.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
enum StatisticsType {
|
||||
area("1", "区域统计"),
|
||||
room("2", "房间统计"),
|
||||
person("3", "个人统计"); //在线
|
||||
|
||||
// 枚举的值
|
||||
final String code; // 整数值
|
||||
final String description; // 字符串描述
|
||||
|
||||
// 构造函数
|
||||
const StatisticsType(this.code, this.description);
|
||||
}
|
||||
Reference in New Issue
Block a user