-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Robert Resch <[email protected]>
- Loading branch information
1 parent
8f75ebf
commit 3433f28
Showing
9 changed files
with
362 additions
and
57 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
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,35 @@ | ||
"""Map set v2 messages.""" | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Any | ||
|
||
from deebot_client.events.map import MapSetType | ||
from deebot_client.message import HandlingResult, HandlingState, MessageBodyDataDict | ||
|
||
if TYPE_CHECKING: | ||
from deebot_client.event_bus import EventBus | ||
|
||
|
||
class OnMapSetV2(MessageBodyDataDict): | ||
"""On map set v2 message.""" | ||
|
||
name = "onMapSet_V2" | ||
|
||
@classmethod | ||
def _handle_body_data_dict( | ||
cls, _: EventBus, data: dict[str, Any] | ||
) -> HandlingResult: | ||
"""Handle message->body->data and notify the correct event subscribers. | ||
:return: A message response | ||
""" | ||
# check if type is know and mid us given | ||
if not MapSetType.has_value(data["type"]) or not data.get("mid"): | ||
return HandlingResult.analyse() | ||
|
||
# NOTE: here would be needed to call 'GetMapSetV2' again with 'mid' and 'type', | ||
# that on event will update the map set changes, | ||
# messages current cannot call commands again | ||
return HandlingResult( | ||
HandlingState.SUCCESS, {"mid": data["mid"], "type": data["type"]} | ||
) |
Oops, something went wrong.