hotspotfw/hsserver/src/hotspotserver.cpp
branchRCL_3
changeset 54 63be7eb3fc78
parent 52 b852595f5cbe
child 55 f28ada11abbf
equal deleted inserted replaced
52:b852595f5cbe 54:63be7eb3fc78
    23 #include <wlanmgmtclient.h>
    23 #include <wlanmgmtclient.h>
    24 #include <wlanmgmtinterface.h>
    24 #include <wlanmgmtinterface.h>
    25 #include <e32std.h>
    25 #include <e32std.h>
    26 #include <commsdattypesv1_1.h>
    26 #include <commsdattypesv1_1.h>
    27 
    27 
    28 #include <cmconnectionmethodext.h>
    28 #include <cmconnectionmethod.h>
    29 #include <cmconnectionmethoddef.h>
    29 #include <cmconnectionmethoddef.h>
    30 #include <cmpluginwlandef.h>
    30 #include <cmpluginwlandef.h>
    31 #include <cmmanagerext.h>
    31 #include <cmmanager.h>
    32 #include <cmmanagerdef.h>
    32 #include <cmmanagerdef.h>
    33 #include <cmdestinationext.h>
    33 #include <cmdestination.h>
    34 
    34 
    35 #include "hotspotserver.h"
    35 #include "hotspotserver.h"
    36 #include "am_debug.h"
    36 #include "am_debug.h"
    37 #include "hotspotsession.h"
    37 #include "hotspotsession.h"
    38 #include "hssclientplugin.h"
    38 #include "hssclientplugin.h"
   156     iIapCheckValue = EFalse;
   156     iIapCheckValue = EFalse;
   157     iLogoutSent = EFalse;
   157     iLogoutSent = EFalse;
   158     iLoginValue = ETrue;
   158     iLoginValue = ETrue;
   159     iAssociationValue = EFalse;
   159     iAssociationValue = EFalse;
   160     iClientIapsChecked = KErrNone;
   160     iClientIapsChecked = KErrNone;
   161     iEasyWlanId = KEasyWlanServiceId; // Set to default value just in case
   161     
   162 
       
   163     TRAP( iClientIapsChecked, FindClientIapsL() );
   162     TRAP( iClientIapsChecked, FindClientIapsL() );
   164  
   163  
   165     // Activate notifications for IAP check purposes. Done with every server startup.
   164     // Activate notifications for IAP check purposes. Done with every server startup.
   166     // When EWlanConnectionModeNotConnected is received we can cancel this.
   165     // When EWlanConnectionModeNotConnected is received we can cancel this.
   167     iMgtClient = CWlanMgmtClient::NewL();
   166     iMgtClient = CWlanMgmtClient::NewL();
   168     ActivateWlanNotificationsL();
   167 #ifndef __WINS__
       
   168     iMgtClient->ActivateNotificationsL( *this );
       
   169 #endif 
   169     }
   170     }
   170 
   171 
   171 // -----------------------------------------------------------------------------
   172 // -----------------------------------------------------------------------------
   172 // ConnectionStateChanged
   173 // ConnectionStateChanged
   173 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   200 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   201 //
   202 //
   202 void CHotSpotServer::FindClientIapsL()
   203 void CHotSpotServer::FindClientIapsL()
   203     {
   204     {
   204     DEBUG("CHotSpotServer::FindClientIapsL()");
   205     DEBUG("CHotSpotServer::FindClientIapsL()");
   205     RCmManagerExt cmManager;
   206     RCmManager cmManager;
   206     cmManager.OpenL();
   207     cmManager.OpenL();
   207     CleanupClosePushL(cmManager);
   208     CleanupClosePushL(cmManager);
   208            
   209            
   209     RArray<TUint32> cmArray;
   210     RArray<TUint32> cmArray;
   210     CleanupClosePushL( cmArray );
   211     CleanupClosePushL( cmArray );
   211     TBool supportedBearersOnly = ETrue;
   212     TBool supportedBearersOnly = ETrue;
   212     TBool legacyCmsOnly = EFalse;
   213     TBool legacyCmsOnly = EFalse;
   213     
   214     
   214     // Read Easy WLAN IAP ID first
       
   215     iEasyWlanId = cmManager.EasyWlanIdL();
       
   216     DEBUG1("CHotSpotServer::FindClientIapsL() iEasyWlanId: % d", iEasyWlanId);
       
   217     
       
   218     cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly );
   215     cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly );
   219     DEBUG1("CHotSpotServer::FindClientIapsL count: %d", cmArray.Count());  
   216     DEBUG1("CHotSpotServer::FindClientIapsL count: %d", cmArray.Count());  
   220     
   217     
   221     for( TInt i = 0; i < cmArray.Count(); i++ )
   218     for( TInt i = 0; i < cmArray.Count(); i++ )
   222         {
   219         {
   223         RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmArray[i] );
   220         RCmConnectionMethod cm = cmManager.ConnectionMethodL( cmArray[i] );
   224         CleanupClosePushL( cm );
   221         CleanupClosePushL( cm );
   225         HBufC* daemonName = cm.GetStringAttributeL( 
   222         HBufC* daemonName = cm.GetStringAttributeL( 
   226                                                 ECmConfigDaemonManagerName );
   223                                                 ECmConfigDaemonManagerName );
   227         CleanupStack::PushL( daemonName );
   224         CleanupStack::PushL( daemonName );
   228         if ( daemonName )
   225         if ( daemonName )
   274         TBuf8<KExtensionAPILength> nullBuf;
   271         TBuf8<KExtensionAPILength> nullBuf;
   275         TRAPD( error, plugin = CHssClientPlugin::NewL( client, nullBuf ) );
   272         TRAPD( error, plugin = CHssClientPlugin::NewL( client, nullBuf ) );
   276         delete plugin;
   273         delete plugin;
   277 
   274 
   278         DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error );
   275         DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error );
   279         if ( error != KErrNone )
   276         if ( error == KErrNotFound )
   280             {
   277             {
   281             // Remove from database
   278             // Remove from database
   282             RCmManagerExt cmManager;
   279             RCmManager cmManager;
   283             cmManager.OpenL();
   280             cmManager.OpenL();
   284             CleanupClosePushL(cmManager);
   281             CleanupClosePushL(cmManager);
   285             
   282             
   286             RCmConnectionMethodExt cm;
   283             RCmConnectionMethod cm;
   287             cm = cmManager.ConnectionMethodL( iClientIaps[i].iIapId );
   284             cm = cmManager.ConnectionMethodL( iClientIaps[i].iIapId );
   288             CleanupClosePushL( cm );
   285             CleanupClosePushL( cm );
   289             cmManager.RemoveAllReferencesL( cm );
   286             cmManager.RemoveAllReferencesL( cm );
   290             cm.DeleteL();
   287             cm.DeleteL();
   291             
   288             
   300         }
   297         }
   301     DEBUG("CHotSpotServer::CheckIapsL Done");
   298     DEBUG("CHotSpotServer::CheckIapsL Done");
   302     }
   299     }
   303 
   300 
   304 // -----------------------------------------------------------------------------
   301 // -----------------------------------------------------------------------------
   305 // ActivateWlanNotificationsL
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 void CHotSpotServer::ActivateWlanNotificationsL()
       
   309     {
       
   310     DEBUG("CHotSpotServer::ActivateWlanNotificationsL");
       
   311 #ifndef __WINS__
       
   312     iMgtClient->CancelNotifications();
       
   313     iMgtClient->ActivateNotificationsL( *this );
       
   314 #endif 
       
   315     }
       
   316 
       
   317 // -----------------------------------------------------------------------------
       
   318 // NewSessionL
   302 // NewSessionL
   319 // -----------------------------------------------------------------------------
   303 // -----------------------------------------------------------------------------
   320 //
   304 //
   321 CSession2* CHotSpotServer::NewSessionL( const TVersion& aVersion, 
   305 CSession2* CHotSpotServer::NewSessionL( const TVersion& aVersion, 
   322                                         const RMessage2& /* aMessage */ ) const
   306                                         const RMessage2& /* aMessage */ ) const
   675             }
   659             }
   676         i++;
   660         i++;
   677         }
   661         }
   678     }
   662     }
   679 
   663 
   680 // -----------------------------------------------------------------------------
       
   681 // GetEasyWlanId
       
   682 // -----------------------------------------------------------------------------
       
   683 //
       
   684 TInt CHotSpotServer::GetEasyWlanId()
       
   685     {
       
   686     DEBUG("CHotspotServer::GetEasyWlanId()");
       
   687     return iEasyWlanId;
       
   688     }
       
   689 
       
   690 // ========================== OTHER EXPORTED FUNCTIONS =========================
   664 // ========================== OTHER EXPORTED FUNCTIONS =========================
   691 
   665 
   692 // -----------------------------------------------------------------------------
   666 // -----------------------------------------------------------------------------
   693 // E32Main implements the executable entry function.
   667 // E32Main implements the executable entry function.
   694 // Note that because the target type of the IPWServer Hss
   668 // Note that because the target type of the IPWServer Hss