mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp
changeset 47 63cf70d3ecd8
parent 38 48c22c726cf9
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    33 #include "mtpdevdppanic.h"
    33 #include "mtpdevdppanic.h"
    34 #include "mtpdevicedpconst.h"
    34 #include "mtpdevicedpconst.h"
    35 #include "rmtpdevicedpsingletons.h"
    35 #include "rmtpdevicedpsingletons.h"
    36 #include "cmtpdevicedpconfigmgr.h"
    36 #include "cmtpdevicedpconfigmgr.h"
    37 #include "cmtpservicemgr.h"
    37 #include "cmtpservicemgr.h"
       
    38 #include "OstTraceDefinitions.h"
       
    39 #ifdef OST_TRACE_COMPILER_IN_USE
       
    40 #include "cmtpgetdeviceinfoTraces.h"
       
    41 #endif
       
    42 
    38 
    43 
    39 // Class constants.
    44 // Class constants.
    40 __FLOG_STMT(_LIT8(KComponent,"GetDeviceInfo");)
       
    41 
    45 
    42 /**
    46 /**
    43 This identifies, in hundredths, the PTP version this device can support
    47 This identifies, in hundredths, the PTP version this device can support
    44 */
    48 */
    45 static const TUint16 KMTPStandardVersion = 100;
    49 static const TUint16 KMTPStandardVersion = 100;
    76 /**
    80 /**
    77 Destructor.
    81 Destructor.
    78 */    
    82 */    
    79 CMTPGetDeviceInfo::~CMTPGetDeviceInfo()
    83 CMTPGetDeviceInfo::~CMTPGetDeviceInfo()
    80     {    
    84     {    
    81     __FLOG(_L8("~CMTPGetDeviceInfo - Entry"));
    85     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_CMTPGETDEVICEINFO_ENTRY );
    82     delete iDeviceInfo;
    86     delete iDeviceInfo;
    83     iDpSingletons.Close();
    87     iDpSingletons.Close();
    84     iSingletons.Close();
    88     iSingletons.Close();
    85     __FLOG(_L8("~CMTPGetDeviceInfo - Exit"));
    89     OstTraceFunctionExit0( CMTPGETDEVICEINFO_CMTPGETDEVICEINFO_EXIT );
    86     __FLOG_CLOSE;
       
    87     }
    90     }
    88 
    91 
    89 /**
    92 /**
    90 Constructor.
    93 Constructor.
    91 */    
    94 */    
    98 /**
   101 /**
    99 GetDeviceInfo request handler. Build and send device info data set.
   102 GetDeviceInfo request handler. Build and send device info data set.
   100 */    
   103 */    
   101 void CMTPGetDeviceInfo::ServiceL()
   104 void CMTPGetDeviceInfo::ServiceL()
   102     {
   105     {
   103     __FLOG(_L8("ServiceL - Entry"));
   106     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SERVICEL_ENTRY );
   104     
   107     
   105     if (!iDpSingletons.DeviceDataStore().Enumerated())
   108     if (!iDpSingletons.DeviceDataStore().Enumerated())
   106         {
   109         {
   107         __FLOG(_L8("MTPExtensionReady not ready, reschedule request")); 
   110         OstTrace0(TRACE_NORMAL, CMTPGETDEVICEINFO_SERVICEL, 
       
   111                 "MTPExtensionReady not ready, reschedule request");
   108         iDpSingletons.DeviceDataStore().RegisterPendingRequest();
   112         iDpSingletons.DeviceDataStore().RegisterPendingRequest();
   109         RegisterPendingRequest();
   113         RegisterPendingRequest();
       
   114         OstTraceFunctionExit0( CMTPGETDEVICEINFO_SERVICEL_EXIT );
   110         return;
   115         return;
   111         }
   116         }
   112     
   117     
   113     BuildDeviceInfoL();
   118     BuildDeviceInfoL();
   114     SendDataL(*iDeviceInfo);
   119     SendDataL(*iDeviceInfo);
   115     __FLOG(_L8("ServiceL - Exit"));
   120     OstTraceFunctionExit0( DUP1_CMTPGETDEVICEINFO_SERVICEL_EXIT );
   116     }
   121     }
   117 
   122 
   118 /**
   123 /**
   119 Second-phase constructor.
   124 Second-phase constructor.
   120 */        
   125 */        
   121 void CMTPGetDeviceInfo::ConstructL()
   126 void CMTPGetDeviceInfo::ConstructL()
   122     {
   127     {
   123     __FLOG_OPEN(KMTPSubsystem, KComponent);
   128     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_CONSTRUCTL_ENTRY );
   124     __FLOG(_L8("ConstructL - Entry")); 
       
   125     iSingletons.OpenL();
   129     iSingletons.OpenL();
   126     iDpSingletons.OpenL(iFramework);
   130     iDpSingletons.OpenL(iFramework);
   127     iDeviceInfo = CMTPTypeDeviceInfo::NewL();
   131     iDeviceInfo = CMTPTypeDeviceInfo::NewL();
   128     __FLOG(_L8("ConstructL - Exit")); 
   132     OstTraceFunctionExit0( CMTPGETDEVICEINFO_CONSTRUCTL_EXIT );
   129     }
   133     }
   130 
   134 
   131 /**
   135 /**
   132 Populates device info data set
   136 Populates device info data set
   133 */
   137 */
   134 void CMTPGetDeviceInfo::BuildDeviceInfoL()
   138 void CMTPGetDeviceInfo::BuildDeviceInfoL()
   135     {
   139     {
   136     __FLOG(_L8("BuildDeviceInfoL - Entry")); 
   140     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_BUILDDEVICEINFOL_ENTRY );
   137     CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
   141     CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
   138     iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EStandardVersion, KMTPStandardVersion);
   142     iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EStandardVersion, KMTPStandardVersion);
   139     
   143     
   140     if(iDpSingletons.DeviceDataStore().IsConnectMac())
   144     if(iDpSingletons.DeviceDataStore().IsConnectMac())
   141         {
   145         {
   142         __FLOG(_L8("Connect Mac = ETrue"));         
   146         OstTrace0(TRACE_NORMAL, CMTPGETDEVICEINFO_BUILDDEVICEINFOL, "Connect Mac = ETrue");
   143         iDeviceInfo->SetUint32L(CMTPTypeDeviceInfo::EMTPVendorExtensionID, KMTPVendorExtensionId_Mac);
   147         iDeviceInfo->SetUint32L(CMTPTypeDeviceInfo::EMTPVendorExtensionID, KMTPVendorExtensionId_Mac);
   144         iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EMTPVersion, KMTPVersion);        
   148         iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EMTPVersion, KMTPVersion);        
   145         RBuf  mtpExtensions;
   149         RBuf  mtpExtensions;
   146         mtpExtensions.CleanupClosePushL();
   150         mtpExtensions.CleanupClosePushL();
   147         mtpExtensions.CreateL(0);
   151         mtpExtensions.CreateL(0);
   148         iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::EMTPExtensions, mtpExtensions);
   152         iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::EMTPExtensions, mtpExtensions);
   149         CleanupStack::PopAndDestroy(&mtpExtensions);
   153         CleanupStack::PopAndDestroy(&mtpExtensions);
   150         }
   154         }
   151     else
   155     else
   152         {
   156         {
   153         __FLOG(_L8("Connect Mac = EFalse")); 
   157         OstTrace0(TRACE_NORMAL, DUP1_CMTPGETDEVICEINFO_BUILDDEVICEINFOL, "Connect Mac = EFalse");
   154         iDeviceInfo->SetUint32L(CMTPTypeDeviceInfo::EMTPVendorExtensionID, KMTPVendorExtensionId);
   158         iDeviceInfo->SetUint32L(CMTPTypeDeviceInfo::EMTPVendorExtensionID, KMTPVendorExtensionId);
   155         iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EMTPVersion, KMTPVersion);        
   159         iDeviceInfo->SetUint16L(CMTPTypeDeviceInfo::EMTPVersion, KMTPVersion);        
   156         iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::EMTPExtensions, iDpSingletons.DeviceDataStore().MTPExtensions());  
   160         iDeviceInfo->SetStringL(CMTPTypeDeviceInfo::EMTPExtensions, iDpSingletons.DeviceDataStore().MTPExtensions());  
   157         }
   161         }
   158     
   162     
   166     SetSupportedOperationsL(dps);
   170     SetSupportedOperationsL(dps);
   167     SetSupportedEventsL(dps);
   171     SetSupportedEventsL(dps);
   168     SetSupportedDevicePropertiesL(dps);
   172     SetSupportedDevicePropertiesL(dps);
   169     SetSupportedCaptureFormatsL(dps);
   173     SetSupportedCaptureFormatsL(dps);
   170     SetSupportedPlaybackFormatsL(dps);
   174     SetSupportedPlaybackFormatsL(dps);
   171     
   175 
   172     __FLOG(_L8("BuildDeviceInfoL - Exit")); 
   176     OstTraceFunctionExit0( CMTPGETDEVICEINFO_BUILDDEVICEINFOL_EXIT );
   173     }
   177     }
   174 
   178 
   175 /**
   179 /**
   176 Populates the supported operations field in the device info data set
   180 Populates the supported operations field in the device info data set
   177 It enumerates the installed data provider plugins and retrieves the supported operations
   181 It enumerates the installed data provider plugins and retrieves the supported operations
   178 @param aDpController    A reference to the data provider controller
   182 @param aDpController    A reference to the data provider controller
   179 */    
   183 */    
   180 void CMTPGetDeviceInfo::SetSupportedOperationsL(CMTPDataProviderController& aDpController)
   184 void CMTPGetDeviceInfo::SetSupportedOperationsL(CMTPDataProviderController& aDpController)
   181     {
   185     {
   182     __FLOG(_L8("SetSupportedOperationsL - Entry")); 
   186     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SETSUPPORTEDOPERATIONSL_ENTRY );
   183     
   187     
   184     TInt count = aDpController.Count();    
   188     TInt count = aDpController.Count();    
   185     RArray<TUint> supportedOperations(KMTPArrayGranularity);
   189     RArray<TUint> supportedOperations(KMTPArrayGranularity);
   186     CleanupClosePushL(supportedOperations);
   190     CleanupClosePushL(supportedOperations);
   187     const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
   191     const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
   210 
   214 
   211     CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
   215     CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
   212     CleanupStack::PopAndDestroy(&supportedOperations);
   216     CleanupStack::PopAndDestroy(&supportedOperations);
   213     CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,         
   217     CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,         
   214     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EOperationsSupported, *mtpOperationsArray);
   218     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EOperationsSupported, *mtpOperationsArray);
   215     CleanupStack::PopAndDestroy(mtpOperationsArray);  
   219     CleanupStack::PopAndDestroy(mtpOperationsArray);     
   216     __FLOG(_L8("SetSupportedOperationsL - Exit"));      
   220     OstTraceFunctionExit0( CMTPGETDEVICEINFO_SETSUPPORTEDOPERATIONSL_EXIT );
   217     }
   221     }
   218 
   222 
   219 /**
   223 /**
   220 Populates the supported events field in the device info data set
   224 Populates the supported events field in the device info data set
   221 It enumerates the installed data provider plugins and retrieves the supported events
   225 It enumerates the installed data provider plugins and retrieves the supported events
   222 @param aDpController    A reference to the data provider controller
   226 @param aDpController    A reference to the data provider controller
   223 */    
   227 */    
   224 void CMTPGetDeviceInfo::SetSupportedEventsL(CMTPDataProviderController& aDpController)
   228 void CMTPGetDeviceInfo::SetSupportedEventsL(CMTPDataProviderController& aDpController)
   225     {
   229     {
   226     __FLOG(_L8("SetSupportedEventsL - Entry"));
   230     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SETSUPPORTEDEVENTSL_ENTRY );
   227     TInt count = aDpController.Count();    
   231     TInt count = aDpController.Count();    
   228     RArray<TUint> supportedEvents(KMTPArrayGranularity);
   232     RArray<TUint> supportedEvents(KMTPArrayGranularity);
   229     CleanupClosePushL(supportedEvents);
   233     CleanupClosePushL(supportedEvents);
   230     while(count--)
   234     while(count--)
   231         {
   235         {
   235     CMTPTypeArray* mtpEventArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedEvents);
   239     CMTPTypeArray* mtpEventArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedEvents);
   236     CleanupStack::PopAndDestroy(&supportedEvents);
   240     CleanupStack::PopAndDestroy(&supportedEvents);
   237     CleanupStack::PushL(mtpEventArray); //unnecessary if Set operation below does not leave,         
   241     CleanupStack::PushL(mtpEventArray); //unnecessary if Set operation below does not leave,         
   238     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EEventsSupported, *mtpEventArray);
   242     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EEventsSupported, *mtpEventArray);
   239     CleanupStack::PopAndDestroy(mtpEventArray);  
   243     CleanupStack::PopAndDestroy(mtpEventArray);  
   240     __FLOG(_L8("SetSupportedEventsL - Exit"));  
   244     OstTraceFunctionExit0( CMTPGETDEVICEINFO_SETSUPPORTEDEVENTSL_EXIT );
   241     }
   245     }
   242 
   246 
   243 /**
   247 /**
   244 Populates the supported device properties field in the device info data set
   248 Populates the supported device properties field in the device info data set
   245 */       
   249 */       
   246 void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
   250 void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
   247 	{ 
   251 	{ 
   248 	__FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));	
   252 	OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SETSUPPORTEDDEVICEPROPERTIESL_ENTRY );
   249     TInt count = aDpController.Count();    
   253     TInt count = aDpController.Count();    
   250     RArray<TUint> supportedOperations(KMTPArrayGranularity);
   254     RArray<TUint> supportedOperations(KMTPArrayGranularity);
   251     CleanupClosePushL(supportedOperations);
   255     CleanupClosePushL(supportedOperations);
   252     const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
   256     const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
   253     const TInt32 KMTPImplementationUidFileDp(0x102827B0);
   257     const TInt32 KMTPImplementationUidFileDp(0x102827B0);
   276     CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
   280     CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
   277     CleanupStack::PopAndDestroy(&supportedOperations);
   281     CleanupStack::PopAndDestroy(&supportedOperations);
   278     CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,         
   282     CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,         
   279     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, *mtpOperationsArray);
   283     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, *mtpOperationsArray);
   280     CleanupStack::PopAndDestroy(mtpOperationsArray);  
   284     CleanupStack::PopAndDestroy(mtpOperationsArray);  
   281 	
   285  
   282 	__FLOG(_L8("SetSupportedDevicePropertiesL - Exit"));  
   286 	OstTraceFunctionExit0( CMTPGETDEVICEINFO_SETSUPPORTEDDEVICEPROPERTIESL_EXIT );
   283 	}
   287 	}
   284 
   288 
   285 /**
   289 /**
   286 Populates the supported capture formats field in the device info data set
   290 Populates the supported capture formats field in the device info data set
   287 It enumerates the installed data provider plugins and retrieves the supported capture formats
   291 It enumerates the installed data provider plugins and retrieves the supported capture formats
   288 @param aDpController    A reference to the data provider controller
   292 @param aDpController    A reference to the data provider controller
   289 */    
   293 */    
   290 void CMTPGetDeviceInfo::SetSupportedCaptureFormatsL(CMTPDataProviderController& aDpController)
   294 void CMTPGetDeviceInfo::SetSupportedCaptureFormatsL(CMTPDataProviderController& aDpController)
   291     {
   295     {
   292     __FLOG(_L8("SetSupportedCaptureFormatsL - Entry"));
   296     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SETSUPPORTEDCAPTUREFORMATSL_ENTRY );
   293     TInt count = aDpController.Count();    
   297     TInt count = aDpController.Count();    
   294     RArray<TUint> supportedCaptureFormats(KMTPArrayGranularity);
   298     RArray<TUint> supportedCaptureFormats(KMTPArrayGranularity);
   295     CleanupClosePushL(supportedCaptureFormats);
   299     CleanupClosePushL(supportedCaptureFormats);
   296 //get the formt supported information from the devdp rss file
   300 //get the formt supported information from the devdp rss file
   297   //and store it into the CArrayFix by passing the reference of the array.
   301   //and store it into the CArrayFix by passing the reference of the array.
   299   CleanupClosePushL(orderedFormats);
   303   CleanupClosePushL(orderedFormats);
   300   //get the count form the formt supported struct.
   304   //get the count form the formt supported struct.
   301   TRAPD(errorCode,iDpSingletons.ConfigMgr().GetRssConfigInfoArrayL(orderedFormats, EDevDpFormats));
   305   TRAPD(errorCode,iDpSingletons.ConfigMgr().GetRssConfigInfoArrayL(orderedFormats, EDevDpFormats));
   302   if(KErrNone != errorCode)
   306   if(KErrNone != errorCode)
   303 	  {
   307 	  {
   304 	  __FLOG(_L8("There is an issue in reading format info from rss file "));
   308       OstTrace0(TRACE_WARNING, CMTPGETDEVICEINFO_SETSUPPORTEDCAPTUREFORMATSL, 
       
   309               "There is an issue in reading format info from rss file ");
   305 	  }
   310 	  }
   306 	
   311 	
   307     while(count--)
   312     while(count--)
   308         {
   313         {
   309         AddToArrayL(supportedCaptureFormats, aDpController.DataProviderByIndexL(count).SupportedCodes(EObjectCaptureFormats));
   314         AddToArrayL(supportedCaptureFormats, aDpController.DataProviderByIndexL(count).SupportedCodes(EObjectCaptureFormats));
   327 	RemoveServiceFormat(supportedCaptureFormats);
   332 	RemoveServiceFormat(supportedCaptureFormats);
   328 	
   333 	
   329 #ifdef _DEBUG
   334 #ifdef _DEBUG
   330 	for(TInt i =0 ; i < supportedCaptureFormats.Count(); i++)
   335 	for(TInt i =0 ; i < supportedCaptureFormats.Count(); i++)
   331 	{
   336 	{
   332 	__FLOG_VA((_L8("Playback formats = %d"), supportedCaptureFormats[i]));
   337     OstTrace1(TRACE_NORMAL, DUP1_CMTPGETDEVICEINFO_SETSUPPORTEDCAPTUREFORMATSL, 
       
   338             "Playback formats = %d ", supportedCaptureFormats[i]);
   333 	}
   339 	}
   334 #endif 
   340 #endif 
   335 	//before deleting make sure all the elements are added to supportedPlaybackFormats
   341 	//before deleting make sure all the elements are added to supportedPlaybackFormats
   336 	CleanupStack::PopAndDestroy(&orderedFormats);
   342 	CleanupStack::PopAndDestroy(&orderedFormats);
   337 
   343 
   338     CMTPTypeArray* mtpCaptureFormatArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedCaptureFormats);
   344     CMTPTypeArray* mtpCaptureFormatArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedCaptureFormats);
   339     CleanupStack::PopAndDestroy(&supportedCaptureFormats);
   345     CleanupStack::PopAndDestroy(&supportedCaptureFormats);
   340     CleanupStack::PushL(mtpCaptureFormatArray); //unnecessary if Set operation below does not leave,         
   346     CleanupStack::PushL(mtpCaptureFormatArray); //unnecessary if Set operation below does not leave,         
   341     iDeviceInfo->SetL(CMTPTypeDeviceInfo::ECaptureFormats, *mtpCaptureFormatArray);
   347     iDeviceInfo->SetL(CMTPTypeDeviceInfo::ECaptureFormats, *mtpCaptureFormatArray);
   342     CleanupStack::PopAndDestroy(mtpCaptureFormatArray); 
   348     CleanupStack::PopAndDestroy(mtpCaptureFormatArray); 
   343     __FLOG(_L8("SetSupportedCaptureFormatsL - Exit"));   
   349     OstTraceFunctionExit0( CMTPGETDEVICEINFO_SETSUPPORTEDCAPTUREFORMATSL_EXIT );
   344     }
   350     }
   345 
   351 
   346 /**
   352 /**
   347 Populates the supported playback formats field in the device info data set
   353 Populates the supported playback formats field in the device info data set
   348 It enumerates the installed data provider plugins and retrieves the supported playback formats
   354 It enumerates the installed data provider plugins and retrieves the supported playback formats
   349 @param aDpController    A reference to the data provider controller
   355 @param aDpController    A reference to the data provider controller
   350 */    
   356 */    
   351 void CMTPGetDeviceInfo::SetSupportedPlaybackFormatsL(CMTPDataProviderController& aDpController)
   357 void CMTPGetDeviceInfo::SetSupportedPlaybackFormatsL(CMTPDataProviderController& aDpController)
   352     {
   358     {
   353     __FLOG(_L8("SetSupportedPlaybackFormatsL - Entry"));
   359     OstTraceFunctionEntry0( CMTPGETDEVICEINFO_SETSUPPORTEDPLAYBACKFORMATSL_ENTRY );
   354     TInt count = aDpController.Count();    
   360     TInt count = aDpController.Count();    
   355     RArray<TUint> supportedPlaybackFormats(KMTPArrayGranularity);	
   361     RArray<TUint> supportedPlaybackFormats(KMTPArrayGranularity);	
   356     CleanupClosePushL(supportedPlaybackFormats);
   362     CleanupClosePushL(supportedPlaybackFormats);
   357 	
   363 	
   358     //get the formt supported information from the devdp rss file
   364     //get the formt supported information from the devdp rss file
   361     CleanupClosePushL(orderedFormats);
   367     CleanupClosePushL(orderedFormats);
   362     //get the count form the formt supported struct.
   368     //get the count form the formt supported struct.
   363     TRAPD(errorCode,iDpSingletons.ConfigMgr().GetRssConfigInfoArrayL(orderedFormats, EDevDpFormats));
   369     TRAPD(errorCode,iDpSingletons.ConfigMgr().GetRssConfigInfoArrayL(orderedFormats, EDevDpFormats));
   364 	if(KErrNone != errorCode)
   370 	if(KErrNone != errorCode)
   365 		{
   371 		{
   366 		__FLOG(_L8("There is an issue in reading format info from rss file "));
   372         OstTrace0(TRACE_WARNING, CMTPGETDEVICEINFO_SETSUPPORTEDPLAYBACKFORMATSL, 
       
   373                 "There is an issue in reading format info from rss file ");
   367 		}
   374 		}
   368 
   375 
   369     while(count--)
   376     while(count--)
   370         {
   377         {
   371         AddToArrayL(supportedPlaybackFormats, aDpController.DataProviderByIndexL(count).SupportedCodes(EObjectPlaybackFormats));       
   378         AddToArrayL(supportedPlaybackFormats, aDpController.DataProviderByIndexL(count).SupportedCodes(EObjectPlaybackFormats));       
   390  	RemoveServiceFormat(supportedPlaybackFormats);
   397  	RemoveServiceFormat(supportedPlaybackFormats);
   391  	
   398  	
   392 #ifdef _DEBUG
   399 #ifdef _DEBUG
   393 	for(TInt i =0 ; i < supportedPlaybackFormats.Count(); i++)
   400 	for(TInt i =0 ; i < supportedPlaybackFormats.Count(); i++)
   394 	{
   401 	{
   395 	__FLOG_VA((_L8("Playback formats = %d"), supportedPlaybackFormats[i]));
   402     OstTrace1(TRACE_NORMAL, DUP1_CMTPGETDEVICEINFO_SETSUPPORTEDPLAYBACKFORMATSL, 
       
   403             "Playback formats = %d ", supportedPlaybackFormats[i]);
   396 	}
   404 	}
   397 #endif 
   405 #endif 
   398     //before deleting make sure all the elements are added to supportedPlaybackFormats
   406     //before deleting make sure all the elements are added to supportedPlaybackFormats
   399     CleanupStack::PopAndDestroy(&orderedFormats);
   407     CleanupStack::PopAndDestroy(&orderedFormats);
   400 	
   408 	
   401     CMTPTypeArray* mtpPlaybackFormatArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedPlaybackFormats);    
   409     CMTPTypeArray* mtpPlaybackFormatArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedPlaybackFormats);    
   402     CleanupStack::PopAndDestroy(&supportedPlaybackFormats);
   410     CleanupStack::PopAndDestroy(&supportedPlaybackFormats);
   403     CleanupStack::PushL(mtpPlaybackFormatArray); //unnecessary if Set operation below does not leave,         
   411     CleanupStack::PushL(mtpPlaybackFormatArray); //unnecessary if Set operation below does not leave,         
   404     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EPlaybackFormats, *mtpPlaybackFormatArray);
   412     iDeviceInfo->SetL(CMTPTypeDeviceInfo::EPlaybackFormats, *mtpPlaybackFormatArray);
   405     CleanupStack::PopAndDestroy(mtpPlaybackFormatArray);  
   413     CleanupStack::PopAndDestroy(mtpPlaybackFormatArray);  
   406     __FLOG(_L8("SetSupportedPlaybackFormatsL - Exit"));  
   414     OstTraceFunctionExit0( CMTPGETDEVICEINFO_SETSUPPORTEDPLAYBACKFORMATSL_EXIT );
   407     }
   415     }
   408 
   416 
   409 /**
   417 /**
   410 Add elements from source array to the destination array without duplication
   418 Add elements from source array to the destination array without duplication
   411 @param aDestArray    The destination array
   419 @param aDestArray    The destination array
   417     for (TInt i(0); (i < count); i++)
   425     for (TInt i(0); (i < count); i++)
   418         {
   426         {
   419         // Apply filter
   427         // Apply filter
   420         if(aSrcArray[i] == EMTPOpCodeResetDevicePropValue)
   428         if(aSrcArray[i] == EMTPOpCodeResetDevicePropValue)
   421             {
   429             {
   422             __FLOG_VA((_L8("Filter ignored operation: %d"), aSrcArray[i]));
   430             OstTrace1(TRACE_NORMAL, CMTPGETDEVICEINFO_ADDTOARRAYL, "Filter ignored operation: %d", aSrcArray[i]);
   423             continue;
   431             continue;
   424             }
   432             }
   425         
   433         
   426         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   434         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   427         if ((err != KErrNone) && (err != KErrAlreadyExists))
   435         if ((err != KErrNone) && (err != KErrAlreadyExists))
   428             {
   436             {
       
   437             OstTrace1( TRACE_ERROR, DUP1_CMTPGETDEVICEINFO_ADDTOARRAYL, 
       
   438                     "Add elements from source array to the destination array error! error code %d", err );
   429             User::Leave(err);
   439             User::Leave(err);
   430             }
   440             }
   431         }
   441         }
   432     }
   442     }
   433 
   443 
   446         if(aSrcArray[i] == EMTPOpCodeGetObjectPropList ||
   456         if(aSrcArray[i] == EMTPOpCodeGetObjectPropList ||
   447            aSrcArray[i] == EMTPOpCodeSetObjectPropList||
   457            aSrcArray[i] == EMTPOpCodeSetObjectPropList||
   448            aSrcArray[i] == EMTPOpCodeSendObjectPropList ||
   458            aSrcArray[i] == EMTPOpCodeSendObjectPropList ||
   449 			aSrcArray[i] == EMTPOpCodeGetFormatCapabilities )
   459 			aSrcArray[i] == EMTPOpCodeGetFormatCapabilities )
   450             {
   460             {
   451             __FLOG_VA((_L8("Filter ignored operation: %d"), aSrcArray[i]));
   461             OstTrace1(TRACE_NORMAL, CMTPGETDEVICEINFO_ADDTOARRAYWITHFILTERL, 
       
   462                     "Filter ignored operation: %d", aSrcArray[i]);
   452             continue;
   463             continue;
   453             }
   464             }
   454 
   465 
   455         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   466         TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
   456         if ((err != KErrNone) && (err != KErrAlreadyExists))
   467         if ((err != KErrNone) && (err != KErrAlreadyExists))
   457             {
   468             {
       
   469             OstTrace1( TRACE_ERROR, DUP1_CMTPGETDEVICEINFO_ADDTOARRAYWITHFILTERL, 
       
   470                     "Add elements from source array to the destination array error! error code %d", err );
   458             User::Leave(err);
   471             User::Leave(err);
   459             }
   472             }
   460         }
   473         }
   461     }
   474     }
   462 
   475 
   463 
   476 
   464 void CMTPGetDeviceInfo::RemoveServiceFormat(RArray<TUint>& aSupportedCaptureFormats)
   477 void CMTPGetDeviceInfo::RemoveServiceFormat(RArray<TUint>& aSupportedCaptureFormats)
   465 	{
   478 	{
   466 	__FLOG(_L8("RemovetServiceFormat - Entry"));
   479 	OstTraceFunctionEntry0( CMTPGETDEVICEINFO_REMOVESERVICEFORMAT_ENTRY );
   467 	
   480 	
   468 	TInt count = aSupportedCaptureFormats.Count();
   481 	TInt count = aSupportedCaptureFormats.Count();
   469 	count--;
   482 	count--;
   470 	while(count>=0)
   483 	while(count>=0)
   471 		{
   484 		{
   472         if(iSingletons.ServiceMgr().IsServiceFormatCode( aSupportedCaptureFormats[count] ))
   485         if(iSingletons.ServiceMgr().IsServiceFormatCode( aSupportedCaptureFormats[count] ))
   473             aSupportedCaptureFormats.Remove(count);
   486             aSupportedCaptureFormats.Remove(count);
   474         count--;
   487         count--;
   475 		}
   488 		}
   476 	__FLOG(_L8("RemovetServiceFormat - Exit")); 
   489 	OstTraceFunctionExit0( CMTPGETDEVICEINFO_REMOVESERVICEFORMAT_EXIT );
   477 	}
   490 	}