Exemplo n.º 1
0
 def _get_scene_terminal_data(cls, user, scene_terminal, fields=None):
     user = get_user(user)
     scene_terminal = get_obj(scene_terminal, SceneTerminal)
     handler = SceneHandler(user)
     terminal_util = handler.get_terminal_util(scene_terminal)
     data = terminal_util.get_data(fields=fields)
     return data
Exemplo n.º 2
0
 def _get_scene_net_data(cls, user, scene_net, fields=None):
     user = get_user(user)
     scene_net = get_obj(scene_net, SceneNet)
     handler = SceneHandler(user)
     net_util = handler.get_net_util(scene_net)
     data = net_util.get_data(fields=fields)
     return data
Exemplo n.º 3
0
    def get_node_obj(self, model, node_obj=None, sub_id=None):
        if node_obj:
            return get_obj(node_obj, model)

        if sub_id:
            return model.objects.get(scene=self.scene, sub_id=sub_id)

        raise SceneException('get_node_obj args error')
Exemplo n.º 4
0
 def _get_device_data(cls, user, device):
     user = get_user(user)
     device = get_obj(device, StandardDevice)
     data = mserializers.StandardDeviceSerializer(device,
                                                  context={
                                                      'user': user
                                                  }).data
     return data
Exemplo n.º 5
0
 def __init__(self, scene_net):
     scene_net = get_obj(scene_net, SceneNet)
     super(NetUtil, self).__init__(scene_net)
Exemplo n.º 6
0
 def _get_cr_event_data(cls, user, cr_event):
     cr_event = get_obj(cr_event, CrEvent)
     data = mserializers.CrEventSerializers(cr_event, fields=('id', )).data
     return data
Exemplo n.º 7
0
 def __init__(self, scene_gateway):
     scene_gateway = get_obj(scene_gateway, SceneGateway)
     super(GatewayUtil, self).__init__(scene_gateway)
Exemplo n.º 8
0
 def __init__(self, cr_event_id_or_obj):
     self.cr_event_obj = get_obj(cr_event_id_or_obj, CrEvent)
     self.vis_cr = CpVisCr(id=self.cr_event_obj.id,
                           title=self.cr_event_obj.name,
                           redis_conf=app_settings.REDIS_CONF)
     self.root_entity = ''
Exemplo n.º 9
0
 def __init__(self, user, scene_config, hang_info=None, super_viewer=False):
     self.user = user
     self.scene_config = get_obj(scene_config, SceneConfig)
     self.json_config = json.loads(self.scene_config.json_config)
     self.hang_info = hang_info or {}
     self.super_viewer = super_viewer
Exemplo n.º 10
0
 def _get_scene_data(cls, user, scene, fields=None):
     user = get_user(user)
     scene = get_obj(scene, Scene)
     handler = SceneHandler(user, scene=scene)
     data = handler.scene_util.get_data(fields=fields)
     return data