pymammotion 0.5.69__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 +53 -0
- pymammotion/agora/__init__.py +0 -0
- pymammotion/agora/agora_api.py +755 -0
- pymammotion/agora/agora_rtc_capabilities.py +748 -0
- pymammotion/agora/agora_websockets.py +1175 -0
- pymammotion/aliyun/__init__.py +1 -0
- pymammotion/aliyun/client.py +235 -0
- pymammotion/aliyun/cloud_gateway.py +982 -0
- pymammotion/aliyun/model/aep_response.py +21 -0
- pymammotion/aliyun/model/connect_response.py +51 -0
- pymammotion/aliyun/model/dev_by_account_response.py +195 -0
- pymammotion/aliyun/model/login_by_oauth_response.py +64 -0
- pymammotion/aliyun/model/regions_response.py +29 -0
- pymammotion/aliyun/model/session_by_authcode_response.py +19 -0
- pymammotion/aliyun/model/thing_response.py +12 -0
- pymammotion/aliyun/regions.py +62 -0
- pymammotion/aliyun/tea/core.py +297 -0
- pymammotion/aliyun/tmp_constant.py +171 -0
- pymammotion/bluetooth/__init__.py +1 -0
- pymammotion/bluetooth/ble.py +62 -0
- pymammotion/bluetooth/ble_message.py +676 -0
- pymammotion/bluetooth/const.py +27 -0
- pymammotion/bluetooth/data/__init__.py +0 -0
- pymammotion/bluetooth/data/convert.py +25 -0
- pymammotion/bluetooth/data/framectrldata.py +40 -0
- pymammotion/bluetooth/data/notifydata.py +62 -0
- pymammotion/bluetooth/model/__init__.py +0 -0
- pymammotion/bluetooth/model/atomic_integer.py +54 -0
- pymammotion/const.py +13 -0
- pymammotion/data/__init__.py +0 -0
- pymammotion/data/model/__init__.py +8 -0
- pymammotion/data/model/account.py +8 -0
- pymammotion/data/model/device.py +192 -0
- pymammotion/data/model/device_config.py +72 -0
- pymammotion/data/model/device_info.py +60 -0
- pymammotion/data/model/device_limits.py +49 -0
- pymammotion/data/model/enums.py +77 -0
- pymammotion/data/model/errors.py +12 -0
- pymammotion/data/model/events.py +14 -0
- pymammotion/data/model/generate_geojson.py +565 -0
- pymammotion/data/model/generate_route_information.py +26 -0
- pymammotion/data/model/hash_list.py +475 -0
- pymammotion/data/model/location.py +36 -0
- pymammotion/data/model/mowing_modes.py +77 -0
- pymammotion/data/model/rapid_state.py +45 -0
- pymammotion/data/model/raw_data.py +215 -0
- pymammotion/data/model/region_data.py +102 -0
- pymammotion/data/model/report_info.py +182 -0
- pymammotion/data/model/work.py +27 -0
- pymammotion/data/mower_state_manager.py +369 -0
- pymammotion/data/mqtt/__init__.py +1 -0
- pymammotion/data/mqtt/event.py +227 -0
- pymammotion/data/mqtt/mammotion_properties.py +276 -0
- pymammotion/data/mqtt/properties.py +203 -0
- pymammotion/data/mqtt/status.py +57 -0
- pymammotion/event/__init__.py +6 -0
- pymammotion/event/event.py +96 -0
- pymammotion/homeassistant/__init__.py +3 -0
- pymammotion/homeassistant/mower_api.py +514 -0
- pymammotion/homeassistant/rtk_api.py +54 -0
- pymammotion/http/__init__.py +0 -0
- pymammotion/http/encryption.py +220 -0
- pymammotion/http/http.py +673 -0
- pymammotion/http/model/__init__.py +0 -0
- pymammotion/http/model/camera_stream.py +31 -0
- pymammotion/http/model/http.py +249 -0
- pymammotion/http/model/response_factory.py +61 -0
- pymammotion/http/model/rtk.py +16 -0
- pymammotion/mammotion/__init__.py +0 -0
- pymammotion/mammotion/commands/__init__.py +0 -0
- pymammotion/mammotion/commands/abstract_message.py +24 -0
- pymammotion/mammotion/commands/mammotion_command.py +81 -0
- pymammotion/mammotion/commands/messages/__init__.py +0 -0
- pymammotion/mammotion/commands/messages/basestation.py +43 -0
- pymammotion/mammotion/commands/messages/driver.py +122 -0
- pymammotion/mammotion/commands/messages/media.py +87 -0
- pymammotion/mammotion/commands/messages/navigation.py +564 -0
- pymammotion/mammotion/commands/messages/network.py +205 -0
- pymammotion/mammotion/commands/messages/ota.py +38 -0
- pymammotion/mammotion/commands/messages/system.py +330 -0
- pymammotion/mammotion/commands/messages/video.py +33 -0
- pymammotion/mammotion/control/__init__.py +0 -0
- pymammotion/mammotion/control/joystick.py +145 -0
- pymammotion/mammotion/devices/__init__.py +29 -0
- pymammotion/mammotion/devices/base.py +163 -0
- pymammotion/mammotion/devices/mammotion.py +571 -0
- pymammotion/mammotion/devices/mammotion_bluetooth.py +496 -0
- pymammotion/mammotion/devices/mammotion_cloud.py +355 -0
- pymammotion/mammotion/devices/mammotion_mower_ble.py +48 -0
- pymammotion/mammotion/devices/mammotion_mower_cloud.py +39 -0
- pymammotion/mammotion/devices/managers/managers.py +81 -0
- pymammotion/mammotion/devices/mower_device.py +120 -0
- pymammotion/mammotion/devices/mower_manager.py +107 -0
- pymammotion/mammotion/devices/rtk_ble.py +89 -0
- pymammotion/mammotion/devices/rtk_cloud.py +115 -0
- pymammotion/mammotion/devices/rtk_device.py +50 -0
- pymammotion/mammotion/devices/rtk_manager.py +125 -0
- pymammotion/mqtt/__init__.py +6 -0
- pymammotion/mqtt/aliyun_mqtt.py +237 -0
- pymammotion/mqtt/linkkit/__init__.py +5 -0
- pymammotion/mqtt/linkkit/h2client.py +585 -0
- pymammotion/mqtt/linkkit/linkkit.py +3025 -0
- pymammotion/mqtt/mammotion_future.py +26 -0
- pymammotion/mqtt/mammotion_mqtt.py +214 -0
- pymammotion/mqtt/mqtt_models.py +66 -0
- pymammotion/proto/__init__.py +4841 -0
- pymammotion/proto/basestation.proto +51 -0
- pymammotion/proto/basestation_pb2.py +35 -0
- pymammotion/proto/basestation_pb2.pyi +89 -0
- pymammotion/proto/common.proto +7 -0
- pymammotion/proto/common_pb2.py +25 -0
- pymammotion/proto/common_pb2.pyi +13 -0
- pymammotion/proto/dev_net.proto +321 -0
- pymammotion/proto/dev_net_pb2.py +111 -0
- pymammotion/proto/dev_net_pb2.pyi +515 -0
- pymammotion/proto/luba_msg.proto +76 -0
- pymammotion/proto/luba_msg_pb2.py +41 -0
- pymammotion/proto/luba_msg_pb2.pyi +97 -0
- pymammotion/proto/luba_mul.proto +129 -0
- pymammotion/proto/luba_mul_pb2.py +61 -0
- pymammotion/proto/luba_mul_pb2.pyi +178 -0
- pymammotion/proto/mctrl_driver.proto +107 -0
- pymammotion/proto/mctrl_driver_pb2.py +57 -0
- pymammotion/proto/mctrl_driver_pb2.pyi +167 -0
- pymammotion/proto/mctrl_nav.proto +591 -0
- pymammotion/proto/mctrl_nav_pb2.py +136 -0
- pymammotion/proto/mctrl_nav_pb2.pyi +1067 -0
- pymammotion/proto/mctrl_ota.proto +80 -0
- pymammotion/proto/mctrl_ota_pb2.py +45 -0
- pymammotion/proto/mctrl_ota_pb2.pyi +128 -0
- pymammotion/proto/mctrl_pept.proto +34 -0
- pymammotion/proto/mctrl_pept_pb2.py +33 -0
- pymammotion/proto/mctrl_pept_pb2.pyi +58 -0
- pymammotion/proto/mctrl_sys.proto +741 -0
- pymammotion/proto/mctrl_sys_pb2.py +206 -0
- pymammotion/proto/mctrl_sys_pb2.pyi +1213 -0
- pymammotion/proto/message_pool.py +3 -0
- pymammotion/proto/py.typed +0 -0
- pymammotion/py.typed +0 -0
- pymammotion/utility/constant/__init__.py +3 -0
- pymammotion/utility/constant/device_constant.py +315 -0
- pymammotion/utility/conversions.py +5 -0
- pymammotion/utility/datatype_converter.py +124 -0
- pymammotion/utility/device_config.py +755 -0
- pymammotion/utility/device_type.py +489 -0
- pymammotion/utility/map.py +259 -0
- pymammotion/utility/movement.py +18 -0
- pymammotion/utility/mur_mur_hash.py +159 -0
- pymammotion/utility/periodic.py +106 -0
- pymammotion/utility/rocker_util.py +194 -0
- pymammotion-0.5.69.dist-info/METADATA +93 -0
- pymammotion-0.5.69.dist-info/RECORD +154 -0
- pymammotion-0.5.69.dist-info/WHEEL +4 -0
- pymammotion-0.5.69.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
|
|
3
|
+
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
|
4
|
+
|
|
5
|
+
from pymammotion.proto import DevNet, LubaMsg, MctlDriver, MctlNav, MctlOta, MctlPept, MctlSys, SocMul
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class RawMowerData:
|
|
10
|
+
raw: LubaMsg | None = field(default_factory=LubaMsg)
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def from_raw(cls, raw: dict) -> "RawMowerData":
|
|
14
|
+
"""Take in raw data to hold in the betterproto dataclass."""
|
|
15
|
+
return RawMowerData(raw=LubaMsg(**raw))
|
|
16
|
+
|
|
17
|
+
def update_raw(self, raw: dict) -> None:
|
|
18
|
+
"""Update the raw LubaMsg data."""
|
|
19
|
+
self.raw = LubaMsg(**raw)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def net(self):
|
|
23
|
+
"""Will return a wrapped betterproto of net."""
|
|
24
|
+
return DevNetData(net=self.raw.net)
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def sys(self):
|
|
28
|
+
"""Will return a wrapped betterproto of sys."""
|
|
29
|
+
return SysData(sys=self.raw.sys)
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def nav(self):
|
|
33
|
+
"""Will return a wrapped betterproto of nav."""
|
|
34
|
+
return NavData(nav=self.raw.nav)
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def driver(self):
|
|
38
|
+
"""Will return a wrapped betterproto of driver."""
|
|
39
|
+
return DriverData(driver=self.raw.driver)
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def mul(self):
|
|
43
|
+
"""Will return a wrapped betterproto of mul."""
|
|
44
|
+
return MulData(mul=self.raw.mul)
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def ota(self):
|
|
48
|
+
"""Will return a wrapped betterproto of ota."""
|
|
49
|
+
return OtaData(ota=self.raw.ota)
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def pept(self):
|
|
53
|
+
"""Will return a wrapped betterproto of pept."""
|
|
54
|
+
return PeptData(pept=self.raw.pept)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass
|
|
58
|
+
class DevNetData(DataClassORJSONMixin):
|
|
59
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
60
|
+
|
|
61
|
+
net: dict
|
|
62
|
+
|
|
63
|
+
def __init__(self, net: DevNet) -> None:
|
|
64
|
+
if isinstance(net, dict):
|
|
65
|
+
self.net = net
|
|
66
|
+
else:
|
|
67
|
+
self.net = net.to_dict()
|
|
68
|
+
|
|
69
|
+
def __getattr__(self, item):
|
|
70
|
+
"""Intercept call to get net in dict and return a betterproto dataclass."""
|
|
71
|
+
if self.net.get(item) is None:
|
|
72
|
+
return DevNet().__getattribute__(item)
|
|
73
|
+
|
|
74
|
+
if not isinstance(self.net.get(item), dict):
|
|
75
|
+
return self.net.get(item)
|
|
76
|
+
|
|
77
|
+
return DevNet().__getattribute__(item).from_dict(value=self.net.get(item))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass
|
|
81
|
+
class SysData(DataClassORJSONMixin):
|
|
82
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
83
|
+
|
|
84
|
+
sys: dict
|
|
85
|
+
|
|
86
|
+
def __init__(self, sys: MctlSys) -> None:
|
|
87
|
+
if isinstance(sys, dict):
|
|
88
|
+
self.sys = sys
|
|
89
|
+
else:
|
|
90
|
+
self.sys = sys.to_dict()
|
|
91
|
+
|
|
92
|
+
def __getattr__(self, item: str):
|
|
93
|
+
"""Intercept call to get sys in dict and return a betterproto dataclass."""
|
|
94
|
+
if self.sys.get(item) is None:
|
|
95
|
+
return MctlSys().__getattribute__(item)
|
|
96
|
+
|
|
97
|
+
if not isinstance(self.sys.get(item), dict):
|
|
98
|
+
return self.sys.get(item)
|
|
99
|
+
|
|
100
|
+
return MctlSys().__getattribute__(item).from_dict(value=self.sys.get(item))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass
|
|
104
|
+
class NavData(DataClassORJSONMixin):
|
|
105
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
106
|
+
|
|
107
|
+
nav: dict
|
|
108
|
+
|
|
109
|
+
def __init__(self, nav: MctlNav) -> None:
|
|
110
|
+
if isinstance(nav, dict):
|
|
111
|
+
self.nav = nav
|
|
112
|
+
else:
|
|
113
|
+
self.nav = nav.to_dict()
|
|
114
|
+
|
|
115
|
+
def __getattr__(self, item: str):
|
|
116
|
+
"""Intercept call to get nav in dict and return a betterproto dataclass."""
|
|
117
|
+
if self.nav.get(item) is None:
|
|
118
|
+
return MctlNav().__getattribute__(item)
|
|
119
|
+
|
|
120
|
+
if not isinstance(self.nav.get(item), dict):
|
|
121
|
+
return self.nav.get(item)
|
|
122
|
+
|
|
123
|
+
return MctlNav().__getattribute__(item).from_dict(value=self.nav.get(item))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@dataclass
|
|
127
|
+
class DriverData(DataClassORJSONMixin):
|
|
128
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
129
|
+
|
|
130
|
+
driver: dict
|
|
131
|
+
|
|
132
|
+
def __init__(self, driver: MctlDriver) -> None:
|
|
133
|
+
if isinstance(driver, dict):
|
|
134
|
+
self.driver = driver
|
|
135
|
+
else:
|
|
136
|
+
self.driver = driver.to_dict()
|
|
137
|
+
|
|
138
|
+
def __getattr__(self, item: str):
|
|
139
|
+
"""Intercept call to get driver in dict and return a betterproto dataclass."""
|
|
140
|
+
if self.driver.get(item) is None:
|
|
141
|
+
return MctlDriver().__getattribute__(item)
|
|
142
|
+
|
|
143
|
+
if not isinstance(self.driver.get(item), dict):
|
|
144
|
+
return self.driver.get(item)
|
|
145
|
+
|
|
146
|
+
return MctlDriver().__getattribute__(item).from_dict(value=self.driver.get(item))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@dataclass
|
|
150
|
+
class MulData(DataClassORJSONMixin):
|
|
151
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
152
|
+
|
|
153
|
+
mul: dict
|
|
154
|
+
|
|
155
|
+
def __init__(self, mul: SocMul) -> None:
|
|
156
|
+
if isinstance(mul, dict):
|
|
157
|
+
self.mul = mul
|
|
158
|
+
else:
|
|
159
|
+
self.mul = mul.to_dict()
|
|
160
|
+
|
|
161
|
+
def __getattr__(self, item: str):
|
|
162
|
+
"""Intercept call to get mul in dict and return a betterproto dataclass."""
|
|
163
|
+
if self.mul.get(item) is None:
|
|
164
|
+
return SocMul().__getattribute__(item)
|
|
165
|
+
|
|
166
|
+
if not isinstance(self.mul.get(item), dict):
|
|
167
|
+
return self.mul.get(item)
|
|
168
|
+
|
|
169
|
+
return SocMul().__getattribute__(item).from_dict(value=self.mul.get(item))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@dataclass
|
|
173
|
+
class OtaData(DataClassORJSONMixin):
|
|
174
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
175
|
+
|
|
176
|
+
ota: dict
|
|
177
|
+
|
|
178
|
+
def __init__(self, ota: MctlOta) -> None:
|
|
179
|
+
if isinstance(ota, dict):
|
|
180
|
+
self.ota = ota
|
|
181
|
+
else:
|
|
182
|
+
self.ota = ota.to_dict()
|
|
183
|
+
|
|
184
|
+
def __getattr__(self, item: str):
|
|
185
|
+
"""Intercept call to get ota in dict and return a betterproto dataclass."""
|
|
186
|
+
if self.ota.get(item) is None:
|
|
187
|
+
return MctlOta().__getattribute__(item)
|
|
188
|
+
|
|
189
|
+
if not isinstance(self.ota.get(item), dict):
|
|
190
|
+
return self.ota.get(item)
|
|
191
|
+
|
|
192
|
+
return MctlOta().__getattribute__(item).from_dict(value=self.ota.get(item))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@dataclass
|
|
196
|
+
class PeptData(DataClassORJSONMixin):
|
|
197
|
+
"""Wrapping class around LubaMsg to return a dataclass from the raw dict."""
|
|
198
|
+
|
|
199
|
+
pept: dict
|
|
200
|
+
|
|
201
|
+
def __init__(self, pept: MctlPept) -> None:
|
|
202
|
+
if isinstance(pept, dict):
|
|
203
|
+
self.pept = pept
|
|
204
|
+
else:
|
|
205
|
+
self.pept = pept.to_dict()
|
|
206
|
+
|
|
207
|
+
def __getattr__(self, item: str):
|
|
208
|
+
"""Intercept call to get pept in dict and return a betterproto dataclass."""
|
|
209
|
+
if self.pept.get(item) is None:
|
|
210
|
+
return MctlPept().__getattribute__(item)
|
|
211
|
+
|
|
212
|
+
if not isinstance(self.pept.get(item), dict):
|
|
213
|
+
return self.pept.get(item)
|
|
214
|
+
|
|
215
|
+
return MctlPept().__getattribute__(item).from_dict(value=self.pept.get(item))
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class RegionData(DataClassORJSONMixin):
|
|
8
|
+
def __init__(self) -> None:
|
|
9
|
+
self.hash: int = 0
|
|
10
|
+
self.action: int = 0
|
|
11
|
+
self.current_frame: int = 0
|
|
12
|
+
self.data_hash: int = 0
|
|
13
|
+
self.data_len: int = 0
|
|
14
|
+
self.p_hash_a: int = 0
|
|
15
|
+
self.p_hash_b: int = 0
|
|
16
|
+
self.path: list[list[float]] | None = None
|
|
17
|
+
self.pver: int = 0
|
|
18
|
+
self.result: int = 0
|
|
19
|
+
self.sub_cmd: int = 0
|
|
20
|
+
self.total_frame: int = 0
|
|
21
|
+
self.type: int = 0
|
|
22
|
+
|
|
23
|
+
def set_hash(self, hash: int) -> None:
|
|
24
|
+
self.hash = hash
|
|
25
|
+
|
|
26
|
+
def get_data_len(self) -> int:
|
|
27
|
+
return self.data_len
|
|
28
|
+
|
|
29
|
+
def set_data_len(self, data_len: int) -> None:
|
|
30
|
+
self.data_len = data_len
|
|
31
|
+
|
|
32
|
+
def get_pver(self) -> int:
|
|
33
|
+
return self.pver
|
|
34
|
+
|
|
35
|
+
def set_pver(self, pver: int) -> None:
|
|
36
|
+
self.pver = pver
|
|
37
|
+
|
|
38
|
+
def get_sub_cmd(self) -> int:
|
|
39
|
+
return self.sub_cmd
|
|
40
|
+
|
|
41
|
+
def set_sub_cmd(self, sub_cmd: int) -> None:
|
|
42
|
+
self.sub_cmd = sub_cmd
|
|
43
|
+
|
|
44
|
+
def get_result(self) -> int:
|
|
45
|
+
return self.result
|
|
46
|
+
|
|
47
|
+
def set_result(self, result: int) -> None:
|
|
48
|
+
self.result = result
|
|
49
|
+
|
|
50
|
+
def get_action(self) -> int:
|
|
51
|
+
return self.action
|
|
52
|
+
|
|
53
|
+
def set_action(self, action: int) -> None:
|
|
54
|
+
self.action = action
|
|
55
|
+
|
|
56
|
+
def get_type(self) -> int:
|
|
57
|
+
return self.type
|
|
58
|
+
|
|
59
|
+
def set_type(self, type: int) -> None:
|
|
60
|
+
self.type = type
|
|
61
|
+
|
|
62
|
+
def get_total_frame(self) -> int:
|
|
63
|
+
return self.total_frame
|
|
64
|
+
|
|
65
|
+
def set_total_frame(self, total_frame: int) -> None:
|
|
66
|
+
self.total_frame = total_frame
|
|
67
|
+
|
|
68
|
+
def get_current_frame(self) -> int:
|
|
69
|
+
return self.current_frame
|
|
70
|
+
|
|
71
|
+
def set_current_frame(self, current_frame: int) -> None:
|
|
72
|
+
self.current_frame = current_frame
|
|
73
|
+
|
|
74
|
+
def get_path(self) -> list[list[float]] | None:
|
|
75
|
+
return self.path
|
|
76
|
+
|
|
77
|
+
def set_path(self, path: list[list[float]]) -> None:
|
|
78
|
+
self.path = path
|
|
79
|
+
|
|
80
|
+
def get_hash(self) -> int | None:
|
|
81
|
+
return self.hash
|
|
82
|
+
|
|
83
|
+
def set_data_hash(self, data_hash: int) -> None:
|
|
84
|
+
self.data_hash = data_hash
|
|
85
|
+
|
|
86
|
+
def get_data_hash(self) -> int | None:
|
|
87
|
+
return self.data_hash
|
|
88
|
+
|
|
89
|
+
def set_p_hash_a(self, p_hash_a: int) -> None:
|
|
90
|
+
self.p_hash_a = p_hash_a
|
|
91
|
+
|
|
92
|
+
def get_p_hash_a(self) -> int | None:
|
|
93
|
+
return self.p_hash_a
|
|
94
|
+
|
|
95
|
+
def set_p_hash_b(self, p_hash_b: int) -> None:
|
|
96
|
+
self.p_hash_b = p_hash_b
|
|
97
|
+
|
|
98
|
+
def get_p_hash_b(self) -> int | None:
|
|
99
|
+
return self.p_hash_b
|
|
100
|
+
|
|
101
|
+
def __str__(self) -> str:
|
|
102
|
+
return f"RegionData{{pver={self.pver}, sub_cmd={self.sub_cmd}, result={self.result}, action={self.action}, type={self.type}, Hash={self.hash}, total_frame={self.total_frame}, current_frame={self.current_frame}, data_hash={self.data_hash}, p_hash_a={self.p_hash_a}, p_hash_b={self.p_hash_b}, data_len={self.data_len}, path={self.path}}}"
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from enum import StrEnum
|
|
3
|
+
|
|
4
|
+
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NetUsedType(StrEnum):
|
|
8
|
+
NONE = "NONE"
|
|
9
|
+
WIFI = "WIFI"
|
|
10
|
+
MNET = "MNET"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class ConnectData(DataClassORJSONMixin):
|
|
15
|
+
connect_type: int = 0
|
|
16
|
+
ble_rssi: int = 0
|
|
17
|
+
wifi_rssi: int = 0
|
|
18
|
+
link_type: int = 0
|
|
19
|
+
mnet_rssi: int = 0
|
|
20
|
+
mnet_inet: int = 0
|
|
21
|
+
used_net: str = "NONE"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# mnet_cfg:
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class CollectorStatus(DataClassORJSONMixin):
|
|
29
|
+
collector_installation_status: int = 0
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class MnetInfo(DataClassORJSONMixin):
|
|
34
|
+
model: str = ""
|
|
35
|
+
revision: str = ""
|
|
36
|
+
imei: str = ""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class LockStateT(DataClassORJSONMixin):
|
|
41
|
+
lock_state: int = 0
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class VioSurvivalInfo(DataClassORJSONMixin):
|
|
46
|
+
vio_survival_distance: float = 0.0
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass
|
|
50
|
+
class DeviceData(DataClassORJSONMixin):
|
|
51
|
+
sys_status: int = 0
|
|
52
|
+
charge_state: int = 0
|
|
53
|
+
battery_val: int = 0
|
|
54
|
+
sensor_status: int = 0
|
|
55
|
+
last_status: int = 0
|
|
56
|
+
sys_time_stamp: str = ""
|
|
57
|
+
vslam_status: int = 0
|
|
58
|
+
mnet_info: MnetInfo = field(default_factory=MnetInfo)
|
|
59
|
+
vio_survival_info: VioSurvivalInfo = field(default_factory=VioSurvivalInfo)
|
|
60
|
+
collector_status: CollectorStatus = field(default_factory=CollectorStatus)
|
|
61
|
+
lock_state: LockStateT = field(default_factory=LockStateT)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class RTKDisStatus(DataClassORJSONMixin):
|
|
66
|
+
pos_status: int = 0
|
|
67
|
+
precision: int = 0
|
|
68
|
+
device_signal: int = 0
|
|
69
|
+
l1: int = 0
|
|
70
|
+
l2: int = 0
|
|
71
|
+
connection_to_ref: int = 0
|
|
72
|
+
rtk_signal: int = 0
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@dataclass
|
|
76
|
+
class RTKData(DataClassORJSONMixin):
|
|
77
|
+
status: int = 0
|
|
78
|
+
pos_level: int = 0
|
|
79
|
+
gps_stars: int = 0
|
|
80
|
+
dis_status: int = 0
|
|
81
|
+
co_view_stars: int = 0
|
|
82
|
+
|
|
83
|
+
def get_dis_status(self) -> RTKDisStatus:
|
|
84
|
+
rtk_dis_status = RTKDisStatus()
|
|
85
|
+
rtk_dis_status.pos_status = ((int)(self.dis_status >> 8)) & 255
|
|
86
|
+
rtk_dis_status.precision = ((int)(self.dis_status >> 56)) & 255
|
|
87
|
+
rtk_dis_status.device_signal = ((int)(self.dis_status >> 32)) & 255
|
|
88
|
+
rtk_dis_status.l1 = ((int)(self.dis_status >> 16)) & 255
|
|
89
|
+
rtk_dis_status.l2 = ((int)(self.dis_status >> 24)) & 255
|
|
90
|
+
rtk_dis_status.connection_to_ref = ((int)(self.dis_status >> 48)) & 255
|
|
91
|
+
rtk_dis_status.rtk_signal = ((int)(self.dis_status >> 40)) & 255
|
|
92
|
+
return rtk_dis_status
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class LocationData(DataClassORJSONMixin):
|
|
97
|
+
real_pos_x: int = 0
|
|
98
|
+
real_pos_y: int = 0
|
|
99
|
+
real_toward: int = 0
|
|
100
|
+
pos_type: int = 0
|
|
101
|
+
bol_hash: int = 0
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass
|
|
105
|
+
class BladeUsed(DataClassORJSONMixin):
|
|
106
|
+
blade_used_time: int = 0
|
|
107
|
+
blade_used_warn_time: int = 0
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@dataclass
|
|
111
|
+
class Maintain(DataClassORJSONMixin):
|
|
112
|
+
blade_used_time: BladeUsed = field(default_factory=BladeUsed)
|
|
113
|
+
mileage: int = 0
|
|
114
|
+
work_time: int = 0
|
|
115
|
+
bat_cycles: int = 0
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass
|
|
119
|
+
class VisionInfo(DataClassORJSONMixin):
|
|
120
|
+
x: float = 0.0
|
|
121
|
+
y: float = 0.0
|
|
122
|
+
heading: float = 0.0
|
|
123
|
+
vio_state: int = 0
|
|
124
|
+
brightness: int = 0
|
|
125
|
+
detect_feature_num: int = 0
|
|
126
|
+
track_feature_num: int = 0
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@dataclass
|
|
130
|
+
class HeadingState(DataClassORJSONMixin):
|
|
131
|
+
heading_state: int = 0
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass
|
|
135
|
+
class WorkData(DataClassORJSONMixin):
|
|
136
|
+
path: int = 0
|
|
137
|
+
path_hash: int = 0
|
|
138
|
+
progress: int = 0
|
|
139
|
+
area: int = 0
|
|
140
|
+
bp_info: int = 0
|
|
141
|
+
bp_hash: int = 0
|
|
142
|
+
bp_pos_x: int = 0
|
|
143
|
+
bp_pos_y: int = 0
|
|
144
|
+
real_path_num: int = 0
|
|
145
|
+
path_pos_x: int = 0
|
|
146
|
+
path_pos_y: int = 0
|
|
147
|
+
ub_zone_hash: int = 0
|
|
148
|
+
ub_path_hash: int = 0
|
|
149
|
+
init_cfg_hash: int = 0
|
|
150
|
+
ub_ecode_hash: int = 0
|
|
151
|
+
nav_run_mode: int = 0
|
|
152
|
+
test_mode_status: int = 0
|
|
153
|
+
man_run_speed: int = 0
|
|
154
|
+
nav_edit_status: int = 0
|
|
155
|
+
knife_height: int = 0
|
|
156
|
+
nav_heading_state: HeadingState = field(default_factory=HeadingState)
|
|
157
|
+
cutter_offset: float = 0.0
|
|
158
|
+
cutter_width: float = 0.0
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@dataclass
|
|
162
|
+
class ReportData(DataClassORJSONMixin):
|
|
163
|
+
connect: ConnectData = field(default_factory=ConnectData)
|
|
164
|
+
dev: DeviceData = field(default_factory=DeviceData)
|
|
165
|
+
maintenance: Maintain = field(default_factory=Maintain)
|
|
166
|
+
vision_info: VisionInfo = field(default_factory=VisionInfo)
|
|
167
|
+
rtk: RTKData = field(default_factory=RTKData)
|
|
168
|
+
locations: list[LocationData] = field(default_factory=list)
|
|
169
|
+
work: WorkData = field(default_factory=WorkData)
|
|
170
|
+
|
|
171
|
+
def update(self, data: dict) -> None:
|
|
172
|
+
locations = self.locations
|
|
173
|
+
if data.get("locations") is not None:
|
|
174
|
+
locations = [LocationData.from_dict(loc) for loc in data.get("locations", [])]
|
|
175
|
+
|
|
176
|
+
self.connect = ConnectData.from_dict(data.get("connect", self.connect.to_dict()))
|
|
177
|
+
self.dev = DeviceData.from_dict(data.get("dev", self.dev.to_dict()))
|
|
178
|
+
self.rtk = RTKData.from_dict(data.get("rtk", self.rtk.to_dict()))
|
|
179
|
+
self.maintenance = Maintain.from_dict(data.get("maintain", self.maintenance.to_dict()))
|
|
180
|
+
self.vision_info = VisionInfo.from_dict(data.get("vio_to_app_info", VisionInfo().to_dict()))
|
|
181
|
+
self.locations = locations
|
|
182
|
+
self.work = WorkData.from_dict(data.get("work", self.work.to_dict()))
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""bidire_reqconver_path as a model."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
|
|
5
|
+
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class CurrentTaskSettings(DataClassORJSONMixin):
|
|
10
|
+
pver: int = 0
|
|
11
|
+
job_id: int = 0
|
|
12
|
+
job_ver: int = 0
|
|
13
|
+
job_mode: int = 0
|
|
14
|
+
sub_cmd: int = 0
|
|
15
|
+
edge_mode: int = 0
|
|
16
|
+
knife_height: int = 0
|
|
17
|
+
channel_width: int = 0
|
|
18
|
+
ultra_wave: int = 0
|
|
19
|
+
channel_mode: int = 0
|
|
20
|
+
toward: int = 0
|
|
21
|
+
speed: float = 0.0
|
|
22
|
+
zone_hashs: list[int] = field(default_factory=list)
|
|
23
|
+
path_hash: int = 0
|
|
24
|
+
reserved: str = ""
|
|
25
|
+
result: int = 0
|
|
26
|
+
toward_mode: int = 0
|
|
27
|
+
toward_included_angle: int = 0
|