incyclist-devices 1.4.98 → 1.4.100

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 (128) hide show
  1. package/LICENSE +0 -0
  2. package/lib/CyclingMode.d.ts +76 -76
  3. package/lib/CyclingMode.js +79 -79
  4. package/lib/Device.d.ts +92 -92
  5. package/lib/Device.js +71 -71
  6. package/lib/DeviceProtocol.d.ts +74 -74
  7. package/lib/DeviceProtocol.js +41 -41
  8. package/lib/DeviceRegistry.d.ts +8 -8
  9. package/lib/DeviceRegistry.js +33 -33
  10. package/lib/DeviceSupport.d.ts +34 -34
  11. package/lib/DeviceSupport.js +78 -78
  12. package/lib/ant/AntAdapter.d.ts +50 -50
  13. package/lib/ant/AntAdapter.js +109 -109
  14. package/lib/ant/AntScanner.d.ts +60 -60
  15. package/lib/ant/AntScanner.js +651 -651
  16. package/lib/ant/antfe/AntFEAdapter.d.ts +83 -83
  17. package/lib/ant/antfe/AntFEAdapter.js +652 -652
  18. package/lib/ant/antfe/ant-fe-adv-st-mode.d.ts +9 -9
  19. package/lib/ant/antfe/ant-fe-adv-st-mode.js +51 -51
  20. package/lib/ant/antfe/ant-fe-erg-mode.d.ts +6 -6
  21. package/lib/ant/antfe/ant-fe-erg-mode.js +14 -14
  22. package/lib/ant/antfe/ant-fe-st-mode.d.ts +5 -5
  23. package/lib/ant/antfe/ant-fe-st-mode.js +13 -13
  24. package/lib/ant/anthrm/AntHrmAdapter.d.ts +16 -16
  25. package/lib/ant/anthrm/AntHrmAdapter.js +130 -130
  26. package/lib/ant/antpwr/pwr-adapter.d.ts +49 -49
  27. package/lib/ant/antpwr/pwr-adapter.js +251 -251
  28. package/lib/ant/utils.d.ts +1 -1
  29. package/lib/ant/utils.js +23 -23
  30. package/lib/ble/ble-device.d.ts +63 -63
  31. package/lib/ble/ble-device.js +442 -442
  32. package/lib/ble/ble-erg-mode.d.ts +18 -18
  33. package/lib/ble/ble-erg-mode.js +132 -127
  34. package/lib/ble/ble-interface.d.ts +100 -99
  35. package/lib/ble/ble-interface.js +717 -712
  36. package/lib/ble/ble-peripheral.d.ts +36 -36
  37. package/lib/ble/ble-peripheral.js +200 -200
  38. package/lib/ble/ble-st-mode.d.ts +15 -15
  39. package/lib/ble/ble-st-mode.js +102 -102
  40. package/lib/ble/ble.d.ts +129 -129
  41. package/lib/ble/ble.js +86 -86
  42. package/lib/ble/consts.d.ts +14 -14
  43. package/lib/ble/consts.js +17 -17
  44. package/lib/ble/fm.d.ts +125 -125
  45. package/lib/ble/fm.js +739 -739
  46. package/lib/ble/hrm.d.ts +48 -48
  47. package/lib/ble/hrm.js +134 -134
  48. package/lib/ble/incyclist-protocol.d.ts +31 -31
  49. package/lib/ble/incyclist-protocol.js +147 -147
  50. package/lib/ble/pwr.d.ts +89 -89
  51. package/lib/ble/pwr.js +321 -321
  52. package/lib/ble/tacx.d.ts +90 -90
  53. package/lib/ble/tacx.js +731 -730
  54. package/lib/ble/wahoo-kickr.d.ts +98 -98
  55. package/lib/ble/wahoo-kickr.js +496 -496
  56. package/lib/calculations.d.ts +13 -13
  57. package/lib/calculations.js +150 -150
  58. package/lib/daum/DaumAdapter.d.ts +66 -66
  59. package/lib/daum/DaumAdapter.js +396 -396
  60. package/lib/daum/DaumPowerMeterCyclingMode.d.ts +8 -8
  61. package/lib/daum/DaumPowerMeterCyclingMode.js +21 -21
  62. package/lib/daum/ERGCyclingMode.d.ts +26 -26
  63. package/lib/daum/ERGCyclingMode.js +201 -201
  64. package/lib/daum/SmartTrainerCyclingMode.d.ts +41 -41
  65. package/lib/daum/SmartTrainerCyclingMode.js +344 -344
  66. package/lib/daum/classic/DaumClassicAdapter.d.ts +18 -18
  67. package/lib/daum/classic/DaumClassicAdapter.js +146 -146
  68. package/lib/daum/classic/DaumClassicCyclingMode.d.ts +13 -13
  69. package/lib/daum/classic/DaumClassicCyclingMode.js +97 -97
  70. package/lib/daum/classic/DaumClassicProtocol.d.ts +27 -27
  71. package/lib/daum/classic/DaumClassicProtocol.js +185 -185
  72. package/lib/daum/classic/bike.d.ts +64 -64
  73. package/lib/daum/classic/bike.js +456 -456
  74. package/lib/daum/classic/utils.d.ts +13 -13
  75. package/lib/daum/classic/utils.js +143 -143
  76. package/lib/daum/constants.d.ts +19 -19
  77. package/lib/daum/constants.js +22 -22
  78. package/lib/daum/premium/DaumClassicCyclingMode.d.ts +14 -14
  79. package/lib/daum/premium/DaumClassicCyclingMode.js +86 -86
  80. package/lib/daum/premium/DaumPremiumAdapter.d.ts +12 -12
  81. package/lib/daum/premium/DaumPremiumAdapter.js +131 -131
  82. package/lib/daum/premium/DaumPremiumProtocol.d.ts +32 -32
  83. package/lib/daum/premium/DaumPremiumProtocol.js +207 -207
  84. package/lib/daum/premium/bike.d.ts +123 -123
  85. package/lib/daum/premium/bike.js +894 -894
  86. package/lib/daum/premium/tcpserial.d.ts +33 -33
  87. package/lib/daum/premium/tcpserial.js +123 -123
  88. package/lib/daum/premium/utils.d.ts +62 -62
  89. package/lib/daum/premium/utils.js +376 -376
  90. package/lib/kettler/comms.d.ts +59 -59
  91. package/lib/kettler/comms.js +242 -242
  92. package/lib/kettler/ergo-racer/ERGCyclingMode.d.ts +25 -25
  93. package/lib/kettler/ergo-racer/ERGCyclingMode.js +144 -145
  94. package/lib/kettler/ergo-racer/adapter.d.ts +101 -101
  95. package/lib/kettler/ergo-racer/adapter.js +639 -639
  96. package/lib/kettler/ergo-racer/protocol.d.ts +41 -41
  97. package/lib/kettler/ergo-racer/protocol.js +203 -203
  98. package/lib/modes/power-base.d.ts +20 -20
  99. package/lib/modes/power-base.js +70 -70
  100. package/lib/modes/power-meter.d.ts +20 -20
  101. package/lib/modes/power-meter.js +78 -78
  102. package/lib/modes/simulator.d.ts +29 -29
  103. package/lib/modes/simulator.js +140 -140
  104. package/lib/simulator/Simulator.d.ts +69 -69
  105. package/lib/simulator/Simulator.js +288 -288
  106. package/lib/types/command.d.ts +8 -8
  107. package/lib/types/command.js +2 -2
  108. package/lib/types/route.d.ts +24 -24
  109. package/lib/types/route.js +9 -9
  110. package/lib/types/user.d.ts +11 -11
  111. package/lib/types/user.js +9 -9
  112. package/lib/utils.d.ts +14 -14
  113. package/lib/utils.js +114 -114
  114. package/package.json +46 -46
  115. package/lib/ant/antfe/ant-fe-st-mode copy.d.ts +0 -7
  116. package/lib/ant/antfe/ant-fe-st-mode copy.js +0 -54
  117. package/lib/ant/antpwr/AntPWRAdapter.d.ts +0 -24
  118. package/lib/ant/antpwr/AntPWRAdapter.js +0 -252
  119. package/lib/daum/PowerMeterCyclingMode.d.ts +0 -18
  120. package/lib/daum/PowerMeterCyclingMode.js +0 -78
  121. package/lib/daum/classic/ERGCyclingMode.d.ts +0 -23
  122. package/lib/daum/classic/ERGCyclingMode.js +0 -171
  123. package/lib/daum/indoorbike.d.ts +0 -24
  124. package/lib/daum/indoorbike.js +0 -178
  125. package/lib/kettler/ergo-racer/modes/power-meter.d.ts +0 -18
  126. package/lib/kettler/ergo-racer/modes/power-meter.js +0 -86
  127. package/lib/simulator/simulator-mode.d.ts +0 -28
  128. package/lib/simulator/simulator-mode.js +0 -120
@@ -1,13 +1,13 @@
1
- export declare class IllegalArgumentException extends Error {
2
- constructor(message: any);
3
- }
4
- export default class C {
5
- static calculateSpeed(m: number, power: number, slope: number, props?: any): number;
6
- static calculatePower(m: number, v: number, slope: number, props?: any): number;
7
- static calculateSpeedDaum(gear: number, rpm: number, bikeType?: string | number): number;
8
- static calculateSpeedBike(gear: number, rpm: number, chain: number[], cassette: number[], props?: {
9
- numGears?: number;
10
- wheelCirc?: number;
11
- }): number;
12
- }
13
- export declare function solveCubic(p: any, q: any): any[];
1
+ export declare class IllegalArgumentException extends Error {
2
+ constructor(message: any);
3
+ }
4
+ export default class C {
5
+ static calculateSpeed(m: number, power: number, slope: number, props?: any): number;
6
+ static calculatePower(m: number, v: number, slope: number, props?: any): number;
7
+ static calculateSpeedDaum(gear: number, rpm: number, bikeType?: string | number): number;
8
+ static calculateSpeedBike(gear: number, rpm: number, chain: number[], cassette: number[], props?: {
9
+ numGears?: number;
10
+ wheelCirc?: number;
11
+ }): number;
12
+ }
13
+ export declare function solveCubic(p: any, q: any): any[];
@@ -1,150 +1,150 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.solveCubic = exports.IllegalArgumentException = void 0;
4
- const g = 9.80665;
5
- const rho = 1.2041;
6
- const cwABike = {
7
- race: 0.35,
8
- triathlon: 0.29,
9
- mountain: 0.57
10
- };
11
- const cRR = 0.0036;
12
- class IllegalArgumentException extends Error {
13
- constructor(message) {
14
- super(message);
15
- this.name = "IllegalArgumentException";
16
- }
17
- }
18
- exports.IllegalArgumentException = IllegalArgumentException;
19
- class C {
20
- static calculateSpeed(m, power, slope, props = {}) {
21
- if (m === undefined || m === null || m < 0)
22
- throw new IllegalArgumentException("m must be a positive number");
23
- if (power === undefined || power === null || power < 0)
24
- throw new IllegalArgumentException("power must be a positive number");
25
- if (slope === undefined || slope === null)
26
- slope = 0;
27
- const _rho = props.rho || rho;
28
- const _cRR = props.cRR || cRR;
29
- const _cwA = props.cwA || cwABike[props.bikeType || 'race'] || cwABike.race;
30
- let sl = Math.atan(slope / 100);
31
- let c1 = 0.5 * _rho * _cwA;
32
- let c2 = (sl + _cRR) * m * g;
33
- let p = c2 / c1;
34
- let q = -1.0 * power / c1;
35
- var v = solveCubic(p, q).filter(value => value >= 0);
36
- if (v.length === 1)
37
- return v[0] * 3.6;
38
- if (v.length > 1) {
39
- if (props.previous) {
40
- let speed = undefined;
41
- let minDiff = undefined;
42
- v.forEach(s => {
43
- if (!minDiff) {
44
- minDiff = Math.abs(s - props.previous);
45
- speed = s;
46
- return;
47
- }
48
- const diff = Math.abs(s - props.previous);
49
- if (diff < minDiff) {
50
- minDiff = diff;
51
- speed = s;
52
- }
53
- });
54
- return speed * 3.6;
55
- }
56
- for (var i = 0; i < v.length; i++)
57
- if (v[i] > 0)
58
- return v[i] * 3.6;
59
- }
60
- return 0;
61
- }
62
- static calculatePower(m, v, slope, props = {}) {
63
- if (m === undefined || m === null || m < 0)
64
- throw new IllegalArgumentException("m must be a positive number");
65
- if (v === undefined || v === null || v < 0)
66
- throw new IllegalArgumentException("v must be a positive number");
67
- if (slope === undefined || slope === null)
68
- slope = 0;
69
- let _rho = props.rho || rho;
70
- let _cRR = props.cRR || cRR;
71
- let _cwA = props.cwA || cwABike[props.bikeType || 'race'] || cwABike.race;
72
- let sl = Math.sin(Math.atan(slope / 100));
73
- let P = (0.5 * _rho * _cwA) * Math.pow(v, 3.0) + (sl + _cRR) * m * g * v;
74
- return P;
75
- }
76
- static calculateSpeedDaum(gear, rpm, bikeType) {
77
- if (bikeType === 0 || bikeType === undefined || bikeType === "race" || bikeType === 'triathlon') {
78
- let lengthRPM = 210;
79
- let gearRatio = 1.75 + (gear - 1) * 0.098767;
80
- let distRotation = lengthRPM * gearRatio;
81
- let speed = rpm * distRotation * 0.0006;
82
- return speed;
83
- }
84
- else {
85
- let lengthRPM = 185;
86
- let gearRatio = 0.67 + (gear - 1) * 0.1485;
87
- let distRotation = lengthRPM * gearRatio;
88
- let speed = rpm * distRotation * 0.0006;
89
- return speed;
90
- }
91
- }
92
- static calculateSpeedBike(gear, rpm, chain, cassette, props) {
93
- if (chain.length !== 2 || cassette.length !== 2)
94
- throw new IllegalArgumentException("chain and cassette must be an array of 2 numbers");
95
- if (cassette[0] < 1 || cassette[1] < 1)
96
- throw new IllegalArgumentException("cassette must be an array of 2 positive numbers");
97
- const bikeProps = props || {};
98
- const minGearRatio = chain[0] / cassette[1];
99
- const maxGearRatio = chain[1] / cassette[0];
100
- const numGears = bikeProps.numGears || 28;
101
- const wheelCirc = bikeProps.wheelCirc || 2125;
102
- const gearRatio = minGearRatio + (maxGearRatio - minGearRatio) * (gear - 1) / (numGears - 1);
103
- let distRotation = wheelCirc * gearRatio / 1000;
104
- let speed = rpm * distRotation * 60 / 1000;
105
- return speed;
106
- }
107
- }
108
- exports.default = C;
109
- function acosh(x) {
110
- return Math.log(x + Math.sqrt(x * x - 1.0));
111
- }
112
- function asinh(x) {
113
- return Math.log(x + Math.sqrt(x * x + 1.0));
114
- }
115
- function sqrtN(x, n) {
116
- let exp = 1.0 / n;
117
- if (Math.sign(x) === 1 || n % 2 === 0) {
118
- return Math.pow(x, exp);
119
- }
120
- return Math.sign(x) * Math.pow(Math.abs(x), exp);
121
- }
122
- function solveCubic(p, q) {
123
- let D = Math.pow(q / 2.0, 2) + Math.pow(p / 3.0, 3);
124
- let R = Math.sign(q) * Math.sqrt(Math.abs(p) / 3.0);
125
- if (p === 0) {
126
- return [sqrtN(-1 * q, 3)];
127
- }
128
- if (D === 0) {
129
- return [3 * q / p, -3 * q / (2 * p)];
130
- }
131
- if (D < 0 && p < 0) {
132
- const results = [];
133
- let phi = Math.acos(q / (2 * Math.pow(R, 3)));
134
- results[0] = -2 * R * Math.cos(phi / 3);
135
- results[1] = -2 * R * Math.cos(phi / 3 + 2 * Math.PI / 3);
136
- results[2] = -2 * R * Math.cos(phi / 3 + 4 * Math.PI / 3);
137
- return results;
138
- }
139
- if (D > 0 && p < 0) {
140
- const results = [];
141
- let phi = acosh(q / (2 * Math.pow(R, 3)));
142
- results[0] = -2 * R * Math.cosh(phi / 3);
143
- return results;
144
- }
145
- const results = [];
146
- let phi = asinh(q / (2 * Math.pow(R, 3)));
147
- results[0] = -2 * R * Math.sinh(phi / 3);
148
- return results;
149
- }
150
- exports.solveCubic = solveCubic;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.solveCubic = exports.IllegalArgumentException = void 0;
4
+ const g = 9.80665;
5
+ const rho = 1.2041;
6
+ const cwABike = {
7
+ race: 0.35,
8
+ triathlon: 0.29,
9
+ mountain: 0.57
10
+ };
11
+ const cRR = 0.0036;
12
+ class IllegalArgumentException extends Error {
13
+ constructor(message) {
14
+ super(message);
15
+ this.name = "IllegalArgumentException";
16
+ }
17
+ }
18
+ exports.IllegalArgumentException = IllegalArgumentException;
19
+ class C {
20
+ static calculateSpeed(m, power, slope, props = {}) {
21
+ if (m === undefined || m === null || m < 0)
22
+ throw new IllegalArgumentException("m must be a positive number");
23
+ if (power === undefined || power === null || power < 0)
24
+ throw new IllegalArgumentException("power must be a positive number");
25
+ if (slope === undefined || slope === null)
26
+ slope = 0;
27
+ const _rho = props.rho || rho;
28
+ const _cRR = props.cRR || cRR;
29
+ const _cwA = props.cwA || cwABike[props.bikeType || 'race'] || cwABike.race;
30
+ let sl = Math.atan(slope / 100);
31
+ let c1 = 0.5 * _rho * _cwA;
32
+ let c2 = (sl + _cRR) * m * g;
33
+ let p = c2 / c1;
34
+ let q = -1.0 * power / c1;
35
+ var v = solveCubic(p, q).filter(value => value >= 0);
36
+ if (v.length === 1)
37
+ return v[0] * 3.6;
38
+ if (v.length > 1) {
39
+ if (props.previous) {
40
+ let speed = undefined;
41
+ let minDiff = undefined;
42
+ v.forEach(s => {
43
+ if (!minDiff) {
44
+ minDiff = Math.abs(s - props.previous);
45
+ speed = s;
46
+ return;
47
+ }
48
+ const diff = Math.abs(s - props.previous);
49
+ if (diff < minDiff) {
50
+ minDiff = diff;
51
+ speed = s;
52
+ }
53
+ });
54
+ return speed * 3.6;
55
+ }
56
+ for (var i = 0; i < v.length; i++)
57
+ if (v[i] > 0)
58
+ return v[i] * 3.6;
59
+ }
60
+ return 0;
61
+ }
62
+ static calculatePower(m, v, slope, props = {}) {
63
+ if (m === undefined || m === null || m < 0)
64
+ throw new IllegalArgumentException("m must be a positive number");
65
+ if (v === undefined || v === null || v < 0)
66
+ throw new IllegalArgumentException("v must be a positive number");
67
+ if (slope === undefined || slope === null)
68
+ slope = 0;
69
+ let _rho = props.rho || rho;
70
+ let _cRR = props.cRR || cRR;
71
+ let _cwA = props.cwA || cwABike[props.bikeType || 'race'] || cwABike.race;
72
+ let sl = Math.sin(Math.atan(slope / 100));
73
+ let P = (0.5 * _rho * _cwA) * Math.pow(v, 3.0) + (sl + _cRR) * m * g * v;
74
+ return P;
75
+ }
76
+ static calculateSpeedDaum(gear, rpm, bikeType) {
77
+ if (bikeType === 0 || bikeType === undefined || bikeType === "race" || bikeType === 'triathlon') {
78
+ let lengthRPM = 210;
79
+ let gearRatio = 1.75 + (gear - 1) * 0.098767;
80
+ let distRotation = lengthRPM * gearRatio;
81
+ let speed = rpm * distRotation * 0.0006;
82
+ return speed;
83
+ }
84
+ else {
85
+ let lengthRPM = 185;
86
+ let gearRatio = 0.67 + (gear - 1) * 0.1485;
87
+ let distRotation = lengthRPM * gearRatio;
88
+ let speed = rpm * distRotation * 0.0006;
89
+ return speed;
90
+ }
91
+ }
92
+ static calculateSpeedBike(gear, rpm, chain, cassette, props) {
93
+ if (chain.length !== 2 || cassette.length !== 2)
94
+ throw new IllegalArgumentException("chain and cassette must be an array of 2 numbers");
95
+ if (cassette[0] < 1 || cassette[1] < 1)
96
+ throw new IllegalArgumentException("cassette must be an array of 2 positive numbers");
97
+ const bikeProps = props || {};
98
+ const minGearRatio = chain[0] / cassette[1];
99
+ const maxGearRatio = chain[1] / cassette[0];
100
+ const numGears = bikeProps.numGears || 28;
101
+ const wheelCirc = bikeProps.wheelCirc || 2125;
102
+ const gearRatio = minGearRatio + (maxGearRatio - minGearRatio) * (gear - 1) / (numGears - 1);
103
+ let distRotation = wheelCirc * gearRatio / 1000;
104
+ let speed = rpm * distRotation * 60 / 1000;
105
+ return speed;
106
+ }
107
+ }
108
+ exports.default = C;
109
+ function acosh(x) {
110
+ return Math.log(x + Math.sqrt(x * x - 1.0));
111
+ }
112
+ function asinh(x) {
113
+ return Math.log(x + Math.sqrt(x * x + 1.0));
114
+ }
115
+ function sqrtN(x, n) {
116
+ let exp = 1.0 / n;
117
+ if (Math.sign(x) === 1 || n % 2 === 0) {
118
+ return Math.pow(x, exp);
119
+ }
120
+ return Math.sign(x) * Math.pow(Math.abs(x), exp);
121
+ }
122
+ function solveCubic(p, q) {
123
+ let D = Math.pow(q / 2.0, 2) + Math.pow(p / 3.0, 3);
124
+ let R = Math.sign(q) * Math.sqrt(Math.abs(p) / 3.0);
125
+ if (p === 0) {
126
+ return [sqrtN(-1 * q, 3)];
127
+ }
128
+ if (D === 0) {
129
+ return [3 * q / p, -3 * q / (2 * p)];
130
+ }
131
+ if (D < 0 && p < 0) {
132
+ const results = [];
133
+ let phi = Math.acos(q / (2 * Math.pow(R, 3)));
134
+ results[0] = -2 * R * Math.cos(phi / 3);
135
+ results[1] = -2 * R * Math.cos(phi / 3 + 2 * Math.PI / 3);
136
+ results[2] = -2 * R * Math.cos(phi / 3 + 4 * Math.PI / 3);
137
+ return results;
138
+ }
139
+ if (D > 0 && p < 0) {
140
+ const results = [];
141
+ let phi = acosh(q / (2 * Math.pow(R, 3)));
142
+ results[0] = -2 * R * Math.cosh(phi / 3);
143
+ return results;
144
+ }
145
+ const results = [];
146
+ let phi = asinh(q / (2 * Math.pow(R, 3)));
147
+ results[0] = -2 * R * Math.sinh(phi / 3);
148
+ return results;
149
+ }
150
+ exports.solveCubic = solveCubic;
@@ -1,66 +1,66 @@
1
- import { EventLogger } from 'gd-eventlog';
2
- import CyclingMode, { IncyclistBikeData } from '../CyclingMode';
3
- import IncyclistDevice, { Bike, DeviceAdapter, DeviceData } from '../Device';
4
- import { User } from '../types/user';
5
- interface DaumAdapter {
6
- getCurrentBikeData(): Promise<any>;
7
- }
8
- export default class DaumAdapterBase extends IncyclistDevice implements DeviceAdapter, DaumAdapter, Bike {
9
- bike: any;
10
- ignoreHrm: boolean;
11
- ignoreBike: boolean;
12
- ignorePower: boolean;
13
- distanceInternal: number;
14
- paused: boolean;
15
- stopped: boolean;
16
- cyclingData: IncyclistBikeData;
17
- deviceData: DeviceData;
18
- currentRequest: any;
19
- requests: Array<any>;
20
- iv: any;
21
- logger: EventLogger;
22
- cyclingMode: CyclingMode;
23
- userSettings: User;
24
- bikeSettings: any;
25
- tsPrevData: number;
26
- adapterTime: number;
27
- requestBusy: boolean;
28
- updateBusy: boolean;
29
- constructor(props: any, bike: any);
30
- setCyclingMode(mode: CyclingMode | string, settings?: any): void;
31
- getSupportedCyclingModes(): Array<any>;
32
- getCyclingMode(): CyclingMode;
33
- getDefaultCyclingMode(): CyclingMode;
34
- setUserSettings(userSettings: User): void;
35
- setBikeSettings(bikeSettings: any): void;
36
- getWeight(): number;
37
- getCurrentBikeData(): Promise<any>;
38
- getBike(): any;
39
- isBike(): boolean;
40
- isPower(): boolean;
41
- isHrm(): boolean;
42
- isSame(device: DeviceAdapter): boolean;
43
- setIgnoreHrm(ignore: any): void;
44
- setIgnoreBike(ignore: any): void;
45
- isStopped(): boolean;
46
- initData(): void;
47
- start(props?: any): Promise<any>;
48
- startUpdatePull(): void;
49
- connect(): void;
50
- close(): any;
51
- logEvent(event: any): void;
52
- stop(): Promise<boolean>;
53
- pause(): Promise<boolean>;
54
- resume(): Promise<boolean>;
55
- sendUpdate(request: any): Promise<unknown>;
56
- sendData(): void;
57
- update(): Promise<void>;
58
- sendRequests(): Promise<void>;
59
- bikeSync(): Promise<void>;
60
- updateData(prev: any, bikeData: any): IncyclistBikeData;
61
- transformData(): DeviceData;
62
- sendRequest(request: any): Promise<any>;
63
- refreshRequests(): void;
64
- processClientRequest(request: any): Promise<unknown>;
65
- }
66
- export {};
1
+ import { EventLogger } from 'gd-eventlog';
2
+ import CyclingMode, { IncyclistBikeData } from '../CyclingMode';
3
+ import IncyclistDevice, { Bike, DeviceAdapter, DeviceData } from '../Device';
4
+ import { User } from '../types/user';
5
+ interface DaumAdapter {
6
+ getCurrentBikeData(): Promise<any>;
7
+ }
8
+ export default class DaumAdapterBase extends IncyclistDevice implements DeviceAdapter, DaumAdapter, Bike {
9
+ bike: any;
10
+ ignoreHrm: boolean;
11
+ ignoreBike: boolean;
12
+ ignorePower: boolean;
13
+ distanceInternal: number;
14
+ paused: boolean;
15
+ stopped: boolean;
16
+ cyclingData: IncyclistBikeData;
17
+ deviceData: DeviceData;
18
+ currentRequest: any;
19
+ requests: Array<any>;
20
+ iv: any;
21
+ logger: EventLogger;
22
+ cyclingMode: CyclingMode;
23
+ userSettings: User;
24
+ bikeSettings: any;
25
+ tsPrevData: number;
26
+ adapterTime: number;
27
+ requestBusy: boolean;
28
+ updateBusy: boolean;
29
+ constructor(props: any, bike: any);
30
+ setCyclingMode(mode: CyclingMode | string, settings?: any): void;
31
+ getSupportedCyclingModes(): Array<any>;
32
+ getCyclingMode(): CyclingMode;
33
+ getDefaultCyclingMode(): CyclingMode;
34
+ setUserSettings(userSettings: User): void;
35
+ setBikeSettings(bikeSettings: any): void;
36
+ getWeight(): number;
37
+ getCurrentBikeData(): Promise<any>;
38
+ getBike(): any;
39
+ isBike(): boolean;
40
+ isPower(): boolean;
41
+ isHrm(): boolean;
42
+ isSame(device: DeviceAdapter): boolean;
43
+ setIgnoreHrm(ignore: any): void;
44
+ setIgnoreBike(ignore: any): void;
45
+ isStopped(): boolean;
46
+ initData(): void;
47
+ start(props?: any): Promise<any>;
48
+ startUpdatePull(): void;
49
+ connect(): void;
50
+ close(): any;
51
+ logEvent(event: any): void;
52
+ stop(): Promise<boolean>;
53
+ pause(): Promise<boolean>;
54
+ resume(): Promise<boolean>;
55
+ sendUpdate(request: any): Promise<unknown>;
56
+ sendData(): void;
57
+ update(): Promise<void>;
58
+ sendRequests(): Promise<void>;
59
+ bikeSync(): Promise<void>;
60
+ updateData(prev: any, bikeData: any): IncyclistBikeData;
61
+ transformData(): DeviceData;
62
+ sendRequest(request: any): Promise<any>;
63
+ refreshRequests(): void;
64
+ processClientRequest(request: any): Promise<unknown>;
65
+ }
66
+ export {};