pymammotion 0.3.7__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.
- pymammotion/__init__.py +2 -2
- pymammotion/aliyun/cloud_gateway.py +12 -9
- pymammotion/aliyun/model/aep_response.py +1 -2
- pymammotion/aliyun/model/dev_by_account_response.py +7 -8
- pymammotion/aliyun/model/login_by_oauth_response.py +2 -3
- pymammotion/aliyun/model/regions_response.py +3 -3
- pymammotion/aliyun/model/session_by_authcode_response.py +1 -2
- pymammotion/aliyun/model/stream_subscription_response.py +1 -2
- pymammotion/bluetooth/ble.py +5 -5
- pymammotion/bluetooth/ble_message.py +9 -13
- pymammotion/data/model/device.py +31 -228
- pymammotion/data/model/device_config.py +0 -10
- pymammotion/data/model/device_info.py +13 -0
- pymammotion/data/model/device_limits.py +49 -0
- pymammotion/data/model/generate_route_information.py +1 -1
- pymammotion/data/model/hash_list.py +6 -2
- pymammotion/data/model/plan.py +0 -3
- pymammotion/data/model/raw_data.py +215 -0
- pymammotion/data/model/region_data.py +10 -11
- pymammotion/data/model/report_info.py +1 -1
- pymammotion/data/mqtt/event.py +18 -14
- pymammotion/data/mqtt/properties.py +1 -1
- pymammotion/data/mqtt/status.py +1 -1
- pymammotion/data/state_manager.py +83 -23
- pymammotion/http/encryption.py +220 -0
- pymammotion/http/http.py +92 -39
- pymammotion/http/model/http.py +4 -2
- pymammotion/mammotion/commands/abstract_message.py +2 -2
- pymammotion/mammotion/commands/messages/driver.py +28 -21
- pymammotion/mammotion/commands/messages/media.py +10 -14
- pymammotion/mammotion/commands/messages/navigation.py +14 -11
- pymammotion/mammotion/commands/messages/network.py +17 -14
- pymammotion/mammotion/commands/messages/ota.py +9 -14
- pymammotion/mammotion/commands/messages/system.py +32 -29
- pymammotion/mammotion/commands/messages/video.py +9 -14
- pymammotion/mammotion/devices/base.py +7 -14
- pymammotion/mammotion/devices/mammotion.py +22 -13
- pymammotion/mammotion/devices/mammotion_bluetooth.py +15 -4
- pymammotion/mammotion/devices/mammotion_cloud.py +30 -12
- pymammotion/mqtt/linkkit/__init__.py +5 -0
- pymammotion/mqtt/linkkit/h2client.py +585 -0
- pymammotion/mqtt/linkkit/linkkit.py +3020 -0
- pymammotion/mqtt/mammotion_mqtt.py +13 -9
- pymammotion/proto/__init__.py +2176 -1
- pymammotion/proto/luba_mul.proto +1 -0
- pymammotion/proto/luba_mul_pb2.py +8 -8
- pymammotion/proto/luba_mul_pb2.pyi +1 -0
- pymammotion/proto/mctrl_nav_pb2.py +69 -67
- pymammotion/proto/mctrl_nav_pb2.pyi +13 -5
- pymammotion/proto/mctrl_sys_pb2.py +41 -37
- pymammotion/proto/mctrl_sys_pb2.pyi +34 -11
- pymammotion/utility/constant/device_constant.py +14 -5
- pymammotion/utility/device_config.py +754 -0
- pymammotion/utility/device_type.py +64 -16
- {pymammotion-0.3.7.dist-info → pymammotion-0.4.0.dist-info}/METADATA +9 -9
- {pymammotion-0.3.7.dist-info → pymammotion-0.4.0.dist-info}/RECORD +58 -62
- {pymammotion-0.3.7.dist-info → pymammotion-0.4.0.dist-info}/WHEEL +1 -1
- pymammotion/aliyun/cloud_service.py +0 -65
- pymammotion/proto/basestation.py +0 -59
- pymammotion/proto/common.py +0 -12
- pymammotion/proto/dev_net.py +0 -381
- pymammotion/proto/luba_msg.py +0 -81
- pymammotion/proto/luba_mul.py +0 -76
- pymammotion/proto/mctrl_driver.py +0 -100
- pymammotion/proto/mctrl_nav.py +0 -664
- pymammotion/proto/mctrl_ota.py +0 -48
- pymammotion/proto/mctrl_pept.py +0 -41
- pymammotion/proto/mctrl_sys.py +0 -574
- {pymammotion-0.3.7.dist-info → pymammotion-0.4.0.dist-info}/LICENSE +0 -0
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
import asyncio
|
4
4
|
import base64
|
5
|
+
from collections.abc import Awaitable, Callable
|
5
6
|
import hashlib
|
6
7
|
import hmac
|
7
8
|
import json
|
8
9
|
import logging
|
9
10
|
from logging import getLogger
|
10
|
-
from typing import Awaitable, Callable, Optional
|
11
11
|
|
12
12
|
import betterproto
|
13
|
-
from linkkit.linkkit import LinkKit
|
14
13
|
from paho.mqtt.client import MQTTMessage
|
15
14
|
|
16
15
|
from pymammotion.aliyun.cloud_gateway import CloudIOTGateway
|
17
16
|
from pymammotion.data.mqtt.event import ThingEventMessage
|
18
17
|
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
|
19
18
|
from pymammotion.data.mqtt.status import ThingStatusMessage
|
20
|
-
from pymammotion.
|
19
|
+
from pymammotion.mqtt.linkkit.linkkit import LinkKit
|
20
|
+
from pymammotion.proto import LubaMsg
|
21
21
|
|
22
22
|
logger = getLogger(__name__)
|
23
23
|
|
@@ -33,18 +33,18 @@ class MammotionMQTT:
|
|
33
33
|
device_secret: str,
|
34
34
|
iot_token: str,
|
35
35
|
cloud_client: CloudIOTGateway,
|
36
|
-
client_id:
|
36
|
+
client_id: str | None = None,
|
37
37
|
) -> None:
|
38
38
|
"""Create instance of MammotionMQTT."""
|
39
39
|
super().__init__()
|
40
40
|
self._cloud_client = cloud_client
|
41
41
|
self.is_connected = False
|
42
42
|
self.is_ready = False
|
43
|
-
self.on_connected:
|
44
|
-
self.on_ready:
|
45
|
-
self.on_error:
|
46
|
-
self.on_disconnected:
|
47
|
-
self.on_message:
|
43
|
+
self.on_connected: Callable[[], Awaitable[None]] | None = None
|
44
|
+
self.on_ready: Callable[[], Awaitable[None]] | None = None
|
45
|
+
self.on_error: Callable[[str], Awaitable[None]] | None = None
|
46
|
+
self.on_disconnected: Callable[[], Awaitable[None]] | None = None
|
47
|
+
self.on_message: Callable[[str, str, str], Awaitable[None]] | None = None
|
48
48
|
|
49
49
|
self._product_key = product_key
|
50
50
|
self._device_name = device_name
|
@@ -193,6 +193,10 @@ class MammotionMQTT:
|
|
193
193
|
else:
|
194
194
|
logger.info("Unhandled event: %s", params.identifier)
|
195
195
|
elif message.topic.endswith("/app/down/thing/status"):
|
196
|
+
# the tell if a device has come back online
|
197
|
+
# lastStatus
|
198
|
+
# 1 online?
|
199
|
+
# 3 offline?
|
196
200
|
status = ThingStatusMessage(**payload)
|
197
201
|
logger.debug(status.params.status.value)
|
198
202
|
elif message.topic.endswith("/app/down/thing/properties"):
|