pymammotion 0.2.29__py3-none-any.whl → 0.2.31__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.
Files changed (49) hide show
  1. pymammotion/__init__.py +11 -8
  2. pymammotion/aliyun/cloud_gateway.py +26 -24
  3. pymammotion/aliyun/cloud_service.py +3 -3
  4. pymammotion/aliyun/dataclass/dev_by_account_response.py +1 -1
  5. pymammotion/bluetooth/ble.py +5 -5
  6. pymammotion/bluetooth/ble_message.py +30 -16
  7. pymammotion/bluetooth/data/convert.py +1 -1
  8. pymammotion/bluetooth/data/framectrldata.py +1 -1
  9. pymammotion/bluetooth/data/notifydata.py +6 -6
  10. pymammotion/const.py +1 -0
  11. pymammotion/data/model/__init__.py +2 -0
  12. pymammotion/data/model/device.py +22 -20
  13. pymammotion/data/model/device_config.py +1 -1
  14. pymammotion/data/model/enums.py +4 -4
  15. pymammotion/data/model/excute_boarder_params.py +5 -5
  16. pymammotion/data/model/execute_boarder.py +4 -4
  17. pymammotion/data/model/hash_list.py +1 -1
  18. pymammotion/data/model/location.py +2 -2
  19. pymammotion/data/model/plan.py +4 -4
  20. pymammotion/data/model/region_data.py +4 -4
  21. pymammotion/data/model/report_info.py +1 -1
  22. pymammotion/data/mqtt/event.py +1 -1
  23. pymammotion/data/state_manager.py +9 -9
  24. pymammotion/event/event.py +14 -14
  25. pymammotion/http/http.py +29 -51
  26. pymammotion/http/model/http.py +75 -0
  27. pymammotion/mammotion/commands/messages/driver.py +20 -23
  28. pymammotion/mammotion/commands/messages/navigation.py +47 -48
  29. pymammotion/mammotion/commands/messages/network.py +17 -35
  30. pymammotion/mammotion/commands/messages/system.py +6 -7
  31. pymammotion/mammotion/control/joystick.py +10 -10
  32. pymammotion/mammotion/devices/__init__.py +2 -2
  33. pymammotion/mammotion/devices/base.py +248 -0
  34. pymammotion/mammotion/devices/mammotion.py +23 -1005
  35. pymammotion/mammotion/devices/mammotion_bluetooth.py +447 -0
  36. pymammotion/mammotion/devices/mammotion_cloud.py +246 -0
  37. pymammotion/mqtt/mammotion_future.py +2 -2
  38. pymammotion/mqtt/mammotion_mqtt.py +17 -14
  39. pymammotion/proto/__init__.py +6 -0
  40. pymammotion/utility/constant/__init__.py +3 -1
  41. pymammotion/utility/datatype_converter.py +9 -9
  42. pymammotion/utility/device_type.py +13 -13
  43. pymammotion/utility/map.py +2 -2
  44. pymammotion/utility/periodic.py +5 -5
  45. pymammotion/utility/rocker_util.py +1 -1
  46. {pymammotion-0.2.29.dist-info → pymammotion-0.2.31.dist-info}/METADATA +3 -1
  47. {pymammotion-0.2.29.dist-info → pymammotion-0.2.31.dist-info}/RECORD +49 -45
  48. {pymammotion-0.2.29.dist-info → pymammotion-0.2.31.dist-info}/LICENSE +0 -0
  49. {pymammotion-0.2.29.dist-info → pymammotion-0.2.31.dist-info}/WHEEL +0 -0
@@ -2,7 +2,6 @@
2
2
  import logging
3
3
  import time
4
4
  from abc import ABC
5
- from typing import List
6
5
 
7
6
  from pymammotion.data.model import GenerateRouteInformation
8
7
  from pymammotion.data.model.plan import Plan
@@ -61,82 +60,82 @@ class MessageNavigation(AbstractMessage, ABC):
61
60
  logger.debug(f"Send command--9 general read and write command id={id}, context={context}, rw={rw}")
62
61
  return self.send_order_msg_nav(build)
63
62
 
64
- def along_border(self):
63
+ def along_border(self) -> bytes:
65
64
  build = MctlNav(todev_edgecmd=1)
66
65
  logger.debug("Send command--along the edge command")
67
66
  return self.send_order_msg_nav(build)
68
67
 
69
- def start_draw_border(self):
68
+ def start_draw_border(self) -> bytes:
70
69
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=0))
71
70
  logger.debug("Send command--Start drawing boundary command")
72
71
  return self.send_order_msg_nav(build)
73
72
 
74
- def enter_dumping_status(self):
73
+ def enter_dumping_status(self) -> bytes:
75
74
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=14, type=12))
76
75
  logger.debug("Send command--Enter grass collection status")
77
76
  return self.send_order_msg_nav(build)
78
77
 
79
- def add_dump_point(self):
78
+ def add_dump_point(self) -> bytes:
80
79
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=12))
81
80
  logger.debug("Send command--Add grass collection point")
82
81
  return self.send_order_msg_nav(build)
83
82
 
84
- def revoke_dump_point(self):
83
+ def revoke_dump_point(self) -> bytes:
85
84
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=12))
86
85
  logger.debug("Send command--Revoke grass collection point")
87
86
  return self.send_order_msg_nav(build)
88
87
 
89
- def exit_dumping_status(self):
88
+ def exit_dumping_status(self) -> bytes:
90
89
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=1, type=12))
91
90
  logger.debug("Send command--Exit grass collection setting status")
92
91
  return self.send_order_msg_nav(build)
93
92
 
94
- def out_drop_dumping_add(self):
93
+ def out_drop_dumping_add(self) -> bytes:
95
94
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=15, type=12))
96
95
  logger.debug("Send command--Complete external grass collection point marking operation")
97
96
  return self.send_order_msg_nav(build)
98
97
 
99
- def recover_dumping(self):
98
+ def recover_dumping(self) -> bytes:
100
99
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=12, type=12))
101
100
  logger.debug("Send command--Recover grass collection operation")
102
101
  return self.send_order_msg_nav(build)
103
102
 
104
- def start_draw_barrier(self):
103
+ def start_draw_barrier(self) -> bytes:
105
104
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=1))
106
105
  logger.debug("Sending command - Draw obstacle command")
107
106
  return self.send_order_msg_nav(build)
108
107
 
109
- def start_erase(self):
108
+ def start_erase(self) -> bytes:
110
109
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=4, type=0))
111
110
  logger.debug("Sending command - Start erase command - Bluetooth")
112
111
  return self.send_order_msg_nav(build)
113
112
 
114
- def end_erase(self):
113
+ def end_erase(self) -> bytes:
115
114
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=5, type=0))
116
115
  logger.debug("Sending command - End erase command")
117
116
  return self.send_order_msg_nav(build)
118
117
 
119
- def cancel_erase(self):
118
+ def cancel_erase(self) -> bytes:
120
119
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=7, type=0))
121
120
  logger.debug("Sending command - Cancel erase command")
122
121
  return self.send_order_msg_nav(build)
123
122
 
124
- def start_channel_line(self):
123
+ def start_channel_line(self) -> bytes:
125
124
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=0, type=2))
126
125
  logger.debug("Sending command - Start drawing channel line command")
127
126
  return self.send_order_msg_nav(build)
128
127
 
129
- def save_task(self):
128
+ def save_task(self) -> bytes:
130
129
  build = MctlNav(todev_save_task=1)
131
130
  logger.debug("Sending command - Save task command")
132
131
  return self.send_order_msg_nav(build)
133
132
 
134
- def set_edit_boundary(self, action: int):
133
+ def set_edit_boundary(self, action: int) -> bytes:
135
134
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=action, type=0))
136
135
  logger.debug(f"Sending secondary editing command action={action}")
137
136
  return self.send_order_msg_nav(build)
138
137
 
139
- def set_data_synchronization(self, type: int):
138
+ def set_data_synchronization(self, type: int) -> bytes:
140
139
  logger.debug(f"Sync data ==================== Sending ============ Restore command: {type}")
141
140
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=12, type=type))
142
141
  logger.debug("Sync data ==================== Sending ============ Restore command")
@@ -259,7 +258,7 @@ class MessageNavigation(AbstractMessage, ABC):
259
258
  def request_job_history(self, num: int) -> bytes:
260
259
  return self.send_order_msg_nav(MctlNav(todev_work_report_cmd=WorkReportCmdData(sub_cmd=1, get_info_num=num)))
261
260
 
262
- def leave_dock(self):
261
+ def leave_dock(self) -> bytes:
263
262
  build = MctlNav(todev_one_touch_leave_pile=1)
264
263
  logger.debug("Send command--One-click automatic undocking")
265
264
  return self.send_order_msg_nav(build)
@@ -289,12 +288,12 @@ class MessageNavigation(AbstractMessage, ABC):
289
288
  logger.debug("Send command--Get area name list")
290
289
  return self.send_order_msg_nav(mctl_nav)
291
290
 
292
- def get_all_boundary_hash_list(self, sub_cmd: int):
291
+ def get_all_boundary_hash_list(self, sub_cmd: int) -> bytes:
293
292
  build = MctlNav(todev_gethash=NavGetHashList(pver=1, sub_cmd=sub_cmd))
294
293
  logger.debug(f"Area loading=====================:Get area hash list++Bluetooth:{sub_cmd}")
295
294
  return self.send_order_msg_nav(build)
296
295
 
297
- def get_hash_response(self, total_frame: int, current_frame: int):
296
+ def get_hash_response(self, total_frame: int, current_frame: int) -> bytes:
298
297
  build = MctlNav(
299
298
  todev_gethash=NavGetHashList(pver=1, sub_cmd=2, current_frame=current_frame, total_frame=total_frame)
300
299
  )
@@ -303,17 +302,17 @@ class MessageNavigation(AbstractMessage, ABC):
303
302
  )
304
303
  return self.send_order_msg_nav(build)
305
304
 
306
- def synchronize_hash_data(self, hash_num: int):
305
+ def synchronize_hash_data(self, hash_num: int) -> bytes:
307
306
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=8, hash=hash_num, sub_cmd=1))
308
307
  logger.debug(f"Send command--209,hash synchronize area data hash:{hash}")
309
308
  return self.send_order_msg_nav(build)
310
309
 
311
- def get_area_to_be_transferred(self):
310
+ def get_area_to_be_transferred(self) -> bytes:
312
311
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=8, sub_cmd=1, type=3))
313
312
  logger.debug("Send command--Get transfer area before charging pile")
314
313
  return self.send_order_msg_nav(build)
315
314
 
316
- def get_regional_data(self, regional_data: RegionData):
315
+ def get_regional_data(self, regional_data: RegionData) -> bytes:
317
316
  build = MctlNav(
318
317
  todev_get_commondata=NavGetCommData(
319
318
  pver=1,
@@ -328,53 +327,53 @@ class MessageNavigation(AbstractMessage, ABC):
328
327
  logger.debug("Area loading=====================:Response area data")
329
328
  return self.send_order_msg_nav(build)
330
329
 
331
- def indoor_simulation(self, flag: int):
330
+ def indoor_simulation(self, flag: int) -> bytes:
332
331
  build = MctlNav(simulation_cmd=SimulationCmdData(sub_cmd=flag))
333
332
  logger.debug(f"Send command--Send indoor simulation command flag={flag}")
334
333
  return self.send_order_msg_nav(build)
335
334
 
336
- def send_tools_order(self, param_id: int, values: List[int]):
335
+ def send_tools_order(self, param_id: int, values: list[int]) -> bytes:
337
336
  build = MctlNav(simulation_cmd=SimulationCmdData(sub_cmd=2, param_id=param_id, param_value=values))
338
337
  logger.debug(f"Send command--Send tool command id={param_id},values={values}")
339
338
  return self.send_order_msg_nav(build)
340
339
 
341
- def end_draw_border(self, type: int):
340
+ def end_draw_border(self, type: int) -> bytes:
342
341
  if type == -1:
343
342
  return
344
343
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=1, type=type))
345
344
  logger.debug(f"Send command--End drawing boundary, obstacle, channel command type={type}")
346
345
  return self.send_order_msg_nav(build)
347
346
 
348
- def cancel_current_record(self):
347
+ def cancel_current_record(self) -> bytes:
349
348
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=7, sub_cmd=0))
350
349
  logger.debug("Send command--Cancel current recording (boundary, obstacle)")
351
350
  return self.send_order_msg_nav(build)
352
351
 
353
- def delete_map_elements(self, type: int, hash_num: int):
352
+ def delete_map_elements(self, type: int, hash_num: int) -> bytes:
354
353
  if type == -1:
355
354
  return
356
355
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=type, hash=hash_num))
357
356
  logger.debug(f"Send command--Delete boundary or obstacle or channel command type={type},hash={hash}")
358
357
  return self.send_order_msg_nav(build)
359
358
 
360
- def delete_charge_point(self):
359
+ def delete_charge_point(self) -> bytes:
361
360
  logger.debug("Delete charging pile")
362
361
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=5))
363
362
  logger.debug("Send command--Delete charging pile location and reset")
364
363
  return self.send_order_msg_nav(build)
365
364
 
366
- def confirm_base_station(self):
365
+ def confirm_base_station(self) -> bytes:
367
366
  logger.debug("Reset base station")
368
367
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=2, type=7))
369
368
  logger.debug("Send command--Confirm no modification to base station")
370
369
  return self.send_order_msg_nav(build)
371
370
 
372
- def delete_all(self):
371
+ def delete_all(self) -> bytes:
373
372
  build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=6))
374
373
  logger.debug("Send command--Clear job data")
375
374
  return self.send_order_msg_nav(build)
376
375
 
377
- def generate_route_information(self, generate_route_information: GenerateRouteInformation):
376
+ def generate_route_information(self, generate_route_information: GenerateRouteInformation) -> bytes:
378
377
  logger.debug(f"Generate route data source:{generate_route_information}")
379
378
  build = NavReqCoverPath(
380
379
  pver=1,
@@ -382,7 +381,7 @@ class MessageNavigation(AbstractMessage, ABC):
382
381
  zone_hashs=generate_route_information.one_hashs,
383
382
  job_mode=generate_route_information.job_mode,
384
383
  edge_mode=generate_route_information.edge_mode,
385
- knife_height=generate_route_information.knife_height,
384
+ knife_height=generate_route_information.blade_height,
386
385
  speed=generate_route_information.speed,
387
386
  ultra_wave=generate_route_information.ultra_wave,
388
387
  channel_width=generate_route_information.channel_width,
@@ -397,7 +396,7 @@ class MessageNavigation(AbstractMessage, ABC):
397
396
  generate_route_information}")
398
397
  return self.send_order_msg_nav(MctlNav(bidire_reqconver_path=build))
399
398
 
400
- def modify_generate_route_information(self, generate_route_information: GenerateRouteInformation):
399
+ def modify_generate_route_information(self, generate_route_information: GenerateRouteInformation) -> bytes:
401
400
  logger.debug(f"Generate route data source: {generate_route_information}")
402
401
  build = NavReqCoverPath(
403
402
  pver=1,
@@ -405,7 +404,7 @@ class MessageNavigation(AbstractMessage, ABC):
405
404
  zone_hashs=generate_route_information.one_hashs,
406
405
  job_mode=generate_route_information.job_mode,
407
406
  edge_mode=generate_route_information.edge_mode,
408
- knife_height=generate_route_information.knife_height,
407
+ knife_height=generate_route_information.blade_height,
409
408
  speed=generate_route_information.speed,
410
409
  ultra_wave=generate_route_information.ultra_wave,
411
410
  channel_width=generate_route_information.channel_width,
@@ -418,14 +417,14 @@ class MessageNavigation(AbstractMessage, ABC):
418
417
  generate_route_information}")
419
418
  return self.send_order_msg_nav(MctlNav(bidire_reqconver_path=build))
420
419
 
421
- def end_generate_route_information(self):
420
+ def end_generate_route_information(self) -> bytes:
422
421
  build = NavReqCoverPath(pver=1, sub_cmd=9)
423
422
  logger.debug(f"{self.get_device_name()} Generate route ===== {build}")
424
423
  build2 = MctlNav(bidire_reqconver_path=build)
425
424
  logger.debug("Send command -- End generating route information generate_route_information=")
426
425
  return self.send_order_msg_nav(build2)
427
426
 
428
- def query_generate_route_information(self):
427
+ def query_generate_route_information(self) -> bytes:
429
428
  build = NavReqCoverPath(pver=1, sub_cmd=2)
430
429
  logger.debug(f"{self.get_device_name(
431
430
  )} Send command -- Get route configuration information generate_route_information={build}")
@@ -438,7 +437,7 @@ class MessageNavigation(AbstractMessage, ABC):
438
437
  logger.debug(f"Sending command--Get route data corresponding to hash={current_hash}")
439
438
  return self.send_order_msg_nav(build)
440
439
 
441
- def get_line_info_list(self, hash_list: List[int], transaction_id: int) -> bytes:
440
+ def get_line_info_list(self, hash_list: list[int], transaction_id: int) -> bytes:
442
441
  logger.debug(f"Sending==========Get route command: {hash_list}")
443
442
  build = MctlNav(
444
443
  app_request_cover_paths=AppRequestCoverPathsT(
@@ -454,52 +453,52 @@ class MessageNavigation(AbstractMessage, ABC):
454
453
  logger.debug("Sending command--Start job")
455
454
  return self.send_order_msg_nav(build)
456
455
 
457
- def cancel_return_to_dock(self):
456
+ def cancel_return_to_dock(self) -> bytes:
458
457
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=12, result=0))
459
458
  logger.debug("Send command - Cancel return to charge")
460
459
  return self.send_order_msg_nav(build)
461
460
 
462
- def cancel_job(self):
461
+ def cancel_job(self) -> bytes:
463
462
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=4, result=0))
464
463
  logger.debug("Send command - End job")
465
464
  return self.send_order_msg_nav(build)
466
465
 
467
- def return_to_dock(self):
466
+ def return_to_dock(self) -> bytes:
468
467
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=5, result=0))
469
468
  logger.debug("Send command - Return to charge command")
470
469
  return self.send_order_msg_nav(build)
471
470
 
472
- def pause_execute_task(self):
471
+ def pause_execute_task(self) -> bytes:
473
472
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=2, result=0))
474
473
  logger.debug("Send command - Pause command")
475
474
  return self.send_order_msg_nav(build)
476
475
 
477
- def re_charge_test(self):
476
+ def re_charge_test(self) -> bytes:
478
477
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=10, result=0))
479
478
  logger.debug("Send command - Return to charge test command")
480
479
  return self.send_order_msg_nav(build)
481
480
 
482
- def fast_aotu_test(self, action: int):
481
+ def fast_aotu_test(self, action: int) -> bytes:
483
482
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=action, result=0))
484
483
  logger.debug("Send command - One-click automation test")
485
484
  return self.send_order_msg_nav(build)
486
485
 
487
- def resume_execute_task(self):
486
+ def resume_execute_task(self) -> bytes:
488
487
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=3, result=0))
489
488
  logger.debug("Send command - Cancel pause command")
490
489
  return self.send_order_msg_nav(build)
491
490
 
492
- def break_point_continue(self):
491
+ def break_point_continue(self) -> bytes:
493
492
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=7, result=0))
494
493
  logger.debug("Send command - Continue from breakpoint")
495
494
  return self.send_order_msg_nav(build)
496
495
 
497
- def break_point_anywhere_continue(self):
496
+ def break_point_anywhere_continue(self) -> bytes:
498
497
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=1, action=9, result=0))
499
498
  logger.debug("Send command - Continue from current vehicle position")
500
499
  return self.send_order_msg_nav(build)
501
500
 
502
- def reset_base_station(self):
501
+ def reset_base_station(self) -> bytes:
503
502
  build = MctlNav(todev_taskctrl=NavTaskCtrl(type=3, action=1, result=0))
504
503
  logger.debug("Send command - Reset charging pile, base station position")
505
504
  return self.send_order_msg_nav(build)
@@ -1,9 +1,5 @@
1
1
  # === sendOrderMsg_Net ===
2
- import json
3
- import time
4
- from typing import Dict
5
2
 
6
- from pymammotion.aliyun.tmp_constant import tmp_constant
7
3
  from pymammotion.mammotion.commands.messages.navigation import MessageNavigation
8
4
  from pymammotion.proto import dev_net_pb2, luba_msg_pb2
9
5
 
@@ -12,7 +8,7 @@ class MessageNetwork:
12
8
  messageNavigation: MessageNavigation = MessageNavigation()
13
9
 
14
10
  @staticmethod
15
- def send_order_msg_net(build):
11
+ def send_order_msg_net(build) -> bytes:
16
12
  luba_msg = luba_msg_pb2.LubaMsg(
17
13
  msgtype=luba_msg_pb2.MSG_CMD_TYPE_ESP,
18
14
  sender=luba_msg_pb2.DEV_MOBILEAPP,
@@ -36,17 +32,17 @@ class MessageNetwork:
36
32
 
37
33
  return self.send_order_msg_net(net)
38
34
 
39
- def get_4g_module_info(self):
35
+ def get_4g_module_info(self) -> bytes:
40
36
  build = dev_net_pb2.DevNet(todev_get_mnet_cfg_req=dev_net_pb2.DevNet().todev_get_mnet_cfg_req)
41
37
  print("Send command -- Get device 4G network module information")
42
38
  return self.send_order_msg_net(build)
43
39
 
44
- def get_4g_info(self):
40
+ def get_4g_info(self) -> bytes:
45
41
  build = dev_net_pb2.DevNet(todev_mnet_info_req=dev_net_pb2.DevNet().todev_mnet_info_req)
46
42
  print("Send command -- Get device 4G network information")
47
43
  return self.send_order_msg_net(build)
48
44
 
49
- def set_zmq_enable(self):
45
+ def set_zmq_enable(self) -> bytes:
50
46
  build = dev_net_pb2.DevNet(
51
47
  todev_set_dds2zmq=dev_net_pb2.DrvDebugDdsZmq(
52
48
  is_enable=True,
@@ -57,7 +53,7 @@ class MessageNetwork:
57
53
  print("Send command -- Set vision ZMQ to enable")
58
54
  return self.send_order_msg_net(build)
59
55
 
60
- def set_iot_setting(self, iot_control_type: dev_net_pb2.iot_conctrl_type):
56
+ def set_iot_setting(self, iot_control_type: dev_net_pb2.iot_conctrl_type) -> bytes:
61
57
  build = dev_net_pb2.DevNet(todev_set_iot_offline_req=iot_control_type)
62
58
  print("Send command -- Device re-online")
63
59
  return self.send_order_msg_net(build)
@@ -70,7 +66,7 @@ class MessageNetwork:
70
66
  server_port: int,
71
67
  number: int,
72
68
  type: int,
73
- ):
69
+ ) -> bytes:
74
70
  build = dev_net_pb2.DrvUploadFileToAppReq(
75
71
  bizId=request_id,
76
72
  operation=operation,
@@ -122,18 +118,18 @@ class MessageNetwork:
122
118
  )
123
119
  )
124
120
 
125
- def cancel_log_update(self, biz_id: str):
121
+ def cancel_log_update(self, biz_id: str) -> bytes:
126
122
  """Cancel log update (bluetooth only)."""
127
123
  return self.send_order_msg_net(
128
124
  dev_net_pb2.DevNet(todev_log_data_cancel=dev_net_pb2.DrvUploadFileCancel(bizId=biz_id))
129
125
  )
130
126
 
131
- def get_device_network_info(self):
127
+ def get_device_network_info(self) -> bytes:
132
128
  build = dev_net_pb2.DevNet(todev_networkinfo_req=dev_net_pb2.GetNetworkInfoReq(req_ids=1))
133
129
  print("Send command - get device network information")
134
130
  return self.send_order_msg_net(build)
135
131
 
136
- def set_device_4g_enable_status(self, new_4g_status: bool):
132
+ def set_device_4g_enable_status(self, new_4g_status: bool) -> bytes:
137
133
  build = dev_net_pb2.DevNet(
138
134
  todev_ble_sync=1,
139
135
  todev_set_mnet_cfg_req=dev_net_pb2.SetMnetCfgReq(
@@ -148,7 +144,7 @@ class MessageNetwork:
148
144
  print(f"Send command - set 4G (on/off status). newWifiStatus={new_4g_status}")
149
145
  return self.send_order_msg_net(build)
150
146
 
151
- def set_device_wifi_enable_status(self, new_wifi_status: bool):
147
+ def set_device_wifi_enable_status(self, new_wifi_status: bool) -> bytes:
152
148
  build = dev_net_pb2.DevNet(
153
149
  todev_ble_sync=1,
154
150
  todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(configParam=4, wifi_enable=new_wifi_status),
@@ -156,25 +152,25 @@ class MessageNetwork:
156
152
  print(f"szNetwork: Send command - set network (on/off status). newWifiStatus={new_wifi_status}")
157
153
  return self.send_order_msg_net(build)
158
154
 
159
- def wifi_connectinfo_update(self, device_name: str, is_binary: bool):
155
+ def wifi_connectinfo_update(self, device_name: str, is_binary: bool) -> bytes:
160
156
  print(
161
157
  f"Send command - get Wifi connection information.wifiConnectinfoUpdate().deviceName={device_name}.isBinary={is_binary}"
162
158
  )
163
159
  if is_binary:
164
160
  build = dev_net_pb2.DevNet(
165
161
  todev_ble_sync=1,
166
- todev_WifiMsgUpload=dev_net_pb2.DrvWifiUpload(Wifi_Msg_Upload=1),
162
+ todev_WifiMsgUpload=dev_net_pb2.DrvWifiUpload(wifi_msg_upload=1),
167
163
  )
168
164
  print("Send command - get Wifi connection information")
169
165
  return self.send_order_msg_net(build)
170
166
  self.wifi_connectinfo_update2()
171
167
 
172
- def wifi_connectinfo_update2(self):
168
+ def wifi_connectinfo_update2(self) -> None:
173
169
  hash_map = {"getMsgCmd": 1}
174
170
  # self.post_custom_data(self.get_json_string(
175
171
  # 68, hash_map)) # ToDo: Fix this
176
172
 
177
- def get_record_wifi_list(self, is_binary: bool):
173
+ def get_record_wifi_list(self, is_binary: bool) -> bytes:
178
174
  print(f"getRecordWifiList().isBinary={is_binary}")
179
175
  if is_binary:
180
176
  build = dev_net_pb2.DevNet(todev_ble_sync=1, todev_WifiListUpload=dev_net_pb2.DrvWifiList())
@@ -182,12 +178,12 @@ class MessageNetwork:
182
178
  return self.send_order_msg_net(build)
183
179
  self.get_record_wifi_list2()
184
180
 
185
- def get_record_wifi_list2(self):
181
+ def get_record_wifi_list2(self) -> None:
186
182
  pass
187
183
  # self.messageNavigation.post_custom_data(
188
184
  # self.get_json_string(69)) # ToDo: Fix this
189
185
 
190
- def close_clear_connect_current_wifi(self, ssid: str, status: int, is_binary: bool):
186
+ def close_clear_connect_current_wifi(self, ssid: str, status: int, is_binary: bool) -> bytes:
191
187
  if is_binary:
192
188
  build = dev_net_pb2.DevNet(
193
189
  todev_ble_sync=1,
@@ -199,22 +195,8 @@ class MessageNetwork:
199
195
  return self.send_order_msg_net(build)
200
196
  self.close_clear_connect_current_wifi2(ssid, status)
201
197
 
202
- def close_clear_connect_current_wifi2(self, ssid: str, get_msg_cmd: int):
198
+ def close_clear_connect_current_wifi2(self, ssid: str, get_msg_cmd: int) -> None:
203
199
  data = {"ssid": ssid, "getMsgCmd": get_msg_cmd}
204
200
  # self.messageNavigation.post_custom_data(
205
201
  # ToDo: Fix this
206
202
  # self.get_json_string(bleOrderCmd.close_clear_connect_current_wifi, data).encode())
207
-
208
- def get_json_string(self, cmd: int, hash_map: Dict[str, object]) -> str:
209
- jSONObject = {}
210
- try:
211
- jSONObject["cmd"] = cmd
212
- jSONObject[tmp_constant.REQUEST_ID] = int(time.time())
213
- jSONObject2 = {}
214
- for key, value in hash_map.items():
215
- jSONObject2[key] = value
216
- jSONObject["params"] = jSONObject2
217
- return json.dumps(jSONObject)
218
- except Exception as e:
219
- print(e)
220
- return ""
@@ -1,11 +1,10 @@
1
1
  # === sendOrderMsg_Sys ===
2
2
  import datetime
3
3
  from abc import ABC
4
- from typing import List
5
4
 
6
5
  from pymammotion.mammotion.commands.abstract_message import AbstractMessage
7
6
  from pymammotion.mammotion.commands.messages.navigation import MessageNavigation
8
- from pymammotion.proto import luba_msg_pb2, mctrl_sys_pb2
7
+ from pymammotion.proto import luba_msg_pb2, mctrl_sys, mctrl_sys_pb2
9
8
  from pymammotion.proto.mctrl_sys import RptInfoType
10
9
  from pymammotion.utility.device_type import DeviceType
11
10
 
@@ -70,7 +69,7 @@ class MessageSystem(AbstractMessage, ABC):
70
69
  is_sidelight}, operate:{operate}, timeCtrlLight:{build}")
71
70
  return self.send_order_msg_sys(build2)
72
71
 
73
- def test_tool_order_to_sys(self, sub_cmd: int, param_id: int, param_value: List[int]):
72
+ def test_tool_order_to_sys(self, sub_cmd: int, param_id: int, param_value: list[int]):
74
73
  build = mctrl_sys_pb2.mCtrlSimulationCmdData(sub_cmd=sub_cmd, param_id=param_id, param_value=param_value)
75
74
  print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
76
75
  param_id}, param_value={param_value}")
@@ -158,7 +157,7 @@ class MessageSystem(AbstractMessage, ABC):
158
157
  # return self.send_order_msg_sys(build2)
159
158
 
160
159
  def send_sys_set_date_time(self):
161
- calendar = datetime.now()
160
+ calendar = datetime.datetime.now()
162
161
  i = calendar.year
163
162
  i2 = calendar.month
164
163
  i3 = calendar.day
@@ -170,8 +169,8 @@ class MessageSystem(AbstractMessage, ABC):
170
169
  i9 = 1 if calendar.dst() else 0
171
170
  print(f"Print time zone, time zone={
172
171
  i8}, daylight saving time={i9} week={i4}")
173
- build = mctrl_sys_pb2.MctlSys(
174
- todev_data_time=mctrl_sys_pb2.SysSetDateTime(
172
+ build = mctrl_sys.MctlSys(
173
+ todev_data_time=mctrl_sys.SysSetDateTime(
175
174
  year=i,
176
175
  month=i2,
177
176
  date=i3,
@@ -199,7 +198,7 @@ class MessageSystem(AbstractMessage, ABC):
199
198
  def request_iot_sys(
200
199
  self,
201
200
  rpt_act: mctrl_sys_pb2.rpt_act,
202
- rpt_info_type: List[RptInfoType | str] | None,
201
+ rpt_info_type: list[RptInfoType | str] | None,
203
202
  timeout: int,
204
203
  period: int,
205
204
  no_change_period: int,
@@ -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 pymammotion import MammotionBaseBLEDevice
10
9
  from pymammotion.event import BleNotificationEvent
11
- from pymammotion.utility.movement import transform_both_speeds, get_percent
10
+ from pymammotion.mammotion.devices import MammotionBaseBLEDevice
11
+ from pymammotion.utility.movement import get_percent, transform_both_speeds
12
12
 
13
13
  bleNotificationEvt = BleNotificationEvent()
14
14
 
@@ -26,7 +26,7 @@ class JoystickControl:
26
26
  _blade_height = 25
27
27
  worker = None
28
28
 
29
- def __init__(self, luba_ble: MammotionBaseBLEDevice):
29
+ def __init__(self, luba_ble: MammotionBaseBLEDevice) -> None:
30
30
  self._client = luba_ble
31
31
  self._curr_time = timer()
32
32
  self.stopped = False
@@ -45,10 +45,10 @@ class JoystickControl:
45
45
  self.worker.alive = self.mngr.alive # stop when this event stops
46
46
  self.worker.daemon = True
47
47
 
48
- def _movement_finished(self):
48
+ def _movement_finished(self) -> None:
49
49
  self.ignore_events = False
50
50
 
51
- def run_movement(self):
51
+ def run_movement(self) -> None:
52
52
  if self.linear_percent == 0.0 and self.angular_percent == 0.0:
53
53
  if self.stopped:
54
54
  return
@@ -62,20 +62,20 @@ class JoystickControl:
62
62
  )
63
63
  asyncio.run(self._client.command("send_movement", linear_speed=linear_speed, angular_speed=angular_speed))
64
64
 
65
- def print_add(self, joy):
65
+ def print_add(self, joy) -> None:
66
66
  print("Added", joy)
67
67
 
68
- def print_remove(self, joy):
68
+ def print_remove(self, joy) -> None:
69
69
  print("Removed", joy)
70
70
 
71
- def key_received(self, key):
71
+ def key_received(self, key) -> None:
72
72
  self.handle_key_received(key)
73
73
 
74
- def run_controller(self):
74
+ def run_controller(self) -> None:
75
75
  self.mngr.start()
76
76
  self.worker.start()
77
77
 
78
- def handle_key_received(self, key):
78
+ def handle_key_received(self, key) -> None:
79
79
  # print(key, "-", key.keytype, "-", key.number, "-", key.value)
80
80
 
81
81
  if key.keytype is Key.BUTTON and key.value == 1:
@@ -1,5 +1,5 @@
1
1
  """mqtt init."""
2
2
 
3
- from .mammotion import MammotionBaseBLEDevice, has_field
3
+ from .mammotion import MammotionBaseBLEDevice
4
4
 
5
- __all__ = ["MammotionBaseBLEDevice", "has_field"]
5
+ __all__ = ["MammotionBaseBLEDevice"]