mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp
branchRCL_3
changeset 32 f85613f12947
parent 14 60a94a45d437
child 47 63cf70d3ecd8
equal deleted inserted replaced
27:81da3301b632 32:f85613f12947
    33 #include "cmtpdevicedpconfigmgr.h"
    33 #include "cmtpdevicedpconfigmgr.h"
    34 
    34 
    35 // Class constants.
    35 // Class constants.
    36 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropDesc");)
    36 __FLOG_STMT(_LIT8(KComponent,"GetDevicePropDesc");)
    37 
    37 
       
    38 _LIT(KSpace, " ");
       
    39 
    38 /**
    40 /**
    39 Two-phase constructor.
    41 Two-phase constructor.
    40 @param aPlugin The data provider plugin
    42 @param aPlugin The data provider plugin
    41 @param aFramework The data provider framework
    43 @param aFramework The data provider framework
    42 @param aConnection The connection from which the request comes
    44 @param aConnection The connection from which the request comes
   271     iPropDesc = NULL;
   273     iPropDesc = NULL;
   272     iPropDesc = CMTPTypeDevicePropDesc::NewL(EMTPDevicePropCodeDeviceFriendlyName);
   274     iPropDesc = CMTPTypeDevicePropDesc::NewL(EMTPDevicePropCodeDeviceFriendlyName);
   273     
   275     
   274     CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
   276     CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
   275     iPropDesc->SetStringL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, device.DeviceFriendlyNameDefault());
   277     iPropDesc->SetStringL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, device.DeviceFriendlyNameDefault());
   276     iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
   278     
       
   279     //if device friendly name is blank, which means it is the first time the device get connected,
       
   280     //, so will use "manufacture + model id" firstly; if neither manufacture nor model
       
   281     //id not able to be fetched by API, then use the default device friendly name 
       
   282     if ( device.DeviceFriendlyName().Length()<=0 )
       
   283         {
       
   284         if ( device.Manufacturer().Compare(KMTPDefaultManufacturer) && device.Model().Compare(KMTPDefaultModel) )
       
   285             {
       
   286             HBufC* friendlyName = HBufC::NewLC(device.Manufacturer().Length()+1+ device.Model().Length());
       
   287             TPtr ptrName = friendlyName->Des();
       
   288             ptrName.Copy(device.Manufacturer());
       
   289             ptrName.Append(KSpace);
       
   290             ptrName.Append(device.Model());
       
   291             device.SetDeviceFriendlyNameL(ptrName);
       
   292             iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, ptrName);
       
   293             CleanupStack::PopAndDestroy(friendlyName);
       
   294             }
       
   295         else
       
   296             {
       
   297             iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyNameDefault());
       
   298             }
       
   299         }
       
   300     else
       
   301         {
       
   302         iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
       
   303         }
   277     
   304     
   278     SendDataL(*iPropDesc);    
   305     SendDataL(*iPropDesc);    
   279     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit")); 
   306     __FLOG(_L8("ServiceDeviceFriendlyNameL - Exit")); 
   280     }
   307     }
   281         
   308