hotspotfw/hsclient/src/hssinterface.cpp
changeset 0 56b72877c1cb
child 10 dff6ebfd236f
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:   Implementation of interface for HotSpot services.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 #include "hssinterface.h"
       
    22 #include "hotspotclientserver.h"
       
    23 #include "am_debug.h"
       
    24 #include <s32mem.h>
       
    25 #include <es_enum.h>
       
    26 #include <commdb.h>
       
    27 
       
    28 // CONSTS
       
    29 const TUint32 KHssWlanUserSettings  = 1;
       
    30 _LIT( KHssWlanDeviceSettings,        "WLANDeviceTable" );
       
    31 _LIT( KHssWlanDeviceSettingsType,    "WlanDeviceSettingsType" );
       
    32 _LIT( KHssBgScanInterval,            "WlanBgScanInterval" );
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // RHssInterface::ActivateNotificationsL
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 EXPORT_C void RHssInterface::ActivateNotificationsL( MHssSrvNotifications& aCallback )
       
    39     {
       
    40     DEBUG( "RHssInterface::ActivateNotificationsL()" );
       
    41     if( iNotify != NULL )
       
    42         {
       
    43         iNotify->Activate( aCallback );
       
    44         }
       
    45     else
       
    46         {
       
    47         iNotify = CHssSrvNotifications::NewL( aCallback, *this );        
       
    48         }
       
    49     }
       
    50  
       
    51    
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // RHssInterface::CancelNotifications
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C void RHssInterface::CancelNotifications()
       
    58     {
       
    59     DEBUG( "RHssInterface::CancelNotifications()" );
       
    60     if( iNotify == NULL )
       
    61         {
       
    62         return;
       
    63         }
       
    64     if( iNotify->IsActive() )
       
    65         {
       
    66         // Notifications activated, request is pending
       
    67         iNotify->Cancel();
       
    68         }
       
    69     else
       
    70         {
       
    71         // Notifications activated, currently executing a notification
       
    72 
       
    73         //(i.e. in RunL of iNotify)
       
    74 
       
    75         iNotify->SetCancelled();
       
    76         }
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // RHssInterface::Close
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C void RHssInterface::Close()
       
    84     {
       
    85     DEBUG( "RHssInterface::Close()" );
       
    86     if ( iNotify != NULL )
       
    87         {
       
    88         delete iNotify;    
       
    89         }
       
    90     iNotify = NULL;
       
    91     
       
    92     RHandleBase::Close();
       
    93     DEBUG( "RHssInterface::Close() Done" );
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // RHssInterface::Connect
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C TInt RHssInterface::Connect()
       
   101     {
       
   102     TInt error = StartServer();
       
   103     DEBUG1( "RHssInterface::Connect() StartServer: %d", error ); 
       
   104 	iNotify = NULL;
       
   105 		
       
   106     if ( KErrNone == error )
       
   107         {
       
   108         error = CreateSession( KHotSpotDataServerName,
       
   109                                Version(),
       
   110                                KDefaultMsgSlots );
       
   111          DEBUG1( "RHssInterface::Connect() CreateSession: %d", error );  
       
   112         }
       
   113     return error;
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // RHssInterface::GetScanResults
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C TInt RHssInterface::GetScanResults( HssScanList& aResults )
       
   121     {
       
   122     DEBUG( "RHssInterface::GetScanResults(HssScanList&)" );
       
   123     TInt ret( KErrNone );
       
   124     CHssScanHandler* scanHandler( NULL );
       
   125     TRAP( ret, scanHandler = CHssScanHandler::NewL() );
       
   126     if (ret == KErrNone)
       
   127         {
       
   128         ret = scanHandler->ScanRequest( aResults );
       
   129         delete scanHandler;
       
   130         }
       
   131     return ret;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // RHssInterface::Register
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 EXPORT_C TUint RHssInterface::Register (const TUid aUID,
       
   139                                         const TDesC& aIapName, 
       
   140                                         const TUint aWaitnote)
       
   141     {
       
   142     DEBUG( "RHssInterface::Register()" );
       
   143     TPckgBuf< TClientUid > uidPckg;
       
   144     uidPckg().SetUid( aUID );
       
   145     TPckgBuf< TIapName > iapPckg;
       
   146     iapPckg().SetIapName( aIapName );
       
   147     TIpcArgs args( &uidPckg, &iapPckg,  aWaitnote );
       
   148     iIapId = SendReceive( EHssRegister, args );
       
   149     return iIapId;
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // RHssInterface::UnRegister
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 EXPORT_C TInt RHssInterface::UnRegister (const TUint aIapID, 
       
   157                                          const TUint aNetworkId,
       
   158                                          const TUid aUID)
       
   159     {
       
   160     DEBUG( "RHssInterface::UnRegister()" );
       
   161     TRAPD( err, StopConnectionL( aIapID, aNetworkId ) );
       
   162     
       
   163     if ( err == KErrNone )
       
   164         {
       
   165         TPckgBuf< TClientUid > uidPckg;
       
   166         uidPckg().SetUid( aUID );
       
   167         TIpcArgs args( aIapID, &uidPckg );
       
   168         err =  SendReceive( EHssUnRegister, args );
       
   169         }
       
   170     
       
   171     return err;
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // RHssInterface::ChangeSettings
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 EXPORT_C TInt RHssInterface::ChangeSettings ( const TUint aIapID, 
       
   179                                               const THssIapSettings& aSettings )
       
   180     {
       
   181     DEBUG( "RHssInterface::ChangeSettings()" );
       
   182     TInt ret( KErrNone );
       
   183     CHssIapHandler* iapHandler( NULL );
       
   184     TRAP( ret, iapHandler = CHssIapHandler::NewL());
       
   185     if ( ret != KErrNone )
       
   186         {
       
   187         DEBUG1( "RHssInterface::ChangeSettings() leave1: %d", ret );
       
   188         }
       
   189     else
       
   190         {
       
   191         TRAPD( err, ret = iapHandler->ChangeSettingsL( aIapID, aSettings ) );
       
   192         if ( err != KErrNone )
       
   193             {
       
   194             DEBUG1( "RHssInterface::ChangeSettings() leave2: %d", err );
       
   195             ret = err;
       
   196             }
       
   197         if ( iapHandler != NULL )
       
   198             {
       
   199             delete iapHandler;
       
   200             }
       
   201         }
       
   202     return ret;
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // RHssInterface::Stop
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 EXPORT_C TInt RHssInterface::Stop ( const TUint aIapID )
       
   210     {
       
   211     DEBUG( "RHssInterface::Stop()" );
       
   212     
       
   213     TIpcArgs args( aIapID );
       
   214     TInt ret = Send( EHssStop, args );
       
   215     
       
   216     TUint32 netId;
       
   217     CHssIapHandler* iapHandler(NULL);
       
   218     
       
   219     TRAPD( err, iapHandler = CHssIapHandler::NewL() );
       
   220     if (err == KErrNone)
       
   221         {
       
   222         TRAP( err, iapHandler->GetNetworkIdL( aIapID, netId ) );
       
   223         delete iapHandler;
       
   224         if (err == KErrNone)
       
   225             {
       
   226             TRAP( err, StopConnectionL( aIapID, netId ) );
       
   227             // Possible error value is neglected?!
       
   228             }
       
   229         }    
       
   230 
       
   231     return ret;
       
   232     }
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // RHssInterface::CancelStart
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 EXPORT_C TInt RHssInterface::CancelStart ( const TUint aIapID )
       
   239     {
       
   240     DEBUG( "RHssInterface::CancelStart()" );
       
   241     TIpcArgs args( aIapID );
       
   242     return Send( EHssCancelStart, args );
       
   243     }
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // RHssInterface::LoginComplete
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 EXPORT_C TInt RHssInterface::LoginComplete ( const TUint aIapID, const TInt aStatus )
       
   250     {
       
   251     DEBUG( "RHssInterface::LoginComplete()" );
       
   252     iArgs = TIpcArgs( aIapID, aStatus );
       
   253     return Send( EHssLoginComplete, iArgs );
       
   254     }
       
   255     
       
   256 // -----------------------------------------------------------------------------
       
   257 // RHssInterface::LogoutComplete
       
   258 // -----------------------------------------------------------------------------
       
   259 //
       
   260 EXPORT_C TInt RHssInterface::LogoutComplete ( const TUint aIapID )
       
   261     {
       
   262     DEBUG( "RHssInterface::LogoutComplete()" );
       
   263     TIpcArgs args( aIapID );
       
   264     return Send( EHssLogoutComplete, args );
       
   265     }
       
   266 
       
   267 // -----------------------------------------------------------------------------
       
   268 // RHssInterface::Join
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 EXPORT_C TInt RHssInterface::Join( const TUint aIapId )
       
   272     {
       
   273     DEBUG( "RHssInterface::Join()" );
       
   274     TIpcArgs args( aIapId );
       
   275     return Send( EHssJoin, args );
       
   276     }
       
   277 
       
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // RHssInterface::StartLogin
       
   281 // -----------------------------------------------------------------------------
       
   282 //
       
   283 EXPORT_C void RHssInterface::StartLogin( const TUint aIapId, 
       
   284                                          const TUint aNetworkId,
       
   285                                          TRequestStatus& aStatus )
       
   286     {
       
   287     DEBUG( "RHssInterface::StartLogin()" );
       
   288     iArgs = TIpcArgs( aIapId, aNetworkId );
       
   289     SendReceive( EHssStartLogin, iArgs, aStatus );
       
   290     }
       
   291 
       
   292 // -----------------------------------------------------------------------------
       
   293 // RHssInterface::CancelLogin
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 EXPORT_C TInt RHssInterface::CancelLogin()
       
   297     {
       
   298     DEBUG( "RHssInterface::CancelLogin()" );
       
   299     return Send( EHssCancelLogin );
       
   300     }  
       
   301 
       
   302 // -----------------------------------------------------------------------------
       
   303 // RHssInterface::Start
       
   304 // -----------------------------------------------------------------------------
       
   305 //
       
   306 EXPORT_C void RHssInterface::Start( const TUint aIapId, 
       
   307                                     TRequestStatus& aStatus )
       
   308     {
       
   309     DEBUG( "RHssInterface::Start()" );
       
   310     iArgs = TIpcArgs( aIapId );
       
   311     SendReceive( EHssStart, iArgs, aStatus );
       
   312     }
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // RHssInterface::StartAgain
       
   316 // -----------------------------------------------------------------------------
       
   317 //
       
   318 EXPORT_C void RHssInterface::StartAgain( const TUint aIapId, 
       
   319                                          TRequestStatus& aStatus )
       
   320     {
       
   321     DEBUG( "RHssInterface::StartAgain()" );
       
   322     iArgs = TIpcArgs( aIapId );
       
   323     SendReceive( EHssStartAgain, iArgs, aStatus );
       
   324     }
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // RHssInterface::CloseConnection
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 EXPORT_C void RHssInterface::CloseConnection( const TUint aIapId,
       
   331                                               TRequestStatus& aStatus )
       
   332     {
       
   333     DEBUG( "RHssInterface::CloseConnection()" );
       
   334     iArgs = TIpcArgs( aIapId );
       
   335     SendReceive( EHssCloseConnection, iArgs, aStatus );
       
   336     }    
       
   337 
       
   338 // -----------------------------------------------------------------------------
       
   339 // RHssInterface::Cancel
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 EXPORT_C void RHssInterface::Cancel( const TUint aIapId )
       
   343     {
       
   344     DEBUG( "RHssInterface::Cancel()" );
       
   345     TIpcArgs args( aIapId );
       
   346     Send( EHssCancel, args );
       
   347     }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // RHssInterface::ShutdownServerL
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 EXPORT_C TInt RHssInterface::ShutdownServerL()
       
   354     {
       
   355     DEBUG( "RHssInterface::ShutdownServerL" );
       
   356     TInt ret( KErrNone );
       
   357     TInt iapId;
       
   358     TInt netId;
       
   359     TPckgBuf<TInt> iapPckg;
       
   360     TPckgBuf<TInt> netPckg;
       
   361     TIpcArgs args( &iapPckg, &netPckg );
       
   362     ret = SendReceive( EHssServerShutdown, args );
       
   363     
       
   364     if ( ret == KErrInUse )
       
   365         {
       
   366         iapId = iapPckg();
       
   367         netId = netPckg();
       
   368         DEBUG1("iapID RHSSINTERFACE : %d", iapId );
       
   369         ret = StopConnectionL( iapId, netId );
       
   370         
       
   371         if ( ret == KErrNone )
       
   372             {
       
   373             ret =  SendReceive( EHssServerShutdown, args );
       
   374             }
       
   375         }
       
   376     
       
   377     TIpcArgs args2( KHssShutdown ); 
       
   378     ret =  SendReceive( EHssServerShutdown, args2 );
       
   379         
       
   380     return ret;
       
   381     }
       
   382 
       
   383 // -----------------------------------------------------------------------------
       
   384 // RHssInterface::SetUiState
       
   385 // -----------------------------------------------------------------------------
       
   386 //
       
   387 EXPORT_C void RHssInterface::SetUiState( const TUint aIapId,
       
   388                                          const TUint aState )
       
   389     {
       
   390     DEBUG( "RHssInterface::SetUiState()" );
       
   391     TIpcArgs args( aIapId, aState );
       
   392     SendReceive( EHssUiState, args );	
       
   393 	}
       
   394     
       
   395 // -----------------------------------------------------------------------------
       
   396 // RHssInterface::Version
       
   397 // Needed only when activating the server.
       
   398 // -----------------------------------------------------------------------------
       
   399 //
       
   400 TVersion RHssInterface::Version() const
       
   401     {
       
   402     return( TVersion(
       
   403             KHotSpotMajorVersionNumber,
       
   404             KHotSpotMinorVersionNumber,
       
   405             KHotSpotBuildVersionNumber ) );
       
   406     }
       
   407 
       
   408 // -----------------------------------------------------------------------------
       
   409 // RHssInterface::StartServer()
       
   410 // Starts the server if it is not already running
       
   411 // -----------------------------------------------------------------------------
       
   412 //
       
   413 TInt RHssInterface::StartServer()
       
   414     {
       
   415     DEBUG( "RHssInterface::StartServer" );
       
   416     TInt result;
       
   417 
       
   418     TFindServer findHotSpotServer( KHotSpotDataServerName );
       
   419     TFullName name;
       
   420 
       
   421     result = findHotSpotServer.Next( name );
       
   422     if ( result == KErrNone )
       
   423         {
       
   424         // Server already running
       
   425         return KErrNone;
       
   426         }
       
   427 
       
   428     RSemaphore semaphore;
       
   429     result = semaphore.CreateGlobal( KHotSpotServerSemaphore, 0 );
       
   430     DEBUG1( "RHssInterface::StartServer semaphore: %d", result );
       
   431     if ( result != KErrNone )
       
   432         {
       
   433         return  result;
       
   434         }
       
   435 
       
   436     result = CreateServerProcess();
       
   437     DEBUG1( "RHssInterface::StartServer CreateServerProcess: %d", result );
       
   438     if ( result != KErrNone )
       
   439         {
       
   440         // Should the semaphore be closed if process creating fails?
       
   441         return  result;
       
   442         }
       
   443 
       
   444     semaphore.Wait();
       
   445     semaphore.Close();
       
   446 
       
   447     return KErrNone;
       
   448     }
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // RHssInterface::CreateServerProcess()
       
   452 // Creates a server process
       
   453 // -----------------------------------------------------------------------------
       
   454 //
       
   455 TInt RHssInterface::CreateServerProcess()
       
   456     {
       
   457   	const TUidType serverUid( KNullUid,KNullUid, KHotspotServerUid3 );
       
   458 
       
   459 	RProcess server;
       
   460 
       
   461 	TInt r = server.Create(KHotSpotServerExe,KNullDesC);
       
   462 	if ( r != KErrNone )
       
   463 		{
       
   464 	    DEBUG1( "**** RHssInterface: server start failed %d", r );
       
   465 		return r;
       
   466 		}
       
   467 	TRequestStatus stat;
       
   468 	server.Rendezvous( stat );
       
   469 	if ( stat!=KRequestPending )
       
   470 	    {
       
   471 	    server.Kill(0);		// abort startup
       
   472 	    }
       
   473     else
       
   474         {
       
   475         server.Resume();	// logon OK - start the server
       
   476         }
       
   477 		
       
   478     DEBUG("**** RHssInterface: Started");
       
   479 	
       
   480 	User::WaitForRequest(stat);
       
   481 	r = ( server.ExitType()==EExitPanic ) ? KErrGeneral : stat.Int();
       
   482 	server.Close();
       
   483 	return r;
       
   484     }
       
   485 
       
   486 // ---------------------------------------------------------
       
   487 // RHssInterface::WaitForNotification
       
   488 // When the message is completed at the server side, the
       
   489 // CHssSrvNotifications::RunL() is been called. This is used by the
       
   490 // notification service.
       
   491 // ---------------------------------------------------------
       
   492 //
       
   493 void RHssInterface::WaitForNotification(
       
   494     TRequestStatus& aReturnValue, 
       
   495     TDes8& aReturnData )
       
   496     {
       
   497     DEBUG( "RHssInterface::WaitForNotification()" );
       
   498     TIpcArgs params( &aReturnData );
       
   499     SendReceive( EHssActivateNotifications, params, aReturnValue );
       
   500     }
       
   501     
       
   502 // ---------------------------------------------------------
       
   503 // RHssInterface::CancelWaitForNotification
       
   504 // CHssSrvNotifications class uses this method to cancel pending 
       
   505 // message at server side.
       
   506 // ---------------------------------------------------------
       
   507 //
       
   508 void RHssInterface::CancelWaitForNotification()
       
   509     {
       
   510     DEBUG( "RHssInterface::CancelWaitForNotification()" );
       
   511 
       
   512     // Check is notify service activated.
       
   513     if( iNotify != NULL )
       
   514         {
       
   515         // Send synchronous request to the data server
       
   516         DEBUG( "RHssInterface::CancelWaitForNotification() Cancelling..." );
       
   517         Send( EHssCancelNotifications, TIpcArgs() );
       
   518         DEBUG( "Done!" );
       
   519         }
       
   520     else
       
   521         {
       
   522         DEBUG( "RHssInterface::CancelWaitForNotification() Notification service was not started." );
       
   523         }
       
   524     }
       
   525 
       
   526 // ---------------------------------------------------------
       
   527 // RHssInterface::StopConnectionL
       
   528 // ---------------------------------------------------------
       
   529 //
       
   530 TInt RHssInterface::StopConnectionL( const TUint aIapId, const TUint aNetworkId )
       
   531     {
       
   532     DEBUG( "RHssInterface::StopConnectionL()" );
       
   533 
       
   534     TInt ret( KErrNone );
       
   535     RSocketServ socketServ;
       
   536     RConnection conn;
       
   537 
       
   538     User::LeaveIfError( socketServ.Connect() );
       
   539     CleanupClosePushL( socketServ );
       
   540     
       
   541     // Open connection
       
   542     User::LeaveIfError( conn.Open(socketServ) );
       
   543     CleanupClosePushL( conn );
       
   544 
       
   545     TConnectionInfo info;
       
   546     info.iIapId = aIapId;
       
   547     info.iNetId = aNetworkId;
       
   548 
       
   549     TInt err = conn.Attach(
       
   550             TPckg< TConnectionInfo >( info ),
       
   551             RConnection::EAttachTypeNormal );
       
   552     DEBUG1( "RHssInterface::conn.Attach: %d", err );
       
   553 
       
   554     if ( err == KErrNone )
       
   555         {
       
   556         ret = conn.Stop( RConnection::EStopAuthoritative );
       
   557         DEBUG1( "RHssInterface::connection.Stop: %d", ret );
       
   558         }
       
   559 
       
   560     /* Note: In previous version, tried to PopAndDestroy conn (RConnection)
       
   561      * from cleanup stack...
       
   562      * => Somehow this broke Sniffer connection opening, no idea why.
       
   563      */
       
   564     CleanupStack::Pop( &conn );
       
   565     conn.Close();
       
   566     CleanupStack::PopAndDestroy( &socketServ );
       
   567     
       
   568     return ret;
       
   569     }
       
   570 
       
   571 // ---------------------------------------------------------
       
   572 // RHssInterface::CheckBackgroundScanL
       
   573 // ---------------------------------------------------------
       
   574 //
       
   575 EXPORT_C TUint32 RHssInterface::CheckBackgroundScanL()
       
   576 	{
       
   577 	DEBUG( "RHssInterface::CheckBackgroundScanL()" );
       
   578     CCommsDatabase*    commDB = NULL;
       
   579     CCommsDbTableView* table  = NULL;
       
   580 
       
   581     // Open commDB
       
   582     commDB = CCommsDatabase::NewL();
       
   583     CleanupStack::PushL( commDB );
       
   584 
       
   585     table = commDB->OpenViewMatchingUintLC( KHssWlanDeviceSettings,
       
   586 	                                        KHssWlanDeviceSettingsType,
       
   587 	                                        KHssWlanUserSettings );
       
   588 
       
   589     TInt err = table->GotoFirstRecord();
       
   590 
       
   591     if ( err )
       
   592         {
       
   593         User::Leave( err );  
       
   594         }
       
   595 	
       
   596 	TUint32 scanInterval;
       
   597     table->ReadUintL( KHssBgScanInterval, scanInterval ); 
       
   598 
       
   599     // cleanup
       
   600     CleanupStack::PopAndDestroy( table );
       
   601     CleanupStack::PopAndDestroy( commDB );
       
   602     
       
   603     return (scanInterval);
       
   604 	
       
   605 	}
       
   606 
       
   607 // ---------------------------------------------------------
       
   608 // RHssInterface::GetIap
       
   609 // ---------------------------------------------------------
       
   610 //
       
   611 EXPORT_C TUint32 RHssInterface::GetIap( TIpcArgs aArgs )
       
   612 	{
       
   613 	DEBUG( "RHssInterface::GetIap()" );
       
   614 	return SendReceive ( EHssGetIAP, aArgs );	
       
   615 	}
       
   616 
       
   617 // ---------------------------------------------------------
       
   618 // RHssInterface::StartBrowser
       
   619 // ---------------------------------------------------------
       
   620 //
       
   621 EXPORT_C void RHssInterface::StartBrowser( const TDesC& aString, 
       
   622 										   const TUint aIapId,
       
   623 										   const TUint aNetId,
       
   624 										   TRequestStatus& aStatus )
       
   625 	{
       
   626 	DEBUG( "RHssInterface::StartBrowser()" );
       
   627 
       
   628 	iArgs = TIpcArgs( &aString, aIapId, aNetId ) ;
       
   629 	SendReceive( EHssStartBrowser, iArgs, aStatus );
       
   630 	}
       
   631 
       
   632 // ---------------------------------------------------------
       
   633 // RHssInterface::GetConnectionBssid
       
   634 // ---------------------------------------------------------
       
   635 //
       
   636 EXPORT_C TInt RHssInterface::GetConnectionBssid( THssBssid& aBssId )
       
   637     {
       
   638     DEBUG( "RHssInterface::GetConnectionBssid()" );
       
   639     TInt ret( KErrNone );
       
   640     CHssScanHandler* scanHandler( NULL );
       
   641     TRAP( ret, scanHandler = CHssScanHandler::NewL() );
       
   642     if (KErrNone != ret )
       
   643         {
       
   644         DEBUG1( "RHssInterface::GetConnectionBssid() err:", ret );
       
   645         }
       
   646     else
       
   647         {
       
   648         ret = scanHandler->GetConnectionBssid( aBssId );
       
   649         DEBUG1( "RHssInterface::GetConnectionBssid() ret:", ret );
       
   650         delete scanHandler;
       
   651         }
       
   652     return ret;
       
   653     }
       
   654 
       
   655 // ---------------------------------------------------------
       
   656 // RHssInterface::AddIapSsidList
       
   657 // ---------------------------------------------------------
       
   658 //
       
   659 EXPORT_C TInt RHssInterface::AddIapSsidList(
       
   660         TUint aIapId,
       
   661         const CArrayFixFlat<THssSsid>& aSsidList )
       
   662     {
       
   663     DEBUG( "RHssInterface::AddIapSsidList()" );
       
   664     TInt ret( KErrNone );
       
   665     CHssScanHandler* scanHandler( NULL );
       
   666     TRAP( ret, scanHandler = CHssScanHandler::NewL() );
       
   667     if (KErrNone != ret )
       
   668         {
       
   669         DEBUG1( "RHssInterface::AddIapSsidList() err:", ret );
       
   670         }
       
   671     else
       
   672         {    
       
   673         ret = scanHandler->AddIapSsidList( aIapId, aSsidList );
       
   674         DEBUG1( "RHssInterface::AddIapSsidList() ret:", ret );
       
   675         delete scanHandler;    
       
   676         }
       
   677     return ret;
       
   678     }
       
   679 
       
   680 // -----------------------------------------------------------------------------
       
   681 // RHssInterface::SetTimerValues
       
   682 // -----------------------------------------------------------------------------
       
   683 //
       
   684 EXPORT_C TInt RHssInterface::SetTimerValues (
       
   685         TUid aClientUid,
       
   686         TUint aLoginTimerValue,
       
   687         TUint aLogoutTimerValue )
       
   688     {
       
   689     DEBUG( "RHssInterface::SetTimerValues()" );
       
   690     TIpcArgs args( aClientUid.iUid, aLoginTimerValue, aLogoutTimerValue );
       
   691     return Send( EHssSetTimerValues, args );
       
   692     }
       
   693 
       
   694 // ---------------------------------------------------------
       
   695 // RHssInterface::GetClientIapsL
       
   696 // ---------------------------------------------------------
       
   697 //
       
   698 EXPORT_C void RHssInterface::GetClientIapsL( const TUid aUid, RArray<TUint>& aIapIdArray )
       
   699     {
       
   700     DEBUG( "RHssInterface::GetClientIapsL()" );
       
   701     CHssIapHandler* iapHandler( NULL );
       
   702     iapHandler = CHssIapHandler::NewL();
       
   703     CleanupStack::PushL( iapHandler );
       
   704     iapHandler->GetClientIapsL( aUid, aIapIdArray );
       
   705     CleanupStack::PopAndDestroy( iapHandler );
       
   706     }
       
   707 
       
   708 // End of File
       
   709