mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp
branchRCL_3
changeset 42 0aa8cc770c8a
parent 32 f85613f12947
child 43 4a793f564d72
equal deleted inserted replaced
40:453dfc402455 42:0aa8cc770c8a
   163     iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::ESerialNumber, device.SerialNumber());
   163     iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::ESerialNumber, device.SerialNumber());
   164     
   164     
   165     CMTPDataProviderController& dps(iSingletons.DpController());
   165     CMTPDataProviderController& dps(iSingletons.DpController());
   166     SetSupportedOperationsL(dps);
   166     SetSupportedOperationsL(dps);
   167     SetSupportedEventsL(dps);
   167     SetSupportedEventsL(dps);
   168     SetSupportedDevicePropertiesL();
   168     SetSupportedDevicePropertiesL(dps);
   169     SetSupportedCaptureFormatsL(dps);
   169     SetSupportedCaptureFormatsL(dps);
   170     SetSupportedPlaybackFormatsL(dps);
   170     SetSupportedPlaybackFormatsL(dps);
   171     
   171     
   172     __FLOG(_L8("BuildDeviceInfoL - Exit")); 
   172     __FLOG(_L8("BuildDeviceInfoL - Exit")); 
   173     }
   173     }
   241     }
   241     }
   242 
   242 
   243 /**
   243 /**
   244 Populates the supported device properties field in the device info data set
   244 Populates the supported device properties field in the device info data set
   245 */       
   245 */       
   246 void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL()
   246 void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
   247 	{ 
   247 	{ 
   248 	__FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));  
   248 	__FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));	
   249 	iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, 
   249     TInt count = aDpController.Count();    
   250 	iDpSingletons.DeviceDataStore().GetSupportedDeviceProperties());
   250     RArray<TUint> supportedOperations(KMTPArrayGranularity);
       
   251     CleanupClosePushL(supportedOperations);
       
   252     const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
       
   253     const TInt32 KMTPImplementationUidFileDp(0x102827B0);
       
   254     const TInt32 KMTPImplementationUidProxyDp(0x102827B1);
       
   255     const TInt32 KMTPFrameworkDpCount(3);
       
   256     TBool bOnlyInternalDpLoad = count > KMTPFrameworkDpCount ? EFalse : ETrue;
       
   257     while(count--)
       
   258         {
       
   259         TInt32 uid = aDpController.DataProviderByIndexL(count).ImplementationUid().iUid;
       
   260         // The filter is added for licencee's request which will filtrate the symbian's internal
       
   261         // dp's supported enhance mode operations to make licencee's dp work.
       
   262         // Every new internal dp need add it's implementation id here to filtrate and increase
       
   263         // the KMTPFrameworkDpCount number.
       
   264         if ((uid == KMTPImplementationUidDeviceDp ||
       
   265             uid == KMTPImplementationUidFileDp ||
       
   266             uid == KMTPImplementationUidProxyDp) && !bOnlyInternalDpLoad)
       
   267             {
       
   268             AddToArrayWithFilterL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
       
   269             }
       
   270         else
       
   271             {
       
   272             AddToArrayL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
       
   273             }
       
   274         }
       
   275 
       
   276     CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
       
   277     CleanupStack::PopAndDestroy(&supportedOperations);
       
   278     CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,         
       
   279     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, *mtpOperationsArray);
       
   280     CleanupStack::PopAndDestroy(mtpOperationsArray);  
       
   281 	
   251 	__FLOG(_L8("SetSupportedDevicePropertiesL - Exit"));  
   282 	__FLOG(_L8("SetSupportedDevicePropertiesL - Exit"));  
   252 	}
   283 	}
   253 
   284 
   254 /**
   285 /**
   255 Populates the supported capture formats field in the device info data set
   286 Populates the supported capture formats field in the device info data set
   383 void CMTPGetDeviceInfo::AddToArrayL(RArray<TUint>& aDestArray, const RArray<TUint>& aSrcArray) const
   414 void CMTPGetDeviceInfo::AddToArrayL(RArray<TUint>& aDestArray, const RArray<TUint>& aSrcArray) const
   384     {
   415     {
   385     TInt count(aSrcArray.Count());
   416     TInt count(aSrcArray.Count());
   386     for (TInt i(0); (i < count); i++)
   417     for (TInt i(0); (i < count); i++)
   387         {
   418         {
       
   419         // Apply filter
       
   420         if(aSrcArray[i] == EMTPOpCodeResetDevicePropValue)
       
   421             {
       
   422             __FLOG_VA((_L8("Filter ignored operation: %d"), aSrcArray[i]));
       
   423             continue;
       
   424             }
       
   425         
   388         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   426         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   389         if ((err != KErrNone) && (err != KErrAlreadyExists))
   427         if ((err != KErrNone) && (err != KErrAlreadyExists))
   390             {
   428             {
   391             User::Leave(err);
   429             User::Leave(err);
   392             }
   430             }