coherence.upnp.services.servers (package)

coherence.upnp.services.servers.av_transport_server (module)

class AVTransportControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class AVTransportServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'service_server'
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.connection_manager_server (module)

class ConnectionManagerControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class ConnectionManagerServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

logCategory = 'connection_manager_server'
release()[source]
add_connection(RemoteProtocolInfo, Direction, PeerConnectionID, PeerConnectionManager)[source]
remove_connection(id)[source]
remove_lingering_connections()[source]

check if we have a connection that hasn’t a StateVariable change within the last 300 seconds, if so remove it

lookup_connection(id)[source]
lookup_avt_id(id)[source]
lookup_rcs_id(id)[source]
listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

set_variable(instance, variable_name, value, default=False)[source]
upnp_PrepareForConnection(*args, **kwargs)[source]
upnp_ConnectionComplete(*args, **kwargs)[source]
COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
simulate_notification()
upnp_GetCurrentConnectionInfo(*args, **kwargs)[source]
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.content_directory_server (module)

class ContentDirectoryControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class ContentDirectoryServer(device, backend=None, transcoding=False)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

logCategory = 'content_directory_server'
listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

upnp_Browse(*args, **kwargs)[source]
COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.dimming_server (module)

class DimmingControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class DimmingServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

logCategory = 'dimming_server'
COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render(request)

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.media_receiver_registrar_server (module)

class FakeMediaReceiverRegistrarBackend[source]

Bases: object

upnp_IsAuthorized(*args, **kwargs)[source]
upnp_IsValidated(*args, **kwargs)[source]
upnp_RegisterDevice(*args, **kwargs)[source]

in parameter RegistrationReqMsg

class MediaReceiverRegistrarControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class MediaReceiverRegistrarServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

implementation = 'optional'
listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'service_server'
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.rendering_control_server (module)

class RenderingControlControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class RenderingControlServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'service_server'
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.scheduled_recording_server (module)

class ScheduledRecordingControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class ScheduledRecordingServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

implementation = 'optional'
listchilds(uri)[source]
render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'service_server'
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)

coherence.upnp.services.servers.switch_power_server (module)

class SwitchPowerControl(server)[source]

Bases: coherence.upnp.core.service.ServiceControl, coherence.upnp.core.soap_service.UPnPPublisher

COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_gotError(failure, request, methodName, ns)
_gotResult(result, request, methodName, ns)
_methodNotFound(request, methodName)
_sendResponse(request, response, status=200)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
decode_result(element)
delEntity(name)
encoding = 'UTF-8'
entityType = <InterfaceClass twisted.web.resource.IResource>
envelope_attrib = None
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action_results(result, action, instance)

check for out arguments if yes: check if there are related ones to StateVariables with

non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action

if yes: update StateVariable values with call result if no: get StateVariable values and

add them to result dict
info(message, *args, **kwargs)
isLeaf = 1
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
logCategory = 'soap'
lookupFunction(functionName)
msg(message, *args, **kwargs)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
render(request)

Handle a SOAP command.

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

server = None
soap__generic(*args, **kwargs)

generic UPnP service control method, which will be used if no soap_ACTIONNAME method in the server service control class can be found

warn(message, *args, **kwargs)
warning(message, *args, **kwargs)
class SwitchPowerServer(device, backend=None)[source]

Bases: coherence.upnp.core.service.ServiceServer, twisted.web.resource.Resource

logCategory = 'switch_power_server'
COLOR_FORMAT = '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'
FORMAT = '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'
_Loggable__logger = None
_release()
build_last_change_event(instance=0, force=False)
build_single_notification(instance, variable_name, value)
check_moderated_variables()
check_subscribers()
create_new_instance(instance)
critical(message, *args, **kwargs)
debug(message, *args, **kwargs)
delEntity(name)
entityType = <InterfaceClass twisted.web.resource.IResource>
error(message, *args, **kwargs)
exception(message, *args, **kwargs)
fatal(message, *args, **kwargs)
getChild(path, request)

Retrieve a ‘child’ resource from me.

Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().

This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.

For example, the URL /foo/bar/baz will normally be:

| site.resource.getChild('foo').getChild('bar').getChild('baz').

However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.

Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.

getChildForRequest(request)
getChildWithDefault(path, request)

Retrieve a static or dynamically generated child resource from me.

First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.

This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.

@see: L{IResource.getChildWithDefault}

getDynamicEntity(name, request)
getStaticEntity(name)
get_action(action_name)
get_actions()
get_id()
get_scpdXML()
get_subscribers()
get_type()
get_variable(variable_name, instance=0)
get_variables()
info(message, *args, **kwargs)
init_var_and_actions()
isLeaf = 0
is_variable_moderated(name)
listDynamicEntities(request=None)
listDynamicNames()
listEntities()
listNames()
listStaticEntities()
listStaticNames()
log(message, *args, **kwargs)
msg(message, *args, **kwargs)
new_subscriber(subscriber)
propagate_notification(notify)
putChild(path, child)

Register a static child.

You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.

@see: L{IResource.putChild}

reallyPutEntity(name, entity)
register_vendor_action(name, implementation, arguments=None, needs_callback=True)

enables a backend to add an own, vendor defined, Action to the service

@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},

like (name,direction,relatedStateVariable)
@ivar needs_callback: this Action needs a method in the backend
or service class
register_vendor_variable(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)

enables a backend to add an own, vendor defined, StateVariable to the service

@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable

should be assigned to, usually ‘0’
@ivar evented: boolean, or the special keyword ‘never’ if the variable
doesn’t show up in a LastChange event too
@ivar data_type: ‘string’,’boolean’,’bin.base64’ or
various number formats
@ivar dependant_variable: the name of another StateVariable that
depends on this one
@ivar default_value: the value this StateVariable should have by
default when created for another instance of in the service

@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside

the allowed_values list too
@ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
and ‘step’ values
@ivar moderated: boolean, True if this StateVariable should only be
evented via a LastChange event
remove_instance(instance)
render(request)

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

render_HEAD(request)

Default handling of HEAD method.

I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.

rm_notification(result, d)
server = None
set_variable(instance, variable_name, value, default=False)
simulate_notification()
warn(message, *args, **kwargs)
warning(message, *args, **kwargs)