trackswap 0.0.26 → 0.2.0
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/README.md +124 -431
- package/dist/FIT/base.d.ts +61 -0
- package/dist/FIT/course-plan.d.ts +3 -0
- package/dist/FIT/crc.d.ts +1 -0
- package/dist/FIT/decoder.d.ts +33 -0
- package/dist/FIT/encoder.d.ts +45 -0
- package/dist/FIT/encoderCourse.d.ts +37 -0
- package/dist/FIT/encoderWorkout.d.ts +41 -0
- package/dist/FIT/health.d.ts +121 -0
- package/dist/FIT/index.d.ts +15 -0
- package/dist/FIT/mesg.d.ts +37 -0
- package/dist/FIT/middleware.d.ts +33 -0
- package/dist/FIT/plugins.d.ts +17 -0
- package/dist/FIT/processor.d.ts +34 -0
- package/dist/FIT/types/checksum_type.d.ts +4 -0
- package/dist/FIT/types/course_point.d.ts +56 -0
- package/dist/FIT/types/date_time_type.d.ts +3 -0
- package/dist/FIT/types/event.d.ts +49 -0
- package/dist/FIT/types/event_type.d.ts +18 -0
- package/dist/FIT/types/file.d.ts +23 -0
- package/dist/FIT/types/file_flags_type.d.ts +5 -0
- package/dist/FIT/types/index.d.ts +119 -0
- package/dist/FIT/types/local_date_time_type.d.ts +3 -0
- package/dist/FIT/types/mesg_count_type.d.ts +5 -0
- package/dist/FIT/types/mesg_num.d.ts +125 -0
- package/dist/FIT/types/message_index_type.d.ts +4558 -0
- package/dist/FIT/types/sport.d.ts +47 -0
- package/dist/FIT/types.d.ts +516 -0
- package/dist/FIT/util.d.ts +1 -0
- package/dist/GPX/base.d.ts +16 -0
- package/dist/GPX/converters.d.ts +62 -0
- package/dist/GPX/decoder.d.ts +43 -0
- package/dist/GPX/encoder.d.ts +45 -0
- package/dist/GPX/extensions/index.d.ts +14 -0
- package/dist/GPX/index.d.ts +13 -0
- package/dist/GPX/middleware.d.ts +18 -0
- package/dist/GPX/processor.d.ts +30 -0
- package/dist/GPX/types.d.ts +124 -0
- package/dist/GPX/util.d.ts +1 -0
- package/dist/TCX/base.d.ts +19 -0
- package/dist/TCX/converters.d.ts +52 -0
- package/dist/TCX/decoder.d.ts +33 -0
- package/dist/TCX/encoder.d.ts +46 -0
- package/dist/TCX/index.d.ts +7 -0
- package/dist/TCX/middleware.d.ts +25 -0
- package/dist/TCX/processor.d.ts +39 -0
- package/dist/TCX/types.d.ts +192 -0
- package/dist/TrackSwap.d.ts +16 -0
- package/dist/activity/base.d.ts +62 -0
- package/dist/activity/converters.d.ts +40 -0
- package/dist/activity/encoders.d.ts +36 -0
- package/dist/activity/index.d.ts +17 -0
- package/dist/activity/metrics/MetricsCalculator.d.ts +18 -0
- package/dist/activity/metrics/index.d.ts +1 -0
- package/dist/activity/processor.d.ts +19 -0
- package/dist/core/base.d.ts +73 -0
- package/dist/core/builtin-adapters.d.ts +52 -0
- package/dist/core/format-adapter.d.ts +23 -0
- package/dist/core/format-registry.d.ts +9 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/xml-utils.d.ts +17 -0
- package/dist/document.d.ts +57 -0
- package/dist/errors.d.ts +12 -0
- package/dist/fit-debug.d.ts +3 -0
- package/dist/index.cjs +29 -26
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -17
- package/dist/types.d.ts +76 -0
- package/dist/util.d.ts +25 -0
- package/package.json +15 -6
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FITFileType } from "./types.js";
|
|
2
|
+
export interface FITEncoderOptions {
|
|
3
|
+
compact?: boolean;
|
|
4
|
+
defaultActivity?: string;
|
|
5
|
+
defaultSubActivity?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class FITEncoder {
|
|
8
|
+
private localNum;
|
|
9
|
+
private mesgDefn;
|
|
10
|
+
private messages;
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options?: FITEncoderOptions);
|
|
13
|
+
encode(fitData: FITFileType): Promise<Buffer>;
|
|
14
|
+
encodeCourse(fitData: FITFileType): Promise<Buffer>;
|
|
15
|
+
encodeToBlob(fitData: FITFileType, fileType?: "activity" | "course"): Promise<Blob>;
|
|
16
|
+
private reset;
|
|
17
|
+
private buildFITContent;
|
|
18
|
+
private buildActivityContent;
|
|
19
|
+
private buildCourseContent;
|
|
20
|
+
private buildFileId;
|
|
21
|
+
private buildSession;
|
|
22
|
+
private buildLaps;
|
|
23
|
+
private buildLap;
|
|
24
|
+
private buildRecords;
|
|
25
|
+
private buildRecord;
|
|
26
|
+
private buildEvent;
|
|
27
|
+
private buildActivity;
|
|
28
|
+
private buildCourse;
|
|
29
|
+
private buildEventsFromLaps;
|
|
30
|
+
private buildActivityFromSession;
|
|
31
|
+
private parseTimestamp;
|
|
32
|
+
private convertToSemicircles;
|
|
33
|
+
private validateRequiredFields;
|
|
34
|
+
private writeMesg;
|
|
35
|
+
get blob(): Blob;
|
|
36
|
+
get dataLen(): number;
|
|
37
|
+
get dataCrc(): number;
|
|
38
|
+
get header(): ArrayBuffer;
|
|
39
|
+
get trailer(): ArrayBuffer;
|
|
40
|
+
encoder(fitData: FITFileType): Promise<Buffer>;
|
|
41
|
+
}
|
|
42
|
+
declare const _default: {
|
|
43
|
+
FITEncoder: typeof FITEncoder;
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CoursePoint as CoursePointType } from "./types/course_point.js";
|
|
2
|
+
import { MesgNum } from "./types/mesg_num.js";
|
|
3
|
+
import { Sport, SubSport } from "./types/message_index_type.js";
|
|
4
|
+
export interface CourseRecordPoint {
|
|
5
|
+
timestamp: Date | number;
|
|
6
|
+
latitude: number;
|
|
7
|
+
longitude: number;
|
|
8
|
+
distance?: number;
|
|
9
|
+
altitude?: number;
|
|
10
|
+
speed?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CourseCuePoint {
|
|
13
|
+
timestamp: Date | number;
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
type?: CoursePointType;
|
|
17
|
+
name?: string;
|
|
18
|
+
distance?: number;
|
|
19
|
+
favorite?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CoursePlan {
|
|
22
|
+
name: string;
|
|
23
|
+
sport?: Sport;
|
|
24
|
+
subSport?: SubSport;
|
|
25
|
+
records: CourseRecordPoint[];
|
|
26
|
+
coursePoints?: CourseCuePoint[];
|
|
27
|
+
manufacturer?: string | number;
|
|
28
|
+
product?: number;
|
|
29
|
+
serialNumber?: number;
|
|
30
|
+
timeCreated?: Date | number;
|
|
31
|
+
}
|
|
32
|
+
export interface FitMesg {
|
|
33
|
+
mesgNum: MesgNum;
|
|
34
|
+
data: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export declare function buildCourseMesgs(plan: CoursePlan): FitMesg[];
|
|
37
|
+
export declare function encodeCourse(plan: CoursePlan): Uint8Array;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MesgNum } from "./types/mesg_num.js";
|
|
2
|
+
import { Intensity, Sport, SubSport } from "./types/message_index_type.js";
|
|
3
|
+
export type WorkoutDuration = {
|
|
4
|
+
kind: "time";
|
|
5
|
+
seconds: number;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "distance";
|
|
8
|
+
meters: number;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "calories";
|
|
11
|
+
kcal: number;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "open";
|
|
14
|
+
};
|
|
15
|
+
export type WorkoutTarget = {
|
|
16
|
+
kind: "open";
|
|
17
|
+
};
|
|
18
|
+
export interface WorkoutStep {
|
|
19
|
+
name?: string;
|
|
20
|
+
intensity?: Intensity;
|
|
21
|
+
duration: WorkoutDuration;
|
|
22
|
+
target?: WorkoutTarget;
|
|
23
|
+
}
|
|
24
|
+
export interface WorkoutPlan {
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
sport: Sport;
|
|
28
|
+
subSport?: SubSport;
|
|
29
|
+
steps: WorkoutStep[];
|
|
30
|
+
manufacturer?: string | number;
|
|
31
|
+
product?: number;
|
|
32
|
+
serialNumber?: number;
|
|
33
|
+
messageIndex?: number;
|
|
34
|
+
timeCreated?: Date | number;
|
|
35
|
+
}
|
|
36
|
+
export interface FitMesg {
|
|
37
|
+
mesgNum: MesgNum;
|
|
38
|
+
data: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare function buildWorkoutMesgs(plan: WorkoutPlan): FitMesg[];
|
|
41
|
+
export declare function encodeWorkout(plan: WorkoutPlan): Uint8Array;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { BaseFITStructurePlugin } from "./base.js";
|
|
2
|
+
import type { FITContext } from "./types.js";
|
|
3
|
+
export type FITPrimaryKind = 'activity' | 'health' | 'workout' | 'course' | 'device' | 'unknown';
|
|
4
|
+
export type HealthMetricCode = 'heart_rate_bpm' | 'resting_heart_rate_bpm' | 'resting_heart_rate_7_day_bpm' | 'steps' | 'distance_m' | 'active_time_s' | 'active_energy_kcal' | 'total_energy_kcal' | 'stress_level' | 'respiration_rate_bpm' | 'spo2_percent' | 'body_battery_level' | 'body_battery_charged' | 'body_battery_drained' | 'hrv_rmssd_ms' | 'temperature_c' | 'skin_temperature_deviation_c' | 'skin_temperature_7_day_deviation_c' | 'skin_temperature_nightly_c' | 'ascent_m' | 'descent_m' | `vendor:${string}`;
|
|
5
|
+
export type HealthValueStatus = 'valid' | 'invalid' | 'off_wrist' | 'motion' | 'low_confidence' | 'gap' | 'unknown';
|
|
6
|
+
export type HealthMessagePointerV1 = {
|
|
7
|
+
messageName: string;
|
|
8
|
+
messageIndex: number;
|
|
9
|
+
fieldName?: string;
|
|
10
|
+
developerField?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type HealthPointV1 = {
|
|
13
|
+
metric: HealthMetricCode;
|
|
14
|
+
timestamp: Date;
|
|
15
|
+
localTimestamp?: string;
|
|
16
|
+
offsetSeconds?: number;
|
|
17
|
+
value?: number;
|
|
18
|
+
unit: string;
|
|
19
|
+
status: HealthValueStatus;
|
|
20
|
+
quality?: number;
|
|
21
|
+
aggregation?: 'instant' | 'mean' | 'min' | 'max' | 'sum' | 'latest';
|
|
22
|
+
source: HealthMessagePointerV1;
|
|
23
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
24
|
+
};
|
|
25
|
+
export type HealthIntervalV1 = {
|
|
26
|
+
metric: HealthMetricCode;
|
|
27
|
+
startTime: Date;
|
|
28
|
+
endTime: Date;
|
|
29
|
+
localStartTime?: string;
|
|
30
|
+
offsetSeconds?: number;
|
|
31
|
+
value?: number;
|
|
32
|
+
unit: string;
|
|
33
|
+
status: HealthValueStatus;
|
|
34
|
+
activityType?: string;
|
|
35
|
+
intensity?: string;
|
|
36
|
+
source: HealthMessagePointerV1;
|
|
37
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
38
|
+
};
|
|
39
|
+
export type HealthSummaryV1 = {
|
|
40
|
+
summaryType: 'daily' | 'sleep' | 'hrv_status' | 'monitoring_window' | 'device';
|
|
41
|
+
externalId: string;
|
|
42
|
+
calendarDate?: string;
|
|
43
|
+
startTime?: Date;
|
|
44
|
+
endTime?: Date;
|
|
45
|
+
offsetSeconds?: number;
|
|
46
|
+
metrics: Record<string, number | string | boolean | null>;
|
|
47
|
+
source: HealthMessagePointerV1;
|
|
48
|
+
};
|
|
49
|
+
export type HealthSessionSegmentV1 = {
|
|
50
|
+
segmentType: 'awake' | 'light' | 'deep' | 'rem' | 'unmeasurable' | 'sleeping' | `vendor:${string}`;
|
|
51
|
+
startTime: Date;
|
|
52
|
+
endTime: Date;
|
|
53
|
+
status: HealthValueStatus;
|
|
54
|
+
source: HealthMessagePointerV1;
|
|
55
|
+
};
|
|
56
|
+
export type HealthSessionV1 = {
|
|
57
|
+
sessionType: 'sleep' | 'nap' | 'health_snapshot' | `vendor:${string}`;
|
|
58
|
+
externalId: string;
|
|
59
|
+
startTime: Date;
|
|
60
|
+
endTime: Date;
|
|
61
|
+
startOffsetSeconds?: number;
|
|
62
|
+
endOffsetSeconds?: number;
|
|
63
|
+
calendarDate?: string;
|
|
64
|
+
deleted?: boolean;
|
|
65
|
+
segments: HealthSessionSegmentV1[];
|
|
66
|
+
metrics: Record<string, number | string | boolean | null>;
|
|
67
|
+
source: HealthMessagePointerV1;
|
|
68
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
69
|
+
};
|
|
70
|
+
export type FITDiagnosticWarningV1 = {
|
|
71
|
+
code: string;
|
|
72
|
+
message: string;
|
|
73
|
+
source?: HealthMessagePointerV1;
|
|
74
|
+
};
|
|
75
|
+
export type FITDiagnosticsV1 = {
|
|
76
|
+
sdkProfileVersion?: string;
|
|
77
|
+
parserVersion: string;
|
|
78
|
+
messageCounts: Record<string, number>;
|
|
79
|
+
recognizedMessageCounts: Record<string, number>;
|
|
80
|
+
unknownMessageCounts: Record<string, number>;
|
|
81
|
+
invalidValueCounts: Record<string, number>;
|
|
82
|
+
warnings: FITDiagnosticWarningV1[];
|
|
83
|
+
unknownMessages?: Record<string, unknown[]>;
|
|
84
|
+
};
|
|
85
|
+
export type HealthDocumentV1 = {
|
|
86
|
+
schemaVersion: '1';
|
|
87
|
+
observedStart?: Date;
|
|
88
|
+
observedEnd?: Date;
|
|
89
|
+
timezone: {
|
|
90
|
+
strategy: 'explicit_offset' | 'timestamp_correlation' | 'inferred' | 'unknown';
|
|
91
|
+
offsets: Array<{
|
|
92
|
+
at: Date;
|
|
93
|
+
offsetSeconds: number;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
points: HealthPointV1[];
|
|
97
|
+
intervals: HealthIntervalV1[];
|
|
98
|
+
summaries: HealthSummaryV1[];
|
|
99
|
+
sessions: HealthSessionV1[];
|
|
100
|
+
diagnostics: FITDiagnosticsV1;
|
|
101
|
+
};
|
|
102
|
+
export type FITDocumentParseOptions = {
|
|
103
|
+
includeUnknownMessages?: boolean;
|
|
104
|
+
includeDeveloperFields?: boolean;
|
|
105
|
+
strict?: boolean;
|
|
106
|
+
health?: {
|
|
107
|
+
reconstructIntervals?: boolean;
|
|
108
|
+
retainCumulativeValues?: boolean;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export type FITMessages = Record<string, unknown[] | undefined>;
|
|
112
|
+
export declare const TRACKSWAP_HEALTH_PARSER_VERSION = "trackswap-0.2.0-health-ir-v1";
|
|
113
|
+
export declare function detectFITKinds(messages: FITMessages): FITPrimaryKind[];
|
|
114
|
+
export declare function buildHealthDocumentFromMessages(messages: FITMessages, options?: FITDocumentParseOptions, environment?: {
|
|
115
|
+
sdkProfileVersion?: string;
|
|
116
|
+
}): HealthDocumentV1;
|
|
117
|
+
export declare class HealthStructurePlugin extends BaseFITStructurePlugin {
|
|
118
|
+
name: string;
|
|
119
|
+
priority: number;
|
|
120
|
+
structureData(messages: FITMessages, context: FITContext): Partial<import("./types.js").FITFileType>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { FITDecoder } from "./decoder.js";
|
|
2
|
+
export { FITEncoder } from "./encoder.js";
|
|
3
|
+
export { IFITMessageConverter, IFITStructurePlugin, IFITMiddlewarePlugin, BaseFITMessageConverter, BaseFITStructurePlugin, BaseFITMiddleware, } from "./base.js";
|
|
4
|
+
export { SessionStructurePlugin, CourseStructurePlugin, FileHeaderPlugin, } from "./plugins.js";
|
|
5
|
+
export { HealthStructurePlugin, buildHealthDocumentFromMessages, detectFITKinds, TRACKSWAP_HEALTH_PARSER_VERSION, } from "./health.js";
|
|
6
|
+
export type { FITDocumentParseOptions, FITPrimaryKind, FITDiagnosticsV1, HealthDocumentV1, HealthIntervalV1, HealthMetricCode, HealthPointV1, HealthSessionSegmentV1, HealthSessionV1, HealthSummaryV1, HealthValueStatus, } from "./health.js";
|
|
7
|
+
export * from "./types.js";
|
|
8
|
+
export { encodeCourse, buildCourseMesgs, type CoursePlan, type CourseRecordPoint, type CourseCuePoint, type FitMesg as CourseFitMesg, } from "./encoderCourse.js";
|
|
9
|
+
import { FITDecoder } from "./decoder.js";
|
|
10
|
+
import { FITEncoder } from "./encoder.js";
|
|
11
|
+
declare const _default: {
|
|
12
|
+
FITDecoder: typeof FITDecoder;
|
|
13
|
+
FITEncoder: typeof FITEncoder;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MesgNum } from "./types/mesg_num.js";
|
|
2
|
+
interface FieldDefn {
|
|
3
|
+
name: string;
|
|
4
|
+
number: number;
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
interface Field {
|
|
8
|
+
name: string;
|
|
9
|
+
number: number;
|
|
10
|
+
type: string;
|
|
11
|
+
value: any;
|
|
12
|
+
}
|
|
13
|
+
interface ProcessedMesgDefn {
|
|
14
|
+
localNum: number;
|
|
15
|
+
mesgNum: MesgNum;
|
|
16
|
+
fieldDefns: {
|
|
17
|
+
number: number;
|
|
18
|
+
size: number;
|
|
19
|
+
baseType: number;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export declare class Mesg {
|
|
23
|
+
localNum: number;
|
|
24
|
+
mesgNum: MesgNum;
|
|
25
|
+
fields: Field[];
|
|
26
|
+
static check(mesgName: string, mesgNum: MesgNum | undefined, fieldDefns: FieldDefn[] | undefined, values: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}): void;
|
|
29
|
+
constructor(localNum: number, mesgName: string, values: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
});
|
|
32
|
+
get mesgDefn(): ProcessedMesgDefn;
|
|
33
|
+
isSameDefn(mesgDefn: ProcessedMesgDefn): boolean;
|
|
34
|
+
get defnRecord(): ArrayBuffer;
|
|
35
|
+
get dataRecord(): ArrayBuffer;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseFITMiddleware } from "./base.js";
|
|
2
|
+
import { FITDecoderMesgs, FITFileType, FITContext } from "./types.js";
|
|
3
|
+
export declare class PerformanceMiddleware extends BaseFITMiddleware {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
onParse(buffer: Buffer, context: FITContext): Promise<Buffer>;
|
|
7
|
+
onExtractMessages(messages: FITDecoderMesgs, context: FITContext): Promise<FITDecoderMesgs>;
|
|
8
|
+
onStructure(result: Partial<FITFileType>, context: FITContext): Promise<Partial<FITFileType>>;
|
|
9
|
+
onComplete(result: FITFileType, context: FITContext): Promise<FITFileType>;
|
|
10
|
+
onError(error: Error, context: FITContext): Promise<void>;
|
|
11
|
+
private countMessages;
|
|
12
|
+
private analyzeStructure;
|
|
13
|
+
private getSummary;
|
|
14
|
+
}
|
|
15
|
+
export declare class ValidationMiddleware extends BaseFITMiddleware {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
onComplete(result: FITFileType, context: FITContext): Promise<FITFileType>;
|
|
19
|
+
private validateFIT;
|
|
20
|
+
}
|
|
21
|
+
export declare class DataCleanupMiddleware extends BaseFITMiddleware {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
onStructure(result: Partial<FITFileType>, context: FITContext): Promise<Partial<FITFileType>>;
|
|
25
|
+
private cleanupData;
|
|
26
|
+
}
|
|
27
|
+
export declare class FileInfoMiddleware extends BaseFITMiddleware {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
onExtractMessages(messages: FITDecoderMesgs, context: FITContext): Promise<FITDecoderMesgs>;
|
|
31
|
+
private extractFileInfo;
|
|
32
|
+
}
|
|
33
|
+
export declare function registerDefaultMiddlewares(decoder: any): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseFITStructurePlugin } from "./base.js";
|
|
2
|
+
import { FITDecoderMesgs, FITFileType, FITContext } from "./types.js";
|
|
3
|
+
export declare class SessionStructurePlugin extends BaseFITStructurePlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
priority: number;
|
|
6
|
+
structureData(messages: FITDecoderMesgs, context: FITContext): Partial<FITFileType>;
|
|
7
|
+
}
|
|
8
|
+
export declare class CourseStructurePlugin extends BaseFITStructurePlugin {
|
|
9
|
+
name: string;
|
|
10
|
+
priority: number;
|
|
11
|
+
structureData(messages: FITDecoderMesgs, context: FITContext): Partial<FITFileType>;
|
|
12
|
+
}
|
|
13
|
+
export declare class FileHeaderPlugin extends BaseFITStructurePlugin {
|
|
14
|
+
name: string;
|
|
15
|
+
priority: number;
|
|
16
|
+
structureData(messages: FITDecoderMesgs, context: FITContext): Partial<FITFileType>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IFITMessageConverter, IFITStructurePlugin } from "./base.js";
|
|
2
|
+
import { FITContext } from "./types.js";
|
|
3
|
+
export declare enum FITPipelineStage {
|
|
4
|
+
PARSE = "parse",
|
|
5
|
+
EXTRACT = "extract",
|
|
6
|
+
STRUCTURE = "structure",
|
|
7
|
+
COMPLETE = "complete"
|
|
8
|
+
}
|
|
9
|
+
export interface IFITPipelineProcessor {
|
|
10
|
+
stage: FITPipelineStage;
|
|
11
|
+
process(context: FITContext): Promise<FITContext>;
|
|
12
|
+
}
|
|
13
|
+
export declare class ParseProcessor implements IFITPipelineProcessor {
|
|
14
|
+
stage: FITPipelineStage;
|
|
15
|
+
process(context: FITContext): Promise<FITContext>;
|
|
16
|
+
private parseWithFitSDK;
|
|
17
|
+
}
|
|
18
|
+
export declare class ExtractProcessor implements IFITPipelineProcessor {
|
|
19
|
+
private getConverters;
|
|
20
|
+
stage: FITPipelineStage;
|
|
21
|
+
constructor(getConverters: (messageType: string) => IFITMessageConverter[]);
|
|
22
|
+
process(context: FITContext): Promise<FITContext>;
|
|
23
|
+
}
|
|
24
|
+
export declare class StructureProcessor implements IFITPipelineProcessor {
|
|
25
|
+
private getStructurePlugins;
|
|
26
|
+
stage: FITPipelineStage;
|
|
27
|
+
constructor(getStructurePlugins: () => IFITStructurePlugin[]);
|
|
28
|
+
process(context: FITContext): Promise<FITContext>;
|
|
29
|
+
}
|
|
30
|
+
export declare class CompleteProcessor implements IFITPipelineProcessor {
|
|
31
|
+
stage: FITPipelineStage;
|
|
32
|
+
process(context: FITContext): Promise<FITContext>;
|
|
33
|
+
private countTotalMessages;
|
|
34
|
+
}
|
|
@@ -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,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,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,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,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 {};
|