bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp
branchRCL_3
changeset 22 613943a21004
equal deleted inserted replaced
21:0ba996a9b75d 22:613943a21004
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <btextnotifiers.h>
       
    20 #include <btservices/advancedevdiscoverer.h>
       
    21 #include <btservices/btdevextension.h>
       
    22 #include <hb/hbcore/hbdevicedialogsymbian.h>
       
    23 #include "btnotifdeviceselector.h"
       
    24 
       
    25 #include "btnotifserver.h"
       
    26 #include "btnotificationmanager.h"
       
    27 #include "btnotifclientserver.h"
       
    28 // Key description length
       
    29 const TInt KMaxKeyDesCLength  = 20;
       
    30 
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // C++ default constructor
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CBTNotifDeviceSelector::CBTNotifDeviceSelector( CBTNotifServer& aServer )
       
    38 :   iServer( aServer )
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // Symbian 2nd-phase constructor
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CBTNotifDeviceSelector::ConstructL()
       
    48     {
       
    49     iServer.DevRepository().AddObserverL(this);
       
    50     iDiscoverer = CAdvanceDevDiscoverer::NewL( iServer.DevRepository(), *this );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // NewL.
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CBTNotifDeviceSelector* CBTNotifDeviceSelector::NewL( CBTNotifServer& aServer )
       
    58     {
       
    59     CBTNotifDeviceSelector* self = new( ELeave ) CBTNotifDeviceSelector( aServer );
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // Destructor
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CBTNotifDeviceSelector::~CBTNotifDeviceSelector()
       
    71     {
       
    72     iServer.DevRepository().RemoveObserver(this);
       
    73     if( iNotification )
       
    74         {
       
    75         // Clear the notification callback, we cannot receive them anymore.
       
    76         iNotification->RemoveObserver();
       
    77         iNotification->Close(); // Also dequeues the notification from the queue.
       
    78         iNotification = NULL;
       
    79         }
       
    80     iDevices.ResetAndDestroy();
       
    81     iDevices.Close();
       
    82     delete iDiscoverer;
       
    83     
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // Process a client message related to notifiers.
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CBTNotifDeviceSelector::DispatchNotifierMessageL( const RMessage2& aMessage )
       
    91     {
       
    92     BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() );
       
    93     TInt opcode = aMessage.Function();
       
    94     TInt uid = aMessage.Int0();
       
    95     switch ( opcode ) 
       
    96         {
       
    97         case EBTNotifCancelNotifier:
       
    98             {
       
    99             // We only accept a cancel message from the same session as the original
       
   100             // request (this is enforced by the RNotifier backend).
       
   101             TInt err( KErrNotFound );
       
   102             if ( !iMessage.IsNull() && opcode == iMessage.Function() && 
       
   103                     aMessage.Session() == iMessage.Session() )
       
   104                 {
       
   105                 iMessage.Complete( KErrCancel );
       
   106                 err = KErrNone;
       
   107                 }
       
   108             aMessage.Complete( err );
       
   109             break;
       
   110             }
       
   111         case EBTNotifUpdateNotifier:
       
   112             {
       
   113             // not handling so far
       
   114             break;
       
   115             }
       
   116         case EBTNotifStartSyncNotifier:
       
   117             {
       
   118             // synch version of device searching is not supported:
       
   119             aMessage.Complete( KErrNotSupported );
       
   120             break;
       
   121             }
       
   122         case EBTNotifStartAsyncNotifier:
       
   123             {
       
   124             if ( !iMessage.IsNull() )
       
   125                 {
       
   126                 aMessage.Complete( KErrServerBusy );
       
   127                 return;
       
   128                 }
       
   129             
       
   130             iLoadDevices = EFalse;
       
   131             if(iServer.DevRepository().IsInitialized())
       
   132                 {
       
   133                 iLoadDevices = ETrue;
       
   134                 if(iServer.DevRepository().AllDevices().Count()==0)
       
   135                      {
       
   136                      PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource);
       
   137                      iDevices.ResetAndDestroy();
       
   138                      iDiscoverer->DiscoverDeviceL();
       
   139                      }
       
   140                 else
       
   141                      {
       
   142                      iDevices.ResetAndDestroy();
       
   143                      PrepareNotificationL(TBluetoothDialogParams::EMoreDevice, ENoResource);
       
   144                      LoadUsedDevicesL();
       
   145                      }
       
   146                 }
       
   147             iMessage = aMessage;
       
   148             break;
       
   149             }
       
   150         default:
       
   151             {
       
   152             aMessage.Complete( KErrNotSupported );
       
   153             }
       
   154         }
       
   155     BOstraceFunctionExit1( DUMMY_DEVLIST, this );
       
   156     }
       
   157 
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // Cancels an outstanding client message related to notifiers.
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 void CBTNotifDeviceSelector::CancelNotifierMessageL( const RMessage2& aMessage )
       
   164     {
       
   165     (void) aMessage;
       
   166     }
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // From class MBTNotificationResult.
       
   170 // Handle a result from a user query.
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 void CBTNotifDeviceSelector::MBRDataReceived( CHbSymbianVariantMap& aData )
       
   174     {
       
   175     TInt err = KErrCancel;
       
   176     if(aData.Keys().MdcaPoint(aData.Keys().MdcaCount()-1).Compare(_L("selectedindex"))==KErrNone)
       
   177         {
       
   178         TInt val = *(static_cast<TInt*>(aData.Get(_L("selectedindex"))->Data()));
       
   179         BOstrace1( TRACE_DEBUG, TNAME_DEVLIST_2, "MBRDataReceived, val %d", val );
       
   180 
       
   181         if ( !iMessage.IsNull() )
       
   182             {
       
   183            // TInt sel = val;// - TBluetoothDialogParams::EDialogExt;
       
   184             TBTDeviceResponseParamsPckg devParams;    
       
   185             if (  val > -1 && val < iDevices.Count() )
       
   186                 {
       
   187                 TRAP(err,SendSelectedDeviceL(aData));
       
   188              /*   devParams().SetDeviceAddress( iDevices[val]->Addr() );
       
   189                 devParams().SetDeviceClass(iDevices[val]->Device().DeviceClass());
       
   190                 devParams().SetDeviceName(iDevices[val]->Alias());
       
   191                 err = iMessage.Write( EBTNotifSrvReplySlot, devParams );*/
       
   192                 iNotification->RemoveObserver();
       
   193                 iNotification->Close(); // Also dequeues the notification from the queue.
       
   194                 iNotification = NULL;                
       
   195                 }
       
   196             iMessage.Complete( err );
       
   197             }
       
   198         iDiscoverer->CancelDiscovery();
       
   199         }
       
   200     else if(aData.Keys().MdcaPoint(0).Compare(_L("Stop"))==KErrNone)
       
   201         {
       
   202          iDiscoverer->CancelDiscovery();
       
   203         }
       
   204     else if(aData.Keys().MdcaPoint(0).Compare(_L("Retry"))==KErrNone)
       
   205         {
       
   206         iDiscoverer->CancelDiscovery();
       
   207         iDevices.ResetAndDestroy();
       
   208         TRAP_IGNORE( iDiscoverer->DiscoverDeviceL() );
       
   209         
       
   210         }
       
   211     else if(aData.Keys().MdcaPoint(0).Compare(_L("MoreDevices"))==KErrNone)
       
   212         {
       
   213         iNotification->RemoveObserver();
       
   214         iNotification->Close(); // Also dequeues the notification from the queue.
       
   215         iNotification = NULL;
       
   216         iDevices.ResetAndDestroy();
       
   217         TRAP_IGNORE( {
       
   218         PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource);
       
   219         iDiscoverer->DiscoverDeviceL(); } );
       
   220         }
       
   221     }
       
   222 
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // From class MBTNotificationResult.
       
   226 // The notification is finished.
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 void CBTNotifDeviceSelector::MBRNotificationClosed( TInt aError, const TDesC8& aData  )
       
   230     {
       
   231     (void) aError;
       
   232     (void) aData;
       
   233     iNotification->RemoveObserver();
       
   234     iNotification = NULL;
       
   235     }
       
   236 
       
   237 // ---------------------------------------------------------------------------
       
   238 // HandleNextDiscoveryResultL
       
   239 // ---------------------------------------------------------------------------
       
   240 //
       
   241 void CBTNotifDeviceSelector::HandleNextDiscoveryResultL( 
       
   242         const TInquirySockAddr& aAddr, const TDesC& aName )
       
   243     {
       
   244     // Todo: look for this device in repository before creating it.
       
   245     TBuf<KBTDevAddrSize * 2> addr; 
       
   246     
       
   247     
       
   248     
       
   249     CBtDevExtension* devext = GetDeviceFromRepositoryL(aAddr.BTAddr());
       
   250     
       
   251     if(!devext)
       
   252         {
       
   253         devext = CBtDevExtension::NewLC( aAddr, aName );
       
   254         }
       
   255     else
       
   256         {
       
   257         CleanupStack::PushL(devext);
       
   258         }
       
   259     iDevices.AppendL( devext );
       
   260     CleanupStack::Pop( devext );    
       
   261     
       
   262     if(iNotification)
       
   263         {// conditional check required as CAdvanceDevDiscoverer sends discovered devices at times
       
   264          // even after canceldiscovery is issued and notification is set to NULL
       
   265          // this causes EExcDataAbort
       
   266     CHbSymbianVariantMap* map = iNotification->Data();
       
   267 /*    TBuf<KMaxKeyDesCLength> keyStr;
       
   268     CHbSymbianVariant* devEntry;
       
   269 
       
   270     keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
       
   271     devEntry = CHbSymbianVariant::NewL( (TAny*) &(devext->Alias()), 
       
   272             CHbSymbianVariant::EDes );
       
   273     map->Add( keyStr, devEntry );*/
       
   274     
       
   275     User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName,
       
   276             devext->Alias()));
       
   277     
       
   278     devext->Addr().GetReadable(addr);
       
   279     User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr));
       
   280     
       
   281     TInt classOfDevice;
       
   282     classOfDevice =  devext->Device().DeviceClass().DeviceClass();
       
   283     User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice));
       
   284 
       
   285     TBool status;
       
   286     status = isBonded( devext->Device());
       
   287     
       
   288  //   setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() ));
       
   289     AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool);
       
   290     status = devext->Device().GlobalSecurity().Banned();
       
   291     AddDataL(map,_L("Blocked"),&status,
       
   292             CHbSymbianVariant::EBool);
       
   293     status = devext->Device().GlobalSecurity().NoAuthorise();
       
   294     AddDataL(map,_L("Trusted"),&status,
       
   295             CHbSymbianVariant::EBool);
       
   296     status = devext->ServiceConnectionStatus() == EBTEngConnected;
       
   297     AddDataL(map,_L("Connected"),&status,
       
   298             CHbSymbianVariant::EBool);
       
   299  
       
   300     iNotification->Update();
       
   301         }
       
   302     }
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 // HandleDiscoveryCompleted
       
   306 // ---------------------------------------------------------------------------
       
   307 //
       
   308 void CBTNotifDeviceSelector::HandleDiscoveryCompleted( TInt aErr )
       
   309     {
       
   310     (void) aErr;
       
   311     CHbSymbianVariantMap* map = iNotification->Data();
       
   312     TBuf<KMaxKeyDesCLength> keyStr;
       
   313     
       
   314 
       
   315     //TODO compile fail here we need to send the discovery completed text to the dialog 
       
   316     //TODO change the hardcoded string
       
   317     keyStr.Copy(_L("Search Completed"));
       
   318     CHbSymbianVariant* devEntry( NULL );
       
   319     TRAP_IGNORE( devEntry = CHbSymbianVariant::NewL( (TAny*) &(keyStr), 
       
   320             CHbSymbianVariant::EDes ) );
       
   321     if ( devEntry )
       
   322         {
       
   323         map->Add( keyStr, devEntry );
       
   324         iNotification->Update();
       
   325         }
       
   326     else
       
   327         {
       
   328         // todo: Complete client request with error
       
   329         }
       
   330     }
       
   331 
       
   332 // From MBtDeviceRepositoryObserver
       
   333 
       
   334 void CBTNotifDeviceSelector::RepositoryInitialized()
       
   335     {
       
   336     iRepositoryInitialized = ETrue;
       
   337     TInt err(KErrNone);
       
   338     if(!iLoadDevices)
       
   339         {
       
   340         iLoadDevices = ETrue;
       
   341         if(iServer.DevRepository().AllDevices().Count()==0)
       
   342              {
       
   343              iDevices.ResetAndDestroy();
       
   344              TRAP(err, {
       
   345              PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource);
       
   346              iDiscoverer->DiscoverDeviceL(); } );
       
   347              }
       
   348         else
       
   349              {
       
   350              iDevices.ResetAndDestroy();
       
   351              TRAP( err, 
       
   352                      {PrepareNotificationL(
       
   353                              TBluetoothDialogParams::EMoreDevice, ENoResource);
       
   354                       LoadUsedDevicesL();
       
   355                      } );
       
   356              }
       
   357         }
       
   358     if ( err )
       
   359         {
       
   360         // todo: complete client request
       
   361         }
       
   362     }
       
   363 
       
   364 void CBTNotifDeviceSelector::DeletedFromRegistry( const TBTDevAddr& aAddr )
       
   365     {
       
   366     (void) aAddr;
       
   367     }
       
   368 
       
   369 void CBTNotifDeviceSelector::AddedToRegistry( const CBtDevExtension& aDev )
       
   370     {
       
   371     (void) aDev;
       
   372     }
       
   373 
       
   374 void CBTNotifDeviceSelector::ChangedInRegistry( const CBtDevExtension& aDev, TUint aSimilarity  ) 
       
   375     {
       
   376     (void) aDev;
       
   377     (void) aSimilarity;
       
   378     }
       
   379 
       
   380 void CBTNotifDeviceSelector::ServiceConnectionChanged(const CBtDevExtension& aDev, TBool aConnected )
       
   381     {
       
   382     (void) aDev;
       
   383     (void) aConnected;
       
   384     }
       
   385 
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // Get and configure a notification.
       
   389 // ---------------------------------------------------------------------------
       
   390 //
       
   391 void CBTNotifDeviceSelector::PrepareNotificationL(
       
   392     TBluetoothDialogParams::TBTDialogType aType,
       
   393     TBTDialogResourceId aResourceId )
       
   394     {
       
   395     BOstraceFunctionEntry0( DUMMY_DEVLIST );
       
   396     if(iNotification)
       
   397         {
       
   398         iNotification->RemoveObserver();
       
   399         iNotification = NULL;
       
   400         }
       
   401     iNotification = iServer.NotificationManager()->GetNotification();
       
   402     User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
       
   403     iNotification->SetObserver( this );
       
   404     iNotification->SetNotificationType( aType, aResourceId );
       
   405 
       
   406     iServer.NotificationManager()->QueueNotificationL( iNotification,CBTNotificationManager::EPriorityHigh );
       
   407     BOstraceFunctionExit0( DUMMY_DEVLIST );
       
   408     }
       
   409 
       
   410 void CBTNotifDeviceSelector::LoadUsedDevicesL()
       
   411     {
       
   412     const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices();
       
   413     TBuf<KBTDevAddrSize * 2> addr; 
       
   414     for(TInt i=0; i< devArray.Count(); i++ )
       
   415         {
       
   416       const TTime& usedTime = devArray[i]->Device().Used();
       
   417         TTime monthBack;
       
   418         monthBack.HomeTime();
       
   419         monthBack -= TTimeIntervalDays(30);
       
   420         if(usedTime >= monthBack)
       
   421             {
       
   422             iDevices.AppendL( devArray[i]->CopyL() );
       
   423             CHbSymbianVariantMap* map = iNotification->Data();
       
   424  //           TBuf<KMaxKeyDesCLength> keyStr;
       
   425  //           CHbSymbianVariant* devEntry;
       
   426 
       
   427   //          keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
       
   428 //            devEntry = CHbSymbianVariant::NewL( (TAny*) &(devArray[i]->Alias()), 
       
   429   //                  CHbSymbianVariant::EDes );
       
   430   //          map->Add( keyStr, devEntry, );
       
   431             User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName,
       
   432                     devArray[i]->Alias()));
       
   433 //            AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes);
       
   434             devArray[i]->Addr().GetReadable(addr);
       
   435             User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr));
       
   436             addr.Zero();
       
   437             TInt classOfDevice;
       
   438             classOfDevice =  devArray[i]->Device().DeviceClass().DeviceClass();
       
   439             User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice));
       
   440             
       
   441             TBool status;
       
   442             status = isBonded( devArray[i]->Device());
       
   443             
       
   444          //   setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() ));
       
   445             AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool);
       
   446             status = devArray[i]->Device().GlobalSecurity().Banned();
       
   447             AddDataL(map,_L("Blocked"),&status,
       
   448                     CHbSymbianVariant::EBool);
       
   449             status = devArray[i]->Device().GlobalSecurity().NoAuthorise();
       
   450             AddDataL(map,_L("Trusted"),&status,
       
   451                     CHbSymbianVariant::EBool);
       
   452             status = devArray[i]->ServiceConnectionStatus() == EBTEngConnected;
       
   453             AddDataL(map,_L("Connected"),&status,
       
   454                     CHbSymbianVariant::EBool);
       
   455              // set blocked status:
       
   456 /*             setMajorProperty(majorProperty, BtuiDevProperty::Blocked, 
       
   457                      devArray[i]->Device().GlobalSecurity().Banned() );
       
   458              // set trusted status:
       
   459              setMajorProperty(majorProperty, BtuiDevProperty::Trusted, 
       
   460                      devArray[i]->Device().GlobalSecurity().NoAuthorise() );
       
   461              // set connected status:
       
   462              // EBTEngConnecting is an intermediate state between connected and not-connected, 
       
   463              // we do not treat it as connected:         
       
   464              setMajorProperty(majorProperty, BtuiDevProperty::Connected, devArray[i]->ServiceConnectionStatus() == EBTEngConnected);
       
   465 
       
   466   */          
       
   467 
       
   468  //           AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes);
       
   469             iNotification->Update();
       
   470             }
       
   471         }
       
   472     }
       
   473 
       
   474 
       
   475 
       
   476 /*!
       
   477   Tells if the given device is bonded.
       
   478 */
       
   479 TBool CBTNotifDeviceSelector::isBonded( const CBTDevice &dev )
       
   480 {
       
   481     // todo: this has not addresses Just Works pairing mode yet.
       
   482     return dev.IsValidPaired() && dev.IsPaired() &&
       
   483         dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable;
       
   484 }
       
   485 
       
   486 void CBTNotifDeviceSelector::AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, 
       
   487     const TAny* aData, CHbSymbianVariant::TType aDataType)
       
   488     {
       
   489     CHbSymbianVariant* value = CHbSymbianVariant::NewL(aData, aDataType);
       
   490     CleanupStack::PushL( value );
       
   491     User::LeaveIfError( aMap->Add( aKey, value ) ); // aMap takes the ownership of value
       
   492     CleanupStack::Pop( value );
       
   493     }
       
   494 
       
   495 // ---------------------------------------------------------------------------
       
   496 // Tells if these two instances are for the same remote device
       
   497 // ---------------------------------------------------------------------------
       
   498 //
       
   499 TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBtDevExtension& aDev)
       
   500     {
       
   501     return *aAddr == aDev.Device().BDAddr();
       
   502     }
       
   503 
       
   504 
       
   505 CBtDevExtension* CBTNotifDeviceSelector::GetDeviceFromRepositoryL( const TBTDevAddr& aAddr ) 
       
   506 {
       
   507     const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices();
       
   508     
       
   509     TInt pos = devArray.Find( aAddr, MatchDeviceAddress);
       
   510     if(pos > -1)
       
   511         {
       
   512         return devArray[pos]->CopyL();
       
   513         }
       
   514     return NULL;
       
   515 /*    addrSymbianToReadbleString( addrStr, addr );
       
   516     for (int i = 0; i < mData.count(); ++i ) {
       
   517         if ( mData.at( i ).value( BtDeviceModel::ReadableBdaddrRole ) 
       
   518                 == addrStr ) {
       
   519             return i;
       
   520         }
       
   521     }
       
   522     return -1;*/
       
   523 }
       
   524 
       
   525 
       
   526 void CBTNotifDeviceSelector::SendSelectedDeviceL( CHbSymbianVariantMap& aData )
       
   527     {
       
   528     TInt err; 
       
   529     TBTDeviceResponseParamsPckg devParams;
       
   530     TBTDevAddr address; 
       
   531     User::LeaveIfError(address.SetReadable(
       
   532                                     *(static_cast<TDesC*>(aData.Get(_L("deviceaddress"))->Data()))));
       
   533     devParams().SetDeviceAddress( address );
       
   534     devParams().SetDeviceClass(*(static_cast<TUint32*>(aData.Get(_L("deviceclass"))->Data())));
       
   535     devParams().SetDeviceName(*(static_cast<TDesC*>(aData.Get(_L("devicename"))->Data())));
       
   536     User::LeaveIfError(iMessage.Write( EBTNotifSrvReplySlot, devParams ));
       
   537     }
       
   538