Example #1
0
 def cr_sysctrl_sync_timing(self):
     msg = AtomSysctrl.mk_sync_timing(False)
     self.pub_state(WORLD_STATES.TIME_CURRENT, '', msg)
     # 发送proto2兼容数据
     msg2 = AtomSysctrl2.mk_sync_timing(False)
     self.pub_state(WORLD_STATES.TIME_CURRENT_PROTO2, '', msg2)
     return True
Example #2
0
 def cr_sysctrl_focus_subnet(self, subnet_id):
     """
     聚焦网络
     :param subnet_id: 网络编号
     :return:
     """
     msg = AtomSysctrl.mk_focus_subnet(subnet_id=subnet_id, duration=10)
     return self.pub_message(msg)
Example #3
0
 def cr_sysctrl_toggle_scene(self,
                             scenario_type=Enums.EnumScenarioType.topology):
     """
     切换场景
     :param scenario_type: Enums.EnumScenarioType.topology 沙盘/拓扑两个场景
     :return:
     """
     msg = AtomSysctrl.mk_toggle_scene(scenario_type)
     return self.pub_message(msg)
Example #4
0
 def cr_sysctrl_focus_entities(self, id1, id2="", id3=""):
     """
     聚焦设备
     :param id1: 设备编号
     :param id2:
     :param id3:
     :return:
     """
     msg = AtomSysctrl.mk_focus(obj_id1=id1,
                                obj_id2=id2,
                                obj_id3=id3,
                                duration=10)
     return self.pub_message(msg)
Example #5
0
 def cr_sysctrl_sync_timing_countdown(self, countdown_seconds=0):
     """
     存入倒计时
     :param countdown_seconds: int 型,倒计时剩余秒数
     :return:
     """
     msg = AtomSysctrl.mk_sync_timing(True, countdown_seconds * 1000)
     saved_state = {"MOMENT": time.time(), "SECONDS": countdown_seconds}
     self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN, saved_state, msg)
     # 发送proto2兼容数据
     msg2 = AtomSysctrl2.mk_sync_timing(False)
     self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN_PROTO2, saved_state,
                    msg2)
     return True
Example #6
0
 def restore_current(self):
     msg = AtomSysctrl.mk_sync_timing(False)
     return self.pub_state(WORLD_STATES.TIME_CURRENT, '', msg)
Example #7
0
 def restore_countdown(self, saved_state):
     message = AtomSysctrl.mk_sync_timing(True,
                                          saved_state['SECONDS'] * 1000)
     self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN, saved_state,
                    message)
Example #8
0
 def cr_sysctrl_toggle_camera(self,
                              camera_type=Enums.EnumCameraType.normal):
     msg = AtomSysctrl.mk_toggle_camera(camera_type)
     self.pub_message(msg)
     return True