trackswap 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FIT/base.d.ts +91 -0
- package/dist/FIT/base.js +101 -0
- package/dist/FIT/crc.d.ts +1 -0
- package/dist/FIT/crc.js +16 -0
- package/dist/FIT/decoder.d.ts +83 -0
- package/dist/FIT/decoder.js +323 -0
- package/dist/FIT/encoder.d.ts +142 -0
- package/dist/FIT/encoder.js +445 -0
- package/dist/FIT/index.d.ts +12 -0
- package/dist/FIT/index.js +13 -0
- package/dist/FIT/mesg.d.ts +40 -0
- package/dist/FIT/mesg.js +208 -0
- package/dist/FIT/middleware.d.ts +48 -0
- package/dist/FIT/middleware.js +206 -0
- package/dist/FIT/plugins.d.ts +26 -0
- package/dist/FIT/plugins.js +104 -0
- package/dist/FIT/processor.d.ts +58 -0
- package/dist/FIT/processor.js +170 -0
- package/dist/FIT/types/course_point.d.ts +56 -0
- package/dist/FIT/types/course_point.js +58 -0
- package/dist/FIT/types/event.d.ts +49 -0
- package/dist/FIT/types/event.js +50 -0
- package/dist/FIT/types/event_type.d.ts +18 -0
- package/dist/FIT/types/event_type.js +19 -0
- package/dist/FIT/types/file.d.ts +23 -0
- package/dist/FIT/types/file.js +24 -0
- package/dist/FIT/types/index.d.ts +119 -0
- package/dist/FIT/types/index.js +297 -0
- package/dist/FIT/types/mesg_num.d.ts +105 -0
- package/dist/FIT/types/mesg_num.js +106 -0
- package/dist/FIT/types/sport.d.ts +47 -0
- package/dist/FIT/types/sport.js +48 -0
- package/dist/FIT/types.d.ts +231 -0
- package/dist/FIT/types.js +1 -0
- package/dist/FIT/util.d.ts +1 -0
- package/dist/FIT/util.js +7 -0
- package/dist/GPX/base.d.ts +43 -67
- package/dist/GPX/base.js +40 -67
- package/dist/GPX/converters.d.ts +12 -36
- package/dist/GPX/converters.js +11 -103
- package/dist/GPX/decoder.d.ts +5 -5
- package/dist/GPX/decoder.js +6 -0
- package/dist/GPX/encoder.d.ts +4 -0
- package/dist/GPX/encoder.js +3 -0
- package/dist/GPX/index.d.ts +1 -1
- package/dist/GPX/index.js +1 -1
- package/dist/GPX/middleware.d.ts +27 -0
- package/dist/GPX/middleware.js +93 -0
- package/dist/GPX/processor.d.ts +1 -1
- package/dist/GPX/processor.js +12 -11
- package/dist/GPX/types.d.ts +2 -3
- package/dist/TCX/base.d.ts +52 -0
- package/dist/TCX/base.js +62 -0
- package/dist/TCX/converters.d.ts +75 -0
- package/dist/TCX/converters.js +333 -0
- package/dist/TCX/decoder.d.ts +87 -0
- package/dist/TCX/decoder.js +350 -0
- package/dist/TCX/encoder.d.ts +150 -0
- package/dist/TCX/encoder.js +513 -0
- package/dist/TCX/index.d.ts +10 -0
- package/dist/TCX/index.js +9 -0
- package/dist/TCX/middleware.d.ts +27 -0
- package/dist/TCX/middleware.js +93 -0
- package/dist/TCX/processor.d.ts +48 -0
- package/dist/TCX/processor.js +197 -0
- package/dist/TCX/types.d.ts +203 -0
- package/dist/TCX/types.js +1 -0
- package/dist/core/base.d.ts +119 -0
- package/dist/core/base.js +138 -0
- package/dist/core/decoder.d.ts +66 -0
- package/dist/core/decoder.js +90 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +4 -0
- package/dist/core/processor.d.ts +69 -0
- package/dist/core/processor.js +265 -0
- package/dist/core/xml-utils.d.ts +41 -0
- package/dist/core/xml-utils.js +140 -0
- package/package.json +8 -5
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// 移除旧的 FITProcessor 类,所有内容都在上面的流水线处理器中实现了
|
|
2
|
+
/**
|
|
3
|
+
* FIT 流水线阶段
|
|
4
|
+
*/
|
|
5
|
+
export var FITPipelineStage;
|
|
6
|
+
(function (FITPipelineStage) {
|
|
7
|
+
FITPipelineStage["PARSE"] = "parse";
|
|
8
|
+
FITPipelineStage["EXTRACT"] = "extract";
|
|
9
|
+
FITPipelineStage["STRUCTURE"] = "structure";
|
|
10
|
+
FITPipelineStage["COMPLETE"] = "complete";
|
|
11
|
+
})(FITPipelineStage || (FITPipelineStage = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Parse处理器 - 解析二进制FIT数据为消息
|
|
14
|
+
*/
|
|
15
|
+
export class ParseProcessor {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.stage = FITPipelineStage.PARSE;
|
|
18
|
+
}
|
|
19
|
+
async process(context) {
|
|
20
|
+
const startTime = Date.now();
|
|
21
|
+
if (!context.rawData) {
|
|
22
|
+
throw new Error("FIT 数据不能为空");
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
// 使用 FIT SDK 解析二进制数据
|
|
26
|
+
const rawMessages = await this.parseWithFitSDK(context.rawData);
|
|
27
|
+
context.rawMessages = rawMessages;
|
|
28
|
+
context.performance.parseTime = Date.now() - startTime;
|
|
29
|
+
console.log(`🔧 FIT 解析完成,包含消息类型: ${Object.keys(rawMessages).join(", ")}`);
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw new Error(`FIT 解析失败: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 使用 FIT SDK 解析二进制数据
|
|
38
|
+
*/
|
|
39
|
+
async parseWithFitSDK(buffer) {
|
|
40
|
+
const { Decoder, Stream } = await import("@garmin/fitsdk");
|
|
41
|
+
const stream = Stream.fromBuffer(buffer);
|
|
42
|
+
if (!Decoder.isFIT(stream)) {
|
|
43
|
+
throw new Error("不是有效的 FIT 文件");
|
|
44
|
+
}
|
|
45
|
+
const decoder = new Decoder(stream);
|
|
46
|
+
const { messages, errors } = decoder.read();
|
|
47
|
+
if (errors && errors.length > 0) {
|
|
48
|
+
console.warn("FIT 解析警告:", errors);
|
|
49
|
+
}
|
|
50
|
+
return messages;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Extract处理器 - 提取和转换消息
|
|
55
|
+
*/
|
|
56
|
+
export class ExtractProcessor {
|
|
57
|
+
constructor(getConverters) {
|
|
58
|
+
this.getConverters = getConverters;
|
|
59
|
+
this.stage = FITPipelineStage.EXTRACT;
|
|
60
|
+
}
|
|
61
|
+
async process(context) {
|
|
62
|
+
const startTime = Date.now();
|
|
63
|
+
if (!context.rawMessages) {
|
|
64
|
+
throw new Error("原始消息不能为空");
|
|
65
|
+
}
|
|
66
|
+
const extractedMessages = {};
|
|
67
|
+
// 遍历所有消息类型
|
|
68
|
+
for (const [messageType, messages] of Object.entries(context.rawMessages)) {
|
|
69
|
+
if (!Array.isArray(messages) || messages.length === 0) {
|
|
70
|
+
extractedMessages[messageType] = messages;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const converters = this.getConverters(messageType);
|
|
74
|
+
if (converters.length === 0) {
|
|
75
|
+
// 没有转换器,直接使用原始消息
|
|
76
|
+
extractedMessages[messageType] = messages;
|
|
77
|
+
console.log(`📋 消息类型 "${messageType}" 没有转换器,使用原始数据`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// 使用优先级最高的转换器
|
|
81
|
+
const converter = converters[0];
|
|
82
|
+
try {
|
|
83
|
+
const convertedMessages = converter.convertMessages(messages, context);
|
|
84
|
+
extractedMessages[messageType] = convertedMessages;
|
|
85
|
+
console.log(`✅ 消息类型 "${messageType}" 使用转换器 ${converter.name}`);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
context.errors.push(error);
|
|
89
|
+
extractedMessages[messageType] = messages; // 回退到原始消息
|
|
90
|
+
console.error(`❌ 转换器 ${converter.name} 处理 ${messageType} 时出错:`, error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
context.rawMessages = extractedMessages;
|
|
95
|
+
context.performance.extractTime = Date.now() - startTime;
|
|
96
|
+
return context;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Structure处理器 - 数据结构化
|
|
101
|
+
*/
|
|
102
|
+
export class StructureProcessor {
|
|
103
|
+
constructor(getStructurePlugins) {
|
|
104
|
+
this.getStructurePlugins = getStructurePlugins;
|
|
105
|
+
this.stage = FITPipelineStage.STRUCTURE;
|
|
106
|
+
}
|
|
107
|
+
async process(context) {
|
|
108
|
+
const startTime = Date.now();
|
|
109
|
+
if (!context.rawMessages) {
|
|
110
|
+
throw new Error("消息数据不能为空");
|
|
111
|
+
}
|
|
112
|
+
let structuredResult = {};
|
|
113
|
+
// 应用所有结构化插件
|
|
114
|
+
const plugins = this.getStructurePlugins();
|
|
115
|
+
for (const plugin of plugins) {
|
|
116
|
+
try {
|
|
117
|
+
const pluginResult = plugin.structureData(context.rawMessages, context);
|
|
118
|
+
structuredResult = { ...structuredResult, ...pluginResult };
|
|
119
|
+
console.log(`🔧 结构化插件 ${plugin.name} 处理完成`);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
context.errors.push(error);
|
|
123
|
+
console.error(`❌ 结构化插件 ${plugin.name} 出错:`, error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
context.result = structuredResult;
|
|
127
|
+
context.performance.structureTime = Date.now() - startTime;
|
|
128
|
+
return context;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Complete处理器 - 最终处理和清理
|
|
133
|
+
*/
|
|
134
|
+
export class CompleteProcessor {
|
|
135
|
+
constructor() {
|
|
136
|
+
this.stage = FITPipelineStage.COMPLETE;
|
|
137
|
+
}
|
|
138
|
+
async process(context) {
|
|
139
|
+
context.performance.endTime = Date.now();
|
|
140
|
+
// 记录性能指标
|
|
141
|
+
const totalTime = context.performance.endTime - context.performance.startTime;
|
|
142
|
+
context.metadata.set("performance", {
|
|
143
|
+
totalTime,
|
|
144
|
+
parseTime: context.performance.parseTime,
|
|
145
|
+
extractTime: context.performance.extractTime,
|
|
146
|
+
structureTime: context.performance.structureTime,
|
|
147
|
+
});
|
|
148
|
+
// 更新统计信息
|
|
149
|
+
if (context.stats) {
|
|
150
|
+
context.stats.endTime = Date.now();
|
|
151
|
+
if (context.rawMessages) {
|
|
152
|
+
context.stats.processedTokens = this.countTotalMessages(context.rawMessages);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
console.log(`✅ FIT 处理完成,总耗时: ${totalTime}ms`);
|
|
156
|
+
return context;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 计算消息总数
|
|
160
|
+
*/
|
|
161
|
+
countTotalMessages(messages) {
|
|
162
|
+
let count = 0;
|
|
163
|
+
Object.values(messages).forEach((messageArray) => {
|
|
164
|
+
if (Array.isArray(messageArray)) {
|
|
165
|
+
count += messageArray.length;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return count;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare enum CoursePoint {
|
|
2
|
+
GENERIC = 0,
|
|
3
|
+
SUMMIT = 1,
|
|
4
|
+
VALLEY = 2,
|
|
5
|
+
WATER = 3,
|
|
6
|
+
FOOD = 4,
|
|
7
|
+
DANGER = 5,
|
|
8
|
+
LEFT = 6,
|
|
9
|
+
RIGHT = 7,
|
|
10
|
+
STRAIGHT = 8,
|
|
11
|
+
FIRST_AID = 9,
|
|
12
|
+
FOURTH_CATEGORY = 10,
|
|
13
|
+
THIRD_CATEGORY = 11,
|
|
14
|
+
SECOND_CATEGORY = 12,
|
|
15
|
+
FIRST_CATEGORY = 13,
|
|
16
|
+
HORS_CATEGORY = 14,
|
|
17
|
+
SPRINT = 15,
|
|
18
|
+
LEFT_FORK = 16,
|
|
19
|
+
RIGHT_FORK = 17,
|
|
20
|
+
MIDDLE_FORK = 18,
|
|
21
|
+
SLIGHT_LEFT = 19,
|
|
22
|
+
SHARP_LEFT = 20,
|
|
23
|
+
SLIGHT_RIGHT = 21,
|
|
24
|
+
SHARP_RIGHT = 22,
|
|
25
|
+
U_TURN = 23,
|
|
26
|
+
SEGMENT_START = 24,
|
|
27
|
+
SEGMENT_END = 25,
|
|
28
|
+
CAMPSITE = 27,
|
|
29
|
+
AID_STATION = 28,
|
|
30
|
+
REST_AREA = 29,
|
|
31
|
+
GENERAL_DISTANCE = 30,
|
|
32
|
+
SERVICE = 31,
|
|
33
|
+
ENERGY_GEL = 32,
|
|
34
|
+
SPORTS_DRINK = 33,
|
|
35
|
+
MILE_MARKER = 34,
|
|
36
|
+
CHECKPOINT = 35,
|
|
37
|
+
SHELTER = 36,
|
|
38
|
+
MEETING_SPOT = 37,
|
|
39
|
+
OVERLOOK = 38,
|
|
40
|
+
TOILET = 39,
|
|
41
|
+
SHOWER = 40,
|
|
42
|
+
GEAR = 41,
|
|
43
|
+
SHARP_CURVE = 42,
|
|
44
|
+
STEEP_INCLINE = 43,
|
|
45
|
+
TUNNEL = 44,
|
|
46
|
+
BRIDGE = 45,
|
|
47
|
+
OBSTACLE = 46,
|
|
48
|
+
CROSSING = 47,
|
|
49
|
+
STORE = 48,
|
|
50
|
+
TRANSITION = 49,
|
|
51
|
+
NAVAID = 50,
|
|
52
|
+
TRANSPORT = 51,
|
|
53
|
+
ALERT = 52,
|
|
54
|
+
INFO = 53,
|
|
55
|
+
INVALID = 255
|
|
56
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export var CoursePoint;
|
|
2
|
+
(function (CoursePoint) {
|
|
3
|
+
CoursePoint[CoursePoint["GENERIC"] = 0] = "GENERIC";
|
|
4
|
+
CoursePoint[CoursePoint["SUMMIT"] = 1] = "SUMMIT";
|
|
5
|
+
CoursePoint[CoursePoint["VALLEY"] = 2] = "VALLEY";
|
|
6
|
+
CoursePoint[CoursePoint["WATER"] = 3] = "WATER";
|
|
7
|
+
CoursePoint[CoursePoint["FOOD"] = 4] = "FOOD";
|
|
8
|
+
CoursePoint[CoursePoint["DANGER"] = 5] = "DANGER";
|
|
9
|
+
CoursePoint[CoursePoint["LEFT"] = 6] = "LEFT";
|
|
10
|
+
CoursePoint[CoursePoint["RIGHT"] = 7] = "RIGHT";
|
|
11
|
+
CoursePoint[CoursePoint["STRAIGHT"] = 8] = "STRAIGHT";
|
|
12
|
+
CoursePoint[CoursePoint["FIRST_AID"] = 9] = "FIRST_AID";
|
|
13
|
+
CoursePoint[CoursePoint["FOURTH_CATEGORY"] = 10] = "FOURTH_CATEGORY";
|
|
14
|
+
CoursePoint[CoursePoint["THIRD_CATEGORY"] = 11] = "THIRD_CATEGORY";
|
|
15
|
+
CoursePoint[CoursePoint["SECOND_CATEGORY"] = 12] = "SECOND_CATEGORY";
|
|
16
|
+
CoursePoint[CoursePoint["FIRST_CATEGORY"] = 13] = "FIRST_CATEGORY";
|
|
17
|
+
CoursePoint[CoursePoint["HORS_CATEGORY"] = 14] = "HORS_CATEGORY";
|
|
18
|
+
CoursePoint[CoursePoint["SPRINT"] = 15] = "SPRINT";
|
|
19
|
+
CoursePoint[CoursePoint["LEFT_FORK"] = 16] = "LEFT_FORK";
|
|
20
|
+
CoursePoint[CoursePoint["RIGHT_FORK"] = 17] = "RIGHT_FORK";
|
|
21
|
+
CoursePoint[CoursePoint["MIDDLE_FORK"] = 18] = "MIDDLE_FORK";
|
|
22
|
+
CoursePoint[CoursePoint["SLIGHT_LEFT"] = 19] = "SLIGHT_LEFT";
|
|
23
|
+
CoursePoint[CoursePoint["SHARP_LEFT"] = 20] = "SHARP_LEFT";
|
|
24
|
+
CoursePoint[CoursePoint["SLIGHT_RIGHT"] = 21] = "SLIGHT_RIGHT";
|
|
25
|
+
CoursePoint[CoursePoint["SHARP_RIGHT"] = 22] = "SHARP_RIGHT";
|
|
26
|
+
CoursePoint[CoursePoint["U_TURN"] = 23] = "U_TURN";
|
|
27
|
+
CoursePoint[CoursePoint["SEGMENT_START"] = 24] = "SEGMENT_START";
|
|
28
|
+
CoursePoint[CoursePoint["SEGMENT_END"] = 25] = "SEGMENT_END";
|
|
29
|
+
// 保留 26 作为未使用的值
|
|
30
|
+
CoursePoint[CoursePoint["CAMPSITE"] = 27] = "CAMPSITE";
|
|
31
|
+
CoursePoint[CoursePoint["AID_STATION"] = 28] = "AID_STATION";
|
|
32
|
+
CoursePoint[CoursePoint["REST_AREA"] = 29] = "REST_AREA";
|
|
33
|
+
CoursePoint[CoursePoint["GENERAL_DISTANCE"] = 30] = "GENERAL_DISTANCE";
|
|
34
|
+
CoursePoint[CoursePoint["SERVICE"] = 31] = "SERVICE";
|
|
35
|
+
CoursePoint[CoursePoint["ENERGY_GEL"] = 32] = "ENERGY_GEL";
|
|
36
|
+
CoursePoint[CoursePoint["SPORTS_DRINK"] = 33] = "SPORTS_DRINK";
|
|
37
|
+
CoursePoint[CoursePoint["MILE_MARKER"] = 34] = "MILE_MARKER";
|
|
38
|
+
CoursePoint[CoursePoint["CHECKPOINT"] = 35] = "CHECKPOINT";
|
|
39
|
+
CoursePoint[CoursePoint["SHELTER"] = 36] = "SHELTER";
|
|
40
|
+
CoursePoint[CoursePoint["MEETING_SPOT"] = 37] = "MEETING_SPOT";
|
|
41
|
+
CoursePoint[CoursePoint["OVERLOOK"] = 38] = "OVERLOOK";
|
|
42
|
+
CoursePoint[CoursePoint["TOILET"] = 39] = "TOILET";
|
|
43
|
+
CoursePoint[CoursePoint["SHOWER"] = 40] = "SHOWER";
|
|
44
|
+
CoursePoint[CoursePoint["GEAR"] = 41] = "GEAR";
|
|
45
|
+
CoursePoint[CoursePoint["SHARP_CURVE"] = 42] = "SHARP_CURVE";
|
|
46
|
+
CoursePoint[CoursePoint["STEEP_INCLINE"] = 43] = "STEEP_INCLINE";
|
|
47
|
+
CoursePoint[CoursePoint["TUNNEL"] = 44] = "TUNNEL";
|
|
48
|
+
CoursePoint[CoursePoint["BRIDGE"] = 45] = "BRIDGE";
|
|
49
|
+
CoursePoint[CoursePoint["OBSTACLE"] = 46] = "OBSTACLE";
|
|
50
|
+
CoursePoint[CoursePoint["CROSSING"] = 47] = "CROSSING";
|
|
51
|
+
CoursePoint[CoursePoint["STORE"] = 48] = "STORE";
|
|
52
|
+
CoursePoint[CoursePoint["TRANSITION"] = 49] = "TRANSITION";
|
|
53
|
+
CoursePoint[CoursePoint["NAVAID"] = 50] = "NAVAID";
|
|
54
|
+
CoursePoint[CoursePoint["TRANSPORT"] = 51] = "TRANSPORT";
|
|
55
|
+
CoursePoint[CoursePoint["ALERT"] = 52] = "ALERT";
|
|
56
|
+
CoursePoint[CoursePoint["INFO"] = 53] = "INFO";
|
|
57
|
+
CoursePoint[CoursePoint["INVALID"] = 255] = "INVALID";
|
|
58
|
+
})(CoursePoint || (CoursePoint = {}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare enum Event {
|
|
2
|
+
TIMER = 0,
|
|
3
|
+
WORKOUT = 3,
|
|
4
|
+
WORKOUT_STEP = 4,
|
|
5
|
+
POWER_DOWN = 5,
|
|
6
|
+
POWER_UP = 6,
|
|
7
|
+
OFF_COURSE = 7,
|
|
8
|
+
SESSION = 8,
|
|
9
|
+
LAP = 9,
|
|
10
|
+
COURSE_POINT = 10,
|
|
11
|
+
BATTERY = 11,
|
|
12
|
+
VIRTUAL_PARTNER_PACE = 12,
|
|
13
|
+
HR_HIGH_ALERT = 13,
|
|
14
|
+
HR_LOW_ALERT = 14,
|
|
15
|
+
SPEED_HIGH_ALERT = 15,
|
|
16
|
+
SPEED_LOW_ALERT = 16,
|
|
17
|
+
CAD_HIGH_ALERT = 17,
|
|
18
|
+
CAD_LOW_ALERT = 18,
|
|
19
|
+
POWER_HIGH_ALERT = 19,
|
|
20
|
+
POWER_LOW_ALERT = 20,
|
|
21
|
+
RECOVERY_HR = 21,
|
|
22
|
+
BATTERY_LOW = 22,
|
|
23
|
+
TIME_DURATION_ALERT = 23,
|
|
24
|
+
DISTANCE_DURATION_ALERT = 24,
|
|
25
|
+
CALORIE_DURATION_ALERT = 25,
|
|
26
|
+
ACTIVITY = 26,
|
|
27
|
+
FITNESS_EQUIPMENT = 27,
|
|
28
|
+
LENGTH = 28,
|
|
29
|
+
USER_MARKER = 32,
|
|
30
|
+
SPORT_POINT = 33,
|
|
31
|
+
CALIBRATION = 36,
|
|
32
|
+
FRONT_GEAR_CHANGE = 42,
|
|
33
|
+
REAR_GEAR_CHANGE = 43,
|
|
34
|
+
RIDER_POSITION_CHANGE = 44,
|
|
35
|
+
ELEV_HIGH_ALERT = 45,
|
|
36
|
+
ELEV_LOW_ALERT = 46,
|
|
37
|
+
COMM_TIMEOUT = 47,
|
|
38
|
+
AUTO_ACTIVITY_DETECT = 54,
|
|
39
|
+
DIVE_ALERT = 56,
|
|
40
|
+
DIVE_GAS_SWITCHED = 57,
|
|
41
|
+
TANK_PRESSURE_RESERVE = 71,
|
|
42
|
+
TANK_PRESSURE_CRITICAL = 72,
|
|
43
|
+
TANK_LOST = 73,
|
|
44
|
+
RADAR_THREAT_ALERT = 75,
|
|
45
|
+
TANK_BATTERY_LOW = 76,
|
|
46
|
+
TANK_POD_CONNECTED = 81,
|
|
47
|
+
TANK_POD_DISCONNECTED = 82,
|
|
48
|
+
INVALID = 255
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export var Event;
|
|
2
|
+
(function (Event) {
|
|
3
|
+
Event[Event["TIMER"] = 0] = "TIMER";
|
|
4
|
+
Event[Event["WORKOUT"] = 3] = "WORKOUT";
|
|
5
|
+
Event[Event["WORKOUT_STEP"] = 4] = "WORKOUT_STEP";
|
|
6
|
+
Event[Event["POWER_DOWN"] = 5] = "POWER_DOWN";
|
|
7
|
+
Event[Event["POWER_UP"] = 6] = "POWER_UP";
|
|
8
|
+
Event[Event["OFF_COURSE"] = 7] = "OFF_COURSE";
|
|
9
|
+
Event[Event["SESSION"] = 8] = "SESSION";
|
|
10
|
+
Event[Event["LAP"] = 9] = "LAP";
|
|
11
|
+
Event[Event["COURSE_POINT"] = 10] = "COURSE_POINT";
|
|
12
|
+
Event[Event["BATTERY"] = 11] = "BATTERY";
|
|
13
|
+
Event[Event["VIRTUAL_PARTNER_PACE"] = 12] = "VIRTUAL_PARTNER_PACE";
|
|
14
|
+
Event[Event["HR_HIGH_ALERT"] = 13] = "HR_HIGH_ALERT";
|
|
15
|
+
Event[Event["HR_LOW_ALERT"] = 14] = "HR_LOW_ALERT";
|
|
16
|
+
Event[Event["SPEED_HIGH_ALERT"] = 15] = "SPEED_HIGH_ALERT";
|
|
17
|
+
Event[Event["SPEED_LOW_ALERT"] = 16] = "SPEED_LOW_ALERT";
|
|
18
|
+
Event[Event["CAD_HIGH_ALERT"] = 17] = "CAD_HIGH_ALERT";
|
|
19
|
+
Event[Event["CAD_LOW_ALERT"] = 18] = "CAD_LOW_ALERT";
|
|
20
|
+
Event[Event["POWER_HIGH_ALERT"] = 19] = "POWER_HIGH_ALERT";
|
|
21
|
+
Event[Event["POWER_LOW_ALERT"] = 20] = "POWER_LOW_ALERT";
|
|
22
|
+
Event[Event["RECOVERY_HR"] = 21] = "RECOVERY_HR";
|
|
23
|
+
Event[Event["BATTERY_LOW"] = 22] = "BATTERY_LOW";
|
|
24
|
+
Event[Event["TIME_DURATION_ALERT"] = 23] = "TIME_DURATION_ALERT";
|
|
25
|
+
Event[Event["DISTANCE_DURATION_ALERT"] = 24] = "DISTANCE_DURATION_ALERT";
|
|
26
|
+
Event[Event["CALORIE_DURATION_ALERT"] = 25] = "CALORIE_DURATION_ALERT";
|
|
27
|
+
Event[Event["ACTIVITY"] = 26] = "ACTIVITY";
|
|
28
|
+
Event[Event["FITNESS_EQUIPMENT"] = 27] = "FITNESS_EQUIPMENT";
|
|
29
|
+
Event[Event["LENGTH"] = 28] = "LENGTH";
|
|
30
|
+
Event[Event["USER_MARKER"] = 32] = "USER_MARKER";
|
|
31
|
+
Event[Event["SPORT_POINT"] = 33] = "SPORT_POINT";
|
|
32
|
+
Event[Event["CALIBRATION"] = 36] = "CALIBRATION";
|
|
33
|
+
Event[Event["FRONT_GEAR_CHANGE"] = 42] = "FRONT_GEAR_CHANGE";
|
|
34
|
+
Event[Event["REAR_GEAR_CHANGE"] = 43] = "REAR_GEAR_CHANGE";
|
|
35
|
+
Event[Event["RIDER_POSITION_CHANGE"] = 44] = "RIDER_POSITION_CHANGE";
|
|
36
|
+
Event[Event["ELEV_HIGH_ALERT"] = 45] = "ELEV_HIGH_ALERT";
|
|
37
|
+
Event[Event["ELEV_LOW_ALERT"] = 46] = "ELEV_LOW_ALERT";
|
|
38
|
+
Event[Event["COMM_TIMEOUT"] = 47] = "COMM_TIMEOUT";
|
|
39
|
+
Event[Event["AUTO_ACTIVITY_DETECT"] = 54] = "AUTO_ACTIVITY_DETECT";
|
|
40
|
+
Event[Event["DIVE_ALERT"] = 56] = "DIVE_ALERT";
|
|
41
|
+
Event[Event["DIVE_GAS_SWITCHED"] = 57] = "DIVE_GAS_SWITCHED";
|
|
42
|
+
Event[Event["TANK_PRESSURE_RESERVE"] = 71] = "TANK_PRESSURE_RESERVE";
|
|
43
|
+
Event[Event["TANK_PRESSURE_CRITICAL"] = 72] = "TANK_PRESSURE_CRITICAL";
|
|
44
|
+
Event[Event["TANK_LOST"] = 73] = "TANK_LOST";
|
|
45
|
+
Event[Event["RADAR_THREAT_ALERT"] = 75] = "RADAR_THREAT_ALERT";
|
|
46
|
+
Event[Event["TANK_BATTERY_LOW"] = 76] = "TANK_BATTERY_LOW";
|
|
47
|
+
Event[Event["TANK_POD_CONNECTED"] = 81] = "TANK_POD_CONNECTED";
|
|
48
|
+
Event[Event["TANK_POD_DISCONNECTED"] = 82] = "TANK_POD_DISCONNECTED";
|
|
49
|
+
Event[Event["INVALID"] = 255] = "INVALID";
|
|
50
|
+
})(Event || (Event = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum EventType {
|
|
2
|
+
START = 0,
|
|
3
|
+
STOP = 1,
|
|
4
|
+
CONSECUTIVE_DEPRECIATED = 2,
|
|
5
|
+
MARKER = 3,
|
|
6
|
+
STOP_ALL = 4,
|
|
7
|
+
BEGIN_DEPRECIATED = 5,
|
|
8
|
+
END_DEPRECIATED = 6,
|
|
9
|
+
END_ALL_DEPRECIATED = 7,
|
|
10
|
+
STOP_DISABLE = 8,
|
|
11
|
+
STOP_DISABLE_ALL = 9,
|
|
12
|
+
MARKER_START = 10,
|
|
13
|
+
MARKER_STOP = 11,
|
|
14
|
+
STOP_ALL_ENTER_RECOVERY = 12,
|
|
15
|
+
STOP_ENTER_RECOVERY = 13,
|
|
16
|
+
MARK_END = 14,
|
|
17
|
+
UNDEFINED = 255
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var EventType;
|
|
2
|
+
(function (EventType) {
|
|
3
|
+
EventType[EventType["START"] = 0] = "START";
|
|
4
|
+
EventType[EventType["STOP"] = 1] = "STOP";
|
|
5
|
+
EventType[EventType["CONSECUTIVE_DEPRECIATED"] = 2] = "CONSECUTIVE_DEPRECIATED";
|
|
6
|
+
EventType[EventType["MARKER"] = 3] = "MARKER";
|
|
7
|
+
EventType[EventType["STOP_ALL"] = 4] = "STOP_ALL";
|
|
8
|
+
EventType[EventType["BEGIN_DEPRECIATED"] = 5] = "BEGIN_DEPRECIATED";
|
|
9
|
+
EventType[EventType["END_DEPRECIATED"] = 6] = "END_DEPRECIATED";
|
|
10
|
+
EventType[EventType["END_ALL_DEPRECIATED"] = 7] = "END_ALL_DEPRECIATED";
|
|
11
|
+
EventType[EventType["STOP_DISABLE"] = 8] = "STOP_DISABLE";
|
|
12
|
+
EventType[EventType["STOP_DISABLE_ALL"] = 9] = "STOP_DISABLE_ALL";
|
|
13
|
+
EventType[EventType["MARKER_START"] = 10] = "MARKER_START";
|
|
14
|
+
EventType[EventType["MARKER_STOP"] = 11] = "MARKER_STOP";
|
|
15
|
+
EventType[EventType["STOP_ALL_ENTER_RECOVERY"] = 12] = "STOP_ALL_ENTER_RECOVERY";
|
|
16
|
+
EventType[EventType["STOP_ENTER_RECOVERY"] = 13] = "STOP_ENTER_RECOVERY";
|
|
17
|
+
EventType[EventType["MARK_END"] = 14] = "MARK_END";
|
|
18
|
+
EventType[EventType["UNDEFINED"] = 255] = "UNDEFINED";
|
|
19
|
+
})(EventType || (EventType = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum FITFile {
|
|
2
|
+
DEVICE = 1,
|
|
3
|
+
SETTINGS = 2,
|
|
4
|
+
SPORT = 3,
|
|
5
|
+
ACTIVITY = 4,
|
|
6
|
+
WORKOUT = 5,
|
|
7
|
+
COURSE = 6,
|
|
8
|
+
SCHEDULES = 7,
|
|
9
|
+
WEIGHT = 9,
|
|
10
|
+
TOTALS = 10,
|
|
11
|
+
GOALS = 11,
|
|
12
|
+
BLOOD_PRESSURE = 14,
|
|
13
|
+
MONITORING_A = 15,
|
|
14
|
+
ACTIVITY_SUMMARY = 20,
|
|
15
|
+
MONITORING_DAILY = 28,
|
|
16
|
+
MONITORING_B = 32,
|
|
17
|
+
SEGMENT = 34,
|
|
18
|
+
SEGMENT_LIST = 35,
|
|
19
|
+
EXD_CONFIGURATION = 40,
|
|
20
|
+
MFG_RANGE_MIN = 247,
|
|
21
|
+
MFG_RANGE_MAX = 254,
|
|
22
|
+
INVALID = 255
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var FITFile;
|
|
2
|
+
(function (FITFile) {
|
|
3
|
+
FITFile[FITFile["DEVICE"] = 1] = "DEVICE";
|
|
4
|
+
FITFile[FITFile["SETTINGS"] = 2] = "SETTINGS";
|
|
5
|
+
FITFile[FITFile["SPORT"] = 3] = "SPORT";
|
|
6
|
+
FITFile[FITFile["ACTIVITY"] = 4] = "ACTIVITY";
|
|
7
|
+
FITFile[FITFile["WORKOUT"] = 5] = "WORKOUT";
|
|
8
|
+
FITFile[FITFile["COURSE"] = 6] = "COURSE";
|
|
9
|
+
FITFile[FITFile["SCHEDULES"] = 7] = "SCHEDULES";
|
|
10
|
+
FITFile[FITFile["WEIGHT"] = 9] = "WEIGHT";
|
|
11
|
+
FITFile[FITFile["TOTALS"] = 10] = "TOTALS";
|
|
12
|
+
FITFile[FITFile["GOALS"] = 11] = "GOALS";
|
|
13
|
+
FITFile[FITFile["BLOOD_PRESSURE"] = 14] = "BLOOD_PRESSURE";
|
|
14
|
+
FITFile[FITFile["MONITORING_A"] = 15] = "MONITORING_A";
|
|
15
|
+
FITFile[FITFile["ACTIVITY_SUMMARY"] = 20] = "ACTIVITY_SUMMARY";
|
|
16
|
+
FITFile[FITFile["MONITORING_DAILY"] = 28] = "MONITORING_DAILY";
|
|
17
|
+
FITFile[FITFile["MONITORING_B"] = 32] = "MONITORING_B";
|
|
18
|
+
FITFile[FITFile["SEGMENT"] = 34] = "SEGMENT";
|
|
19
|
+
FITFile[FITFile["SEGMENT_LIST"] = 35] = "SEGMENT_LIST";
|
|
20
|
+
FITFile[FITFile["EXD_CONFIGURATION"] = 40] = "EXD_CONFIGURATION";
|
|
21
|
+
FITFile[FITFile["MFG_RANGE_MIN"] = 247] = "MFG_RANGE_MIN";
|
|
22
|
+
FITFile[FITFile["MFG_RANGE_MAX"] = 254] = "MFG_RANGE_MAX";
|
|
23
|
+
FITFile[FITFile["INVALID"] = 255] = "INVALID";
|
|
24
|
+
})(FITFile || (FITFile = {}));
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export declare const types: {
|
|
2
|
+
enum_file: {
|
|
3
|
+
size: number;
|
|
4
|
+
baseType: number;
|
|
5
|
+
mapValue: (value: string | number) => any;
|
|
6
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
7
|
+
};
|
|
8
|
+
enum_activity: {
|
|
9
|
+
size: number;
|
|
10
|
+
baseType: number;
|
|
11
|
+
mapValue: (value: string | number) => any;
|
|
12
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
13
|
+
};
|
|
14
|
+
enum_sport: {
|
|
15
|
+
size: number;
|
|
16
|
+
baseType: number;
|
|
17
|
+
mapValue: (value: string | number) => any;
|
|
18
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
19
|
+
};
|
|
20
|
+
enum_sub_sport: {
|
|
21
|
+
size: number;
|
|
22
|
+
baseType: number;
|
|
23
|
+
mapValue: (value: string | number) => any;
|
|
24
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
25
|
+
};
|
|
26
|
+
enum_event: {
|
|
27
|
+
size: number;
|
|
28
|
+
baseType: number;
|
|
29
|
+
mapValue: (value: string | number) => any;
|
|
30
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
31
|
+
};
|
|
32
|
+
enum_event_type: {
|
|
33
|
+
size: number;
|
|
34
|
+
baseType: number;
|
|
35
|
+
mapValue: (value: string | number) => any;
|
|
36
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
37
|
+
};
|
|
38
|
+
enum_course_point: {
|
|
39
|
+
size: number;
|
|
40
|
+
baseType: number;
|
|
41
|
+
mapValue: (value: string | number) => any;
|
|
42
|
+
setValue: (this: DataView, byteOffset: number, value: number) => void;
|
|
43
|
+
};
|
|
44
|
+
uint8: {
|
|
45
|
+
size: number;
|
|
46
|
+
baseType: number;
|
|
47
|
+
setValue: (byteOffset: number, value: number) => void;
|
|
48
|
+
};
|
|
49
|
+
sint8: {
|
|
50
|
+
size: number;
|
|
51
|
+
baseType: number;
|
|
52
|
+
setValue: (byteOffset: number, value: number) => void;
|
|
53
|
+
};
|
|
54
|
+
uint16: {
|
|
55
|
+
size: number;
|
|
56
|
+
baseType: number;
|
|
57
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
58
|
+
};
|
|
59
|
+
sint16: {
|
|
60
|
+
size: number;
|
|
61
|
+
baseType: number;
|
|
62
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
63
|
+
};
|
|
64
|
+
uint32: {
|
|
65
|
+
size: number;
|
|
66
|
+
baseType: number;
|
|
67
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
68
|
+
};
|
|
69
|
+
sint32: {
|
|
70
|
+
size: number;
|
|
71
|
+
baseType: number;
|
|
72
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
73
|
+
};
|
|
74
|
+
string: {
|
|
75
|
+
size: number;
|
|
76
|
+
baseType: number;
|
|
77
|
+
mapValue: (value: string) => number[];
|
|
78
|
+
setValue: typeof dvSetUint8Array;
|
|
79
|
+
};
|
|
80
|
+
distance: {
|
|
81
|
+
size: number;
|
|
82
|
+
baseType: number;
|
|
83
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
84
|
+
mapValue: (value: number) => number;
|
|
85
|
+
};
|
|
86
|
+
speed: {
|
|
87
|
+
size: number;
|
|
88
|
+
baseType: number;
|
|
89
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
90
|
+
mapValue: (value: number) => number;
|
|
91
|
+
};
|
|
92
|
+
altitude: {
|
|
93
|
+
size: number;
|
|
94
|
+
baseType: number;
|
|
95
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
96
|
+
mapValue: (value: number) => number;
|
|
97
|
+
};
|
|
98
|
+
seconds: {
|
|
99
|
+
size: number;
|
|
100
|
+
baseType: number;
|
|
101
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
102
|
+
mapValue: (value: number) => number;
|
|
103
|
+
};
|
|
104
|
+
date_time: {
|
|
105
|
+
size: number;
|
|
106
|
+
baseType: number;
|
|
107
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
108
|
+
mapValue: (value: number | string | Date) => number;
|
|
109
|
+
};
|
|
110
|
+
semicircles: {
|
|
111
|
+
size: number;
|
|
112
|
+
baseType: number;
|
|
113
|
+
setValue: (byteOffset: number, value: number, littleEndian?: boolean) => void;
|
|
114
|
+
mapValue: (value: number) => number;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export declare function encodedStrlen(str: string): number;
|
|
118
|
+
declare function dvSetUint8Array(this: DataView, offset: number, values: number[]): void;
|
|
119
|
+
export {};
|