pymammotion 0.0.37__py3-none-any.whl → 0.0.39__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.39.dist-info}/METADATA +7 -7
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.39.dist-info}/RECORD +52 -52
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.39.dist-info}/LICENSE +0 -0
- {pymammotion-0.0.37.dist-info → pymammotion-0.0.39.dist-info}/WHEEL +0 -0
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
# === sendOrderMsg_Net ===
|
|
2
|
-
import json
|
|
3
|
-
import time
|
|
4
|
-
from typing import Dict
|
|
5
|
-
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class MessageNetwork:
|
|
12
|
-
messageNavigation: MessageNavigation = MessageNavigation()
|
|
13
|
-
|
|
14
|
-
@staticmethod
|
|
15
|
-
def send_order_msg_net(build):
|
|
16
|
-
luba_msg = luba_msg_pb2.LubaMsg(
|
|
17
|
-
msgtype=luba_msg_pb2.MSG_CMD_TYPE_ESP,
|
|
18
|
-
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
19
|
-
rcver=luba_msg_pb2.DEV_COMM_ESP,
|
|
20
|
-
msgattr=luba_msg_pb2.MSG_ATTR_REQ,
|
|
21
|
-
seqs=1,
|
|
22
|
-
version=1,
|
|
23
|
-
subtype=1,
|
|
24
|
-
net=build,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
return luba_msg.SerializeToString()
|
|
28
|
-
|
|
29
|
-
def get_device_base_info(self):
|
|
30
|
-
net = dev_net_pb2.DevNet(todev_devinfo_req=dev_net_pb2.DrvDevInfoReq())
|
|
31
|
-
net.todev_devinfo_req.req_ids.add(id=1, type=6)
|
|
32
|
-
|
|
33
|
-
return self.send_order_msg_net(net)
|
|
34
|
-
|
|
35
|
-
def get_4g_module_info(self):
|
|
36
|
-
build = dev_net_pb2.DevNet(
|
|
37
|
-
todev_get_mnet_cfg_req=dev_net_pb2.DevNet().todev_get_mnet_cfg_req
|
|
38
|
-
)
|
|
39
|
-
print("Send command -- Get device 4G network module information")
|
|
40
|
-
return self.send_order_msg_net(build)
|
|
41
|
-
|
|
42
|
-
def get_4g_info(self):
|
|
43
|
-
build = dev_net_pb2.DevNet(
|
|
44
|
-
todev_mnet_info_req=dev_net_pb2.DevNet().todev_mnet_info_req
|
|
45
|
-
)
|
|
46
|
-
print("Send command -- Get device 4G network information")
|
|
47
|
-
return self.send_order_msg_net(build)
|
|
48
|
-
|
|
49
|
-
def set_zmq_enable(self):
|
|
50
|
-
build = dev_net_pb2.DevNet(
|
|
51
|
-
todev_set_dds2zmq=dev_net_pb2.DrvDebugDdsZmq(
|
|
52
|
-
is_enable=True,
|
|
53
|
-
rx_topic_name="perception_post_result",
|
|
54
|
-
tx_zmq_url="tcp://0.0.0.0:5555",
|
|
55
|
-
)
|
|
56
|
-
)
|
|
57
|
-
print("Send command -- Set vision ZMQ to enable")
|
|
58
|
-
return self.send_order_msg_net(build)
|
|
59
|
-
|
|
60
|
-
def set_iot_setting(self, iot_control_type: dev_net_pb2.iot_conctrl_type):
|
|
61
|
-
build = dev_net_pb2.DevNet(todev_set_iot_offline_req=iot_control_type)
|
|
62
|
-
print("Send command -- Device re-online")
|
|
63
|
-
return self.send_order_msg_net(build)
|
|
64
|
-
|
|
65
|
-
def set_device_log_upload(
|
|
66
|
-
self,
|
|
67
|
-
request_id: str,
|
|
68
|
-
operation: int,
|
|
69
|
-
server_ip: int,
|
|
70
|
-
server_port: int,
|
|
71
|
-
number: int,
|
|
72
|
-
type: int,
|
|
73
|
-
):
|
|
74
|
-
build = dev_net_pb2.DrvUploadFileToAppReq(
|
|
75
|
-
bizId=request_id,
|
|
76
|
-
operation=operation,
|
|
77
|
-
serverIp=server_ip,
|
|
78
|
-
serverPort=server_port,
|
|
79
|
-
num=number,
|
|
80
|
-
type=type,
|
|
81
|
-
)
|
|
82
|
-
print(
|
|
83
|
-
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
84
|
-
)
|
|
85
|
-
return self.send_order_msg_net(
|
|
86
|
-
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
def set_device_socket_request(
|
|
90
|
-
self,
|
|
91
|
-
request_id: str,
|
|
92
|
-
operation: int,
|
|
93
|
-
server_ip: int,
|
|
94
|
-
server_port: int,
|
|
95
|
-
number: int,
|
|
96
|
-
type: int,
|
|
97
|
-
) -> bytes:
|
|
98
|
-
"""Set device socket request (bluetooth only)."""
|
|
99
|
-
build = dev_net_pb2.DrvUploadFileToAppReq(
|
|
100
|
-
bizId=request_id,
|
|
101
|
-
operation=operation,
|
|
102
|
-
serverIp=server_ip,
|
|
103
|
-
serverPort=server_port,
|
|
104
|
-
num=number,
|
|
105
|
-
type=type,
|
|
106
|
-
)
|
|
107
|
-
print(
|
|
108
|
-
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
109
|
-
)
|
|
110
|
-
return self.send_order_msg_net(
|
|
111
|
-
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
def get_device_log_info(self, biz_id: str, type: int, log_url: str) -> bytes:
|
|
115
|
-
"""Get device log info (bluetooth only)."""
|
|
116
|
-
return self.send_order_msg_net(
|
|
117
|
-
dev_net_pb2.DevNet(
|
|
118
|
-
todev_ble_sync=1,
|
|
119
|
-
todev_req_log_info=dev_net_pb2.DrvUploadFileReq(
|
|
120
|
-
bizId=biz_id,
|
|
121
|
-
type=type,
|
|
122
|
-
url=log_url,
|
|
123
|
-
num=0,
|
|
124
|
-
userId="", # TODO supply user id
|
|
125
|
-
),
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
def cancel_log_update(self, biz_id: str):
|
|
130
|
-
"""Cancel log update (bluetooth only)."""
|
|
131
|
-
return self.send_order_msg_net(
|
|
132
|
-
dev_net_pb2.DevNet(
|
|
133
|
-
todev_log_data_cancel=dev_net_pb2.DrvUploadFileCancel(bizId=biz_id)
|
|
134
|
-
)
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
def get_device_network_info(self):
|
|
138
|
-
build = dev_net_pb2.DevNet(
|
|
139
|
-
todev_networkinfo_req=dev_net_pb2.GetNetworkInfoReq(req_ids=1)
|
|
140
|
-
)
|
|
141
|
-
print("Send command - get device network information")
|
|
142
|
-
return self.send_order_msg_net(build)
|
|
143
|
-
|
|
144
|
-
def set_device_4g_enable_status(self, new_4g_status: bool):
|
|
145
|
-
build = dev_net_pb2.DevNet(
|
|
146
|
-
todev_ble_sync=1,
|
|
147
|
-
todev_set_mnet_cfg_req=dev_net_pb2.SetMnetCfgReq(
|
|
148
|
-
cfg=dev_net_pb2.MnetCfg(
|
|
149
|
-
type=dev_net_pb2.NET_TYPE_WIFI,
|
|
150
|
-
inet_enable=new_4g_status,
|
|
151
|
-
mnet_enable=new_4g_status,
|
|
152
|
-
)
|
|
153
|
-
),
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
print(f"Send command - set 4G (on/off status). newWifiStatus={new_4g_status}")
|
|
157
|
-
return self.send_order_msg_net(build)
|
|
158
|
-
|
|
159
|
-
def set_device_wifi_enable_status(self, new_wifi_status: bool):
|
|
160
|
-
build = dev_net_pb2.DevNet(
|
|
161
|
-
todev_ble_sync=1,
|
|
162
|
-
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
163
|
-
configParam=4, wifi_enable=new_wifi_status
|
|
164
|
-
),
|
|
165
|
-
)
|
|
166
|
-
print(
|
|
167
|
-
f"szNetwork: Send command - set network (on/off status). newWifiStatus={new_wifi_status}"
|
|
168
|
-
)
|
|
169
|
-
return self.send_order_msg_net(build)
|
|
170
|
-
|
|
171
|
-
def wifi_connectinfo_update(self, device_name: str, is_binary: bool):
|
|
172
|
-
print(
|
|
173
|
-
f"Send command - get Wifi connection information.wifiConnectinfoUpdate().deviceName={device_name}.isBinary={is_binary}"
|
|
174
|
-
)
|
|
175
|
-
if is_binary:
|
|
176
|
-
build = dev_net_pb2.DevNet(
|
|
177
|
-
todev_ble_sync=1,
|
|
178
|
-
todev_WifiMsgUpload=dev_net_pb2.DrvWifiUpload(Wifi_Msg_Upload=1),
|
|
179
|
-
)
|
|
180
|
-
print("Send command - get Wifi connection information")
|
|
181
|
-
return self.send_order_msg_net(build)
|
|
182
|
-
self.wifi_connectinfo_update2()
|
|
183
|
-
|
|
184
|
-
def wifi_connectinfo_update2(self):
|
|
185
|
-
hash_map = {"getMsgCmd": 1}
|
|
186
|
-
# self.post_custom_data(self.get_json_string(
|
|
187
|
-
# 68, hash_map)) # ToDo: Fix this
|
|
188
|
-
|
|
189
|
-
def get_record_wifi_list(self, is_binary: bool):
|
|
190
|
-
print(f"getRecordWifiList().isBinary={is_binary}")
|
|
191
|
-
if is_binary:
|
|
192
|
-
build = dev_net_pb2.DevNet(
|
|
193
|
-
todev_ble_sync=1, todev_WifiListUpload=dev_net_pb2.DrvWifiList()
|
|
194
|
-
)
|
|
195
|
-
print("Send command - get memorized WiFi list upload command")
|
|
196
|
-
return self.send_order_msg_net(build)
|
|
197
|
-
self.get_record_wifi_list2()
|
|
198
|
-
|
|
199
|
-
def get_record_wifi_list2(self):
|
|
200
|
-
pass
|
|
201
|
-
# self.messageNavigation.post_custom_data(
|
|
202
|
-
# self.get_json_string(69)) # ToDo: Fix this
|
|
203
|
-
|
|
204
|
-
def close_clear_connect_current_wifi(self, ssid: str, status: int, is_binary: bool):
|
|
205
|
-
if is_binary:
|
|
206
|
-
build = dev_net_pb2.DevNet(
|
|
207
|
-
todev_ble_sync=1,
|
|
208
|
-
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
209
|
-
configParam=status, Confssid=ssid
|
|
210
|
-
),
|
|
211
|
-
)
|
|
212
|
-
print(
|
|
213
|
-
f"Send command - set network (disconnect, direct connect, forget, no operation reconnect) operation command (downlink ssid={ssid}, status={status})"
|
|
214
|
-
)
|
|
215
|
-
return self.send_order_msg_net(build)
|
|
216
|
-
self.close_clear_connect_current_wifi2(ssid, status)
|
|
217
|
-
|
|
218
|
-
def close_clear_connect_current_wifi2(self, ssid: str, get_msg_cmd: int):
|
|
219
|
-
data = {"ssid": ssid, "getMsgCmd": get_msg_cmd}
|
|
220
|
-
# self.messageNavigation.post_custom_data(
|
|
221
|
-
# ToDo: Fix this
|
|
222
|
-
# self.get_json_string(bleOrderCmd.close_clear_connect_current_wifi, data).encode())
|
|
223
|
-
|
|
224
|
-
def get_json_string(self, cmd: int, hash_map: Dict[str, object]) -> str:
|
|
225
|
-
jSONObject = {}
|
|
226
|
-
try:
|
|
227
|
-
jSONObject["cmd"] = cmd
|
|
228
|
-
jSONObject[tmp_constant.REQUEST_ID] = int(time.time())
|
|
229
|
-
jSONObject2 = {}
|
|
230
|
-
for key, value in hash_map.items():
|
|
231
|
-
jSONObject2[key] = value
|
|
232
|
-
jSONObject["params"] = jSONObject2
|
|
233
|
-
return json.dumps(jSONObject)
|
|
234
|
-
except Exception as e:
|
|
235
|
-
print(e)
|
|
236
|
-
return ""
|
|
1
|
+
# === sendOrderMsg_Net ===
|
|
2
|
+
import json
|
|
3
|
+
import time
|
|
4
|
+
from typing import Dict
|
|
5
|
+
|
|
6
|
+
from pymammotion.aliyun.tmp_constant import tmp_constant
|
|
7
|
+
from pymammotion.mammotion.commands.messages.navigation import MessageNavigation
|
|
8
|
+
from pymammotion.proto import dev_net_pb2, luba_msg_pb2
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessageNetwork:
|
|
12
|
+
messageNavigation: MessageNavigation = MessageNavigation()
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def send_order_msg_net(build):
|
|
16
|
+
luba_msg = luba_msg_pb2.LubaMsg(
|
|
17
|
+
msgtype=luba_msg_pb2.MSG_CMD_TYPE_ESP,
|
|
18
|
+
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
19
|
+
rcver=luba_msg_pb2.DEV_COMM_ESP,
|
|
20
|
+
msgattr=luba_msg_pb2.MSG_ATTR_REQ,
|
|
21
|
+
seqs=1,
|
|
22
|
+
version=1,
|
|
23
|
+
subtype=1,
|
|
24
|
+
net=build,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
return luba_msg.SerializeToString()
|
|
28
|
+
|
|
29
|
+
def get_device_base_info(self):
|
|
30
|
+
net = dev_net_pb2.DevNet(todev_devinfo_req=dev_net_pb2.DrvDevInfoReq())
|
|
31
|
+
net.todev_devinfo_req.req_ids.add(id=1, type=6)
|
|
32
|
+
|
|
33
|
+
return self.send_order_msg_net(net)
|
|
34
|
+
|
|
35
|
+
def get_4g_module_info(self):
|
|
36
|
+
build = dev_net_pb2.DevNet(
|
|
37
|
+
todev_get_mnet_cfg_req=dev_net_pb2.DevNet().todev_get_mnet_cfg_req
|
|
38
|
+
)
|
|
39
|
+
print("Send command -- Get device 4G network module information")
|
|
40
|
+
return self.send_order_msg_net(build)
|
|
41
|
+
|
|
42
|
+
def get_4g_info(self):
|
|
43
|
+
build = dev_net_pb2.DevNet(
|
|
44
|
+
todev_mnet_info_req=dev_net_pb2.DevNet().todev_mnet_info_req
|
|
45
|
+
)
|
|
46
|
+
print("Send command -- Get device 4G network information")
|
|
47
|
+
return self.send_order_msg_net(build)
|
|
48
|
+
|
|
49
|
+
def set_zmq_enable(self):
|
|
50
|
+
build = dev_net_pb2.DevNet(
|
|
51
|
+
todev_set_dds2zmq=dev_net_pb2.DrvDebugDdsZmq(
|
|
52
|
+
is_enable=True,
|
|
53
|
+
rx_topic_name="perception_post_result",
|
|
54
|
+
tx_zmq_url="tcp://0.0.0.0:5555",
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
print("Send command -- Set vision ZMQ to enable")
|
|
58
|
+
return self.send_order_msg_net(build)
|
|
59
|
+
|
|
60
|
+
def set_iot_setting(self, iot_control_type: dev_net_pb2.iot_conctrl_type):
|
|
61
|
+
build = dev_net_pb2.DevNet(todev_set_iot_offline_req=iot_control_type)
|
|
62
|
+
print("Send command -- Device re-online")
|
|
63
|
+
return self.send_order_msg_net(build)
|
|
64
|
+
|
|
65
|
+
def set_device_log_upload(
|
|
66
|
+
self,
|
|
67
|
+
request_id: str,
|
|
68
|
+
operation: int,
|
|
69
|
+
server_ip: int,
|
|
70
|
+
server_port: int,
|
|
71
|
+
number: int,
|
|
72
|
+
type: int,
|
|
73
|
+
):
|
|
74
|
+
build = dev_net_pb2.DrvUploadFileToAppReq(
|
|
75
|
+
bizId=request_id,
|
|
76
|
+
operation=operation,
|
|
77
|
+
serverIp=server_ip,
|
|
78
|
+
serverPort=server_port,
|
|
79
|
+
num=number,
|
|
80
|
+
type=type,
|
|
81
|
+
)
|
|
82
|
+
print(
|
|
83
|
+
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
84
|
+
)
|
|
85
|
+
return self.send_order_msg_net(
|
|
86
|
+
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def set_device_socket_request(
|
|
90
|
+
self,
|
|
91
|
+
request_id: str,
|
|
92
|
+
operation: int,
|
|
93
|
+
server_ip: int,
|
|
94
|
+
server_port: int,
|
|
95
|
+
number: int,
|
|
96
|
+
type: int,
|
|
97
|
+
) -> bytes:
|
|
98
|
+
"""Set device socket request (bluetooth only)."""
|
|
99
|
+
build = dev_net_pb2.DrvUploadFileToAppReq(
|
|
100
|
+
bizId=request_id,
|
|
101
|
+
operation=operation,
|
|
102
|
+
serverIp=server_ip,
|
|
103
|
+
serverPort=server_port,
|
|
104
|
+
num=number,
|
|
105
|
+
type=type,
|
|
106
|
+
)
|
|
107
|
+
print(
|
|
108
|
+
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
109
|
+
)
|
|
110
|
+
return self.send_order_msg_net(
|
|
111
|
+
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def get_device_log_info(self, biz_id: str, type: int, log_url: str) -> bytes:
|
|
115
|
+
"""Get device log info (bluetooth only)."""
|
|
116
|
+
return self.send_order_msg_net(
|
|
117
|
+
dev_net_pb2.DevNet(
|
|
118
|
+
todev_ble_sync=1,
|
|
119
|
+
todev_req_log_info=dev_net_pb2.DrvUploadFileReq(
|
|
120
|
+
bizId=biz_id,
|
|
121
|
+
type=type,
|
|
122
|
+
url=log_url,
|
|
123
|
+
num=0,
|
|
124
|
+
userId="", # TODO supply user id
|
|
125
|
+
),
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
def cancel_log_update(self, biz_id: str):
|
|
130
|
+
"""Cancel log update (bluetooth only)."""
|
|
131
|
+
return self.send_order_msg_net(
|
|
132
|
+
dev_net_pb2.DevNet(
|
|
133
|
+
todev_log_data_cancel=dev_net_pb2.DrvUploadFileCancel(bizId=biz_id)
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def get_device_network_info(self):
|
|
138
|
+
build = dev_net_pb2.DevNet(
|
|
139
|
+
todev_networkinfo_req=dev_net_pb2.GetNetworkInfoReq(req_ids=1)
|
|
140
|
+
)
|
|
141
|
+
print("Send command - get device network information")
|
|
142
|
+
return self.send_order_msg_net(build)
|
|
143
|
+
|
|
144
|
+
def set_device_4g_enable_status(self, new_4g_status: bool):
|
|
145
|
+
build = dev_net_pb2.DevNet(
|
|
146
|
+
todev_ble_sync=1,
|
|
147
|
+
todev_set_mnet_cfg_req=dev_net_pb2.SetMnetCfgReq(
|
|
148
|
+
cfg=dev_net_pb2.MnetCfg(
|
|
149
|
+
type=dev_net_pb2.NET_TYPE_WIFI,
|
|
150
|
+
inet_enable=new_4g_status,
|
|
151
|
+
mnet_enable=new_4g_status,
|
|
152
|
+
)
|
|
153
|
+
),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
print(f"Send command - set 4G (on/off status). newWifiStatus={new_4g_status}")
|
|
157
|
+
return self.send_order_msg_net(build)
|
|
158
|
+
|
|
159
|
+
def set_device_wifi_enable_status(self, new_wifi_status: bool):
|
|
160
|
+
build = dev_net_pb2.DevNet(
|
|
161
|
+
todev_ble_sync=1,
|
|
162
|
+
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
163
|
+
configParam=4, wifi_enable=new_wifi_status
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
print(
|
|
167
|
+
f"szNetwork: Send command - set network (on/off status). newWifiStatus={new_wifi_status}"
|
|
168
|
+
)
|
|
169
|
+
return self.send_order_msg_net(build)
|
|
170
|
+
|
|
171
|
+
def wifi_connectinfo_update(self, device_name: str, is_binary: bool):
|
|
172
|
+
print(
|
|
173
|
+
f"Send command - get Wifi connection information.wifiConnectinfoUpdate().deviceName={device_name}.isBinary={is_binary}"
|
|
174
|
+
)
|
|
175
|
+
if is_binary:
|
|
176
|
+
build = dev_net_pb2.DevNet(
|
|
177
|
+
todev_ble_sync=1,
|
|
178
|
+
todev_WifiMsgUpload=dev_net_pb2.DrvWifiUpload(Wifi_Msg_Upload=1),
|
|
179
|
+
)
|
|
180
|
+
print("Send command - get Wifi connection information")
|
|
181
|
+
return self.send_order_msg_net(build)
|
|
182
|
+
self.wifi_connectinfo_update2()
|
|
183
|
+
|
|
184
|
+
def wifi_connectinfo_update2(self):
|
|
185
|
+
hash_map = {"getMsgCmd": 1}
|
|
186
|
+
# self.post_custom_data(self.get_json_string(
|
|
187
|
+
# 68, hash_map)) # ToDo: Fix this
|
|
188
|
+
|
|
189
|
+
def get_record_wifi_list(self, is_binary: bool):
|
|
190
|
+
print(f"getRecordWifiList().isBinary={is_binary}")
|
|
191
|
+
if is_binary:
|
|
192
|
+
build = dev_net_pb2.DevNet(
|
|
193
|
+
todev_ble_sync=1, todev_WifiListUpload=dev_net_pb2.DrvWifiList()
|
|
194
|
+
)
|
|
195
|
+
print("Send command - get memorized WiFi list upload command")
|
|
196
|
+
return self.send_order_msg_net(build)
|
|
197
|
+
self.get_record_wifi_list2()
|
|
198
|
+
|
|
199
|
+
def get_record_wifi_list2(self):
|
|
200
|
+
pass
|
|
201
|
+
# self.messageNavigation.post_custom_data(
|
|
202
|
+
# self.get_json_string(69)) # ToDo: Fix this
|
|
203
|
+
|
|
204
|
+
def close_clear_connect_current_wifi(self, ssid: str, status: int, is_binary: bool):
|
|
205
|
+
if is_binary:
|
|
206
|
+
build = dev_net_pb2.DevNet(
|
|
207
|
+
todev_ble_sync=1,
|
|
208
|
+
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
209
|
+
configParam=status, Confssid=ssid
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
print(
|
|
213
|
+
f"Send command - set network (disconnect, direct connect, forget, no operation reconnect) operation command (downlink ssid={ssid}, status={status})"
|
|
214
|
+
)
|
|
215
|
+
return self.send_order_msg_net(build)
|
|
216
|
+
self.close_clear_connect_current_wifi2(ssid, status)
|
|
217
|
+
|
|
218
|
+
def close_clear_connect_current_wifi2(self, ssid: str, get_msg_cmd: int):
|
|
219
|
+
data = {"ssid": ssid, "getMsgCmd": get_msg_cmd}
|
|
220
|
+
# self.messageNavigation.post_custom_data(
|
|
221
|
+
# ToDo: Fix this
|
|
222
|
+
# self.get_json_string(bleOrderCmd.close_clear_connect_current_wifi, data).encode())
|
|
223
|
+
|
|
224
|
+
def get_json_string(self, cmd: int, hash_map: Dict[str, object]) -> str:
|
|
225
|
+
jSONObject = {}
|
|
226
|
+
try:
|
|
227
|
+
jSONObject["cmd"] = cmd
|
|
228
|
+
jSONObject[tmp_constant.REQUEST_ID] = int(time.time())
|
|
229
|
+
jSONObject2 = {}
|
|
230
|
+
for key, value in hash_map.items():
|
|
231
|
+
jSONObject2[key] = value
|
|
232
|
+
jSONObject["params"] = jSONObject2
|
|
233
|
+
return json.dumps(jSONObject)
|
|
234
|
+
except Exception as e:
|
|
235
|
+
print(e)
|
|
236
|
+
return ""
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# === sendOrderMsg_Ota ===
|
|
2
|
-
from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class MessageOta:
|
|
6
|
-
def send_order_msg_ota(self, ota):
|
|
7
|
-
luba_msg = luba_msg_pb2.LubaMsg(
|
|
8
|
-
msgtype=luba_msg_pb2.MSG_CMD_TYPE_EMBED_OTA,
|
|
9
|
-
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
10
|
-
rcver=luba_msg_pb2.DEV_MAINCTL,
|
|
11
|
-
msgattr=luba_msg_pb2.MSG_ATTR_REQ,
|
|
12
|
-
seqs=1,
|
|
13
|
-
version=1,
|
|
14
|
-
subtype=1,
|
|
15
|
-
ota=ota,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
return luba_msg.SerializeToString()
|
|
19
|
-
|
|
20
|
-
def get_device_ota_info(self, log_type: int):
|
|
21
|
-
todev_get_info_req = mctrl_ota_pb2.MctlOta(
|
|
22
|
-
todev_get_info_req=mctrl_ota_pb2.getInfoReq(type=mctrl_ota_pb2.IT_OTA)
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
print("===Send command to get upgrade details===logType:" + str(log_type))
|
|
26
|
-
return self.send_order_msg_ota(todev_get_info_req)
|
|
27
|
-
|
|
28
|
-
def get_device_info_new(self):
|
|
29
|
-
"""New device call for OTA upgrade information."""
|
|
30
|
-
todev_get_info_req = mctrl_ota_pb2.MctlOta(
|
|
31
|
-
todev_get_info_req=mctrl_ota_pb2.getInfoReq(type=mctrl_ota_pb2.IT_BASE)
|
|
32
|
-
)
|
|
33
|
-
print("Send to get OTA upgrade information", "Get device information")
|
|
34
|
-
return self.send_order_msg_ota(todev_get_info_req)
|
|
1
|
+
# === sendOrderMsg_Ota ===
|
|
2
|
+
from pymammotion.proto import luba_msg_pb2, mctrl_ota_pb2
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class MessageOta:
|
|
6
|
+
def send_order_msg_ota(self, ota):
|
|
7
|
+
luba_msg = luba_msg_pb2.LubaMsg(
|
|
8
|
+
msgtype=luba_msg_pb2.MSG_CMD_TYPE_EMBED_OTA,
|
|
9
|
+
sender=luba_msg_pb2.DEV_MOBILEAPP,
|
|
10
|
+
rcver=luba_msg_pb2.DEV_MAINCTL,
|
|
11
|
+
msgattr=luba_msg_pb2.MSG_ATTR_REQ,
|
|
12
|
+
seqs=1,
|
|
13
|
+
version=1,
|
|
14
|
+
subtype=1,
|
|
15
|
+
ota=ota,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
return luba_msg.SerializeToString()
|
|
19
|
+
|
|
20
|
+
def get_device_ota_info(self, log_type: int):
|
|
21
|
+
todev_get_info_req = mctrl_ota_pb2.MctlOta(
|
|
22
|
+
todev_get_info_req=mctrl_ota_pb2.getInfoReq(type=mctrl_ota_pb2.IT_OTA)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
print("===Send command to get upgrade details===logType:" + str(log_type))
|
|
26
|
+
return self.send_order_msg_ota(todev_get_info_req)
|
|
27
|
+
|
|
28
|
+
def get_device_info_new(self):
|
|
29
|
+
"""New device call for OTA upgrade information."""
|
|
30
|
+
todev_get_info_req = mctrl_ota_pb2.MctlOta(
|
|
31
|
+
todev_get_info_req=mctrl_ota_pb2.getInfoReq(type=mctrl_ota_pb2.IT_BASE)
|
|
32
|
+
)
|
|
33
|
+
print("Send to get OTA upgrade information", "Get device information")
|
|
34
|
+
return self.send_order_msg_ota(todev_get_info_req)
|