Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        """ Constructor for the Device class.

        @param device_type: device type as described on the device reference
        @param friendly_name: a friendly name

        Optional parameters follow below:

        @param udn: uuid for the device. If not specified will be
                    automatically generated.
        @param parent: parent device
        @param manufacturer: manufacturer
        @param manufacturer_url: manufacturer url
        @param model_description: model description
        @param model_name: model name
        @param model_number: model number
        @param model_url: model url
        @param serial_number: serial number
        @param upc: upc
        @param presentation_url: presentation url
        @param create_webserver: see class description for more information.
                                 Default value is True and you should normally
                                 don't pass anything
        @param force_listen_url: forces the webserver to listen on a specific
                                 address. If it's not possible to listen on
                                 that address, another random one will be
                                 generated and used automatically.
	@param additional_ssdp_headers: can be used to add more field in the
                                        notify message or http responses.

        @type device_type: string
        @type friendly_name: string
        @type udn: string
        @type parent: Device
        @type manufacturer: string
        @type manufacturer_url: string
        @type model_description: string
        @type model_name: string
        @type model_number: string
        @type model_url: string
        @type serial_number: string
        @type upc: string
        @type presentation_url: string
        @type create_webserver: bool
        @type force_listen_url: bool
        @type additional_ssdp_headers: dict
        """
        create_webserver = kwargs.pop('create_webserver', True)
        force_listen_url = kwargs.pop('force_listen_url', '')
        additional_ssdp_headers = kwargs.pop('additional_ssdp_headers', {})
        BaseDevice.__init__(self, *args, **kwargs)
        self._generate_xml()
        self.SSDP = SSDPServer(self.friendly_name, self.xml_filename,
			       additional_headers=additional_ssdp_headers)
        self.webserver = None
        if create_webserver:
            self._create_webserver(force_listen_url)
        self._event_reload_time = None
        self._force_event_reload = None
        self.extra_elts = []
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        """ Constructor for the Device class.

        @param device_type: device type as described on the device reference
        @param friendly_name: a friendly name

        Optional parameters follow below:

        @param udn: uuid for the device. If not specified will be
                    automatically generated.
        @param parent: parent device
        @param manufacturer: manufacturer
        @param manufacturer_url: manufacturer url
        @param model_description: model description
        @param model_name: model name
        @param model_number: model number
        @param model_url: model url
        @param serial_number: serial number
        @param upc: upc
        @param presentation_url: presentation url
        @param create_webserver: see class description for more information.
                                 Default value is True and you should normally
                                 don't pass anything
        @param force_listen_url: forces the webserver to listen on a specific
                                 address. If it's not possible to listen on
                                 that address, another random one will be
                                 generated and used automatically.
        @param additional_ssdp_headers: can be used to add more field in the
                                        notify message or http responses.

        @type device_type: string
        @type friendly_name: string
        @type udn: string
        @type parent: Device
        @type manufacturer: string
        @type manufacturer_url: string
        @type model_description: string
        @type model_name: string
        @type model_number: string
        @type model_url: string
        @type serial_number: string
        @type upc: string
        @type presentation_url: string
        @type create_webserver: bool
        @type force_listen_url: bool
        @type additional_ssdp_headers: dict
        """
        create_webserver = kwargs.pop('create_webserver', True)
        force_listen_url = kwargs.pop('force_listen_url', '')
        additional_ssdp_headers = kwargs.pop('additional_ssdp_headers', {})
        BaseDevice.__init__(self, *args, **kwargs)
        self._generate_xml()
        self.SSDP = SSDPServer(self.friendly_name, self.xml_filename, additional_headers=additional_ssdp_headers)
        self.webserver = None
        if create_webserver:
            self._create_webserver(force_listen_url)
        self._event_reload_time = None
        self._force_event_reload = None
        self.extra_elts = []
Exemplo n.º 3
0
 def add_service(self, service):
     """ Adds a service to the device.
     """
     assert self.location, 'service does not have a location attribute yet'\
                           '. It must have a location set before adding '\
                           'services. If you passed create_webserver=Fal'\
                           'se, you must create the webserver in your '\
                           'own fashion and set self.location to the '\
                           'listening URL before adding services. This '\
                           'problem may also occur if you pass an '\
                           'invalid force_listen_url parameter.'
     service.url_base = self.location
     BaseDevice.add_service(self, service)
Exemplo n.º 4
0
    def add_device(self, device):
        if not BaseDevice.add_device(self, device):
            # Could not add device
            return False
        if brisa.__skip_soap_service__:
            return

        # Auto generate soap service
        self._generate_soap_services_for_device(device)
Exemplo n.º 5
0
    def add_device(self, device):
        if not BaseDevice.add_device(self, device):
            # Could not add device
            return False
        if brisa.__skip_soap_service__:
            return

        # Auto generate soap service
        self._generate_soap_services_for_device(device)