Package brisa :: Package upnp :: Package control_point :: Module service :: Class Service
[hide private]
[frames] | no frames]

Class Service

source code

              object --+    
                       |    
base_service.BaseService --+
                           |
                          Service

Instance Methods [hide private]
 
__init__(self, id, serv_type, url_base, scpd_url, control_url='', event_url='', presentation_url='', build_async=False, async_cb=None, build=False)
Constructor for the BaseService class.
source code
 
_build_sync(self)
Builds the Service synchronously.
source code
 
_build_async(self, cb)
Builds the service asynchronously.
source code
 
_fetch_scpd_async_done(self, fd=None, cb=None)
Called when the SCPD XML was sucessfully fetched.
source code
 
_fetch_scpd_async_error(self, cb=None, error=None)
Called when the SCPD XML wasn't successfully fetched.
source code
 
generate_soap_service(self) source code
 
subscribe_for_variable(self, var_name, callback)
Subscribes for events on a specific variable (unicast eventing) with a notifier callback.
source code
StateVariable
get_state_variable(self, var_name)
Returns a state variable of the service, if exists.
source code
 
event_subscribe(self, event_host, callback, cargo, auto_renew=True, renew_callback=None)
Subscribes for events.
source code
 
event_unsubscribe(self, event_host, callback, cargo)
Unsubscribes for events.
source code
 
event_renew(self, event_host, callback, cargo)
Renew subscription for events.
source code
 
_on_event(self, changed_vars) source code

Inherited from base_service.BaseService: add_state_variable, get_actions, get_variables

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, scpd_url, control_url='', event_url='', presentation_url='', build_async=False, async_cb=None, build=False)
(Constructor)

source code 

Constructor for the BaseService class.

Parameters:
  • async_cb - callback in the form async_cb(success). Receives only one parameter (success) that tells if the the service has been successfully built or not.
Overrides: object.__init__

_build_async(self, cb)

source code 

Builds the service asynchronously. Forwards True to the specified callback 'cb' if the service was successfully built (otherwise, forwards False).

_fetch_scpd_async_done(self, fd=None, cb=None)

source code 

Called when the SCPD XML was sucessfully fetched. If so, build the service by parsing the description.

subscribe_for_variable(self, var_name, callback)

source code 

Subscribes for events on a specific variable (unicast eventing) with a notifier callback.

Parameters:
  • var_name (string) - variable name to subscribe on
  • callback (callable) - callback to receive notifications

get_state_variable(self, var_name)

source code 

Returns a state variable of the service, if exists.

Parameters:
  • var_name (string) - name of the state variable
Returns: StateVariable
matching state variable or None

event_subscribe(self, event_host, callback, cargo, auto_renew=True, renew_callback=None)

source code 

Subscribes for events.

Parameters:
  • event_host (tuple) - 2-tuple (host, port) with the event listener server.
  • callback (callable) - callback
  • cargo - callback parameters
  • auto_renew (boolean) - if True, the framework will automatically renew the subscription before it expires. If False, the program need to call event_renew method before the subscription timeout.
  • renew_callback (callable) - renew callback. It will be used when auto_renew is True

event_unsubscribe(self, event_host, callback, cargo)

source code 

Unsubscribes for events.

Parameters:
  • event_host (tuple) - 2-tuple (host, port) with the event listener server.
  • callback (callable) - callback
  • cargo - callback parameters

event_renew(self, event_host, callback, cargo)

source code 

Renew subscription for events.

Parameters:
  • event_host (tuple) - 2-tuple (host, port) with the event listener server.
  • callback (callable) - callback
  • cargo - callback parameters