pymammotion 0.0.37__py3-none-any.whl → 0.0.38__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.
- pymammotion/__init__.py +4 -4
- pymammotion/aliyun/cloud_gateway.py +10 -8
- pymammotion/bluetooth/ble.py +2 -2
- pymammotion/bluetooth/ble_message.py +9 -9
- pymammotion/bluetooth/data/convert.py +3 -2
- pymammotion/data/model/__init__.py +0 -1
- pymammotion/data/model/device.py +8 -8
- pymammotion/data/model/enums.py +67 -67
- pymammotion/data/mqtt/event.py +1 -1
- pymammotion/http/http.py +5 -1
- pymammotion/luba/base.py +2 -2
- pymammotion/mammotion/commands/abstract_message.py +7 -7
- pymammotion/mammotion/commands/mammotion_command.py +6 -6
- pymammotion/mammotion/commands/messages/driver.py +108 -108
- pymammotion/mammotion/commands/messages/media.py +36 -36
- pymammotion/mammotion/commands/messages/navigation.py +535 -535
- pymammotion/mammotion/commands/messages/network.py +236 -236
- pymammotion/mammotion/commands/messages/ota.py +34 -34
- pymammotion/mammotion/commands/messages/system.py +266 -266
- pymammotion/mammotion/commands/messages/video.py +27 -27
- pymammotion/mammotion/control/joystick.py +3 -3
- pymammotion/mammotion/devices/luba.py +4 -6
- pymammotion/mqtt/mqtt.py +7 -7
- pymammotion/proto/common.py +1 -1
- pymammotion/proto/common_pb2.py +3 -3
- pymammotion/proto/dev_net.py +1 -1
- pymammotion/proto/dev_net_pb2.py +3 -3
- pymammotion/proto/luba_msg.proto +7 -7
- pymammotion/proto/luba_msg.py +1 -1
- pymammotion/proto/luba_msg_pb2.py +10 -10
- pymammotion/proto/luba_msg_pb2.pyi +7 -7
- pymammotion/proto/luba_mul.py +1 -1
- pymammotion/proto/luba_mul_pb2.py +3 -3
- pymammotion/proto/mctrl_driver.py +1 -1
- pymammotion/proto/mctrl_driver_pb2.py +3 -3
- pymammotion/proto/mctrl_nav.proto +1 -1
- pymammotion/proto/mctrl_nav.py +1 -1
- pymammotion/proto/mctrl_nav_pb2.py +4 -4
- pymammotion/proto/mctrl_nav_pb2.pyi +1 -1
- pymammotion/proto/mctrl_ota.py +1 -1
- pymammotion/proto/mctrl_ota_pb2.py +3 -3
- pymammotion/proto/mctrl_pept.py +1 -1
- pymammotion/proto/mctrl_pept_pb2.py +3 -3
- pymammotion/proto/mctrl_sys.proto +1 -1
- pymammotion/proto/mctrl_sys.py +1 -1
- pymammotion/proto/mctrl_sys_pb2.py +4 -4
- pymammotion/proto/mctrl_sys_pb2.pyi +1 -1
- pymammotion/utility/device_type.py +152 -152
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.38.dist-info}/METADATA +6 -6
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.38.dist-info}/RECORD +52 -52
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.38.dist-info}/LICENSE +0 -0
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.38.dist-info}/WHEEL +0 -0
|
@@ -1,266 +1,266 @@
|
|
|
1
|
-
# === sendOrderMsg_Sys ===
|
|
2
|
-
import datetime
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class MessageSystem(AbstractMessage):
|
|
13
|
-
messageNavigation: MessageNavigation = MessageNavigation()
|
|
14
|
-
|
|
15
|
-
def send_order_msg_sys(self, sys):
|
|
16
|
-
luba_msg = luba_msg_pb2.LubaMsg(
|
|
17
|
-
msgtype=luba_msg_pb2.MSG_CMD_TYPE_EMBED_SYS,
|
|
18
|
-
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
19
|
-
rcver=luba_msg_pb2.DEV_MAINCTL,
|
|
20
|
-
sys=sys,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
return luba_msg.SerializeToString()
|
|
24
|
-
|
|
25
|
-
def reset_system(self):
|
|
26
|
-
build = mctrl_sys_pb2.MctlSys(todev_reset_system=1)
|
|
27
|
-
print("Send command - send factory reset")
|
|
28
|
-
return self.send_order_msg_sys(build)
|
|
29
|
-
|
|
30
|
-
async def set_blade_control(self, on_off: int):
|
|
31
|
-
mctlsys = mctrl_sys_pb2.MctlSys()
|
|
32
|
-
sysKnifeControl = mctrl_sys_pb2.SysKnifeControl()
|
|
33
|
-
sysKnifeControl.knife_status = on_off
|
|
34
|
-
mctlsys.todev_knife_ctrl.CopyFrom(sysKnifeControl)
|
|
35
|
-
|
|
36
|
-
return self.send_order_msg_sys(mctlsys)
|
|
37
|
-
|
|
38
|
-
def get_device_product_model(self):
|
|
39
|
-
return self.send_order_msg_sys(
|
|
40
|
-
mctrl_sys_pb2.MctlSys(
|
|
41
|
-
device_product_type_info=mctrl_sys_pb2.device_product_type_info_t()
|
|
42
|
-
),
|
|
43
|
-
12,
|
|
44
|
-
True,
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
def read_and_set_sidelight(self, is_sidelight: bool, operate: int):
|
|
48
|
-
if is_sidelight:
|
|
49
|
-
build = mctrl_sys_pb2.TimeCtrlLight(
|
|
50
|
-
operate=operate,
|
|
51
|
-
enable=0,
|
|
52
|
-
action=0,
|
|
53
|
-
start_hour=0,
|
|
54
|
-
start_min=0,
|
|
55
|
-
end_hour=0,
|
|
56
|
-
end_min=0,
|
|
57
|
-
)
|
|
58
|
-
else:
|
|
59
|
-
build = mctrl_sys_pb2.TimeCtrlLight(
|
|
60
|
-
operate=operate,
|
|
61
|
-
enable=1,
|
|
62
|
-
action=0,
|
|
63
|
-
start_hour=0,
|
|
64
|
-
start_min=0,
|
|
65
|
-
end_hour=0,
|
|
66
|
-
end_min=0,
|
|
67
|
-
)
|
|
68
|
-
print(f"Send read and write sidelight command is_sidelight:{
|
|
69
|
-
is_sidelight}, operate:{operate}")
|
|
70
|
-
build2 = mctrl_sys_pb2.MctlSys(todev_time_ctrl_light=build)
|
|
71
|
-
print(f"Send command - send read and write sidelight command is_sidelight:{
|
|
72
|
-
is_sidelight}, operate:{operate}, timeCtrlLight:{build}")
|
|
73
|
-
return self.send_order_msg_sys(build2)
|
|
74
|
-
|
|
75
|
-
def test_tool_order_to_sys(
|
|
76
|
-
self, sub_cmd: int, param_id: int, param_value: List[int]
|
|
77
|
-
):
|
|
78
|
-
build = mctrl_sys_pb2.mCtrlSimulationCmdData(
|
|
79
|
-
sub_cmd=sub_cmd, param_id=param_id, param_value=param_value
|
|
80
|
-
)
|
|
81
|
-
print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
|
|
82
|
-
param_id}, param_value={param_value}")
|
|
83
|
-
build2 = mctrl_sys_pb2.MctlSys(simulation_cmd=build)
|
|
84
|
-
print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
|
|
85
|
-
param_id}, param_value={param_value}")
|
|
86
|
-
return self.send_order_msg_sys(build2)
|
|
87
|
-
|
|
88
|
-
def read_and_set_rt_k_paring_code(self, op: int, cgf: str):
|
|
89
|
-
print(f"Send read and write base station configuration quality op:{
|
|
90
|
-
op}, cgf:{cgf}")
|
|
91
|
-
return self.send_order_msg_sys(
|
|
92
|
-
mctrl_sys_pb2.MctlSys(
|
|
93
|
-
todev_lora_cfg_req=mctrl_sys_pb2.LoraCfgReq(op=op, cfg=cgf)
|
|
94
|
-
)
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
def allpowerfull_rw(self, id: int, context: int, rw: int):
|
|
98
|
-
if (id == 6 or id == 3 or id == 7) and DeviceType.is_luba_2(
|
|
99
|
-
self.get_device_name()
|
|
100
|
-
):
|
|
101
|
-
self.messageNavigation.allpowerfull_rw_adapter_x3(id, context, rw)
|
|
102
|
-
return
|
|
103
|
-
build = mctrl_sys_pb2.MctlSys(
|
|
104
|
-
bidire_comm_cmd=mctrl_sys_pb2.SysCommCmd(id=id, context=context, rw=rw)
|
|
105
|
-
)
|
|
106
|
-
print(
|
|
107
|
-
f"Send command - 9 general read and write command id={id}, context={context}, rw={rw}"
|
|
108
|
-
)
|
|
109
|
-
if id == 5:
|
|
110
|
-
# This logic doesnt make snese, but its what they had so..
|
|
111
|
-
return self.send_order_msg_sys(build)
|
|
112
|
-
return self.send_order_msg_sys(build)
|
|
113
|
-
|
|
114
|
-
# Commented out as not needed and too many refs to try fix up
|
|
115
|
-
# def factory_test_order(self, test_id: int, test_duration: int, expect: str):
|
|
116
|
-
# new_builder = mctrl_sys_pb2.mow_to_app_qctools_info_t.Builder()
|
|
117
|
-
# print(f"Factory tool print, expect={expect}")
|
|
118
|
-
# if not expect:
|
|
119
|
-
# build = new_builder.set_type_value(
|
|
120
|
-
# test_id).set_time_of_duration(test_duration).build()
|
|
121
|
-
# else:
|
|
122
|
-
# try:
|
|
123
|
-
# json_array = json.loads(expect)
|
|
124
|
-
# z2 = True
|
|
125
|
-
# for i in range(len(json_array)):
|
|
126
|
-
# new_builder2 = mctrl_sys_pb2.QCAppTestExcept.Builder()
|
|
127
|
-
# json_object = json_array[i]
|
|
128
|
-
# if "except_type" in json_object:
|
|
129
|
-
# string = json_object["except_type"]
|
|
130
|
-
# if "conditions" in json_object:
|
|
131
|
-
# json_array2 = json_object["conditions"]
|
|
132
|
-
# for i2 in range(len(json_array2)):
|
|
133
|
-
# json_object2 = json_array2[i2]
|
|
134
|
-
# new_builder3 = mctrl_sys_pb2.QCAppTestConditions.Builder()
|
|
135
|
-
# if "cond_type" in json_object2:
|
|
136
|
-
# new_builder3.set_cond_type(
|
|
137
|
-
# json_object2["cond_type"])
|
|
138
|
-
# else:
|
|
139
|
-
# z2 = False
|
|
140
|
-
# if "value" in json_object2:
|
|
141
|
-
# obj = json_object2["value"]
|
|
142
|
-
# if string == "int":
|
|
143
|
-
# new_builder3.set_int_val(int(obj))
|
|
144
|
-
# elif string == "float":
|
|
145
|
-
# new_builder3.set_float_val(float(obj))
|
|
146
|
-
# elif string == "double":
|
|
147
|
-
# new_builder3.set_double_val(float(obj))
|
|
148
|
-
# elif string == "string":
|
|
149
|
-
# new_builder3.set_string_val(str(obj))
|
|
150
|
-
# else:
|
|
151
|
-
# z2 = False
|
|
152
|
-
# new_builder2.add_conditions(new_builder3)
|
|
153
|
-
# else:
|
|
154
|
-
# z2 = False
|
|
155
|
-
# new_builder2.set_except_type(string)
|
|
156
|
-
# new_builder.add_except(new_builder2)
|
|
157
|
-
# new_builder2.clear()
|
|
158
|
-
# z = z2
|
|
159
|
-
# except json.JSONDecodeError:
|
|
160
|
-
# z = False
|
|
161
|
-
# if z:
|
|
162
|
-
# build = new_builder.set_type_value(
|
|
163
|
-
# test_id).set_time_of_duration(test_duration).build()
|
|
164
|
-
# else:
|
|
165
|
-
# build = new_builder.set_type_value(
|
|
166
|
-
# test_id).set_time_of_duration(test_duration).build()
|
|
167
|
-
# print(f"Factory tool print, mow_to_app_qctools_info_t={
|
|
168
|
-
# build.except_count}, mow_to_app_qctools_info_t22={build.except_list}")
|
|
169
|
-
# build2 = mctrl_sys_pb2.MctlSys(mow_to_app_qctools_info=build)
|
|
170
|
-
# print(f"Send command - factory tool test command testId={
|
|
171
|
-
# test_id}, testDuration={test_duration}", "Factory tool print222", True)
|
|
172
|
-
# return self.send_order_msg_sys(build2)
|
|
173
|
-
|
|
174
|
-
def send_sys_set_date_time(self):
|
|
175
|
-
calendar = datetime.now()
|
|
176
|
-
i = calendar.year
|
|
177
|
-
i2 = calendar.month
|
|
178
|
-
i3 = calendar.day
|
|
179
|
-
i4 = calendar.isoweekday()
|
|
180
|
-
i5 = calendar.hour
|
|
181
|
-
i6 = calendar.minute
|
|
182
|
-
i7 = calendar.second
|
|
183
|
-
i8 = calendar.utcoffset().total_seconds() // 60 if calendar.utcoffset() else 0
|
|
184
|
-
i9 = 1 if calendar.dst() else 0
|
|
185
|
-
print(f"Print time zone, time zone={
|
|
186
|
-
i8}, daylight saving time={i9} week={i4}")
|
|
187
|
-
build = mctrl_sys_pb2.MctlSys(
|
|
188
|
-
todev_data_time=mctrl_sys_pb2.SysSetDateTime(
|
|
189
|
-
year=i,
|
|
190
|
-
month=i2,
|
|
191
|
-
date=i3,
|
|
192
|
-
week=i4,
|
|
193
|
-
hours=i5,
|
|
194
|
-
minutes=i6,
|
|
195
|
-
seconds=i7,
|
|
196
|
-
time_zone=i8,
|
|
197
|
-
daylight=i9,
|
|
198
|
-
)
|
|
199
|
-
)
|
|
200
|
-
print(
|
|
201
|
-
f"Send command - synchronize time zone={i8}, daylight saving time={i9} week={i4}, day:{
|
|
202
|
-
i3}, month:{i2}, hours:{i5}, minutes:{i6}, seconds:{i7}, year={i}",
|
|
203
|
-
"Time synchronization",
|
|
204
|
-
True,
|
|
205
|
-
)
|
|
206
|
-
return self.send_order_msg_sys(build)
|
|
207
|
-
|
|
208
|
-
def get_device_version_info(self):
|
|
209
|
-
return self.send_order_msg_sys(mctrl_sys_pb2.MctlSys(todev_get_dev_fw_info=1))
|
|
210
|
-
|
|
211
|
-
# === sendOrderMsg_Sys2 ===
|
|
212
|
-
|
|
213
|
-
def request_iot_sys(
|
|
214
|
-
self,
|
|
215
|
-
rpt_act: mctrl_sys_pb2.rpt_act,
|
|
216
|
-
rpt_info_type: List[RptInfoType | str] | None,
|
|
217
|
-
timeout: int,
|
|
218
|
-
period: int,
|
|
219
|
-
no_change_period: int,
|
|
220
|
-
count: int,
|
|
221
|
-
) -> None:
|
|
222
|
-
build = mctrl_sys_pb2.MctlSys(
|
|
223
|
-
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
224
|
-
act=rpt_act,
|
|
225
|
-
sub=rpt_info_type,
|
|
226
|
-
timeout=timeout,
|
|
227
|
-
period=period,
|
|
228
|
-
no_change_period=no_change_period,
|
|
229
|
-
count=count,
|
|
230
|
-
)
|
|
231
|
-
)
|
|
232
|
-
print(f"Send command==== IOT slim data Act {
|
|
233
|
-
build.todev_report_cfg.act} {build}")
|
|
234
|
-
return self.send_order_msg_sys(build)
|
|
235
|
-
|
|
236
|
-
def get_report_cfg(
|
|
237
|
-
self, timeout: int = 10000, period: int = 1000, no_change_period: int = 2000
|
|
238
|
-
):
|
|
239
|
-
mctlsys = mctrl_sys_pb2.MctlSys(
|
|
240
|
-
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
241
|
-
timeout=timeout,
|
|
242
|
-
period=period,
|
|
243
|
-
no_change_period=no_change_period,
|
|
244
|
-
count=1,
|
|
245
|
-
)
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_CONNECT.value)
|
|
249
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_RTK.value)
|
|
250
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_DEV_LOCAL.value)
|
|
251
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_WORK.value)
|
|
252
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_DEV_STA.value)
|
|
253
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VISION_POINT.value)
|
|
254
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VIO.value)
|
|
255
|
-
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VISION_STATISTIC.value)
|
|
256
|
-
|
|
257
|
-
lubaMsg = luba_msg_pb2.LubaMsg()
|
|
258
|
-
lubaMsg.msgtype = luba_msg_pb2.MSG_CMD_TYPE_EMBED_SYS
|
|
259
|
-
lubaMsg.sender = luba_msg_pb2.DEV_MOBILEAPP
|
|
260
|
-
lubaMsg.rcver = luba_msg_pb2.DEV_MAINCTL
|
|
261
|
-
lubaMsg.msgattr = luba_msg_pb2.MSG_ATTR_REQ
|
|
262
|
-
lubaMsg.seqs = 1
|
|
263
|
-
lubaMsg.version = 1
|
|
264
|
-
lubaMsg.subtype = 1
|
|
265
|
-
lubaMsg.sys.CopyFrom(mctlsys)
|
|
266
|
-
return lubaMsg.SerializeToString()
|
|
1
|
+
# === sendOrderMsg_Sys ===
|
|
2
|
+
import datetime
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from pymammotion.mammotion.commands.abstract_message import AbstractMessage
|
|
6
|
+
from pymammotion.mammotion.commands.messages.navigation import MessageNavigation
|
|
7
|
+
from pymammotion.proto import luba_msg_pb2, mctrl_sys_pb2
|
|
8
|
+
from pymammotion.proto.mctrl_sys import RptInfoType
|
|
9
|
+
from pymammotion.utility.device_type import DeviceType
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageSystem(AbstractMessage):
|
|
13
|
+
messageNavigation: MessageNavigation = MessageNavigation()
|
|
14
|
+
|
|
15
|
+
def send_order_msg_sys(self, sys):
|
|
16
|
+
luba_msg = luba_msg_pb2.LubaMsg(
|
|
17
|
+
msgtype=luba_msg_pb2.MSG_CMD_TYPE_EMBED_SYS,
|
|
18
|
+
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
19
|
+
rcver=luba_msg_pb2.DEV_MAINCTL,
|
|
20
|
+
sys=sys,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
return luba_msg.SerializeToString()
|
|
24
|
+
|
|
25
|
+
def reset_system(self):
|
|
26
|
+
build = mctrl_sys_pb2.MctlSys(todev_reset_system=1)
|
|
27
|
+
print("Send command - send factory reset")
|
|
28
|
+
return self.send_order_msg_sys(build)
|
|
29
|
+
|
|
30
|
+
async def set_blade_control(self, on_off: int):
|
|
31
|
+
mctlsys = mctrl_sys_pb2.MctlSys()
|
|
32
|
+
sysKnifeControl = mctrl_sys_pb2.SysKnifeControl()
|
|
33
|
+
sysKnifeControl.knife_status = on_off
|
|
34
|
+
mctlsys.todev_knife_ctrl.CopyFrom(sysKnifeControl)
|
|
35
|
+
|
|
36
|
+
return self.send_order_msg_sys(mctlsys)
|
|
37
|
+
|
|
38
|
+
def get_device_product_model(self):
|
|
39
|
+
return self.send_order_msg_sys(
|
|
40
|
+
mctrl_sys_pb2.MctlSys(
|
|
41
|
+
device_product_type_info=mctrl_sys_pb2.device_product_type_info_t()
|
|
42
|
+
),
|
|
43
|
+
12,
|
|
44
|
+
True,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def read_and_set_sidelight(self, is_sidelight: bool, operate: int):
|
|
48
|
+
if is_sidelight:
|
|
49
|
+
build = mctrl_sys_pb2.TimeCtrlLight(
|
|
50
|
+
operate=operate,
|
|
51
|
+
enable=0,
|
|
52
|
+
action=0,
|
|
53
|
+
start_hour=0,
|
|
54
|
+
start_min=0,
|
|
55
|
+
end_hour=0,
|
|
56
|
+
end_min=0,
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
build = mctrl_sys_pb2.TimeCtrlLight(
|
|
60
|
+
operate=operate,
|
|
61
|
+
enable=1,
|
|
62
|
+
action=0,
|
|
63
|
+
start_hour=0,
|
|
64
|
+
start_min=0,
|
|
65
|
+
end_hour=0,
|
|
66
|
+
end_min=0,
|
|
67
|
+
)
|
|
68
|
+
print(f"Send read and write sidelight command is_sidelight:{
|
|
69
|
+
is_sidelight}, operate:{operate}")
|
|
70
|
+
build2 = mctrl_sys_pb2.MctlSys(todev_time_ctrl_light=build)
|
|
71
|
+
print(f"Send command - send read and write sidelight command is_sidelight:{
|
|
72
|
+
is_sidelight}, operate:{operate}, timeCtrlLight:{build}")
|
|
73
|
+
return self.send_order_msg_sys(build2)
|
|
74
|
+
|
|
75
|
+
def test_tool_order_to_sys(
|
|
76
|
+
self, sub_cmd: int, param_id: int, param_value: List[int]
|
|
77
|
+
):
|
|
78
|
+
build = mctrl_sys_pb2.mCtrlSimulationCmdData(
|
|
79
|
+
sub_cmd=sub_cmd, param_id=param_id, param_value=param_value
|
|
80
|
+
)
|
|
81
|
+
print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
|
|
82
|
+
param_id}, param_value={param_value}")
|
|
83
|
+
build2 = mctrl_sys_pb2.MctlSys(simulation_cmd=build)
|
|
84
|
+
print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
|
|
85
|
+
param_id}, param_value={param_value}")
|
|
86
|
+
return self.send_order_msg_sys(build2)
|
|
87
|
+
|
|
88
|
+
def read_and_set_rt_k_paring_code(self, op: int, cgf: str):
|
|
89
|
+
print(f"Send read and write base station configuration quality op:{
|
|
90
|
+
op}, cgf:{cgf}")
|
|
91
|
+
return self.send_order_msg_sys(
|
|
92
|
+
mctrl_sys_pb2.MctlSys(
|
|
93
|
+
todev_lora_cfg_req=mctrl_sys_pb2.LoraCfgReq(op=op, cfg=cgf)
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def allpowerfull_rw(self, id: int, context: int, rw: int):
|
|
98
|
+
if (id == 6 or id == 3 or id == 7) and DeviceType.is_luba_2(
|
|
99
|
+
self.get_device_name()
|
|
100
|
+
):
|
|
101
|
+
self.messageNavigation.allpowerfull_rw_adapter_x3(id, context, rw)
|
|
102
|
+
return
|
|
103
|
+
build = mctrl_sys_pb2.MctlSys(
|
|
104
|
+
bidire_comm_cmd=mctrl_sys_pb2.SysCommCmd(id=id, context=context, rw=rw)
|
|
105
|
+
)
|
|
106
|
+
print(
|
|
107
|
+
f"Send command - 9 general read and write command id={id}, context={context}, rw={rw}"
|
|
108
|
+
)
|
|
109
|
+
if id == 5:
|
|
110
|
+
# This logic doesnt make snese, but its what they had so..
|
|
111
|
+
return self.send_order_msg_sys(build)
|
|
112
|
+
return self.send_order_msg_sys(build)
|
|
113
|
+
|
|
114
|
+
# Commented out as not needed and too many refs to try fix up
|
|
115
|
+
# def factory_test_order(self, test_id: int, test_duration: int, expect: str):
|
|
116
|
+
# new_builder = mctrl_sys_pb2.mow_to_app_qctools_info_t.Builder()
|
|
117
|
+
# print(f"Factory tool print, expect={expect}")
|
|
118
|
+
# if not expect:
|
|
119
|
+
# build = new_builder.set_type_value(
|
|
120
|
+
# test_id).set_time_of_duration(test_duration).build()
|
|
121
|
+
# else:
|
|
122
|
+
# try:
|
|
123
|
+
# json_array = json.loads(expect)
|
|
124
|
+
# z2 = True
|
|
125
|
+
# for i in range(len(json_array)):
|
|
126
|
+
# new_builder2 = mctrl_sys_pb2.QCAppTestExcept.Builder()
|
|
127
|
+
# json_object = json_array[i]
|
|
128
|
+
# if "except_type" in json_object:
|
|
129
|
+
# string = json_object["except_type"]
|
|
130
|
+
# if "conditions" in json_object:
|
|
131
|
+
# json_array2 = json_object["conditions"]
|
|
132
|
+
# for i2 in range(len(json_array2)):
|
|
133
|
+
# json_object2 = json_array2[i2]
|
|
134
|
+
# new_builder3 = mctrl_sys_pb2.QCAppTestConditions.Builder()
|
|
135
|
+
# if "cond_type" in json_object2:
|
|
136
|
+
# new_builder3.set_cond_type(
|
|
137
|
+
# json_object2["cond_type"])
|
|
138
|
+
# else:
|
|
139
|
+
# z2 = False
|
|
140
|
+
# if "value" in json_object2:
|
|
141
|
+
# obj = json_object2["value"]
|
|
142
|
+
# if string == "int":
|
|
143
|
+
# new_builder3.set_int_val(int(obj))
|
|
144
|
+
# elif string == "float":
|
|
145
|
+
# new_builder3.set_float_val(float(obj))
|
|
146
|
+
# elif string == "double":
|
|
147
|
+
# new_builder3.set_double_val(float(obj))
|
|
148
|
+
# elif string == "string":
|
|
149
|
+
# new_builder3.set_string_val(str(obj))
|
|
150
|
+
# else:
|
|
151
|
+
# z2 = False
|
|
152
|
+
# new_builder2.add_conditions(new_builder3)
|
|
153
|
+
# else:
|
|
154
|
+
# z2 = False
|
|
155
|
+
# new_builder2.set_except_type(string)
|
|
156
|
+
# new_builder.add_except(new_builder2)
|
|
157
|
+
# new_builder2.clear()
|
|
158
|
+
# z = z2
|
|
159
|
+
# except json.JSONDecodeError:
|
|
160
|
+
# z = False
|
|
161
|
+
# if z:
|
|
162
|
+
# build = new_builder.set_type_value(
|
|
163
|
+
# test_id).set_time_of_duration(test_duration).build()
|
|
164
|
+
# else:
|
|
165
|
+
# build = new_builder.set_type_value(
|
|
166
|
+
# test_id).set_time_of_duration(test_duration).build()
|
|
167
|
+
# print(f"Factory tool print, mow_to_app_qctools_info_t={
|
|
168
|
+
# build.except_count}, mow_to_app_qctools_info_t22={build.except_list}")
|
|
169
|
+
# build2 = mctrl_sys_pb2.MctlSys(mow_to_app_qctools_info=build)
|
|
170
|
+
# print(f"Send command - factory tool test command testId={
|
|
171
|
+
# test_id}, testDuration={test_duration}", "Factory tool print222", True)
|
|
172
|
+
# return self.send_order_msg_sys(build2)
|
|
173
|
+
|
|
174
|
+
def send_sys_set_date_time(self):
|
|
175
|
+
calendar = datetime.now()
|
|
176
|
+
i = calendar.year
|
|
177
|
+
i2 = calendar.month
|
|
178
|
+
i3 = calendar.day
|
|
179
|
+
i4 = calendar.isoweekday()
|
|
180
|
+
i5 = calendar.hour
|
|
181
|
+
i6 = calendar.minute
|
|
182
|
+
i7 = calendar.second
|
|
183
|
+
i8 = calendar.utcoffset().total_seconds() // 60 if calendar.utcoffset() else 0
|
|
184
|
+
i9 = 1 if calendar.dst() else 0
|
|
185
|
+
print(f"Print time zone, time zone={
|
|
186
|
+
i8}, daylight saving time={i9} week={i4}")
|
|
187
|
+
build = mctrl_sys_pb2.MctlSys(
|
|
188
|
+
todev_data_time=mctrl_sys_pb2.SysSetDateTime(
|
|
189
|
+
year=i,
|
|
190
|
+
month=i2,
|
|
191
|
+
date=i3,
|
|
192
|
+
week=i4,
|
|
193
|
+
hours=i5,
|
|
194
|
+
minutes=i6,
|
|
195
|
+
seconds=i7,
|
|
196
|
+
time_zone=i8,
|
|
197
|
+
daylight=i9,
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
print(
|
|
201
|
+
f"Send command - synchronize time zone={i8}, daylight saving time={i9} week={i4}, day:{
|
|
202
|
+
i3}, month:{i2}, hours:{i5}, minutes:{i6}, seconds:{i7}, year={i}",
|
|
203
|
+
"Time synchronization",
|
|
204
|
+
True,
|
|
205
|
+
)
|
|
206
|
+
return self.send_order_msg_sys(build)
|
|
207
|
+
|
|
208
|
+
def get_device_version_info(self):
|
|
209
|
+
return self.send_order_msg_sys(mctrl_sys_pb2.MctlSys(todev_get_dev_fw_info=1))
|
|
210
|
+
|
|
211
|
+
# === sendOrderMsg_Sys2 ===
|
|
212
|
+
|
|
213
|
+
def request_iot_sys(
|
|
214
|
+
self,
|
|
215
|
+
rpt_act: mctrl_sys_pb2.rpt_act,
|
|
216
|
+
rpt_info_type: List[RptInfoType | str] | None,
|
|
217
|
+
timeout: int,
|
|
218
|
+
period: int,
|
|
219
|
+
no_change_period: int,
|
|
220
|
+
count: int,
|
|
221
|
+
) -> None:
|
|
222
|
+
build = mctrl_sys_pb2.MctlSys(
|
|
223
|
+
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
224
|
+
act=rpt_act,
|
|
225
|
+
sub=rpt_info_type,
|
|
226
|
+
timeout=timeout,
|
|
227
|
+
period=period,
|
|
228
|
+
no_change_period=no_change_period,
|
|
229
|
+
count=count,
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
print(f"Send command==== IOT slim data Act {
|
|
233
|
+
build.todev_report_cfg.act} {build}")
|
|
234
|
+
return self.send_order_msg_sys(build)
|
|
235
|
+
|
|
236
|
+
def get_report_cfg(
|
|
237
|
+
self, timeout: int = 10000, period: int = 1000, no_change_period: int = 2000
|
|
238
|
+
):
|
|
239
|
+
mctlsys = mctrl_sys_pb2.MctlSys(
|
|
240
|
+
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
241
|
+
timeout=timeout,
|
|
242
|
+
period=period,
|
|
243
|
+
no_change_period=no_change_period,
|
|
244
|
+
count=1,
|
|
245
|
+
)
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_CONNECT.value)
|
|
249
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_RTK.value)
|
|
250
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_DEV_LOCAL.value)
|
|
251
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_WORK.value)
|
|
252
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_DEV_STA.value)
|
|
253
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VISION_POINT.value)
|
|
254
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VIO.value)
|
|
255
|
+
mctlsys.todev_report_cfg.sub.append(RptInfoType.RIT_VISION_STATISTIC.value)
|
|
256
|
+
|
|
257
|
+
lubaMsg = luba_msg_pb2.LubaMsg()
|
|
258
|
+
lubaMsg.msgtype = luba_msg_pb2.MSG_CMD_TYPE_EMBED_SYS
|
|
259
|
+
lubaMsg.sender = luba_msg_pb2.DEV_MOBILEAPP
|
|
260
|
+
lubaMsg.rcver = luba_msg_pb2.DEV_MAINCTL
|
|
261
|
+
lubaMsg.msgattr = luba_msg_pb2.MSG_ATTR_REQ
|
|
262
|
+
lubaMsg.seqs = 1
|
|
263
|
+
lubaMsg.version = 1
|
|
264
|
+
lubaMsg.subtype = 1
|
|
265
|
+
lubaMsg.sys.CopyFrom(mctlsys)
|
|
266
|
+
return lubaMsg.SerializeToString()
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# === sendOrderMsg_Video ===
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class MessageVideo(AbstractMessage):
|
|
8
|
-
async def send_order_msg_video(self, mul):
|
|
9
|
-
luba_msg = luba_msg_pb2.LubaMsg(
|
|
10
|
-
msgtype=luba_msg_pb2.MSG_CMD_TYPE_MUL,
|
|
11
|
-
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
12
|
-
rcver=luba_msg_pb2.SOC_MODULE_MULTIMEDIA,
|
|
13
|
-
mul=mul,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
return luba_msg.SerializeToString()
|
|
17
|
-
|
|
18
|
-
def device_agora_join_channel_with_position(self, enter_state: int):
|
|
19
|
-
position = (
|
|
20
|
-
luba_mul_pb2.MUL_CAMERA_POSITION.ALL
|
|
21
|
-
if DeviceType.is_yuka(self.get_device_name())
|
|
22
|
-
else luba_mul_pb2.MUL_CAMERA_POSITION.LEFT
|
|
23
|
-
)
|
|
24
|
-
mctl_sys = luba_mul_pb2.SocMul(
|
|
25
|
-
set_video=luba_mul_pb2.MulSetVideo(position=position, vi_switch=enter_state)
|
|
26
|
-
)
|
|
27
|
-
return self.send_order_msg_video(mctl_sys)
|
|
1
|
+
# === sendOrderMsg_Video ===
|
|
2
|
+
from pymammotion.mammotion.commands.abstract_message import AbstractMessage
|
|
3
|
+
from pymammotion.proto import luba_msg_pb2, luba_mul_pb2
|
|
4
|
+
from pymammotion.utility.device_type import DeviceType
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MessageVideo(AbstractMessage):
|
|
8
|
+
async def send_order_msg_video(self, mul):
|
|
9
|
+
luba_msg = luba_msg_pb2.LubaMsg(
|
|
10
|
+
msgtype=luba_msg_pb2.MSG_CMD_TYPE_MUL,
|
|
11
|
+
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
12
|
+
rcver=luba_msg_pb2.SOC_MODULE_MULTIMEDIA,
|
|
13
|
+
mul=mul,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
return luba_msg.SerializeToString()
|
|
17
|
+
|
|
18
|
+
def device_agora_join_channel_with_position(self, enter_state: int):
|
|
19
|
+
position = (
|
|
20
|
+
luba_mul_pb2.MUL_CAMERA_POSITION.ALL
|
|
21
|
+
if DeviceType.is_yuka(self.get_device_name())
|
|
22
|
+
else luba_mul_pb2.MUL_CAMERA_POSITION.LEFT
|
|
23
|
+
)
|
|
24
|
+
mctl_sys = luba_mul_pb2.SocMul(
|
|
25
|
+
set_video=luba_mul_pb2.MulSetVideo(position=position, vi_switch=enter_state)
|
|
26
|
+
)
|
|
27
|
+
return self.send_order_msg_video(mctl_sys)
|
|
@@ -6,9 +6,9 @@ import pyjoystick
|
|
|
6
6
|
from pyjoystick.sdl2 import Key, run_event_loop
|
|
7
7
|
from pyjoystick.utils import PeriodicThread
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
9
|
+
from pymammotion import MammotionBaseBLEDevice
|
|
10
|
+
from pymammotion.event import BleNotificationEvent
|
|
11
|
+
from pymammotion.utility.rocker_util import RockerControlUtil
|
|
12
12
|
|
|
13
13
|
bleNotificationEvt = BleNotificationEvent()
|
|
14
14
|
|
|
@@ -20,11 +20,10 @@ from bleak_retry_connector import (
|
|
|
20
20
|
establish_connection,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from pyluba.proto.luba_msg import LubaMsg
|
|
23
|
+
from pymammotion.bluetooth import BleMessage
|
|
24
|
+
from pymammotion.data.model.device import MowingDevice
|
|
25
|
+
from pymammotion.mammotion.commands.mammotion_command import MammotionCommand
|
|
26
|
+
from pymammotion.proto.luba_msg import LubaMsg
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
class CharacteristicMissingError(Exception):
|
|
@@ -191,7 +190,6 @@ class MammotionBaseDevice:
|
|
|
191
190
|
await self._send_command("get_report_cfg", retry)
|
|
192
191
|
await self._send_command_with_args("read_plan", sub_cmd=2, plan_index=0)
|
|
193
192
|
|
|
194
|
-
|
|
195
193
|
RW = await self._send_command_with_args(
|
|
196
194
|
"allpowerfull_rw", id=5, context=1, rw=1
|
|
197
195
|
)
|
pymammotion/mqtt/mqtt.py
CHANGED
|
@@ -8,13 +8,13 @@ from typing import Callable, Optional, cast
|
|
|
8
8
|
from linkkit.linkkit import LinkKit
|
|
9
9
|
from paho.mqtt.client import Client, MQTTMessage, MQTTv311, connack_string
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
11
|
+
from pymammotion.data.model import RapidState
|
|
12
|
+
from pymammotion.data.mqtt.event import ThingEventMessage
|
|
13
|
+
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
|
|
14
|
+
from pymammotion.data.mqtt.status import ThingStatusMessage
|
|
15
|
+
from pymammotion.luba.base import BaseLuba
|
|
16
|
+
from pymammotion.mammotion.commands.mammotion_command import MammotionCommand
|
|
17
|
+
from pymammotion.proto import luba_msg_pb2
|
|
18
18
|
|
|
19
19
|
logger = getLogger(__name__)
|
|
20
20
|
|
pymammotion/proto/common.py
CHANGED