bluetoothengine/btserviceutil/src/btdevextension.cpp
changeset 42 b72428996822
parent 31 a0ea99b6fa53
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    75     CleanupStack::Pop( dev );
    75     CleanupStack::Pop( dev );
    76     return self;
    76     return self;
    77     }
    77     }
    78 
    78 
    79 // ---------------------------------------------------------------------------
    79 // ---------------------------------------------------------------------------
       
    80 // NewLC
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C CBtDevExtension* CBtDevExtension::NewLC( 
       
    84         const TBTDevAddr& aAddr,
       
    85         const TDesC& aName,
       
    86         TDefaultDevNameOption aNameOption )
       
    87     {
       
    88     CBtDevExtension* self = new (ELeave) CBtDevExtension( aNameOption );
       
    89     CleanupStack::PushL( self );
       
    90     CBTDevice* dev = CBTDevice::NewLC( aAddr );
       
    91     if ( aName.Length() )
       
    92         {
       
    93         dev->SetDeviceNameL(  BTDeviceNameConverter::ToUTF8L( aName ) );
       
    94         }
       
    95     self->ConstructL( dev );
       
    96     CleanupStack::Pop( dev );
       
    97     return self;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
    80 // Destructor
   101 // Destructor
    81 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
    82 //
   103 //
    83 EXPORT_C CBtDevExtension::~CBtDevExtension()
   104 EXPORT_C CBtDevExtension::~CBtDevExtension()
    84     {
   105     {
   246     {
   267     {
   247     // UI takes friendly name for displaying if it is available
   268     // UI takes friendly name for displaying if it is available
   248     iAlias.Zero();
   269     iAlias.Zero();
   249     if ( iDev->IsValidFriendlyName() && iDev->FriendlyName().Length() != 0 )
   270     if ( iDev->IsValidFriendlyName() && iDev->FriendlyName().Length() != 0 )
   250         {
   271         {
   251         iAlias.CreateL( iDev->FriendlyName() );
   272         iAlias.ReAllocL(iDev->FriendlyName().Length());
       
   273         iAlias.Append(iDev->FriendlyName());
   252         }
   274         }
   253     // otherwise, device name, if it is available, will be displayed
   275     // otherwise, device name, if it is available, will be displayed
   254     else if ( iDev->IsValidDeviceName() && iDev->DeviceName().Length() != 0 )
   276     else if ( iDev->IsValidDeviceName() && iDev->DeviceName().Length() != 0 )
   255         {
   277         {
   256         iAlias.CreateL( BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName() ) );
   278         TBTDeviceName name = BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName());
       
   279         iAlias.ReAllocL(name.Length());
       
   280         iAlias.Append(name);
   257         }
   281         }
   258     if ( iAlias.Length() == 0 && 
   282     if ( iAlias.Length() == 0 && 
   259         ( iNameOption == EColonSeperatedBDAddr || iNameOption == EPlainBDAddr ) )
   283         ( iNameOption == EColonSeperatedBDAddr || iNameOption == EPlainBDAddr ) )
   260         {
   284         {
   261         // Name for display is still missing. We need to make one for user to 
   285         // Name for display is still missing. We need to make one for user to