pymammotion 0.0.37__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.

Files changed (106) hide show
  1. pymammotion/__init__.py +43 -0
  2. pymammotion/aliyun/cloud_gateway.py +549 -0
  3. pymammotion/aliyun/cloud_service.py +65 -0
  4. pymammotion/aliyun/dataclass/aep_response.py +18 -0
  5. pymammotion/aliyun/dataclass/connect_response.py +51 -0
  6. pymammotion/aliyun/dataclass/dev_by_account_response.py +43 -0
  7. pymammotion/aliyun/dataclass/login_by_oauth_response.py +65 -0
  8. pymammotion/aliyun/dataclass/regions_response.py +26 -0
  9. pymammotion/aliyun/dataclass/session_by_authcode_response.py +18 -0
  10. pymammotion/aliyun/tmp_constant.py +175 -0
  11. pymammotion/bluetooth/__init__.py +1 -0
  12. pymammotion/bluetooth/ble.py +74 -0
  13. pymammotion/bluetooth/ble_message.py +430 -0
  14. pymammotion/bluetooth/const.py +27 -0
  15. pymammotion/bluetooth/data/__init__.py +0 -0
  16. pymammotion/bluetooth/data/convert.py +26 -0
  17. pymammotion/bluetooth/data/framectrldata.py +40 -0
  18. pymammotion/bluetooth/data/notifydata.py +63 -0
  19. pymammotion/const.py +9 -0
  20. pymammotion/data/__init__.py +0 -0
  21. pymammotion/data/model/__init__.py +8 -0
  22. pymammotion/data/model/device.py +157 -0
  23. pymammotion/data/model/enums.py +67 -0
  24. pymammotion/data/model/excute_boarder_params.py +48 -0
  25. pymammotion/data/model/execute_boarder.py +36 -0
  26. pymammotion/data/model/generate_route_information.py +133 -0
  27. pymammotion/data/model/hash_list.py +17 -0
  28. pymammotion/data/model/mowing_modes.py +37 -0
  29. pymammotion/data/model/plan.py +58 -0
  30. pymammotion/data/model/rapid_state.py +45 -0
  31. pymammotion/data/model/region_data.py +99 -0
  32. pymammotion/data/mqtt/__init__.py +1 -0
  33. pymammotion/data/mqtt/event.py +90 -0
  34. pymammotion/data/mqtt/properties.py +140 -0
  35. pymammotion/data/mqtt/status.py +52 -0
  36. pymammotion/event/__init__.py +6 -0
  37. pymammotion/event/event.py +50 -0
  38. pymammotion/http/_init_.py +0 -0
  39. pymammotion/http/http.py +76 -0
  40. pymammotion/luba/_init_.py +0 -0
  41. pymammotion/luba/base.py +52 -0
  42. pymammotion/mammotion/__init__.py +0 -0
  43. pymammotion/mammotion/commands/__init__.py +0 -0
  44. pymammotion/mammotion/commands/abstract_message.py +7 -0
  45. pymammotion/mammotion/commands/mammotion_command.py +34 -0
  46. pymammotion/mammotion/commands/messages/__init__.py +0 -0
  47. pymammotion/mammotion/commands/messages/driver.py +108 -0
  48. pymammotion/mammotion/commands/messages/media.py +36 -0
  49. pymammotion/mammotion/commands/messages/navigation.py +535 -0
  50. pymammotion/mammotion/commands/messages/network.py +236 -0
  51. pymammotion/mammotion/commands/messages/ota.py +34 -0
  52. pymammotion/mammotion/commands/messages/system.py +266 -0
  53. pymammotion/mammotion/commands/messages/video.py +27 -0
  54. pymammotion/mammotion/control/__init__.py +0 -0
  55. pymammotion/mammotion/control/joystick.py +184 -0
  56. pymammotion/mammotion/devices/__init__.py +1 -0
  57. pymammotion/mammotion/devices/luba.py +564 -0
  58. pymammotion/mqtt/mqtt.py +230 -0
  59. pymammotion/proto/__init__.py +0 -0
  60. pymammotion/proto/common.proto +7 -0
  61. pymammotion/proto/common.py +12 -0
  62. pymammotion/proto/common_pb2.py +25 -0
  63. pymammotion/proto/common_pb2.pyi +13 -0
  64. pymammotion/proto/dev_net.proto +297 -0
  65. pymammotion/proto/dev_net.py +381 -0
  66. pymammotion/proto/dev_net_pb2.py +107 -0
  67. pymammotion/proto/dev_net_pb2.pyi +472 -0
  68. pymammotion/proto/luba_msg.proto +73 -0
  69. pymammotion/proto/luba_msg.py +80 -0
  70. pymammotion/proto/luba_msg_pb2.py +40 -0
  71. pymammotion/proto/luba_msg_pb2.pyi +93 -0
  72. pymammotion/proto/luba_mul.proto +68 -0
  73. pymammotion/proto/luba_mul.py +76 -0
  74. pymammotion/proto/luba_mul_pb2.py +45 -0
  75. pymammotion/proto/luba_mul_pb2.pyi +91 -0
  76. pymammotion/proto/mctrl_driver.proto +67 -0
  77. pymammotion/proto/mctrl_driver.py +100 -0
  78. pymammotion/proto/mctrl_driver_pb2.py +45 -0
  79. pymammotion/proto/mctrl_driver_pb2.pyi +112 -0
  80. pymammotion/proto/mctrl_nav.proto +485 -0
  81. pymammotion/proto/mctrl_nav.py +589 -0
  82. pymammotion/proto/mctrl_nav_pb2.py +116 -0
  83. pymammotion/proto/mctrl_nav_pb2.pyi +875 -0
  84. pymammotion/proto/mctrl_ota.proto +42 -0
  85. pymammotion/proto/mctrl_ota.py +48 -0
  86. pymammotion/proto/mctrl_ota_pb2.py +35 -0
  87. pymammotion/proto/mctrl_ota_pb2.pyi +65 -0
  88. pymammotion/proto/mctrl_pept.proto +29 -0
  89. pymammotion/proto/mctrl_pept.py +41 -0
  90. pymammotion/proto/mctrl_pept_pb2.py +31 -0
  91. pymammotion/proto/mctrl_pept_pb2.pyi +50 -0
  92. pymammotion/proto/mctrl_sys.proto +487 -0
  93. pymammotion/proto/mctrl_sys.py +574 -0
  94. pymammotion/proto/mctrl_sys_pb2.py +142 -0
  95. pymammotion/proto/mctrl_sys_pb2.pyi +787 -0
  96. pymammotion/py.typed +0 -0
  97. pymammotion/utility/constant/__init__.py +1 -0
  98. pymammotion/utility/constant/device_constant.py +238 -0
  99. pymammotion/utility/datatype_converter.py +80 -0
  100. pymammotion/utility/device_type.py +152 -0
  101. pymammotion/utility/periodic.py +41 -0
  102. pymammotion/utility/rocker_util.py +135 -0
  103. pymammotion-0.0.37.dist-info/LICENSE +674 -0
  104. pymammotion-0.0.37.dist-info/METADATA +92 -0
  105. pymammotion-0.0.37.dist-info/RECORD +106 -0
  106. pymammotion-0.0.37.dist-info/WHEEL +4 -0
@@ -0,0 +1,108 @@
1
+ # === sendOrderMsg_Driver ===
2
+ import time
3
+ from abc import ABC
4
+ from logging import getLogger
5
+
6
+ from pyluba.mammotion.commands.abstract_message import AbstractMessage
7
+ from pyluba.proto import luba_msg_pb2, mctrl_driver_pb2
8
+
9
+ logger = getLogger(__name__)
10
+
11
+
12
+ class MessageDriver(AbstractMessage, ABC):
13
+ @staticmethod
14
+ def send_order_msg_driver(driver):
15
+ luba_msg = luba_msg_pb2.LubaMsg(
16
+ msgtype=luba_msg_pb2.MSG_CMD_TYPE_EMBED_DRIVER,
17
+ sender=luba_msg_pb2.DEV_MOBILEAPP,
18
+ rcver=luba_msg_pb2.DEV_MAINCTL,
19
+ msgattr=luba_msg_pb2.MSG_ATTR_REQ,
20
+ timestamp=round(time.time() * 1000),
21
+ seqs=1,
22
+ version=1,
23
+ subtype=1,
24
+ driver=driver,
25
+ )
26
+
27
+ return luba_msg.SerializeToString()
28
+
29
+ def set_blade_height(self, height: int):
30
+ logger.debug(f"Send knife height height={height}")
31
+ build = mctrl_driver_pb2.MctlDriver(
32
+ todev_knife_height_set=mctrl_driver_pb2.DrvKnifeHeight(knifeHeight=height)
33
+ )
34
+ logger.debug(f"Send command--Knife motor height setting height={height}")
35
+ return self.send_order_msg_driver(build)
36
+
37
+ def set_speed(self, speed: float):
38
+ logger.debug(f"{self.get_device_name()} set speed, {speed}")
39
+ build = mctrl_driver_pb2.MctlDriver(
40
+ bidire_speed_read_set=mctrl_driver_pb2.DrvSrSpeed(speed=speed, rw=1)
41
+ )
42
+ logger.debug(f"Send command--Speed setting speed={speed}")
43
+ return self.send_order_msg_driver(build)
44
+
45
+ def syn_nav_star_point_data(self, sat_system: int):
46
+ build = mctrl_driver_pb2.MctlDriver(
47
+ rtk_sys_mask_query=mctrl_driver_pb2.rtk_sys_mask_query_t(
48
+ sat_system=sat_system
49
+ )
50
+ )
51
+ logger.debug(
52
+ f"Send command--Navigation satellite frequency point synchronization={sat_system}"
53
+ )
54
+ return self.send_order_msg_driver(build)
55
+
56
+ def set_nav_star_point(self, cmd_req: str):
57
+ build = mctrl_driver_pb2.MctlDriver(
58
+ rtk_cfg_req=mctrl_driver_pb2.rtk_cfg_req_t(
59
+ cmd_req=cmd_req, cmd_length=len(cmd_req) - 1
60
+ )
61
+ )
62
+ logger.debug(
63
+ f"Send command--Navigation satellite frequency point setting={cmd_req}"
64
+ )
65
+ logger.debug(
66
+ f"Navigation satellite setting, Send command--Navigation satellite frequency point setting={cmd_req}"
67
+ )
68
+ return self.send_order_msg_driver(build)
69
+
70
+ def get_speed(self):
71
+ build = mctrl_driver_pb2.MctlDriver(
72
+ bidire_speed_read_set=mctrl_driver_pb2.DrvSrSpeed(rw=0)
73
+ )
74
+ logger.debug("Send command--Get speed value")
75
+ return self.send_order_msg_driver(build)
76
+
77
+ def operate_on_device(
78
+ self,
79
+ main_ctrl: int,
80
+ cut_knife_ctrl: int,
81
+ cut_knife_height: int,
82
+ max_run_speed: float,
83
+ ):
84
+ build = mctrl_driver_pb2.MctlDriver(
85
+ mow_ctrl_by_hand=mctrl_driver_pb2.DrvMowCtrlByHand(
86
+ main_ctrl=main_ctrl,
87
+ cut_knife_ctrl=cut_knife_ctrl,
88
+ cut_knife_height=cut_knife_height,
89
+ max_run_Speed=max_run_speed,
90
+ )
91
+ )
92
+ logger.debug(
93
+ f"Send command--Manual mowing command, main_ctrl:{main_ctrl}, cut_knife_ctrl:{cut_knife_ctrl}, "
94
+ f"cut_knife_height:{cut_knife_height}, max_run_speed:{max_run_speed}"
95
+ )
96
+
97
+ return self.send_order_msg_driver(build)
98
+
99
+ def send_movement(self, linear_speed: int, angular_speed: int):
100
+ logger.debug(f"Control command print, linearSpeed={
101
+ linear_speed} // angularSpeed={angular_speed}")
102
+ return self.send_order_msg_driver(
103
+ mctrl_driver_pb2.MctlDriver(
104
+ todev_devmotion_ctrl=mctrl_driver_pb2.DrvMotionCtrl(
105
+ setLinearSpeed=linear_speed, setAngularSpeed=angular_speed
106
+ )
107
+ )
108
+ )
@@ -0,0 +1,36 @@
1
+ # === sendOrderMsg_Media ===
2
+ from pyluba.proto import luba_msg_pb2, luba_mul_pb2
3
+ from pyluba.proto.luba_mul import MUL_LANGUAGE
4
+
5
+
6
+ class MessageMedia:
7
+ def send_order_msg_media(self, mul):
8
+ luba_msg = luba_msg_pb2.LubaMsg(
9
+ msgtype=luba_msg_pb2.MSG_CMD_TYPE_MUL,
10
+ sender=luba_msg_pb2.DEV_MOBILEAPP,
11
+ rcver=luba_msg_pb2.SOC_MODULE_MULTIMEDIA,
12
+ msgattr=luba_msg_pb2.MSG_ATTR_REQ,
13
+ seqs=1,
14
+ version=1,
15
+ subtype=1,
16
+ mul=mul,
17
+ )
18
+
19
+ return luba_msg.SerializeToString()
20
+
21
+ def set_car_volume(self, volume: int):
22
+ return self.send_order_msg_media(
23
+ luba_mul_pb2.SocMul(set_audio=luba_mul_pb2.MulSetAudio(at_switch=volume))
24
+ )
25
+
26
+ def set_car_voice_language(self, language_type: MUL_LANGUAGE | str | None):
27
+ return self.send_order_msg_media(
28
+ luba_mul_pb2.SocMul(
29
+ set_audio=luba_mul_pb2.MulSetAudio(au_language=language_type)
30
+ )
31
+ )
32
+
33
+ def set_car_wiper(self, round_num: int):
34
+ return self.send_order_msg_media(
35
+ luba_mul_pb2.SocMul(set_wiper=luba_mul_pb2.MulSetWiper(round=round_num))
36
+ )
@@ -0,0 +1,535 @@
1
+ # === sendOrderMsg_Nav ===
2
+ import logging
3
+ from abc import ABC
4
+ from typing import List
5
+
6
+ from pyluba.data.model import GenerateRouteInformation
7
+ from pyluba.data.model.plan import Plan
8
+ from pyluba.data.model.region_data import RegionData
9
+ from pyluba.mammotion.commands.abstract_message import AbstractMessage
10
+ from pyluba.proto.luba_msg import LubaMsg, MsgCmdType, MsgDevice, MsgAttr
11
+ from pyluba.proto.mctrl_nav import (
12
+ AppRequestCoverPathsT,
13
+ MctlNav,
14
+ NavGetCommData,
15
+ NavGetHashList,
16
+ NavPlanJobSet,
17
+ NavPlanTaskExecute,
18
+ NavReqCoverPath,
19
+ NavSysParamMsg,
20
+ NavTaskCtrl,
21
+ NavUnableTimeSet,
22
+ NavUploadZigZagResultAck,
23
+ SimulationCmdData,
24
+ WorkReportCmdData,
25
+ WorkReportUpdateCmd,
26
+ )
27
+
28
+ logger = logging.getLogger(__name__)
29
+
30
+
31
+ class MessageNavigation(AbstractMessage, ABC):
32
+ @staticmethod
33
+ def send_order_msg_nav(build) -> bytes:
34
+ luba_msg = LubaMsg(
35
+ msgtype=MsgCmdType.MSG_CMD_TYPE_NAV,
36
+ sender=MsgDevice.DEV_MOBILEAPP,
37
+ rcver=MsgDevice.DEV_MAINCTL,
38
+ msgattr=MsgAttr.MSG_ATTR_REQ,
39
+ seqs=1,
40
+ version=1,
41
+ subtype=1,
42
+ nav=build,
43
+ )
44
+
45
+ return luba_msg.SerializeToString()
46
+
47
+ def allpowerfull_rw_adapter_x3(self, id: int, context: int, rw: int) -> bytes:
48
+ build = MctlNav(nav_sys_param_cmd=NavSysParamMsg(id=id, context=context, rw=rw))
49
+ logger.debug(
50
+ f"Send command--9 general read and write command id={id}, context={context}, rw={rw}"
51
+ )
52
+ return self.send_order_msg_nav(build)
53
+
54
+ def along_border(self):
55
+ build = MctlNav(todev_edgecmd=1)
56
+ logger.debug("Send command--along the edge command")
57
+ return self.send_order_msg_nav(build)
58
+
59
+ def start_draw_border(self):
60
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=0))
61
+ logger.debug("Send command--Start drawing boundary command")
62
+ return self.send_order_msg_nav(build)
63
+
64
+ def enter_dumping_status(self):
65
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=14, type=12))
66
+ logger.debug("Send command--Enter grass collection status")
67
+ return self.send_order_msg_nav(build)
68
+
69
+ def add_dump_point(self):
70
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=12))
71
+ logger.debug("Send command--Add grass collection point")
72
+ return self.send_order_msg_nav(build)
73
+
74
+ def revoke_dump_point(self):
75
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=12))
76
+ logger.debug("Send command--Revoke grass collection point")
77
+ return self.send_order_msg_nav(build)
78
+
79
+ def exit_dumping_status(self):
80
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=1, type=12))
81
+ logger.debug("Send command--Exit grass collection setting status")
82
+ return self.send_order_msg_nav(build)
83
+
84
+ def out_drop_dumping_add(self):
85
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=15, type=12))
86
+ logger.debug(
87
+ "Send command--Complete external grass collection point marking operation"
88
+ )
89
+ return self.send_order_msg_nav(build)
90
+
91
+ def recover_dumping(self):
92
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=12, type=12))
93
+ logger.debug("Send command--Recover grass collection operation")
94
+ return self.send_order_msg_nav(build)
95
+
96
+ def start_draw_barrier(self):
97
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=1))
98
+ logger.debug("Sending command - Draw obstacle command")
99
+ return self.send_order_msg_nav(build)
100
+
101
+ def start_erase(self):
102
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=4, type=0))
103
+ logger.debug("Sending command - Start erase command - Bluetooth")
104
+ return self.send_order_msg_nav(build)
105
+
106
+ def end_erase(self):
107
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=5, type=0))
108
+ logger.debug("Sending command - End erase command")
109
+ return self.send_order_msg_nav(build)
110
+
111
+ def cancel_erase(self):
112
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=7, type=0))
113
+ logger.debug("Sending command - Cancel erase command")
114
+ return self.send_order_msg_nav(build)
115
+
116
+ def start_channel_line(self):
117
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=2))
118
+ logger.debug("Sending command - Start drawing channel line command")
119
+ return self.send_order_msg_nav(build)
120
+
121
+ def save_task(self):
122
+ build = MctlNav(todev_save_task=1)
123
+ logger.debug("Sending command - Save task command")
124
+ return self.send_order_msg_nav(build)
125
+
126
+ def set_edit_boundary(self, action: int):
127
+ build = MctlNav(
128
+ todev_get_commondata=NavGetCommData(pver=1, action=action, type=0)
129
+ )
130
+ logger.debug(f"Sending secondary editing command action={action}")
131
+ return self.send_order_msg_nav(build)
132
+
133
+ def set_data_synchronization(self, type: int):
134
+ logger.debug(
135
+ f"Sync data ==================== Sending ============ Restore command: {type}"
136
+ )
137
+ build = MctlNav(
138
+ todev_get_commondata=NavGetCommData(pver=1, action=12, type=type)
139
+ )
140
+ logger.debug(
141
+ "Sync data ==================== Sending ============ Restore command"
142
+ )
143
+ return self.send_order_msg_nav(build)
144
+
145
+ def send_plan(self, plan_bean: Plan) -> bytes:
146
+ build = MctlNav(
147
+ todev_planjob_set=NavPlanJobSet(
148
+ pver=plan_bean.pver,
149
+ sub_cmd=plan_bean.sub_cmd,
150
+ area=plan_bean.area,
151
+ work_time=plan_bean.work_time,
152
+ version=plan_bean.version,
153
+ id=plan_bean.id,
154
+ user_id=plan_bean.user_id,
155
+ device_id=plan_bean.device_id,
156
+ plan_id=plan_bean.plan_id,
157
+ task_id=plan_bean.task_id,
158
+ job_id=plan_bean.job_id,
159
+ start_time=plan_bean.start_time,
160
+ end_time=plan_bean.end_time,
161
+ week=plan_bean.week,
162
+ knife_height=plan_bean.knife_height,
163
+ model=plan_bean.model,
164
+ edge_mode=plan_bean.edge_mode,
165
+ required_time=plan_bean.required_time,
166
+ route_angle=plan_bean.route_angle,
167
+ route_model=plan_bean.route_model,
168
+ route_spacing=plan_bean.route_spacing,
169
+ ultrasonic_barrier=plan_bean.ultrasonic_barrier,
170
+ total_plan_num=plan_bean.total_plan_num,
171
+ plan_index=plan_bean.plan_index,
172
+ result=plan_bean.result,
173
+ speed=plan_bean.speed,
174
+ task_name=plan_bean.task_name,
175
+ job_name=plan_bean.job_name,
176
+ zone_hashs=plan_bean.zone_hashs,
177
+ reserved=plan_bean.reserved,
178
+ )
179
+ )
180
+ logger.debug(f"Send read job plan command planBean={plan_bean}")
181
+ return self.send_order_msg_nav(build)
182
+
183
+ def send_schedule(self, plan_bean: Plan) -> bytes:
184
+ build = NavPlanJobSet(
185
+ pver=plan_bean.pver,
186
+ sub_cmd=plan_bean.sub_cmd,
187
+ area=plan_bean.area,
188
+ device_id=plan_bean.device_id,
189
+ work_time=plan_bean.work_time,
190
+ version=plan_bean.version,
191
+ id=plan_bean.id,
192
+ user_id=plan_bean.user_id,
193
+ plan_id=plan_bean.plan_id,
194
+ task_id=plan_bean.task_id,
195
+ job_id=plan_bean.job_id,
196
+ start_time=plan_bean.start_time,
197
+ end_time=plan_bean.end_time,
198
+ week=plan_bean.week,
199
+ knife_height=plan_bean.knife_height,
200
+ model=plan_bean.model,
201
+ edge_mode=plan_bean.edge_mode,
202
+ required_time=plan_bean.required_time,
203
+ route_angle=plan_bean.route_angle,
204
+ route_model=plan_bean.route_model,
205
+ route_spacing=plan_bean.route_spacing,
206
+ ultrasonic_barrier=plan_bean.ultrasonic_barrier,
207
+ total_plan_num=plan_bean.total_plan_num,
208
+ plan_index=plan_bean.plan_index,
209
+ result=plan_bean.result,
210
+ speed=plan_bean.speed,
211
+ task_name=plan_bean.task_name,
212
+ job_name=plan_bean.job_name,
213
+ zone_hashs=plan_bean.zone_hashs,
214
+ reserved=plan_bean.reserved,
215
+ weeks=plan_bean.weeks,
216
+ start_date=plan_bean.start_date,
217
+ trigger_type=plan_bean.job_type,
218
+ day=plan_bean.interval_days,
219
+ toward_included_angle=plan_bean.demond_angle,
220
+ toward_mode=0,
221
+ )
222
+ logger.debug(f"Send read job plan command planBean={plan_bean}")
223
+ return self.send_order_msg_nav(MctlNav(todev_planjob_set=build))
224
+
225
+ def single_schedule(self, plan_id: str) -> bytes:
226
+ return self.send_order_msg_nav(
227
+ MctlNav(plan_task_execute=NavPlanTaskExecute(sub_cmd=1, id=plan_id))
228
+ )
229
+
230
+ def read_plan(self, sub_cmd: int, plan_index: int) -> bytes:
231
+ build = MctlNav(
232
+ todev_planjob_set=NavPlanJobSet(sub_cmd=sub_cmd, plan_index=plan_index)
233
+ )
234
+ logger.debug(f"Send read job plan command cmd={
235
+ sub_cmd} PlanIndex = {plan_index}")
236
+ return self.send_order_msg_nav(build)
237
+
238
+ def delete_plan(self, sub_cmd: int, plan_id: str) -> bytes:
239
+ build = MctlNav(
240
+ todev_planjob_set=NavPlanJobSet(sub_cmd=sub_cmd, plan_id=plan_id)
241
+ )
242
+ logger.debug(
243
+ f"Send command--Send delete job plan command cmd={sub_cmd} planId = {plan_id}"
244
+ )
245
+ return self.send_order_msg_nav(build)
246
+
247
+ def set_plan_unable_time(
248
+ self, sub_cmd: int, device_id: str, unable_end_time: str, unable_start_time: str
249
+ ) -> bytes:
250
+ build = NavUnableTimeSet(
251
+ sub_cmd=sub_cmd,
252
+ device_id=device_id,
253
+ unable_end_time=unable_end_time,
254
+ result=0,
255
+ reserved="0",
256
+ unable_start_time=unable_start_time,
257
+ )
258
+ logger.debug(f"{self.get_device_name()} Set forbidden time===={build}")
259
+ return self.send_order_msg_nav(MctlNav(todev_unable_time_set=build))
260
+
261
+ def read_plan_unable_time(self, sub_cmd: int) -> bytes:
262
+ build = NavUnableTimeSet(sub_cmd=sub_cmd)
263
+ build2 = MctlNav(todev_unable_time_set=build)
264
+ logger.debug(f"Send command--Read plan time {sub_cmd}")
265
+ return self.send_order_msg_nav(build2)
266
+
267
+ def query_job_history(self) -> bytes:
268
+ return self.send_order_msg_nav(
269
+ MctlNav(todev_work_report_update_cmd=WorkReportUpdateCmd(sub_cmd=1))
270
+ )
271
+
272
+ def request_job_history(self, num: int) -> bytes:
273
+ return self.send_order_msg_nav(
274
+ MctlNav(
275
+ todev_work_report_cmd=WorkReportCmdData(sub_cmd=1, get_info_num=num)
276
+ )
277
+ )
278
+
279
+ def leave_dock(self):
280
+ build = MctlNav(todev_one_touch_leave_pile=1)
281
+ logger.debug("Send command--One-click automatic undocking")
282
+ return self.send_order_msg_nav(build)
283
+
284
+ def get_all_boundary_hash_list(self, sub_cmd: int):
285
+ build = MctlNav(todev_gethash=NavGetHashList(pver=1, sub_cmd=sub_cmd))
286
+ logger.debug(f"Area loading=====================:Get area hash list++Bluetooth:{
287
+ sub_cmd}")
288
+ return self.send_order_msg_nav(build)
289
+
290
+ def get_hash_response(self, total_frame: int, current_frame: int):
291
+ build = MctlNav(
292
+ todev_gethash=NavGetHashList(
293
+ pver=1, sub_cmd=2, current_frame=current_frame, total_frame=total_frame
294
+ )
295
+ )
296
+ logger.debug(f"Send command--208 Response hash list command totalFrame={
297
+ total_frame},currentFrame={current_frame}")
298
+ return self.send_order_msg_nav(build)
299
+
300
+ def synchronize_hash_data(self, hash_num: int):
301
+ build = MctlNav(
302
+ todev_get_commondata=NavGetCommData(
303
+ pver=1, action=8, data_hash=hash_num, sub_cmd=1
304
+ )
305
+ )
306
+ logger.debug(f"Send command--209,hash synchronize area data hash:{hash}")
307
+ return self.send_order_msg_nav(build)
308
+
309
+ def get_area_to_be_transferred(self):
310
+ build = MctlNav(
311
+ todev_get_commondata=NavGetCommData(pver=1, action=8, sub_cmd=1, type=3)
312
+ )
313
+ logger.debug("Send command--Get transfer area before charging pile")
314
+ return self.send_order_msg_nav(build)
315
+
316
+ def get_regional_data(self, regional_data_bean: RegionData):
317
+ build = MctlNav(
318
+ todev_get_commondata=NavGetCommData(
319
+ pver=1,
320
+ action=regional_data_bean.action,
321
+ type=regional_data_bean.type,
322
+ data_hash=regional_data_bean.hash,
323
+ total_frame=regional_data_bean.total_frame,
324
+ current_frame=regional_data_bean.current_frame,
325
+ sub_cmd=2,
326
+ )
327
+ )
328
+ logger.debug("Area loading=====================:Response area data")
329
+ return self.send_order_msg_nav(build)
330
+
331
+ def indoor_simulation(self, flag: int):
332
+ build = MctlNav(simulation_cmd=SimulationCmdData(sub_cmd=flag))
333
+ logger.debug(f"Send command--Send indoor simulation command flag={flag}")
334
+ return self.send_order_msg_nav(build)
335
+
336
+ def send_tools_order(self, param_id: int, values: List[int]):
337
+ build = MctlNav(
338
+ simulation_cmd=SimulationCmdData(
339
+ sub_cmd=2, param_id=param_id, param_value=values
340
+ )
341
+ )
342
+ logger.debug(f"Send command--Send tool command id={param_id},values={values}")
343
+ return self.send_order_msg_nav(build)
344
+
345
+ def end_draw_border(self, type: int):
346
+ if type == -1:
347
+ return
348
+ build = MctlNav(
349
+ todev_get_commondata=NavGetCommData(pver=1, action=1, type=type)
350
+ )
351
+ logger.debug(
352
+ f"Send command--End drawing boundary, obstacle, channel command type={type}"
353
+ )
354
+ return self.send_order_msg_nav(build)
355
+
356
+ def cancel_current_record(self):
357
+ build = MctlNav(
358
+ todev_get_commondata=NavGetCommData(pver=1, action=7, sub_cmd=0)
359
+ )
360
+ logger.debug("Send command--Cancel current recording (boundary, obstacle)")
361
+ return self.send_order_msg_nav(build)
362
+
363
+ def delete_map_elements(self, type: int, hash_num: int):
364
+ if type == -1:
365
+ return
366
+ build = MctlNav(
367
+ todev_get_commondata=NavGetCommData(
368
+ pver=1, action=6, type=type, hash=hash_num
369
+ )
370
+ )
371
+ logger.debug(
372
+ f"Send command--Delete boundary or obstacle or channel command type={type},hash={hash}"
373
+ )
374
+ return self.send_order_msg_nav(build)
375
+
376
+ def delete_charge_point(self):
377
+ logger.debug("Delete charging pile")
378
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=5))
379
+ logger.debug("Send command--Delete charging pile location and reset")
380
+ return self.send_order_msg_nav(build)
381
+
382
+ def confirm_base_station(self):
383
+ logger.debug("Reset base station")
384
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=2, type=7))
385
+ logger.debug("Send command--Confirm no modification to base station")
386
+ return self.send_order_msg_nav(build)
387
+
388
+ def delete_all(self):
389
+ build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=6))
390
+ logger.debug("Send command--Clear job data")
391
+ return self.send_order_msg_nav(build)
392
+
393
+ def generate_route_information(
394
+ self, generate_route_information: GenerateRouteInformation
395
+ ):
396
+ logger.debug(f"Generate route data source:{generate_route_information}")
397
+ build = NavReqCoverPath(
398
+ pver=1,
399
+ sub_cmd=0,
400
+ zone_hashs=generate_route_information.one_hashs,
401
+ job_mode=generate_route_information.job_mode,
402
+ edge_mode=generate_route_information.edge_mode,
403
+ knife_height=generate_route_information.knife_height,
404
+ speed=generate_route_information.speed,
405
+ ultra_wave=generate_route_information.ultra_wave,
406
+ channel_width=generate_route_information.channel_width,
407
+ channel_mode=generate_route_information.channel_mode,
408
+ toward=generate_route_information.toward,
409
+ toward_included_angle=generate_route_information.toward_included_angle,
410
+ toward_mode=generate_route_information.toward_mode,
411
+ reserved=generate_route_information.path_order,
412
+ )
413
+ logger.debug(f"{self.get_device_name()}Generate route====={build}")
414
+ logger.debug(f"Send command--Generate route information generateRouteInformation={
415
+ generate_route_information}")
416
+ return self.send_order_msg_nav(MctlNav(bidire_reqconver_path=build))
417
+
418
+ def modify_generate_route_information(
419
+ self, generate_route_information: GenerateRouteInformation
420
+ ):
421
+ logger.debug(f"Generate route data source: {generate_route_information}")
422
+ build = NavReqCoverPath(
423
+ pver=1,
424
+ sub_cmd=3,
425
+ zone_hashs=generate_route_information.one_hashs,
426
+ job_mode=generate_route_information.job_mode,
427
+ edge_mode=generate_route_information.edge_mode,
428
+ knife_height=generate_route_information.knife_height,
429
+ speed=generate_route_information.speed,
430
+ ultra_wave=generate_route_information.ultra_wave,
431
+ channel_width=generate_route_information.channel_width,
432
+ channel_mode=generate_route_information.channel_mode,
433
+ toward=generate_route_information.toward,
434
+ reserved=generate_route_information.path_order,
435
+ )
436
+ logger.debug(f"{self.get_device_name()} Generate route ===== {build}")
437
+ logger.debug(f"Send command -- Modify route parameters generate_route_information={
438
+ generate_route_information}")
439
+ return self.send_order_msg_nav(MctlNav(bidire_reqconver_path=build))
440
+
441
+ def end_generate_route_information(self):
442
+ build = NavReqCoverPath(pver=1, sub_cmd=9)
443
+ logger.debug(f"{self.get_device_name()} Generate route ===== {build}")
444
+ build2 = MctlNav(bidire_reqconver_path=build)
445
+ logger.debug(
446
+ "Send command -- End generating route information generate_route_information="
447
+ )
448
+ return self.send_order_msg_nav(build2)
449
+
450
+ def query_generate_route_information(self):
451
+ build = NavReqCoverPath(pver=1, sub_cmd=2)
452
+ logger.debug(f"{self.get_device_name(
453
+ )} Send command -- Get route configuration information generate_route_information={build}")
454
+ build2 = MctlNav(bidire_reqconver_path=build)
455
+ return self.send_order_msg_nav(build2)
456
+
457
+ def get_line_info(self, current_hash: int) -> bytes:
458
+ logger.debug(f"Sending==========Get route command: {current_hash}")
459
+ build = MctlNav(
460
+ todev_zigzag_ack=NavUploadZigZagResultAck(
461
+ pver=1, current_hash=current_hash, sub_cmd=0
462
+ )
463
+ )
464
+ logger.debug(
465
+ f"Sending command--Get route data corresponding to hash={current_hash}"
466
+ )
467
+ return self.send_order_msg_nav(build)
468
+
469
+ def get_line_info_list(self, hash_list: List[int], transaction_id: int) -> bytes:
470
+ logger.debug(f"Sending==========Get route command: {hash_list}")
471
+ build = MctlNav(
472
+ app_request_cover_paths=AppRequestCoverPathsT(
473
+ pver=1, hash_list=hash_list, transaction_id=transaction_id, sub_cmd=0
474
+ )
475
+ )
476
+ logger.debug(
477
+ f"Sending command--Get route data corresponding to hash={hash_list}"
478
+ )
479
+ return self.send_order_msg_nav(build)
480
+
481
+ def start_job(self) -> bytes:
482
+ logger.debug("Sending==========Start job command")
483
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=1, result=0))
484
+ logger.debug("Sending command--Start job")
485
+ return self.send_order_msg_nav(build)
486
+
487
+ def cancel_return_to_dock(self):
488
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=12, result=0))
489
+ logger.debug("Send command - Cancel return to charge")
490
+ return self.send_order_msg_nav(build)
491
+
492
+ def cancel_job(self):
493
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=4, result=0))
494
+ logger.debug("Send command - End job")
495
+ return self.send_order_msg_nav(build)
496
+
497
+ def return_to_dock(self):
498
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=5, result=0))
499
+ logger.debug("Send command - Return to charge command")
500
+ return self.send_order_msg_nav(build)
501
+
502
+ def pause_execute_task(self):
503
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=2, result=0))
504
+ logger.debug("Send command - Pause command")
505
+ return self.send_order_msg_nav(build)
506
+
507
+ def re_charge_test(self):
508
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=10, result=0))
509
+ logger.debug("Send command - Return to charge test command")
510
+ return self.send_order_msg_nav(build)
511
+
512
+ def fast_aotu_test(self, action: int):
513
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=action, result=0))
514
+ logger.debug("Send command - One-click automation test")
515
+ return self.send_order_msg_nav(build)
516
+
517
+ def resume_execute_task(self):
518
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=3, result=0))
519
+ logger.debug("Send command - Cancel pause command")
520
+ return self.send_order_msg_nav(build)
521
+
522
+ def break_point_continue(self):
523
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=7, result=0))
524
+ logger.debug("Send command - Continue from breakpoint")
525
+ return self.send_order_msg_nav(build)
526
+
527
+ def break_point_anywhere_continue(self):
528
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=9, result=0))
529
+ logger.debug("Send command - Continue from current vehicle position")
530
+ return self.send_order_msg_nav(build)
531
+
532
+ def reset_base_station(self):
533
+ build = MctlNav(todev_taskctrl=NavTaskCtrl(type=3, action=1, result=0))
534
+ logger.debug("Send command - Reset charging pile, base station position")
535
+ return self.send_order_msg_nav(build)