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