mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp
changeset 49 c20dd21d1eb4
parent 29 3ae5cb0b4c02
child 52 866b4af7ffbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    21 #include <mtp/mmtpframeworkconfig.h>
    21 #include <mtp/mmtpframeworkconfig.h>
    22 #include "cmtpdevicedatastore.h"
    22 #include "cmtpdevicedatastore.h"
    23 #include "cmtpgetdevicepropvalue.h"
    23 #include "cmtpgetdevicepropvalue.h"
    24 #include "mtpdevicedpconst.h"
    24 #include "mtpdevicedpconst.h"
    25 #include "mtpdevdppanic.h"
    25 #include "mtpdevdppanic.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "cmtpgetdevicepropvalueTraces.h"
       
    29 #endif
       
    30 
    26 
    31 
    27 // Class constants.
    32 // Class constants.
    28 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
       
    29 
    33 
    30 _LIT(KSpace, " ");
    34 _LIT(KSpace, " ");
    31 
    35 
    32 /**
    36 /**
    33 Two-phase constructor.
    37 Two-phase constructor.
    49 Destructor.
    53 Destructor.
    50 should not delete iMtpArray(ownership is belong to devicedatastore)
    54 should not delete iMtpArray(ownership is belong to devicedatastore)
    51 */    
    55 */    
    52 CMTPGetDevicePropValue::~CMTPGetDevicePropValue()
    56 CMTPGetDevicePropValue::~CMTPGetDevicePropValue()
    53     {
    57     {
    54     __FLOG(_L8("~CMTPGetDevicePropValue - Entry"));
    58     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_CMTPGETDEVICEPROPVALUE_DES_ENTRY );
    55     delete iString;    
    59     delete iString;    
    56     delete iData;
    60     delete iData;
    57     //ownership of the iMtpArray pointer is belongs to devicedatastore so it should not 
    61     //ownership of the iMtpArray pointer is belongs to devicedatastore so it should not 
    58     //deleted.    
    62     //deleted.    
    59     __FLOG(_L8("~CMTPGetDevicePropValue - Exit"));
    63     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_CMTPGETDEVICEPROPVALUE_DES_EXIT );
    60     __FLOG_CLOSE;
       
    61     }
    64     }
    62 
    65 
    63 /**
    66 /**
    64 Constructor.
    67 Constructor.
    65 */    
    68 */    
    66 CMTPGetDevicePropValue::CMTPGetDevicePropValue(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    69 CMTPGetDevicePropValue::CMTPGetDevicePropValue(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
    67     CMTPGetDevicePropDesc(aFramework, aConnection)
    70     CMTPGetDevicePropDesc(aFramework, aConnection)
    68     {
    71     {
    69     
    72 
    70     }
    73     }
    71 
    74 
    72 /**
    75 /**
    73 Second-phase constructor.
    76 Second-phase constructor.
    74 */
    77 */
    75 void CMTPGetDevicePropValue::ConstructL()
    78 void CMTPGetDevicePropValue::ConstructL()
    76     {
    79     {
    77     __FLOG_OPEN(KMTPSubsystem, KComponent);
    80     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_CONSTRUCTL_ENTRY );
    78     __FLOG(_L8("ConstructL - Entry")); 
       
    79     CMTPGetDevicePropDesc::ConstructL();
    81     CMTPGetDevicePropDesc::ConstructL();
    80     iString = CMTPTypeString::NewL();
    82     iString = CMTPTypeString::NewL();
    81     __FLOG(_L8("ConstructL - Exit")); 
    83     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_CONSTRUCTL_EXIT );
    82     }
    84     }
    83 
    85 
    84 /**
    86 /**
    85 Services the battery level property.
    87 Services the battery level property.
    86 */    
    88 */    
    87 void CMTPGetDevicePropValue::ServiceBatteryLevelL()
    89 void CMTPGetDevicePropValue::ServiceBatteryLevelL()
    88     {
    90     {
    89     __FLOG(_L8("ServiceBatteryLevelL - Entry"));
    91     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEBATTERYLEVELL_ENTRY );
    90     iBatteryLevel.Set(iBatteryLevelValue);
    92     iBatteryLevel.Set(iBatteryLevelValue);
    91     SendDataL(iBatteryLevel);
    93     SendDataL(iBatteryLevel);
    92     __FLOG(_L8("ServiceBatteryLevelL - Exit"));
    94     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEBATTERYLEVELL_EXIT );
    93     }
    95     }
    94 
    96 
    95 /**
    97 /**
    96 Services the device friendly name property.
    98 Services the device friendly name property.
    97 */   
    99 */   
    98 void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
   100 void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
    99     {
   101     {
   100     __FLOG(_L8("ServiceDeviceFriendlyNameL - Entry")); 
   102     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEDEVICEFRIENDLYNAMEL_ENTRY );
   101     //if device friendly name is blank, which means it is the first time the device get connected,
   103     //if device friendly name is blank, which means it is the first time the device get connected,
   102     //, so will use "manufacture + model id" firstly; if neither manufacture nor model
   104     //, so will use "manufacture + model id" firstly; if neither manufacture nor model
   103     //id not able to be fetched by API, then use the default device friendly name     if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
   105     //id not able to be fetched by API, then use the default device friendly name     if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
   104     if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 ) 
   106     if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 ) 
   105         {
   107         {
   123     else
   125     else
   124         {
   126         {
   125         iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
   127         iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
   126         }
   128         }
   127       
   129       
   128     SendDataL(*iString);  
   130     SendDataL(*iString);   
   129     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));   
   131     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEDEVICEFRIENDLYNAMEL_EXIT );
   130     }
   132     }
   131         
   133         
   132 /**
   134 /**
   133 Services the synchronisation partner property.
   135 Services the synchronisation partner property.
   134 */ 
   136 */ 
   135 void CMTPGetDevicePropValue::ServiceSynchronisationPartnerL()
   137 void CMTPGetDevicePropValue::ServiceSynchronisationPartnerL()
   136     {
   138     {
   137     __FLOG(_L8("ServiceSynchronisationPartnerL - Entry")); 
   139     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICESYNCHRONISATIONPARTNERL_ENTRY );
   138     iString->SetL(iDpSingletons.DeviceDataStore().SynchronisationPartner());
   140     iString->SetL(iDpSingletons.DeviceDataStore().SynchronisationPartner());
   139     SendDataL(*iString);
   141     SendDataL(*iString);
   140     __FLOG(_L8("ServiceSynchronisationPartnerL - Exit"));
   142     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICESYNCHRONISATIONPARTNERL_EXIT );
   141     }
   143     }
   142 
   144 
   143 /**
   145 /**
   144 Services the ServiceSessionInitiatorVersionInfo property. 
   146 Services the ServiceSessionInitiatorVersionInfo property. 
   145 */ 
   147 */ 
   146 void CMTPGetDevicePropValue::ServiceSessionInitiatorVersionInfoL()
   148 void CMTPGetDevicePropValue::ServiceSessionInitiatorVersionInfoL()
   147    {
   149    {
   148    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry")); 
   150    OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICESESSIONINITIATORVERSIONINFOL_ENTRY );
   149    iString->SetL(iDpSingletons.DeviceDataStore().SessionInitiatorVersionInfo());
   151    iString->SetL(iDpSingletons.DeviceDataStore().SessionInitiatorVersionInfo());
   150    SendDataL(*iString);
   152    SendDataL(*iString);
   151    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
   153    OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICESESSIONINITIATORVERSIONINFOL_EXIT );
   152    }
   154    }
   153 
   155 
   154 /**
   156 /**
   155 Services the ServicePerceivedDeviceType property. 
   157 Services the ServicePerceivedDeviceType property. 
   156 */ 
   158 */ 
   157 void CMTPGetDevicePropValue::ServicePerceivedDeviceTypeL()
   159 void CMTPGetDevicePropValue::ServicePerceivedDeviceTypeL()
   158    {
   160    {
   159    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry")); 
   161    OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEPERCEIVEDDEVICETYPEL_ENTRY );
   160    iUint32.Set(iDpSingletons.DeviceDataStore().PerceivedDeviceType());
   162    iUint32.Set(iDpSingletons.DeviceDataStore().PerceivedDeviceType());
   161    SendDataL(iUint32);
   163    SendDataL(iUint32);
   162    __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
   164    OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEPERCEIVEDDEVICETYPEL_EXIT );
   163    }
   165    }
   164 
   166 
   165 /**
   167 /**
   166 Services the Date time device property. 
   168 Services the Date time device property. 
   167 */ 
   169 */ 
   168 void CMTPGetDevicePropValue::ServiceDateTimeL()
   170 void CMTPGetDevicePropValue::ServiceDateTimeL()
   169   {
   171   {
   170   __FLOG(_L8("ServiceDateTime - Entry")); 
   172   OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEDATETIMEL_ENTRY );
   171   iString->SetL(iDpSingletons.DeviceDataStore().DateTimeL());
   173   iString->SetL(iDpSingletons.DeviceDataStore().DateTimeL());
   172   SendDataL(*iString);
   174   SendDataL(*iString);
   173   __FLOG(_L8("ServiceDateTime - Exit"));
   175   OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEDATETIMEL_EXIT );
   174   }
   176   }
   175 
   177 
   176 /**
   178 /**
   177 Services the DiviceIcon property. 
   179 Services the DiviceIcon property. 
   178 */ 
   180 */ 
   179 void CMTPGetDevicePropValue::ServiceDeviceIconL()
   181 void CMTPGetDevicePropValue::ServiceDeviceIconL()
   180     {
   182     {
   181     __FLOG(_L8("DeviceIcon - Entry")); 
   183     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEDEVICEICONL_ENTRY );
   182     //iMtpArray is not owned by this class DO NOT DELET IT.
   184     //iMtpArray is not owned by this class DO NOT DELET IT.
   183     iMtpArray = &(iDpSingletons.DeviceDataStore().DeviceIcon());
   185     iMtpArray = &(iDpSingletons.DeviceDataStore().DeviceIcon());
   184     SendDataL(*iMtpArray);
   186     SendDataL(*iMtpArray);
   185     __FLOG(_L8("DeviceIcon - Exit"));
   187     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEDEVICEICONL_EXIT );
   186     }
   188     }
   187 
   189 
   188 /**
   190 /**
   189 Services the ServicePerceivedDeviceType property. 
   191 Services the ServicePerceivedDeviceType property. 
   190 */ 
   192 */ 
   191 void CMTPGetDevicePropValue::ServiceSupportedFormatsOrderedL()
   193 void CMTPGetDevicePropValue::ServiceSupportedFormatsOrderedL()
   192     {
   194     {
   193     __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Entry"));    
   195     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICESUPPORTEDFORMATSORDEREDL_ENTRY );  
   194     iUint8.Set(GetFormatOrdered());
   196     iUint8.Set(GetFormatOrdered());
   195     SendDataL(iUint8);
   197     SendDataL(iUint8);
   196     __FLOG(_L8("ServiceSessionInitiatorVersionInfo - Exit"));
   198     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICESUPPORTEDFORMATSORDEREDL_EXIT );
   197     }
   199     }
   198 
   200 
   199  void CMTPGetDevicePropValue::HandleExtnServiceL(TInt aPropCode, MExtnDevicePropDp* aExtnDevplugin)
   201  void CMTPGetDevicePropValue::HandleExtnServiceL(TInt aPropCode, MExtnDevicePropDp* aExtnDevplugin)
   200     {
   202     {
       
   203     OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_HANDLEEXTNSERVICEL_ENTRY );
   201     MMTPType* mtptype = NULL;
   204     MMTPType* mtptype = NULL;
   202     aExtnDevplugin->GetDevPropertyL((TMTPDevicePropertyCode)aPropCode, &mtptype);
   205     aExtnDevplugin->GetDevPropertyL((TMTPDevicePropertyCode)aPropCode, &mtptype);
   203 
   206 
   204     if(NULL != mtptype)
   207     if(NULL != mtptype)
   205         {
   208         {
   207         }
   210         }
   208     else
   211     else
   209         {
   212         {
   210         SendResponseL(EMTPRespCodeDevicePropNotSupported); 	
   213         SendResponseL(EMTPRespCodeDevicePropNotSupported); 	
   211         }
   214         }
       
   215     OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_HANDLEEXTNSERVICEL_EXIT );
   212     }
   216     }
   213  
   217  
   214  /*
   218  /*
   215  *Service Supported FuntionalID.
   219  *Service Supported FuntionalID.
   216  */
   220  */
   217  void CMTPGetDevicePropValue::ServiceFunctionalIDL()
   221  void CMTPGetDevicePropValue::ServiceFunctionalIDL()
   218      {
   222      {
   219      __FLOG(_L8("ServiceFuntionalIDL - Entry")); 
   223      OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_ENTRY );
   220 
   224 
   221     delete iData;
   225     delete iData;
   222     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentFuncationalID); 
   226     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentFuncationalID); 
   223     
   227     
   224      SendDataL(*iData); 
   228      SendDataL(*iData); 
   225      __FLOG(_L8("ServiceFuntionalIDL - Exit")); 
   229      OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_EXIT );
   226      }
   230      }
   227 
   231 
   228  /*
   232  /*
   229  *Service Supported ModelID.
   233  *Service Supported ModelID.
   230  */
   234  */
   231  void CMTPGetDevicePropValue::ServiceModelIDL()
   235  void CMTPGetDevicePropValue::ServiceModelIDL()
   232      {
   236      {
   233      __FLOG(_L8("ServiceModelIDL - Entry")); 
   237      OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEMODELIDL_ENTRY );
   234      
   238      
   235      delete iData;
   239      delete iData;
   236      iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentModelID); 
   240      iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentModelID); 
   237  	
   241  	
   238      SendDataL(*iData); 
   242      SendDataL(*iData); 
   239      __FLOG(_L8("ServiceModelIDL - Exit")); 
   243      OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEMODELIDL_EXIT );
   240      }
   244      }
   241 
   245 
   242  /*
   246  /*
   243  *Service Supported UseDeviceStage.
   247  *Service Supported UseDeviceStage.
   244  */
   248  */
   245  void CMTPGetDevicePropValue::ServiceUseDeviceStageL()
   249  void CMTPGetDevicePropValue::ServiceUseDeviceStageL()
   246      {
   250      {
   247      __FLOG(_L8("ServiceUseDeviceStageL - Entry")); 
   251      OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEUSEDEVICESTAGEL_ENTRY );
   248  	iUint8.Set(1);
   252  	iUint8.Set(1);
   249  	SendDataL(iUint8); 
   253  	SendDataL(iUint8); 
   250      __FLOG(_L8("ServiceUseDeviceStageL - Exit")); 
   254      OstTraceFunctionExit0( CMTPGETDEVICEPROPVALUE_SERVICEUSEDEVICESTAGEL_EXIT );
   251      }
   255      }
   252 
   256 
   253   
   257   
   254 
   258 
   255 
   259