mtpdataproviders/mtpimagedp/src/mtpimagedpgetformatcapabilities.cpp
changeset 49 c20dd21d1eb4
parent 18 1b39655331a3
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    24 #include <mtp/mmtpdataproviderframework.h>
    24 #include <mtp/mmtpdataproviderframework.h>
    25 #include <mtp/cmtptypestring.h>
    25 #include <mtp/cmtptypestring.h>
    26 
    26 
    27 #include "cmtpimagedpgetformatcapabilities.h"
    27 #include "cmtpimagedpgetformatcapabilities.h"
    28 #include "cmtpimagedp.h"
    28 #include "cmtpimagedp.h"
    29 
    29 #include "OstTraceDefinitions.h"
    30 __FLOG_STMT(_LIT8(KComponent,"ImageDpGetFormatCapabilities");)
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "mtpimagedpgetformatcapabilitiesTraces.h"
       
    32 #endif
       
    33 
       
    34 
    31 MMTPRequestProcessor* CMTPImageDpGetFormatCapabilities::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection,CMTPImageDataProvider& /*aDataProvider*/)
    35 MMTPRequestProcessor* CMTPImageDpGetFormatCapabilities::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection,CMTPImageDataProvider& /*aDataProvider*/)
    32     {
    36     {
    33     CMTPImageDpGetFormatCapabilities* self = new (ELeave) CMTPImageDpGetFormatCapabilities(aFramework, aConnection);
    37     CMTPImageDpGetFormatCapabilities* self = new (ELeave) CMTPImageDpGetFormatCapabilities(aFramework, aConnection);
    34     CleanupStack::PushL(self);
    38     CleanupStack::PushL(self);
    35     self->ConstructL();
    39     self->ConstructL();
    37     return self;
    41     return self;
    38     }
    42     }
    39     
    43     
    40 CMTPImageDpGetFormatCapabilities::~CMTPImageDpGetFormatCapabilities()
    44 CMTPImageDpGetFormatCapabilities::~CMTPImageDpGetFormatCapabilities()
    41     {
    45     {
    42     __FLOG(_L8(">> ~CMTPPictureDpGetObject"));
    46     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_CMTPIMAGEDPGETFORMATCAPABILITIES_ENTRY );
    43     delete iCapabilityList;
    47     delete iCapabilityList;
    44     __FLOG(_L8("<< ~CMTPPictureDpGetObject"));
    48     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_CMTPIMAGEDPGETFORMATCAPABILITIES_EXIT );
    45     __FLOG_CLOSE;
       
    46     }
    49     }
    47 
    50 
    48 void CMTPImageDpGetFormatCapabilities::ServiceL()
    51 void CMTPImageDpGetFormatCapabilities::ServiceL()
    49     {
    52     {
    50     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::ServiceL"));
    53     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEL_ENTRY );
    51     delete iCapabilityList;
    54     delete iCapabilityList;
    52     iCapabilityList = NULL;
    55     iCapabilityList = NULL;
    53     iCapabilityList = CMTPTypeFormatCapabilityList::NewL();
    56     iCapabilityList = CMTPTypeFormatCapabilityList::NewL();
    54     
    57     
    55     if (iFormatCode == KMTPFormatsAll)
    58     if (iFormatCode == KMTPFormatsAll)
    64         {
    67         {
    65         ServiceOneFormatCapabilitiesL(iFormatCode);
    68         ServiceOneFormatCapabilitiesL(iFormatCode);
    66         }
    69         }
    67 
    70 
    68     SendDataL(*iCapabilityList); 
    71     SendDataL(*iCapabilityList); 
    69     __FLOG(_L8("<< CMTPPictureDpGetFormatCapabilities::ServiceL"));   
    72     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEL_EXIT );
    70     }
    73     }
    71     
    74     
    72 void CMTPImageDpGetFormatCapabilities::ServiceOneFormatCapabilitiesL(TUint aFormatCode)
    75 void CMTPImageDpGetFormatCapabilities::ServiceOneFormatCapabilitiesL(TUint aFormatCode)
    73     {
    76     {
    74     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::BuildFormatExifJpegL"));
    77     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEONEFORMATCAPABILITIESL_ENTRY );
    75     CMTPTypeInterdependentPropDesc*  interDesc = CMTPTypeInterdependentPropDesc::NewLC();
    78     CMTPTypeInterdependentPropDesc*  interDesc = CMTPTypeInterdependentPropDesc::NewLC();
    76     CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewLC(aFormatCode, interDesc);
    79     CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewLC(aFormatCode, interDesc);
    77     
    80     
    78     //EMTPObjectPropCodeStorageID
    81     //EMTPObjectPropCodeStorageID
    79     CMTPTypeObjectPropDesc* desc = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeStorageID);
    82     CMTPTypeObjectPropDesc* desc = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeStorageID);
   130     CleanupStack::Pop(1, desc);
   133     CleanupStack::Pop(1, desc);
   131     
   134     
   132     //EMTPObjectPropCodeNonConsumable
   135     //EMTPObjectPropCodeNonConsumable
   133     frmCap->AppendL(ServiceNonConsumableL() );
   136     frmCap->AppendL(ServiceNonConsumableL() );
   134     
   137     
   135     
   138     //EMTPObjectPropCodeHidden
       
   139     frmCap->AppendL( ServiceHiddenL() ); 
   136     
   140     
   137     CMTPTypeObjectPropDesc::TPropertyInfo info;
   141     CMTPTypeObjectPropDesc::TPropertyInfo info;
   138     info.iDataType     = EMTPTypeString;
   142     info.iDataType     = EMTPTypeString;
   139     info.iFormFlag     = CMTPTypeObjectPropDesc::EDateTimeForm;
   143     info.iFormFlag     = CMTPTypeObjectPropDesc::EDateTimeForm;
   140     info.iGetSet       = CMTPTypeObjectPropDesc::EReadOnly;
   144     info.iGetSet       = CMTPTypeObjectPropDesc::EReadOnly;
   208     CleanupStack::PopAndDestroy(expectedEnumForm);
   212     CleanupStack::PopAndDestroy(expectedEnumForm);
   209     
   213     
   210     iCapabilityList->AppendL(frmCap);
   214     iCapabilityList->AppendL(frmCap);
   211     CleanupStack::Pop(frmCap);
   215     CleanupStack::Pop(frmCap);
   212     CleanupStack::Pop(interDesc);
   216     CleanupStack::Pop(interDesc);
   213     __FLOG(_L8("<< CMTPPictureDpGetFormatCapabilities::BuildFormatExifJpegL"));
   217     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEONEFORMATCAPABILITIESL_EXIT );
   214     }
   218     }
   215 
   219 
   216 
   220 
   217 CMTPTypeObjectPropDesc* CMTPImageDpGetFormatCapabilities::ServiceProtectionStatusL()
   221 CMTPTypeObjectPropDesc* CMTPImageDpGetFormatCapabilities::ServiceProtectionStatusL()
   218     {
   222     {
   219     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::ServiceProtectionStatusL"));
   223     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEPROTECTIONSTATUSL_ENTRY );
   220     CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT16);
   224     CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT16);
   221     CleanupStack::PushL(expectedForm);
   225     CleanupStack::PushL(expectedForm);
   222     //Currently, we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
   226     //Currently, we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
   223 //  TUint16 values[] = {EMTPProtectionNoProtection, EMTPProtectionReadOnly, EMTPProtectionReadOnlyData, EMTPProtectionNonTransferable};
   227 //  TUint16 values[] = {EMTPProtectionNoProtection, EMTPProtectionReadOnly, EMTPProtectionReadOnlyData, EMTPProtectionNonTransferable};
   224     TUint16 values[] = {EMTPProtectionNoProtection, EMTPProtectionReadOnly};
   228     TUint16 values[] = {EMTPProtectionNoProtection, EMTPProtectionReadOnly};
   230         }
   234         }
   231     CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeProtectionStatus, *expectedForm);
   235     CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeProtectionStatus, *expectedForm);
   232     ret->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(EMTPObjectPropCodeProtectionStatus));
   236     ret->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(EMTPObjectPropCodeProtectionStatus));
   233     CleanupStack::Pop(1, ret);
   237     CleanupStack::Pop(1, ret);
   234     CleanupStack::PopAndDestroy(expectedForm);
   238     CleanupStack::PopAndDestroy(expectedForm);
   235     __FLOG(_L8("<< CMTPPictureDpGetFormatCapabilities::ServiceProtectionStatusL"));
   239     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICEPROTECTIONSTATUSL_EXIT );
   236     return ret;
   240     return ret;
   237    
   241    
   238     }
   242     }
   239 
   243 
   240 CMTPTypeObjectPropDesc* CMTPImageDpGetFormatCapabilities::ServiceNonConsumableL()
   244 CMTPTypeObjectPropDesc* CMTPImageDpGetFormatCapabilities::ServiceNonConsumableL()
   241     {
   245     {
   242     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::ServiceNonConsumableL"));
   246     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICENONCONSUMABLEL_ENTRY );
   243     CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8);
   247     CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT8);
   244     CleanupStack::PushL(expectedForm);
   248     CleanupStack::PushL(expectedForm);
   245     TUint8 values[] = {0,1};
   249     TUint8 values[] = {0,1};
   246     TUint   numValues((sizeof(values) / sizeof(values[0])));
   250     TUint   numValues((sizeof(values) / sizeof(values[0])));
   247     for (TUint i = 0; i < numValues; i++)
   251     for (TUint i = 0; i < numValues; i++)
   251         }   
   255         }   
   252     CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeNonConsumable, *expectedForm);
   256     CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeNonConsumable, *expectedForm);
   253     ret->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(EMTPObjectPropCodeNonConsumable));
   257     ret->SetUint32L(CMTPTypeObjectPropDesc::EGroupCode, GetPropertyGroupNumber(EMTPObjectPropCodeNonConsumable));
   254     CleanupStack::Pop(1, ret);
   258     CleanupStack::Pop(1, ret);
   255     CleanupStack::PopAndDestroy(expectedForm);
   259     CleanupStack::PopAndDestroy(expectedForm);
   256     __FLOG(_L8("<< CMTPPictureDpGetFormatCapabilities::ServiceNonConsumableL"));
   260     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_SERVICENONCONSUMABLEL_EXIT );
   257     return ret;
   261     return ret;
   258     }
   262     }
   259 
   263 
   260 
   264 
   261 TMTPResponseCode CMTPImageDpGetFormatCapabilities::CheckRequestL()
   265 TMTPResponseCode CMTPImageDpGetFormatCapabilities::CheckRequestL()
   262     {
   266     {
   263     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::CheckRequestL"));
   267     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_CHECKREQUESTL_ENTRY );
   264     TMTPResponseCode response = EMTPRespCodeOK;
   268     TMTPResponseCode response = EMTPRespCodeOK;
   265     iFormatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   269     iFormatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   266     
   270     
   267     if (iFormatCode != KMTPFormatsAll)
   271     if (iFormatCode != KMTPFormatsAll)
   268         {
   272         {
   274                 {
   278                 {
   275                 response = EMTPRespCodeOK;
   279                 response = EMTPRespCodeOK;
   276                 break;
   280                 break;
   277                 }
   281                 }
   278             }        
   282             }        
   279         }
   283         } 
   280     __FLOG_VA((_L8("<< CMTPPictureDpGetFormatCapabilities::CheckRequestL - response = 0x%x"), response));   
   284     OstTrace1( TRACE_NORMAL, CMTPIMAGEDPGETFORMATCAPABILITIES_CHECKREQUESTL, "response = 0x%x", response );    
       
   285     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_CHECKREQUESTL_EXIT );
       
   286     
   281     return response; 
   287     return response; 
   282     }
   288     }
   283     
   289     
   284 
   290 
   285 CMTPImageDpGetFormatCapabilities::CMTPImageDpGetFormatCapabilities(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
   291 CMTPImageDpGetFormatCapabilities::CMTPImageDpGetFormatCapabilities(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
   287     {
   293     {
   288     }
   294     }
   289     
   295     
   290 void CMTPImageDpGetFormatCapabilities::ConstructL()
   296 void CMTPImageDpGetFormatCapabilities::ConstructL()
   291     {
   297     {
   292     __FLOG_OPEN(KMTPSubsystem, KComponent);
   298     OstTraceFunctionEntry0( CMTPIMAGEDPGETFORMATCAPABILITIES_CONSTRUCTL_ENTRY );
   293     __FLOG(_L8(">> CMTPPictureDpGetFormatCapabilities::ConstructL"));
   299     OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_CONSTRUCTL_EXIT );
   294     __FLOG(_L8("<< CMTPPictureDpGetFormatCapabilities::ConstructL"));
   300     }
   295     }
   301 
   296 
   302 CMTPTypeObjectPropDesc* CMTPImageDpGetFormatCapabilities::ServiceHiddenL()
       
   303     {
       
   304     CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL(EMTPTypeUINT16);
       
   305     CleanupStack::PushL(expectedForm);
       
   306     TUint16 values[] = {EMTPVisible, EMTPHidden};
       
   307     TUint   numValues((sizeof(values) / sizeof(values[0])));
       
   308     for (TUint i = 0; i < numValues; i++)
       
   309         {
       
   310         TMTPTypeUint16 data(values[i]);
       
   311         expectedForm->AppendSupportedValueL(data);
       
   312         }   
       
   313     CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeHidden, *expectedForm);     
       
   314     CleanupStack::PopAndDestroy(expectedForm);
       
   315     return ret;
       
   316     }
       
   317 	
   297 TUint16 CMTPImageDpGetFormatCapabilities::GetPropertyGroupNumber(const TUint16 aPropCode) const
   318 TUint16 CMTPImageDpGetFormatCapabilities::GetPropertyGroupNumber(const TUint16 aPropCode) const
   298     {
   319     {
   299     for( TInt propCodeIndex = 0 ; propCodeIndex < KMTPImageDpGroupOneSize ; propCodeIndex++)
   320     for( TInt propCodeIndex = 0 ; propCodeIndex < KMTPImageDpGroupOneSize ; propCodeIndex++)
   300         {
   321         {
   301             if(KMTPImageDpGroupOneProperties[propCodeIndex] == aPropCode)
   322             if(KMTPImageDpGroupOneProperties[propCodeIndex] == aPropCode)
   302                 {
   323                 {
       
   324                 OstTraceFunctionExit0( CMTPIMAGEDPGETFORMATCAPABILITIES_GETPROPERTYGROUPNUMBER_EXIT );
   303                 return KMTPImageDpPropertyGroupOneNumber;
   325                 return KMTPImageDpPropertyGroupOneNumber;
   304                 }
   326                 }
   305         }
   327         }
   306     
   328     
   307     // if not foud, the group number should be 0.
   329     // if not foud, the group number should be 0.