Package brisa :: Package upnp :: Module base_service :: Class BaseService
[hide private]
[frames] | no frames]

Class BaseService

source code

object --+
         |
        BaseService

Instance Methods [hide private]
 
__init__(self, id, serv_type, url_base)
Constructor for the BaseService class.
source code
 
get_actions(self)
Returns a dict of the service actions.
source code
 
get_variables(self)
Returns a dict of the service state variables.
source code
 
add_state_variable(self, state_variable)
Adds a service state variable.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, serv_type, url_base)
(Constructor)

source code 

Constructor for the BaseService class.

Parameters:
  • serv_type (string) - service type
  • url_base (string) - base URL on the form schema://URL
Overrides: object.__init__

Note: url_base is expected on the form schema://URL. For example, suppose your device is located at http://192.168.1.15 and available on the specific port 12345. Also suppose your device has a service called Hello, with its resources available on the following addresses:

Hello SCPD: http://192.168.1.15:12345/Hello/SCPD Hello Control: http://192.168.1.15:12345/Hello/Control Hello EventSub: http://192.168.1.15:12345/Hello/Event Hello Present.: http://192.168.1.15:12345/Hello/Presentation

These addresses can be written in the form url_base/rel_url. In this case, url_base is http://192.168.1.15:12345 and rel_urls are /Hello/SCPD, /Hello/Control, and so on.

Relative URL's must begin with '/' and the base URL must not end in '/' (not http://192.168.1.15:12345/).

add_state_variable(self, state_variable)

source code 

Adds a service state variable.

Parameters:
  • state_variable (BaseStateVariable) - the service state variable