Ejemplo n.º 1
0
 def __init__(self, controller, subscriber):
     super(WinMediaParam, self).__init__(controller, self.set_value)
     self.subscriber = subscriber
     self.media_name = None
     self.shared_info.connect(SharedInfo.GLOBAL_MEDIA, self.set_camera)
     self.subscriber.subscribe(keys.get_key_media_param(),
                               self.call_signal_param)
Ejemplo n.º 2
0
    def __new__(cls):
        # Singleton
        if not cls._instance:
            # first instance
            cls.config = Configuration()
            cls.dct_filter = {}
            cls.dct_media = {}

            # {"filter_name" : class_filter}
            cls.dct_filterchain = {}
            cls.dct_filter = {}

            # initialize subscriber server
            publisher = Publisher(5031)
            cls.publisher = publisher
            # self.resource.set_all_publisher(publisher)
            publisher.start()

            publisher.register(keys.get_key_execution_list())
            publisher.register(keys.get_key_filter_param())
            publisher.register(keys.get_key_media_param())
            publisher.register(keys.get_key_lst_rec_historic())
            publisher.register(keys.get_key_count())

            # instance class
            cls._instance = super(Resource, cls).__new__(cls)
        return cls._instance
Ejemplo n.º 3
0
    def __new__(cls):
        # Singleton
        if not cls._instance:
            # first instance
            cls.config = Configuration()
            cls.dct_filter = {}
            cls.dct_media = {}

            # {"filter_name" : class_filter}
            cls.dct_filterchain = {}
            cls.dct_filter = {}

            # initialize subscriber server
            publisher = Publisher(5031)
            cls.publisher = publisher
            # self.resource.set_all_publisher(publisher)
            publisher.start()

            publisher.register(keys.get_key_execution_list())
            publisher.register(keys.get_key_filter_param())
            publisher.register(keys.get_key_media_param())
            publisher.register(keys.get_key_lst_rec_historic())
            publisher.register(keys.get_key_count())

            # instance class
            cls._instance = super(Resource, cls).__new__(cls)
        return cls._instance
Ejemplo n.º 4
0
 def _add_notification_param(self, param):
     # send from publisher
     if not self._publisher:
         return
     data = {"media": self.media_name, "param": param.serialize()}
     json_data = json.dumps(data)
     self._publisher.publish(keys.get_key_media_param(), json_data)
Ejemplo n.º 5
0
    def close(self):
        logger.info("Close cmdHandler and close server.")
        for media_name in self.resource.get_media_name_list():
            media = self.resource.get_media(media_name)
            media.close()
            media.destroy()

        self.server_observer.stop()
        self.publisher.stop()
        self.publisher.deregister(keys.get_key_execution_list())
        self.publisher.deregister(keys.get_key_filter_param())
        self.publisher.deregister(keys.get_key_media_param())
        self.publisher.deregister(keys.get_key_lst_rec_historic())
        self.publisher.deregister(keys.get_key_count())
Ejemplo n.º 6
0
 def __init__(self, controller, subscriber):
     super(WinMediaParam, self).__init__(controller, self.set_value)
     self.subscriber = subscriber
     self.media_name = None
     self.shared_info.connect(SharedInfo.GLOBAL_MEDIA, self.set_camera)
     self.subscriber.subscribe(keys.get_key_media_param(), self.call_signal_param)