pymammotion 0.2.62__py3-none-any.whl → 0.5.51__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.

Potentially problematic release.


This version of pymammotion might be problematic. Click here for more details.

Files changed (135) hide show
  1. pymammotion/__init__.py +9 -6
  2. pymammotion/aliyun/client.py +235 -0
  3. pymammotion/aliyun/cloud_gateway.py +320 -69
  4. pymammotion/aliyun/model/aep_response.py +1 -2
  5. pymammotion/aliyun/model/dev_by_account_response.py +170 -23
  6. pymammotion/aliyun/model/login_by_oauth_response.py +2 -3
  7. pymammotion/aliyun/model/regions_response.py +3 -3
  8. pymammotion/aliyun/model/session_by_authcode_response.py +2 -2
  9. pymammotion/aliyun/model/thing_response.py +12 -0
  10. pymammotion/aliyun/regions.py +62 -0
  11. pymammotion/aliyun/tea/core.py +297 -0
  12. pymammotion/bluetooth/ble.py +11 -15
  13. pymammotion/bluetooth/ble_message.py +389 -106
  14. pymammotion/bluetooth/model/atomic_integer.py +54 -0
  15. pymammotion/const.py +3 -0
  16. pymammotion/data/model/__init__.py +1 -2
  17. pymammotion/data/model/device.py +92 -240
  18. pymammotion/data/model/device_config.py +10 -24
  19. pymammotion/data/model/device_info.py +35 -0
  20. pymammotion/data/model/device_limits.py +49 -0
  21. pymammotion/data/model/enums.py +12 -2
  22. pymammotion/data/model/errors.py +12 -0
  23. pymammotion/data/model/events.py +14 -0
  24. pymammotion/data/model/generate_geojson.py +521 -0
  25. pymammotion/data/model/generate_route_information.py +3 -4
  26. pymammotion/data/model/hash_list.py +384 -48
  27. pymammotion/data/model/location.py +4 -4
  28. pymammotion/data/model/mowing_modes.py +24 -1
  29. pymammotion/data/model/raw_data.py +215 -0
  30. pymammotion/data/model/region_data.py +10 -11
  31. pymammotion/data/model/report_info.py +62 -6
  32. pymammotion/data/model/work.py +27 -0
  33. pymammotion/data/mower_state_manager.py +316 -0
  34. pymammotion/data/mqtt/event.py +73 -28
  35. pymammotion/data/mqtt/mammotion_properties.py +257 -0
  36. pymammotion/data/mqtt/properties.py +93 -78
  37. pymammotion/data/mqtt/status.py +18 -17
  38. pymammotion/event/event.py +32 -8
  39. pymammotion/homeassistant/__init__.py +3 -0
  40. pymammotion/homeassistant/mower_api.py +484 -0
  41. pymammotion/homeassistant/rtk_api.py +54 -0
  42. pymammotion/http/__init__.py +0 -0
  43. pymammotion/http/encryption.py +220 -0
  44. pymammotion/http/http.py +652 -44
  45. pymammotion/http/model/__init__.py +0 -0
  46. pymammotion/{aliyun/model/stream_subscription_response.py → http/model/camera_stream.py} +14 -2
  47. pymammotion/http/model/http.py +160 -9
  48. pymammotion/http/model/response_factory.py +61 -0
  49. pymammotion/http/model/rtk.py +16 -0
  50. pymammotion/mammotion/commands/abstract_message.py +7 -5
  51. pymammotion/mammotion/commands/mammotion_command.py +32 -3
  52. pymammotion/mammotion/commands/messages/basestation.py +43 -0
  53. pymammotion/mammotion/commands/messages/driver.py +61 -29
  54. pymammotion/mammotion/commands/messages/media.py +68 -15
  55. pymammotion/mammotion/commands/messages/navigation.py +61 -25
  56. pymammotion/mammotion/commands/messages/network.py +93 -100
  57. pymammotion/mammotion/commands/messages/ota.py +18 -18
  58. pymammotion/mammotion/commands/messages/system.py +97 -72
  59. pymammotion/mammotion/commands/messages/video.py +17 -12
  60. pymammotion/mammotion/devices/__init__.py +27 -3
  61. pymammotion/mammotion/devices/base.py +50 -127
  62. pymammotion/mammotion/devices/mammotion.py +447 -212
  63. pymammotion/mammotion/devices/mammotion_bluetooth.py +105 -60
  64. pymammotion/mammotion/devices/mammotion_cloud.py +157 -105
  65. pymammotion/mammotion/devices/mammotion_mower_ble.py +49 -0
  66. pymammotion/mammotion/devices/mammotion_mower_cloud.py +39 -0
  67. pymammotion/mammotion/devices/managers/managers.py +81 -0
  68. pymammotion/mammotion/devices/mower_device.py +124 -0
  69. pymammotion/mammotion/devices/mower_manager.py +107 -0
  70. pymammotion/mammotion/devices/rtk_ble.py +89 -0
  71. pymammotion/mammotion/devices/rtk_cloud.py +113 -0
  72. pymammotion/mammotion/devices/rtk_device.py +50 -0
  73. pymammotion/mammotion/devices/rtk_manager.py +122 -0
  74. pymammotion/mqtt/__init__.py +2 -1
  75. pymammotion/mqtt/aliyun_mqtt.py +232 -0
  76. pymammotion/mqtt/linkkit/__init__.py +5 -0
  77. pymammotion/mqtt/linkkit/h2client.py +585 -0
  78. pymammotion/mqtt/linkkit/linkkit.py +3023 -0
  79. pymammotion/mqtt/mammotion_mqtt.py +176 -169
  80. pymammotion/mqtt/mqtt_models.py +66 -0
  81. pymammotion/proto/__init__.py +4839 -4
  82. pymammotion/proto/basestation.proto +8 -0
  83. pymammotion/proto/basestation_pb2.py +11 -9
  84. pymammotion/proto/basestation_pb2.pyi +16 -2
  85. pymammotion/proto/dev_net.proto +79 -55
  86. pymammotion/proto/dev_net_pb2.py +60 -56
  87. pymammotion/proto/dev_net_pb2.pyi +49 -6
  88. pymammotion/proto/luba_msg.proto +2 -1
  89. pymammotion/proto/luba_msg_pb2.py +6 -6
  90. pymammotion/proto/luba_msg_pb2.pyi +1 -0
  91. pymammotion/proto/luba_mul.proto +62 -1
  92. pymammotion/proto/luba_mul_pb2.py +38 -22
  93. pymammotion/proto/luba_mul_pb2.pyi +94 -7
  94. pymammotion/proto/mctrl_driver.proto +44 -4
  95. pymammotion/proto/mctrl_driver_pb2.py +26 -14
  96. pymammotion/proto/mctrl_driver_pb2.pyi +66 -11
  97. pymammotion/proto/mctrl_nav.proto +97 -51
  98. pymammotion/proto/mctrl_nav_pb2.py +75 -67
  99. pymammotion/proto/mctrl_nav_pb2.pyi +142 -56
  100. pymammotion/proto/mctrl_ota.proto +40 -2
  101. pymammotion/proto/mctrl_ota_pb2.py +23 -13
  102. pymammotion/proto/mctrl_ota_pb2.pyi +67 -4
  103. pymammotion/proto/mctrl_pept.proto +8 -3
  104. pymammotion/proto/mctrl_pept_pb2.py +8 -6
  105. pymammotion/proto/mctrl_pept_pb2.pyi +14 -6
  106. pymammotion/proto/mctrl_sys.proto +325 -86
  107. pymammotion/proto/mctrl_sys_pb2.py +162 -98
  108. pymammotion/proto/mctrl_sys_pb2.pyi +451 -25
  109. pymammotion/proto/message_pool.py +3 -0
  110. pymammotion/proto/py.typed +0 -0
  111. pymammotion/utility/constant/device_constant.py +65 -21
  112. pymammotion/utility/datatype_converter.py +13 -12
  113. pymammotion/utility/device_config.py +755 -0
  114. pymammotion/utility/device_type.py +218 -21
  115. pymammotion/utility/map.py +238 -51
  116. pymammotion/utility/mur_mur_hash.py +159 -0
  117. {pymammotion-0.2.62.dist-info → pymammotion-0.5.51.dist-info}/METADATA +27 -31
  118. pymammotion-0.5.51.dist-info/RECORD +152 -0
  119. {pymammotion-0.2.62.dist-info → pymammotion-0.5.51.dist-info}/WHEEL +1 -1
  120. pymammotion/aliyun/cloud_service.py +0 -65
  121. pymammotion/data/model/plan.py +0 -58
  122. pymammotion/data/state_manager.py +0 -130
  123. pymammotion/proto/basestation.py +0 -59
  124. pymammotion/proto/common.py +0 -12
  125. pymammotion/proto/dev_net.py +0 -381
  126. pymammotion/proto/luba_msg.py +0 -81
  127. pymammotion/proto/luba_mul.py +0 -76
  128. pymammotion/proto/mctrl_driver.py +0 -100
  129. pymammotion/proto/mctrl_nav.py +0 -660
  130. pymammotion/proto/mctrl_ota.py +0 -48
  131. pymammotion/proto/mctrl_pept.py +0 -41
  132. pymammotion/proto/mctrl_sys.py +0 -574
  133. pymammotion-0.2.62.dist-info/RECORD +0 -125
  134. /pymammotion/{http/_init_.py → bluetooth/model/__init__.py} +0 -0
  135. {pymammotion-0.2.62.dist-info → pymammotion-0.5.51.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,3 @@
1
+ import betterproto2
2
+
3
+ default_message_pool = betterproto2.MessagePool()
File without changes
@@ -1,5 +1,7 @@
1
1
  from enum import IntEnum
2
2
 
3
+ from pymammotion.data.model.report_info import ConnectData
4
+
3
5
 
4
6
  class bleOrderCmd:
5
7
  allpowerfullRW = 67
@@ -186,33 +188,63 @@ class SystemTardStateTunnel:
186
188
 
187
189
 
188
190
  class WorkMode:
189
- MODE_BOUNDARY_JUMP = 38
190
- MODE_CHANNEL_DRAW = 34
191
- MODE_CHARGING = 15
192
- MODE_DISABLE = 8
193
- MODE_EDIT_BOUNDARY = 36
194
- MODE_ERASER_DRAW = 35
195
- MODE_INITIALIZATION = 10
196
- MODE_JOB_DRAW = 31
197
- MODE_LOCATION_ERROR = 37
198
- MODE_LOCK = 17
199
- MODE_MANUAL_MOWING = 20
200
191
  MODE_NOT_ACTIVE = 0
201
- MODE_OBSTACLE_DRAW = 32
202
- MODE_OFFLINE = 2
203
192
  MODE_ONLINE = 1
204
- MODE_OTA_UPGRADE_FAIL = 23
205
- MODE_PATH_MODIFICATION = 35
206
- MODE_PAUSE = 19
193
+ MODE_OFFLINE = 2
194
+ MODE_DISABLE = 8
195
+ MODE_INITIALIZATION = 10
207
196
  MODE_READY = 11
197
+ MODE_WORKING = 13
208
198
  MODE_RETURNING = 14
209
- MODE_SECOND_EDIT = 36
210
- MODE_UPDATE_SUCCESS = 22
199
+ MODE_CHARGING = 15
211
200
  MODE_UPDATING = 16
212
- MODE_WORKING = 13
201
+ MODE_LOCK = 17
202
+ MODE_PAUSE = 19
203
+ MODE_MANUAL_MOWING = 20
204
+ MODE_UPDATE_SUCCESS = 22
205
+ MODE_OTA_UPGRADE_FAIL = 23
206
+ MODE_JOB_DRAW = 31
207
+ MODE_OBSTACLE_DRAW = 32
208
+ MODE_CHANNEL_DRAW = 34
209
+ MODE_ERASER_DRAW = 35
210
+ MODE_EDIT_BOUNDARY = 36
211
+ MODE_LOCATION_ERROR = 37
212
+ MODE_BOUNDARY_JUMP = 38
213
+ MODE_CHARGING_PAUSE = 39
214
+
215
+
216
+ NO_REQUEST_MODES = (
217
+ WorkMode.MODE_JOB_DRAW,
218
+ WorkMode.MODE_OBSTACLE_DRAW,
219
+ WorkMode.MODE_CHANNEL_DRAW,
220
+ WorkMode.MODE_ERASER_DRAW,
221
+ WorkMode.MODE_UPDATING,
222
+ WorkMode.MODE_EDIT_BOUNDARY,
223
+ WorkMode.MODE_UPDATING,
224
+ WorkMode.MODE_LOCK,
225
+ WorkMode.MODE_MANUAL_MOWING,
226
+ )
213
227
 
214
228
 
215
- def device_mode(value) -> str:
229
+ def device_connection(connect: ConnectData) -> str:
230
+ """Return string representation of device connection."""
231
+
232
+ if connect.wifi_rssi != 0 and connect.ble_rssi != 0:
233
+ return "WIFI/BLE"
234
+
235
+ if connect.connect_type == 2 or connect.used_net == "NET_USED_TYPE_WIFI" or connect.wifi_rssi != 0:
236
+ return "WIFI"
237
+
238
+ if connect.connect_type == 1 or connect.used_net == "NET_USED_TYPE_MNET":
239
+ return "3G/4G"
240
+
241
+ if connect.ble_rssi != 0:
242
+ return "BLE"
243
+
244
+ return "None"
245
+
246
+
247
+ def device_mode(value: int) -> str:
216
248
  """Return the mode corresponding to the given value.
217
249
 
218
250
  This function takes a value and returns the corresponding mode from a
@@ -251,6 +283,7 @@ def device_mode(value) -> str:
251
283
  36: "MODE_EDIT_BOUNDARY",
252
284
  37: "MODE_LOCATION_ERROR",
253
285
  38: "MODE_BOUNDARY_JUMP",
286
+ 39: "MODE_CHARGING_PAUSE",
254
287
  }
255
288
  return modes.get(value, "Invalid mode")
256
289
 
@@ -261,11 +294,22 @@ class PosType(IntEnum):
261
294
  AREA_BORDER_ON = 7
262
295
  AREA_INSIDE = 1
263
296
  AREA_OUT = 0
264
- CHANNAL_AREA_OVERLAP = 9
297
+ CHANNEL_AREA_OVERLAP = 9
265
298
  CHANNEL_ON = 3
266
299
  CHARGE_ON = 5
267
300
  DUMPING_AREA_INSIDE = 8
268
301
  DUMPING_OUTSIDE = 10
302
+ ABNORMAL_POSITIONING = 11
303
+ NO_AREAS = 100
269
304
  OBS_ON = 2
270
305
  TURN_AREA_INSIDE = 4
271
306
  VIRTUAL_INSIDE = 6
307
+
308
+
309
+ def camera_brightness(value: int) -> str:
310
+ """Return the brightness corresponding to the given value."""
311
+ modes = {
312
+ 0: "Dark",
313
+ 1: "Light",
314
+ }
315
+ return modes.get(value, "Invalid mode")
@@ -2,7 +2,7 @@ import base64
2
2
 
3
3
 
4
4
  class DatatypeConverter:
5
- encode_map = None
5
+ encode_map: list[str | int] | None = None
6
6
 
7
7
  @staticmethod
8
8
  def init_encode_map():
@@ -20,24 +20,25 @@ class DatatypeConverter:
20
20
  """
21
21
 
22
22
  if DatatypeConverter.encode_map is None:
23
- cArr: list[str | int] = [0] * 64
23
+ c_arr: list[str | int] = [0] * 64
24
24
  for num in range(26):
25
- cArr[num] = chr(num + 65)
25
+ c_arr[num] = chr(num + 65)
26
26
  for num_2 in range(26, 52):
27
- cArr[num_2] = chr(num_2 - 26 + 97)
27
+ c_arr[num_2] = chr(num_2 - 26 + 97)
28
28
  for num_3 in range(52, 62):
29
- cArr[num_3] = chr(num_3 - 52 + 48)
30
- cArr[62] = "+"
31
- cArr[63] = "/"
32
- DatatypeConverter.encode_map = cArr
29
+ c_arr[num_3] = chr(num_3 - 52 + 48)
30
+ c_arr[62] = "+"
31
+ c_arr[63] = "/"
32
+ DatatypeConverter.encode_map = c_arr
33
33
  return DatatypeConverter.encode_map
34
34
 
35
35
  @staticmethod
36
- def parseBase64Binary(s):
36
+ def parseBase64Binary(s: str) -> bytes:
37
37
  return base64.b64decode(s)
38
38
 
39
39
  @staticmethod
40
- def printBase64Binary(bArr):
40
+ def printBase64Binary(bArr: bytes) -> str:
41
+ """Print the Base64 str representation of a byte array."""
41
42
  return DatatypeConverter._printBase64Binary(bArr)
42
43
 
43
44
  @staticmethod
@@ -45,7 +46,7 @@ class DatatypeConverter:
45
46
  return DatatypeConverter.encode_map[i & 63]
46
47
 
47
48
  @staticmethod
48
- def _printBase64Binary(bArr: bytes, i: int = 0, i2=None):
49
+ def _printBase64Binary(bArr: bytes, i: int = 0, i2=None) -> str:
49
50
  """Print the Base64 binary representation of a byte array.
50
51
 
51
52
  This function takes a byte array and optional start and end indices to
@@ -68,7 +69,7 @@ class DatatypeConverter:
68
69
  return "".join(cArr)
69
70
 
70
71
  @staticmethod
71
- def _printBase64Binary_core(bArr: bytes, i, i2, cArr, i3):
72
+ def _printBase64Binary_core(bArr: bytes, i, i2, cArr, i3) -> int:
72
73
  """Encode binary data into Base64 format.
73
74
 
74
75
  This function encodes binary data into Base64 format following the