pymammotion 0.4.11__py3-none-any.whl → 0.4.12__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/bluetooth/ble.py +2 -4
- pymammotion/data/model/device.py +0 -2
- pymammotion/data/model/hash_list.py +29 -4
- pymammotion/mammotion/devices/base.py +10 -6
- {pymammotion-0.4.11.dist-info → pymammotion-0.4.12.dist-info}/METADATA +1 -1
- {pymammotion-0.4.11.dist-info → pymammotion-0.4.12.dist-info}/RECORD +8 -8
- {pymammotion-0.4.11.dist-info → pymammotion-0.4.12.dist-info}/WHEEL +1 -1
- {pymammotion-0.4.11.dist-info → pymammotion-0.4.12.dist-info}/LICENSE +0 -0
pymammotion/bluetooth/ble.py
CHANGED
@@ -36,12 +36,10 @@ class MammotionBLE:
|
|
36
36
|
return await self.connect()
|
37
37
|
|
38
38
|
async def connect(self) -> bool:
|
39
|
-
if self.client is not None
|
40
|
-
return await self.client.connect()
|
39
|
+
return await self.client.connect() if self.client is not None else False
|
41
40
|
|
42
41
|
async def disconnect(self) -> bool:
|
43
|
-
if self.client is not None
|
44
|
-
return await self.client.disconnect()
|
42
|
+
return await self.client.disconnect() if self.client is not None else False
|
45
43
|
|
46
44
|
async def notification_handler(self, _characteristic: BleakGATTCharacteristic, data: bytearray) -> None:
|
47
45
|
"""Simple notification handler which prints the data received."""
|
pymammotion/data/model/device.py
CHANGED
@@ -92,8 +92,6 @@ class MowingDevice(DataClassORJSONMixin):
|
|
92
92
|
self.location.work_zone = (
|
93
93
|
location.zone_hash if self.report_data.dev.sys_status == WorkMode.MODE_WORKING else 0
|
94
94
|
)
|
95
|
-
if location.bol_hash:
|
96
|
-
self.map.bol_hash = location.bol_hash
|
97
95
|
|
98
96
|
if toapp_report_data.fw_info:
|
99
97
|
self.update_device_firmwares(toapp_report_data.fw_info)
|
@@ -120,7 +120,6 @@ class HashList(DataClassORJSONMixin):
|
|
120
120
|
hashlist for all our hashIDs for verification
|
121
121
|
"""
|
122
122
|
|
123
|
-
bol_hash: str = ""
|
124
123
|
root_hash_lists: list[RootHashList] = field(default_factory=list)
|
125
124
|
area: dict[int, FrameList] = field(default_factory=dict) # type 0
|
126
125
|
path: dict[int, FrameList] = field(default_factory=dict) # type 2
|
@@ -135,6 +134,11 @@ class HashList(DataClassORJSONMixin):
|
|
135
134
|
self.obstacle = {hash_id: frames for hash_id, frames in self.obstacle.items() if hash_id in hashlist}
|
136
135
|
self.dump = {hash_id: frames for hash_id, frames in self.dump.items() if hash_id in hashlist}
|
137
136
|
self.svg = {hash_id: frames for hash_id, frames in self.svg.items() if hash_id in hashlist}
|
137
|
+
self.area_name = [
|
138
|
+
area_item
|
139
|
+
for area_item in self.area_name
|
140
|
+
if area_item.hash in self.area.keys() or area_item.hash in self.hashlist
|
141
|
+
]
|
138
142
|
|
139
143
|
@property
|
140
144
|
def hashlist(self) -> list[int]:
|
@@ -143,8 +147,7 @@ class HashList(DataClassORJSONMixin):
|
|
143
147
|
# Combine data_couple from all RootHashLists
|
144
148
|
return [i for root_list in self.root_hash_lists for obj in root_list.data for i in obj.data_couple]
|
145
149
|
|
146
|
-
|
147
|
-
def missing_hashlist(self) -> list[int]:
|
150
|
+
def missing_hashlist(self, sub_cmd: int = 0) -> list[int]:
|
148
151
|
"""Return missing hashlist."""
|
149
152
|
all_hash_ids = set(self.area.keys()).union(
|
150
153
|
self.path.keys(), self.obstacle.keys(), self.dump.keys(), self.svg.keys()
|
@@ -153,10 +156,26 @@ class HashList(DataClassORJSONMixin):
|
|
153
156
|
i
|
154
157
|
for root_list in self.root_hash_lists
|
155
158
|
for obj in root_list.data
|
159
|
+
if root_list.sub_cmd == sub_cmd
|
156
160
|
for i in obj.data_couple
|
157
161
|
if i not in all_hash_ids
|
158
162
|
]
|
159
163
|
|
164
|
+
def missing_root_hash_frame(self, hash_list: NavGetHashListAck) -> list[int]:
|
165
|
+
"""Return missing root hash frame."""
|
166
|
+
target_root_list = next(
|
167
|
+
(
|
168
|
+
rhl
|
169
|
+
for rhl in self.root_hash_lists
|
170
|
+
if rhl.total_frame == hash_list.total_frame and rhl.sub_cmd == hash_list.sub_cmd
|
171
|
+
),
|
172
|
+
None,
|
173
|
+
)
|
174
|
+
if target_root_list is None:
|
175
|
+
return []
|
176
|
+
|
177
|
+
return self._find_missing_frames(target_root_list)
|
178
|
+
|
160
179
|
def update_root_hash_list(self, hash_list: NavGetHashListData) -> None:
|
161
180
|
target_root_list = next(
|
162
181
|
(
|
@@ -212,12 +231,15 @@ class HashList(DataClassORJSONMixin):
|
|
212
231
|
|
213
232
|
def update(self, hash_data: NavGetCommData | SvgMessage) -> bool:
|
214
233
|
"""Update the map data."""
|
234
|
+
|
215
235
|
if hash_data.type == PathType.AREA:
|
216
236
|
existing_name = next((area for area in self.area_name if area.hash == hash_data.hash), None)
|
217
237
|
if not existing_name:
|
218
238
|
name = f"area {len(self.area_name)+1}" if hash_data.area_label is None else hash_data.area_label.label
|
219
239
|
self.area_name.append(AreaHashNameList(name=name, hash=hash_data.hash))
|
220
|
-
|
240
|
+
result = self._add_hash_data(self.area, hash_data)
|
241
|
+
self.update_hash_lists(self.hashlist)
|
242
|
+
return result
|
221
243
|
|
222
244
|
if hash_data.type == PathType.OBSTACLE:
|
223
245
|
return self._add_hash_data(self.obstacle, hash_data)
|
@@ -235,6 +257,9 @@ class HashList(DataClassORJSONMixin):
|
|
235
257
|
|
236
258
|
@staticmethod
|
237
259
|
def _find_missing_frames(frame_list: FrameList | RootHashList) -> list[int]:
|
260
|
+
if frame_list is None:
|
261
|
+
return []
|
262
|
+
|
238
263
|
if frame_list.total_frame == len(frame_list.data):
|
239
264
|
return []
|
240
265
|
number_list = list(range(1, frame_list.total_frame + 1))
|
@@ -46,10 +46,10 @@ class MammotionBaseDevice:
|
|
46
46
|
async def datahash_response(self, hash_ack: NavGetHashListAck) -> None:
|
47
47
|
"""Handle datahash responses."""
|
48
48
|
|
49
|
-
missing_frames = self.mower.map.
|
49
|
+
missing_frames = self.mower.map.missing_root_hash_frame(hash_ack)
|
50
50
|
if len(missing_frames) == 0:
|
51
|
-
if len(self.mower.map.missing_hashlist) > 0:
|
52
|
-
data_hash = self.mower.map.missing_hashlist.pop()
|
51
|
+
if len(self.mower.map.missing_hashlist(hash_ack.sub_cmd)) > 0:
|
52
|
+
data_hash = self.mower.map.missing_hashlist(hash_ack.sub_cmd).pop()
|
53
53
|
return await self.queue_command("synchronize_hash_data", hash_num=data_hash)
|
54
54
|
return
|
55
55
|
|
@@ -67,7 +67,11 @@ class MammotionBaseDevice:
|
|
67
67
|
if len(missing_frames) == 0:
|
68
68
|
# get next in hash ack list
|
69
69
|
|
70
|
-
data_hash =
|
70
|
+
data_hash = (
|
71
|
+
self.mower.map.missing_hashlist(common_data.sub_cmd).pop()
|
72
|
+
if len(self.mower.map.missing_hashlist(common_data.sub_cmd)) > 0
|
73
|
+
else None
|
74
|
+
)
|
71
75
|
if data_hash is None:
|
72
76
|
return
|
73
77
|
|
@@ -211,8 +215,8 @@ class MammotionBaseDevice:
|
|
211
215
|
await self.queue_command("read_plan", sub_cmd=2, plan_index=0)
|
212
216
|
|
213
217
|
await self.queue_command("get_all_boundary_hash_list", sub_cmd=0)
|
214
|
-
if len(self.mower.map.missing_hashlist) > 0:
|
215
|
-
data_hash = self.mower.map.missing_hashlist.pop()
|
218
|
+
if len(self.mower.map.missing_hashlist()) > 0:
|
219
|
+
data_hash = self.mower.map.missing_hashlist().pop()
|
216
220
|
await self.queue_command("synchronize_hash_data", hash_num=data_hash)
|
217
221
|
|
218
222
|
# sub_cmd 3 is job hashes??
|
@@ -10,7 +10,7 @@ pymammotion/aliyun/model/session_by_authcode_response.py,sha256=naMDigtvmpf-Ikf5
|
|
10
10
|
pymammotion/aliyun/model/stream_subscription_response.py,sha256=7d0i8cNMAMX7aQjd2yebMDdqQkugcCzk-SD6oVtf18M,333
|
11
11
|
pymammotion/aliyun/tmp_constant.py,sha256=M4Hq_lrGB3LZdX6R2XohRPFoK1NDnNV-pTJwJcJ9838,6650
|
12
12
|
pymammotion/bluetooth/__init__.py,sha256=LAl8jqZ1fPh-3mLmViNQsP3s814C1vsocYUa6oSaXt0,36
|
13
|
-
pymammotion/bluetooth/ble.py,sha256=
|
13
|
+
pymammotion/bluetooth/ble.py,sha256=XQWJBpSzeIawCrLTsVrq9LI6jmM_ALVTttUkosK2BRM,2480
|
14
14
|
pymammotion/bluetooth/ble_message.py,sha256=47xoj22Kw5XF9VT965J_BxpvTdOgSXy4opqkbsojvDo,18795
|
15
15
|
pymammotion/bluetooth/const.py,sha256=CCqyHsYbB0BAYjwdhXt_n6eWWxmhlUrAFjvVv57mbvE,1749
|
16
16
|
pymammotion/bluetooth/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -23,7 +23,7 @@ pymammotion/const.py,sha256=lWRxvTVdXnNHuxqvRkjO5ziK0Ic-fZMM6J2dbe5M6Nc,385
|
|
23
23
|
pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
pymammotion/data/model/__init__.py,sha256=aSyroxYQQS-WMRi6WmWm2js4wLa9nmsi160gx9tts4o,323
|
25
25
|
pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
|
26
|
-
pymammotion/data/model/device.py,sha256=
|
26
|
+
pymammotion/data/model/device.py,sha256=GRKaXPocoetyekHo4DQtPKmJQH9v7ksZvGxe0XgmnLc,6892
|
27
27
|
pymammotion/data/model/device_config.py,sha256=dfva6mErOepLaen1CrjGaEVbEPrxRTSWXJh-yIn5iMI,2636
|
28
28
|
pymammotion/data/model/device_info.py,sha256=Q0qJ6BflQycH_VFugwaFFXcvM69q2v9JAe2wWOcCggE,904
|
29
29
|
pymammotion/data/model/device_limits.py,sha256=m8HdxD-RaAkPm7jHYb9GLxMEH9IfzBPz0ZypmsLnId4,1946
|
@@ -31,7 +31,7 @@ pymammotion/data/model/enums.py,sha256=EpKmO8yVUZyEnTY4yH0DMMVKYNQM42zpW1maUu0i3
|
|
31
31
|
pymammotion/data/model/excute_boarder_params.py,sha256=9CpUqrygcle1C_1hDW-riLmm4map4ZbE842NXjcomEI,1394
|
32
32
|
pymammotion/data/model/execute_boarder.py,sha256=9rd_h4fbcsXxgnLOd2rO2hWyD1abnTGc47QTEpp8DD0,1103
|
33
33
|
pymammotion/data/model/generate_route_information.py,sha256=pgjqURwmEIzjCMbl4Z5JDDkfxyUAdry1KhPfyir3-mU,777
|
34
|
-
pymammotion/data/model/hash_list.py,sha256=
|
34
|
+
pymammotion/data/model/hash_list.py,sha256=xbvve9t-VcsN_ezrWjkZyLKCdji4Ii0ota9R1fhrr4g,9926
|
35
35
|
pymammotion/data/model/location.py,sha256=PwmITejfI4pm7PI4rzqSuuHetwle6IJr_CV95435s2M,871
|
36
36
|
pymammotion/data/model/mowing_modes.py,sha256=bBbRhDe-imZsXDR0TN0emQv6BiIkAlXJFb5isPEjgDk,1078
|
37
37
|
pymammotion/data/model/plan.py,sha256=wGlcJT-w0EdbWK9jI838TCOm_MABFg7WoR664VB8RWg,2880
|
@@ -65,7 +65,7 @@ pymammotion/mammotion/commands/messages/video.py,sha256=YQGIxKx2prA0X01ovNmMkX6Y
|
|
65
65
|
pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
66
|
pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
|
67
67
|
pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
|
68
|
-
pymammotion/mammotion/devices/base.py,sha256=
|
68
|
+
pymammotion/mammotion/devices/base.py,sha256=nzXpybSLX7o7ASVt85WYrmi0ycsATeQe-8ePMaQXXFY,10415
|
69
69
|
pymammotion/mammotion/devices/mammotion.py,sha256=Zz2tUIdGA-jFSHLM3aO8tBMvVl7sBIBiqC9Kg7f-lm8,13190
|
70
70
|
pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=0c-HXawLQVHz28s0HKaSCNq4wmLWJZZ3ATDVnCXdSrc,19579
|
71
71
|
pymammotion/mammotion/devices/mammotion_cloud.py,sha256=gLdxaD759QphR10LsQchTTOHZi6jvnI2EHlbhMfsXvE,14373
|
@@ -117,7 +117,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
|
|
117
117
|
pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
|
118
118
|
pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
|
119
119
|
pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
|
120
|
-
pymammotion-0.4.
|
121
|
-
pymammotion-0.4.
|
122
|
-
pymammotion-0.4.
|
123
|
-
pymammotion-0.4.
|
120
|
+
pymammotion-0.4.12.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
121
|
+
pymammotion-0.4.12.dist-info/METADATA,sha256=7OOHH8HQ2IzfLTBV7avw8fyUMUBu_i72OoQGDWkeXSg,3834
|
122
|
+
pymammotion-0.4.12.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
123
|
+
pymammotion-0.4.12.dist-info/RECORD,,
|
File without changes
|