mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp
branchRCL_3
changeset 15 f85613f12947
parent 0 d0791faffa3f
equal deleted inserted replaced
13:81da3301b632 15:f85613f12947
    25 #include "mtpdevdppanic.h"
    25 #include "mtpdevdppanic.h"
    26 
    26 
    27 // Class constants.
    27 // Class constants.
    28 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
    28 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
    29 
    29 
       
    30 _LIT(KSpace, " ");
       
    31 
    30 /**
    32 /**
    31 Two-phase constructor.
    33 Two-phase constructor.
    32 @param aPlugin  The data provider plugin
    34 @param aPlugin  The data provider plugin
    33 @param aFramework The data provider framework
    35 @param aFramework The data provider framework
    34 @param aConnection The connection from which the request comes
    36 @param aConnection The connection from which the request comes
    94 Services the device friendly name property.
    96 Services the device friendly name property.
    95 */   
    97 */   
    96 void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
    98 void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
    97     {
    99     {
    98     __FLOG(_L8("ServiceDeviceFriendlyNameL - Entry")); 
   100     __FLOG(_L8("ServiceDeviceFriendlyNameL - Entry")); 
    99     iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
   101     //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
       
   103     //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 ) 
       
   105         {
       
   106         if ( iDpSingletons.DeviceDataStore().Manufacturer().Compare(KMTPDefaultManufacturer) && 
       
   107                 iDpSingletons.DeviceDataStore().Model().Compare(KMTPDefaultModel) )
       
   108             {
       
   109             HBufC* friendlyName = HBufC::NewLC( iDpSingletons.DeviceDataStore().Manufacturer().Length()+1+  iDpSingletons.DeviceDataStore().Model().Length());
       
   110             TPtr ptrName = friendlyName->Des();
       
   111             ptrName.Copy( iDpSingletons.DeviceDataStore().Manufacturer());
       
   112             ptrName.Append(KSpace);
       
   113             ptrName.Append( iDpSingletons.DeviceDataStore().Model());
       
   114             iDpSingletons.DeviceDataStore().SetDeviceFriendlyNameL(ptrName);
       
   115             iString->SetL(ptrName);
       
   116             CleanupStack::PopAndDestroy(friendlyName);
       
   117             }
       
   118         else
       
   119             {
       
   120             iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyNameDefault());
       
   121             }
       
   122         }
       
   123     else
       
   124         {
       
   125         iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
       
   126         }
       
   127       
   100     SendDataL(*iString);  
   128     SendDataL(*iString);  
   101     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));   
   129     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));   
   102     }
   130     }
   103         
   131         
   104 /**
   132 /**