pymammotion 0.2.69__py3-none-any.whl → 0.2.70__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.
@@ -7,9 +7,6 @@ from pymammotion.bluetooth.const import (
7
7
  )
8
8
  from pymammotion.event.event import BleNotificationEvent
9
9
 
10
- # TODO setup for each Luba
11
- address = "90:38:0C:6E:EE:9E"
12
-
13
10
 
14
11
  class MammotionBLE:
15
12
  client: BleakClient
@@ -24,9 +21,7 @@ class MammotionBLE:
24
21
  # TODO: do something with incoming data
25
22
  print(device)
26
23
  print(advertising_data)
27
- if device.address == "90:38:0C:6E:EE:9E":
28
- return True
29
- if advertising_data.local_name and "Luba-" in advertising_data.local_name:
24
+ if advertising_data.local_name and ("Luba-" in advertising_data.local_name or "Yuka-" in advertising_data.local_name):
30
25
  return True
31
26
  return False
32
27
 
@@ -54,6 +54,7 @@ class BleMessage:
54
54
  self.mReadSequence = itertools.count(start=0)
55
55
  self.mAck = queue.Queue()
56
56
  self.notification = BlufiNotifyData()
57
+ self._write_char = client.services.get_characteristic(UUID_WRITE_CHARACTERISTIC)
57
58
 
58
59
  async def get_task(self) -> None:
59
60
  hash_map = {"pver": 1, "subCmd": 2, "result": 0}
@@ -128,7 +129,7 @@ class BleMessage:
128
129
  await self.post_custom_data(serialize(executeBorder))
129
130
 
130
131
  async def gatt_write(self, data: bytes) -> None:
131
- await self.client.write_gatt_char(UUID_WRITE_CHARACTERISTIC, data, True)
132
+ await self.client.write_gatt_char(self._write_char, data, True)
132
133
 
133
134
  def parseNotification(self, response: bytearray):
134
135
  dataOffset = None
@@ -97,9 +97,10 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
97
97
  self._device = device
98
98
 
99
99
  async def _ble_sync(self) -> None:
100
- _LOGGER.debug("BLE SYNC")
101
- command_bytes = self._commands.send_todev_ble_sync(2)
102
- await self._message.post_custom_data_bytes(command_bytes)
100
+ if self._client is not None and self._client.is_connected:
101
+ _LOGGER.debug("BLE SYNC")
102
+ command_bytes = self._commands.send_todev_ble_sync(2)
103
+ await self._message.post_custom_data_bytes(command_bytes)
103
104
 
104
105
  async def run_periodic_sync_task(self) -> None:
105
106
  """Send ble sync to robot."""
@@ -323,6 +324,7 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
323
324
  _LOGGER.exception("Error parsing message %s", data)
324
325
  finally:
325
326
  self._message.clearNotification()
327
+ data = b''
326
328
 
327
329
  _LOGGER.debug("%s: Received notification: %s", self.name, data)
328
330
  else:
@@ -379,11 +381,9 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
379
381
  """Resolve characteristics."""
380
382
  self._read_char = services.get_characteristic(READ_CHAR_UUID)
381
383
  if not self._read_char:
382
- self._read_char = READ_CHAR_UUID
383
384
  _LOGGER.error(CharacteristicMissingError(READ_CHAR_UUID))
384
385
  self._write_char = services.get_characteristic(WRITE_CHAR_UUID)
385
386
  if not self._write_char:
386
- self._write_char = WRITE_CHAR_UUID
387
387
  _LOGGER.error(CharacteristicMissingError(WRITE_CHAR_UUID))
388
388
 
389
389
  def _reset_disconnect_timer(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.69
3
+ Version: 0.2.70
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -11,8 +11,8 @@ pymammotion/aliyun/model/session_by_authcode_response.py,sha256=qW0pnnRXfyEuMbb9
11
11
  pymammotion/aliyun/model/stream_subscription_response.py,sha256=po765WASQDboVCosbPEfDHNlanBf-3WMrA6iV3ezooY,357
12
12
  pymammotion/aliyun/tmp_constant.py,sha256=M4Hq_lrGB3LZdX6R2XohRPFoK1NDnNV-pTJwJcJ9838,6650
13
13
  pymammotion/bluetooth/__init__.py,sha256=LAl8jqZ1fPh-3mLmViNQsP3s814C1vsocYUa6oSaXt0,36
14
- pymammotion/bluetooth/ble.py,sha256=C7H7j71fhsvBfI8QEa9PlY3Ugm2CK1CXI7CXqranM48,2470
15
- pymammotion/bluetooth/ble_message.py,sha256=toPhMOgmHEdHzvaOsgCUfrkjdI38oeS4Av0E-I8X0_s,14952
14
+ pymammotion/bluetooth/ble.py,sha256=sIY0vtUazXDWd_YjIFk9QEbOh_NQ9y5fVrQIemDhKd8,2374
15
+ pymammotion/bluetooth/ble_message.py,sha256=bVgrSnl6882hjGfv117SpV5BFvPkKcShti-CTC8DOOU,15032
16
16
  pymammotion/bluetooth/const.py,sha256=CCqyHsYbB0BAYjwdhXt_n6eWWxmhlUrAFjvVv57mbvE,1749
17
17
  pymammotion/bluetooth/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  pymammotion/bluetooth/data/convert.py,sha256=6DMwvzVr9FWCoQFIKSI2poFXjISc_m6X59g8FlVO0-o,800
@@ -63,7 +63,7 @@ pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3T
63
63
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
64
64
  pymammotion/mammotion/devices/base.py,sha256=F_L5aDtY6rgRkk7Q4CwilLenTANW6cBe9zIU3a9HRmA,10020
65
65
  pymammotion/mammotion/devices/mammotion.py,sha256=hSO184o1q4ftfLPx9froFPIXk428wGg8Ayw160W3z7c,12482
66
- pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=P4cJEfntCPcaGlrGGZSWEApM5D5cwCk4MbukfStSP3Q,18889
66
+ pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=YL_865BZ_DzosiZ1I85l4ro_DTZVQWZT0SLIjAmSyCU,18903
67
67
  pymammotion/mammotion/devices/mammotion_cloud.py,sha256=7xbSZmC1PUG6ZfF5LtiELkQE61lybHoJcBUzz76VvLg,12074
68
68
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
69
69
  pymammotion/mqtt/mammotion_future.py,sha256=_OWqKOlUGl2yT1xOsXFQYpGd-1zQ63OxqXgy7KRQgYc,710
@@ -119,7 +119,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
119
119
  pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
120
120
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
121
121
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
122
- pymammotion-0.2.69.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
- pymammotion-0.2.69.dist-info/METADATA,sha256=WB0DIDd6a9UIsShP0cBubzGQVOZJjvXNHNkOeMpfQnc,3896
124
- pymammotion-0.2.69.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
- pymammotion-0.2.69.dist-info/RECORD,,
122
+ pymammotion-0.2.70.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
+ pymammotion-0.2.70.dist-info/METADATA,sha256=Vi-ttJuh4fzMfWA11xLx0O5KGHrNO7Cf3kmGbr73Y2Y,3896
124
+ pymammotion-0.2.70.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
+ pymammotion-0.2.70.dist-info/RECORD,,