wvuing/wvuiada/Src/CCAImpsAccessClient.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 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:  Implements WV engine access services interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CCAImpsAccessClient.h"
       
    22 #include    "CCAAdapterDll.h"
       
    23 #include    "TCAInterfaceSignaller.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CCAImpsAccessClient::CCAImpsAccessClient
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CCAImpsAccessClient::CCAImpsAccessClient( RImpsEng& aImpsEng )
       
    34         : iImpsEng( aImpsEng )
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CCAImpsAccessClient::NewL
       
    40 // Two-phased constructor.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CCAImpsAccessClient* CCAImpsAccessClient::NewL( RImpsEng& aImpsEng )
       
    44     {
       
    45     CCAImpsAccessClient* self = new( ELeave ) CCAImpsAccessClient( aImpsEng );
       
    46     return self;
       
    47     }
       
    48 
       
    49 // Destructor
       
    50 CCAImpsAccessClient::~CCAImpsAccessClient()
       
    51     {
       
    52     delete iCIdle;
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CCAImpsAccessClient::InterfaceL
       
    57 // Returns registered WV Engine interface. Implements lazy initialization.
       
    58 // (other items were commented in a header).
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 RImpsAccessClient2* CCAImpsAccessClient::InterfaceL()
       
    62     {
       
    63     if ( iLazyInitialization )
       
    64         {
       
    65         iClient.RegisterL( iImpsEng, iAccessHandler, iPriority );
       
    66         iLazyInitialization = EFalse;
       
    67         iRegistered = ETrue;
       
    68         if ( iErrorHandler )
       
    69             {
       
    70             iClient.RegisterErrorObserverL( *iErrorHandler );
       
    71             }
       
    72         if ( iStatusHandler )
       
    73             {
       
    74             iClient.RegisterStatusObserverL( iStatusHandler );
       
    75             }
       
    76         // register all the client interfaces immediately, otherwise
       
    77         // client might miss events from network
       
    78         TCAInterfaceSignaller::RegisterAllL();
       
    79         }
       
    80     return &iClient;
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CCAImpsAccessClient::RegisterL
       
    85 // Stores values for later registration. Implements lazy initialization.
       
    86 // (other items were commented in a header).
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CCAImpsAccessClient::RegisterL( MImpsAccessHandler2* aObserver,
       
    90                                      TInt aPriority /* = 0  */ )
       
    91     {
       
    92     iPriority = aPriority;
       
    93     iAccessHandler = aObserver;
       
    94     iLazyInitialization = ETrue;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CCAImpsAccessClient::Unregister
       
    99 // Unregisters if registered. Clears member variables.
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CCAImpsAccessClient::Unregister()
       
   104     {
       
   105     if ( iRegistered )
       
   106         {
       
   107         iClient.Unregister();
       
   108         }
       
   109     iAccessHandler = NULL;
       
   110     iLazyInitialization = ETrue;
       
   111     iRegistered = EFalse;
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CCAImpsAccessClient::LoginL
       
   116 // Forwards the call to WV Engine.
       
   117 // (other items were commented in a header).
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 TInt CCAImpsAccessClient::LoginL( TImpsCspIdentifier aCspId,
       
   121                                   const TDesC& aPsw,
       
   122                                   const TDesC& aClientId,
       
   123                                   TUint32 aAP,
       
   124                                   const TDesC* aKey1 /*= NULL*/,
       
   125                                   const TDesC* aKey2 /*= NULL*/ )
       
   126     {
       
   127     return InterfaceL()->ReactiveLoginL( aCspId, aPsw, aClientId, aAP, aKey1,
       
   128                                          aKey2 );
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CCAImpsAccessClient::LogoutL
       
   133 // Forwards the call to WV Engine.
       
   134 // (other items were commented in a header).
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 TInt CCAImpsAccessClient::LogoutL()
       
   138     {
       
   139     return InterfaceL()->LogoutL();
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CCAImpsAccessClient::NumberOfSessionsL
       
   144 // Forwards the call to WV Engine.
       
   145 // (other items were commented in a header).
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 TInt CCAImpsAccessClient::NumberOfSessionsL( TImpsCspIdentifier& aCspId )
       
   149     {
       
   150     return InterfaceL()->NumberOfSessionsL( aCspId );
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CCAImpsAccessClient::GetServicesL
       
   155 // Forwards the call to WV Engine.
       
   156 // (other items were commented in a header).
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 void CCAImpsAccessClient::GetServicesL( TImpsServices& aServices )
       
   160     {
       
   161     InterfaceL()->GetServicesL( aServices );
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CCAImpsAccessClient::RegisterErrorObserverL
       
   166 // Calls WV Engine if registered.
       
   167 // (other items were commented in a header).
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 void CCAImpsAccessClient::RegisterErrorObserverL( MImpsErrorHandler2& aObs )
       
   171     {
       
   172     iErrorHandler = &aObs;
       
   173     if ( iRegistered )
       
   174         {
       
   175         InterfaceL()->RegisterErrorObserverL( *iErrorHandler );
       
   176         }
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CCAImpsAccessClient::UnregisterErrorObserverL
       
   181 // Calls WV Engine always.
       
   182 // (other items were commented in a header).
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CCAImpsAccessClient::UnregisterErrorObserverL()
       
   186     {
       
   187     iErrorHandler = NULL;
       
   188     iClient.UnregisterErrorObserverL();
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CCAImpsAccessClient::RegisterStatusObserverL
       
   193 // Calls WV Engine if registered.
       
   194 // (other items were commented in a header).
       
   195 // -----------------------------------------------------------------------------
       
   196 //
       
   197 void CCAImpsAccessClient::RegisterStatusObserverL( MImpsStatusHandler2* aObs )
       
   198     {
       
   199     iStatusHandler = aObs;
       
   200     if ( iRegistered )
       
   201         {
       
   202         InterfaceL()->RegisterStatusObserverL( iStatusHandler );
       
   203         }
       
   204     }
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CCAImpsAccessClient::UnregisterStatusObserverL
       
   208 // Calls WV Engine always.
       
   209 // (other items were commented in a header).
       
   210 // -----------------------------------------------------------------------------
       
   211 //
       
   212 void CCAImpsAccessClient::UnregisterStatusObserverL()
       
   213     {
       
   214     iClient.UnregisterStatusObserverL();
       
   215     }
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // CCAImpsAccessClient::StatusHandler
       
   219 // Returns current status handler.
       
   220 // (other items were commented in a header).
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 MImpsStatusHandler2* CCAImpsAccessClient::StatusHandler() const
       
   224     {
       
   225     return iStatusHandler;
       
   226     }
       
   227 
       
   228 // -----------------------------------------------------------------------------
       
   229 // CCAImpsAccessClient::ErrorHandler
       
   230 // Returns current error handler.
       
   231 // (other items were commented in a header).
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 MImpsErrorHandler2* CCAImpsAccessClient::ErrorHandler() const
       
   235     {
       
   236     return iErrorHandler;
       
   237     }
       
   238 
       
   239 //  End of File