health_kit_raw_data_api.dart
3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import 'package:pigeon/pigeon.dart';
class HealthKitRawDataPoint {
int dataType;
int startTime;
int endTime;
double? value;
bool? isMotionLike;
HealthKitRawDataPoint({
required this.dataType,
required this.startTime,
required this.endTime,
this.value,
this.isMotionLike,
});
}
class HealthKitRawSleepDataPoint {
int dataType;
List<HealthKitRawDataPoint> sleepDataPoints;
HealthKitRawSleepDataPoint({
required this.dataType,
required this.sleepDataPoints,
});
}
class HealthKitRawWorkoutDataPoint {
int workoutType;
int startTime;
int endTime;
HealthKitRawWorkoutDataPoint({
required this.workoutType,
required this.startTime,
required this.endTime,
});
}
class HealthKitRawMotionDataPoint {
int motionType;
int startTime;
int endTime;
HealthKitRawMotionDataPoint({
required this.motionType,
required this.startTime,
required this.endTime,
});
}
class HealthKitRawActivityDataPoint {
int endTime;
// 千卡
double? activeEnergyBurned;
double? activeEnergyBurnedGoal;
// 公里
double? appleMoveTime;
double? appleMoveTimeGoal;
// 分钟
double? appleExerciseTime;
double? exerciseTimeGoal;
//小时
double? appleStandHours;
double? standHoursGoal;
HealthKitRawActivityDataPoint({
required this.endTime,
this.activeEnergyBurned,
this.activeEnergyBurnedGoal,
this.appleMoveTime,
this.appleMoveTimeGoal,
this.appleExerciseTime,
this.exerciseTimeGoal,
this.appleStandHours,
this.standHoursGoal,
});
}
@ConfigurePigeon(
PigeonOptions(
dartOut: 'lib/pigeon/health_kit_raw_data_api.g.dart',
dartPackageName: 'doublefeel_flutter',
dartOptions: DartOptions(),
swiftOut: 'ios/Runner/Pigeon/HealthKitRawDataApi.swift',
swiftOptions: SwiftOptions(),
copyrightHeader: 'pigeon/copyright.txt',
),
)
@HostApi()
abstract class HealthKitRawDataHostApi {
/// 是否有AppleHealth数据
@async
bool hasHealthData();
/// 从AppleHealth 中读取原始数据
@async
List<HealthKitRawDataPoint> getHealthKitRawData(
int dataType, int startTime, int endTime);
/// 原生数据上传
@async
bool performHealthDataUpload();
/// 上传心率 - 实时压力数据, 返回上传截止的时间戳, 方便flutter修改数据库
@async
int performHRDataUpload({required String sqliteFilePath});
/// 上传HRV - HRV压力数据, 返回上传截止的时间戳,方便flutter 修改数据库
@async
int performHRVDataUpload({required String sqliteFilePath});
/// 上传睡眠统计数据
@async
int performSleepAnalysisDataUpload({required String sqliteFilePath});
/// 上传当前实时压力(统计维度是当天)
@async
int performAvgRealtimeStressDataUpload({required String sqliteFilePath});
/// 从从AppleHealth中读取睡眠数据
@async
List<HealthKitRawSleepDataPoint> getHealthKitRawSleepData(
int startTime, int endTime);
/// 从从AppleHealth中读取活动统计数据
@async
List<HealthKitRawActivityDataPoint> getHealthKitRawActivityData(
int startTime, int endTime);
/// 从从AppleHealth中读取锻炼数据
@async
List<HealthKitRawWorkoutDataPoint> getHealthKitRawWorkoutData(
int startTime, int endTime);
}