UPnPItemUtility Class Reference

class UPnPItemUtility

Utility for working with classes CUpnpObject and CUpnpItem. The class provides helpers to locating elements and attributes within the class, locating the resource and the URI, decoding some special elements like dc:date, res etc.

upnpavcontrollerhelper.lib
Since
S60 3.2
Public Member Functions
IMPORT_C TBoolBelongsToClass(const CUpnpObject &, const TDesC8 &)
IMPORT_C const CUpnpAttribute *FindAttributeByName(const CUpnpElement &, const TDesC8 &)
IMPORT_C const CUpnpAttribute &FindAttributeByNameL(const CUpnpElement &, const TDesC8 &)
IMPORT_C const CUpnpElement *FindElementByName(const CUpnpObject &, const TDesC8 &)
IMPORT_C const CUpnpElement &FindElementByNameL(const CUpnpObject &, const TDesC8 &)
IMPORT_C voidGetResElements(const CUpnpObject &, RUPnPElementsArray &)
IMPORT_C const CUpnpElement &ResourceFromItemL(const CUpnpItem &)
IMPORT_C TIntUPnPDateAsTTime(const TDesC8 &, TTime &)
IMPORT_C TIntUPnPDurationAsMilliseconds(const TDesC8 &, TInt &)
Private Member Functions
voidUPnPDateAsTTimeL(const TDesC8 &, TTime &)

Member Functions Documentation

BelongsToClass(const CUpnpObject &, const TDesC8 &)

IMPORT_C TBoolBelongsToClass(const CUpnpObject &aObject,
const TDesC8 &aClass
)[static]

Tests if given object is of given class type. Note that in upnp the object classes are organised in open hierarchies, and this method will return true even if the class is unknown, if aObject's class is derived from aClass. see upnpconstantdefs.h for defined class definitions. example: TBool isPlaylist = BelongsToClass( item, KClassPlaylist );

Since
S60 3.2

Parameters

const CUpnpObject & aObjectthe object whose class is to be tested
const TDesC8 & aClassthe class (in string form) against which to test

FindAttributeByName(const CUpnpElement &, const TDesC8 &)

IMPORT_C const CUpnpAttribute *FindAttributeByName(const CUpnpElement &aElement,
const TDesC8 &aName
)[static]

Finds an attribute within an upnp element see upnpconstantdefs.h for element name definitions. example: CUpnpAttribute* s = FindAttributeByName( resElem, KAttributeSize );

Since
S60 3.2

Parameters

const CUpnpElement & aElementthe element where to look for attributes
const TDesC8 & aNameattribute name

FindAttributeByNameL(const CUpnpElement &, const TDesC8 &)

IMPORT_C const CUpnpAttribute &FindAttributeByNameL(const CUpnpElement &aElement,
const TDesC8 &aName
)[static]

Finds an attribute within an upnp element. Leaves if not found see upnpconstantdefs.h for attribute name definitions. example: TDesC& s = FindAttributeByNameL( resElem, KAttributeSize ).Value();

Since
S60 3.2

Parameters

const CUpnpElement & aElementthe element where to look for attributes
const TDesC8 & aNameattribute name

FindElementByName(const CUpnpObject &, const TDesC8 &)

IMPORT_C const CUpnpElement *FindElementByName(const CUpnpObject &aObject,
const TDesC8 &aName
)[static]

Finds an element within an object. see upnpconstantdefs.h for element name definitions. example: CUpnpElement* date = FindElementByName( item, KElementDate );

Since
S60 3.2

Parameters

const CUpnpObject & aObjectthe object where to look for elements
const TDesC8 & aNameelement name

FindElementByNameL(const CUpnpObject &, const TDesC8 &)

IMPORT_C const CUpnpElement &FindElementByNameL(const CUpnpObject &aObject,
const TDesC8 &aName
)[static]

Finds an element within an object. Leaves if not found. see upnpconstantdefs.h for element name definitions. example: TDesC& genre = FindElementByNameL( item, KElementDate ).Value();

Since
S60 3.2

Parameters

const CUpnpObject & aObjectthe object where to look for elements
const TDesC8 & aNameelement name

GetResElements(const CUpnpObject &, RUPnPElementsArray &)

IMPORT_C voidGetResElements(const CUpnpObject &aObject,
RUPnPElementsArray &aResElementsArray
)[static]

Extracts all RES elements from an item. An item can include multiple resources, for instance an item may include the same image scaled to multiple resolutions, or a music track may include the track and its CR cover art as thumbnail. example: RUPnPElementsArray array; GetResElements( array );

Since
S60 3.2

Parameters

const CUpnpObject & aObject
RUPnPElementsArray & aResElementsArray

ResourceFromItemL(const CUpnpItem &)

IMPORT_C const CUpnpElement &ResourceFromItemL(const CUpnpItem &aItem)[static]

Finds the original resource of given item. Note that if item has multiple resource elements, this API will select the original and recommended one to use. Also note that if an item includes a thumbnail or another supporting resource, this can not be used to retrieve it. Example: const TDesC& uri = ResourceFromItemL( item ).Value();

Since
S60 3.2

Parameters

const CUpnpItem & aItemUPnP item where to extract the res element.

UPnPDateAsTTime(const TDesC8 &, TTime &)

IMPORT_C TIntUPnPDateAsTTime(const TDesC8 &aUpnpDate,
TTime &aTime
)[static]

Converts given upnp date string into TTime. example: TTime time = UpnpDateAsTTime( FindElementByNameL( item, KElementDate ).Value() );

Since
S60 3.2

Parameters

const TDesC8 & aUpnpDatevalue from item's dc:date element
TTime & aTimeout variable to receive corresponding TTime

UPnPDateAsTTimeL(const TDesC8 &, TTime &)

voidUPnPDateAsTTimeL(const TDesC8 &aUpnpDate,
TTime &aTime
)[private, static]

Parameters

const TDesC8 & aUpnpDate
TTime & aTime

UPnPDurationAsMilliseconds(const TDesC8 &, TInt &)

IMPORT_C TIntUPnPDurationAsMilliseconds(const TDesC8 &aDuration,
TInt &aMilliseconds
)[static]

Converts given upnp duration or position string to a value in milliseconds. Duration was received in res element duration attribute, or in PositionInfo result from renderer. example: TInt duration = UpnpDurationAsMilliseconds( FindAttributeByNameL( ResourceFromItemL( item ), KAttributeDuration ).Value() );

Since
S60 3.2

Parameters

const TDesC8 & aDurationduration or position as string
TInt & aMillisecondsout variable to receive the result