incyclist-devices 1.5.15 → 1.5.16
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.
|
@@ -15,10 +15,10 @@ export default class DaumClassicAdapter extends DaumAdapter {
|
|
|
15
15
|
pause(): Promise<boolean>;
|
|
16
16
|
resume(): Promise<boolean>;
|
|
17
17
|
check(): Promise<unknown>;
|
|
18
|
-
|
|
18
|
+
startRide(props: any): Promise<boolean>;
|
|
19
19
|
start(props: any): Promise<boolean>;
|
|
20
20
|
launch(props: any, isRelaunch?: boolean): Promise<boolean>;
|
|
21
|
-
|
|
21
|
+
performStart(props?: {
|
|
22
22
|
user?: any;
|
|
23
23
|
bikeSettings?: any;
|
|
24
24
|
gear?: any;
|
|
@@ -58,7 +58,6 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
58
58
|
pause: { get: () => super.pause }
|
|
59
59
|
});
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
console.log('~~~~~~~~~~ PAUSE');
|
|
62
61
|
const paused = yield _super.pause.call(this);
|
|
63
62
|
this.bike.pauseLogging();
|
|
64
63
|
return paused;
|
|
@@ -100,34 +99,45 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
100
99
|
}
|
|
101
100
|
}));
|
|
102
101
|
}
|
|
103
|
-
|
|
102
|
+
startRide(props) {
|
|
104
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
this.logger.logEvent({ message: 'relaunch
|
|
104
|
+
this.logger.logEvent({ message: 'relaunch of device' });
|
|
106
105
|
return yield this.launch(props, true);
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
start(props) {
|
|
110
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
this.logger.logEvent({ message: 'start
|
|
110
|
+
this.logger.logEvent({ message: 'initial start of device' });
|
|
112
111
|
return yield this.launch(props, false);
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
114
|
launch(props, isRelaunch = false) {
|
|
116
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
.
|
|
116
|
+
try {
|
|
117
|
+
if (isRelaunch) {
|
|
118
|
+
yield this.stop();
|
|
119
|
+
}
|
|
120
|
+
yield this.performStart(props);
|
|
121
|
+
if (!isRelaunch) {
|
|
122
|
+
try {
|
|
123
|
+
const version = yield this.bike.getVersion();
|
|
124
|
+
this.logEvent({ message: 'device info', deviceInfo: version });
|
|
125
|
+
}
|
|
126
|
+
catch (_a) { }
|
|
127
|
+
}
|
|
122
128
|
this.stopped = false;
|
|
123
129
|
this.paused = false;
|
|
124
130
|
this.startUpdatePull();
|
|
125
131
|
return true;
|
|
126
|
-
}
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
this.logger.logEvent({ message: 'start result: error', error: err.message });
|
|
135
|
+
throw new Error(`could not start device, reason:${err.message}`);
|
|
136
|
+
}
|
|
127
137
|
});
|
|
128
138
|
}
|
|
129
|
-
|
|
130
|
-
this.
|
|
139
|
+
performStart(props = {}) {
|
|
140
|
+
this.stop();
|
|
131
141
|
const { user, bikeSettings } = props;
|
|
132
142
|
if (user && user.weight)
|
|
133
143
|
this.userSettings.weight = user.weight;
|
|
@@ -182,6 +192,8 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
182
192
|
}), 5, 1000);
|
|
183
193
|
}
|
|
184
194
|
getCurrentBikeData() {
|
|
195
|
+
if (this.stopped)
|
|
196
|
+
return;
|
|
185
197
|
return this.getBike().runData();
|
|
186
198
|
}
|
|
187
199
|
}
|
|
@@ -9,7 +9,7 @@ export default class DaumPremiumDevice extends DaumAdapter {
|
|
|
9
9
|
check(): Promise<unknown>;
|
|
10
10
|
pause(): Promise<boolean>;
|
|
11
11
|
resume(): Promise<boolean>;
|
|
12
|
-
|
|
12
|
+
startRide(props: any): Promise<boolean>;
|
|
13
13
|
start(props: any): Promise<boolean>;
|
|
14
14
|
launch(props: any, isRelaunch?: boolean): Promise<boolean>;
|
|
15
15
|
getCurrentBikeData(): Promise<any>;
|
|
@@ -82,16 +82,30 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
|
|
|
82
82
|
return resumed;
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
startRide(props) {
|
|
86
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
this.logger.logEvent({ message: 'relaunch
|
|
88
|
-
|
|
87
|
+
this.logger.logEvent({ message: 'relaunch of device' });
|
|
88
|
+
try {
|
|
89
|
+
yield this.launch(props, true);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
this.logger.logEvent({ message: 'start result: error', error: err.message });
|
|
94
|
+
throw new Error(`could not start device, reason:${err.message}`);
|
|
95
|
+
}
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
98
|
start(props) {
|
|
92
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
this.logger.logEvent({ message: 'start
|
|
94
|
-
|
|
100
|
+
this.logger.logEvent({ message: 'initial start of device' });
|
|
101
|
+
try {
|
|
102
|
+
yield this.launch(props, false);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
this.logger.logEvent({ message: 'start result: error', error: err.message });
|
|
107
|
+
throw new Error(`could not start device, reason:${err.message}`);
|
|
108
|
+
}
|
|
95
109
|
});
|
|
96
110
|
}
|
|
97
111
|
launch(props, isRelaunch = false) {
|
|
@@ -138,7 +152,6 @@ class DaumPremiumDevice extends DaumAdapter_1.default {
|
|
|
138
152
|
return;
|
|
139
153
|
}
|
|
140
154
|
catch (err) {
|
|
141
|
-
console.error(err);
|
|
142
155
|
throw (new Error(`could not start device, reason:${err.message}`));
|
|
143
156
|
}
|
|
144
157
|
}), 5, 1500)
|