upnp_xml.cc File Reference

#include "upnp_xml.h"
#include "server.h"
#include "cds_resource_manager.h"
#include "common.h"
#include "config_manager.h"
#include "metadata_handler.h"

Go to the source code of this file.

Functions

Ref< ElementUpnpXML_CreateResponse (String actionName, String serviceType)
 Renders XML for the action response header.
Ref< ElementUpnpXML_DIDLRenderObject (Ref< CdsObject > obj, bool renderActions, int stringLimit)
 Renders the DIDL-Lite representation of an object in the content directory.
void UpnpXML_DIDLUpdateObject (Ref< CdsObject > obj, String text)
Ref< ElementUpnpXML_CreateEventPropertySet ()
 Renders XML for the event property set.
Ref< ElementUpnpXML_RenderDeviceDescription (String presentationURL)
 Renders the device description XML.
Ref< ElementUpnpXML_DIDLRenderResource (String URL, Ref< Dictionary > attributes)
 Renders a resource tag (part of DIDL-Lite XML).

Detailed Description

Definition in file upnp_xml.cc.


Function Documentation

Ref<Element> UpnpXML_CreateEventPropertySet (  ) 

Renders XML for the event property set.

Returns:
mxml::Element representing the newly created XML.

Definition at line 186 of file upnp_xml.cc.

References _.

Referenced by ConnectionManagerService::process_subscription_request(), ContentDirectoryService::process_subscription_request(), ConnectionManagerService::subscription_update(), and ContentDirectoryService::subscription_update().

Ref<Element> UpnpXML_CreateResponse ( zmm::String  actionName,
zmm::String  serviceType 
)

Renders XML for the action response header.

Parameters:
actionName Name of the action.
serviceType Type of service.
Returns:
mxml::Element representing the newly created XML.

Basically it renders an XML that looks like the following: <u:actionNameResponse xmlns:u="serviceType"/> Further response information (various parameters, DIDL-Lite or whatever can then be adapted to it.

Definition at line 46 of file upnp_xml.cc.

References _.

Referenced by ContentDirectoryService::upnp_action_Browse(), ConnectionManagerService::upnp_action_GetCurrentConnectionIDs(), ConnectionManagerService::upnp_action_GetProtocolInfo(), ContentDirectoryService::upnp_action_GetSearchCapabilities(), ContentDirectoryService::upnp_action_GetSortCapabilities(), and ContentDirectoryService::upnp_action_GetSystemUpdateID().

Ref<Element> UpnpXML_DIDLRenderObject ( zmm::Ref< CdsObject obj,
bool  renderActions = false,
int  stringLimit = -1 
)

Renders the DIDL-Lite representation of an object in the content directory.

Parameters:
obj Object to be rendered as XML.
renderActions If true, also render special elements of an active item.
Returns:
mxml::Element representing the newly created XML.

This function looks at the object, and renders the DIDL-Lite representation of it - either a container or an item. The renderActions parameter tells us whether to also show the special fields of an active item in the XML. This is currently used when providing the XML representation of an active item to a trigger/toggle script.

Definition at line 55 of file upnp_xml.cc.

References _, CdsResourceManager::addResources(), MetadataHandler::getMetaFieldName(), getValidUTF8CutPosition(), IS_CDS_ACTIVE_ITEM, IS_CDS_CONTAINER, IS_CDS_ITEM, zmm::String::length(), M_DESCRIPTION, M_TITLE, M_TRACKNUMBER, RefCast, zmm::String::substring(), and UPNP_DEFAULT_CLASS_MUSIC_TRACK.

Referenced by FileRequestHandler::open(), and ContentDirectoryService::upnp_action_Browse().

Ref<Element> UpnpXML_DIDLRenderResource ( zmm::String  URL,
zmm::Ref< Dictionary attributes 
)

Renders a resource tag (part of DIDL-Lite XML).

Parameters:
URL download location of the item (will be child element of the <res> tag)
attributes Dictionary containing the <res> tag attributes (like resolution, etc.)

Definition at line 364 of file upnp_xml.cc.

References _.

Referenced by CdsResourceManager::addResources().

void UpnpXML_DIDLUpdateObject ( zmm::Ref< CdsObject obj,
zmm::String  text 
)
Todo:
change the text string to element, parsing should be done outside

Todo:
description should be taken from the dictionary

Definition at line 145 of file upnp_xml.cc.

References _, MetadataHandler::getMetaFieldName(), IS_CDS_ACTIVE_ITEM, M_DESCRIPTION, nil, and RefCast.

Referenced by FileRequestHandler::open().

Ref<Element> UpnpXML_RenderDeviceDescription ( zmm::String  presentationUTL = nil  ) 

Generated on Fri Mar 26 20:16:55 2010 for MediaTomb by  doxygen 1.6.1