-
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vendor.roborock): update Gen4 MCU time using local.time
Signed-off-by: Xuefer <[email protected]>
- Loading branch information
Xuefer
committed
Mar 31, 2024
1 parent
aa90b41
commit 21c202d
Showing
11 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const Capability = require("./Capability"); | ||
const NotImplementedError = require("../NotImplementedError"); | ||
|
||
/** | ||
* @template {import("../ValetudoRobot")} T | ||
* @extends Capability<T> | ||
*/ | ||
class SetMCUTimeCapability extends Capability { | ||
/** | ||
* Sets the MCU time | ||
* | ||
* @abstract | ||
* @param {Date} date | ||
* @returns {Promise<void>} | ||
*/ | ||
async setTime(date) { | ||
throw new NotImplementedError(); | ||
} | ||
|
||
getType() { | ||
return SetMCUTimeCapability.TYPE; | ||
} | ||
} | ||
|
||
SetMCUTimeCapability.TYPE = "SetMCUTimeCapability"; | ||
|
||
module.exports = SetMCUTimeCapability; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
backend/lib/robots/roborock/capabilities/RoborockSetMCUTimeCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const SetMCUTimeCapability = require("../../../core/capabilities/SetMCUTimeCapability"); | ||
|
||
/** | ||
* @extends SetMCUTimeCapability<import("../RoborockValetudoRobot")> | ||
*/ | ||
class RoborockSetMCUTimeCapability extends SetMCUTimeCapability { | ||
/** | ||
* Sets the MCU time | ||
* | ||
* @param {Date} date | ||
* @returns {Promise<void>} | ||
*/ | ||
async setTime(date) { | ||
await this.robot.sendCommand("local.time", [Math.floor(date.valueOf() / 1000)], {}); | ||
} | ||
} | ||
|
||
module.exports = RoborockSetMCUTimeCapability; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
backend/lib/webserver/capabilityRouters/DummyCapabilityRouter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const CapabilityRouter = require("./CapabilityRouter"); | ||
|
||
class DummyCapabilityRouter extends CapabilityRouter { | ||
initRoutes() { | ||
//intentional | ||
} | ||
} | ||
|
||
module.exports = DummyCapabilityRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters