add stuff
This commit is contained in:
+11
-1
@@ -12,6 +12,7 @@ class IConsoleDriver {
|
||||
this.maxLevel = 24;
|
||||
this.lastLevel = 18;
|
||||
this.workoutStatus = {};
|
||||
this.started = false;
|
||||
}
|
||||
|
||||
async connect() {
|
||||
@@ -36,8 +37,17 @@ class IConsoleDriver {
|
||||
})
|
||||
}
|
||||
|
||||
get state() {
|
||||
return this.client.state;
|
||||
}
|
||||
|
||||
async start() {
|
||||
await this.client.start({level: this.lastLevel});
|
||||
if (!this.started) {
|
||||
await this.client.start({level: this.lastLevel});
|
||||
this.started = true;
|
||||
} else {
|
||||
await this.client.resume();
|
||||
}
|
||||
}
|
||||
|
||||
async pause() {
|
||||
|
||||
@@ -18,6 +18,7 @@ class MockDriver {
|
||||
watt: 0,
|
||||
level: 1,
|
||||
};
|
||||
this.state = "disconnected";
|
||||
|
||||
this.interval = null;
|
||||
}
|
||||
@@ -27,6 +28,8 @@ class MockDriver {
|
||||
this.events.emit("maxLevel", 32);
|
||||
})
|
||||
|
||||
this.state = "connected";
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -34,6 +37,7 @@ class MockDriver {
|
||||
if (this.started) {
|
||||
return;
|
||||
}
|
||||
this.state = "started";
|
||||
|
||||
this.started = true;
|
||||
this.interval = setInterval(() => {
|
||||
@@ -77,10 +81,15 @@ class MockDriver {
|
||||
pause() {
|
||||
clearInterval(this.interval);
|
||||
this.started = false;
|
||||
this.state = "connected";
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
resume() {
|
||||
return this.start();
|
||||
}
|
||||
|
||||
stop() {
|
||||
this.pause();
|
||||
this.workoutStatus = {
|
||||
@@ -95,6 +104,9 @@ class MockDriver {
|
||||
level: 1,
|
||||
};
|
||||
this.seconds = 0;
|
||||
this.started = false;
|
||||
|
||||
this.state = "disconnected";
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user