incyclist-devices 2.1.0 → 2.1.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/lib/adapters.d.ts +1 -1
- package/lib/antv2/adapter-factory.d.ts +4 -15
- package/lib/antv2/adapter.d.ts +15 -15
- package/lib/antv2/adapter.js +67 -21
- package/lib/antv2/ant-interface.d.ts +3 -11
- package/lib/antv2/ant-interface.js +1 -1
- package/lib/antv2/base/adapter.d.ts +69 -0
- package/lib/antv2/base/adapter.js +439 -0
- package/lib/antv2/base/ant-interface.d.ts +35 -0
- package/lib/antv2/base/ant-interface.js +285 -0
- package/lib/antv2/base/binding.d.ts +13 -0
- package/lib/antv2/base/binding.js +27 -0
- package/lib/antv2/base/interface.d.ts +46 -0
- package/lib/antv2/base/interface.js +337 -0
- package/lib/antv2/cad/adapter.d.ts +10 -0
- package/lib/antv2/cad/adapter.js +25 -0
- package/lib/antv2/cad/index.d.ts +2 -0
- package/lib/antv2/cad/index.js +7 -0
- package/lib/antv2/consts.d.ts +2 -0
- package/lib/antv2/consts.js +5 -0
- package/lib/antv2/factories/adapter-factory.d.ts +14 -0
- package/lib/antv2/factories/adapter-factory.js +73 -0
- package/lib/antv2/factories/sensor-factory.d.ts +5 -0
- package/lib/antv2/factories/sensor-factory.js +22 -0
- package/lib/antv2/fe/adapter.d.ts +21 -30
- package/lib/antv2/fe/adapter.js +139 -251
- package/lib/antv2/hr/adapter.d.ts +6 -15
- package/lib/antv2/hr/adapter.js +7 -55
- package/lib/antv2/hr copy/adapter.d.ts +11 -0
- package/lib/antv2/hr copy/adapter.js +30 -0
- package/lib/antv2/hr copy/index.d.ts +2 -0
- package/lib/antv2/hr copy/index.js +7 -0
- package/lib/antv2/index.d.ts +5 -4
- package/lib/antv2/index.js +5 -3
- package/lib/antv2/pwr/adapter.d.ts +9 -33
- package/lib/antv2/pwr/adapter.js +19 -140
- package/lib/antv2/types.d.ts +32 -4
- package/lib/base/adpater.d.ts +39 -60
- package/lib/base/adpater.js +139 -161
- package/lib/base/consts.d.ts +4 -0
- package/lib/base/consts.js +9 -0
- package/lib/ble/adapter-factory.d.ts +10 -11
- package/lib/ble/base/adapter.d.ts +7 -14
- package/lib/ble/base/adapter.js +2 -36
- package/lib/ble/ble-interface.d.ts +5 -7
- package/lib/ble/cp/adapter.d.ts +6 -8
- package/lib/ble/cp/adapter.js +8 -27
- package/lib/ble/elite/adapter.d.ts +7 -8
- package/lib/ble/elite/adapter.js +5 -25
- package/lib/ble/fm/adapter.d.ts +6 -7
- package/lib/ble/fm/adapter.js +13 -34
- package/lib/ble/hr/adapter.d.ts +5 -8
- package/lib/ble/hr/adapter.js +2 -2
- package/lib/ble/peripheral-cache.d.ts +2 -3
- package/lib/ble/tacx/adapter.d.ts +2 -3
- package/lib/ble/tacx/adapter.js +8 -8
- package/lib/ble/types.d.ts +1 -2
- package/lib/ble/wahoo/adapter.d.ts +2 -2
- package/lib/ble/wahoo/adapter.js +6 -6
- package/lib/ble/wahoo/comms.js +16 -16
- package/lib/factories/adapters.d.ts +7 -0
- package/lib/factories/adapters.js +49 -0
- package/lib/factories/index.d.ts +3 -0
- package/lib/factories/index.js +10 -0
- package/lib/factories/interfaces.d.ts +7 -0
- package/lib/factories/interfaces.js +27 -0
- package/lib/index.d.ts +5 -6
- package/lib/index.js +4 -9
- package/lib/interfaces.d.ts +1 -1
- package/lib/modes/ant-fe-adv-st-mode.d.ts +1 -1
- package/lib/modes/antble-erg.d.ts +1 -1
- package/lib/modes/antble-smarttrainer.d.ts +2 -2
- package/lib/modes/base.d.ts +5 -5
- package/lib/modes/daum-classic-standard.d.ts +3 -2
- package/lib/modes/daum-erg.d.ts +3 -3
- package/lib/modes/daum-premium-standard.d.ts +3 -2
- package/lib/modes/daum-smarttrainer.d.ts +3 -2
- package/lib/modes/kettler-erg.d.ts +3 -3
- package/lib/modes/power-base.d.ts +3 -3
- package/lib/modes/power-base.js +2 -2
- package/lib/modes/power-meter.d.ts +3 -2
- package/lib/modes/simulator.d.ts +2 -1
- package/lib/modes/types.d.ts +2 -13
- package/lib/serial/SinglePathScanner.d.ts +17 -0
- package/lib/serial/SinglePathScanner.js +87 -0
- package/lib/serial/adapter-factory.d.ts +6 -6
- package/lib/serial/adapter.d.ts +6 -11
- package/lib/serial/base/adapter.d.ts +17 -0
- package/lib/serial/base/adapter.js +67 -0
- package/lib/serial/base/comms.d.ts +62 -0
- package/lib/serial/base/comms.js +280 -0
- package/lib/serial/base/serial-interface.d.ts +36 -0
- package/lib/serial/base/serial-interface.js +288 -0
- package/lib/serial/base/serial-scanner.d.ts +16 -0
- package/lib/serial/base/serial-scanner.js +87 -0
- package/lib/serial/base/serialport.d.ts +17 -0
- package/lib/serial/base/serialport.js +87 -0
- package/lib/serial/comms.d.ts +2 -2
- package/lib/serial/daum/DaumAdapter.d.ts +12 -24
- package/lib/serial/daum/DaumAdapter.js +40 -59
- package/lib/serial/daum/classic/PROTOCOL_NAME.d.ts +2 -0
- package/lib/serial/daum/classic/PROTOCOL_NAME.js +5 -0
- package/lib/serial/daum/classic/adapter.d.ts +8 -20
- package/lib/serial/daum/classic/adapter.js +28 -58
- package/lib/serial/daum/classic/comms.d.ts +4 -6
- package/lib/serial/daum/classic/comms.js +2 -2
- package/lib/serial/daum/classic/consts.d.ts +2 -0
- package/lib/serial/daum/classic/consts.js +5 -0
- package/lib/serial/daum/classic/mock.js +5 -4
- package/lib/serial/daum/classic/types.d.ts +8 -10
- package/lib/serial/daum/classic/utils.d.ts +1 -2
- package/lib/serial/daum/consts.d.ts +0 -19
- package/lib/serial/daum/consts.js +0 -22
- package/lib/serial/daum/premium/adapter.d.ts +8 -11
- package/lib/serial/daum/premium/adapter.js +27 -53
- package/lib/serial/daum/premium/comms.d.ts +4 -7
- package/lib/serial/daum/premium/comms.js +23 -22
- package/lib/serial/daum/premium/mock.d.ts +1 -1
- package/lib/serial/daum/premium/mock.js +2 -2
- package/lib/serial/daum/premium/types.d.ts +32 -17
- package/lib/serial/daum/premium/types.js +8 -8
- package/lib/serial/daum/premium/utils.d.ts +2 -3
- package/lib/serial/daum/premium/utils.js +3 -3
- package/lib/serial/daum/types.d.ts +4 -1
- package/lib/serial/daum/types.js +9 -1
- package/lib/serial/factories/adapter-factory.d.ts +14 -0
- package/lib/serial/factories/adapter-factory.js +30 -0
- package/lib/serial/index.d.ts +8 -5
- package/lib/serial/index.js +15 -15
- package/lib/serial/kettler/comms.d.ts +1 -1
- package/lib/serial/kettler/ergo-racer/adapter.d.ts +11 -18
- package/lib/serial/kettler/ergo-racer/adapter.js +9 -21
- package/lib/serial/kettler/types.d.ts +8 -0
- package/lib/serial/kettler/types.js +2 -0
- package/lib/serial/serial-interface.d.ts +2 -32
- package/lib/serial/serial-interface.js +3 -76
- package/lib/serial/serial-scanner.d.ts +16 -0
- package/lib/serial/serial-scanner.js +87 -0
- package/lib/serial/serialport.d.ts +1 -13
- package/lib/serial/types.d.ts +45 -0
- package/lib/serial/types.js +9 -0
- package/lib/simulator/Simulator.d.ts +10 -13
- package/lib/simulator/Simulator.js +11 -23
- package/lib/types/Command.d.ts +8 -0
- package/lib/types/Command.js +2 -0
- package/lib/types/adapter.d.ts +22 -33
- package/lib/types/adapter.js +0 -68
- package/lib/types/command.d.ts +0 -8
- package/lib/types/command.js +0 -2
- package/lib/types/data.d.ts +12 -1
- package/lib/types/device.d.ts +8 -23
- package/lib/types/device.js +9 -8
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.js +22 -0
- package/lib/types/route.d.ts +0 -19
- package/lib/types/route.js +0 -2
- package/lib/types/types.d.ts +8 -0
- package/lib/types/types.js +2 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.js +39 -4
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./adapter"), exports);
|
|
18
|
+
__exportStar(require("./capabilities"), exports);
|
|
19
|
+
__exportStar(require("./data"), exports);
|
|
20
|
+
__exportStar(require("./device"), exports);
|
|
21
|
+
__exportStar(require("./interface"), exports);
|
|
22
|
+
__exportStar(require("./user"), exports);
|
package/lib/types/route.d.ts
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type Point = {
|
|
2
|
-
lat?: number;
|
|
3
|
-
lng?: number;
|
|
4
|
-
elevation?: number;
|
|
5
|
-
distance: number;
|
|
6
|
-
slope?: number;
|
|
7
|
-
};
|
|
8
|
-
export type Route = {
|
|
9
|
-
programId: number;
|
|
10
|
-
points: Point[];
|
|
11
|
-
type: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
lapMode: boolean;
|
|
15
|
-
totalDistance: number;
|
|
16
|
-
minElevation?: number;
|
|
17
|
-
maxElevation?: number;
|
|
18
|
-
sampleRate?: number;
|
|
19
|
-
};
|
package/lib/types/route.js
CHANGED
package/lib/utils/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function runWithRetries(fn: any, maxRetries: any, timeBetween: an
|
|
|
4
4
|
export declare function floatVal(d?: number | string): number;
|
|
5
5
|
export declare function intVal(d?: number | string): number;
|
|
6
6
|
export declare function hexstr(arr: any, start?: any, len?: any): string;
|
|
7
|
+
export declare function isTrue(value: any): boolean;
|
|
7
8
|
export declare class Queue<T> {
|
|
8
9
|
protected data: Array<T>;
|
|
9
10
|
constructor(values?: Array<T>);
|
|
@@ -13,4 +14,5 @@ export declare class Queue<T> {
|
|
|
13
14
|
dequeue(): T;
|
|
14
15
|
enqueue(value: T): void;
|
|
15
16
|
}
|
|
17
|
+
export declare function runWithTimeout(promise: Promise<any>, timeout: number): Promise<any>;
|
|
16
18
|
export declare function waitWithTimeout(promise: Promise<any>, timeout: number, onTimeout?: () => void): Promise<any>;
|
package/lib/utils/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.waitWithTimeout = exports.Queue = exports.hexstr = exports.intVal = exports.floatVal = exports.runWithRetries = exports.resolveNextTick = exports.sleep = void 0;
|
|
12
|
+
exports.waitWithTimeout = exports.runWithTimeout = exports.Queue = exports.isTrue = exports.hexstr = exports.intVal = exports.floatVal = exports.runWithRetries = exports.resolveNextTick = exports.sleep = void 0;
|
|
13
13
|
const sleep = (ms) => {
|
|
14
14
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
15
15
|
};
|
|
@@ -92,6 +92,23 @@ function hexstr(arr, start, len) {
|
|
|
92
92
|
return str;
|
|
93
93
|
}
|
|
94
94
|
exports.hexstr = hexstr;
|
|
95
|
+
function isTrue(value) {
|
|
96
|
+
if (typeof (value) === 'string') {
|
|
97
|
+
value = value.trim().toLowerCase();
|
|
98
|
+
}
|
|
99
|
+
switch (value) {
|
|
100
|
+
case true:
|
|
101
|
+
case "true":
|
|
102
|
+
case 1:
|
|
103
|
+
case "1":
|
|
104
|
+
case "on":
|
|
105
|
+
case "yes":
|
|
106
|
+
return true;
|
|
107
|
+
default:
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.isTrue = isTrue;
|
|
95
112
|
class Queue {
|
|
96
113
|
constructor(values) {
|
|
97
114
|
this.data = [];
|
|
@@ -116,7 +133,19 @@ class Queue {
|
|
|
116
133
|
}
|
|
117
134
|
}
|
|
118
135
|
exports.Queue = Queue;
|
|
136
|
+
function runWithTimeout(promise, timeout) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
return yield doWaitWithTimeout(promise, timeout, true);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports.runWithTimeout = runWithTimeout;
|
|
119
142
|
function waitWithTimeout(promise, timeout, onTimeout) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
return yield doWaitWithTimeout(promise, timeout, false, onTimeout);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
exports.waitWithTimeout = waitWithTimeout;
|
|
148
|
+
function doWaitWithTimeout(promise, timeout, throwError, onTimeout) {
|
|
120
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
150
|
let to;
|
|
122
151
|
let hasTimedOut = false;
|
|
@@ -124,7 +153,7 @@ function waitWithTimeout(promise, timeout, onTimeout) {
|
|
|
124
153
|
return new Promise((resolve, reject) => {
|
|
125
154
|
to = setTimeout(() => {
|
|
126
155
|
hasTimedOut = true;
|
|
127
|
-
if (!onTimeout) {
|
|
156
|
+
if (!onTimeout || throwError) {
|
|
128
157
|
reject(new Error('Timeout'));
|
|
129
158
|
}
|
|
130
159
|
else {
|
|
@@ -144,11 +173,17 @@ function waitWithTimeout(promise, timeout, onTimeout) {
|
|
|
144
173
|
res = yield Promise.race([promise, toPromise(timeout)]);
|
|
145
174
|
}
|
|
146
175
|
catch (err) {
|
|
147
|
-
if (err.message === 'Timeout' && hasTimedOut)
|
|
176
|
+
if (err.message === 'Timeout' && hasTimedOut) {
|
|
148
177
|
throw err;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
if (throwError) {
|
|
181
|
+
clearTimeout(to);
|
|
182
|
+
throw err;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
149
185
|
}
|
|
150
186
|
clearTimeout(to);
|
|
151
187
|
return res;
|
|
152
188
|
});
|
|
153
189
|
}
|
|
154
|
-
exports.waitWithTimeout = waitWithTimeout;
|