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

@@ -2,9 +2,12 @@
2
2
 
3
3
  from dataclasses import dataclass
4
4
 
5
+ import betterproto
6
+
5
7
  from pymammotion.data.model import HashList
6
8
  from pymammotion.data.model.device_config import DeviceLimits
7
9
  from pymammotion.data.model.location import Location
10
+ from pymammotion.data.model.report_info import ReportData
8
11
  from pymammotion.proto.dev_net import DevNet
9
12
  from pymammotion.proto.luba_msg import LubaMsg
10
13
  from pymammotion.proto.luba_mul import SocMul
@@ -28,6 +31,7 @@ class MowingDevice:
28
31
  self.device = LubaMsg()
29
32
  self.map = HashList(area={}, path={}, obstacle={})
30
33
  self.location = Location()
34
+ self.report_data = ReportData()
31
35
  self.err_code_list = []
32
36
  self.err_code_list_time = []
33
37
  self.limits = DeviceLimits(30, 70, 0.2, 0.6)
@@ -85,7 +89,7 @@ class MowingDevice:
85
89
  ]
86
90
  )
87
91
 
88
- def report_data(self, toapp_report_data: ReportInfoData):
92
+ def update_report_data(self, toapp_report_data: ReportInfoData):
89
93
  coordinate_converter = CoordinateConverter(self.location.RTK.latitude, self.location.RTK.longitude)
90
94
  for index, location in enumerate(toapp_report_data.locations):
91
95
  if index == 0:
@@ -93,6 +97,8 @@ class MowingDevice:
93
97
  self.location.orientation = location.real_toward / 10000
94
98
  self.location.device = coordinate_converter.enu_to_lla(location.real_pos_y, location.real_pos_x)
95
99
 
100
+ self.report_data = self.report_data.from_dict(toapp_report_data.to_dict(casing=betterproto.Casing.SNAKE))
101
+
96
102
 
97
103
 
98
104
  def mow_info(self, toapp_mow_info: MowToAppInfoT):
@@ -0,0 +1,121 @@
1
+ from dataclasses import dataclass, field
2
+
3
+ @dataclass
4
+ class ConnectData:
5
+ connect_type: int = 0
6
+ ble_rssi: int = 0
7
+ wifi_rssi: int = 0
8
+
9
+ @classmethod
10
+ def from_dict(cls, data: dict):
11
+ return cls(
12
+ connect_type=data.get('connect_type', 0),
13
+ ble_rssi=data.get('ble_rssi', 0),
14
+ wifi_rssi=data.get('wifi_rssi', 0)
15
+ )
16
+
17
+ @dataclass
18
+ class DeviceData:
19
+ sys_status: int = 0
20
+ charge_state: int = 0
21
+ battery_val: int = 0
22
+ sensor_status: int = 0
23
+ last_status: int = 0
24
+ sys_time_stamp: str = ""
25
+
26
+ @classmethod
27
+ def from_dict(cls, data: dict):
28
+ return cls(
29
+ sys_status=data.get('sys_status', 0),
30
+ charge_state=data.get('charge_state', 0),
31
+ battery_val=data.get('battery_val', 0),
32
+ sensor_status=data.get('sensor_status', 0),
33
+ last_status=data.get('last_status', 0),
34
+ sys_time_stamp=data.get('sys_time_stamp', "")
35
+ )
36
+
37
+ @dataclass
38
+ class RTKData:
39
+ status: int = 0
40
+ pos_level: int = 0
41
+ gps_stars: int = 0
42
+ dis_status: str = ""
43
+ co_view_stars: int = 0
44
+
45
+ @classmethod
46
+ def from_dict(cls, data: dict):
47
+ return cls(
48
+ status=data.get('status', 0),
49
+ pos_level=data.get('pos_level', 0),
50
+ gps_stars=data.get('gps_stars', 0),
51
+ dis_status=data.get('dis_status', ""),
52
+ co_view_stars=data.get('co_view_stars', 0)
53
+ )
54
+
55
+ @dataclass
56
+ class LocationData:
57
+ real_pos_x: int = 0
58
+ real_pos_y: int = 0
59
+ real_toward: int = 0
60
+ pos_type: int = 0
61
+ bol_hash: str = ""
62
+
63
+ @classmethod
64
+ def from_dict(cls, data: dict):
65
+ return cls(
66
+ real_pos_x=data.get('real_pos_x', 0),
67
+ real_pos_y=data.get('real_pos_y', 0),
68
+ real_toward=data.get('real_toward', 0),
69
+ pos_type=data.get('pos_type', 0),
70
+ bol_hash=data.get('bol_hash', "")
71
+ )
72
+
73
+ @dataclass
74
+ class WorkData:
75
+ path_hash: str = ""
76
+ progress: int = 0
77
+ area: int = 0
78
+ bp_info: int = 0
79
+ bp_hash: str = ""
80
+ bp_pos_x: int = 0
81
+ bp_pos_y: int = 0
82
+ real_path_num: str = ""
83
+ ub_zone_hash: str = ""
84
+ init_cfg_hash: str = ""
85
+ ub_ecode_hash: str = ""
86
+ knife_height: int = 0
87
+
88
+ @classmethod
89
+ def from_dict(cls, data: dict):
90
+ return cls(
91
+ path_hash=data.get('path_hash', ""),
92
+ progress=data.get('progress', 0),
93
+ area=data.get('area', 0),
94
+ bp_info=data.get('bp_info', 0),
95
+ bp_hash=data.get('bp_hash', ""),
96
+ bp_pos_x=data.get('bp_pos_x', 0),
97
+ bp_pos_y=data.get('bp_pos_y', 0),
98
+ real_path_num=data.get('real_path_num', ""),
99
+ ub_zone_hash=data.get('ub_zone_hash', ""),
100
+ init_cfg_hash=data.get('init_cfg_hash', ""),
101
+ ub_ecode_hash=data.get('ub_ecode_hash', ""),
102
+ knife_height=data.get('knife_height', 0)
103
+ )
104
+
105
+ @dataclass
106
+ class ReportData:
107
+ connect: ConnectData = field(default_factory=ConnectData)
108
+ dev: DeviceData = field(default_factory=DeviceData)
109
+ rtk: RTKData = field(default_factory=RTKData)
110
+ locations: list[LocationData] = field(default_factory=list)
111
+ work: WorkData = field(default_factory=WorkData)
112
+
113
+ @classmethod
114
+ def from_dict(cls, data: dict):
115
+ return cls(
116
+ connect=ConnectData.from_dict(data.get('connect', {})),
117
+ dev=DeviceData.from_dict(data.get('dev', {})),
118
+ rtk=RTKData.from_dict(data.get('rtk', {})),
119
+ locations=[LocationData.from_dict(loc) for loc in data.get('locations', [])],
120
+ work=WorkData.from_dict(data.get('work', {}))
121
+ )
@@ -68,7 +68,7 @@ class StateManager:
68
68
  case "system_update_buf":
69
69
  self._device.buffer(sys_msg[1])
70
70
  case "toapp_report_data":
71
- self._device.report_data(sys_msg[1])
71
+ self._device.update_report_data(sys_msg[1])
72
72
  case "mow_to_app_info":
73
73
  self._device.mow_info(sys_msg[1])
74
74
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -23,7 +23,7 @@ Requires-Dist: bleak-retry-connector (>=3.5.0,<4.0.0)
23
23
  Requires-Dist: jsonic (>=1.0.0,<2.0.0)
24
24
  Requires-Dist: mashumaro (>=3.13,<4.0)
25
25
  Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
26
- Requires-Dist: numpy (>=2.0.1,<3.0.0)
26
+ Requires-Dist: numpy (>=1.26.0,<2.0.0)
27
27
  Requires-Dist: orjson (>=3.9.15,<4.0.0)
28
28
  Requires-Dist: paho-mqtt (>=1.6.1,<2.0.0)
29
29
  Requires-Dist: protobuf (>=4.23.1)
@@ -20,7 +20,7 @@ pymammotion/bluetooth/data/notifydata.py,sha256=N1bphpueWUWbsWUcpZmMGt2CyCgLcKAF
20
20
  pymammotion/const.py,sha256=3plR6t5sFVhx3LoUbW5PE2gqIANoD-fSm-T0q8uIwIU,336
21
21
  pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  pymammotion/data/model/__init__.py,sha256=d8FlIgCcWqoH3jJSpnm-IY-25RM-l2nbRwLtWjSHo74,222
23
- pymammotion/data/model/device.py,sha256=iW7EK36A6ndAmfJlMNjxcB2PxjRXhg5slI4ITGzfi_k,9911
23
+ pymammotion/data/model/device.py,sha256=tvwxuodX54CIYVIs9XqZLX0k546SJqAx5hsVi7n9A-A,10151
24
24
  pymammotion/data/model/device_config.py,sha256=6BcyVbMyw6vA1jANof8_mnG-jizGsF96pbKeHP4t8G4,179
25
25
  pymammotion/data/model/enums.py,sha256=tD_vYsxstOV_lUkYF9uWkrjVOgAJPNnGevy_xmiu3WE,1558
26
26
  pymammotion/data/model/excute_boarder_params.py,sha256=kadSth4y-VXlXIZ6R-Ng-kDvBbM-3YRr8bmR86qR0U0,1355
@@ -32,11 +32,12 @@ pymammotion/data/model/mowing_modes.py,sha256=121zhvouPKRbF7mynJIc7tJ0zO9bS-Nq4C
32
32
  pymammotion/data/model/plan.py,sha256=7JvqAo0a9Yg1Vtifd4J3Dx3StEppxrMOfmq2-877kYg,2891
33
33
  pymammotion/data/model/rapid_state.py,sha256=_e9M-65AbkvIqXyMYzLKBxbNvpso42qD8R-JSt66THY,986
34
34
  pymammotion/data/model/region_data.py,sha256=75xOTM1qeRbSROp53eIczw3yCmYM9DgMjMh8qE9xkKo,2880
35
+ pymammotion/data/model/report_info.py,sha256=ISk_ZT-GoL9Os-2FmxuTnXr2-28DiDhQVo6YEaGhJrg,3639
35
36
  pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
36
37
  pymammotion/data/mqtt/event.py,sha256=kEilMLmwZG2nbokLw7X28KF3b-te8G-MfNARYm4LG6I,2170
37
38
  pymammotion/data/mqtt/properties.py,sha256=HkBPghr26L9_b4QaOi1DtPgb0UoPIOGSe9wb3kgnM6Y,2815
38
39
  pymammotion/data/mqtt/status.py,sha256=zqnlo-MzejEQZszl0i0Wucoc3E76x6UtI9JLxoBnu54,1067
39
- pymammotion/data/state_manager.py,sha256=bi_ThLe65n-kjhVq8lfW1P1a4GUp4czs_86hbXj4URs,2798
40
+ pymammotion/data/state_manager.py,sha256=ItihtkmJCeIdXOYD3YRBp241cP29oMABbSISyC5A7tw,2805
40
41
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
41
42
  pymammotion/event/event.py,sha256=Fy5-I1p92AO_D67VW4eHQqA4pOt7MZsrP--tVfIVUz8,1820
42
43
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -108,7 +109,7 @@ pymammotion/utility/device_type.py,sha256=KYawu2glZMVlPmxRbA4kVFujXz3miHp3rJiOWR
108
109
  pymammotion/utility/map.py,sha256=CRW-CjkLBp8R9UcobH2cQ9x4qNxHSLlI2u0jAiKyB8A,2271
109
110
  pymammotion/utility/periodic.py,sha256=9wJMfwXPlx6Mbp3Fws7LLTI34ZDKphH1bva_Ggyk32g,3281
110
111
  pymammotion/utility/rocker_util.py,sha256=syPL0QN4zMzHiTIkUKS7RXBBptjdbkfNlPddwUD5V3A,7171
111
- pymammotion-0.1.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
112
- pymammotion-0.1.2.dist-info/METADATA,sha256=sGPlxMHLYdo5F5dNcJOQiQVPCMBZGPX-7B15TN51K2A,3921
113
- pymammotion-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
114
- pymammotion-0.1.2.dist-info/RECORD,,
112
+ pymammotion-0.1.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
113
+ pymammotion-0.1.4.dist-info/METADATA,sha256=3HWIpIIRvA-gnH-SZ3qJH7mdieIwKy3hNEPLJ9eszA4,3922
114
+ pymammotion-0.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
115
+ pymammotion-0.1.4.dist-info/RECORD,,