mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp
changeset 49 c20dd21d1eb4
parent 20 6e82ae192c3a
child 52 866b4af7ffbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    23 
    23 
    24 #include "cmtpdevicedatastore.h"
    24 #include "cmtpdevicedatastore.h"
    25 #include "cmtpresetdevicepropvalue.h"
    25 #include "cmtpresetdevicepropvalue.h"
    26 #include "mtpdevicedpconst.h"
    26 #include "mtpdevicedpconst.h"
    27 #include "mtpdevdppanic.h"
    27 #include "mtpdevdppanic.h"
       
    28 #include "mtpdebug.h"
       
    29 #include "OstTraceDefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "cmtpresetdevicepropvalueTraces.h"
       
    32 #endif
       
    33 
    28 
    34 
    29 // Class constants.
    35 // Class constants.
    30 __FLOG_STMT(_LIT8(KComponent,"ResetDevicePropValue");)
       
    31 
    36 
    32 /**
    37 /**
    33 Two-phase constructor.
    38 Two-phase constructor.
    34 @param aPlugin  The data provider plugin
    39 @param aPlugin  The data provider plugin
    35 @param aFramework The data provider framework
    40 @param aFramework The data provider framework
    48 /**
    53 /**
    49 Destructor
    54 Destructor
    50 */    
    55 */    
    51 CMTPResetDevicePropValue::~CMTPResetDevicePropValue()
    56 CMTPResetDevicePropValue::~CMTPResetDevicePropValue()
    52     {    
    57     {    
    53     __FLOG(_L8("~CMTPResetDevicePropValue - Entry"));
    58     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_CMTPRESETDEVICEPROPVALUE_DES_ENTRY );
    54         iDpSingletons.Close();
    59     iDpSingletons.Close();
    55         delete iData;
    60     delete iData;
    56         delete iRepository;
    61     delete iRepository;
    57     __FLOG(_L8("~CMTPResetDevicePropValue - Exit"));
    62     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_CMTPRESETDEVICEPROPVALUE_DES_EXIT );
    58     __FLOG_CLOSE;
       
    59     }
    63     }
    60 
    64 
    61 /**
    65 /**
    62 Standard c++ constructor
    66 Standard c++ constructor
    63 */    
    67 */    
    64 CMTPResetDevicePropValue::CMTPResetDevicePropValue(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    68 CMTPResetDevicePropValue::CMTPResetDevicePropValue(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    65  CMTPRequestProcessor(aFramework, aConnection, 0, NULL)
    69  CMTPRequestProcessor(aFramework, aConnection, 0, NULL)
    66     {
    70     {
    67     
    71 
    68     }
    72     }
    69     
    73     
    70 /**
    74 /**
    71 Second-phase construction
    75 Second-phase construction
    72 */    
    76 */    
    73 void CMTPResetDevicePropValue::ConstructL()
    77 void CMTPResetDevicePropValue::ConstructL()
    74     {
    78     {
    75     __FLOG_OPEN(KMTPSubsystem, KComponent);
    79     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_CONSTRUCTL_ENTRY );
    76     __FLOG(_L8("ConstructL - Entry")); 
       
    77     iDpSingletons.OpenL(iFramework);
    80     iDpSingletons.OpenL(iFramework);
    78 	const TUint32 KUidMTPRepositoryValue(0x10282FCC);
    81 	const TUint32 KUidMTPRepositoryValue(0x10282FCC);
    79     const TUid KUidMTPRepository = {KUidMTPRepositoryValue};
    82     const TUid KUidMTPRepository = {KUidMTPRepositoryValue};
    80     iRepository = CRepository::NewL(KUidMTPRepository);
    83     iRepository = CRepository::NewL(KUidMTPRepository);
    81     __FLOG(_L8("ConstructL - Exit")); 
    84     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_CONSTRUCTL_EXIT );
    82     }
    85     }
    83 
    86 
    84 /**
    87 /**
    85 SetDevicePropValue request validator.
    88 SetDevicePropValue request validator.
    86 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    89 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    87 */
    90 */
    88 TMTPResponseCode CMTPResetDevicePropValue::CheckRequestL()
    91 TMTPResponseCode CMTPResetDevicePropValue::CheckRequestL()
    89     {
    92     {
    90     __FLOG(_L8("CheckRequestL - Entry"));
    93     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_CHECKREQUESTL_ENTRY );
    91     TMTPResponseCode respCode(EMTPRespCodeDevicePropNotSupported);
    94     TMTPResponseCode respCode(EMTPRespCodeDevicePropNotSupported);
    92     iPropCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    95     iPropCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    93     const TInt count = sizeof(KMTPDeviceDpSupportedProperties) / sizeof(KMTPDeviceDpSupportedProperties[0]);
    96     const TInt count = sizeof(KMTPDeviceDpSupportedProperties) / sizeof(KMTPDeviceDpSupportedProperties[0]);
    94     for (TUint i(0); ((respCode != EMTPRespCodeOK) && (i < count)); i++)
    97     for (TUint i(0); ((respCode != EMTPRespCodeOK) && (i < count)); i++)
    95         {
    98         {
   101 
   104 
   102     if(iDpSingletons.DeviceDataStore().ExtnDevicePropDp())
   105     if(iDpSingletons.DeviceDataStore().ExtnDevicePropDp())
   103         {
   106         {
   104         respCode = EMTPRespCodeOK;
   107         respCode = EMTPRespCodeOK;
   105         }
   108         }
   106     __FLOG(_L8("CheckRequestL - Exit"));
   109     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_CHECKREQUESTL_EXIT );
   107     return respCode;
   110     return respCode;
   108     }
   111     }
   109 /**
   112 /**
   110 ResetDevicePropValue request handler.
   113 ResetDevicePropValue request handler.
   111 */ 	
   114 */ 	
   112 void CMTPResetDevicePropValue::ServiceL()
   115 void CMTPResetDevicePropValue::ServiceL()
   113     {
   116     {
   114     __FLOG(_L8("ServiceL - Entry"));
   117     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEL_ENTRY );
   115     iPropCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   118     iPropCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   116     MExtnDevicePropDp* extnDevplugin = iDpSingletons.DeviceDataStore().ExtnDevicePropDp();
   119     MExtnDevicePropDp* extnDevplugin = iDpSingletons.DeviceDataStore().ExtnDevicePropDp();
   117     switch (iPropCode)
   120     switch (iPropCode)
   118         {
   121         {
   119         //Added all new prpoerties here we have to add other properties that not present here*/
   122         //Added all new prpoerties here we have to add other properties that not present here*/
   153                 { 
   156                 { 
   154                 SendResponseL(EMTPRespCodeDevicePropNotSupported);
   157                 SendResponseL(EMTPRespCodeDevicePropNotSupported);
   155                 }
   158                 }
   156         break;   
   159         break;   
   157         }
   160         }
       
   161     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEL_EXIT );
   158     } 
   162     } 
   159 
   163 
   160  void CMTPResetDevicePropValue::HandleExtnServiceL(TInt aPropCode, MExtnDevicePropDp* aExtnDevplugin)
   164  void CMTPResetDevicePropValue::HandleExtnServiceL(TInt aPropCode, MExtnDevicePropDp* aExtnDevplugin)
   161     {
   165     {
   162 	  if(aExtnDevplugin->ResetDevPropertyL((TMTPDevicePropertyCode)aPropCode) == KErrNone)
   166 	  if(aExtnDevplugin->ResetDevPropertyL((TMTPDevicePropertyCode)aPropCode) == KErrNone)
   165 	  }
   169 	  }
   166 	  else
   170 	  else
   167 	  {
   171 	  {
   168 	  SendResponseL(EMTPRespCodeDevicePropNotSupported);
   172 	  SendResponseL(EMTPRespCodeDevicePropNotSupported);
   169 	  }
   173 	  }
   170     
   174 
   171     }
   175     }
   172 
   176 
   173 /**
   177 /**
   174 Service session initiator property.
   178 Service session initiator property.
   175 */ 
   179 */ 
   176 void CMTPResetDevicePropValue::ServiceSessionInitiatorVersionInfoL()
   180 void CMTPResetDevicePropValue::ServiceSessionInitiatorVersionInfoL()
   177     {  
   181     {  
   178     __FLOG(_L8("SetSessionInitiatorVersionInfo - Entry")); 
   182     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICESESSIONINITIATORVERSIONINFOL_ENTRY );
   179     iDpSingletons.DeviceDataStore().SetSessionInitiatorVersionInfoL( iDpSingletons.DeviceDataStore().SessionInitiatorVersionInfoDefault());
   183     iDpSingletons.DeviceDataStore().SetSessionInitiatorVersionInfoL( iDpSingletons.DeviceDataStore().SessionInitiatorVersionInfoDefault());
   180     SendResponseL(EMTPRespCodeOK);
   184     SendResponseL(EMTPRespCodeOK);
   181     __FLOG(_L8("SetSessionInitiatorVersionInfo - Exit"));
   185     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICESESSIONINITIATORVERSIONINFOL_EXIT );
   182     }
   186     }
   183 
   187 
   184 /**
   188 /**
   185 *Service the PerceivedDeviceType property.
   189 *Service the PerceivedDeviceType property.
   186 *it is not set type it should be removed 
   190 *it is not set type it should be removed 
   187 **/
   191 **/
   188 void CMTPResetDevicePropValue::ServicePerceivedDeviceTypeL()
   192 void CMTPResetDevicePropValue::ServicePerceivedDeviceTypeL()
   189     {  
   193     {  
   190     __FLOG(_L8("ServicePerceivedDeviceType - Entry")); 
   194     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEPERCEIVEDDEVICETYPEL_ENTRY );
   191     //PerceivedDeviceType is of type get only .
   195     //PerceivedDeviceType is of type get only .
   192     SendResponseL(EMTPRespCodeAccessDenied);
   196     SendResponseL(EMTPRespCodeAccessDenied);
   193     __FLOG(_L8("ServicePerceivedDeviceType - Exit"));
   197     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEPERCEIVEDDEVICETYPEL_EXIT );
   194     }
   198     }
   195 
   199 
   196 /**
   200 /**
   197 Service the Date Time property.
   201 Service the Date Time property.
   198 */ 
   202 */ 
   199 void CMTPResetDevicePropValue::ServiceDateTimeL()
   203 void CMTPResetDevicePropValue::ServiceDateTimeL()
   200     {  
   204     {  
   201     __FLOG(_L8("ServiceDateTime - Entry")); 
   205     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEDATETIMEL_ENTRY );
   202     SendResponseL(EMTPRespCodeOperationNotSupported);
   206     SendResponseL(EMTPRespCodeOperationNotSupported);
   203     __FLOG(_L8("ServiceDateTime - Exit"));
   207     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEDATETIMEL_EXIT );
   204     }
   208     }
   205 
   209 
   206 
   210 
   207 /*
   211 /*
   208 *Service the Device Icon property and CompleteDeviceIcon.
   212 *Service the Device Icon property and CompleteDeviceIcon.
   209 As of now implemented as device property of type get.
   213 As of now implemented as device property of type get.
   210 */   
   214 */   
   211 void CMTPResetDevicePropValue::ServiceDeviceIconL()
   215 void CMTPResetDevicePropValue::ServiceDeviceIconL()
   212     {  
   216     {  
   213     __FLOG(_L8("ServiceDeviceIcon - Entry")); 
   217     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEDEVICEICONL_ENTRY );
   214     //DeviceIcon property is implemented as get only .
   218     //DeviceIcon property is implemented as get only .
   215     SendResponseL(EMTPRespCodeAccessDenied);
   219     SendResponseL(EMTPRespCodeAccessDenied);
   216     __FLOG(_L8("ServiceDeviceIcon - Exit"));
   220     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEDEVICEICONL_EXIT );
   217     }
   221     }
   218 
   222 
   219 /*
   223 /*
   220 *ServiceSupportedFormatsOrdered property. it is get only type.
   224 *ServiceSupportedFormatsOrdered property. it is get only type.
   221 */
   225 */
   222 void CMTPResetDevicePropValue::ServiceSupportedFormatsOrderedL()
   226 void CMTPResetDevicePropValue::ServiceSupportedFormatsOrderedL()
   223     {  
   227     {  
   224     __FLOG(_L8("ServiceSupportedFormatsOrdered - Entry"));  
   228     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICESUPPORTEDFORMATSORDEREDL_ENTRY );
   225     //no need to recive this data beacuse it is Get property
   229     //no need to recive this data beacuse it is Get property
   226     //iDpSingletons.DeviceDataStore().SetFormatOrdered( iDpSingletons.DeviceDataStore().FormatOrderedDefault());
   230     //iDpSingletons.DeviceDataStore().SetFormatOrdered( iDpSingletons.DeviceDataStore().FormatOrderedDefault());
   227     SendResponseL(EMTPRespCodeAccessDenied);
   231     SendResponseL(EMTPRespCodeAccessDenied);
   228     __FLOG(_L8("ServicePerceivedDeviceType - Exit"));
   232     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICESUPPORTEDFORMATSORDEREDL_EXIT );
   229     }
   233     }
   230 
   234 
   231 /*
   235 /*
   232 *FunctionalID property. 
   236 *FunctionalID property. 
   233 */
   237 */
   234 void CMTPResetDevicePropValue::ServiceFunctionalIDL()
   238 void CMTPResetDevicePropValue::ServiceFunctionalIDL()
   235     {	 
   239     {	 
   236     __FLOG(_L8("ServiceFunctionalIDL - Entry")); 
   240     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_ENTRY );
   237     delete iData;
   241     delete iData;
   238     iData = GetGUIDL( MMTPFrameworkConfig::EDeviceDefaultFuncationalID ); 
   242     iData = GetGUIDL( MMTPFrameworkConfig::EDeviceDefaultFuncationalID ); 
   239     SaveGUID(MMTPFrameworkConfig::EDeviceCurrentFuncationalID, *iData);
   243     SaveGUID(MMTPFrameworkConfig::EDeviceCurrentFuncationalID, *iData);
   240     SendResponseL(EMTPRespCodeOK);
   244     SendResponseL(EMTPRespCodeOK);
   241     __FLOG(_L8("ServiceFunctionalIDL - Exit"));
   245     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_EXIT );
   242     }
   246     }
   243 
   247 
   244 /*
   248 /*
   245 *ModelID property. it is get only type.
   249 *ModelID property. it is get only type.
   246 */
   250 */
   247 void CMTPResetDevicePropValue::ServiceModelIDL()
   251 void CMTPResetDevicePropValue::ServiceModelIDL()
   248     {	 
   252     {	 
   249     __FLOG(_L8("ServiceModelIDL - Entry")); 	
   253     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEMODELIDL_ENTRY );
   250     SendResponseL(EMTPRespCodeAccessDenied);
   254     SendResponseL(EMTPRespCodeAccessDenied);
   251     __FLOG(_L8("ServiceModelIDL - Exit"));
   255     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEMODELIDL_EXIT );
   252     }
   256     }
   253 
   257 
   254 /*
   258 /*
   255 *UseDeviceStage property. it is get only type.
   259 *UseDeviceStage property. it is get only type.
   256 */
   260 */
   257 void CMTPResetDevicePropValue::ServiceUseDeviceStageL()
   261 void CMTPResetDevicePropValue::ServiceUseDeviceStageL()
   258     {	 
   262     {	 
   259     __FLOG(_L8("ServiceUseDeviceStageL - Entry")); 	
   263     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEUSEDEVICESTAGEL_ENTRY );
   260     SendResponseL(EMTPRespCodeAccessDenied);
   264     SendResponseL(EMTPRespCodeAccessDenied);
   261     __FLOG(_L8("ServiceUseDeviceStageL - Exit"));
   265     OstTraceFunctionExit0( CMTPRESETDEVICEPROPVALUE_SERVICEUSEDEVICESTAGEL_EXIT );
   262     }
   266     }
   263 
   267 
   264 TMTPTypeGuid* CMTPResetDevicePropValue::GetGUIDL(const TUint aKey)
   268 TMTPTypeGuid* CMTPResetDevicePropValue::GetGUIDL(const TUint aKey)
   265     {
   269     {
   266     TBuf<KGUIDFormatStringLength> buf;
   270     TBuf<KGUIDFormatStringLength> buf;
   267     
   271     
   268     User::LeaveIfError(iRepository->Get(aKey,buf));
   272     LEAVEIFERROR(iRepository->Get(aKey,buf),
       
   273             OstTrace1( TRACE_ERROR, CMTPRESETDEVICEPROPVALUE_GETGUIDL, "get from iRepository with key %d", aKey ));
   269 
   274 
   270     TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( buf );
   275     TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( buf );
   271     
   276     
   272     return ret;
   277     return ret;
   273     }
   278     }