mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp
branchRCL_3
changeset 8 bee149131e4b
parent 0 a2952bb97e68
child 9 05b0d2323768
equal deleted inserted replaced
4:d45095c2f4f3 8:bee149131e4b
    80 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
    81 //
    81 //
    82 EXPORT_C CGetObjectPropList::CGetObjectPropList( MMTPDataProviderFramework& aFramework,
    82 EXPORT_C CGetObjectPropList::CGetObjectPropList( MMTPDataProviderFramework& aFramework,
    83     MMTPConnection& aConnection,
    83     MMTPConnection& aConnection,
    84     MMmMtpDpConfig& aDpConfig ) :
    84     MMmMtpDpConfig& aDpConfig ) :
    85     CRequestProcessor( aFramework,
    85         CRequestProcessor( aFramework,
    86         aConnection,
    86             aConnection,
    87         sizeof ( KMTPGetObjectPropListPolicy ) / sizeof( TMTPRequestElementInfo ),
    87             sizeof ( KMTPGetObjectPropListPolicy ) / sizeof( TMTPRequestElementInfo ),
    88         KMTPGetObjectPropListPolicy ),
    88             KMTPGetObjectPropListPolicy ),
    89     iHandles ( KMmMtpRArrayGranularity ),
    89         iHandles ( KMmMtpRArrayGranularity ),
    90     iDpConfig( aDpConfig ),
    90         iDpConfig( aDpConfig ),
    91     iPropertyArray( KMmMtpRArrayGranularity )
    91         iPropertyArray( KMmMtpRArrayGranularity )
    92     {
    92     {
    93     PRINT( _L( "Operation: GetObjectPropList(0x9805)" ) );
    93     PRINT( _L( "Operation: GetObjectPropList(0x9805)" ) );
    94     }
    94     }
    95 
    95 
    96 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
   142     return result;
   142     return result;
   143     }
   143     }
   144 
   144 
   145 // -----------------------------------------------------------------------------
   145 // -----------------------------------------------------------------------------
   146 // CGetObjectPropList::ServiceL
   146 // CGetObjectPropList::ServiceL
   147 // service a request at request phase
   147 // GetObjectPropList request handler
   148 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   149 //
   149 //
   150 EXPORT_C void CGetObjectPropList::ServiceL()
   150 EXPORT_C void CGetObjectPropList::ServiceL()
   151     {
   151     {
   152     GetObjectHandlesL();
   152     GetObjectHandlesL();
   165     else
   165     else
   166         {
   166         {
   167         TInt err = KErrNone;
   167         TInt err = KErrNone;
   168         for ( TInt i = 0; i < numOfObjects; i++ )
   168         for ( TInt i = 0; i < numOfObjects; i++ )
   169             {
   169             {
   170             TUint32 handle = iHandles[i ];
   170             TUint32 handle = iHandles[i];
   171 
   171 
   172             if ( iFramework.ObjectMgr().ObjectOwnerId( handle )
   172             if ( iFramework.ObjectMgr().ObjectOwnerId( handle )
   173                 == iFramework.DataProviderId() )
   173                 == iFramework.DataProviderId() )
   174                 {
   174                 {
   175                 delete iObject;
   175                 delete iObject;
   185                         break;
   185                         break;
   186                     }
   186                     }
   187                 }
   187                 }
   188             }
   188             }
   189         PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceL, one property was queried, Send data to PC! err = %d" ), err );
   189         PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceL, one property was queried, Send data to PC! err = %d" ), err );
   190         if ( err == KErrNone  || err == KErrNotSupported )
   190         if ( err == KErrNone
       
   191             || ( err == KErrNotSupported && 0 < iPropertyList->NumberOfElements() ) )
       
   192             // Make sure the dataset which is returned to pc is valid
   191             SendDataL( *iPropertyList );
   193             SendDataL( *iPropertyList );
   192         else if ( err == KErrNotFound )
   194         else if ( err == KErrNotFound || err == KErrNotSupported )
       
   195             // The object entry is not in db
       
   196             // or the ONLY required metadata is not in db.
       
   197             // The second case is the same with GetObjectPropValue and device has nothing to return.
   193             SendResponseL( EMTPRespCodeAccessDenied );
   198             SendResponseL( EMTPRespCodeAccessDenied );
   194         else
   199         else
   195             SendResponseL( EMTPRespCodeGeneralError );
   200             SendResponseL( EMTPRespCodeGeneralError );
   196         }
   201         }
   197 
   202 
   198     PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceL" ) );
   203     PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceL" ) );
   199     }
   204     }
   200 
   205 
   201 // -----------------------------------------------------------------------------
   206 // -----------------------------------------------------------------------------
   202 // CGetObjectPropList::CheckFormatL
   207 // CGetObjectPropList::CheckFormatL
   203 // Ensures the object format operation parameter is valid
   208 // Ensure the object format operation parameter is valid
   204 // -----------------------------------------------------------------------------
   209 // -----------------------------------------------------------------------------
   205 //
   210 //
   206 TMTPResponseCode CGetObjectPropList::CheckFormatL() const
   211 TMTPResponseCode CGetObjectPropList::CheckFormatL() const
   207     {
   212     {
   208     TMTPResponseCode response = EMTPRespCodeOK;
   213     TMTPResponseCode response = EMTPRespCodeOK;
   221         const RArray<TUint>* format = iDpConfig.GetSupportedFormat();
   226         const RArray<TUint>* format = iDpConfig.GetSupportedFormat();
   222         TInt count = format->Count();
   227         TInt count = format->Count();
   223 
   228 
   224         for ( TInt i = 0; i < count; i++ )
   229         for ( TInt i = 0; i < count; i++ )
   225             {
   230             {
   226             if ( formatCode == (*format)[i ] )
   231             if ( formatCode == (*format)[i] )
   227                 {
   232                 {
   228                 response = EMTPRespCodeOK;
   233                 response = EMTPRespCodeOK;
   229                 break;
   234                 break;
   230                 }
   235                 }
   231             }
   236             }
   236     return response;
   241     return response;
   237     }
   242     }
   238 
   243 
   239 // -----------------------------------------------------------------------------
   244 // -----------------------------------------------------------------------------
   240 // CGetObjectPropList::CheckPropCodeL
   245 // CGetObjectPropList::CheckPropCodeL
   241 // Ensures the object prop code operation parameter is valid
   246 // Ensure the object prop code operation parameter is valid
   242 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   243 //
   248 //
   244 TMTPResponseCode CGetObjectPropList::CheckPropCodeL() const
   249 TMTPResponseCode CGetObjectPropList::CheckPropCodeL() const
   245     {
   250     {
   246     PRINT( _L( "MM MTP => CGetObjectPropList::CheckPropCode" ) );
   251     PRINT( _L( "MM MTP => CGetObjectPropList::CheckPropCode" ) );
   257         // Get group code
   262         // Get group code
   258         TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 );
   263         TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 );
   259         PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Group Code = 0x%x" ), groupCode );
   264         PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Group Code = 0x%x" ), groupCode );
   260 
   265 
   261         // check if groupCode is supported
   266         // check if groupCode is supported
   262         TInt count = sizeof ( KSupportedGroupCode )
   267         TInt count = sizeof ( KSupportedGroupCode ) / sizeof ( KSupportedGroupCode[0] );
   263             / sizeof ( KSupportedGroupCode[0] );
       
   264         TInt i = 0;
   268         TInt i = 0;
   265         for ( ; i < count; i++ )
   269         for ( ; i < count; i++ )
   266             {
   270             {
   267             if ( groupCode == KSupportedGroupCode[i ] )
   271             if ( groupCode == KSupportedGroupCode[i ] )
   268                 break;
   272                 break;
   273         }
   277         }
   274     else if ( iPropCode != KMTPAll )
   278     else if ( iPropCode != KMTPAll )
   275         {
   279         {
   276         PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Property(0x%x) was queried." ), iPropCode );
   280         PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Property(0x%x) was queried." ), iPropCode );
   277 
   281 
   278         TInt err = KErrNone;
       
   279         const RArray<TUint>* properties = NULL;
   282         const RArray<TUint>* properties = NULL;
   280         if ( formatCode == KMTPFormatsAll )
   283         if ( formatCode == KMTPFormatsAll )
   281             properties = iDpConfig.GetAllSupportedProperties();
   284             properties = iDpConfig.GetAllSupportedProperties();
   282         else
   285         else
   283             properties = iDpConfig.GetSupportedPropertiesL( formatCode );
   286             properties = iDpConfig.GetSupportedPropertiesL( formatCode );
   284 
   287 
   285         User::LeaveIfError( err );
       
   286 
       
   287         const TInt count = properties->Count();
   288         const TInt count = properties->Count();
   288         TInt i = 0;
   289         TInt i = 0;
   289         for ( i = 0; i < count; i++ )
   290         for ( i = 0; i < count; i++ )
   290             {
   291             {
   291             if ( (*properties)[i] == iPropCode )
   292             if ( (*properties)[i] == iPropCode )
   310     return response;
   311     return response;
   311     }
   312     }
   312 
   313 
   313 // -----------------------------------------------------------------------------
   314 // -----------------------------------------------------------------------------
   314 // CGetObjectPropList::CheckDepth
   315 // CGetObjectPropList::CheckDepth
   315 // Ensures the depth operation parameter is valid
   316 // Ensure the depth operation parameter is valid
   316 // -----------------------------------------------------------------------------
   317 // -----------------------------------------------------------------------------
   317 //
   318 //
   318 TMTPResponseCode CGetObjectPropList::CheckDepth() const
   319 TMTPResponseCode CGetObjectPropList::CheckDepth() const
   319     {
   320     {
   320     TMTPResponseCode response = EMTPRespCodeSpecificationByDepthUnsupported;
   321     TMTPResponseCode response = EMTPRespCodeSpecificationByDepthUnsupported;
   339     return response;
   340     return response;
   340     }
   341     }
   341 
   342 
   342 // -----------------------------------------------------------------------------
   343 // -----------------------------------------------------------------------------
   343 // CGetObjectPropList::GetObjectHandlesL
   344 // CGetObjectPropList::GetObjectHandlesL
   344 // Gets the handles for the objects that we want the properties for
   345 // Get the handles for the objects that we want the properties for
   345 // -----------------------------------------------------------------------------
   346 // -----------------------------------------------------------------------------
   346 //
   347 //
   347 void CGetObjectPropList::GetObjectHandlesL()
   348 void CGetObjectPropList::GetObjectHandlesL()
   348     {
   349     {
   349     PRINT( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL" ) );
   350     PRINT( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL" ) );
   381     PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) );
   382     PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) );
   382     }
   383     }
   383 
   384 
   384 // -----------------------------------------------------------------------------
   385 // -----------------------------------------------------------------------------
   385 // CGetObjectPropList::GetObjectHandlesL
   386 // CGetObjectPropList::GetObjectHandlesL
   386 // Gets all object handles (for GetObjectHandlesL)
   387 // Get all object handles (for GetObjectHandlesL)
   387 // -----------------------------------------------------------------------------
   388 // -----------------------------------------------------------------------------
   388 //
   389 //
   389 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId,
   390 void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId,
   390     TUint32 aParentHandle,
   391     TUint32 aParentHandle,
   391     TUint16 aFormat /*= 0x0000*/)
   392     TUint16 aFormat /*= 0x0000*/)
   510         properties = iDpConfig.GetSupportedPropertiesL( formatCode );
   511         properties = iDpConfig.GetSupportedPropertiesL( formatCode );
   511 
   512 
   512     const TInt count = properties->Count();
   513     const TInt count = properties->Count();
   513 
   514 
   514     TInt err = KErrNone;
   515     TInt err = KErrNone;
       
   516     TBool successQuery = EFalse;
   515     for ( TInt i = 0; i < count; i++ )
   517     for ( TInt i = 0; i < count; i++ )
   516         {
   518         {
   517         // no need to do the trap anymore, this is being handle internally in Media DP's ServiceSpecificObjectPropertyL, also, this base class should not know too much of different handling between different formats
   519         // no need to do the trap anymore, this is being handle internally in Media DP's ServiceSpecificObjectPropertyL,
       
   520         // also, this base class should not know too much of different handling between different formats
   518         err = ServiceOneObjectPropertyL( aHandle, (*properties)[i] );
   521         err = ServiceOneObjectPropertyL( aHandle, (*properties)[i] );
   519         if ( err == KErrNotSupported )  // Skip
   522         if ( err == KErrNone )
       
   523             successQuery = ETrue;
       
   524         if ( err == KErrNotSupported || err == KErrNotFound )  // Skip
   520             err = KErrNone;
   525             err = KErrNone;
   521         if ( err != KErrNone )
   526         if ( err != KErrNone )
   522             break;
   527             break;
   523         }
   528         }
   524 
   529 
       
   530     // In PC Suite combined mode, a file that was found at the beginning could be deleted by PC Suite protocol
       
   531     // Need to fail it here.
       
   532     if ( successQuery == EFalse )
       
   533         err = KErrNotFound;
       
   534 
   525     PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceAllPropertiesL err = %d" ), err );
   535     PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceAllPropertiesL err = %d" ), err );
   526     return err;
   536     return err;
   527     }
   537     }
   528 
   538 
       
   539 // -----------------------------------------------------------------------------
       
   540 // CGetObjectPropList::ServiceGroupPropertiesL
       
   541 // Get the grouped object properties for specific object
       
   542 // -----------------------------------------------------------------------------
       
   543 //
   529 TInt CGetObjectPropList::ServiceGroupPropertiesL( TUint32 aHandle )
   544 TInt CGetObjectPropList::ServiceGroupPropertiesL( TUint32 aHandle )
   530     {
   545     {
   531     PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceGroupPropertiesL aHandle = 0x%x" ), aHandle );
   546     PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceGroupPropertiesL aHandle = 0x%x" ), aHandle );
   532 
   547 
   533     TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) );
   548     TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) );
   543     GetPropertiesL( iPropertyArray, groupCode, formatCode );
   558     GetPropertiesL( iPropertyArray, groupCode, formatCode );
   544 
   559 
   545     const TInt count = iPropertyArray.Count();
   560     const TInt count = iPropertyArray.Count();
   546 
   561 
   547     TInt err = KErrNone;
   562     TInt err = KErrNone;
       
   563     TBool successQuery = EFalse;
   548     for ( TInt i = 0; i < count; i++ )
   564     for ( TInt i = 0; i < count; i++ )
   549         {
   565         {
   550         err = ServiceOneObjectPropertyL( aHandle, iPropertyArray[i] );
   566         err = ServiceOneObjectPropertyL( aHandle, iPropertyArray[i] );
   551         if ( err == KErrNotSupported )  // Skip
   567         if ( err == KErrNone )
       
   568             successQuery = ETrue;
       
   569         if ( err == KErrNotSupported || err == KErrNotFound )  // Skip
   552             err = KErrNone;
   570             err = KErrNone;
   553         if ( err != KErrNone )
   571         if ( err != KErrNone )
   554             break;
   572             break;
   555         }
   573         }
   556 
   574 
       
   575     // In PC Suite combined mode, a file that was found at the beginning could be deleted by PC Suite protocol
       
   576     // Need to fail it here.
       
   577     if ( successQuery == EFalse )
       
   578         err = KErrNotFound;
       
   579 
   557     PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceGroupPropertiesL err = %d" ), err );
   580     PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceGroupPropertiesL err = %d" ), err );
   558 
   581 
   559     return err;
   582     return err;
   560     }
   583     }
   561 
   584 
   562 // -----------------------------------------------------------------------------
   585 // -----------------------------------------------------------------------------
   563 // CGetObjectPropList::ServiceOneObjectPropertyL
   586 // CGetObjectPropList::ServiceOneObjectPropertyL
   564 //  Gets the object property information for the required object
   587 //  Get the object property information for the required object
   565 // -----------------------------------------------------------------------------
   588 // -----------------------------------------------------------------------------
   566 //
   589 //
   567 TInt CGetObjectPropList::ServiceOneObjectPropertyL( TUint32 aHandle,
   590 TInt CGetObjectPropList::ServiceOneObjectPropertyL( TUint32 aHandle,
   568     TUint16 aPropCode )
   591     TUint16 aPropCode )
   569     {
   592     {
   583         {
   606         {
   584         // Storage ID
   607         // Storage ID
   585         case EMTPObjectPropCodeStorageID:
   608         case EMTPObjectPropCodeStorageID:
   586             {
   609             {
   587             TMTPTypeUint32 storageId( iObject->Uint( CMTPObjectMetaData::EStorageId ) );
   610             TMTPTypeUint32 storageId( iObject->Uint( CMTPObjectMetaData::EStorageId ) );
   588             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   611             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   589             iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, storageId.Value());
   612             iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, storageId.Value() );
   590             }
   613             }
   591             break;
   614             break;
   592 
   615 
   593         // Format Code
   616         // Format Code
   594         case EMTPObjectPropCodeObjectFormat:
   617         case EMTPObjectPropCodeObjectFormat:
   595             {
   618             {
   596             TMTPTypeUint16 objectFormat( iObject->Uint( CMTPObjectMetaData::EFormatCode ) );
   619             TMTPTypeUint16 objectFormat( iObject->Uint( CMTPObjectMetaData::EFormatCode ) );
   597             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   620             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   598             iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue, objectFormat.Value());
   621             iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, objectFormat.Value() );
   599             }
   622             }
   600             break;
   623             break;
   601 
   624 
   602         // Protection Status
   625         // Protection Status
   603         case EMTPObjectPropCodeProtectionStatus:
   626         case EMTPObjectPropCodeProtectionStatus:
   604             {
   627             {
   605             TMTPTypeUint16 protectionStatus( MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(),
   628             TMTPTypeUint16 protectionStatus( MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(),
   606                 iObject->DesC( CMTPObjectMetaData::ESuid ) ) );
   629                 iObject->DesC( CMTPObjectMetaData::ESuid ) ) );
   607             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   630             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   608             iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue,  protectionStatus.Value());
   631             iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue,  protectionStatus.Value() );
   609             }
   632             }
   610             break;
   633             break;
   611 
   634 
   612         // Object Size
   635         // Object Size
   613         case EMTPObjectPropCodeObjectSize:
   636         case EMTPObjectPropCodeObjectSize:
   628             delete log;
   651             delete log;
   629             log = NULL;
   652             log = NULL;
   630 #endif // _DEBUG
   653 #endif // _DEBUG
   631             TParsePtrC parse( iObject->DesC( CMTPObjectMetaData::ESuid ) );
   654             TParsePtrC parse( iObject->DesC( CMTPObjectMetaData::ESuid ) );
   632             textData = CMTPTypeString::NewLC( parse.NameAndExt() );    // + textData
   655             textData = CMTPTypeString::NewLC( parse.NameAndExt() );    // + textData
   633             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   656             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode) );
   634             iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars());
   657             iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() );
   635             CleanupStack::PopAndDestroy( textData );    // - textData
   658             CleanupStack::PopAndDestroy( textData );    // - textData
   636             }
   659             }
   637             break;
   660             break;
   638 
   661 
   639         // Parent Object
   662         // Parent Object
   640         case EMTPObjectPropCodeParentObject:
   663         case EMTPObjectPropCodeParentObject:
   641             {
   664             {
   642             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   665             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   643             iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, iObject->Uint( CMTPObjectMetaData::EParentHandle ));
   666             iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, iObject->Uint( CMTPObjectMetaData::EParentHandle ) );
   644             }
   667             }
   645             break;
   668             break;
   646 
   669 
   647         // PUID
   670         // PUID
   648         case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   671         case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   649             {
   672             {
   650             TMTPTypeUint128 puid = iFramework.ObjectMgr().PuidL( aHandle );
   673             TMTPTypeUint128 puid = iFramework.ObjectMgr().PuidL( aHandle );
   651             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   674             iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   652             iPropertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue,puid.UpperValue(), puid.LowerValue() );
   675             iPropertyElement->SetUint128L( CMTPTypeObjectPropListElement::EValue,puid.UpperValue(), puid.LowerValue() );
   653             }
   676             }
   654             break;
   677             break;
   655 
   678 
   656         case EMTPObjectPropCodeName:
   679         case EMTPObjectPropCodeName:
   657         case EMTPObjectPropCodeDateAdded:
   680         case EMTPObjectPropCodeDateAdded:
   669                 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err );
   692                 PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err );
   670 
   693 
   671                 if ( err == KErrNone )
   694                 if ( err == KErrNone )
   672                     {
   695                     {
   673                     iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   696                     iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) );
   674                     iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars());
   697                     iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars() );
   675                     }
   698                     }
   676 
   699 
   677                 CleanupStack::PopAndDestroy( textData );  // - textData
   700                 CleanupStack::PopAndDestroy( textData );  // - textData
       
   701                 break;
   678                 }
   702                 }
   679             }
   703             // Else, video DB does not support DateAdded field, use the file system date!
   680             break;
   704             // It's the same behavior with DateCreated and DateModified.
       
   705             // Fall through intentional.
       
   706             }
   681 
   707 
   682         case EMTPObjectPropCodeDateCreated:
   708         case EMTPObjectPropCodeDateCreated:
   683         case EMTPObjectPropCodeDateModified:
   709         case EMTPObjectPropCodeDateModified:
   684             {
   710             {
   685             TTime dataModified;
   711             TTime dataModified;
   699 
   725 
   700         // Consumable Value
   726         // Consumable Value
   701         case EMTPObjectPropCodeNonConsumable:
   727         case EMTPObjectPropCodeNonConsumable:
   702             {
   728             {
   703             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   729             iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode));
   704             iPropertyElement->SetUint8L(CMTPTypeObjectPropListElement::EValue,0);
   730             iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue,
       
   731                 iObject->Uint( CMTPObjectMetaData::ENonConsumable ) );
   705             }
   732             }
   706             break;
   733             break;
   707 
   734 
   708         default:
   735         default:
   709             {
   736             {
       
   737             // "err == KErrNotFound" means the object entry does not exist in DB,
       
   738             // "err == KErrNotSupported" means the entry is there but this metadata not.
   710             err = ServiceSpecificObjectPropertyL( aPropCode, aHandle );
   739             err = ServiceSpecificObjectPropertyL( aPropCode, aHandle );
   711             }
   740             }
   712             break;
   741             break;
   713         }
   742         }
   714 
   743 
   771             SetActive();
   800             SetActive();
   772             }
   801             }
   773         }
   802         }
   774     else // all handles processed, can send data
   803     else // all handles processed, can send data
   775         {
   804         {
   776         PRINT( _L( "MM MTP <> CGetObjectPropList::RunL, Finished, Send data to PC!" ) );
   805         PRINT1( _L( "MM MTP <> CGetObjectPropList::RunL, Finished, Send data to PC!, iPropertyList->NumberOfElements() = %d" ),
       
   806             iPropertyList->NumberOfElements() );
   777         SendDataL( *iPropertyList );
   807         SendDataL( *iPropertyList );
   778         }
   808         }
   779     }
   809     }
   780 
   810 
   781 // -----------------------------------------------------------------------------
   811 // -----------------------------------------------------------------------------
   796 // Cancel the process
   826 // Cancel the process
   797 // -----------------------------------------------------------------------------
   827 // -----------------------------------------------------------------------------
   798 //
   828 //
   799 EXPORT_C void CGetObjectPropList::DoCancel()
   829 EXPORT_C void CGetObjectPropList::DoCancel()
   800     {
   830     {
   801     // TODO: need to send the data here?
       
   802     // SendDataL( *iPropertyList );
       
   803     }
   831     }
   804 
   832 
   805 void CGetObjectPropList::GetPropertiesL( RArray<TUint>& aPropArray,
   833 void CGetObjectPropList::GetPropertiesL( RArray<TUint>& aPropArray,
   806     TUint32 aGroupCode,
   834     TUint32 aGroupCode,
   807     TUint16 aFormatCode ) const
   835     TUint16 aFormatCode ) const