incyclist-devices 2.0.17 → 2.0.18
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.
|
@@ -31,11 +31,18 @@ class AntAdapterFactory {
|
|
|
31
31
|
createInstance(settings, props) {
|
|
32
32
|
let info;
|
|
33
33
|
const { profile, protocol } = settings;
|
|
34
|
+
let isLegacy = false;
|
|
34
35
|
if (protocol) {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
try {
|
|
37
|
+
const incyclistProfile = profile;
|
|
38
|
+
info = this.getAdapter({ incyclistProfile });
|
|
39
|
+
isLegacy = true;
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
isLegacy = false;
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
|
-
|
|
45
|
+
if (!isLegacy) {
|
|
39
46
|
const antProfile = profile;
|
|
40
47
|
info = this.getAdapter({ antProfile });
|
|
41
48
|
}
|
|
@@ -22,9 +22,14 @@ class BleAdapterFactory {
|
|
|
22
22
|
let { profile, protocol } = settings;
|
|
23
23
|
const adapterSettings = Object.assign({}, settings);
|
|
24
24
|
if (profile) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
try {
|
|
26
|
+
const mapping = (0, utils_1.mapLegacyProfile)(profile);
|
|
27
|
+
protocol = adapterSettings.protocol = mapping.protocol;
|
|
28
|
+
delete adapterSettings.profile;
|
|
29
|
+
}
|
|
30
|
+
catch (_a) {
|
|
31
|
+
delete settings.profile;
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
const existing = this.find(adapterSettings);
|
|
30
35
|
if (existing) {
|
package/lib/ble/utils.js
CHANGED
|
@@ -5,9 +5,12 @@ function mapLegacyProfile(profile) {
|
|
|
5
5
|
switch (profile) {
|
|
6
6
|
case 'Smart Trainer': return { profile: 'Smart Trainer', protocol: 'fm' };
|
|
7
7
|
case 'Elite Smart Trainer': return { profile: 'Smart Trainer', protocol: 'elite' };
|
|
8
|
+
case 'Elite SmartTrainer': return { profile: 'Smart Trainer', protocol: 'elite' };
|
|
8
9
|
case 'Heartrate Monitor': return { profile: 'Heartrate Monitor', protocol: 'hr' };
|
|
9
10
|
case 'Power Meter': return { profile: 'Power Meter', protocol: 'cp' };
|
|
10
11
|
case 'Tacx Smart Trainer': return { profile: 'Smart Trainer', protocol: 'tacx' };
|
|
12
|
+
case 'Tacx SmartTrainer': return { profile: 'Smart Trainer', protocol: 'tacx' };
|
|
13
|
+
case 'Wahoo SmartTrainer': return { profile: 'Smart Trainer', protocol: 'wahoo' };
|
|
11
14
|
case 'Wahoo Smart Trainer': return { profile: 'Smart Trainer', protocol: 'wahoo' };
|
|
12
15
|
}
|
|
13
16
|
}
|