hotspotfw/hsclient/src/hssmgmtimpl.cpp
changeset 0 56b72877c1cb
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 hotspot management API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32std.h>
       
    22 #include <implementationproxy.h>
       
    23 #include "hssmgmtimpl.h"
       
    24 #include "hssmgmtscaninfoimpl.h"
       
    25 #include "am_debug.h"
       
    26 
       
    27 // LOCAL CONSTANTS
       
    28 /**
       
    29 * Pairs ECom implementation UIDs with a pointer to the instantiation 
       
    30 * method for that implementation. Required for all ECom implementation
       
    31 * collections.
       
    32 */
       
    33 const TImplementationProxy ImplementationTable[] =
       
    34     {
       
    35         {{0x10282ece}, reinterpret_cast<TProxyNewLPtr>(CHssMgmtImpl::NewL)},
       
    36         {{0x10282ed0}, reinterpret_cast<TProxyNewLPtr>(CHssMgmtScanInfoImpl::NewL)}
       
    37     };
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 //
       
    44 CHssMgmtImpl::CHssMgmtImpl() : 
       
    45 	iClientNotification( NULL )	
       
    46     {
       
    47     DEBUG( "CHssMgmtImpl::CHssMgmtImpl()" );
       
    48     }
       
    49 
       
    50 // Symbian 2nd phase constructor can leave.
       
    51 void CHssMgmtImpl::ConstructL()
       
    52     {
       
    53     DEBUG( "CHssMgmtImpl::ConstructL()" );
       
    54     User::LeaveIfError( iServer.Connect() );
       
    55     }
       
    56 
       
    57 // Static constructor.
       
    58 CHssMgmtImpl* CHssMgmtImpl::NewL()
       
    59     {
       
    60     DEBUG( "CHssMgmtImpl::NewL()" );
       
    61     CHssMgmtImpl* self = new (ELeave) CHssMgmtImpl;
       
    62     CleanupStack::PushL( self );    
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     return self;
       
    66     }
       
    67     
       
    68 // Destructor
       
    69 CHssMgmtImpl::~CHssMgmtImpl()
       
    70     {
       
    71     DEBUG( "CHssMgmtImpl::~CHssMgmtImpl()" );
       
    72     iServer.Close();
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CHssMgmtImpl::ActivateNotificationsL
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 void CHssMgmtImpl::ActivateNotificationsL( MHssMgmtNotifications& aCallback )
       
    80     {
       
    81     DEBUG( "CHssMgmtImpl::ActivateNotificationsL()" );   
       
    82 	iClientNotification = &aCallback;
       
    83 	iServer.ActivateNotificationsL( *this );
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------
       
    87 // CHssMgmtImpl::CancelNotifications
       
    88 // ---------------------------------------------------------
       
    89 //
       
    90 void CHssMgmtImpl::CancelNotifications()
       
    91     {
       
    92     DEBUG( "CHssMgmtImpl::CancelNotifications()" );   
       
    93 	iServer.CancelNotifications();
       
    94 	iClientNotification = NULL;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CHssMgmtImpl::GetScanResults
       
    99 // ---------------------------------------------------------
       
   100 //
       
   101 TInt CHssMgmtImpl::GetScanResults( CHssMgmtScanInfo& aResults )
       
   102     {
       
   103     DEBUG( "CHssMgmtImpl::GetScanResults() " );
       
   104     // Because CHssMgmtScanInfo has been initialized through ECom
       
   105     // interface, the object is actually CHssMgmtScanInfoImpl.
       
   106     CHssMgmtScanInfoImpl* impl = reinterpret_cast<CHssMgmtScanInfoImpl*>(&aResults);
       
   107     
       
   108     TInt ret(KErrNone);
       
   109     ret = iServer.GetScanResults( impl->GetInternalList() );
       
   110     if ( ret != KErrNone )
       
   111         {
       
   112         DEBUG1( "GetScanResults() returned with %d", ret );
       
   113         return ret;
       
   114         }
       
   115     TRAP( ret, impl->UpdateResultsL() );
       
   116     if ( ret != KErrNone )
       
   117         {
       
   118         DEBUG1( "UpdateResultsL() returned with %d", ret );
       
   119         }
       
   120     return ret;
       
   121     }
       
   122 
       
   123 
       
   124 // ---------------------------------------------------------
       
   125 // CHssMgmtImpl::Register
       
   126 // ---------------------------------------------------------
       
   127 //
       
   128 TUint CHssMgmtImpl::Register( const TUid aUid,
       
   129                               const TDesC& aIapName, 
       
   130                               const TUint aWaitNote )
       
   131     {
       
   132     DEBUG( "CHssMgmtImpl::Register()" );
       
   133     return iServer.Register( aUid, aIapName, aWaitNote );
       
   134     }
       
   135         
       
   136 // ---------------------------------------------------------
       
   137 // CHssMgmtImpl::UnRegister
       
   138 // ---------------------------------------------------------
       
   139 //
       
   140 TInt CHssMgmtImpl::UnRegister( const TUid aUid,
       
   141                                const TUint aIapId, 
       
   142                                const TUint aNetworkId )
       
   143     {
       
   144     DEBUG( "CHssMgmtImpl::UnRegister()" );
       
   145     return iServer.UnRegister( aIapId, aNetworkId, aUid );	
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------
       
   149 // CHssMgmtImpl::ChangeSettings
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 TInt CHssMgmtImpl::ChangeSettings( const TUint aIapId, const THssIapSettings& aSettings )
       
   153     {
       
   154     DEBUG( "CHssMgmtImpl::ChangeSettings()" );
       
   155     return iServer.ChangeSettings( aIapId, aSettings );	
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------
       
   159 // CHssMgmtImpl::Join
       
   160 // ---------------------------------------------------------
       
   161 //
       
   162 TInt CHssMgmtImpl::Join( const TUint aIapId )
       
   163     {
       
   164     DEBUG( "CHssMgmtImpl::Join()" );
       
   165     return iServer.Join( aIapId );	
       
   166     }
       
   167 
       
   168 // ---------------------------------------------------------
       
   169 // CHssMgmtImpl::CancelStart
       
   170 // ---------------------------------------------------------
       
   171 //
       
   172 TInt CHssMgmtImpl::CancelStart( const TUint aIapId )
       
   173     {
       
   174     DEBUG( "CHssMgmtImpl::CancelStart()" );
       
   175     return iServer.CancelStart( aIapId );		
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------
       
   179 // CHssMgmtImpl::Stop
       
   180 // ---------------------------------------------------------
       
   181 //
       
   182 TInt CHssMgmtImpl::Stop( const TUint aIapId )
       
   183     {
       
   184     DEBUG( "CHssMgmtImpl::Stop()" );
       
   185     return iServer.Stop( aIapId );
       
   186     }
       
   187 
       
   188 // ---------------------------------------------------------
       
   189 // CHssMgmtImpl::LoginComplete
       
   190 // ---------------------------------------------------------
       
   191 //
       
   192 TInt CHssMgmtImpl::LoginComplete( const TUint aIapId, const TInt aStatus )
       
   193     {
       
   194     DEBUG( "CHssMgmtImpl::LoginComplete()" );
       
   195     return iServer.LoginComplete( aIapId, aStatus );
       
   196     }
       
   197 
       
   198 // ---------------------------------------------------------
       
   199 // CHssMgmtImpl::LogoutComplete
       
   200 // ---------------------------------------------------------
       
   201 //
       
   202 TInt CHssMgmtImpl::LogoutComplete( const TUint aIapId )
       
   203     {
       
   204 	DEBUG( "CHssMgmtImpl::LogoutComplete()" );
       
   205     return iServer.LogoutComplete( aIapId );
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------
       
   209 // CHssMgmtImpl::CheckBackgroundScan
       
   210 // ---------------------------------------------------------
       
   211 //
       
   212 TUint32 CHssMgmtImpl::CheckBackgroundScan()
       
   213     {
       
   214     DEBUG( "CHssMgmtImpl::CheckBackgroundScan()" );
       
   215     TInt ret(KErrNone);
       
   216     TRAPD( err, ret = iServer.CheckBackgroundScanL() );
       
   217     if ( err != KErrNone )
       
   218         {
       
   219         return err;
       
   220         }
       
   221     DEBUG1( "CheckBackgroundScan() returned with %d", ret );
       
   222     return ret;	
       
   223     }
       
   224 
       
   225 // ---------------------------------------------------------
       
   226 // CHssMgmtImpl::GetConnectionBssid
       
   227 // ---------------------------------------------------------
       
   228 //
       
   229 TInt CHssMgmtImpl::GetConnectionBssid( THssBssid& aBssId )
       
   230     {
       
   231     DEBUG( "CHssMgmtImpl::GetConnectionBssid()" );
       
   232     return iServer.GetConnectionBssid( aBssId ); 
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------
       
   236 // CHssMgmtImpl::AddIapSsidList
       
   237 // ---------------------------------------------------------
       
   238 //
       
   239 TInt CHssMgmtImpl::AddIapSsidList(
       
   240         TUint aIapId,
       
   241         const CArrayFixFlat<THssSsid>& aSsidList )
       
   242     {
       
   243     DEBUG( "CHssMgmtImpl::AddIapSsidList()" );
       
   244     return iServer.AddIapSsidList( aIapId, aSsidList ); 
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------
       
   248 // CHssMgmtImpl::NewNetworksDetected
       
   249 // ---------------------------------------------------------
       
   250 //
       
   251 void CHssMgmtImpl::NewNetworksDetected( TUint aIapId )
       
   252     {
       
   253     DEBUG( "CHssMgmtImpl::NewNetworksDetected()" );
       
   254     iClientNotification->NewNetworksDetected( aIapId );
       
   255     }
       
   256 
       
   257 // ---------------------------------------------------------
       
   258 // CHssMgmtImpl::OldNetworksLost
       
   259 // ---------------------------------------------------------
       
   260 //    
       
   261 void CHssMgmtImpl::OldNetworksLost( TUint aIapId )
       
   262     {
       
   263     DEBUG( "CHssMgmtImpl::OldNetworksLost()" );
       
   264     iClientNotification->OldNetworksLost( aIapId );
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------
       
   268 // CHssMgmtImpl::SetTimerValues
       
   269 // ---------------------------------------------------------
       
   270 //
       
   271 TInt CHssMgmtImpl::SetTimerValues(
       
   272         TUid aClientUid,
       
   273         TUint aLoginTimerValue,
       
   274         TUint aLogoutTimerValue )
       
   275     {
       
   276     DEBUG( "CHssMgmtImpl::SetTimerValues()" );
       
   277     return iServer.SetTimerValues( aClientUid, aLoginTimerValue, aLogoutTimerValue );
       
   278     }
       
   279 
       
   280 // ---------------------------------------------------------
       
   281 // CHssMgmtImpl::GetClientIaps
       
   282 // ---------------------------------------------------------
       
   283 //
       
   284 TInt CHssMgmtImpl::GetClientIaps( const TUid aUid, RArray<TUint>& aIapIdArray )
       
   285     {
       
   286     DEBUG( "CHssMgmtImpl::GetClientIaps()" );
       
   287     TRAPD( err, iServer.GetClientIapsL( aUid, aIapIdArray ) );
       
   288     DEBUG1( "CHssMgmtImpl::GetClientIaps() returned with %d", err );
       
   289     return err;	    
       
   290     }
       
   291     
       
   292 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   293 
       
   294 // ---------------------------------------------------------
       
   295 // Returns an instance of the proxy table.
       
   296 // Returns: KErrNone
       
   297 // ---------------------------------------------------------
       
   298 //
       
   299 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   300     {
       
   301     aTableCount = sizeof( ImplementationTable) / sizeof( TImplementationProxy );
       
   302     return ImplementationTable;
       
   303     }
       
   304 
       
   305 //  End of File