incyclist-devices 1.5.11 → 1.5.12

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.
Files changed (136) hide show
  1. package/LICENSE +0 -0
  2. package/lib/DeviceSupport.d.ts +36 -36
  3. package/lib/DeviceSupport.js +82 -82
  4. package/lib/ant/AntAdapter.d.ts +50 -50
  5. package/lib/ant/AntAdapter.js +109 -109
  6. package/lib/ant/AntScanner.d.ts +60 -60
  7. package/lib/ant/AntScanner.js +651 -651
  8. package/lib/ant/antfe/AntFEAdapter.d.ts +83 -83
  9. package/lib/ant/antfe/AntFEAdapter.js +652 -652
  10. package/lib/ant/antfe/ant-fe-adv-st-mode.d.ts +9 -9
  11. package/lib/ant/antfe/ant-fe-adv-st-mode.js +51 -51
  12. package/lib/ant/antfe/ant-fe-erg-mode.d.ts +6 -6
  13. package/lib/ant/antfe/ant-fe-erg-mode.js +14 -14
  14. package/lib/ant/antfe/ant-fe-st-mode.d.ts +5 -5
  15. package/lib/ant/antfe/ant-fe-st-mode.js +13 -13
  16. package/lib/ant/anthrm/AntHrmAdapter.d.ts +16 -16
  17. package/lib/ant/anthrm/AntHrmAdapter.js +130 -130
  18. package/lib/ant/antpwr/pwr-adapter.d.ts +49 -49
  19. package/lib/ant/antpwr/pwr-adapter.js +251 -251
  20. package/lib/ant/utils.d.ts +1 -1
  21. package/lib/ant/utils.js +23 -23
  22. package/lib/antv2/AntAdapter.d.ts +48 -0
  23. package/lib/antv2/AntAdapter.js +104 -0
  24. package/lib/antv2/adapter-factory.d.ts +11 -11
  25. package/lib/antv2/adapter-factory.js +40 -40
  26. package/lib/antv2/ant-binding.d.ts +13 -13
  27. package/lib/antv2/ant-binding.js +27 -27
  28. package/lib/antv2/ant-device.d.ts +51 -51
  29. package/lib/antv2/ant-device.js +115 -115
  30. package/lib/antv2/ant-interface.d.ts +37 -37
  31. package/lib/antv2/ant-interface.js +255 -255
  32. package/lib/antv2/fe.d.ts +29 -29
  33. package/lib/antv2/fe.js +262 -262
  34. package/lib/antv2/hr.d.ts +18 -18
  35. package/lib/antv2/hr.js +93 -93
  36. package/lib/antv2/incyclist-protocol.d.ts +37 -37
  37. package/lib/antv2/incyclist-protocol.js +126 -126
  38. package/lib/antv2/pwr.d.ts +28 -28
  39. package/lib/antv2/pwr.js +163 -163
  40. package/lib/antv2/sensor-factory.d.ts +5 -5
  41. package/lib/antv2/sensor-factory.js +20 -20
  42. package/lib/ble/ble-device.d.ts +63 -63
  43. package/lib/ble/ble-device.js +444 -444
  44. package/lib/ble/ble-erg-mode.d.ts +18 -18
  45. package/lib/ble/ble-erg-mode.js +132 -132
  46. package/lib/ble/ble-interface.d.ts +100 -100
  47. package/lib/ble/ble-interface.js +721 -721
  48. package/lib/ble/ble-peripheral.d.ts +36 -36
  49. package/lib/ble/ble-peripheral.js +200 -200
  50. package/lib/ble/ble-st-mode.d.ts +15 -15
  51. package/lib/ble/ble-st-mode.js +95 -95
  52. package/lib/ble/ble.d.ts +129 -129
  53. package/lib/ble/ble.js +86 -86
  54. package/lib/ble/consts.d.ts +14 -14
  55. package/lib/ble/consts.js +17 -17
  56. package/lib/ble/elite.d.ts +90 -90
  57. package/lib/ble/elite.js +322 -322
  58. package/lib/ble/fm.d.ts +125 -125
  59. package/lib/ble/fm.js +745 -745
  60. package/lib/ble/hrm.d.ts +48 -48
  61. package/lib/ble/hrm.js +134 -134
  62. package/lib/ble/incyclist-protocol.d.ts +31 -31
  63. package/lib/ble/incyclist-protocol.js +153 -153
  64. package/lib/ble/pwr.d.ts +89 -89
  65. package/lib/ble/pwr.js +321 -321
  66. package/lib/ble/tacx.d.ts +92 -90
  67. package/lib/ble/tacx.js +763 -731
  68. package/lib/ble/wahoo-kickr.d.ts +98 -98
  69. package/lib/ble/wahoo-kickr.js +496 -496
  70. package/lib/calculations.d.ts +13 -13
  71. package/lib/calculations.js +150 -150
  72. package/lib/cycling-mode.d.ts +76 -76
  73. package/lib/cycling-mode.js +79 -79
  74. package/lib/daum/DaumAdapter.d.ts +66 -66
  75. package/lib/daum/DaumAdapter.js +396 -396
  76. package/lib/daum/DaumPowerMeterCyclingMode.d.ts +8 -8
  77. package/lib/daum/DaumPowerMeterCyclingMode.js +21 -21
  78. package/lib/daum/ERGCyclingMode.d.ts +26 -26
  79. package/lib/daum/ERGCyclingMode.js +201 -201
  80. package/lib/daum/SmartTrainerCyclingMode.d.ts +41 -41
  81. package/lib/daum/SmartTrainerCyclingMode.js +344 -344
  82. package/lib/daum/classic/DaumClassicAdapter.d.ts +22 -22
  83. package/lib/daum/classic/DaumClassicAdapter.js +183 -183
  84. package/lib/daum/classic/DaumClassicCyclingMode.d.ts +13 -13
  85. package/lib/daum/classic/DaumClassicCyclingMode.js +97 -97
  86. package/lib/daum/classic/DaumClassicProtocol.d.ts +27 -27
  87. package/lib/daum/classic/DaumClassicProtocol.js +185 -185
  88. package/lib/daum/classic/bike.d.ts +68 -68
  89. package/lib/daum/classic/bike.js +467 -467
  90. package/lib/daum/classic/utils.d.ts +13 -13
  91. package/lib/daum/classic/utils.js +143 -143
  92. package/lib/daum/constants.d.ts +19 -19
  93. package/lib/daum/constants.js +22 -22
  94. package/lib/daum/premium/DaumClassicCyclingMode.d.ts +14 -14
  95. package/lib/daum/premium/DaumClassicCyclingMode.js +86 -86
  96. package/lib/daum/premium/DaumPremiumAdapter.d.ts +16 -16
  97. package/lib/daum/premium/DaumPremiumAdapter.js +163 -163
  98. package/lib/daum/premium/DaumPremiumProtocol.d.ts +32 -32
  99. package/lib/daum/premium/DaumPremiumProtocol.js +207 -207
  100. package/lib/daum/premium/bike.d.ts +127 -127
  101. package/lib/daum/premium/bike.js +904 -904
  102. package/lib/daum/premium/tcpserial.d.ts +33 -33
  103. package/lib/daum/premium/tcpserial.js +123 -123
  104. package/lib/daum/premium/utils.d.ts +62 -62
  105. package/lib/daum/premium/utils.js +376 -376
  106. package/lib/device.d.ts +92 -92
  107. package/lib/device.js +71 -71
  108. package/lib/kettler/comms.d.ts +59 -59
  109. package/lib/kettler/comms.js +242 -242
  110. package/lib/kettler/ergo-racer/ERGCyclingMode.d.ts +25 -25
  111. package/lib/kettler/ergo-racer/ERGCyclingMode.js +144 -144
  112. package/lib/kettler/ergo-racer/adapter.d.ts +101 -101
  113. package/lib/kettler/ergo-racer/adapter.js +639 -639
  114. package/lib/kettler/ergo-racer/protocol.d.ts +41 -41
  115. package/lib/kettler/ergo-racer/protocol.js +203 -203
  116. package/lib/modes/power-base.d.ts +20 -20
  117. package/lib/modes/power-base.js +70 -70
  118. package/lib/modes/power-meter.d.ts +20 -20
  119. package/lib/modes/power-meter.js +78 -78
  120. package/lib/modes/simulator.d.ts +29 -29
  121. package/lib/modes/simulator.js +140 -140
  122. package/lib/protocol.d.ts +74 -74
  123. package/lib/protocol.js +41 -41
  124. package/lib/registry.d.ts +8 -8
  125. package/lib/registry.js +33 -33
  126. package/lib/simulator/Simulator.d.ts +69 -69
  127. package/lib/simulator/Simulator.js +288 -288
  128. package/lib/types/command.d.ts +8 -8
  129. package/lib/types/command.js +2 -2
  130. package/lib/types/route.d.ts +24 -24
  131. package/lib/types/route.js +9 -9
  132. package/lib/types/user.d.ts +11 -11
  133. package/lib/types/user.js +9 -9
  134. package/lib/utils.d.ts +14 -14
  135. package/lib/utils.js +114 -114
  136. package/package.json +47 -47
@@ -1,13 +1,13 @@
1
- export declare const DEFAULT_AGE = 30;
2
- export declare const DEFAULT_USER_WEIGHT = 75;
3
- export declare const DEFAULT_BIKE_WEIGHT = 10;
4
- export declare function getCockpit(c: any): "Cardio" | "Fitness" | "Vita De Luxe" | "8008" | "8008 TRS" | "8080" | "Therapie" | "8008 TRS Pro" | "8008 TRS3" | "ergo_lyps Cardio Pro" | "Unknown";
5
- export declare function getBikeType(type: any): 1 | 0;
6
- export declare function getGender(sex: any): 1 | 2;
7
- export declare function getLength(length: any): number;
8
- export declare function getWeight(weight?: any): number;
9
- export declare function parseRunData(data: any): any;
10
- export declare function buildError(status: any, err: any): any;
11
- export declare function hexstr(arr: any, start?: any, len?: any): string;
12
- export declare function Float32ToHex(float32: any): any;
13
- export declare function Float32ToIntArray(float32: any): any[];
1
+ export declare const DEFAULT_AGE = 30;
2
+ export declare const DEFAULT_USER_WEIGHT = 75;
3
+ export declare const DEFAULT_BIKE_WEIGHT = 10;
4
+ export declare function getCockpit(c: any): "Cardio" | "Fitness" | "Vita De Luxe" | "8008" | "8008 TRS" | "8080" | "Therapie" | "8008 TRS Pro" | "8008 TRS3" | "ergo_lyps Cardio Pro" | "Unknown";
5
+ export declare function getBikeType(type: any): 1 | 0;
6
+ export declare function getGender(sex: any): 1 | 2;
7
+ export declare function getLength(length: any): number;
8
+ export declare function getWeight(weight?: any): number;
9
+ export declare function parseRunData(data: any): any;
10
+ export declare function buildError(status: any, err: any): any;
11
+ export declare function hexstr(arr: any, start?: any, len?: any): string;
12
+ export declare function Float32ToHex(float32: any): any;
13
+ export declare function Float32ToIntArray(float32: any): any[];
@@ -1,143 +1,143 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Float32ToIntArray = exports.Float32ToHex = exports.hexstr = exports.buildError = exports.parseRunData = exports.getWeight = exports.getLength = exports.getGender = exports.getBikeType = exports.getCockpit = exports.DEFAULT_BIKE_WEIGHT = exports.DEFAULT_USER_WEIGHT = exports.DEFAULT_AGE = void 0;
4
- exports.DEFAULT_AGE = 30;
5
- exports.DEFAULT_USER_WEIGHT = 75;
6
- exports.DEFAULT_BIKE_WEIGHT = 10;
7
- function getCockpit(c) {
8
- switch (c) {
9
- case 10:
10
- return "Cardio";
11
- case 20:
12
- return "Fitness";
13
- case 30:
14
- return "Vita De Luxe";
15
- case 40:
16
- return "8008";
17
- case 0x2A:
18
- return "8008 TRS";
19
- case 50:
20
- return "8080";
21
- case 60:
22
- return "Therapie";
23
- case 100:
24
- return "8008 TRS Pro";
25
- case 160:
26
- return "8008 TRS3";
27
- case 0x8D:
28
- return "ergo_lyps Cardio Pro";
29
- default:
30
- return "Unknown";
31
- }
32
- }
33
- exports.getCockpit = getCockpit;
34
- function getBikeType(type) {
35
- if (type === undefined)
36
- return 0;
37
- switch (type) {
38
- case "triathlon":
39
- return 0;
40
- case "race":
41
- return 0;
42
- case "mountain":
43
- return 1;
44
- default:
45
- return 1;
46
- }
47
- }
48
- exports.getBikeType = getBikeType;
49
- function getGender(sex) {
50
- if (sex === undefined)
51
- return 2;
52
- switch (sex) {
53
- case "M":
54
- return 1;
55
- case "F":
56
- return 1;
57
- default:
58
- return 2;
59
- }
60
- }
61
- exports.getGender = getGender;
62
- function getLength(length) {
63
- if (length === undefined || length === null)
64
- return 180;
65
- let l = Math.round(length);
66
- if (l < 100)
67
- return 100;
68
- if (l > 220)
69
- return 220;
70
- return l;
71
- }
72
- exports.getLength = getLength;
73
- function getWeight(weight) {
74
- if (weight === undefined || weight === null)
75
- return 80;
76
- let m = Math.round(weight);
77
- if (isNaN(m))
78
- return 80;
79
- if (m < 10)
80
- return 10;
81
- if (m > 250)
82
- return 250;
83
- return m;
84
- }
85
- exports.getWeight = getWeight;
86
- function parseRunData(data) {
87
- const bikeData = {};
88
- bikeData.isPedalling = (data[4] > 0);
89
- bikeData.power = data[5] * 5;
90
- bikeData.cadence = data[6];
91
- bikeData.speed = data[7];
92
- bikeData.heartrate = data[14];
93
- bikeData.distance = (data[9] * 256 + data[8]) / 10;
94
- bikeData.distanceInternal = (data[9] * 256 + data[8]) * 100;
95
- bikeData.time = (data[11] * 256 + data[10]);
96
- bikeData.gear = data[16];
97
- return bikeData;
98
- }
99
- exports.parseRunData = parseRunData;
100
- function buildError(status, err) {
101
- const message = err && err.message ? err.message : err;
102
- const error = new Error(message);
103
- error.status = status;
104
- return error;
105
- }
106
- exports.buildError = buildError;
107
- function hexstr(arr, start, len) {
108
- var str = "";
109
- if (start === undefined)
110
- start = 0;
111
- if (len === undefined) {
112
- len = arr.length;
113
- }
114
- if (len - start > arr.length) {
115
- len = arr.length - start;
116
- }
117
- var j = start;
118
- for (var i = 0; i < len; i++) {
119
- var hex = Math.abs(arr[j++]).toString(16);
120
- if (i !== 0)
121
- str += " ";
122
- str += hex;
123
- }
124
- return str;
125
- }
126
- exports.hexstr = hexstr;
127
- function Float32ToHex(float32) {
128
- function getHex(i) { return ('00' + i.toString(16)).slice(-2).toUpperCase(); }
129
- var view = new DataView(new ArrayBuffer(4));
130
- view.setFloat32(0, float32);
131
- return Array.apply(null, { length: 4 }).map((_, i) => getHex(view.getUint8(i))).join('');
132
- }
133
- exports.Float32ToHex = Float32ToHex;
134
- function Float32ToIntArray(float32) {
135
- var view = new DataView(new ArrayBuffer(4));
136
- view.setFloat32(0, float32);
137
- var arr = [];
138
- for (let i = 0; i < 4; i++) {
139
- arr.push(view.getUint8(i));
140
- }
141
- return arr;
142
- }
143
- exports.Float32ToIntArray = Float32ToIntArray;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Float32ToIntArray = exports.Float32ToHex = exports.hexstr = exports.buildError = exports.parseRunData = exports.getWeight = exports.getLength = exports.getGender = exports.getBikeType = exports.getCockpit = exports.DEFAULT_BIKE_WEIGHT = exports.DEFAULT_USER_WEIGHT = exports.DEFAULT_AGE = void 0;
4
+ exports.DEFAULT_AGE = 30;
5
+ exports.DEFAULT_USER_WEIGHT = 75;
6
+ exports.DEFAULT_BIKE_WEIGHT = 10;
7
+ function getCockpit(c) {
8
+ switch (c) {
9
+ case 10:
10
+ return "Cardio";
11
+ case 20:
12
+ return "Fitness";
13
+ case 30:
14
+ return "Vita De Luxe";
15
+ case 40:
16
+ return "8008";
17
+ case 0x2A:
18
+ return "8008 TRS";
19
+ case 50:
20
+ return "8080";
21
+ case 60:
22
+ return "Therapie";
23
+ case 100:
24
+ return "8008 TRS Pro";
25
+ case 160:
26
+ return "8008 TRS3";
27
+ case 0x8D:
28
+ return "ergo_lyps Cardio Pro";
29
+ default:
30
+ return "Unknown";
31
+ }
32
+ }
33
+ exports.getCockpit = getCockpit;
34
+ function getBikeType(type) {
35
+ if (type === undefined)
36
+ return 0;
37
+ switch (type) {
38
+ case "triathlon":
39
+ return 0;
40
+ case "race":
41
+ return 0;
42
+ case "mountain":
43
+ return 1;
44
+ default:
45
+ return 1;
46
+ }
47
+ }
48
+ exports.getBikeType = getBikeType;
49
+ function getGender(sex) {
50
+ if (sex === undefined)
51
+ return 2;
52
+ switch (sex) {
53
+ case "M":
54
+ return 1;
55
+ case "F":
56
+ return 1;
57
+ default:
58
+ return 2;
59
+ }
60
+ }
61
+ exports.getGender = getGender;
62
+ function getLength(length) {
63
+ if (length === undefined || length === null)
64
+ return 180;
65
+ let l = Math.round(length);
66
+ if (l < 100)
67
+ return 100;
68
+ if (l > 220)
69
+ return 220;
70
+ return l;
71
+ }
72
+ exports.getLength = getLength;
73
+ function getWeight(weight) {
74
+ if (weight === undefined || weight === null)
75
+ return 80;
76
+ let m = Math.round(weight);
77
+ if (isNaN(m))
78
+ return 80;
79
+ if (m < 10)
80
+ return 10;
81
+ if (m > 250)
82
+ return 250;
83
+ return m;
84
+ }
85
+ exports.getWeight = getWeight;
86
+ function parseRunData(data) {
87
+ const bikeData = {};
88
+ bikeData.isPedalling = (data[4] > 0);
89
+ bikeData.power = data[5] * 5;
90
+ bikeData.cadence = data[6];
91
+ bikeData.speed = data[7];
92
+ bikeData.heartrate = data[14];
93
+ bikeData.distance = (data[9] * 256 + data[8]) / 10;
94
+ bikeData.distanceInternal = (data[9] * 256 + data[8]) * 100;
95
+ bikeData.time = (data[11] * 256 + data[10]);
96
+ bikeData.gear = data[16];
97
+ return bikeData;
98
+ }
99
+ exports.parseRunData = parseRunData;
100
+ function buildError(status, err) {
101
+ const message = err && err.message ? err.message : err;
102
+ const error = new Error(message);
103
+ error.status = status;
104
+ return error;
105
+ }
106
+ exports.buildError = buildError;
107
+ function hexstr(arr, start, len) {
108
+ var str = "";
109
+ if (start === undefined)
110
+ start = 0;
111
+ if (len === undefined) {
112
+ len = arr.length;
113
+ }
114
+ if (len - start > arr.length) {
115
+ len = arr.length - start;
116
+ }
117
+ var j = start;
118
+ for (var i = 0; i < len; i++) {
119
+ var hex = Math.abs(arr[j++]).toString(16);
120
+ if (i !== 0)
121
+ str += " ";
122
+ str += hex;
123
+ }
124
+ return str;
125
+ }
126
+ exports.hexstr = hexstr;
127
+ function Float32ToHex(float32) {
128
+ function getHex(i) { return ('00' + i.toString(16)).slice(-2).toUpperCase(); }
129
+ var view = new DataView(new ArrayBuffer(4));
130
+ view.setFloat32(0, float32);
131
+ return Array.apply(null, { length: 4 }).map((_, i) => getHex(view.getUint8(i))).join('');
132
+ }
133
+ exports.Float32ToHex = Float32ToHex;
134
+ function Float32ToIntArray(float32) {
135
+ var view = new DataView(new ArrayBuffer(4));
136
+ view.setFloat32(0, float32);
137
+ var arr = [];
138
+ for (let i = 0; i < 4; i++) {
139
+ arr.push(view.getUint8(i));
140
+ }
141
+ return arr;
142
+ }
143
+ exports.Float32ToIntArray = Float32ToIntArray;
@@ -1,19 +1,19 @@
1
- export declare const ACTUAL_BIKE_TYPE: {
2
- ALLROUND: string;
3
- RACE: string;
4
- MOUNTAIN: string;
5
- TRIATHLON: string;
6
- };
7
- export declare const BIKE_INTERFACE: {
8
- SERIAL: string;
9
- ANT: string;
10
- BLE: string;
11
- BLUETOOTH: string;
12
- TCPIP: string;
13
- };
14
- export declare const BIKE_TRAINING_STATE: {
15
- IDLE: string;
16
- STARTING: string;
17
- BUSY: string;
18
- STOPPING: string;
19
- };
1
+ export declare const ACTUAL_BIKE_TYPE: {
2
+ ALLROUND: string;
3
+ RACE: string;
4
+ MOUNTAIN: string;
5
+ TRIATHLON: string;
6
+ };
7
+ export declare const BIKE_INTERFACE: {
8
+ SERIAL: string;
9
+ ANT: string;
10
+ BLE: string;
11
+ BLUETOOTH: string;
12
+ TCPIP: string;
13
+ };
14
+ export declare const BIKE_TRAINING_STATE: {
15
+ IDLE: string;
16
+ STARTING: string;
17
+ BUSY: string;
18
+ STOPPING: string;
19
+ };
@@ -1,22 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BIKE_TRAINING_STATE = exports.BIKE_INTERFACE = exports.ACTUAL_BIKE_TYPE = void 0;
4
- exports.ACTUAL_BIKE_TYPE = {
5
- ALLROUND: 'allround',
6
- RACE: 'race',
7
- MOUNTAIN: 'mountain',
8
- TRIATHLON: 'triathlon'
9
- };
10
- exports.BIKE_INTERFACE = {
11
- SERIAL: 'serial',
12
- ANT: 'ant',
13
- BLE: 'ble',
14
- BLUETOOTH: 'bluetooth',
15
- TCPIP: 'tcpip',
16
- };
17
- exports.BIKE_TRAINING_STATE = {
18
- IDLE: 'idle',
19
- STARTING: 'starting',
20
- BUSY: 'busy',
21
- STOPPING: 'stopping'
22
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BIKE_TRAINING_STATE = exports.BIKE_INTERFACE = exports.ACTUAL_BIKE_TYPE = void 0;
4
+ exports.ACTUAL_BIKE_TYPE = {
5
+ ALLROUND: 'allround',
6
+ RACE: 'race',
7
+ MOUNTAIN: 'mountain',
8
+ TRIATHLON: 'triathlon'
9
+ };
10
+ exports.BIKE_INTERFACE = {
11
+ SERIAL: 'serial',
12
+ ANT: 'ant',
13
+ BLE: 'ble',
14
+ BLUETOOTH: 'bluetooth',
15
+ TCPIP: 'tcpip',
16
+ };
17
+ exports.BIKE_TRAINING_STATE = {
18
+ IDLE: 'idle',
19
+ STARTING: 'starting',
20
+ BUSY: 'busy',
21
+ STOPPING: 'stopping'
22
+ };
@@ -1,14 +1,14 @@
1
- import CyclingMode, { CyclingModeProperty, IncyclistBikeData, Settings, UpdateRequest } from "../../cycling-mode";
2
- import DaumAdapter from "../DaumAdapter";
3
- import DaumPowerMeterCyclingMode from "../DaumPowerMeterCyclingMode";
4
- export default class DaumClassicCyclingMode extends DaumPowerMeterCyclingMode implements CyclingMode {
5
- constructor(adapter: DaumAdapter, props?: Settings);
6
- getName(): string;
7
- getDescription(): string;
8
- getProperties(): CyclingModeProperty[];
9
- getProperty(name: string): CyclingModeProperty;
10
- getBikeInitRequest(): UpdateRequest;
11
- getSettings(): Settings;
12
- getSetting(name: string): any;
13
- updateData(data: IncyclistBikeData): IncyclistBikeData;
14
- }
1
+ import CyclingMode, { CyclingModeProperty, IncyclistBikeData, Settings, UpdateRequest } from "../../cycling-mode";
2
+ import DaumAdapter from "../DaumAdapter";
3
+ import DaumPowerMeterCyclingMode from "../DaumPowerMeterCyclingMode";
4
+ export default class DaumClassicCyclingMode extends DaumPowerMeterCyclingMode implements CyclingMode {
5
+ constructor(adapter: DaumAdapter, props?: Settings);
6
+ getName(): string;
7
+ getDescription(): string;
8
+ getProperties(): CyclingModeProperty[];
9
+ getProperty(name: string): CyclingModeProperty;
10
+ getBikeInitRequest(): UpdateRequest;
11
+ getSettings(): Settings;
12
+ getSetting(name: string): any;
13
+ updateData(data: IncyclistBikeData): IncyclistBikeData;
14
+ }
@@ -1,86 +1,86 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const gd_eventlog_1 = require("gd-eventlog");
7
- const cycling_mode_1 = require("../../cycling-mode");
8
- const DaumPowerMeterCyclingMode_1 = __importDefault(require("../DaumPowerMeterCyclingMode"));
9
- const config = {
10
- name: "Daum Classic",
11
- description: "The device calculates speed and power based on slope. Incyclist will not modify any values recived from the device\nThis mode will not respect maximum power and/or workout limits",
12
- properties: [
13
- { key: 'bikeType', name: 'Bike Type', description: '', type: cycling_mode_1.CyclingModeProperyType.SingleSelect, options: ['Race', 'Mountain'], default: 'Race' },
14
- ]
15
- };
16
- class DaumClassicCyclingMode extends DaumPowerMeterCyclingMode_1.default {
17
- constructor(adapter, props) {
18
- super(adapter, props);
19
- this.logger = adapter ? adapter.logger : undefined;
20
- if (!this.logger)
21
- this.logger = new gd_eventlog_1.EventLogger('DaumClassic');
22
- this.setModeProperty('eppSupport', true);
23
- this.setModeProperty('setPersonSupport', true);
24
- }
25
- getName() {
26
- return config.name;
27
- }
28
- getDescription() {
29
- return config.description;
30
- }
31
- getProperties() {
32
- return config.properties;
33
- }
34
- getProperty(name) {
35
- return config.properties.find(p => p.name === name);
36
- }
37
- getBikeInitRequest() {
38
- return {};
39
- }
40
- getSettings() {
41
- const settings = super.getSettings();
42
- settings['setPerson'] = true;
43
- return settings;
44
- }
45
- getSetting(name) {
46
- if (name === 'setPerson')
47
- return true;
48
- return super.getSetting(name);
49
- }
50
- updateData(data) {
51
- try {
52
- const prevData = this.data || {};
53
- const prevRequest = this.prevRequest || {};
54
- const bikeData = JSON.parse(JSON.stringify(data));
55
- let power = data.power || 0;
56
- let speed = data.speed || 0;
57
- let slope = (prevData.slope !== undefined ? prevData.slope : prevRequest.slope || 0);
58
- let distanceBike = data.distanceInternal || 0;
59
- let distancePrev = prevData.distanceInternal || 0;
60
- let distanceInternal = distanceBike;
61
- let ts = Date.now();
62
- if (!bikeData.pedalRpm || bikeData.isPedalling === false) {
63
- speed = 0;
64
- power = 0;
65
- }
66
- if (distanceBike < distancePrev) {
67
- this.logger.logEvent({ message: '~~~ distance overflow', distanceBike, distancePrev });
68
- let v = speed / 3.6;
69
- let duration = this.prevUpdateTS === 0 ? 0 : ((ts - this.prevUpdateTS) / 1000);
70
- distanceInternal = distancePrev + v * duration;
71
- }
72
- data.speed = parseFloat(speed.toFixed(1));
73
- data.power = Math.round(power);
74
- data.distanceInternal = distanceInternal;
75
- data.slope = slope;
76
- this.logger.logEvent({ message: "updateData result", data, bikeData, prevRequest: {}, prevSpeed: prevData.speed });
77
- this.data = JSON.parse(JSON.stringify(data));
78
- this.prevUpdateTS = ts;
79
- }
80
- catch (err) {
81
- this.logger.logEvent({ message: 'error', fn: 'updateData()', error: err.message || err });
82
- }
83
- return data;
84
- }
85
- }
86
- exports.default = DaumClassicCyclingMode;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const gd_eventlog_1 = require("gd-eventlog");
7
+ const cycling_mode_1 = require("../../cycling-mode");
8
+ const DaumPowerMeterCyclingMode_1 = __importDefault(require("../DaumPowerMeterCyclingMode"));
9
+ const config = {
10
+ name: "Daum Classic",
11
+ description: "The device calculates speed and power based on slope. Incyclist will not modify any values recived from the device\nThis mode will not respect maximum power and/or workout limits",
12
+ properties: [
13
+ { key: 'bikeType', name: 'Bike Type', description: '', type: cycling_mode_1.CyclingModeProperyType.SingleSelect, options: ['Race', 'Mountain'], default: 'Race' },
14
+ ]
15
+ };
16
+ class DaumClassicCyclingMode extends DaumPowerMeterCyclingMode_1.default {
17
+ constructor(adapter, props) {
18
+ super(adapter, props);
19
+ this.logger = adapter ? adapter.logger : undefined;
20
+ if (!this.logger)
21
+ this.logger = new gd_eventlog_1.EventLogger('DaumClassic');
22
+ this.setModeProperty('eppSupport', true);
23
+ this.setModeProperty('setPersonSupport', true);
24
+ }
25
+ getName() {
26
+ return config.name;
27
+ }
28
+ getDescription() {
29
+ return config.description;
30
+ }
31
+ getProperties() {
32
+ return config.properties;
33
+ }
34
+ getProperty(name) {
35
+ return config.properties.find(p => p.name === name);
36
+ }
37
+ getBikeInitRequest() {
38
+ return {};
39
+ }
40
+ getSettings() {
41
+ const settings = super.getSettings();
42
+ settings['setPerson'] = true;
43
+ return settings;
44
+ }
45
+ getSetting(name) {
46
+ if (name === 'setPerson')
47
+ return true;
48
+ return super.getSetting(name);
49
+ }
50
+ updateData(data) {
51
+ try {
52
+ const prevData = this.data || {};
53
+ const prevRequest = this.prevRequest || {};
54
+ const bikeData = JSON.parse(JSON.stringify(data));
55
+ let power = data.power || 0;
56
+ let speed = data.speed || 0;
57
+ let slope = (prevData.slope !== undefined ? prevData.slope : prevRequest.slope || 0);
58
+ let distanceBike = data.distanceInternal || 0;
59
+ let distancePrev = prevData.distanceInternal || 0;
60
+ let distanceInternal = distanceBike;
61
+ let ts = Date.now();
62
+ if (!bikeData.pedalRpm || bikeData.isPedalling === false) {
63
+ speed = 0;
64
+ power = 0;
65
+ }
66
+ if (distanceBike < distancePrev) {
67
+ this.logger.logEvent({ message: '~~~ distance overflow', distanceBike, distancePrev });
68
+ let v = speed / 3.6;
69
+ let duration = this.prevUpdateTS === 0 ? 0 : ((ts - this.prevUpdateTS) / 1000);
70
+ distanceInternal = distancePrev + v * duration;
71
+ }
72
+ data.speed = parseFloat(speed.toFixed(1));
73
+ data.power = Math.round(power);
74
+ data.distanceInternal = distanceInternal;
75
+ data.slope = slope;
76
+ this.logger.logEvent({ message: "updateData result", data, bikeData, prevRequest: {}, prevSpeed: prevData.speed });
77
+ this.data = JSON.parse(JSON.stringify(data));
78
+ this.prevUpdateTS = ts;
79
+ }
80
+ catch (err) {
81
+ this.logger.logEvent({ message: 'error', fn: 'updateData()', error: err.message || err });
82
+ }
83
+ return data;
84
+ }
85
+ }
86
+ exports.default = DaumClassicCyclingMode;
@@ -1,16 +1,16 @@
1
- import DaumAdapter from '../DaumAdapter';
2
- export default class DaumPremiumDevice extends DaumAdapter {
3
- static NAME: string;
4
- constructor(protocol: any, bike: any);
5
- getName(): string;
6
- getPort(): any;
7
- getInterface(): any;
8
- getSupportedCyclingModes(): Array<any>;
9
- check(): Promise<unknown>;
10
- pause(): Promise<boolean>;
11
- resume(): Promise<boolean>;
12
- relaunch(props: any): Promise<unknown>;
13
- start(props: any): Promise<unknown>;
14
- launch(props: any, isRelaunch?: boolean): Promise<unknown>;
15
- getCurrentBikeData(): Promise<any>;
16
- }
1
+ import DaumAdapter from '../DaumAdapter';
2
+ export default class DaumPremiumDevice extends DaumAdapter {
3
+ static NAME: string;
4
+ constructor(protocol: any, bike: any);
5
+ getName(): string;
6
+ getPort(): any;
7
+ getInterface(): any;
8
+ getSupportedCyclingModes(): Array<any>;
9
+ check(): Promise<unknown>;
10
+ pause(): Promise<boolean>;
11
+ resume(): Promise<boolean>;
12
+ relaunch(props: any): Promise<unknown>;
13
+ start(props: any): Promise<unknown>;
14
+ launch(props: any, isRelaunch?: boolean): Promise<unknown>;
15
+ getCurrentBikeData(): Promise<any>;
16
+ }