Package brisa :: Package upnp :: Package services :: Package connmgr :: Module connection_manager
[hide private]
[frames] | no frames]

Source Code for Module brisa.upnp.services.connmgr.connection_manager

  1  # Licensed # Licensed under the MIT license 
  2  # http://opensource.org/licenses/mit-license.php or see LICENSE file. 
  3  # Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org> 
  4  # 
  5  # This module implements the Connection Manager service 
  6  # type as documented in the ConnectionManager:1 Service Template 
  7  # Version 1.01 
  8  # It is implemented the features of MediaServer and only the 
  9  # required actions 
 10  # 
 11   
 12  """ Connection Manager service implementation 
 13   
 14  Common usage is to just add a ConnectionManagerServer (or 
 15  ConnectionManagerRenderer) class instance to a device. 
 16  """ 
 17   
 18  __all__ = ('ConnectionManagerServer', 'ConnectionManagerRenderer') 
 19   
 20  import os.path 
 21   
 22  from brisa.core import log 
 23  from brisa.upnp.services.xmls import xml_path 
 24  from brisa.upnp.device import Service 
 25   
 26   
 27  service_name = 'ConnectionManager' 
 28  service_type = 'urn:schemas-upnp-org:service:ConnectionManager:1' 
 29  server_scpd_xml_path = os.path.join(xml_path, 'connection-manager-scpd.xml') 
 30  renderer_scpd_xml_path = os.path.join(xml_path, 'render-connmgr-scpd.xml') 
 31   
 32   
33 -class ConnectionManagerServer(Service):
34
35 - def __init__(self):
38
39 - def soap_GetProtocolInfo(self, *args, **kwargs):
40 """Required: Returns the protocol-related info that this \ 41 ConnectionManager supports in its current state 42 """ 43 log.debug('Action on ConnectionManager: GetProtocolInfo()') 44 return {'Source': 'http-get:*:*:*', 45 'Sink': ''}
46
47 - def soap_GetCurrentConnectionIDs(self, *args, **kwargs):
48 """Required: Returns a comma-separated list of ConnectionIDs of 49 currently ongoing Connections.""" 50 log.debug('Action on ConnectionManager: GetCurrentConnectionIDs()') 51 #If optional action PrepareForConnection is not implemented 52 #this state variable should be set to 0. 53 return {'ConnectionIDs': '0'}
54
55 - def soap_GetCurrentConnectionInfo(self, *args, **kwargs):
56 """Required: Returns associated information of the connection 57 referred to by the ConnectionID parameter.""" 58 59 log.debug('Action on ConnectionManager: GetCurrentConnectionInfo()') 60 #connection information can be retrieved for ConnectionID 0 61 return {'RcsID': '-1', 62 'AVTransportID': '-1', 63 'ProtocolInfo': '', 64 'PeerConnectionManager': '', 65 'PeerConnectionID': '-1', 66 'Direction': 'Output', 67 'Status': 'OK'}
68 69
70 -class ConnectionManagerRenderer(Service):
71
72 - def __init__(self):
75
76 - def soap_GetProtocolInfo(self, *args, **kwargs):
77 """Required: Returns the protocol-related info that this 78 ConnectionManager supports in its current state - Specific 79 for MediaRenderer Devices""" 80 81 log.debug('Action on ConnectionManager: GetProtocolInfo()') 82 return {'Source': '', 'Sink': 83 'http-get:*:audio/mpeg:*'}
84
85 - def soap_GetCurrentConnectionInfo(self, *args, **kwargs):
86 """Required: Returns associated information of the connection 87 referred to by the ConnectionID parameter.""" 88 89 log.debug('Action on ConnectionManager: GetCurrentConnectionInfo()') 90 #connection information can be retrieved for ConnectionID 0 91 return {'RcsID': '0', 92 'AVTransportID': '0', 93 'ProtocolInfo': '', 94 'PeerConnectionManager': '', 95 'PeerConnectionID': '-1', 96 'Direction': 'Input', 97 'Status': 'OK'}
98
99 - def soap_GetCurrentConnectionIDs(self, *args, **kwargs):
100 """Required: Returns a comma-separated list of ConnectionIDs of 101 currently ongoing Connections.""" 102 103 log.debug('Action on ConnectionManager: GetCurrentConnectionIDs()') 104 #If optional action PrepareForConnection is not implemented 105 #this state variable should be set to 0. 106 return {'ConnectionIDs': '0'}
107