upnpmediaserver/contentdirectoryservice/src/upnpmspathutility.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 0 7f85d04be362
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include <bautils.h>    
    19 #include <bautils.h>    
    20 #include <upnpstring.h>
    20 #include <upnpstring.h>
    21 #include <upnpdlnaprotocolinfo.h>
    21 #include <upnpdlnaprotocolinfo.h>
    22 #include <pathinfo.h>
    22 #include <pathinfo.h>
    23 #include <centralrepository.h>
    23 #include <CentralRepository.h>
    24 
    24 
    25 #include "upnpmspathutility.h"
    25 #include "upnpmspathutility.h"
    26 #include "upnpcontentdirectoryglobals.h"
    26 #include "upnpcontentdirectoryglobals.h"
    27 #include "upnpcdutils.h"
    27 #include "upnpcdutils.h"
    28 #include "upnpdominterface.h"
    28 #include "upnpdominterface.h"
    41 _LIT8( KMimeAudio,                "audio" );
    41 _LIT8( KMimeAudio,                "audio" );
    42 _LIT8( KMimeVideo,                "video" );
    42 _LIT8( KMimeVideo,                "video" );
    43 _LIT8( KMimeImage,                "image" );
    43 _LIT8( KMimeImage,                "image" );
    44 _LIT8( KMimePlaylist,             "audio/mpegurl" );
    44 _LIT8( KMimePlaylist,             "audio/mpegurl" );
    45 
    45 
    46 
    46 #if defined(__HN_31__) || defined(__HN_32__)
       
    47 const TUid KHnCRUidMediaServer = { 0x2000f87f }; //for parallel stack
       
    48 #else
    47 const TUid KCRUidMediaServer   = { 0x101F978F };
    49 const TUid KCRUidMediaServer   = { 0x101F978F };
       
    50 #endif
       
    51 
    48 const TInt KDateStringLength        = 10;
    52 const TInt KDateStringLength        = 10;
    49 const TInt KDateTimeStringLength    = 19;
    53 const TInt KDateTimeStringLength    = 19;
    50 const TInt KMaxDateStringLength     = 30;
    54 const TInt KMaxDateStringLength     = 30;
    51 
    55 
    52 // ============================ MEMBER FUNCTIONS ============================
    56 // ============================ MEMBER FUNCTIONS ============================
    80 //
    84 //
    81 CUPnPMSPathUtility* CUPnPMSPathUtility::NewLC()
    85 CUPnPMSPathUtility* CUPnPMSPathUtility::NewLC()
    82     {
    86     {
    83     CUPnPMSPathUtility* self = new( ELeave ) CUPnPMSPathUtility;
    87     CUPnPMSPathUtility* self = new( ELeave ) CUPnPMSPathUtility;
    84     CleanupStack::PushL( self );
    88     CleanupStack::PushL( self );
       
    89     #if defined(__HN_31__) || defined(__HN_32__)
       
    90     self->ConstructL( KHnCRUidMediaServer );
       
    91     #else
    85     self->ConstructL( KCRUidMediaServer );
    92     self->ConstructL( KCRUidMediaServer );
    86        return self;
    93     #endif    
       
    94     return self;
    87     }
    95     }
    88 
    96 
    89 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
    90 // CUPnPMSPathUtility::ConstructL
    98 // CUPnPMSPathUtility::ConstructL
    91 // Symbian 2nd phase constructor can leave.
    99 // Symbian 2nd phase constructor can leave.
   300         TDes& aPath, const TXmlEngElement& aItem ) const
   308         TDes& aPath, const TXmlEngElement& aItem ) const
   301     {  
   309     {  
   302     // Get the date-element
   310     // Get the date-element
   303     TXmlEngElement dateElem;
   311     TXmlEngElement dateElem;
   304     UpnpDomInterface::GetElementL( aItem, dateElem, KDate8 );
   312     UpnpDomInterface::GetElementL( aItem, dateElem, KDate8 );
       
   313     
   305     TTime date; date.HomeTime();
   314     TTime date; date.HomeTime();
   306     if ( !dateElem.IsNull( ) )
   315     TInt offsetMonthDay = 1;
       
   316     // Use date element time instead of current time,
       
   317     // if element exist
       
   318     if ( !dateElem.IsNull() )
   307         {
   319         {
   308         UPnPDateAsTTimeL( dateElem.Value(), date );
   320         UPnPDateAsTTimeL( dateElem.Value(), date );
   309         }     
   321         offsetMonthDay = 0;
       
   322         }
   310     
   323     
   311     TDateTime ymd = date.DateTime();
   324     TDateTime ymd = date.DateTime();
   312     CheckBufferSpaceL( aPath, 11 ); //4(year)+2(month)+2(day)+3(\)
   325     CheckBufferSpaceL( aPath, 11 ); //4(year)+2(month)+2(day)+3(\)
   313     
   326         
   314     aPath.AppendFormat( KYearMonthDayFormat(), 
   327     aPath.AppendFormat( KYearMonthDayFormat(), 
   315             ymd.Year(), ymd.Month()+1, ymd.Day()+1 );
   328             ymd.Year(), 
       
   329             ymd.Month() + offsetMonthDay, 
       
   330             ymd.Day() + offsetMonthDay );
   316     
   331     
   317     }
   332     }
   318 
   333 
   319 // --------------------------------------------------------------------------
   334 // --------------------------------------------------------------------------
   320 // CUPnPMSPathUtility::AppendArtistAlbumL
   335 // CUPnPMSPathUtility::AppendArtistAlbumL